ES31: Implement Geometry Shader resource queries on OpenGL
This patch intends to implement all geometry shader related
resource queries on OpenGL back-ends.
This patch also fixes a memory leak by releasing the geometry
shader compiler handle in the destructor of the Compiler.
BUG=angleproject:1941, angleproject:2261
TEST=angle_end2end_tests
Change-Id: Ieb69c162d2fc6c6550e145d1ec7948c3d36d4d15
Reviewed-on: https://chromium-review.googlesource.com/784552
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/GeometryShaderTest.cpp b/src/tests/gl_tests/GeometryShaderTest.cpp
index 62bf205..bf55d06 100644
--- a/src/tests/gl_tests/GeometryShaderTest.cpp
+++ b/src/tests/gl_tests/GeometryShaderTest.cpp
@@ -69,6 +69,64 @@
EXPECT_GL_NO_ERROR();
}
+// Verify that all the implementation dependent geometry shader related resource limits meet the
+// requirement of GL_EXT_geometry_shader SPEC.
+TEST_P(GeometryShaderTest, GeometryShaderImplementationDependentLimits)
+{
+ ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_EXT_geometry_shader"));
+
+ const std::map<GLenum, int> limits = {{GL_MAX_FRAMEBUFFER_LAYERS_EXT, 256},
+ {GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT, 1024},
+ {GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT, 12},
+ {GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT, 64},
+ {GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT, 64},
+ {GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, 256},
+ {GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT, 1024},
+ {GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT, 16},
+ {GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT, 0},
+ {GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT, 0},
+ {GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT, 0},
+ {GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT, 0},
+ {GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT, 32}};
+
+ GLint value;
+ for (const auto &limit : limits)
+ {
+ value = 0;
+ glGetIntegerv(limit.first, &value);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_GE(value, limit.second);
+ }
+
+ value = 0;
+ glGetIntegerv(GL_LAYER_PROVOKING_VERTEX_EXT, &value);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_TRUE(value == GL_FIRST_VERTEX_CONVENTION_EXT || value == GL_LAST_VERTEX_CONVENTION_EXT ||
+ value == GL_UNDEFINED_VERTEX_EXT);
+}
+
+// Verify that all the combined resource limits meet the requirement of GL_EXT_geometry_shader SPEC.
+TEST_P(GeometryShaderTest, CombinedResourceLimits)
+{
+ ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_EXT_geometry_shader"));
+
+ // See http://anglebug.com/2261.
+ ANGLE_SKIP_TEST_IF(IsAndroid());
+
+ const std::map<GLenum, int> limits = {{GL_MAX_UNIFORM_BUFFER_BINDINGS, 48},
+ {GL_MAX_COMBINED_UNIFORM_BLOCKS, 36},
+ {GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 64}};
+
+ GLint value;
+ for (const auto &limit : limits)
+ {
+ value = 0;
+ glGetIntegerv(limit.first, &value);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_GE(value, limit.second);
+ }
+}
+
ANGLE_INSTANTIATE_TEST(GeometryShaderTestES3, ES3_OPENGL(), ES3_OPENGLES(), ES3_D3D11());
ANGLE_INSTANTIATE_TEST(GeometryShaderTest, ES31_OPENGL(), ES31_OPENGLES(), ES31_D3D11());
}