gl_state: Remove clamp framebuffer color tracking

This commit doesn't reset it for screen draws because clamping doesn't
change anything there.
This commit is contained in:
ReinUsesLisp 2019-12-26 01:07:34 -03:00
parent f92236976b
commit 2392b548be
3 changed files with 6 additions and 17 deletions

View File

@ -415,6 +415,11 @@ void RasterizerOpenGL::Clear() {
clear_state.color_mask[0].green_enabled = regs.clear_buffers.G ? GL_TRUE : GL_FALSE; clear_state.color_mask[0].green_enabled = regs.clear_buffers.G ? GL_TRUE : GL_FALSE;
clear_state.color_mask[0].blue_enabled = regs.clear_buffers.B ? GL_TRUE : GL_FALSE; clear_state.color_mask[0].blue_enabled = regs.clear_buffers.B ? GL_TRUE : GL_FALSE;
clear_state.color_mask[0].alpha_enabled = regs.clear_buffers.A ? GL_TRUE : GL_FALSE; clear_state.color_mask[0].alpha_enabled = regs.clear_buffers.A ? GL_TRUE : GL_FALSE;
// TODO: Signal state tracker about these changes
SyncFramebufferSRGB();
// TODO(Rodrigo): Determine if clamping is used on clears
SyncFragmentColorClampState();
} }
if (regs.clear_buffers.Z) { if (regs.clear_buffers.Z) {
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!"); ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
@ -454,9 +459,6 @@ void RasterizerOpenGL::Clear() {
} }
} }
// TODO: Signal state tracker about these changes
SyncFramebufferSRGB();
if (!use_color && !use_depth && !use_stencil) { if (!use_color && !use_depth && !use_stencil) {
// No color surface nor depth/stencil surface are enabled // No color surface nor depth/stencil surface are enabled
return; return;
@ -1089,7 +1091,7 @@ void RasterizerOpenGL::SyncMultiSampleState() {
void RasterizerOpenGL::SyncFragmentColorClampState() { void RasterizerOpenGL::SyncFragmentColorClampState() {
const auto& regs = system.GPU().Maxwell3D().regs; const auto& regs = system.GPU().Maxwell3D().regs;
state.fragment_color_clamp.enabled = regs.frag_color_clamp != 0; glClampColor(GL_CLAMP_FRAGMENT_COLOR, regs.frag_color_clamp ? GL_TRUE : GL_FALSE);
} }
void RasterizerOpenGL::SyncBlendState() { void RasterizerOpenGL::SyncBlendState() {

View File

@ -117,13 +117,6 @@ void OpenGLState::ApplyClipDistances() {
} }
} }
void OpenGLState::ApplyFragmentColorClamp() {
if (UpdateValue(cur_state.fragment_color_clamp.enabled, fragment_color_clamp.enabled)) {
glClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB,
fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE);
}
}
void OpenGLState::ApplyRasterizerDiscard() { void OpenGLState::ApplyRasterizerDiscard() {
Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard); Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
} }
@ -317,7 +310,6 @@ void OpenGLState::Apply() {
ApplyShaderProgram(); ApplyShaderProgram();
ApplyProgramPipeline(); ApplyProgramPipeline();
ApplyClipDistances(); ApplyClipDistances();
ApplyFragmentColorClamp();
ApplyRasterizerDiscard(); ApplyRasterizerDiscard();
ApplyColorMask(); ApplyColorMask();
ApplyViewport(); ApplyViewport();

View File

@ -13,10 +13,6 @@ namespace OpenGL {
class OpenGLState { class OpenGLState {
public: public:
struct {
bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB
} fragment_color_clamp;
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
struct ColorMask { struct ColorMask {
@ -110,7 +106,6 @@ public:
void ApplyShaderProgram(); void ApplyShaderProgram();
void ApplyProgramPipeline(); void ApplyProgramPipeline();
void ApplyClipDistances(); void ApplyClipDistances();
void ApplyFragmentColorClamp();
void ApplyRasterizerDiscard(); void ApplyRasterizerDiscard();
void ApplyColorMask(); void ApplyColorMask();
void ApplyStencilTest(); void ApplyStencilTest();