summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ameerj2021-09-18 00:43:41 -0400
committerGravatar Fernando Sahmkow2021-11-16 22:11:30 +0100
commitb027fac7945184d644aa00940e528a20edcf0d06 (patch)
tree302d34b7e09cf8ca5c2cd6760e24a5494fbf9fb9 /src
parentvk_texture_cache: Minor cleanup (diff)
downloadyuzu-b027fac7945184d644aa00940e528a20edcf0d06.tar.gz
yuzu-b027fac7945184d644aa00940e528a20edcf0d06.tar.xz
yuzu-b027fac7945184d644aa00940e528a20edcf0d06.zip
gl_texture_cache/rescaling_pass: minor cleanup
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/ir_opt/rescaling_pass.cpp20
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h1
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) {
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) {
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&
474 set_view(Shader::TextureType::ColorArrayCube, null_image_cube_array.handle); 474 set_view(Shader::TextureType::ColorArrayCube, null_image_cube_array.handle);
475 475
476 resolution = Settings::values.resolution_info; 476 resolution = Settings::values.resolution_info;
477 is_rescaling_on = resolution.up_scale != 1 || resolution.down_shift != 0; 477 if (resolution.active) {
478 if (is_rescaling_on) {
479 rescale_draw_fbo.Create(); 478 rescale_draw_fbo.Create();
480 rescale_read_fbo.Create(); 479 rescale_read_fbo.Create();
481 480
@@ -957,7 +956,7 @@ bool Image::ScaleUp() {
957 if (True(flags & ImageFlagBits::Rescaled)) { 956 if (True(flags & ImageFlagBits::Rescaled)) {
958 return false; 957 return false;
959 } 958 }
960 if (!runtime->is_rescaling_on) { 959 if (!runtime->resolution.active) {
961 return false; 960 return false;
962 } 961 }
963 if (gl_format == 0 && gl_type == 0) { 962 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:
156 OGLFramebuffer rescale_draw_fbo; 156 OGLFramebuffer rescale_draw_fbo;
157 OGLFramebuffer rescale_read_fbo; 157 OGLFramebuffer rescale_read_fbo;
158 Settings::ResolutionScalingInfo resolution; 158 Settings::ResolutionScalingInfo resolution;
159 bool is_rescaling_on{};
160}; 159};
161 160
162class Image : public VideoCommon::ImageBase { 161class Image : public VideoCommon::ImageBase {