From b027fac7945184d644aa00940e528a20edcf0d06 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Sat, 18 Sep 2021 00:43:41 -0400 Subject: [PATCH] gl_texture_cache/rescaling_pass: minor cleanup --- .../ir_opt/rescaling_pass.cpp | 20 ++++++++----------- .../renderer_opengl/gl_texture_cache.cpp | 5 ++--- .../renderer_opengl/gl_texture_cache.h | 1 - 3 files changed, 10 insertions(+), 16 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) { [[nodiscard]] IR::U32 SubScale(IR::IREmitter& ir, const IR::U1& is_scaled, const IR::U32& value, const IR::Attribute attrib) { - if (Settings::values.resolution_info.active) { - const IR::F32 opt1{ir.Imm32(Settings::values.resolution_info.up_factor)}; - const IR::F32 base{ir.FPMul(ir.ConvertUToF(32, 32, value), opt1)}; - const IR::F32 frag_coord{ir.GetAttribute(attrib)}; - const IR::F32 opt2{ir.Imm32(Settings::values.resolution_info.down_factor)}; - const IR::F32 floor{ir.FPMul(opt1, ir.FPFloor(ir.FPMul(frag_coord, opt2)))}; - const IR::U32 deviation{ - ir.ConvertFToU(32, ir.FPAdd(base, ir.FPAdd(frag_coord, ir.FPNeg(floor))))}; - return IR::U32{ir.Select(is_scaled, deviation, value)}; - } else { - return value; - } + const IR::F32 opt1{ir.Imm32(Settings::values.resolution_info.up_factor)}; + const IR::F32 base{ir.FPMul(ir.ConvertUToF(32, 32, value), opt1)}; + const IR::F32 frag_coord{ir.GetAttribute(attrib)}; + const IR::F32 opt2{ir.Imm32(Settings::values.resolution_info.down_factor)}; + const IR::F32 floor{ir.FPMul(opt1, ir.FPFloor(ir.FPMul(frag_coord, opt2)))}; + const IR::U32 deviation{ + ir.ConvertFToU(32, ir.FPAdd(base, ir.FPAdd(frag_coord, ir.FPNeg(floor))))}; + return IR::U32{ir.Select(is_scaled, deviation, value)}; } [[nodiscard]] IR::U32 DownScale(IR::IREmitter& ir, const IR::U1& is_scaled, IR::U32 value) { diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 22fffb19b..64bd88c3b 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -474,8 +474,7 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, ProgramManager& set_view(Shader::TextureType::ColorArrayCube, null_image_cube_array.handle); resolution = Settings::values.resolution_info; - is_rescaling_on = resolution.up_scale != 1 || resolution.down_shift != 0; - if (is_rescaling_on) { + if (resolution.active) { rescale_draw_fbo.Create(); rescale_read_fbo.Create(); @@ -957,7 +956,7 @@ bool Image::ScaleUp() { if (True(flags & ImageFlagBits::Rescaled)) { return false; } - if (!runtime->is_rescaling_on) { + if (!runtime->resolution.active) { return false; } if (gl_format == 0 && gl_type == 0) { diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index f4dcc6f9b..6c8033003 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h @@ -156,7 +156,6 @@ private: OGLFramebuffer rescale_draw_fbo; OGLFramebuffer rescale_read_fbo; Settings::ResolutionScalingInfo resolution; - bool is_rescaling_on{}; }; class Image : public VideoCommon::ImageBase {