Skip to content

add sample_index and sample_mask builtin variables #1317

@dneto0

Description

@dneto0

WebGPU supports modifying the sample mask in the fragment shader. See https://gpuweb.github.io/gpuweb/#sample-masking
There's an open issue to link to the "SV_SampleIndex" and "SV_Coverage" semantics in WGSL.

Across languages:

sample_index, input:

  • SPIR-V: SampleId variable, array of 32-bit integer scalar values, input only.
  • GLSL: in int gl_SampleID;
  • HLSL: uint SV_SampleIndex, input or output
  • MSL: uint sample_id input

sample_mask:

  • SPIR-V: SampleMask variable, with 32-bit integer array, input or output. Number of elements of in the array is bounded above by max num samples supported by the implementation. (1 if at most 32 samples, 2 if at most 64 samples.)
  • GLSL: in int gl_SampleMask[];
  • HLSL: uint SV_SampleMask, input or output
  • MSL: uint sample_mask input or output

Proposal: Add builtin variables sample_index with u32 value, sample_mask with u32 value.

Metadata

Metadata

Assignees

Labels

wgslWebGPU Shading Language Issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions