Commit 041ebfed by Jamie Madill Committed by Commit Bot

Speed up InstancingTest.LineLoop.

This test was taking 14-20 seconds in release mode. Likely because of the way we were issuing a ReadPixels and "std::endl" to a stream for every pixel of a 256x256 Framebuffer. Instead issue a single ReadPixels call and no stream flushes. Now runs in less than 500ms. Helps prevent timeouts when running tests multi-process. Also enables the test on D3D9. Bug: angleproject:3162 Change-Id: I27aad773040d6b6668cbde003802345e01044a7d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2047414Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 8257ac30
...@@ -486,9 +486,6 @@ TEST_P(InstancingTest, LineLoop) ...@@ -486,9 +486,6 @@ TEST_P(InstancingTest, LineLoop)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_instanced_arrays")); ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_instanced_arrays"));
// TODO(hqle): D3D9 seems to draw very slow here, probably due to invariant
ANGLE_SKIP_TEST_IF(IsD3D9());
constexpr char kVS[] = R"( constexpr char kVS[] = R"(
attribute vec2 a_position; attribute vec2 a_position;
// x,y = offset, z = scale // x,y = offset, z = scale
...@@ -577,31 +574,18 @@ void main() ...@@ -577,31 +574,18 @@ void main()
glDrawArraysInstancedANGLE(GL_LINE_LOOP, 0, ArraySize(vertices) / 2, instances); glDrawArraysInstancedANGLE(GL_LINE_LOOP, 0, ArraySize(vertices) / 2, instances);
for (int y = 0; y < getWindowHeight(); ++y) std::vector<GLColor> actualPixels(getWindowWidth() * getWindowHeight());
{ glReadPixels(0, 0, getWindowWidth(), getWindowHeight(), GL_RGBA, GL_UNSIGNED_BYTE,
for (int x = 0; x < getWindowWidth(); ++x) actualPixels.data());
{ EXPECT_EQ(expectedPixels, actualPixels);
int idx = y * getWindowWidth() + x;
GLColor expectedColor = expectedPixels[idx];
EXPECT_PIXEL_COLOR_EQ(x, y, expectedColor) << std::endl;
}
}
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glDrawElementsInstancedANGLE(GL_LINE_LOOP, ArraySize(lineloopAsStripIndices) - 1, glDrawElementsInstancedANGLE(GL_LINE_LOOP, ArraySize(lineloopAsStripIndices) - 1,
GL_UNSIGNED_SHORT, 0, instances); GL_UNSIGNED_SHORT, 0, instances);
for (int y = 0; y < getWindowHeight(); ++y) glReadPixels(0, 0, getWindowWidth(), getWindowHeight(), GL_RGBA, GL_UNSIGNED_BYTE,
{ actualPixels.data());
for (int x = 0; x < getWindowWidth(); ++x) EXPECT_EQ(expectedPixels, actualPixels);
{
int idx = y * getWindowWidth() + x;
GLColor expectedColor = expectedPixels[idx];
EXPECT_PIXEL_COLOR_EQ(x, y, expectedColor) << std::endl;
}
}
} }
class InstancingTestES3 : public InstancingTest class InstancingTestES3 : public InstancingTest
......
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