Commit fbd7820c by Austin Kinross Committed by Jamie Madill

Fix flaky WebGL point-sprites test when using instanced point sprites

Change-Id: I7d417016d9fa3a2e49806543d981ab98a3e71cbc Reviewed-on: https://chromium-review.googlesource.com/273914Tested-by: 's avatarAustin Kinross <aukinros@microsoft.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 673115d9
...@@ -301,14 +301,14 @@ gl::Error InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl ...@@ -301,14 +301,14 @@ gl::Error InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl
mCurrentBuffers[i] = buffer; mCurrentBuffers[i] = buffer;
mCurrentVertexStrides[i] = vertexStride; mCurrentVertexStrides[i] = vertexStride;
mCurrentVertexOffsets[i] = vertexOffset; mCurrentVertexOffsets[i] = vertexOffset;
}
// If a non null ID3D11Buffer is being assigned to mCurrentBuffers, // If a non null ID3D11Buffer is being assigned to mCurrentBuffers,
// then the next available index needs to be tracked to ensure // then the next available index needs to be tracked to ensure
// that any instanced pointsprite emulation buffers will be properly packed. // that any instanced pointsprite emulation buffers will be properly packed.
if (buffer) if (buffer)
{ {
nextAvailableIndex = i + 1; nextAvailableIndex = i + 1;
}
} }
} }
......
...@@ -291,6 +291,9 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance) ...@@ -291,6 +291,9 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance)
} }
); );
// The WebGL test is drawn on a 2x2 canvas. Emulate this by setting a 2x2 viewport.
glViewport(0, 0, 2, 2);
GLuint program = CompileProgram(vs, fs); GLuint program = CompileProgram(vs, fs);
ASSERT_NE(program, 0u); ASSERT_NE(program, 0u);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
...@@ -341,14 +344,14 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance) ...@@ -341,14 +344,14 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance)
// Test the pixels around the target Red pixel to ensure // Test the pixels around the target Red pixel to ensure
// they are the expected color values // they are the expected color values
for (GLint y = 178; y < 180; ++y) for (GLint y = 0; y < 2; ++y)
{ {
for (GLint x = 178; x < 180; ++x) for (GLint x = 0; x < 2; ++x)
{ {
// 179x179 is expected to be a red pixel // 1x1 is expected to be a red pixel
// All others are black // All others are black
GLubyte expectedColor[4] = { 0, 0, 0, 0 }; GLubyte expectedColor[4] = { 0, 0, 0, 0 };
if (x == 179 && y == 179) if (x == 1 && y == 1)
{ {
expectedColor[0] = 255; expectedColor[0] = 255;
expectedColor[3] = 255; expectedColor[3] = 255;
...@@ -357,8 +360,6 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance) ...@@ -357,8 +360,6 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance)
} }
} }
swapBuffers();
GLfloat pointSizeRange[2] = {}; GLfloat pointSizeRange[2] = {};
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange); glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);
...@@ -374,9 +375,9 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance) ...@@ -374,9 +375,9 @@ TEST_P(PointSpritesTest, PointSizeEnabledCompliance)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Test the pixels to ensure the target is ALL Red pixels // Test the pixels to ensure the target is ALL Red pixels
for (GLint y = 178; y < 180; ++y) for (GLint y = 0; y < 2; ++y)
{ {
for (GLint x = 178; x < 180; ++x) for (GLint x = 0; x < 2; ++x)
{ {
EXPECT_PIXEL_EQ(x, y, 255, 0, 0, 255); EXPECT_PIXEL_EQ(x, y, 255, 0, 0, 255);
} }
......
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