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); ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
SyncRasterizeEnable(clear_state); SyncRasterizeEnable();
if (regs.clear_flags.scissor) { if (regs.clear_flags.scissor) {
SyncScissorTest(); SyncScissorTest();
} }
@ -494,7 +494,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
query_cache.UpdateCounters(); query_cache.UpdateCounters();
SyncViewport(); SyncViewport();
SyncRasterizeEnable(state); SyncRasterizeEnable();
SyncColorMask(); SyncColorMask();
SyncFragmentColorClampState(); SyncFragmentColorClampState();
SyncMultiSampleState(); SyncMultiSampleState();
@ -1048,9 +1048,9 @@ void RasterizerOpenGL::SyncStencilTestState() {
} }
} }
void RasterizerOpenGL::SyncRasterizeEnable(OpenGLState& current_state) { void RasterizerOpenGL::SyncRasterizeEnable() {
const auto& regs = system.GPU().Maxwell3D().regs; 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() { void RasterizerOpenGL::SyncColorMask() {

View file

@ -176,7 +176,7 @@ private:
void SyncPointState(); void SyncPointState();
/// Syncs the rasterizer enable state to match the guest state /// Syncs the rasterizer enable state to match the guest state
void SyncRasterizeEnable(OpenGLState& current_state); void SyncRasterizeEnable();
/// Syncs Color Mask /// Syncs Color Mask
void SyncColorMask(); 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() { void OpenGLState::ApplyStencilTest() {
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled); Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
@ -254,7 +250,6 @@ void OpenGLState::Apply() {
ApplyShaderProgram(); ApplyShaderProgram();
ApplyProgramPipeline(); ApplyProgramPipeline();
ApplyClipDistances(); ApplyClipDistances();
ApplyRasterizerDiscard();
ApplyStencilTest(); ApplyStencilTest();
ApplyBlending(); ApplyBlending();
ApplyTextures(); ApplyTextures();

View file

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

View file

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

View file

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