Skip to content

feat(core): Handle webgpu constant attributes efficiently - #10567

Merged
Pessimistress merged 2 commits into
masterfrom
x/constant-attr
Aug 20, 2026
Merged

Pessimistress merged 2 commits into
masterfrom
x/constant-attr

Conversation

@Pessimistress

Copy link
Copy Markdown
Collaborator

Change List

  • WebGPU constants now allocate one row only and use vertex-buffer stride 0.
  • AttributeBufferGroups now accepts constants as inputs

@Pessimistress
Pessimistress requested a review from ibgreen August 19, 2026 23:38
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Greptile Summary

The PR replaces per-instance expansion of WebGPU constant attributes with one-row buffers and zero-stride layouts.

  • Preserves raw constant vertex-format bytes for grouped interleaving.
  • Adds constant-input support to mixed and all-constant attribute buffer groups.
  • Extends WebGPU handling for double-precision attributes and adds focused coverage for standalone and grouped constants.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defects identified.

The changed paths consistently retain one constant row, expose it through zero-stride WebGPU layouts, and cover both standalone and grouped attribute bindings without an established contract violation.

Important Files Changed

Filename Overview
modules/core/src/lib/attribute/attribute.ts Retains one raw constant row, uploads it once per assignment, and exposes it for WebGPU buffer grouping.
modules/core/src/lib/attribute/data-column.ts Exposes WebGPU constants as one-row buffers with zero-stride layouts and handles double-precision companion attributes.
modules/core/src/lib/attribute/attribute-buffer-groups.ts Accepts constants as interleave inputs, preserves their underlying bytes, and emits a one-row zero-stride buffer for all-constant groups.
test/modules/core/lib/attribute/attribute-buffer-groups.spec.ts Covers constant broadcasting in mixed groups and compact zero-stride output for all-constant groups.
test/modules/core/lib/attribute/attribute-manager.spec.ts Updates WebGPU attribute-manager expectations to retain constants as single rows.
test/modules/core/lib/attribute/attribute.spec.ts Verifies standalone and updater-backed WebGPU constants use one-row buffers and zero-stride layouts.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Constant attribute value] --> B[Normalize one vertex row]
  B --> C[Upload one-row WebGPU buffer]
  C --> D{Buffer group?}
  D -- No --> E[Standalone zero-stride layout]
  D -- Mixed group --> F[Broadcast during interleaving]
  D -- All constants --> G[Pack one row with zero stride]
  E --> H[Model attribute binding]
  F --> H
  G --> H
Loading

Reviews (1): Last reviewed commit: "scope attribute.constant flag reset to w..." | Re-trigger Greptile

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 82.439% (-0.06%) from 82.497% — x/constant-attr into master

@Pessimistress
Pessimistress merged commit 717c328 into master Aug 20, 2026
7 checks passed
@Pessimistress
Pessimistress deleted the x/constant-attr branch August 20, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants