Commit 0a3f58f1 by Jamie Madill Committed by Commit Bot

Fix undefined behaviour in ClearTest.

We were expecting an uninitialized texture to contain black. However the contents of the texture data may be undefined. Discovered when working with the Vulkan command stream refactor. Bug: angleproject:4029 Change-Id: Ia5d24707746819b116ac0053fabb48033574569a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2017978Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent c67252ea
......@@ -393,13 +393,17 @@ TEST_P(ClearTest, ChangeFramebufferAttachmentFromRGBAtoRGB)
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
GLTexture texture;
glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindowWidth(), getWindowHeight(), 0, GL_RGBA,
GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
// Initially clear to black.
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Clear with masked color.
glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
glClearColor(0.5f, 0.5f, 0.5f, 0.75f);
glClear(GL_COLOR_BUFFER_BIT);
ASSERT_GL_NO_ERROR();
......
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