summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-05-26 00:57:38 -0300
committerGravatar ReinUsesLisp2020-05-26 16:33:50 -0300
commit606a62d4c740eec470b19e57322645de20866abf (patch)
treeb3601eb861cda03dc6f12b752369f978de28a7b5 /src
parentfixed_pipeline_state: Remove unnecessary check for front faces flip (diff)
downloadyuzu-606a62d4c740eec470b19e57322645de20866abf.tar.gz
yuzu-606a62d4c740eec470b19e57322645de20866abf.tar.xz
yuzu-606a62d4c740eec470b19e57322645de20866abf.zip
gl_rasterizer: Port front face flip check from Vulkan
While Vulkan was assuming we had no negative viewports, OpenGL code was assuming we had them. Port the old code from Vulkan to OpenGL, checking if the first viewport is negative before flipping faces. This is not a complete implementation since we only check for the first viewport to be negative. That said, unless a game is using Vulkan, OpenGL and NVN games should be fine here, and we can always compare with our Vulkan backend to see if there's a difference.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 8116a5daa..efbbf11f9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1031,6 +1031,26 @@ void RasterizerOpenGL::SyncViewport() {
1031 const auto& regs = gpu.regs; 1031 const auto& regs = gpu.regs;
1032 1032
1033 const bool dirty_viewport = flags[Dirty::Viewports]; 1033 const bool dirty_viewport = flags[Dirty::Viewports];
1034 const bool dirty_clip_control = flags[Dirty::ClipControl];
1035
1036 if (dirty_clip_control || flags[Dirty::FrontFace]) {
1037 flags[Dirty::FrontFace] = false;
1038
1039 GLenum mode = MaxwellToGL::FrontFace(regs.front_face);
1040 if (regs.screen_y_control.triangle_rast_flip != 0 &&
1041 regs.viewport_transform[0].scale_y < 0.0f) {
1042 switch (mode) {
1043 case GL_CW:
1044 mode = GL_CCW;
1045 break;
1046 case GL_CCW:
1047 mode = GL_CW;
1048 break;
1049 }
1050 }
1051 glFrontFace(mode);
1052 }
1053
1034 if (dirty_viewport || flags[Dirty::ClipControl]) { 1054 if (dirty_viewport || flags[Dirty::ClipControl]) {
1035 flags[Dirty::ClipControl] = false; 1055 flags[Dirty::ClipControl] = false;
1036 1056
@@ -1128,11 +1148,6 @@ void RasterizerOpenGL::SyncCullMode() {
1128 glDisable(GL_CULL_FACE); 1148 glDisable(GL_CULL_FACE);
1129 } 1149 }
1130 } 1150 }
1131
1132 if (flags[Dirty::FrontFace]) {
1133 flags[Dirty::FrontFace] = false;
1134 glFrontFace(MaxwellToGL::FrontFace(regs.front_face));
1135 }
1136} 1151}
1137 1152
1138void RasterizerOpenGL::SyncPrimitiveRestart() { 1153void RasterizerOpenGL::SyncPrimitiveRestart() {