johanhelsing/bevy_smud

Shader compilation errors on "fwidth" on wasm

johanhelsing opened this issue · 2 comments

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.

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.