From f019817f8f6452dec784d8217ef102231319d26c Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 30 Oct 2019 00:23:09 -0300 Subject: gl_rasterizer: Emulate viewport flipping with ARB_clip_control Emulates negative y viewports with ARB_clip_control. This allows us to more easily emulated pipelines with tessellation and/or geometry shader stages. It also avoids corrupting games with transform feedbacks and negative viewports (gl_Position.y was being modified). --- src/video_core/renderer_opengl/gl_state.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/video_core/renderer_opengl/gl_state.cpp') diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index f25148362..ccbe5912e 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -410,6 +410,12 @@ void OpenGLState::ApplyAlphaTest() { } } +void OpenGLState::ApplyClipControl() { + if (UpdateValue(cur_state.clip_control.origin, clip_control.origin)) { + glClipControl(clip_control.origin, GL_NEGATIVE_ONE_TO_ONE); + } +} + void OpenGLState::ApplyTextures() { if (const auto update = UpdateArray(cur_state.textures, textures)) { glBindTextures(update->first, update->second, textures.data() + update->first); @@ -453,6 +459,7 @@ void OpenGLState::Apply() { ApplyImages(); ApplyPolygonOffset(); ApplyAlphaTest(); + ApplyClipControl(); } void OpenGLState::EmulateViewportWithScissor() { -- cgit v1.2.3