3
0
Fork 0
forked from suyu/suyu

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

View file

@ -195,13 +195,6 @@ void OpenGLState::ApplyBlending() {
cur_state.independant_blend.enabled = independant_blend.enabled; 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() { void OpenGLState::ApplyRenderBuffer() {
if (cur_state.renderbuffer != renderbuffer) { if (cur_state.renderbuffer != renderbuffer) {
cur_state.renderbuffer = renderbuffer; cur_state.renderbuffer = renderbuffer;
@ -247,7 +240,6 @@ void OpenGLState::Apply() {
ApplyTextures(); ApplyTextures();
ApplySamplers(); ApplySamplers();
ApplyImages(); ApplyImages();
ApplyClipControl();
ApplyRenderBuffer(); ApplyRenderBuffer();
} }

View file

@ -54,11 +54,6 @@ public:
GLuint program_pipeline = 0; // GL_PROGRAM_PIPELINE_BINDING GLuint program_pipeline = 0; // GL_PROGRAM_PIPELINE_BINDING
} draw; } draw;
struct {
GLenum origin = GL_LOWER_LEFT;
GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE;
} clip_control;
GLuint renderbuffer{}; // GL_RENDERBUFFER_BINDING GLuint renderbuffer{}; // GL_RENDERBUFFER_BINDING
OpenGLState(); OpenGLState();
@ -81,7 +76,6 @@ public:
void ApplyTextures(); void ApplyTextures();
void ApplySamplers(); void ApplySamplers();
void ApplyImages(); void ApplyImages();
void ApplyClipControl();
void ApplyRenderBuffer(); void ApplyRenderBuffer();
/// Resets any references to the given resource /// 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 // TODO(Rodrigo): Find out if rasterizer discard affects blits
glDisable(GL_RASTERIZER_DISCARD); glDisable(GL_RASTERIZER_DISCARD);
glDisablei(GL_SCISSOR_TEST, 0); glDisablei(GL_SCISSOR_TEST, 0);
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
u32 buffers{}; u32 buffers{};

View file

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