Skip to content

Fix phantom sampler binding for a trailing texture in WGSL reflection - #9198

Merged
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-phantom-sampler
Aug 20, 2026
Merged

Fix phantom sampler binding for a trailing texture in WGSL reflection#9198
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-phantom-sampler

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

WGSL reflection fabricated a sampler binding for a texture declared as the last resource in a shader: resources[i + 1] is undefined, so hasSampler ended up undefined and fell through to BindTextureFormat's hasSampler = true default — adding a phantom sampler slot to the bind group layout and emitting an unused ${name}_sampler declaration.

Extracted from #9167 (thanks @SashaRX for spotting this) so the fix can land independently.

Changes:

  • WebgpuShaderProcessorWGSL: hasSampler defaults to false when no resource follows the texture (?? false).
  • Regression test: a trailing texture_2d<f32> reflects with hasSampler: false, a single slot, and no fabricated sampler declaration.

Co-authored-by: SashaRX <alexander.komendant@spistudios.com>
@github-actions

Copy link
Copy Markdown

Build size report

This PR changes the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2371.4 KB (+0.0 KB, +0.00%) 609.4 KB (−0.0 KB, −0.00%) 473.3 KB (+0.3 KB, +0.07%)
playcanvas.min.mjs 2368.8 KB (+0.0 KB, +0.00%) 608.3 KB (+0.0 KB, +0.00%) 472.6 KB (−0.1 KB, −0.02%)

@mvaligursky
mvaligursky merged commit a73bfdb into main Aug 20, 2026
10 checks passed
@mvaligursky
mvaligursky deleted the mv-wgsl-phantom-sampler branch August 20, 2026 10:28
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant