Support wgsl diagnostic directives.
Wgpu added this in v24, but I didn't figure out how to get them working properly before we merged that PR so they're currently unsupported.
There's a basic test for them written. The test and the test input (though the expected output here is incorrect). The test currently panics due to the unwrap because the shader module creation is erroring for some reason.
The error stems from the directive not being prior to all global declarations i.e. not all the way at the top. I'm running into the same issue trying to use an enable directive.
(as of writing naga has the scaffolding for enable directive but there's none of them implemented, something I was about to change)
Got a hack here to make it fly for myself. This is obviously nowhere close to a shippable solution. Prodded into doing something more cleaner but not having a great time navigating the codebase and tbh it's not something I want to invest time into right now. But maybe this helps illustrate the issue :) https://github.com/Wumpf/naga_oil/commit/fcfe28070c54bafab624c2ed6c6b11d953d7a066
Hit another snag though on the Naga side: the module -> wgsl writeout that is used when targeting WebGPU isn't emitting enable directives either right now :sigh:
Hit another snag though on the Naga side: the module -> wgsl writeout that is used when targeting WebGPU isn't emitting enable directives either right now :sigh:
practically oftopic to this issue, but FYI got that part under control over on wgpu by now 🥳 (part of https://github.com/gfx-rs/wgpu/pull/7146)