Skip to content

Commit

Permalink
Fix improper vertex array assignment in ANGLE test.
Browse files Browse the repository at this point in the history
Test: StateChangeTestES3.VertexArrayObjectAndDisabledAttributes
Bug: angleproject:4049
Change-Id: Ibda86585e9117686283081a76df213b2b2db0b6e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1879582
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
  • Loading branch information
null77 authored and Commit Bot committed Oct 25, 2019
1 parent 4db9614 commit 77fba58
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/tests/gl_tests/StateChangeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,14 +902,30 @@ TEST_P(StateChangeTestES3, VertexArrayObjectAndDisabledAttributes)
"{\n"
" colorOut = varyColor;\n"
"}";

ANGLE_GL_PROGRAM(dualProgram, kDualVS, kDualFS);
GLint positionLocation = glGetAttribLocation(dualProgram, "position");
ASSERT_NE(-1, positionLocation);
GLint colorLocation = glGetAttribLocation(dualProgram, "color");
ASSERT_NE(-1, colorLocation);

GLint singlePositionLocation = glGetAttribLocation(singleProgram, "position");
ASSERT_NE(-1, singlePositionLocation);
// Force consistent attribute locations
constexpr GLint positionLocation = 0;
constexpr GLint colorLocation = 1;

glBindAttribLocation(singleProgram, positionLocation, "position");
glBindAttribLocation(dualProgram, positionLocation, "position");
glBindAttribLocation(dualProgram, colorLocation, "color");

{
glLinkProgram(singleProgram);
GLint linkStatus;
glGetProgramiv(singleProgram, GL_LINK_STATUS, &linkStatus);
ASSERT_NE(linkStatus, 0);
}

{
glLinkProgram(dualProgram);
GLint linkStatus;
glGetProgramiv(dualProgram, GL_LINK_STATUS, &linkStatus);
ASSERT_NE(linkStatus, 0);
}

glUseProgram(singleProgram);

Expand All @@ -924,8 +940,8 @@ TEST_P(StateChangeTestES3, VertexArrayObjectAndDisabledAttributes)
GLVertexArray vertexArray;
glBindVertexArray(vertexArray);
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
glVertexAttribPointer(singlePositionLocation, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glEnableVertexAttribArray(singlePositionLocation);
glVertexAttribPointer(positionLocation, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glEnableVertexAttribArray(positionLocation);

// Should draw red.
glDrawArrays(GL_TRIANGLES, 0, 6);
Expand Down

0 comments on commit 77fba58

Please sign in to comment.