Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e3a5738

Browse files
null77Commit Bot
authored andcommitted
Fix VertexAttributeTest.DrawArraysWithBufferOffset.
This test was reading past the end of a buffer into undefined data. Bug: angleproject:3951 Bug: angleproject:4163 Bug: angleproject:4258 Bug: angleproject:4269 Change-Id: I54ab9aa0cd1442184692e60c7f99f2139a855d63 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2483842 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
1 parent 188d0fe commit e3a5738

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

src/tests/gl_tests/VertexAttributeTest.cpp

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,38 +1204,28 @@ TEST_P(VertexAttributeOORTest, ANGLEDrawArraysOutOfBoundsCases)
12041204
// Verify that using a different start vertex doesn't mess up the draw.
12051205
TEST_P(VertexAttributeTest, DrawArraysWithBufferOffset)
12061206
{
1207-
// anglebug.com/4258
1208-
ANGLE_SKIP_TEST_IF(IsOpenGL() && IsNVIDIA() && IsOSX());
1209-
1210-
// anglebug.com/4163
1211-
ANGLE_SKIP_TEST_IF(IsD3D11() && IsNVIDIA() && IsWindows7());
1212-
1213-
// TODO(jmadill): Diagnose this failure.
1214-
ANGLE_SKIP_TEST_IF(IsD3D11_FL93());
1215-
1216-
// TODO(geofflang): Figure out why this is broken on AMD OpenGL
1217-
ANGLE_SKIP_TEST_IF(IsAMD() && IsOpenGL());
1218-
1219-
// TODO(cnorthrop): Test this again on more recent drivers. http://anglebug.com/3951
1220-
ANGLE_SKIP_TEST_IF(IsLinux() && IsNVIDIA() && IsVulkan());
1221-
1222-
// TODO(https://anglebug.com/4269): Test is flaky on OpenGL and Metal on Mac NVIDIA.
1223-
ANGLE_SKIP_TEST_IF(IsOSX() && IsNVIDIA());
1224-
12251207
initBasicProgram();
12261208
glUseProgram(mProgram);
12271209

12281210
std::array<GLfloat, kVertexCount> inputData;
12291211
std::array<GLfloat, kVertexCount> expectedData;
12301212
InitTestData(inputData, expectedData);
12311213

1232-
auto quadVertices = GetQuadVertices();
1233-
GLsizei quadVerticesSize = static_cast<GLsizei>(quadVertices.size() * sizeof(quadVertices[0]));
1214+
auto quadVertices = GetQuadVertices();
1215+
1216+
std::vector<Vector3> quadVerticesPlusOne(quadVertices.size() + 1);
1217+
for (size_t index = 0; index < quadVerticesPlusOne.size(); ++index)
1218+
{
1219+
quadVerticesPlusOne[index] = quadVertices[index % quadVertices.size()];
1220+
}
1221+
1222+
GLsizei quadVerticesSize =
1223+
static_cast<GLsizei>(quadVerticesPlusOne.size() * sizeof(quadVertices[0]));
12341224

12351225
glGenBuffers(1, &mQuadBuffer);
12361226
glBindBuffer(GL_ARRAY_BUFFER, mQuadBuffer);
1237-
glBufferData(GL_ARRAY_BUFFER, quadVerticesSize + sizeof(Vector3), nullptr, GL_STATIC_DRAW);
1238-
glBufferSubData(GL_ARRAY_BUFFER, 0, quadVerticesSize, quadVertices.data());
1227+
glBufferData(GL_ARRAY_BUFFER, quadVerticesSize, nullptr, GL_STATIC_DRAW);
1228+
glBufferSubData(GL_ARRAY_BUFFER, 0, quadVerticesSize, quadVerticesPlusOne.data());
12391229

12401230
GLint positionLocation = glGetAttribLocation(mProgram, "position");
12411231
ASSERT_NE(-1, positionLocation);

0 commit comments

Comments
 (0)