johanhelsing / bevy_smud

Sdf 2d shape renderer for Bevy
Other
143 stars 10 forks source link

Shader compilation errors on "fwidth" on wasm #1

Closed johanhelsing closed 2 years ago

johanhelsing commented 2 years ago

I think this is a bug in wasm/naga.

A workaround in the meantime would be to just disable the derivative-based anti-alias fills on wasm. Perhaps it could be done with shader defines.

johanhelsing commented 2 years ago

Turns out this was because both the fragment shader and vertex shader share the same code, and if there are fwidth calls in functions (even though they are not called), the vertex shader fails to compile.

Can be fixed by just adding shader defs for the fragment pass and conditionally include the functions containing fwidth.

johanhelsing commented 2 years ago

gfx-rs/wgpu#4368