shader_recompiler/EXIT: skip render targets with no outputs

This commit is contained in:
Liam 2022-03-18 09:26:25 -04:00
parent 6fa17f3372
commit d400b618a7
2 changed files with 8 additions and 0 deletions

View file

@ -12,6 +12,9 @@ void ExitFragment(TranslatorVisitor& v) {
const ProgramHeader sph{v.env.SPH()}; const ProgramHeader sph{v.env.SPH()};
IR::Reg src_reg{IR::Reg::R0}; IR::Reg src_reg{IR::Reg::R0};
for (u32 render_target = 0; render_target < 8; ++render_target) { for (u32 render_target = 0; render_target < 8; ++render_target) {
if (!sph.ps.HasOutputComponents(render_target)) {
continue;
}
const std::array<bool, 4> mask{sph.ps.EnabledOutputComponents(render_target)}; const std::array<bool, 4> mask{sph.ps.EnabledOutputComponents(render_target)};
for (u32 component = 0; component < 4; ++component) { for (u32 component = 0; component < 4; ++component) {
if (!mask[component]) { if (!mask[component]) {

View file

@ -196,6 +196,11 @@ struct ProgramHeader {
return {(bits & 1) != 0, (bits & 2) != 0, (bits & 4) != 0, (bits & 8) != 0}; return {(bits & 1) != 0, (bits & 2) != 0, (bits & 4) != 0, (bits & 8) != 0};
} }
[[nodiscard]] bool HasOutputComponents(u32 rt) const noexcept {
const u32 bits{omap.target >> (rt * 4)};
return bits & (1 | 2 | 4 | 8);
}
[[nodiscard]] std::array<PixelImap, 4> GenericInputMap(u32 attribute) const { [[nodiscard]] std::array<PixelImap, 4> GenericInputMap(u32 attribute) const {
const auto& vector{imap_generic_vector[attribute]}; const auto& vector{imap_generic_vector[attribute]};
return {vector.x, vector.y, vector.z, vector.w}; return {vector.x, vector.y, vector.z, vector.w};