diff --git a/dep/reshadefx/src/effect_codegen_spirv.cpp b/dep/reshadefx/src/effect_codegen_spirv.cpp index 299a1231a..80e2295c4 100644 --- a/dep/reshadefx/src/effect_codegen_spirv.cpp +++ b/dep/reshadefx/src/effect_codegen_spirv.cpp @@ -306,8 +306,6 @@ private: // All debug instructions for (const spirv_instruction &inst : _debug_a.instructions) inst.write(spirv); - for (const spirv_instruction &inst : _debug_b.instructions) - inst.write(spirv); } } void finalize_type_and_constants_section(std::basic_string &spirv) const @@ -350,6 +348,9 @@ private: finalize_debug_info_section(spirv); + for (const spirv_instruction& inst : _debug_b.instructions) + inst.write(spirv); + // All annotation instructions for (const spirv_instruction &inst : _annotations.instructions) inst.write(spirv); @@ -459,6 +460,16 @@ private: finalize_debug_info_section(spirv); + for (const spirv_instruction &inst : _debug_b.instructions) + { + // Remove all names of interface variables and functions for non-matching entry points + if (std::find(variables_to_remove.begin(), variables_to_remove.end(), inst.operands[0]) != variables_to_remove.end() || + std::find(functions_to_remove.begin(), functions_to_remove.end(), inst.operands[0]) != functions_to_remove.end()) + continue; + + inst.write(spirv); + } + // All annotation instructions for (spirv_instruction inst : _annotations.instructions) { @@ -501,9 +512,8 @@ private: if (func.definition.instructions.empty()) continue; - const bool has_line = (_debug_info && func.declaration.instructions[0].op == spv::OpLine); - assert(func.declaration.instructions[has_line ? 1 : 0].op == spv::OpFunction); - const spv::Id definition = func.declaration.instructions[has_line ? 1 : 0].result; + assert(func.declaration.instructions[func.declaration.instructions[0].op != spv::OpFunction ? 1 : 0].op == spv::OpFunction); + const spv::Id definition = func.declaration.instructions[func.declaration.instructions[0].op != spv::OpFunction ? 1 : 0].result; #if 1 if (std::find(functions_to_remove.begin(), functions_to_remove.end(), definition) != functions_to_remove.end())