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

Vertex-pulling transform generates invalid metal code in certain cases #7410

Open
andyleiserson opened this issue Mar 24, 2025 · 0 comments · May be fixed by #7458
Open

Vertex-pulling transform generates invalid metal code in certain cases #7410

andyleiserson opened this issue Mar 24, 2025 · 0 comments · May be fixed by #7458
Assignees
Labels
area: correctness We're behaving incorrectly area: naga back-end Outputs of naga shader conversion backend: metal Issues with Metal lang: Metal Metal Shading Language type: bug Something isn't working

Comments

@andyleiserson
Copy link
Contributor

andyleiserson commented Mar 24, 2025

This is from one of the demos in https://bugzilla.mozilla.org/show_bug.cgi?id=1866068. The render pipeline descriptor defines an input with format float32x3, but the shader consumes it as a vec2f. The naga-generated metal shader is invalid because it attempts to cast the vec3f return value from unpackFloat32x3 (a helper function generated by the vertex-pulling transform) into a vec2f based on the declared type of texcoord in the shader:

7410-vertex-format-mismatch.metal:41:20: error:  from vector 'metal::float3' (aka 'float3') to vector 'metal::float2' (aka 'float2') of different size
        texcoord = metal::float2(unpackFloat32x3_(vb_1_elem.data[32], vb_1_elem.data[33], vb_1_elem.data[34], vb_1_elem.data[35], vb_1_elem.data[36], vb_1_elem.data[37], vb_1_elem.data[38], vb_1_elem.data[39], vb_1_elem.data[40], vb_1_elem.data[41], vb_1_elem.data[42], vb_1_elem.data[43]));
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Test case: 7410.tar.gz

@andyleiserson andyleiserson added area: correctness We're behaving incorrectly area: naga back-end Outputs of naga shader conversion backend: metal Issues with Metal lang: Metal Metal Shading Language type: bug Something isn't working labels Mar 24, 2025
@andyleiserson andyleiserson self-assigned this Mar 24, 2025
andyleiserson added a commit to andyleiserson/wgpu that referenced this issue Mar 24, 2025
andyleiserson added a commit to andyleiserson/wgpu that referenced this issue Apr 1, 2025
@andyleiserson andyleiserson linked a pull request Apr 1, 2025 that will close this issue
6 tasks
@andyleiserson andyleiserson moved this from Todo to In Progress in WebGPU for Firefox Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: correctness We're behaving incorrectly area: naga back-end Outputs of naga shader conversion backend: metal Issues with Metal lang: Metal Metal Shading Language type: bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant