diff options
| author | 2021-09-18 00:43:41 -0400 | |
|---|---|---|
| committer | 2021-11-16 22:11:30 +0100 | |
| commit | b027fac7945184d644aa00940e528a20edcf0d06 (patch) | |
| tree | 302d34b7e09cf8ca5c2cd6760e24a5494fbf9fb9 /src/shader_recompiler | |
| parent | vk_texture_cache: Minor cleanup (diff) | |
| download | yuzu-b027fac7945184d644aa00940e528a20edcf0d06.tar.gz yuzu-b027fac7945184d644aa00940e528a20edcf0d06.tar.xz yuzu-b027fac7945184d644aa00940e528a20edcf0d06.zip | |
gl_texture_cache/rescaling_pass: minor cleanup
Diffstat (limited to 'src/shader_recompiler')
| -rw-r--r-- | src/shader_recompiler/ir_opt/rescaling_pass.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/shader_recompiler/ir_opt/rescaling_pass.cpp b/src/shader_recompiler/ir_opt/rescaling_pass.cpp index 8bbaa55e4..357e41f2b 100644 --- a/src/shader_recompiler/ir_opt/rescaling_pass.cpp +++ b/src/shader_recompiler/ir_opt/rescaling_pass.cpp | |||
| @@ -82,18 +82,14 @@ void PatchFragCoord(IR::Block& block, IR::Inst& inst) { | |||
| 82 | 82 | ||
| 83 | [[nodiscard]] IR::U32 SubScale(IR::IREmitter& ir, const IR::U1& is_scaled, const IR::U32& value, | 83 | [[nodiscard]] IR::U32 SubScale(IR::IREmitter& ir, const IR::U1& is_scaled, const IR::U32& value, |
| 84 | const IR::Attribute attrib) { | 84 | const IR::Attribute attrib) { |
| 85 | if (Settings::values.resolution_info.active) { | 85 | const IR::F32 opt1{ir.Imm32(Settings::values.resolution_info.up_factor)}; |
| 86 | const IR::F32 opt1{ir.Imm32(Settings::values.resolution_info.up_factor)}; | 86 | const IR::F32 base{ir.FPMul(ir.ConvertUToF(32, 32, value), opt1)}; |
| 87 | const IR::F32 base{ir.FPMul(ir.ConvertUToF(32, 32, value), opt1)}; | 87 | const IR::F32 frag_coord{ir.GetAttribute(attrib)}; |
| 88 | const IR::F32 frag_coord{ir.GetAttribute(attrib)}; | 88 | const IR::F32 opt2{ir.Imm32(Settings::values.resolution_info.down_factor)}; |
| 89 | const IR::F32 opt2{ir.Imm32(Settings::values.resolution_info.down_factor)}; | 89 | const IR::F32 floor{ir.FPMul(opt1, ir.FPFloor(ir.FPMul(frag_coord, opt2)))}; |
| 90 | const IR::F32 floor{ir.FPMul(opt1, ir.FPFloor(ir.FPMul(frag_coord, opt2)))}; | 90 | const IR::U32 deviation{ |
| 91 | const IR::U32 deviation{ | 91 | ir.ConvertFToU(32, ir.FPAdd(base, ir.FPAdd(frag_coord, ir.FPNeg(floor))))}; |
| 92 | ir.ConvertFToU(32, ir.FPAdd(base, ir.FPAdd(frag_coord, ir.FPNeg(floor))))}; | 92 | return IR::U32{ir.Select(is_scaled, deviation, value)}; |
| 93 | return IR::U32{ir.Select(is_scaled, deviation, value)}; | ||
| 94 | } else { | ||
| 95 | return value; | ||
| 96 | } | ||
| 97 | } | 93 | } |
| 98 | 94 | ||
| 99 | [[nodiscard]] IR::U32 DownScale(IR::IREmitter& ir, const IR::U1& is_scaled, IR::U32 value) { | 95 | [[nodiscard]] IR::U32 DownScale(IR::IREmitter& ir, const IR::U1& is_scaled, IR::U32 value) { |