dep/reshadefx: Cherry-pick upstream 74e95dd

This commit is contained in:
Stenzek 2025-10-27 22:12:06 +10:00
parent 05701fef41
commit fcde8c7765
No known key found for this signature in database

View File

@ -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<char> &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())