summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmeer J <52414509+ameerj@users.noreply.github.com>2022-03-22 02:24:07 +0100
committerGitHub <noreply@github.com>2022-03-22 02:24:07 +0100
commit75046a3351effbe4054299ec4237cfcf5862fdc2 (patch)
tree4cb9127fa8aa989d55842fd1f87d4cf2677db2ad
parentMerge pull request #8048 from ameerj/include-purge (diff)
parentAddress review comments (diff)
downloadyuzu-75046a3351effbe4054299ec4237cfcf5862fdc2.tar
yuzu-75046a3351effbe4054299ec4237cfcf5862fdc2.tar.gz
yuzu-75046a3351effbe4054299ec4237cfcf5862fdc2.tar.bz2
yuzu-75046a3351effbe4054299ec4237cfcf5862fdc2.tar.lz
yuzu-75046a3351effbe4054299ec4237cfcf5862fdc2.tar.xz
yuzu-75046a3351effbe4054299ec4237cfcf5862fdc2.tar.zst
yuzu-75046a3351effbe4054299ec4237cfcf5862fdc2.zip
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/exit_program.cpp4
-rw-r--r--src/shader_recompiler/program_header.h5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/exit_program.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/exit_program.cpp
index 6cd13ec48..62d20ebe4 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/exit_program.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/exit_program.cpp
@@ -11,9 +11,13 @@ void ExitFragment(TranslatorVisitor& v) {
const ProgramHeader sph{v.env.SPH()};
IR::Reg src_reg{IR::Reg::R0};
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)};
for (u32 component = 0; component < 4; ++component) {
if (!mask[component]) {
+ ++src_reg;
continue;
}
v.ir.SetFragColor(render_target, component, v.F(src_reg));
diff --git a/src/shader_recompiler/program_header.h b/src/shader_recompiler/program_header.h
index bd6c2bfb5..0cd6597ef 100644
--- a/src/shader_recompiler/program_header.h
+++ b/src/shader_recompiler/program_header.h
@@ -196,6 +196,11 @@ struct ProgramHeader {
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 & 0xf) != 0;
+ }
+
[[nodiscard]] std::array<PixelImap, 4> GenericInputMap(u32 attribute) const {
const auto& vector{imap_generic_vector[attribute]};
return {vector.x, vector.y, vector.z, vector.w};