@@ -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