Commit 3702d8c9 by Geoff Lang Committed by Commit Bot

Propogate dirty bit signals from TextureImpl to Texture up to Context.

If TextureImpl sets a local dirty bit and signals gl::Texture of it, the dirtyness is not propogated to context. This can result in draw calls with textures that are not synchronized BUG=949985 Change-Id: I9baf82c96598265a6a4850f1fd48e213b5e98ab5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1556699 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent 7d689863
...@@ -1771,6 +1771,7 @@ void Texture::onSubjectStateChange(const gl::Context *context, ...@@ -1771,6 +1771,7 @@ void Texture::onSubjectStateChange(const gl::Context *context,
if (message == angle::SubjectMessage::DEPENDENT_DIRTY_BITS) if (message == angle::SubjectMessage::DEPENDENT_DIRTY_BITS)
{ {
mDirtyBits.set(DIRTY_BIT_IMPLEMENTATION); mDirtyBits.set(DIRTY_BIT_IMPLEMENTATION);
signalDirtyState(context, DIRTY_BIT_IMPLEMENTATION);
} }
} }
} // namespace gl } // namespace gl
...@@ -1721,6 +1721,48 @@ TEST_P(Texture2DTest, NPOTSubImageParameters) ...@@ -1721,6 +1721,48 @@ TEST_P(Texture2DTest, NPOTSubImageParameters)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
// Regression test for http://crbug.com/949985 to make sure dirty bits are propagated up from
// TextureImpl and the texture is synced before being used in a draw call.
TEST_P(Texture2DTestES3, TextureImplPropogatesDirtyBits)
{
ANGLE_SKIP_TEST_IF(IsIntel() && IsOpenGL());
// The workaround in the GL backend required to trigger this bug generates driver warning
// messages.
ScopedIgnorePlatformMessages ignoreMessages;
setUpProgram();
glUseProgram(mProgram);
glActiveTexture(GL_TEXTURE0 + mTexture2DUniformLocation);
GLTexture dest;
glBindTexture(GL_TEXTURE_2D, dest);
GLTexture source;
glBindTexture(GL_TEXTURE_2D, source);
// Put data in mip 0 and 1
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
GLColor::red.data());
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
GLColor::green.data());
// Disable mipmapping so source is complete
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// Force the dirty bits to be synchronized in source
drawQuad(mProgram, "position", 1.0f);
// Copy from mip 1 of the source. In the GL backend this internally sets the base level to mip
// 1 and sets a dirty bit.
glCopyTextureCHROMIUM(source, 1, GL_TEXTURE_2D, dest, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_FALSE,
GL_FALSE, GL_FALSE);
// Draw again, assertions are generated if the texture has internal dirty bits at draw time
drawQuad(mProgram, "position", 1.0f);
}
// Test to check that texture completeness is determined correctly when the texture base level is // Test to check that texture completeness is determined correctly when the texture base level is
// greater than 0, and also that level 0 is not sampled when base level is greater than 0. // greater than 0, and also that level 0 is not sampled when base level is greater than 0.
TEST_P(Texture2DTestES3, DrawWithBaseLevel1) TEST_P(Texture2DTestES3, DrawWithBaseLevel1)
......
...@@ -97,6 +97,9 @@ struct GLColor ...@@ -97,6 +97,9 @@ struct GLColor
const GLubyte &operator[](size_t index) const { return (&R)[index]; } const GLubyte &operator[](size_t index) const { return (&R)[index]; }
const GLubyte *data() const { return &R; }
GLubyte *data() { return &R; }
testing::AssertionResult ExpectNear(const GLColor &expected, const GLColor &err) const; testing::AssertionResult ExpectNear(const GLColor &expected, const GLColor &err) const;
GLubyte R, G, B, A; GLubyte R, G, B, A;
......
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