diff options
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp')
-rwxr-xr-x | gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp | 62 |
1 files changed, 6 insertions, 56 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp index 3a227906f..1cf08b242 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp @@ -119,7 +119,6 @@ StateManagerGL::StateManagerGL(const FunctionsGL *functions, const gl::Caps &ren mClearDepth(1.0f), mClearStencil(0), mFramebufferSRGBEnabled(false), - mDitherEnabled(true), mTextureCubemapSeamlessEnabled(false), mMultisamplingEnabled(true), mSampleAlphaToOneEnabled(false), @@ -743,21 +742,18 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::ContextState &data) GLenum textureType = samplerUniform.textureType; for (GLuint textureUnitIndex : samplerUniform.boundTextureUnits) { - gl::Texture *texture = state.getSamplerTexture(textureUnitIndex, textureType); + const gl::Texture *texture = state.getSamplerTexture(textureUnitIndex, textureType); if (texture != nullptr) { const TextureGL *textureGL = GetImplAs<TextureGL>(texture); - if (mTextures[textureType][textureUnitIndex] != textureGL->getTextureID() || - texture->hasAnyDirtyBit() || textureGL->hasAnyDirtyBit()) + if (mTextures[textureType][textureUnitIndex] != textureGL->getTextureID()) { activeTexture(textureUnitIndex); bindTexture(textureType, textureGL->getTextureID()); - - // TODO: Call this from the gl:: layer once other backends use dirty bits for - // texture state. - texture->syncImplState(); } + + textureGL->syncState(textureUnitIndex); } else { @@ -785,6 +781,7 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::ContextState &data) const gl::Framebuffer *framebuffer = state.getDrawFramebuffer(); const FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(framebuffer); bindFramebuffer(GL_DRAW_FRAMEBUFFER, framebufferGL->getFramebufferID()); + framebufferGL->syncDrawState(); // Seamless cubemaps are required for ES3 and higher contexts. setTextureCubemapSeamlessEnabled(data.getClientMajorVersion() >= 3); @@ -1319,13 +1316,6 @@ void StateManagerGL::setClearStencil(GLint clearStencil) void StateManagerGL::syncState(const gl::State &state, const gl::State::DirtyBits &glDirtyBits) { - // The the current framebuffer binding sometimes requires resetting the srgb blending - if (glDirtyBits[gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING] && - mFunctions->standard == STANDARD_GL_DESKTOP) - { - mLocalDirtyBits.set(gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB); - } - const auto &glAndLocalDirtyBits = (glDirtyBits | mLocalDirtyBits); if (!glAndLocalDirtyBits.any()) @@ -1523,7 +1513,7 @@ void StateManagerGL::syncState(const gl::State &state, const gl::State::DirtyBit setPixelPackState(state.getPackState()); break; case gl::State::DIRTY_BIT_DITHER_ENABLED: - setDitherEnabled(state.isDitherEnabled()); + // TODO(jmadill): implement this break; case gl::State::DIRTY_BIT_GENERATE_MIPMAP_HINT: // TODO(jmadill): implement this @@ -1566,11 +1556,6 @@ void StateManagerGL::syncState(const gl::State &state, const gl::State::DirtyBit setPathRenderingStencilState(state.getPathStencilFunc(), state.getPathStencilRef(), state.getPathStencilMask()); break; - case gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB: - setFramebufferSRGBEnabledForFramebuffer( - state.getFramebufferSRGB(), - GetImplAs<FramebufferGL>(state.getDrawFramebuffer())); - break; default: { ASSERT(dirtyBit >= gl::State::DIRTY_BIT_CURRENT_VALUE_0 && @@ -1600,41 +1585,6 @@ void StateManagerGL::setFramebufferSRGBEnabled(bool enabled) { mFunctions->disable(GL_FRAMEBUFFER_SRGB); } - mLocalDirtyBits.set(gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB); - } -} - -void StateManagerGL::setFramebufferSRGBEnabledForFramebuffer(bool enabled, - const FramebufferGL *framebuffer) -{ - if (mFunctions->standard == STANDARD_GL_DESKTOP && framebuffer->isDefault()) - { - // Obey the framebuffer sRGB state for blending on all framebuffers except the default - // framebuffer on Desktop OpenGL. - // When SRGB blending is enabled, only SRGB capable formats will use it but the default - // framebuffer will always use it if it is enabled. - // TODO(geofflang): Update this when the framebuffer binding dirty changes, when it exists. - setFramebufferSRGBEnabled(false); - } - else - { - setFramebufferSRGBEnabled(enabled); - } -} - -void StateManagerGL::setDitherEnabled(bool enabled) -{ - if (mDitherEnabled != enabled) - { - mDitherEnabled = enabled; - if (mDitherEnabled) - { - mFunctions->enable(GL_DITHER); - } - else - { - mFunctions->disable(GL_DITHER); - } } } |