Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

pipeline that reuse the same binding group between vertex and fragment crash on Safari #1617

Closed
mockersf opened this issue Dec 20, 2021 · 2 comments
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: GLSL OpenGL Shading Language

Comments

@mockersf
Copy link
Contributor

Using Bevy pbr pipeline because I'm not really up to write my own pipelines.

Bevy is using the same shader for both fragment and vertex stages, and sharing some of the data structures between both. There are also two binding groups that are shared:

In the shader in wsgl:

[[group(0), binding(0)]]
var<uniform> view: View;

// other binding that are bound only in the fragment stage
...

[[group(2), binding(0)]]
var<uniform> mesh: Mesh;

In the vertex shader in glsl:

uniform View_block_0Vertex { View _group_0_binding_0; };
uniform Mesh_block_1Vertex { Mesh _group_2_binding_0; };

In the fragment shader in glsl:

uniform View_block_0Fragment { View _group_0_binding_0; };
uniform Mesh_block_5Fragment { Mesh _group_2_binding_0; };

This works under Firefox and Chrome, but gives an error with Safari:

"wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_opaque_mesh_pipeline`
    Internal error in VERTEX | FRAGMENT | VERTEX_FRAGMENT shader: Name conflicts between uniform block field names: _group_0_binding_0


"

If I change the glsl back in naga by removing the ID and stage from:

naga/src/back/glsl/mod.rs

Lines 895 to 900 in c2328fe

let block_name = format!(
"{}_block_{}{:?}",
ty_name,
self.block_id.generate(),
self.entry_point.stage,
);

It works again with Safari, and also Firefox and Chrome.

I can submit a PR, but I'm not sure if this is the right fix, or other impacts that it may have

@kvark kvark added area: back-end Outputs of shader conversion kind: bug Something isn't working lang: GLSL OpenGL Shading Language labels Dec 20, 2021
@mockersf
Copy link
Contributor Author

probably a duplicate of #1615 , and fixed by #1616

@parasyte
Copy link
Contributor

This should be fixed in 0.8.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: GLSL OpenGL Shading Language
Projects
None yet
Development

No branches or pull requests

3 participants