Commit 01048a07 by Luc Ferron Committed by Commit Bot

Vulkan: Cleanup InstancingTest logic and enable tests for Vulkan

Bug: angleproject:2647 Change-Id: I3bf78c617a39191e725e0fa73befff4d42ac5962 Reviewed-on: https://chromium-review.googlesource.com/1111903Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
parent fec92a6f
......@@ -32,25 +32,6 @@ class InstancingTest : public ANGLETest
{
ANGLETest::SetUp();
mVertexAttribDivisorANGLE = nullptr;
mDrawArraysInstancedANGLE = nullptr;
mDrawElementsInstancedANGLE = nullptr;
const char *extensionString = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
if (strstr(extensionString, "GL_ANGLE_instanced_arrays"))
{
mVertexAttribDivisorANGLE =
(PFNGLVERTEXATTRIBDIVISORANGLEPROC)eglGetProcAddress("glVertexAttribDivisorANGLE");
mDrawArraysInstancedANGLE =
(PFNGLDRAWARRAYSINSTANCEDANGLEPROC)eglGetProcAddress("glDrawArraysInstancedANGLE");
mDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)eglGetProcAddress(
"glDrawElementsInstancedANGLE");
}
ASSERT_NE(nullptr, mVertexAttribDivisorANGLE);
ASSERT_NE(nullptr, mDrawArraysInstancedANGLE);
ASSERT_NE(nullptr, mDrawElementsInstancedANGLE);
// Initialize the vertex and index vectors
constexpr GLfloat qvertex1[3] = {-quadRadius, quadRadius, 0.0f};
constexpr GLfloat qvertex2[3] = {-quadRadius, -quadRadius, 0.0f};
......@@ -178,7 +159,7 @@ class InstancingTest : public ANGLETest
glEnableVertexAttribArray(instancePosLoc);
// Enable instancing
mVertexAttribDivisorANGLE(instancePosLoc, 1);
glVertexAttribDivisorANGLE(instancePosLoc, 1);
// Offset
GLint uniformLoc = glGetUniformLocation(mProgram, "u_offset");
......@@ -186,7 +167,7 @@ class InstancingTest : public ANGLETest
glUniform3fv(uniformLoc, 1, offset);
// Do the instanced draw
mDrawArraysInstancedANGLE(GL_TRIANGLES, first, count, instanceCount);
glDrawArraysInstancedANGLE(GL_TRIANGLES, first, count, instanceCount);
ASSERT_GL_NO_ERROR();
}
......@@ -227,12 +208,12 @@ class InstancingTest : public ANGLETest
glEnableVertexAttribArray(instancePosLoc);
// Enable instancing
mVertexAttribDivisorANGLE(instancePosLoc, 1);
glVertexAttribDivisorANGLE(instancePosLoc, 1);
// Do the instanced draw
mDrawElementsInstancedANGLE(GL_TRIANGLES, static_cast<GLsizei>(mIndices.size()),
GL_UNSIGNED_SHORT, mIndices.data(),
static_cast<GLsizei>(mInstances.size()) / 3);
glDrawElementsInstancedANGLE(GL_TRIANGLES, static_cast<GLsizei>(mIndices.size()),
GL_UNSIGNED_SHORT, mIndices.data(),
static_cast<GLsizei>(mInstances.size()) / 3);
ASSERT_GL_NO_ERROR();
......@@ -255,11 +236,6 @@ class InstancingTest : public ANGLETest
}
}
// Loaded entry points
PFNGLVERTEXATTRIBDIVISORANGLEPROC mVertexAttribDivisorANGLE;
PFNGLDRAWARRAYSINSTANCEDANGLEPROC mDrawArraysInstancedANGLE;
PFNGLDRAWELEMENTSINSTANCEDANGLEPROC mDrawElementsInstancedANGLE;
// Vertex data
std::vector<GLfloat> mQuadVertices;
std::vector<GLfloat> mNonIndexedVertices;
......@@ -315,6 +291,7 @@ TEST_P(InstancingTestAllConfigs, AttributeZeroInstanced)
TEST_P(InstancingTestAllConfigs, AttributeZeroNotInstanced)
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_ANGLE_instanced_arrays"));
const std::string vs =
"attribute vec3 a_position;\n"
"attribute vec3 a_instancePos;\n"
......@@ -330,6 +307,8 @@ TEST_P(InstancingTestAllConfigs, AttributeZeroNotInstanced)
// the non-instanced vertex attributes.
TEST_P(InstancingTestNo9_3, DrawArraysWithOffset)
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_ANGLE_instanced_arrays"));
const std::string vs =
"attribute vec3 a_position;\n"
"attribute vec3 a_instancePos;\n"
......@@ -354,6 +333,8 @@ TEST_P(InstancingTestNo9_3, DrawArraysWithOffset)
// On D3D11 FL9_3, this triggers a special codepath that emulates instanced points rendering.
TEST_P(InstancingTestPoints, DrawArrays)
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_ANGLE_instanced_arrays"));
// Disable D3D11 SDK Layers warnings checks, see ANGLE issue 667 for details
// On Win7, the D3D SDK Layers emits a false warning for these tests.
// This doesn't occur on Windows 10 (Version 1511) though.
......@@ -382,10 +363,10 @@ TEST_P(InstancingTestPoints, DrawArrays)
glEnableVertexAttribArray(instancePosLoc);
// Enable instancing
mVertexAttribDivisorANGLE(instancePosLoc, 1);
glVertexAttribDivisorANGLE(instancePosLoc, 1);
// Do the instanced draw
mDrawArraysInstancedANGLE(GL_POINTS, 0, 1, static_cast<GLsizei>(mInstances.size()) / 3);
glDrawArraysInstancedANGLE(GL_POINTS, 0, 1, static_cast<GLsizei>(mInstances.size()) / 3);
ASSERT_GL_NO_ERROR();
......@@ -396,6 +377,8 @@ TEST_P(InstancingTestPoints, DrawArrays)
// On D3D11 FL9_3, this triggers a special codepath that emulates instanced points rendering.
TEST_P(InstancingTestPoints, DrawElements)
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_ANGLE_instanced_arrays"));
// Disable D3D11 SDK Layers warnings checks, see ANGLE issue 667 for details
// On Win7, the D3D SDK Layers emits a false warning for these tests.
// This doesn't occur on Windows 10 (Version 1511) though.
......@@ -424,11 +407,12 @@ TEST_P(InstancingTestPoints, DrawElements)
glEnableVertexAttribArray(instancePosLoc);
// Enable instancing
mVertexAttribDivisorANGLE(instancePosLoc, 1);
glVertexAttribDivisorANGLE(instancePosLoc, 1);
// Do the instanced draw
mDrawElementsInstancedANGLE(GL_POINTS, static_cast<GLsizei>(mIndices.size()), GL_UNSIGNED_SHORT,
mIndices.data(), static_cast<GLsizei>(mInstances.size()) / 3);
glDrawElementsInstancedANGLE(GL_POINTS, static_cast<GLsizei>(mIndices.size()),
GL_UNSIGNED_SHORT, mIndices.data(),
static_cast<GLsizei>(mInstances.size()) / 3);
ASSERT_GL_NO_ERROR();
......@@ -444,6 +428,8 @@ class InstancingTestES31 : public InstancingTest
// Verify that VertexAttribDivisor can update both binding divisor and attribBinding.
TEST_P(InstancingTestES31, UpdateAttribBindingByVertexAttribDivisor)
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_ANGLE_instanced_arrays"));
const std::string vs =
"attribute vec3 a_instancePos;\n"
"attribute vec3 a_position;\n"
......@@ -531,9 +517,6 @@ TEST_P(InstancingTestES31, UpdateAttribBindingByVertexAttribDivisor)
glDeleteVertexArrays(1, &vao);
}
// TODO(lucferron): Diagnose and fix InstancingTestAllConfigs for Vulkan.
// http://anglebug.com/2647
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against. We test on D3D9 and D3D11 9_3 because they use special codepaths
// when attribute zero is instanced, unlike D3D11.
......@@ -542,7 +525,8 @@ ANGLE_INSTANTIATE_TEST(InstancingTestAllConfigs,
ES2_D3D11(),
ES2_D3D11_FL9_3(),
ES2_OPENGL(),
ES2_OPENGLES());
ES2_OPENGLES(),
ES2_VULKAN());
// TODO(jmadill): Figure out the situation with DrawInstanced on FL 9_3
ANGLE_INSTANTIATE_TEST(InstancingTestNo9_3, ES2_D3D9(), ES2_D3D11());
......
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