summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-05-04 17:51:30 -0300
committerGravatar ReinUsesLisp2020-05-04 17:51:30 -0300
commitf813cd3ff76dd7e0011b429a325217b5501c158f (patch)
tree768a77e05fd378054989d4bade75537fd8a0bcef /src
parentmaxwell_3d: Add viewport swizzles (diff)
downloadyuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar.gz
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.tar.xz
yuzu-f813cd3ff76dd7e0011b429a325217b5501c158f.zip
gl_rasterizer: Implement viewport swizzles with NV_viewport_swizzle
Diffstat (limited to '')
-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() {
1019 const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z; 1019 const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z;
1020 const GLdouble far_depth = src.translate_z + src.scale_z; 1020 const GLdouble far_depth = src.translate_z + src.scale_z;
1021 glDepthRangeIndexed(static_cast<GLuint>(i), near_depth, far_depth); 1021 glDepthRangeIndexed(static_cast<GLuint>(i), near_depth, far_depth);
1022
1023 if (!GLAD_GL_NV_viewport_swizzle) {
1024 continue;
1025 }
1026 glViewportSwizzleNV(static_cast<GLuint>(i), MaxwellToGL::ViewportSwizzle(src.swizzle.x),
1027 MaxwellToGL::ViewportSwizzle(src.swizzle.y),
1028 MaxwellToGL::ViewportSwizzle(src.swizzle.z),
1029 MaxwellToGL::ViewportSwizzle(src.swizzle.w));
1022 } 1030 }
1023 } 1031 }
1024} 1032}
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) {
503 return GL_FILL; 503 return GL_FILL;
504} 504}
505 505
506inline GLenum ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) {
507 // Enumeration order matches register order. We can convert it arithmetically.
508 return GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV + static_cast<GLenum>(swizzle);
509}
510
506} // namespace MaxwellToGL 511} // namespace MaxwellToGL
507} // namespace OpenGL 512} // namespace OpenGL