glslang icon indicating copy to clipboard operation
glslang copied to clipboard

Source not included with emitNonSemanticShaderDebugSource

Open spencer-lunarg opened this issue 11 months ago • 1 comments

If I have a simple shader like

#version 450
#extension GL_EXT_shader_8bit_storage: enable
#extension GL_EXT_shader_explicit_arithmetic_types_int8: enable
layout(push_constant) uniform PushConstant {
    int8_t x[4];
} data;

void main(){
    gl_Position = vec4(float(data.x[0]) * 0.0);
}

and run glslang -gVS I will see the OpString with all the source, but going

glslang::SpvOptions spv_options;
spv_options.emitNonSemanticShaderDebugSource = true;
glslang::GlslangToSpv(*program.getIntermediate(stage), spirv, &spv_options);

I only get

         %19 = OpString "// OpModuleProcessed client vulkan100
// OpModuleProcessed target-env vulkan1.0
// OpModuleProcessed entry-point main
#line 1
"

spencer-lunarg avatar Feb 03 '25 17:02 spencer-lunarg

You have to additionally call glslang_program_add_source_text before glslang_program_SPIRV_generate. This doesn't make sense to me either.

Novum avatar Jul 25 '25 19:07 Novum