1

I am having an issue compiling HLSL to spirv. Shaderc will detect unused uniform bindings and optimize them out (it does not do this with glsl only with hlsl). This in turn makes it hard to debug my shaders, as I am trying to send data to undeclared bindings in the shader.

Is there a way to instruct shaderc to retain the symbols?

    let compiler = shaderc::Compiler::new().unwrap();
    let mut options = shaderc::CompileOptions::new().unwrap();
    options.set_include_callback(shader_include);

    if *shader_lang == ShaderLanguage::HLSL
    {
        options.set_source_language(shaderc::SourceLanguage::HLSL);
    }

I tried setting optimizaitons to 0 but no luck.

Makogan
  • 8,208
  • 7
  • 44
  • 112
  • https://github.com/google/shaderc/issues/1244 this seems related, are the flags mentioned in issue being passed to spriv-opt in your project? – mateeeeeee Mar 08 '23 at 16:29

0 Answers0