summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-23 17:00:21 +0100
committerGitHub <noreply@github.com>2020-03-23 17:00:21 +0100
commit497f59352588a2926987be2131aa0ff9ce959dd7 (patch)
treeb1d14f7f38e051e15468709914852f9605eae276 /src/video_core
parentMerge pull request #3542 from namkazt/patch-10 (diff)
parentgl_rasterizer: Use transformed viewport for depth ranges (diff)
downloadyuzu-497f59352588a2926987be2131aa0ff9ce959dd7.tar
yuzu-497f59352588a2926987be2131aa0ff9ce959dd7.tar.gz
yuzu-497f59352588a2926987be2131aa0ff9ce959dd7.tar.bz2
yuzu-497f59352588a2926987be2131aa0ff9ce959dd7.tar.lz
yuzu-497f59352588a2926987be2131aa0ff9ce959dd7.tar.xz
yuzu-497f59352588a2926987be2131aa0ff9ce959dd7.tar.zst
yuzu-497f59352588a2926987be2131aa0ff9ce959dd7.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 063f41327..826eee7df 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -933,13 +933,15 @@ void RasterizerOpenGL::SyncViewport() {
}
flags[Dirty::Viewport0 + i] = false;
- const Common::Rectangle<f32> rect{regs.viewport_transform[i].GetRect()};
+ const auto& src = regs.viewport_transform[i];
+ const Common::Rectangle<f32> rect{src.GetRect()};
glViewportIndexedf(static_cast<GLuint>(i), rect.left, rect.bottom, rect.GetWidth(),
rect.GetHeight());
- const auto& src = regs.viewports[i];
- glDepthRangeIndexed(static_cast<GLuint>(i), static_cast<GLdouble>(src.depth_range_near),
- static_cast<GLdouble>(src.depth_range_far));
+ const GLdouble reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne;
+ const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z;
+ const GLdouble far_depth = src.translate_z + src.scale_z;
+ glDepthRangeIndexed(static_cast<GLuint>(i), near_depth, far_depth);
}
}
}