How to tell shaderc not to strip away unused bindings?

126 Views Asked by At

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.

0

There are 0 best solutions below