Commit d3ec341d by Shahbaz Youssefi Committed by Commit Bot

Fix LineLoopStateChangeTest to actually draw square and hourglass

The test claimed to be drawing an hourglass followed by a square. That is: ---- \/ /\ ---- followed by: ---- | | | | ---- With the end result being: ---- |\/| |/\| ---- However, in reality it was drawing two hour glasses with the same result. That is: ---- \/ /\ ---- followed by: |\/| |/\| Bug: angleproject:3361 Change-Id: I59a2930f78e6e448b6ccb2e5f70c73ff0f15a2ea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1561650 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 5646a7cc
...@@ -1146,7 +1146,7 @@ class LineLoopStateChangeTest : public StateChangeTest ...@@ -1146,7 +1146,7 @@ class LineLoopStateChangeTest : public StateChangeTest
setConfigAlphaBits(8); setConfigAlphaBits(8);
} }
void validateSquareAndHourglass() void validateSquareAndHourglass() const
{ {
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
...@@ -1169,8 +1169,6 @@ class LineLoopStateChangeTest : public StateChangeTest ...@@ -1169,8 +1169,6 @@ class LineLoopStateChangeTest : public StateChangeTest
// Verify line is closed between the 2 last vertices // Verify line is closed between the 2 last vertices
EXPECT_PIXEL_COLOR_EQ((quarterWidth * 2), quarterHeight, GLColor::blue); EXPECT_PIXEL_COLOR_EQ((quarterWidth * 2), quarterHeight, GLColor::blue);
} }
GLint mPositionLocation;
}; };
// Draw an hourglass with a drawElements call followed by a square with drawArrays. // Draw an hourglass with a drawElements call followed by a square with drawArrays.
...@@ -1184,13 +1182,13 @@ TEST_P(LineLoopStateChangeTest, DrawElementsThenDrawArrays) ...@@ -1184,13 +1182,13 @@ TEST_P(LineLoopStateChangeTest, DrawElementsThenDrawArrays)
// We expect to draw a square with these 4 vertices with a drawArray call. // We expect to draw a square with these 4 vertices with a drawArray call.
std::vector<Vector3> vertices; std::vector<Vector3> vertices;
CreatePixelCenterWindowCoords({{8, 8}, {8, 24}, {24, 8}, {24, 24}}, getWindowWidth(), CreatePixelCenterWindowCoords({{8, 8}, {8, 24}, {24, 24}, {24, 8}}, getWindowWidth(),
getWindowHeight(), &vertices); getWindowHeight(), &vertices);
// If we use these indices to draw however, we should be drawing an hourglass. // If we use these indices to draw however, we should be drawing an hourglass.
auto indices = std::vector<GLushort>{0, 2, 1, 3}; auto indices = std::vector<GLushort>{0, 2, 1, 3};
mPositionLocation = glGetAttribLocation(program, essl1_shaders::PositionAttrib()); GLint mPositionLocation = glGetAttribLocation(program, essl1_shaders::PositionAttrib());
ASSERT_NE(-1, mPositionLocation); ASSERT_NE(-1, mPositionLocation);
GLBuffer vertexBuffer; GLBuffer vertexBuffer;
...@@ -1225,13 +1223,13 @@ TEST_P(LineLoopStateChangeTest, DrawArraysThenDrawElements) ...@@ -1225,13 +1223,13 @@ TEST_P(LineLoopStateChangeTest, DrawArraysThenDrawElements)
// We expect to draw a square with these 4 vertices with a drawArray call. // We expect to draw a square with these 4 vertices with a drawArray call.
std::vector<Vector3> vertices; std::vector<Vector3> vertices;
CreatePixelCenterWindowCoords({{8, 8}, {8, 24}, {24, 8}, {24, 24}}, getWindowWidth(), CreatePixelCenterWindowCoords({{8, 8}, {8, 24}, {24, 24}, {24, 8}}, getWindowWidth(),
getWindowHeight(), &vertices); getWindowHeight(), &vertices);
// If we use these indices to draw however, we should be drawing an hourglass. // If we use these indices to draw however, we should be drawing an hourglass.
auto indices = std::vector<GLushort>{0, 2, 1, 3}; auto indices = std::vector<GLushort>{0, 2, 1, 3};
mPositionLocation = glGetAttribLocation(program, essl1_shaders::PositionAttrib()); GLint mPositionLocation = glGetAttribLocation(program, essl1_shaders::PositionAttrib());
ASSERT_NE(-1, mPositionLocation); ASSERT_NE(-1, mPositionLocation);
GLBuffer vertexBuffer; GLBuffer vertexBuffer;
......
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