Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naga should require Capabilities to accept binding_array types at all #6910

Open
jimblandy opened this issue Jan 13, 2025 · 1 comment
Open
Labels
area: naga middle-end Intermediate representation area: validation Issues related to validation, diagnostics, and error handling lang: WGSL WebGPU Shading Language naga Shader Translator

Comments

@jimblandy
Copy link
Member

Naga accepts binding_array as a type, even with no Capabilities flags set that would allow it to be used. For use in WebGPU, Naga should not even allow such variables to be declared.

For example, Firefox accepts the following shader module:

@group(0) @binding(0) var<uniform> big_xform: mat2x2<f32>;
@group(0) @binding(1) var<uniform> small_xform: mat2x2<f32>;
@group(0) @binding(2) var ba: binding_array<texture_2d<f32>>;

@vertex
fn vertex_shader(@location(0) center: vec2<f32>,
                 @location(1) corner: vec2<f32>)
                 -> @builtin(position) vec4<f32>
{
   let pos = big_xform * center + small_xform * corner;
   return vec4<f32>(pos.x, pos.y, 0.0, 1.0);
}

@fragment
fn blue() -> @location(0) vec4<f32> {
   return vec4<f32>(0.0, 0.0, 1.0, 1.0);
}
@jimblandy jimblandy added area: validation Issues related to validation, diagnostics, and error handling naga Shader Translator lang: WGSL WebGPU Shading Language labels Jan 13, 2025
@jimblandy jimblandy changed the title Naga should not accept binding_array types at all Naga should require Capabilities to accept binding_array types at all Jan 13, 2025
@cwfitzgerald cwfitzgerald added the area: naga middle-end Intermediate representation label Jan 13, 2025
@teoxoy
Copy link
Member

teoxoy commented Jan 14, 2025

Related: #4407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga middle-end Intermediate representation area: validation Issues related to validation, diagnostics, and error handling lang: WGSL WebGPU Shading Language naga Shader Translator
Projects
None yet
Development

No branches or pull requests

3 participants