Commit 73a5b648 by Geoff Lang

Only check alpha values of 0 and 1.

Relying on the driver to round in one direction or the other is not reliable. Change-Id: Ide96864607ee6a22d2523544d6cfe8fae3116fcd Reviewed-on: https://chromium-review.googlesource.com/288289Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 0bcb68f3
...@@ -216,7 +216,6 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha) ...@@ -216,7 +216,6 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha)
GLuint fbo = 0; GLuint fbo = 0;
GLubyte pixel[4]; GLubyte pixel[4];
glClearColor(0.0f, 0.0f, 0.0f, 0.1f);
// Create a simple 5551 texture // Create a simple 5551 texture
glGenTextures(1, &tex); glGenTextures(1, &tex);
...@@ -231,14 +230,16 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha) ...@@ -231,14 +230,16 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha)
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
EXPECT_GL_NO_ERROR(); EXPECT_PIXEL_EQ(0, 0, 0, 0, 0, 0);
EXPECT_NEAR(0, pixel[0], 32); glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
EXPECT_NEAR(0, pixel[1], 32); glClear(GL_COLOR_BUFFER_BIT);
EXPECT_NEAR(0, pixel[2], 32); glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
EXPECT_NEAR(26, pixel[3], 128); EXPECT_PIXEL_EQ(0, 0, 0, 0, 0, 255);
glDeleteFramebuffers(1, &fbo); glDeleteFramebuffers(1, &fbo);
glDeleteTextures(1, &tex); glDeleteTextures(1, &tex);
......
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