vk/gl: Mark unused FP outputs as unused

This commit is contained in:
kd-11
2025-12-13 14:35:31 +03:00
committed by kd-11
parent 0536ad3b23
commit 5e4c2433c1
2 changed files with 27 additions and 6 deletions
+12 -1
View File
@@ -103,7 +103,18 @@ void GLFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
const auto reg_type = float_type ? "vec4" : getHalfTypeName(4); const auto reg_type = float_type ? "vec4" : getHalfTypeName(4);
for (uint i = 0; i < std::size(table); ++i) for (uint i = 0; i < std::size(table); ++i)
{ {
if (m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second)) if (!m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second))
{
continue;
}
if (i >= m_prog.mrt_buffers_count)
{
// Dead writes. Declare as temp variables for DCE to clean up.
OS << "vec4 " << table[i].first << "; // Unused\n";
continue;
}
OS << "layout(location=" << i << ") out vec4 " << table[i].first << ";\n"; OS << "layout(location=" << i << ") out vec4 " << table[i].first << ";\n";
} }
} }
+12 -2
View File
@@ -156,13 +156,23 @@ void VKFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
const auto reg_type = float_type ? "vec4" : getHalfTypeName(4); const auto reg_type = float_type ? "vec4" : getHalfTypeName(4);
for (uint i = 0; i < std::size(table); ++i) for (uint i = 0; i < std::size(table); ++i)
{ {
if (m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second)) if (!m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second))
{ {
continue;
}
if (i >= m_prog.mrt_buffers_count)
{
// Dead writes. Declare as temp variables for DCE to clean up.
OS << "vec4 " << table[i].first << "; // Unused\n";
vk_prog->output_color_masks[i] = 0;
continue;
}
OS << "layout(location=" << std::to_string(output_index++) << ") " << "out vec4 " << table[i].first << ";\n"; OS << "layout(location=" << std::to_string(output_index++) << ") " << "out vec4 " << table[i].first << ";\n";
vk_prog->output_color_masks[i] = -1; vk_prog->output_color_masks[i] = -1;
} }
} }
}
void VKFragmentDecompilerThread::insertConstants(std::stringstream & OS) void VKFragmentDecompilerThread::insertConstants(std::stringstream & OS)
{ {