diff options
Diffstat (limited to 'src/shader_recompiler/ir_opt/rescaling_pass.cpp')
| -rw-r--r-- | src/shader_recompiler/ir_opt/rescaling_pass.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/shader_recompiler/ir_opt/rescaling_pass.cpp b/src/shader_recompiler/ir_opt/rescaling_pass.cpp index a5fa4ee83..81098c038 100644 --- a/src/shader_recompiler/ir_opt/rescaling_pass.cpp +++ b/src/shader_recompiler/ir_opt/rescaling_pass.cpp | |||
| @@ -75,6 +75,14 @@ void PatchFragCoord(IR::Block& block, IR::Inst& inst) { | |||
| 75 | inst.ReplaceUsesWith(downscaled_frag_coord); | 75 | inst.ReplaceUsesWith(downscaled_frag_coord); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | void PatchPointSize(IR::Block& block, IR::Inst& inst) { | ||
| 79 | IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)}; | ||
| 80 | const IR::F32 point_value{inst.Arg(1)}; | ||
| 81 | const IR::F32 up_factor{ir.FPRecip(ir.ResolutionDownFactor())}; | ||
| 82 | const IR::F32 upscaled_point_value{ir.FPMul(point_value, up_factor)}; | ||
| 83 | inst.SetArg(1, upscaled_point_value); | ||
| 84 | } | ||
| 85 | |||
| 78 | [[nodiscard]] IR::U32 Scale(IR::IREmitter& ir, const IR::U1& is_scaled, const IR::U32& value) { | 86 | [[nodiscard]] IR::U32 Scale(IR::IREmitter& ir, const IR::U1& is_scaled, const IR::U32& value) { |
| 79 | IR::U32 scaled_value{value}; | 87 | IR::U32 scaled_value{value}; |
| 80 | if (const u32 up_scale = Settings::values.resolution_info.up_scale; up_scale != 1) { | 88 | if (const u32 up_scale = Settings::values.resolution_info.up_scale; up_scale != 1) { |
| @@ -253,6 +261,19 @@ void Visit(const IR::Program& program, IR::Block& block, IR::Inst& inst) { | |||
| 253 | } | 261 | } |
| 254 | break; | 262 | break; |
| 255 | } | 263 | } |
| 264 | case IR::Opcode::SetAttribute: { | ||
| 265 | const IR::Attribute attr{inst.Arg(0).Attribute()}; | ||
| 266 | switch (attr) { | ||
| 267 | case IR::Attribute::PointSize: | ||
| 268 | if (inst.Flags<u32>() != 0xDEADBEEF) { | ||
| 269 | PatchPointSize(block, inst); | ||
| 270 | } | ||
| 271 | break; | ||
| 272 | default: | ||
| 273 | break; | ||
| 274 | } | ||
| 275 | break; | ||
| 276 | } | ||
| 256 | case IR::Opcode::ImageQueryDimensions: | 277 | case IR::Opcode::ImageQueryDimensions: |
| 257 | PatchImageQueryDimensions(block, inst); | 278 | PatchImageQueryDimensions(block, inst); |
| 258 | break; | 279 | break; |