gl_state: Remove rasterizer disable tracking

This commit is contained in:
ReinUsesLisp 2019-12-26 02:11:01 -03:00
parent d3e433a380
commit e8125af8dd
6 changed files with 8 additions and 13 deletions

View file

@ -462,7 +462,7 @@ void RasterizerOpenGL::Clear() {
ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
SyncRasterizeEnable(clear_state);
SyncRasterizeEnable();
if (regs.clear_flags.scissor) {
SyncScissorTest();
}
@ -494,7 +494,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
query_cache.UpdateCounters();
SyncViewport();
SyncRasterizeEnable(state);
SyncRasterizeEnable();
SyncColorMask();
SyncFragmentColorClampState();
SyncMultiSampleState();
@ -1048,9 +1048,9 @@ void RasterizerOpenGL::SyncStencilTestState() {
}
}
void RasterizerOpenGL::SyncRasterizeEnable(OpenGLState& current_state) {
void RasterizerOpenGL::SyncRasterizeEnable() {
const auto& regs = system.GPU().Maxwell3D().regs;
current_state.rasterizer_discard = regs.rasterize_enable == 0;
oglEnable(GL_RASTERIZER_DISCARD, regs.rasterize_enable == 0);
}
void RasterizerOpenGL::SyncColorMask() {

View file

@ -176,7 +176,7 @@ private:
void SyncPointState();
/// Syncs the rasterizer enable state to match the guest state
void SyncRasterizeEnable(OpenGLState& current_state);
void SyncRasterizeEnable();
/// Syncs Color Mask
void SyncColorMask();

View file

@ -113,10 +113,6 @@ void OpenGLState::ApplyClipDistances() {
}
}
void OpenGLState::ApplyRasterizerDiscard() {
Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
}
void OpenGLState::ApplyStencilTest() {
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
@ -254,7 +250,6 @@ void OpenGLState::Apply() {
ApplyShaderProgram();
ApplyProgramPipeline();
ApplyClipDistances();
ApplyRasterizerDiscard();
ApplyStencilTest();
ApplyBlending();
ApplyTextures();

View file

@ -13,8 +13,6 @@ namespace OpenGL {
class OpenGLState {
public:
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
struct {
bool test_enabled = false; // GL_STENCIL_TEST
struct {
@ -79,7 +77,6 @@ public:
void ApplyShaderProgram();
void ApplyProgramPipeline();
void ApplyClipDistances();
void ApplyRasterizerDiscard();
void ApplyStencilTest();
void ApplyTargetBlending(std::size_t target, bool force);
void ApplyGlobalBlending();

View file

@ -536,6 +536,8 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
} else {
glDisable(GL_FRAMEBUFFER_SRGB);
}
// TODO(Rodrigo): Find out if rasterizer discard affects blits
glDisable(GL_RASTERIZER_DISCARD);
glDisablei(GL_SCISSOR_TEST, 0);
u32 buffers{};

View file

@ -580,6 +580,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_POLYGON_OFFSET_FILL);
glDisable(GL_RASTERIZER_DISCARD);
glDisablei(GL_SCISSOR_TEST, 0);
glCullFace(GL_BACK);
glFrontFace(GL_CW);