summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-05-04 22:51:30 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-05-04 22:51:30 +0200
commitf813cd3ff76dd7e0011b429a325217b5501c158f (patch)
tree768a77e05fd378054989d4bade75537fd8a0bcef
parentmaxwell_3d: Add viewport swizzles (diff)
downloadyuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar.gz
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar.bz2
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar.lz
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar.xz
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar.zst
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.zip
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp8
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h5
2 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 8b3b3ce92..69dcf952f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1019,6 +1019,14 @@ void RasterizerOpenGL::SyncViewport() {
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);
+
+ if (!GLAD_GL_NV_viewport_swizzle) {
+ continue;
+ }
+ glViewportSwizzleNV(static_cast<GLuint>(i), MaxwellToGL::ViewportSwizzle(src.swizzle.x),
+ MaxwellToGL::ViewportSwizzle(src.swizzle.y),
+ MaxwellToGL::ViewportSwizzle(src.swizzle.z),
+ MaxwellToGL::ViewportSwizzle(src.swizzle.w));
}
}
}
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index 2c0c77c28..994ae98eb 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -503,5 +503,10 @@ inline GLenum PolygonMode(Maxwell::PolygonMode polygon_mode) {
return GL_FILL;
}
+inline GLenum ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) {
+ // Enumeration order matches register order. We can convert it arithmetically.
+ return GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV + static_cast<GLenum>(swizzle);
+}
+
} // namespace MaxwellToGL
} // namespace OpenGL