Using @builtin(sample_mask)
in a fragment shader with OpenGL panics due to a naga translation error
#6085
Labels
area: naga back-end
Outputs of naga shader conversion
lang: GLSL
OpenGL Shading Language
naga
Shader Translator
type: bug
Something isn't working
Description
When using the built-in variable
sample_mask
in a wgsl fragment shader, naga produces incorrect glsl, leading to a panic when using OpenGL.Repro steps
Given the following wgsl (which I will call
sample_mask.wgsl
):Running the command
naga sample_mask.wgsl sample_mask.frag
produces the following output:The problematic line is line 9:
According to the spec,
gl_SampleMaskIn
is an array, so the correct line should be:Additionally, according to the spec, it appears that
gl_SampleMaskIn
is only supported in GLES version 3.20, so naga should probably also update the first line from#version 310 es
to#version 320 es
.Expected vs observed behavior
Shaders using
sample_mask
works fine in Vulkan and DX12, but cause a panic in OpenGL.Platform
This happens both when using the naga command line version 22.0.0, in a simple test program using wgpu 22.1.0, and in my application that uses wgpu 0.20.0.
The text was updated successfully, but these errors were encountered: