diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:29:50 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:31:02 +0200 |
commit | 70dd5e7c66b1fe3f82e5b4db2406050baba15f05 (patch) | |
tree | 3f012200ef3c934f33db1a4ef2b790fae3141860 /gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp | |
parent | 3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff) | |
parent | 8481fa25d246f1968d0a254ee3c6cdd82c60781a (diff) | |
download | UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.gz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.lz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.xz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.zip |
Merge branch 'ANGLE-rollback'
This resolves #624
Note: Cherry-picked some fixes on top of the ANGLE version that we want to keep.
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); - } } } |