Skip to content

Commit 77fba58

Browse files
null77Commit Bot
authored andcommitted
Fix improper vertex array assignment in ANGLE test.
Test: StateChangeTestES3.VertexArrayObjectAndDisabledAttributes Bug: angleproject:4049 Change-Id: Ibda86585e9117686283081a76df213b2b2db0b6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1879582 Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Jamie Madill <[email protected]>
1 parent 4db9614 commit 77fba58

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

src/tests/gl_tests/StateChangeTest.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,30 @@ TEST_P(StateChangeTestES3, VertexArrayObjectAndDisabledAttributes)
902902
"{\n"
903903
" colorOut = varyColor;\n"
904904
"}";
905+
905906
ANGLE_GL_PROGRAM(dualProgram, kDualVS, kDualFS);
906-
GLint positionLocation = glGetAttribLocation(dualProgram, "position");
907-
ASSERT_NE(-1, positionLocation);
908-
GLint colorLocation = glGetAttribLocation(dualProgram, "color");
909-
ASSERT_NE(-1, colorLocation);
910907

911-
GLint singlePositionLocation = glGetAttribLocation(singleProgram, "position");
912-
ASSERT_NE(-1, singlePositionLocation);
908+
// Force consistent attribute locations
909+
constexpr GLint positionLocation = 0;
910+
constexpr GLint colorLocation = 1;
911+
912+
glBindAttribLocation(singleProgram, positionLocation, "position");
913+
glBindAttribLocation(dualProgram, positionLocation, "position");
914+
glBindAttribLocation(dualProgram, colorLocation, "color");
915+
916+
{
917+
glLinkProgram(singleProgram);
918+
GLint linkStatus;
919+
glGetProgramiv(singleProgram, GL_LINK_STATUS, &linkStatus);
920+
ASSERT_NE(linkStatus, 0);
921+
}
922+
923+
{
924+
glLinkProgram(dualProgram);
925+
GLint linkStatus;
926+
glGetProgramiv(dualProgram, GL_LINK_STATUS, &linkStatus);
927+
ASSERT_NE(linkStatus, 0);
928+
}
913929

914930
glUseProgram(singleProgram);
915931

@@ -924,8 +940,8 @@ TEST_P(StateChangeTestES3, VertexArrayObjectAndDisabledAttributes)
924940
GLVertexArray vertexArray;
925941
glBindVertexArray(vertexArray);
926942
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
927-
glVertexAttribPointer(singlePositionLocation, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
928-
glEnableVertexAttribArray(singlePositionLocation);
943+
glVertexAttribPointer(positionLocation, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
944+
glEnableVertexAttribArray(positionLocation);
929945

930946
// Should draw red.
931947
glDrawArrays(GL_TRIANGLES, 0, 6);

0 commit comments

Comments
 (0)