Skip to content
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

Can't use precompiled shader with optimization #1896

Closed
inferrna opened this issue May 10, 2022 · 2 comments · Fixed by #1945
Closed

Can't use precompiled shader with optimization #1896

inferrna opened this issue May 10, 2022 · 2 comments · Fixed by #1945

Comments

@inferrna
Copy link

  • Version of vulkano: 0.29
  • OS: Ubuntu 20.04
  • GPU (the selected PhysicalDevice): AMD RX560
  • GPU Driver: Both Mesa / AMDVLK

Code example
https://github.com/inferrna/smart_denoise_rs

Issue

There are two precompiled shaders in the repo:
compiled_opt.spv produced with ./bin/glslc -fshader-stage=compute shader.glsl
and
compiled_unopt.spv produced with ./bin/glslc -fshader-stage=compute -O shader.glsl

Using unoptimized version in src/denoise_shader_compiled.rs works fine but with optimized I got this error at compile stage:

1 | / vulkano_shaders::shader! {
2 | |         ty: "compute",
3 | |         bytes: "compiled_opt.spv"
4 | | }
  | | ^
  | | |
  | |_field already declared
  |   `__unnamed` first declared here

Using latest glslc from here https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html

@Rua
Copy link
Contributor

Rua commented May 11, 2022

It seems like the names of variables have been stripped out by optimising it, so when Vulkano is trying to assign names to struct fields, it can't find any names and so it just goes with "unnamed". What it really should do in this case is add numbers so that the names don't conflict anymore.

@inferrna
Copy link
Author

inferrna commented May 11, 2022

Passing -g flag to glslc seems solved the issue for me:
./bin/glslc -g -fshader-stage=compute -O shader.glsl

But bad naming for unnamed fields is still the issue for vulkano, so I keep this open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants