Commit 0b94528b by Geoff Lang Committed by Commit Bot

Fix synchronization of workaround dirty bits in TextureGL.

The local dirty bits were sometimes not synced because gl::Texture doesn't know that they exist. Also fix calculation of when the workaround dirty bits need to be set. BUG=angleproject:1386 Change-Id: I3d9d1a01e5441be783190422093c485ea5da7aec Reviewed-on: https://chromium-review.googlesource.com/396542Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent f41d0ee1
...@@ -1131,11 +1131,8 @@ GLuint Texture::getId() const ...@@ -1131,11 +1131,8 @@ GLuint Texture::getId() const
void Texture::syncImplState() void Texture::syncImplState()
{ {
if (mDirtyBits.any()) mTexture->syncState(mDirtyBits);
{ mDirtyBits.reset();
mTexture->syncState(mDirtyBits);
mDirtyBits.reset();
}
} }
rx::FramebufferAttachmentObjectImpl *Texture::getAttachmentImpl() const rx::FramebufferAttachmentObjectImpl *Texture::getAttachmentImpl() const
......
...@@ -749,7 +749,7 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::ContextState &data) ...@@ -749,7 +749,7 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::ContextState &data)
const TextureGL *textureGL = GetImplAs<TextureGL>(texture); const TextureGL *textureGL = GetImplAs<TextureGL>(texture);
if (mTextures[textureType][textureUnitIndex] != textureGL->getTextureID() || if (mTextures[textureType][textureUnitIndex] != textureGL->getTextureID() ||
texture->hasAnyDirtyBit()) texture->hasAnyDirtyBit() || textureGL->hasAnyDirtyBit())
{ {
activeTexture(textureUnitIndex); activeTexture(textureUnitIndex);
bindTexture(textureType, textureGL->getTextureID()); bindTexture(textureType, textureGL->getTextureID());
......
...@@ -800,7 +800,11 @@ gl::Error TextureGL::setEGLImageTarget(GLenum target, egl::Image *image) ...@@ -800,7 +800,11 @@ gl::Error TextureGL::setEGLImageTarget(GLenum target, egl::Image *image)
void TextureGL::syncState(const gl::Texture::DirtyBits &dirtyBits) void TextureGL::syncState(const gl::Texture::DirtyBits &dirtyBits)
{ {
ASSERT(dirtyBits.any()); if (dirtyBits.none() && mLocalDirtyBits.none())
{
return;
}
mStateManager->bindTexture(mState.mTarget, mTextureID); mStateManager->bindTexture(mState.mTarget, mTextureID);
if (dirtyBits[gl::Texture::DIRTY_BIT_BASE_LEVEL] || dirtyBits[gl::Texture::DIRTY_BIT_MAX_LEVEL]) if (dirtyBits[gl::Texture::DIRTY_BIT_BASE_LEVEL] || dirtyBits[gl::Texture::DIRTY_BIT_MAX_LEVEL])
...@@ -891,6 +895,11 @@ void TextureGL::syncState(const gl::Texture::DirtyBits &dirtyBits) ...@@ -891,6 +895,11 @@ void TextureGL::syncState(const gl::Texture::DirtyBits &dirtyBits)
mLocalDirtyBits.reset(); mLocalDirtyBits.reset();
} }
bool TextureGL::hasAnyDirtyBit() const
{
return mLocalDirtyBits.any();
}
void TextureGL::syncTextureStateSwizzle(const FunctionsGL *functions, GLenum name, GLenum value) void TextureGL::syncTextureStateSwizzle(const FunctionsGL *functions, GLenum name, GLenum value)
{ {
const LevelInfoGL &levelInfo = mLevelInfo[mState.getEffectiveBaseLevel()]; const LevelInfoGL &levelInfo = mLevelInfo[mState.getEffectiveBaseLevel()];
...@@ -1009,11 +1018,8 @@ void TextureGL::setLevelInfo(size_t level, size_t levelCount, const LevelInfoGL ...@@ -1009,11 +1018,8 @@ void TextureGL::setLevelInfo(size_t level, size_t levelCount, const LevelInfoGL
ASSERT(levelCount > 0 && level + levelCount < mLevelInfo.size()); ASSERT(levelCount > 0 && level + levelCount < mLevelInfo.size());
GLuint baseLevel = mState.getEffectiveBaseLevel(); GLuint baseLevel = mState.getEffectiveBaseLevel();
const auto &prevBaseLevelInfo = mLevelInfo[baseLevel]; bool needsResync = level <= baseLevel && level + levelCount >= baseLevel &&
bool needsResync = (levelInfo.depthStencilWorkaround || levelInfo.lumaWorkaround.enabled);
level <= baseLevel && level + levelCount >= baseLevel &&
(prevBaseLevelInfo.depthStencilWorkaround != levelInfo.depthStencilWorkaround ||
prevBaseLevelInfo.lumaWorkaround.enabled != levelInfo.lumaWorkaround.enabled);
if (needsResync) if (needsResync)
{ {
mLocalDirtyBits |= GetLevelWorkaroundDirtyBits(); mLocalDirtyBits |= GetLevelWorkaroundDirtyBits();
......
...@@ -92,6 +92,7 @@ class TextureGL : public TextureImpl ...@@ -92,6 +92,7 @@ class TextureGL : public TextureImpl
void setBaseLevel(GLuint) override {} void setBaseLevel(GLuint) override {}
void syncState(const gl::Texture::DirtyBits &dirtyBits) override; void syncState(const gl::Texture::DirtyBits &dirtyBits) override;
bool hasAnyDirtyBit() const;
private: private:
void setImageHelper(GLenum target, void setImageHelper(GLenum target,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment