blob: 1e8b85582c9402ec2469f53e35a04b48f0391fdb [file] [log] [blame]
Martin Radev4c4c8e72016-08-04 12:25:34 +03001//
2// Copyright 2016 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// ComputeShaderTest:
7// Compute shader specific tests.
8
9#include "test_utils/ANGLETest.h"
10#include "test_utils/gl_raii.h"
11#include <vector>
12
13using namespace angle;
14
15namespace
16{
17
18class ComputeShaderTest : public ANGLETest
19{
20 protected:
21 ComputeShaderTest() {}
22};
23
24class ComputeShaderTestES3 : public ANGLETest
25{
26 protected:
27 ComputeShaderTestES3() {}
28};
29
30// link a simple compute program. It should be successful.
31TEST_P(ComputeShaderTest, LinkComputeProgram)
32{
33 const std::string csSource =
Yunchao Hecddcb592017-11-13 15:27:35 +080034 R"(#version 310 es
35 layout(local_size_x=1) in;
36 void main()
37 {\
38 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +030039
40 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
41
42 EXPECT_GL_NO_ERROR();
43}
44
Yunchao He85072e82017-11-14 15:43:28 +080045// Link a simple compute program. Then detach the shader and dispatch compute.
46// It should be successful.
47TEST_P(ComputeShaderTest, DetachShaderAfterLinkSuccess)
48{
49 const std::string csSource =
50 R"(#version 310 es
51 layout(local_size_x=1) in;
52 void main()
53 {
54 })";
55
56 GLuint program = glCreateProgram();
57
58 GLuint cs = CompileShader(GL_COMPUTE_SHADER, csSource);
59 EXPECT_NE(0u, cs);
60
61 glAttachShader(program, cs);
62 glDeleteShader(cs);
63
64 glLinkProgram(program);
65 GLint linkStatus;
66 glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
Yunchao He1f679cc2017-11-29 18:06:00 +080067 EXPECT_GL_TRUE(linkStatus);
Yunchao He85072e82017-11-14 15:43:28 +080068
69 glDetachShader(program, cs);
70 EXPECT_GL_NO_ERROR();
71
72 glUseProgram(program);
73 glDispatchCompute(8, 4, 2);
74 EXPECT_GL_NO_ERROR();
75}
76
Martin Radev4c4c8e72016-08-04 12:25:34 +030077// link a simple compute program. There is no local size and linking should fail.
78TEST_P(ComputeShaderTest, LinkComputeProgramNoLocalSizeLinkError)
79{
80 const std::string csSource =
Yunchao Hecddcb592017-11-13 15:27:35 +080081 R"(#version 310 es
82 void main()
83 {
84 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +030085
86 GLuint program = CompileComputeProgram(csSource, false);
87 EXPECT_EQ(0u, program);
88
89 glDeleteProgram(program);
90
91 EXPECT_GL_NO_ERROR();
92}
93
94// link a simple compute program.
95// make sure that uniforms and uniform samplers get recorded
96TEST_P(ComputeShaderTest, LinkComputeProgramWithUniforms)
97{
98 const std::string csSource =
Olli Etuaho7caa80e2017-11-14 15:03:14 +020099 R"(#version 310 es
100 precision mediump sampler2D;
101 layout(local_size_x=1) in;
102 uniform int myUniformInt;
103 uniform sampler2D myUniformSampler;
104 layout(rgba32i) uniform highp writeonly iimage2D imageOut;
105 void main()
106 {
107 int q = myUniformInt;
108 vec4 v = textureLod(myUniformSampler, vec2(0.0), 0.0);
109 imageStore(imageOut, ivec2(0), ivec4(v) * q);
110 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +0300111
112 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
113
Olli Etuaho7caa80e2017-11-14 15:03:14 +0200114 GLint uniformLoc = glGetUniformLocation(program.get(), "myUniformInt");
115 EXPECT_NE(-1, uniformLoc);
Martin Radev4c4c8e72016-08-04 12:25:34 +0300116
Olli Etuaho7caa80e2017-11-14 15:03:14 +0200117 uniformLoc = glGetUniformLocation(program.get(), "myUniformSampler");
118 EXPECT_NE(-1, uniformLoc);
Martin Radev4c4c8e72016-08-04 12:25:34 +0300119
120 EXPECT_GL_NO_ERROR();
121}
122
123// Attach both compute and non-compute shaders. A link time error should occur.
124// OpenGL ES 3.10, 7.3 Program Objects
125TEST_P(ComputeShaderTest, AttachMultipleShaders)
126{
127 const std::string csSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800128 R"(#version 310 es
129 layout(local_size_x=1) in;
130 void main()
131 {
132 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +0300133
134 const std::string vsSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800135 R"(#version 310 es
136 void main()
137 {
138 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +0300139
140 const std::string fsSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800141 R"(#version 310 es
142 void main()
143 {
144 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +0300145
146 GLuint program = glCreateProgram();
147
148 GLuint vs = CompileShader(GL_VERTEX_SHADER, vsSource);
149 GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fsSource);
150 GLuint cs = CompileShader(GL_COMPUTE_SHADER, csSource);
151
152 EXPECT_NE(0u, vs);
153 EXPECT_NE(0u, fs);
154 EXPECT_NE(0u, cs);
155
156 glAttachShader(program, vs);
157 glDeleteShader(vs);
158
159 glAttachShader(program, fs);
160 glDeleteShader(fs);
161
162 glAttachShader(program, cs);
163 glDeleteShader(cs);
164
165 glLinkProgram(program);
166
167 GLint linkStatus;
168 glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
169
Yunchao He1f679cc2017-11-29 18:06:00 +0800170 EXPECT_GL_FALSE(linkStatus);
Martin Radev4c4c8e72016-08-04 12:25:34 +0300171
172 EXPECT_GL_NO_ERROR();
173}
174
175// Attach a vertex, fragment and compute shader.
176// Query for the number of attached shaders and check the count.
177TEST_P(ComputeShaderTest, AttachmentCount)
178{
Martin Radev4c4c8e72016-08-04 12:25:34 +0300179 const std::string csSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800180 R"(#version 310 es
181 layout(local_size_x=1) in;
182 void main()
183 {
184 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +0300185
186 const std::string vsSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800187 R"(#version 310 es
188 void main()
189 {
190 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +0300191
192 const std::string fsSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800193 R"(#version 310 es
194 void main()
195 {
196 })";
Martin Radev4c4c8e72016-08-04 12:25:34 +0300197
198 GLuint program = glCreateProgram();
199
200 GLuint vs = CompileShader(GL_VERTEX_SHADER, vsSource);
201 GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fsSource);
202 GLuint cs = CompileShader(GL_COMPUTE_SHADER, csSource);
203
204 EXPECT_NE(0u, vs);
205 EXPECT_NE(0u, fs);
206 EXPECT_NE(0u, cs);
207
208 glAttachShader(program, vs);
209 glDeleteShader(vs);
210
211 glAttachShader(program, fs);
212 glDeleteShader(fs);
213
214 glAttachShader(program, cs);
215 glDeleteShader(cs);
216
217 GLint numAttachedShaders;
218 glGetProgramiv(program, GL_ATTACHED_SHADERS, &numAttachedShaders);
219
220 EXPECT_EQ(3, numAttachedShaders);
221
222 glDeleteProgram(program);
223
224 EXPECT_GL_NO_ERROR();
225}
226
Yunchao Hecddcb592017-11-13 15:27:35 +0800227// Attach a compute shader and link, but start rendering.
228TEST_P(ComputeShaderTest, StartRenderingWithComputeProgram)
229{
230 const std::string csSource =
231 R"(#version 310 es
232 layout(local_size_x=1) in;
233 void main()
234 {
235 })";
236
237 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
238 EXPECT_GL_NO_ERROR();
239
240 glUseProgram(program);
241 glDrawArrays(GL_POINTS, 0, 2);
242 EXPECT_GL_ERROR(GL_INVALID_OPERATION);
243}
244
Yunchao He70b715c2017-11-07 14:59:15 +0800245// Attach a vertex and fragment shader and link, but dispatch compute.
246TEST_P(ComputeShaderTest, DispatchComputeWithRenderingProgram)
247{
248 const std::string vsSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800249 R"(#version 310 es
250 void main()
251 {
252 })";
Yunchao He70b715c2017-11-07 14:59:15 +0800253
254 const std::string fsSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800255 R"(#version 310 es
256 void main()
257 {
258 })";
Yunchao He70b715c2017-11-07 14:59:15 +0800259
260 GLuint program = glCreateProgram();
261
262 GLuint vs = CompileShader(GL_VERTEX_SHADER, vsSource);
263 GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fsSource);
264
265 EXPECT_NE(0u, vs);
266 EXPECT_NE(0u, fs);
267
268 glAttachShader(program, vs);
269 glDeleteShader(vs);
270
271 glAttachShader(program, fs);
272 glDeleteShader(fs);
273
274 glLinkProgram(program);
275
276 GLint linkStatus;
277 glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
Yunchao He1f679cc2017-11-29 18:06:00 +0800278 EXPECT_GL_TRUE(linkStatus);
Yunchao He70b715c2017-11-07 14:59:15 +0800279
280 EXPECT_GL_NO_ERROR();
281
282 glUseProgram(program);
283 glDispatchCompute(8, 4, 2);
284 EXPECT_GL_ERROR(GL_INVALID_OPERATION);
285}
286
Xinghua Caob1239382016-12-13 15:07:05 +0800287// Access all compute shader special variables.
288TEST_P(ComputeShaderTest, AccessAllSpecialVariables)
289{
290 const std::string csSource =
Olli Etuaho7caa80e2017-11-14 15:03:14 +0200291 R"(#version 310 es
292 layout(local_size_x=4, local_size_y=3, local_size_z=2) in;
293 layout(rgba32ui) uniform highp writeonly uimage2D imageOut;
294 void main()
295 {
296 uvec3 temp1 = gl_NumWorkGroups;
297 uvec3 temp2 = gl_WorkGroupSize;
298 uvec3 temp3 = gl_WorkGroupID;
299 uvec3 temp4 = gl_LocalInvocationID;
300 uvec3 temp5 = gl_GlobalInvocationID;
301 uint temp6 = gl_LocalInvocationIndex;
302 imageStore(imageOut, ivec2(gl_LocalInvocationIndex, 0), uvec4(temp1 + temp2 + temp3 + temp4 + temp5, temp6));
303 })";
Xinghua Caob1239382016-12-13 15:07:05 +0800304
305 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
306}
307
308// Access part compute shader special variables.
309TEST_P(ComputeShaderTest, AccessPartSpecialVariables)
310{
311 const std::string csSource =
Olli Etuaho7caa80e2017-11-14 15:03:14 +0200312 R"(#version 310 es
313 layout(local_size_x=4, local_size_y=3, local_size_z=2) in;
314 layout(rgba32ui) uniform highp writeonly uimage2D imageOut;
315 void main()
316 {
317 uvec3 temp1 = gl_WorkGroupSize;
318 uvec3 temp2 = gl_WorkGroupID;
319 uint temp3 = gl_LocalInvocationIndex;
320 imageStore(imageOut, ivec2(gl_LocalInvocationIndex, 0), uvec4(temp1 + temp2, temp3));
321 })";
Xinghua Caob1239382016-12-13 15:07:05 +0800322
323 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
324}
325
Xinghua Cao73badc02017-03-29 19:14:53 +0800326// Use glDispatchCompute to define work group count.
327TEST_P(ComputeShaderTest, DispatchCompute)
Xinghua Cao2b396592017-03-29 15:36:04 +0800328{
329 const std::string csSource =
Olli Etuaho7caa80e2017-11-14 15:03:14 +0200330 R"(#version 310 es
331 layout(local_size_x=4, local_size_y=3, local_size_z=2) in;
332 layout(rgba32ui) uniform highp writeonly uimage2D imageOut;
333 void main()
334 {
335 uvec3 temp = gl_NumWorkGroups;
336 imageStore(imageOut, ivec2(0), uvec4(temp, 0u));
337 })";
Xinghua Cao2b396592017-03-29 15:36:04 +0800338
339 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
340
341 glUseProgram(program.get());
342 glDispatchCompute(8, 4, 2);
343 EXPECT_GL_NO_ERROR();
344}
345
Xinghua Cao65ec0b22017-03-28 16:10:52 +0800346// Use image uniform to write texture in compute shader, and verify the content is expected.
347TEST_P(ComputeShaderTest, BindImageTexture)
348{
Xinghua Cao0328b572017-06-26 15:51:36 +0800349 ANGLE_SKIP_TEST_IF(IsD3D11());
Xinghua Cao65ec0b22017-03-28 16:10:52 +0800350
351 GLTexture mTexture[2];
352 GLFramebuffer mFramebuffer;
353 const std::string csSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800354 R"(#version 310 es
355 layout(local_size_x=2, local_size_y=2, local_size_z=1) in;
356 layout(r32ui, binding = 0) writeonly uniform highp uimage2D uImage[2];
357 void main()
358 {
359 imageStore(uImage[0], ivec2(gl_LocalInvocationIndex, gl_WorkGroupID.x), uvec4(100, 0,
360 0, 0));
361 imageStore(uImage[1], ivec2(gl_LocalInvocationIndex, gl_WorkGroupID.x), uvec4(100, 0,
362 0, 0));
363 })";
Xinghua Cao65ec0b22017-03-28 16:10:52 +0800364
365 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
366 glUseProgram(program.get());
367 int width = 4, height = 2;
368 GLuint inputValues[] = {200, 200, 200, 200, 200, 200, 200, 200};
369
370 glBindTexture(GL_TEXTURE_2D, mTexture[0]);
371 glTexStorage2D(GL_TEXTURE_2D, 1, GL_R32UI, width, height);
372 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RED_INTEGER, GL_UNSIGNED_INT,
373 inputValues);
374 EXPECT_GL_NO_ERROR();
375
376 glBindImageTexture(0, mTexture[0], 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_R32UI);
377 EXPECT_GL_NO_ERROR();
378
379 glBindTexture(GL_TEXTURE_2D, mTexture[1]);
380 glTexStorage2D(GL_TEXTURE_2D, 1, GL_R32UI, width, height);
381 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RED_INTEGER, GL_UNSIGNED_INT,
382 inputValues);
383 EXPECT_GL_NO_ERROR();
384
385 glBindImageTexture(1, mTexture[1], 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_R32UI);
386 EXPECT_GL_NO_ERROR();
387
388 glDispatchCompute(2, 1, 1);
389 EXPECT_GL_NO_ERROR();
390
391 glUseProgram(0);
392 GLuint outputValues[2][8];
393 GLuint expectedValue = 100;
394 glBindFramebuffer(GL_READ_FRAMEBUFFER, mFramebuffer);
395
396 glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture[0],
397 0);
398 EXPECT_GL_NO_ERROR();
399 glReadPixels(0, 0, width, height, GL_RED_INTEGER, GL_UNSIGNED_INT, outputValues[0]);
400 EXPECT_GL_NO_ERROR();
401
402 glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture[1],
403 0);
404 EXPECT_GL_NO_ERROR();
405 glReadPixels(0, 0, width, height, GL_RED_INTEGER, GL_UNSIGNED_INT, outputValues[1]);
406 EXPECT_GL_NO_ERROR();
407
408 for (int i = 0; i < width * height; i++)
409 {
410 EXPECT_EQ(expectedValue, outputValues[0][i]);
411 EXPECT_EQ(expectedValue, outputValues[1][i]);
412 }
413}
414
Xinghua Cao0328b572017-06-26 15:51:36 +0800415// When declare a image array without a binding qualifier, all elements are bound to unit zero.
416TEST_P(ComputeShaderTest, ImageArrayWithoutBindingQualifier)
417{
418 ANGLE_SKIP_TEST_IF(IsD3D11());
419
420 // TODO(xinghua.cao@intel.com): On AMD desktop OpenGL, bind two image variables to unit 0,
421 // only one variable is valid.
Corentin Wallez2bde9192017-07-28 14:15:01 -0400422 ANGLE_SKIP_TEST_IF(IsAMD() && IsDesktopOpenGL());
Xinghua Cao0328b572017-06-26 15:51:36 +0800423
424 GLTexture mTexture;
425 GLFramebuffer mFramebuffer;
426 const std::string csSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800427 R"(#version 310 es
428 layout(local_size_x=2, local_size_y=2, local_size_z=1) in;
429 layout(r32ui) writeonly uniform highp uimage2D uImage[2];
430 void main()
431 {
432 imageStore(uImage[0], ivec2(gl_LocalInvocationIndex, 0), uvec4(100, 0, 0, 0));
433 imageStore(uImage[1], ivec2(gl_LocalInvocationIndex, 1), uvec4(100, 0, 0, 0));
434 })";
Xinghua Cao0328b572017-06-26 15:51:36 +0800435
436 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
437 glUseProgram(program.get());
438 constexpr int kTextureWidth = 4, kTextureHeight = 2;
439 GLuint inputValues[] = {200, 200, 200, 200, 200, 200, 200, 200};
440
441 glBindTexture(GL_TEXTURE_2D, mTexture);
442 glTexStorage2D(GL_TEXTURE_2D, 1, GL_R32UI, kTextureWidth, kTextureHeight);
443 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, kTextureWidth, kTextureHeight, GL_RED_INTEGER,
444 GL_UNSIGNED_INT, inputValues);
445 EXPECT_GL_NO_ERROR();
446
447 glBindImageTexture(0, mTexture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_R32UI);
448 glDispatchCompute(1, 1, 1);
449 EXPECT_GL_NO_ERROR();
450
451 glUseProgram(0);
452 glBindFramebuffer(GL_READ_FRAMEBUFFER, mFramebuffer);
453
454 glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0);
455 GLuint outputValues[8];
456 glReadPixels(0, 0, kTextureWidth, kTextureHeight, GL_RED_INTEGER, GL_UNSIGNED_INT,
457 outputValues);
458 EXPECT_GL_NO_ERROR();
459
460 GLuint expectedValue = 100;
461 for (int i = 0; i < kTextureWidth * kTextureHeight; i++)
462 {
463 EXPECT_EQ(expectedValue, outputValues[i]);
464 }
465}
466
Xinghua Cao711b7a12017-10-09 13:38:12 +0800467// imageLoad functions
468TEST_P(ComputeShaderTest, ImageLoad)
469{
470 const std::string csSource =
Olli Etuaho7caa80e2017-11-14 15:03:14 +0200471 R"(#version 310 es
472 layout(local_size_x=8) in;
473 layout(rgba8) uniform highp readonly image2D mImage2DInput;
474 layout(rgba16i) uniform highp readonly iimageCube mImageCubeInput;
475 layout(rgba32ui) uniform highp readonly uimage3D mImage3DInput;
476 layout(r32i) uniform highp writeonly iimage2D imageOut;
477 void main()
478 {
479 vec4 result2d = imageLoad(mImage2DInput, ivec2(gl_LocalInvocationID.xy));
480 ivec4 resultCube = imageLoad(mImageCubeInput, ivec3(gl_LocalInvocationID.xyz));
481 uvec4 result3d = imageLoad(mImage3DInput, ivec3(gl_LocalInvocationID.xyz));
482 imageStore(imageOut, ivec2(gl_LocalInvocationIndex, 0), ivec4(result2d) + resultCube + ivec4(result3d));
483 })";
Xinghua Cao711b7a12017-10-09 13:38:12 +0800484
485 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
486 EXPECT_GL_NO_ERROR();
487}
488
489// imageStore functions
490TEST_P(ComputeShaderTest, ImageStore)
491{
492 const std::string csSource =
Yunchao Hecddcb592017-11-13 15:27:35 +0800493 R"(#version 310 es
494 layout(local_size_x=8) in;
495 layout(rgba16f) uniform highp writeonly imageCube mImageCubeOutput;
496 layout(r32f) uniform highp writeonly image3D mImage3DOutput;
497 layout(rgba8ui) uniform highp writeonly uimage2DArray mImage2DArrayOutput;
498 void main()
499 {
500 imageStore(mImageCubeOutput, ivec3(gl_LocalInvocationID.xyz), vec4(0.0));
501 imageStore(mImage3DOutput, ivec3(gl_LocalInvocationID.xyz), vec4(0.0));
502 imageStore(mImage2DArrayOutput, ivec3(gl_LocalInvocationID.xyz), uvec4(0));
503 })";
Xinghua Cao711b7a12017-10-09 13:38:12 +0800504
505 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
506 EXPECT_GL_NO_ERROR();
507}
508
509// imageSize functions
510TEST_P(ComputeShaderTest, ImageSize)
511{
512 const std::string csSource =
Olli Etuaho7caa80e2017-11-14 15:03:14 +0200513 R"(#version 310 es
514 layout(local_size_x=8) in;
515 layout(rgba8) uniform highp readonly imageCube mImageCubeInput;
516 layout(r32i) uniform highp readonly iimage2D mImage2DInput;
517 layout(rgba16ui) uniform highp readonly uimage2DArray mImage2DArrayInput;
518 layout(r32i) uniform highp writeonly iimage2D imageOut;
519 void main()
520 {
521 ivec2 sizeCube = imageSize(mImageCubeInput);
522 ivec2 size2D = imageSize(mImage2DInput);
523 ivec3 size2DArray = imageSize(mImage2DArrayInput);
524 imageStore(imageOut, ivec2(gl_LocalInvocationIndex, 0), ivec4(sizeCube, size2D.x, size2DArray.x));
525 })";
Xinghua Cao711b7a12017-10-09 13:38:12 +0800526
527 ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
528 EXPECT_GL_NO_ERROR();
529}
530
Martin Radev4c4c8e72016-08-04 12:25:34 +0300531// Check that it is not possible to create a compute shader when the context does not support ES
532// 3.10
533TEST_P(ComputeShaderTestES3, NotSupported)
534{
535 GLuint computeShaderHandle = glCreateShader(GL_COMPUTE_SHADER);
536 EXPECT_EQ(0u, computeShaderHandle);
537 EXPECT_GL_ERROR(GL_INVALID_ENUM);
538}
539
Xinghua Caob1239382016-12-13 15:07:05 +0800540ANGLE_INSTANTIATE_TEST(ComputeShaderTest, ES31_OPENGL(), ES31_OPENGLES(), ES31_D3D11());
Martin Radev4c4c8e72016-08-04 12:25:34 +0300541ANGLE_INSTANTIATE_TEST(ComputeShaderTestES3, ES3_OPENGL(), ES3_OPENGLES());
542
543} // namespace