summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/ir_opt/rescaling_pass.cpp
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-10-29 17:02:57 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 22:11:33 +0100
commitde1c8c5c2c3131bb122351e676014cdc7c442e78 (patch)
treeef09b2327f240c21c368a644e6450d78400d4a5d /src/shader_recompiler/ir_opt/rescaling_pass.cpp
parenttexture_cache: Refactor Render Target scaling function (diff)
downloadyuzu-de1c8c5c2c3131bb122351e676014cdc7c442e78.tar
yuzu-de1c8c5c2c3131bb122351e676014cdc7c442e78.tar.gz
yuzu-de1c8c5c2c3131bb122351e676014cdc7c442e78.tar.bz2
yuzu-de1c8c5c2c3131bb122351e676014cdc7c442e78.tar.lz
yuzu-de1c8c5c2c3131bb122351e676014cdc7c442e78.tar.xz
yuzu-de1c8c5c2c3131bb122351e676014cdc7c442e78.tar.zst
yuzu-de1c8c5c2c3131bb122351e676014cdc7c442e78.zip
Diffstat (limited to 'src/shader_recompiler/ir_opt/rescaling_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/rescaling_pass.cpp21
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) {
inst.ReplaceUsesWith(downscaled_frag_coord);
}
+void PatchPointSize(IR::Block& block, IR::Inst& inst) {
+ IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)};
+ const IR::F32 point_value{inst.Arg(1)};
+ const IR::F32 up_factor{ir.FPRecip(ir.ResolutionDownFactor())};
+ const IR::F32 upscaled_point_value{ir.FPMul(point_value, up_factor)};
+ inst.SetArg(1, upscaled_point_value);
+}
+
[[nodiscard]] IR::U32 Scale(IR::IREmitter& ir, const IR::U1& is_scaled, const IR::U32& value) {
IR::U32 scaled_value{value};
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) {
}
break;
}
+ case IR::Opcode::SetAttribute: {
+ const IR::Attribute attr{inst.Arg(0).Attribute()};
+ switch (attr) {
+ case IR::Attribute::PointSize:
+ if (inst.Flags<u32>() != 0xDEADBEEF) {
+ PatchPointSize(block, inst);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
case IR::Opcode::ImageQueryDimensions:
PatchImageQueryDimensions(block, inst);
break;