WGSL built-in similar to gl_DrawID
(for Multi Draw Indirect)
#6823
Labels
api: dx12
Issues with DX12 or DXGI
api: metal
Issues with Metal
api: vulkan
Issues with Vulkan
area: api
Issues related to API surface
area: naga back-end
Outputs of naga shader conversion
area: naga front-end
lang: HLSL
D3D Shading Language
lang: Metal
Metal Shading Language
lang: SPIR-V
Vulkan's Shading Language
lang: WGSL
WebGPU Shading Language
naga
Shader Translator
type: enhancement
New feature or request
Is your feature request related to a problem? Please describe.
When using Multi Draw Indirect, there is no way for the shader to know what draw it is a part of.
GLSL in OpenGL provides the
gl_DrawID
built-in for this purpose. WGSL does not have an equivalent.(AFAIK, the WebGPU spec does not have MDI at all? I am not sure. That would explain the lack of such builtin in WGSL.)
Describe the solution you'd like
Naga could add support for a
draw_index
built-in, similar tovertex_index
andinstance_index
. Even though this is not part of the upstream WGSL spec.Describe alternatives you've considered
Depending on the use case, it may be possible to work around this by using the instance IDs instead.
The text was updated successfully, but these errors were encountered: