Skip to content

Document the sample_mask WGSL builtin - #1161

Open
mvaligursky wants to merge 1 commit into
mainfrom
mv-wgsl-sample-mask
Open

Document the sample_mask WGSL builtin#1161
mvaligursky wants to merge 1 commit into
mainfrom
mv-wgsl-sample-mask

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Important

Do not merge until Engine 2.22 is released. The sample_mask builtin support ships in Engine 2.22 (playcanvas/engine#9222, merged to main). Merge once 2.22 is out.

Documents the WGSL sample_mask builtin on the WGSL Vertex and Fragment Shaders page, alongside the existing sampleIndex / fragDepth builtins (WebGPU only).

Changes:

  • FragmentInput builtins: sampleMask: @builtin(sample_mask) (the fragment's MSAA coverage mask), also available in global scope as pcSampleMask.
  • Fragment Shader Outputs: sampleMask: @builtin(sample_mask) next to fragDepth, with a short explanation of the semantics (the written mask is AND-ed with the coverage mask by the GPU, allowing per-sample discard - the basis of custom alpha-to-coverage dither patterns) and a minimal example.
  • Japanese translation updated to match.

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.

1 participant