ES31: Implement glDispatchCompute for OpenGL backend
This patch refers to https://chromium-review.googlesource.com/c/380639/
BUG=angleproject:1955
TESTCASE=angle_end2end_tests
Change-Id: Iafd7a6ba2d71c0b332d9267a1260d9dbd9800c02
Reviewed-on: https://chromium-review.googlesource.com/462089
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/ComputeShaderTest.cpp b/src/tests/gl_tests/ComputeShaderTest.cpp
index 4a206a4..c2f8036 100644
--- a/src/tests/gl_tests/ComputeShaderTest.cpp
+++ b/src/tests/gl_tests/ComputeShaderTest.cpp
@@ -21,6 +21,12 @@
ComputeShaderTest() {}
};
+class DispatchComputeTest : public ANGLETest
+{
+ protected:
+ DispatchComputeTest() {}
+};
+
class ComputeShaderTestES3 : public ANGLETest
{
protected:
@@ -225,6 +231,25 @@
ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
}
+// TODO(Xinghua): A temporary test for glDispatchCompute, remove and merge it
+// ComputeShaderTest after implementing this API on D3D backend.
+TEST_P(DispatchComputeTest, DispatchCompute)
+{
+ const std::string csSource =
+ "#version 310 es\n"
+ "layout(local_size_x=4, local_size_y=3, local_size_z=2) in;\n"
+ "void main()\n"
+ "{\n"
+ " uvec3 temp1 = gl_NumWorkGroups;\n"
+ "}\n";
+
+ ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
+
+ glUseProgram(program.get());
+ glDispatchCompute(8, 4, 2);
+ EXPECT_GL_NO_ERROR();
+}
+
// Check that it is not possible to create a compute shader when the context does not support ES
// 3.10
TEST_P(ComputeShaderTestES3, NotSupported)
@@ -235,6 +260,7 @@
}
ANGLE_INSTANTIATE_TEST(ComputeShaderTest, ES31_OPENGL(), ES31_OPENGLES(), ES31_D3D11());
+ANGLE_INSTANTIATE_TEST(DispatchComputeTest, ES31_OPENGL(), ES31_OPENGLES());
ANGLE_INSTANTIATE_TEST(ComputeShaderTestES3, ES3_OPENGL(), ES3_OPENGLES());
} // namespace