summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ameerj2021-10-22 22:59:30 -0400
committerGravatar Fernando Sahmkow2021-11-16 22:11:32 +0100
commit93c9eb196f4444495f50220c3e6b89d2f0b582db (patch)
tree13b68c943f40391976a9675566582f6943f6cb59 /src
parentgl_texture_cache: Simplify scaling procedures (diff)
downloadyuzu-93c9eb196f4444495f50220c3e6b89d2f0b582db.tar.gz
yuzu-93c9eb196f4444495f50220c3e6b89d2f0b582db.tar.xz
yuzu-93c9eb196f4444495f50220c3e6b89d2f0b582db.zip
gl_rasterizer: Fix ScissorTest and Clear when scaling
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index bb24a0656..4df8a684a 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -184,6 +184,9 @@ void RasterizerOpenGL::Clear() {
184 SyncRasterizeEnable(); 184 SyncRasterizeEnable();
185 SyncStencilTestState(); 185 SyncStencilTestState();
186 186
187 std::scoped_lock lock{texture_cache.mutex};
188 texture_cache.UpdateRenderTargets(true);
189 state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle());
187 if (regs.clear_flags.scissor) { 190 if (regs.clear_flags.scissor) {
188 SyncScissorTest(); 191 SyncScissorTest();
189 } else { 192 } else {
@@ -192,10 +195,6 @@ void RasterizerOpenGL::Clear() {
192 } 195 }
193 UNIMPLEMENTED_IF(regs.clear_flags.viewport); 196 UNIMPLEMENTED_IF(regs.clear_flags.viewport);
194 197
195 std::scoped_lock lock{texture_cache.mutex};
196 texture_cache.UpdateRenderTargets(true);
197 state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle());
198
199 if (use_color) { 198 if (use_color) {
200 glClearBufferfv(GL_COLOR, regs.clear_buffers.RT, regs.clear_color); 199 glClearBufferfv(GL_COLOR, regs.clear_buffers.RT, regs.clear_color);
201 } 200 }
@@ -925,12 +924,9 @@ void RasterizerOpenGL::SyncScissorTest() {
925 const auto& regs = maxwell3d.regs; 924 const auto& regs = maxwell3d.regs;
926 925
927 const auto& resolution = Settings::values.resolution_info; 926 const auto& resolution = Settings::values.resolution_info;
928 const auto scale_up = [resolution](u32 value) -> u32 { 927 const bool is_rescaling{texture_cache.IsRescaling()};
929 if (value == 0) { 928 const auto scale_up = [resolution, is_rescaling](u32 value) {
930 return 0U; 929 return is_rescaling ? resolution.ScaleUp(value) : value;
931 }
932 const u32 converted_value = (value * resolution.up_scale) >> resolution.down_shift;
933 return std::max<u32>(converted_value, 1U);
934 }; 930 };
935 for (std::size_t index = 0; index < Maxwell::NumViewports; ++index) { 931 for (std::size_t index = 0; index < Maxwell::NumViewports; ++index) {
936 if (!force && !flags[Dirty::Scissor0 + index]) { 932 if (!force && !flags[Dirty::Scissor0 + index]) {