gl_state: Remove clip control tracking

This commit is contained in:
ReinUsesLisp 2019-12-26 02:27:26 -03:00
parent 1eee891f6e
commit 07a954e67f
5 changed files with 8 additions and 19 deletions

View file

@ -467,6 +467,9 @@ void RasterizerOpenGL::Clear() {
SyncScissorTest();
}
// TODO: Signal state tracker about these changes
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
UNIMPLEMENTED_IF(regs.clear_flags.viewport);
clear_state.Apply();
@ -950,11 +953,9 @@ void RasterizerOpenGL::SyncViewport() {
if (regs.screen_y_control.y_negate != 0) {
flip_y = !flip_y;
}
state.clip_control.origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT;
state.clip_control.depth_mode =
regs.depth_mode == Tegra::Engines::Maxwell3D::Regs::DepthMode::ZeroToOne
? GL_ZERO_TO_ONE
: GL_NEGATIVE_ONE_TO_ONE;
glClipControl(flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT,
regs.depth_mode == Maxwell::DepthMode::ZeroToOne ? GL_ZERO_TO_ONE
: GL_NEGATIVE_ONE_TO_ONE);
}
void RasterizerOpenGL::SyncDepthClamp() {

View file

@ -195,13 +195,6 @@ void OpenGLState::ApplyBlending() {
cur_state.independant_blend.enabled = independant_blend.enabled;
}
void OpenGLState::ApplyClipControl() {
if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
std::tie(clip_control.origin, clip_control.depth_mode))) {
glClipControl(clip_control.origin, clip_control.depth_mode);
}
}
void OpenGLState::ApplyRenderBuffer() {
if (cur_state.renderbuffer != renderbuffer) {
cur_state.renderbuffer = renderbuffer;
@ -247,7 +240,6 @@ void OpenGLState::Apply() {
ApplyTextures();
ApplySamplers();
ApplyImages();
ApplyClipControl();
ApplyRenderBuffer();
}

View file

@ -54,11 +54,6 @@ public:
GLuint program_pipeline = 0; // GL_PROGRAM_PIPELINE_BINDING
} draw;
struct {
GLenum origin = GL_LOWER_LEFT;
GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE;
} clip_control;
GLuint renderbuffer{}; // GL_RENDERBUFFER_BINDING
OpenGLState();
@ -81,7 +76,6 @@ public:
void ApplyTextures();
void ApplySamplers();
void ApplyImages();
void ApplyClipControl();
void ApplyRenderBuffer();
/// Resets any references to the given resource

View file

@ -539,6 +539,7 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
// TODO(Rodrigo): Find out if rasterizer discard affects blits
glDisable(GL_RASTERIZER_DISCARD);
glDisablei(GL_SCISSOR_TEST, 0);
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
u32 buffers{};

View file

@ -585,6 +585,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
glCullFace(GL_BACK);
glFrontFace(GL_CW);
glColorMaski(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
glViewport(0, 0, layout.width, layout.height);
glVertexAttribFormat(PositionLocation, 2, GL_FLOAT, GL_FALSE,