2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #8038 from liamwhite/exit-register-detection

shader_recompiler/EXIT: increment output register on failed enable test
This commit is contained in:
Ameer J 2022-03-21 21:24:07 -04:00 committed by GitHub
commit 75046a3351
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -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));

View file

@ -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};