-
Notifications
You must be signed in to change notification settings - Fork 933
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
[naga/spv-in] Naga seems unable to consume any simple vertex shader from glslc due to gl_PerVertex attributes. #4915
Comments
The
Related: KhronosGroup/SPIRV-Tools#365 |
The problem here is the use of wgpu/naga/src/front/spv/function.rs Lines 375 to 383 in 4675737
I can't get For the record, this works: (I wasn't even aware that the |
Found the original addition of that logic: IMO it should be checking for a
As per the Vulkan spec that should uniquely identify the "builtin interface block" used by some entry-point). Hopefully that's enough to allow ignoring names completely (cc @teoxoy @jimblandy). |
glslc has been around since vk1.0, and is referenced as the preferred compiler (of the author) in the Vulkan Tutorial. I'd wager I'm not alone in treating it as the defacto standard for glsl -> spirv, although to be fair glslangValidator is referenced quite a lot aswell. |
It's possible I missed it because I've been ignoring Anyway, that was there just to explain why I wouldn't have produced SPIR-V that causes Naga problems, and this may hold true for others as well. And I do agree Naga should support all ways to define those builtins, if it has special logic for any of them. Btw, if anyone wants to rename the issue, mentioning |
Yeah, I can understand that. Since Vulkans inception, it's been a lot less like a product from a single group. The tooling and whatknot came from a bunch of different people and the ecosystem sort of emerged, the VulkanSDK does a reasonable job of collecting them into one place in a ready to use state. Giving you Good times, anyway I digress, I hope this title is more useful. |
While attempting to implement the solution suggested here #4915 (comment), I stumbled onto this piece of code that was added in gfx-rs/naga#789: wgpu/naga/src/front/spv/mod.rs Lines 5130 to 5135 in 84ba4e5
I wonder if just checking for this name in addition to "gl_PerVertex" would be reliable enough? |
I think we can just remove the |
See gfx-rs/wgpu#4915 Also: * Remove unused vert-out frag-in variables from shaders (naga doesn't like this probably because they are optimized out on the fragment side). This restriction from naga may be relaxed in the future see gfx-rs/wgpu#3748. * Enable OptimizationLevel::Performance for shaderc by default * Add a environment variable VOXYGEN_SHADERC_OPTS for disabling this (e.g. to test if it actually makes a difference on any platform). (TODO: testing might be easier if there was a way to do toggle it without restarting...)
See gfx-rs/wgpu#4915 Also: * Remove unused vert-out frag-in variables from shaders (naga doesn't like this probably because they are optimized out on the fragment side). This restriction from naga may be relaxed in the future see gfx-rs/wgpu#3748. * Enable OptimizationLevel::Performance for shaderc by default * Add a environment variable VOXYGEN_SHADERC_OPTS for disabling this (e.g. to test if it actually makes a difference on any platform). (TODO: testing might be easier if there was a way to do toggle it without restarting...)
Description
There seems to be something off when attempting to feed a simple vertex shader into naga, due to unused clip distance being present.
Repro steps
fullscreen.vert:
Building:
And the resulting error:
For reference here is the spirv-dis:
There is a rather inconvenient workaround, which is to
spirv-cross
the spv back into glsl and feed that in.Platform
On x64 Win10, using the latest naga and vulkansdk.
naga version:
0.14.0
glslc version:
The text was updated successfully, but these errors were encountered: