1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
4 *
5 * Copyright 2015 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Indexed state query tests
22 *//*--------------------------------------------------------------------*/
23
24 #include "es31fIndexedStateQueryTests.hpp"
25 #include "tcuTestLog.hpp"
26 #include "tcuFormatUtil.hpp"
27 #include "gluRenderContext.hpp"
28 #include "gluCallLogWrapper.hpp"
29 #include "gluStrUtil.hpp"
30 #include "gluContextInfo.hpp"
31 #include "gluObjectWrapper.hpp"
32 #include "glwFunctions.hpp"
33 #include "glwEnums.hpp"
34 #include "glsStateQueryUtil.hpp"
35 #include "deRandom.hpp"
36 #include "deStringUtil.hpp"
37
38 namespace deqp
39 {
40 namespace gles31
41 {
42 namespace Functional
43 {
44 namespace
45 {
46
47 using namespace gls::StateQueryUtil;
48
getVerifierSuffix(QueryType type)49 static const char *getVerifierSuffix(QueryType type)
50 {
51 switch (type)
52 {
53 case QUERY_INDEXED_BOOLEAN:
54 return "getbooleani_v";
55 case QUERY_INDEXED_INTEGER:
56 return "getintegeri_v";
57 case QUERY_INDEXED_INTEGER64:
58 return "getinteger64i_v";
59 case QUERY_INDEXED_BOOLEAN_VEC4:
60 return "getbooleani_v";
61 case QUERY_INDEXED_INTEGER_VEC4:
62 return "getintegeri_v";
63 case QUERY_INDEXED_INTEGER64_VEC4:
64 return "getinteger64i_v";
65 case QUERY_INDEXED_ISENABLED:
66 return "isenabledi";
67 default:
68 DE_ASSERT(false);
69 return DE_NULL;
70 }
71 }
72
isExtensionSupported(Context & context,std::string extensionName)73 void isExtensionSupported(Context &context, std::string extensionName)
74 {
75 if (contextSupports(context.getRenderContext().getType(), glu::ApiType::core(4, 5)))
76 return;
77
78 if (extensionName == "GL_EXT_draw_buffers_indexed" || extensionName == "GL_KHR_blend_equation_advanced")
79 {
80 if (!contextSupports(context.getRenderContext().getType(), glu::ApiType::es(3, 2)) &&
81 !context.getContextInfo().isExtensionSupported(extensionName.c_str()))
82 TCU_THROW(NotSupportedError,
83 (std::string("Extension ") + extensionName + std::string(" not supported.")).c_str());
84 }
85 else if (!context.getContextInfo().isExtensionSupported(extensionName.c_str()))
86 TCU_THROW(NotSupportedError,
87 (std::string("Extension ") + extensionName + std::string(" not supported.")).c_str());
88 }
89
90 class SampleMaskCase : public TestCase
91 {
92 public:
93 SampleMaskCase(Context &context, const char *name, const char *desc, QueryType verifierType);
94
95 private:
96 void init(void);
97 IterateResult iterate(void);
98
99 const QueryType m_verifierType;
100 int m_maxSampleMaskWords;
101 };
102
SampleMaskCase(Context & context,const char * name,const char * desc,QueryType verifierType)103 SampleMaskCase::SampleMaskCase(Context &context, const char *name, const char *desc, QueryType verifierType)
104 : TestCase(context, name, desc)
105 , m_verifierType(verifierType)
106 , m_maxSampleMaskWords(-1)
107 {
108 }
109
init(void)110 void SampleMaskCase::init(void)
111 {
112 const glw::Functions &gl = m_context.getRenderContext().getFunctions();
113
114 gl.getIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &m_maxSampleMaskWords);
115 GLU_EXPECT_NO_ERROR(gl.getError(), "query sample mask words");
116
117 // mask word count ok?
118 if (m_maxSampleMaskWords <= 0)
119 throw tcu::TestError("Minimum value of GL_MAX_SAMPLE_MASK_WORDS is 1. Got " +
120 de::toString(m_maxSampleMaskWords));
121
122 m_testCtx.getLog() << tcu::TestLog::Message << "GL_MAX_SAMPLE_MASK_WORDS = " << m_maxSampleMaskWords
123 << tcu::TestLog::EndMessage;
124 }
125
iterate(void)126 SampleMaskCase::IterateResult SampleMaskCase::iterate(void)
127 {
128 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
129 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
130
131 gl.enableLogging(true);
132
133 // initial values
134 {
135 const tcu::ScopedLogSection section(m_testCtx.getLog(), "initial", "Initial values");
136
137 for (int ndx = 0; ndx < m_maxSampleMaskWords; ++ndx)
138 verifyStateIndexedInteger(result, gl, GL_SAMPLE_MASK_VALUE, ndx, -1, m_verifierType);
139 }
140
141 // fixed values
142 {
143 const tcu::ScopedLogSection section(m_testCtx.getLog(), "fixed", "Fixed values");
144
145 for (int ndx = 0; ndx < m_maxSampleMaskWords; ++ndx)
146 {
147 gl.glSampleMaski(ndx, 0);
148 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glSampleMaski");
149
150 verifyStateIndexedInteger(result, gl, GL_SAMPLE_MASK_VALUE, ndx, 0, m_verifierType);
151 }
152 }
153
154 // random masks
155 {
156 const int numRandomTest = 20;
157 const tcu::ScopedLogSection section(m_testCtx.getLog(), "random", "Random values");
158 de::Random rnd(0x4312);
159
160 for (int testNdx = 0; testNdx < numRandomTest; ++testNdx)
161 {
162 const glw::GLint maskIndex = (glw::GLint)(rnd.getUint32() % m_maxSampleMaskWords);
163 glw::GLint mask = (glw::GLint)(rnd.getUint32());
164
165 gl.glSampleMaski(maskIndex, mask);
166 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glSampleMaski");
167
168 verifyStateIndexedInteger(result, gl, GL_SAMPLE_MASK_VALUE, maskIndex, mask, m_verifierType);
169 }
170 }
171
172 result.setTestContextResult(m_testCtx);
173 return STOP;
174 }
175
176 class MinValueIndexed3Case : public TestCase
177 {
178 public:
179 MinValueIndexed3Case(Context &context, const char *name, const char *desc, glw::GLenum target,
180 const tcu::IVec3 &ref, QueryType verifierType);
181
182 private:
183 IterateResult iterate(void);
184
185 const glw::GLenum m_target;
186 const tcu::IVec3 m_ref;
187 const QueryType m_verifierType;
188 };
189
MinValueIndexed3Case(Context & context,const char * name,const char * desc,glw::GLenum target,const tcu::IVec3 & ref,QueryType verifierType)190 MinValueIndexed3Case::MinValueIndexed3Case(Context &context, const char *name, const char *desc, glw::GLenum target,
191 const tcu::IVec3 &ref, QueryType verifierType)
192 : TestCase(context, name, desc)
193 , m_target(target)
194 , m_ref(ref)
195 , m_verifierType(verifierType)
196 {
197 }
198
iterate(void)199 MinValueIndexed3Case::IterateResult MinValueIndexed3Case::iterate(void)
200 {
201 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
202 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
203
204 gl.enableLogging(true);
205
206 for (int ndx = 0; ndx < 3; ++ndx)
207 {
208 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Element", "Element " + de::toString(ndx));
209
210 verifyStateIndexedIntegerMin(result, gl, m_target, ndx, m_ref[ndx], m_verifierType);
211 }
212
213 result.setTestContextResult(m_testCtx);
214 return STOP;
215 }
216
217 class BufferBindingCase : public TestCase
218 {
219 public:
220 BufferBindingCase(Context &context, const char *name, const char *desc, glw::GLenum queryTarget,
221 glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType);
222
223 private:
224 IterateResult iterate(void);
225
226 const glw::GLenum m_queryTarget;
227 const glw::GLenum m_bufferTarget;
228 const glw::GLenum m_numBindingsTarget;
229 const QueryType m_verifierType;
230 };
231
BufferBindingCase(Context & context,const char * name,const char * desc,glw::GLenum queryTarget,glw::GLenum bufferTarget,glw::GLenum numBindingsTarget,QueryType verifierType)232 BufferBindingCase::BufferBindingCase(Context &context, const char *name, const char *desc, glw::GLenum queryTarget,
233 glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType)
234 : TestCase(context, name, desc)
235 , m_queryTarget(queryTarget)
236 , m_bufferTarget(bufferTarget)
237 , m_numBindingsTarget(numBindingsTarget)
238 , m_verifierType(verifierType)
239 {
240 }
241
iterate(void)242 BufferBindingCase::IterateResult BufferBindingCase::iterate(void)
243 {
244 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
245 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
246 int maxBindings = -1;
247
248 gl.enableLogging(true);
249
250 gl.glGetIntegerv(m_numBindingsTarget, &maxBindings);
251 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
252
253 {
254 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
255
256 for (int ndx = 0; ndx < maxBindings; ++ndx)
257 verifyStateIndexedInteger(result, gl, m_queryTarget, ndx, 0, m_verifierType);
258 }
259
260 {
261 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
262 glu::Buffer bufferA(m_context.getRenderContext());
263 glu::Buffer bufferB(m_context.getRenderContext());
264 const int ndxA = 0;
265 const int ndxB = maxBindings / 2;
266
267 {
268 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Generic", "After setting generic binding point");
269
270 gl.glBindBuffer(m_bufferTarget, *bufferA);
271 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glBindBuffer");
272
273 verifyStateIndexedInteger(result, gl, m_queryTarget, 0, 0, m_verifierType);
274 }
275 {
276 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferBase");
277
278 gl.glBindBufferBase(m_bufferTarget, ndxA, *bufferA);
279 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glBindBufferBase");
280
281 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, *bufferA, m_verifierType);
282 }
283 {
284 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferRange");
285
286 gl.glBindBufferRange(m_bufferTarget, ndxB, *bufferB, 0, 8);
287 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glBindBufferRange");
288
289 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxB, *bufferB, m_verifierType);
290 }
291 if (ndxA != ndxB)
292 {
293 const tcu::ScopedLogSection section(m_testCtx.getLog(), "DifferentStates", "Original state did not change");
294
295 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, *bufferA, m_verifierType);
296 }
297 }
298
299 result.setTestContextResult(m_testCtx);
300 return STOP;
301 }
302
303 class BufferStartCase : public TestCase
304 {
305 public:
306 BufferStartCase(Context &context, const char *name, const char *desc, glw::GLenum queryTarget,
307 glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType);
308
309 private:
310 IterateResult iterate(void);
311
312 const glw::GLenum m_queryTarget;
313 const glw::GLenum m_bufferTarget;
314 const glw::GLenum m_numBindingsTarget;
315 const QueryType m_verifierType;
316 };
317
BufferStartCase(Context & context,const char * name,const char * desc,glw::GLenum queryTarget,glw::GLenum bufferTarget,glw::GLenum numBindingsTarget,QueryType verifierType)318 BufferStartCase::BufferStartCase(Context &context, const char *name, const char *desc, glw::GLenum queryTarget,
319 glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType)
320 : TestCase(context, name, desc)
321 , m_queryTarget(queryTarget)
322 , m_bufferTarget(bufferTarget)
323 , m_numBindingsTarget(numBindingsTarget)
324 , m_verifierType(verifierType)
325 {
326 }
327
iterate(void)328 BufferStartCase::IterateResult BufferStartCase::iterate(void)
329 {
330 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
331 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
332 int maxBindings = -1;
333
334 gl.enableLogging(true);
335
336 gl.glGetIntegerv(m_numBindingsTarget, &maxBindings);
337 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
338
339 {
340 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
341
342 for (int ndx = 0; ndx < maxBindings; ++ndx)
343 verifyStateIndexedInteger(result, gl, m_queryTarget, ndx, 0, m_verifierType);
344 }
345
346 {
347 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
348 glu::Buffer bufferA(m_context.getRenderContext());
349 glu::Buffer bufferB(m_context.getRenderContext());
350 const int ndxA = 0;
351 const int ndxB = maxBindings / 2;
352 int offset = -1;
353
354 if (m_bufferTarget == GL_ATOMIC_COUNTER_BUFFER)
355 offset = 4;
356 else if (m_bufferTarget == GL_SHADER_STORAGE_BUFFER)
357 {
358 gl.glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, &offset);
359 GLU_EXPECT_NO_ERROR(gl.glGetError(), "get align");
360 }
361 else
362 DE_ASSERT(false);
363
364 TCU_CHECK(offset >= 0);
365
366 {
367 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Generic", "After setting generic binding point");
368
369 gl.glBindBuffer(m_bufferTarget, *bufferA);
370 gl.glBufferData(m_bufferTarget, 16, DE_NULL, GL_DYNAMIC_READ);
371 gl.glBindBuffer(m_bufferTarget, *bufferB);
372 gl.glBufferData(m_bufferTarget, 32, DE_NULL, GL_DYNAMIC_READ);
373 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen bufs");
374
375 verifyStateIndexedInteger(result, gl, m_queryTarget, 0, 0, m_verifierType);
376 }
377 {
378 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferBase");
379
380 gl.glBindBufferBase(m_bufferTarget, ndxA, *bufferA);
381 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf");
382
383 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType);
384 }
385 {
386 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferRange");
387
388 gl.glBindBufferRange(m_bufferTarget, ndxB, *bufferB, offset, 8);
389 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf");
390
391 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxB, offset, m_verifierType);
392 }
393 if (ndxA != ndxB)
394 {
395 const tcu::ScopedLogSection section(m_testCtx.getLog(), "DifferentStates", "Original state did not change");
396
397 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType);
398 }
399 }
400
401 result.setTestContextResult(m_testCtx);
402 return STOP;
403 }
404
405 class BufferSizeCase : public TestCase
406 {
407 public:
408 BufferSizeCase(Context &context, const char *name, const char *desc, glw::GLenum queryTarget,
409 glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType);
410
411 private:
412 IterateResult iterate(void);
413
414 const glw::GLenum m_queryTarget;
415 const glw::GLenum m_bufferTarget;
416 const glw::GLenum m_numBindingsTarget;
417 const QueryType m_verifierType;
418 };
419
BufferSizeCase(Context & context,const char * name,const char * desc,glw::GLenum queryTarget,glw::GLenum bufferTarget,glw::GLenum numBindingsTarget,QueryType verifierType)420 BufferSizeCase::BufferSizeCase(Context &context, const char *name, const char *desc, glw::GLenum queryTarget,
421 glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType)
422 : TestCase(context, name, desc)
423 , m_queryTarget(queryTarget)
424 , m_bufferTarget(bufferTarget)
425 , m_numBindingsTarget(numBindingsTarget)
426 , m_verifierType(verifierType)
427 {
428 }
429
iterate(void)430 BufferSizeCase::IterateResult BufferSizeCase::iterate(void)
431 {
432 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
433 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
434 int maxBindings = -1;
435
436 gl.enableLogging(true);
437
438 gl.glGetIntegerv(m_numBindingsTarget, &maxBindings);
439 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
440
441 {
442 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
443
444 for (int ndx = 0; ndx < maxBindings; ++ndx)
445 verifyStateIndexedInteger(result, gl, m_queryTarget, ndx, 0, m_verifierType);
446 }
447
448 {
449 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
450 glu::Buffer bufferA(m_context.getRenderContext());
451 glu::Buffer bufferB(m_context.getRenderContext());
452 const int ndxA = 0;
453 const int ndxB = maxBindings / 2;
454
455 {
456 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Generic", "After setting generic binding point");
457
458 gl.glBindBuffer(m_bufferTarget, *bufferA);
459 gl.glBufferData(m_bufferTarget, 16, DE_NULL, GL_DYNAMIC_READ);
460 gl.glBindBuffer(m_bufferTarget, *bufferB);
461 gl.glBufferData(m_bufferTarget, 32, DE_NULL, GL_DYNAMIC_READ);
462 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen bufs");
463
464 verifyStateIndexedInteger(result, gl, m_queryTarget, 0, 0, m_verifierType);
465 }
466 {
467 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferBase");
468
469 gl.glBindBufferBase(m_bufferTarget, ndxA, *bufferA);
470 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf");
471
472 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType);
473 }
474 {
475 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferRange");
476
477 gl.glBindBufferRange(m_bufferTarget, ndxB, *bufferB, 0, 8);
478 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf");
479
480 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxB, 8, m_verifierType);
481 }
482 if (ndxA != ndxB)
483 {
484 const tcu::ScopedLogSection section(m_testCtx.getLog(), "DifferentStates", "Original state did not change");
485
486 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType);
487 }
488 }
489
490 result.setTestContextResult(m_testCtx);
491 return STOP;
492 }
493
494 class ImageBindingNameCase : public TestCase
495 {
496 public:
497 ImageBindingNameCase(Context &context, const char *name, const char *desc, QueryType verifierType);
498
499 private:
500 IterateResult iterate(void);
501
502 const QueryType m_verifierType;
503 };
504
ImageBindingNameCase(Context & context,const char * name,const char * desc,QueryType verifierType)505 ImageBindingNameCase::ImageBindingNameCase(Context &context, const char *name, const char *desc, QueryType verifierType)
506 : TestCase(context, name, desc)
507 , m_verifierType(verifierType)
508 {
509 }
510
iterate(void)511 ImageBindingNameCase::IterateResult ImageBindingNameCase::iterate(void)
512 {
513 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
514 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
515 int maxImages = -1;
516
517 gl.enableLogging(true);
518
519 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages);
520 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
521
522 {
523 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
524
525 for (int ndx = 0; ndx < maxImages; ++ndx)
526 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_NAME, ndx, 0, m_verifierType);
527 }
528
529 {
530 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
531 glu::Texture textureA(m_context.getRenderContext());
532 glu::Texture textureB(m_context.getRenderContext());
533 const int ndxA = 0;
534 const int ndxB = maxImages / 2;
535
536 gl.glBindTexture(GL_TEXTURE_2D, *textureA);
537 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32);
538 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
539
540 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI);
541 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
542
543 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB);
544 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4);
545 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
546
547 gl.glBindImageTexture(ndxB, *textureB, 0, GL_FALSE, 2, GL_READ_ONLY, GL_RGBA8UI);
548 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
549
550 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_NAME, ndxA, *textureA, m_verifierType);
551 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_NAME, ndxB, *textureB, m_verifierType);
552 }
553
554 result.setTestContextResult(m_testCtx);
555 return STOP;
556 }
557
558 class ImageBindingLevelCase : public TestCase
559 {
560 public:
561 ImageBindingLevelCase(Context &context, const char *name, const char *desc, QueryType verifierType);
562
563 private:
564 IterateResult iterate(void);
565
566 const QueryType m_verifierType;
567 };
568
ImageBindingLevelCase(Context & context,const char * name,const char * desc,QueryType verifierType)569 ImageBindingLevelCase::ImageBindingLevelCase(Context &context, const char *name, const char *desc,
570 QueryType verifierType)
571 : TestCase(context, name, desc)
572 , m_verifierType(verifierType)
573 {
574 }
575
iterate(void)576 ImageBindingLevelCase::IterateResult ImageBindingLevelCase::iterate(void)
577 {
578 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
579 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
580 int maxImages = -1;
581
582 gl.enableLogging(true);
583
584 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages);
585 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
586
587 {
588 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
589
590 for (int ndx = 0; ndx < maxImages; ++ndx)
591 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LEVEL, ndx, 0, m_verifierType);
592 }
593
594 {
595 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
596 glu::Texture textureA(m_context.getRenderContext());
597 glu::Texture textureB(m_context.getRenderContext());
598 const int ndxA = 0;
599 const int ndxB = maxImages / 2;
600
601 gl.glBindTexture(GL_TEXTURE_2D, *textureA);
602 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32);
603 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
604
605 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI);
606 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
607
608 gl.glBindTexture(GL_TEXTURE_2D, *textureB);
609 gl.glTexStorage2D(GL_TEXTURE_2D, 3, GL_RGBA8, 32, 32);
610 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
611
612 gl.glBindImageTexture(ndxB, *textureB, 2, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI);
613 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
614
615 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LEVEL, ndxA, 0, m_verifierType);
616 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LEVEL, ndxB, 2, m_verifierType);
617 }
618
619 result.setTestContextResult(m_testCtx);
620 return STOP;
621 }
622
623 class ImageBindingLayeredCase : public TestCase
624 {
625 public:
626 ImageBindingLayeredCase(Context &context, const char *name, const char *desc, QueryType verifierType);
627
628 private:
629 IterateResult iterate(void);
630
631 const QueryType m_verifierType;
632 };
633
ImageBindingLayeredCase(Context & context,const char * name,const char * desc,QueryType verifierType)634 ImageBindingLayeredCase::ImageBindingLayeredCase(Context &context, const char *name, const char *desc,
635 QueryType verifierType)
636 : TestCase(context, name, desc)
637 , m_verifierType(verifierType)
638 {
639 }
640
iterate(void)641 ImageBindingLayeredCase::IterateResult ImageBindingLayeredCase::iterate(void)
642 {
643 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
644 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
645 int maxImages = -1;
646
647 gl.enableLogging(true);
648
649 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages);
650 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
651
652 {
653 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
654
655 for (int ndx = 0; ndx < maxImages; ++ndx)
656 verifyStateIndexedBoolean(result, gl, GL_IMAGE_BINDING_LAYERED, ndx, false, m_verifierType);
657 }
658
659 {
660 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
661 glu::Texture textureA(m_context.getRenderContext());
662 glu::Texture textureB(m_context.getRenderContext());
663 const int ndxA = 0;
664 const int ndxB = maxImages / 2;
665
666 gl.glBindTexture(GL_TEXTURE_2D, *textureA);
667 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32);
668 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
669
670 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI);
671 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
672
673 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB);
674 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4);
675 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
676
677 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_ONLY, GL_RGBA8UI);
678 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
679
680 verifyStateIndexedBoolean(result, gl, GL_IMAGE_BINDING_LAYERED, ndxA, false, m_verifierType);
681 verifyStateIndexedBoolean(result, gl, GL_IMAGE_BINDING_LAYERED, ndxB, true, m_verifierType);
682 }
683
684 result.setTestContextResult(m_testCtx);
685 return STOP;
686 }
687
688 class ImageBindingLayerCase : public TestCase
689 {
690 public:
691 ImageBindingLayerCase(Context &context, const char *name, const char *desc, QueryType verifierType);
692
693 private:
694 IterateResult iterate(void);
695
696 const QueryType m_verifierType;
697 };
698
ImageBindingLayerCase(Context & context,const char * name,const char * desc,QueryType verifierType)699 ImageBindingLayerCase::ImageBindingLayerCase(Context &context, const char *name, const char *desc,
700 QueryType verifierType)
701 : TestCase(context, name, desc)
702 , m_verifierType(verifierType)
703 {
704 }
705
iterate(void)706 ImageBindingLayerCase::IterateResult ImageBindingLayerCase::iterate(void)
707 {
708 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
709 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
710 int maxImages = -1;
711
712 gl.enableLogging(true);
713
714 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages);
715 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
716
717 {
718 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
719
720 for (int ndx = 0; ndx < maxImages; ++ndx)
721 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LAYER, ndx, 0, m_verifierType);
722 }
723
724 {
725 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
726 glu::Texture textureA(m_context.getRenderContext());
727 glu::Texture textureB(m_context.getRenderContext());
728 const int ndxA = 0;
729 const int ndxB = maxImages / 2;
730
731 gl.glBindTexture(GL_TEXTURE_2D, *textureA);
732 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32);
733 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
734
735 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI);
736 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
737
738 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB);
739 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4);
740 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
741
742 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_ONLY, GL_RGBA8UI);
743 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
744
745 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LAYER, ndxA, 0, m_verifierType);
746 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LAYER, ndxB, 2, m_verifierType);
747 }
748
749 result.setTestContextResult(m_testCtx);
750 return STOP;
751 }
752
753 class ImageBindingAccessCase : public TestCase
754 {
755 public:
756 ImageBindingAccessCase(Context &context, const char *name, const char *desc, QueryType verifierType);
757
758 private:
759 IterateResult iterate(void);
760
761 const QueryType m_verifierType;
762 };
763
ImageBindingAccessCase(Context & context,const char * name,const char * desc,QueryType verifierType)764 ImageBindingAccessCase::ImageBindingAccessCase(Context &context, const char *name, const char *desc,
765 QueryType verifierType)
766 : TestCase(context, name, desc)
767 , m_verifierType(verifierType)
768 {
769 }
770
iterate(void)771 ImageBindingAccessCase::IterateResult ImageBindingAccessCase::iterate(void)
772 {
773 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
774 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
775 int maxImages = -1;
776
777 gl.enableLogging(true);
778
779 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages);
780 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
781
782 {
783 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
784
785 for (int ndx = 0; ndx < maxImages; ++ndx)
786 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_ACCESS, ndx, GL_READ_ONLY, m_verifierType);
787 }
788
789 {
790 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
791 glu::Texture textureA(m_context.getRenderContext());
792 glu::Texture textureB(m_context.getRenderContext());
793 const int ndxA = 0;
794 const int ndxB = maxImages / 2;
795
796 gl.glBindTexture(GL_TEXTURE_2D, *textureA);
797 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32);
798 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
799
800 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI);
801 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
802
803 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB);
804 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4);
805 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
806
807 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_WRITE, GL_RGBA8UI);
808 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
809
810 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_ACCESS, ndxA, GL_READ_ONLY, m_verifierType);
811 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_ACCESS, ndxB, GL_READ_WRITE, m_verifierType);
812 }
813
814 result.setTestContextResult(m_testCtx);
815 return STOP;
816 }
817
818 class ImageBindingFormatCase : public TestCase
819 {
820 public:
821 ImageBindingFormatCase(Context &context, const char *name, const char *desc, QueryType verifierType);
822
823 private:
824 IterateResult iterate(void);
825
826 const QueryType m_verifierType;
827 };
828
ImageBindingFormatCase(Context & context,const char * name,const char * desc,QueryType verifierType)829 ImageBindingFormatCase::ImageBindingFormatCase(Context &context, const char *name, const char *desc,
830 QueryType verifierType)
831 : TestCase(context, name, desc)
832 , m_verifierType(verifierType)
833 {
834 }
835
iterate(void)836 ImageBindingFormatCase::IterateResult ImageBindingFormatCase::iterate(void)
837 {
838 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
839 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
840 int maxImages = -1;
841
842 gl.enableLogging(true);
843
844 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages);
845 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
846
847 {
848 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
849
850 for (int ndx = 0; ndx < maxImages; ++ndx)
851 if (glu::isContextTypeES(m_context.getRenderContext().getType()))
852 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_FORMAT, ndx, GL_R32UI, m_verifierType);
853 else
854 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_FORMAT, ndx, GL_R8, m_verifierType);
855 }
856
857 {
858 const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "AfterSetting", "After setting");
859 glu::Texture textureA(m_context.getRenderContext());
860 glu::Texture textureB(m_context.getRenderContext());
861 const int ndxA = 0;
862 const int ndxB = maxImages / 2;
863
864 gl.glBindTexture(GL_TEXTURE_2D, *textureA);
865 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32);
866 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
867
868 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI);
869 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
870
871 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB);
872 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_R32F, 32, 32, 4);
873 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex");
874
875 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_WRITE, GL_R32F);
876 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit");
877
878 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_FORMAT, ndxA, GL_RGBA8UI, m_verifierType);
879 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_FORMAT, ndxB, GL_R32F, m_verifierType);
880 }
881
882 result.setTestContextResult(m_testCtx);
883 return STOP;
884 }
885
886 class ColorMaskCase : public TestCase
887 {
888 public:
889 ColorMaskCase(Context &context, const char *name, const char *desc, QueryType verifierType);
890
891 void init(void);
892
893 private:
894 IterateResult iterate(void);
895
896 const QueryType m_verifierType;
897 };
898
ColorMaskCase(Context & context,const char * name,const char * desc,QueryType verifierType)899 ColorMaskCase::ColorMaskCase(Context &context, const char *name, const char *desc, QueryType verifierType)
900 : TestCase(context, name, desc)
901 , m_verifierType(verifierType)
902 {
903 }
904
init(void)905 void ColorMaskCase::init(void)
906 {
907 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed");
908 }
909
iterate(void)910 ColorMaskCase::IterateResult ColorMaskCase::iterate(void)
911 {
912 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
913 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
914 int32_t maxDrawBuffers = 0;
915
916 gl.enableLogging(true);
917
918 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
919 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
920
921 {
922 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
923
924 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
925 verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(true), m_verifierType);
926 }
927 {
928 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
929
930 gl.glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
931
932 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
933 verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(false, true, true, false),
934 m_verifierType);
935 }
936 {
937 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
938
939 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
940 gl.glColorMaski(ndx, (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE),
941 (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE));
942
943 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
944 verifyStateIndexedBooleanVec4(
945 result, gl, GL_COLOR_WRITEMASK, ndx,
946 (ndx % 2 == 0 ? tcu::BVec4(true, false, true, false) : tcu::BVec4(false, true, false, true)),
947 m_verifierType);
948 }
949 {
950 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterResettingIndexedWithCommon",
951 "After resetting indexed with common");
952
953 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
954 gl.glColorMaski(ndx, (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE),
955 (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE));
956
957 gl.glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
958
959 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
960 verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(false, true, true, false),
961 m_verifierType);
962 }
963
964 result.setTestContextResult(m_testCtx);
965 return STOP;
966 }
967
968 class BlendFuncCase : public TestCase
969 {
970 public:
971 BlendFuncCase(Context &context, const char *name, const char *desc, QueryType verifierType);
972
973 void init(void);
974
975 private:
976 IterateResult iterate(void);
977
978 const QueryType m_verifierType;
979 };
980
BlendFuncCase(Context & context,const char * name,const char * desc,QueryType verifierType)981 BlendFuncCase::BlendFuncCase(Context &context, const char *name, const char *desc, QueryType verifierType)
982 : TestCase(context, name, desc)
983 , m_verifierType(verifierType)
984 {
985 }
986
init(void)987 void BlendFuncCase::init(void)
988 {
989 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed");
990 }
991
iterate(void)992 BlendFuncCase::IterateResult BlendFuncCase::iterate(void)
993 {
994 const uint32_t blendFuncs[] = {GL_ZERO,
995 GL_ONE,
996 GL_SRC_COLOR,
997 GL_ONE_MINUS_SRC_COLOR,
998 GL_DST_COLOR,
999 GL_ONE_MINUS_DST_COLOR,
1000 GL_SRC_ALPHA,
1001 GL_ONE_MINUS_SRC_ALPHA,
1002 GL_DST_ALPHA,
1003 GL_ONE_MINUS_DST_ALPHA,
1004 GL_CONSTANT_COLOR,
1005 GL_ONE_MINUS_CONSTANT_COLOR,
1006 GL_CONSTANT_ALPHA,
1007 GL_ONE_MINUS_CONSTANT_ALPHA,
1008 GL_SRC_ALPHA_SATURATE};
1009
1010 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
1011 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
1012 int32_t maxDrawBuffers = 0;
1013
1014 gl.enableLogging(true);
1015
1016 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
1017 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
1018
1019 {
1020 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
1021
1022 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1023 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_ONE, m_verifierType);
1024
1025 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1026 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ZERO, m_verifierType);
1027
1028 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1029 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_ONE, m_verifierType);
1030
1031 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1032 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ZERO, m_verifierType);
1033 }
1034 {
1035 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
1036
1037 gl.glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
1038
1039 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1040 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_ALPHA, m_verifierType);
1041
1042 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1043 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_DST_ALPHA, m_verifierType);
1044
1045 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1046 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_SRC_ALPHA, m_verifierType);
1047
1048 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1049 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_DST_ALPHA, m_verifierType);
1050 }
1051 {
1052 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingCommonSeparate",
1053 "After setting common separate");
1054
1055 gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA);
1056
1057 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1058 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_COLOR, m_verifierType);
1059
1060 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1061 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ONE_MINUS_SRC_ALPHA, m_verifierType);
1062
1063 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1064 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_DST_COLOR, m_verifierType);
1065
1066 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1067 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ONE_MINUS_DST_ALPHA, m_verifierType);
1068 }
1069 {
1070 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
1071
1072 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1073 gl.glBlendFunci(ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)],
1074 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
1075
1076 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1077 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx,
1078 blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1079
1080 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1081 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx,
1082 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1083
1084 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1085 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx,
1086 blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1087
1088 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1089 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx,
1090 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1091 }
1092 {
1093 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingIndexedSeparate",
1094 "After setting indexed separate");
1095
1096 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1097 gl.glBlendFuncSeparatei(ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)],
1098 blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)],
1099 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)],
1100 blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
1101
1102 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1103 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx,
1104 blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1105
1106 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1107 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx,
1108 blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1109
1110 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1111 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx,
1112 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1113
1114 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1115 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx,
1116 blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
1117 }
1118 {
1119 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterResettingIndexedWithCommon",
1120 "After resetting indexed with common");
1121
1122 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1123 gl.glBlendFunci(ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)],
1124 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
1125
1126 gl.glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
1127
1128 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1129 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_ALPHA, m_verifierType);
1130
1131 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1132 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_DST_ALPHA, m_verifierType);
1133
1134 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1135 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_SRC_ALPHA, m_verifierType);
1136
1137 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1138 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_DST_ALPHA, m_verifierType);
1139 }
1140 {
1141 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterResettingIndexedWithCommonSeparate",
1142 "After resetting indexed with common separate");
1143
1144 gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA);
1145
1146 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1147 gl.glBlendFuncSeparatei(ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)],
1148 blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)],
1149 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)],
1150 blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
1151
1152 gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA);
1153
1154 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1155 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_COLOR, m_verifierType);
1156
1157 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1158 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ONE_MINUS_SRC_ALPHA, m_verifierType);
1159
1160 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1161 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_DST_COLOR, m_verifierType);
1162
1163 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1164 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ONE_MINUS_DST_ALPHA, m_verifierType);
1165 }
1166
1167 result.setTestContextResult(m_testCtx);
1168 return STOP;
1169 }
1170
1171 class BlendEquationCase : public TestCase
1172 {
1173 public:
1174 BlendEquationCase(Context &context, const char *name, const char *desc, QueryType verifierType);
1175
1176 void init(void);
1177
1178 private:
1179 IterateResult iterate(void);
1180
1181 const QueryType m_verifierType;
1182 };
1183
BlendEquationCase(Context & context,const char * name,const char * desc,QueryType verifierType)1184 BlendEquationCase::BlendEquationCase(Context &context, const char *name, const char *desc, QueryType verifierType)
1185 : TestCase(context, name, desc)
1186 , m_verifierType(verifierType)
1187 {
1188 }
1189
init(void)1190 void BlendEquationCase::init(void)
1191 {
1192 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed");
1193 }
1194
iterate(void)1195 BlendEquationCase::IterateResult BlendEquationCase::iterate(void)
1196 {
1197 const uint32_t blendEquations[] = {GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MIN, GL_MAX};
1198
1199 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
1200 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
1201 int32_t maxDrawBuffers = 0;
1202
1203 gl.enableLogging(true);
1204
1205 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
1206 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
1207
1208 {
1209 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
1210
1211 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1212 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_ADD, m_verifierType);
1213
1214 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1215 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_ADD, m_verifierType);
1216 }
1217 {
1218 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
1219
1220 gl.glBlendEquation(GL_FUNC_SUBTRACT);
1221
1222 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1223 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_SUBTRACT, m_verifierType);
1224
1225 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1226 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
1227 }
1228 {
1229 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingCommonSeparate",
1230 "After setting common separate");
1231
1232 gl.glBlendEquationSeparate(GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_SUBTRACT);
1233
1234 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1235 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_REVERSE_SUBTRACT, m_verifierType);
1236
1237 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1238 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
1239 }
1240 {
1241 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
1242
1243 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1244 gl.glBlendEquationi(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)]);
1245
1246 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1247 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx,
1248 blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
1249
1250 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1251 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx,
1252 blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
1253 }
1254 {
1255 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingIndexedSeparate",
1256 "After setting indexed separate");
1257
1258 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1259 gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)],
1260 blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]);
1261
1262 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1263 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx,
1264 blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
1265
1266 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1267 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx,
1268 blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
1269 }
1270 {
1271 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterResettingIndexedWithCommon",
1272 "After resetting indexed with common");
1273
1274 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1275 gl.glBlendEquationi(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)]);
1276
1277 gl.glBlendEquation(GL_FUNC_SUBTRACT);
1278
1279 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1280 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_SUBTRACT, m_verifierType);
1281
1282 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1283 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
1284 }
1285 {
1286 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterResettingIndexedWithCommonSeparate",
1287 "After resetting indexed with common separate");
1288
1289 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1290 gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)],
1291 blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]);
1292
1293 gl.glBlendEquationSeparate(GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_SUBTRACT);
1294
1295 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1296 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_REVERSE_SUBTRACT, m_verifierType);
1297
1298 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1299 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
1300 }
1301
1302 result.setTestContextResult(m_testCtx);
1303 return STOP;
1304 }
1305
1306 class BlendEquationAdvancedCase : public TestCase
1307 {
1308 public:
1309 BlendEquationAdvancedCase(Context &context, const char *name, const char *desc, QueryType verifierType);
1310
1311 void init(void);
1312
1313 private:
1314 IterateResult iterate(void);
1315
1316 const QueryType m_verifierType;
1317 };
1318
BlendEquationAdvancedCase(Context & context,const char * name,const char * desc,QueryType verifierType)1319 BlendEquationAdvancedCase::BlendEquationAdvancedCase(Context &context, const char *name, const char *desc,
1320 QueryType verifierType)
1321 : TestCase(context, name, desc)
1322 , m_verifierType(verifierType)
1323 {
1324 }
1325
init(void)1326 void BlendEquationAdvancedCase::init(void)
1327 {
1328 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed");
1329 isExtensionSupported(m_context, "GL_KHR_blend_equation_advanced");
1330 }
1331
iterate(void)1332 BlendEquationAdvancedCase::IterateResult BlendEquationAdvancedCase::iterate(void)
1333 {
1334 const uint32_t blendEquations[] = {GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MIN, GL_MAX};
1335
1336 const uint32_t blendEquationAdvanced[] = {GL_MULTIPLY, GL_SCREEN, GL_OVERLAY, GL_DARKEN,
1337 GL_LIGHTEN, GL_COLORDODGE, GL_COLORBURN, GL_HARDLIGHT,
1338 GL_SOFTLIGHT, GL_DIFFERENCE, GL_EXCLUSION, GL_HSL_HUE,
1339 GL_HSL_SATURATION, GL_HSL_COLOR, GL_HSL_LUMINOSITY};
1340
1341 glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
1342 tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
1343 int32_t maxDrawBuffers = 0;
1344
1345 gl.enableLogging(true);
1346
1347 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
1348 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
1349
1350 {
1351 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
1352
1353 gl.glBlendEquation(GL_SCREEN);
1354
1355 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1356 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_SCREEN, m_verifierType);
1357
1358 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1359 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_SCREEN, m_verifierType);
1360 }
1361 {
1362 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
1363
1364 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1365 gl.glBlendEquationi(ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)]);
1366
1367 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1368 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx,
1369 blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)],
1370 m_verifierType);
1371
1372 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1373 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx,
1374 blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)],
1375 m_verifierType);
1376 }
1377 {
1378 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterResettingIndexedWithCommon",
1379 "After resetting indexed with common");
1380
1381 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1382 gl.glBlendEquationi(ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)]);
1383
1384 gl.glBlendEquation(GL_MULTIPLY);
1385
1386 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1387 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_MULTIPLY, m_verifierType);
1388
1389 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1390 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_MULTIPLY, m_verifierType);
1391 }
1392 {
1393 const tcu::ScopedLogSection section(m_testCtx.getLog(), "AfterResettingIndexedSeparateWithCommon",
1394 "After resetting indexed separate with common");
1395
1396 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1397 gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)],
1398 blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]);
1399
1400 gl.glBlendEquation(GL_LIGHTEN);
1401
1402 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1403 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_LIGHTEN, m_verifierType);
1404
1405 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
1406 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_LIGHTEN, m_verifierType);
1407 }
1408
1409 result.setTestContextResult(m_testCtx);
1410 return STOP;
1411 }
1412
1413 } // namespace
1414
IndexedStateQueryTests(Context & context)1415 IndexedStateQueryTests::IndexedStateQueryTests(Context &context)
1416 : TestCaseGroup(context, "indexed", "Indexed state queries")
1417 {
1418 }
1419
~IndexedStateQueryTests(void)1420 IndexedStateQueryTests::~IndexedStateQueryTests(void)
1421 {
1422 }
1423
init(void)1424 void IndexedStateQueryTests::init(void)
1425 {
1426 static const QueryType verifiers[] = {QUERY_INDEXED_BOOLEAN, QUERY_INDEXED_INTEGER, QUERY_INDEXED_INTEGER64};
1427
1428 #define FOR_EACH_VERIFIER(X) \
1429 for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(verifiers); ++verifierNdx) \
1430 { \
1431 const QueryType verifier = verifiers[verifierNdx]; \
1432 const char *verifierSuffix = getVerifierSuffix(verifier); \
1433 this->addChild(X); \
1434 }
1435
1436 FOR_EACH_VERIFIER(new SampleMaskCase(m_context, (std::string() + "sample_mask_value_" + verifierSuffix).c_str(),
1437 "Test SAMPLE_MASK_VALUE", verifier))
1438
1439 FOR_EACH_VERIFIER(
1440 new MinValueIndexed3Case(m_context, (std::string() + "max_compute_work_group_count_" + verifierSuffix).c_str(),
1441 "Test MAX_COMPUTE_WORK_GROUP_COUNT", GL_MAX_COMPUTE_WORK_GROUP_COUNT,
1442 tcu::IVec3(65535, 65535, 65535), verifier))
1443 FOR_EACH_VERIFIER(new MinValueIndexed3Case(
1444 m_context, (std::string() + "max_compute_work_group_size_" + verifierSuffix).c_str(),
1445 "Test MAX_COMPUTE_WORK_GROUP_SIZE", GL_MAX_COMPUTE_WORK_GROUP_SIZE, tcu::IVec3(128, 128, 64), verifier))
1446
1447 FOR_EACH_VERIFIER(new BufferBindingCase(m_context,
1448 (std::string() + "atomic_counter_buffer_binding_" + verifierSuffix).c_str(),
1449 "Test ATOMIC_COUNTER_BUFFER_BINDING", GL_ATOMIC_COUNTER_BUFFER_BINDING,
1450 GL_ATOMIC_COUNTER_BUFFER, GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, verifier))
1451 FOR_EACH_VERIFIER(new BufferStartCase(m_context,
1452 (std::string() + "atomic_counter_buffer_start_" + verifierSuffix).c_str(),
1453 "Test ATOMIC_COUNTER_BUFFER_START", GL_ATOMIC_COUNTER_BUFFER_START,
1454 GL_ATOMIC_COUNTER_BUFFER, GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, verifier))
1455 FOR_EACH_VERIFIER(new BufferSizeCase(m_context,
1456 (std::string() + "atomic_counter_buffer_size_" + verifierSuffix).c_str(),
1457 "Test ATOMIC_COUNTER_BUFFER_SIZE", GL_ATOMIC_COUNTER_BUFFER_SIZE,
1458 GL_ATOMIC_COUNTER_BUFFER, GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, verifier))
1459
1460 FOR_EACH_VERIFIER(new BufferBindingCase(m_context,
1461 (std::string() + "shader_storage_buffer_binding_" + verifierSuffix).c_str(),
1462 "Test SHADER_STORAGE_BUFFER_BINDING", GL_SHADER_STORAGE_BUFFER_BINDING,
1463 GL_SHADER_STORAGE_BUFFER, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, verifier))
1464 FOR_EACH_VERIFIER(new BufferStartCase(m_context,
1465 (std::string() + "shader_storage_buffer_start_" + verifierSuffix).c_str(),
1466 "Test SHADER_STORAGE_BUFFER_START", GL_SHADER_STORAGE_BUFFER_START,
1467 GL_SHADER_STORAGE_BUFFER, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, verifier))
1468 FOR_EACH_VERIFIER(new BufferSizeCase(m_context,
1469 (std::string() + "shader_storage_buffer_size_" + verifierSuffix).c_str(),
1470 "Test SHADER_STORAGE_BUFFER_SIZE", GL_SHADER_STORAGE_BUFFER_SIZE,
1471 GL_SHADER_STORAGE_BUFFER, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, verifier))
1472
1473 FOR_EACH_VERIFIER(new ImageBindingNameCase(m_context,
1474 (std::string() + "image_binding_name_" + verifierSuffix).c_str(),
1475 "Test IMAGE_BINDING_NAME", verifier))
1476 FOR_EACH_VERIFIER(new ImageBindingLevelCase(m_context,
1477 (std::string() + "image_binding_level_" + verifierSuffix).c_str(),
1478 "Test IMAGE_BINDING_LEVEL", verifier))
1479 FOR_EACH_VERIFIER(new ImageBindingLayeredCase(m_context,
1480 (std::string() + "image_binding_layered_" + verifierSuffix).c_str(),
1481 "Test IMAGE_BINDING_LAYERED", verifier))
1482 FOR_EACH_VERIFIER(new ImageBindingLayerCase(m_context,
1483 (std::string() + "image_binding_layer_" + verifierSuffix).c_str(),
1484 "Test IMAGE_BINDING_LAYER", verifier))
1485 FOR_EACH_VERIFIER(new ImageBindingAccessCase(m_context,
1486 (std::string() + "image_binding_access_" + verifierSuffix).c_str(),
1487 "Test IMAGE_BINDING_ACCESS", verifier))
1488 FOR_EACH_VERIFIER(new ImageBindingFormatCase(m_context,
1489 (std::string() + "image_binding_format_" + verifierSuffix).c_str(),
1490 "Test IMAGE_BINDING_FORMAT", verifier))
1491
1492 // All non-boolean verifiers are tested in ES3 test module.
1493 addChild(new ColorMaskCase(m_context, "color_mask_getbooleani_v", "COLOR_WRITEMASK", QUERY_INDEXED_BOOLEAN_VEC4));
1494 addChild(
1495 new BlendFuncCase(m_context, "blend_func_getbooleani_v", "BLEND_SRC and BLEND_DST", QUERY_INDEXED_BOOLEAN));
1496 addChild(new BlendEquationCase(m_context, "blend_equation_getbooleani_v", "BLEND_EQUATION_RGB and BLEND_DST",
1497 QUERY_INDEXED_BOOLEAN));
1498 addChild(new BlendEquationAdvancedCase(m_context, "blend_equation_advanced_getbooleani_v",
1499 "BLEND_EQUATION_RGB and BLEND_DST", QUERY_INDEXED_BOOLEAN));
1500
1501 #undef FOR_EACH_VEC4_VERIFIER
1502 #undef FOR_EACH_VERIFIER
1503 }
1504
1505 } // namespace Functional
1506 } // namespace gles31
1507 } // namespace deqp
1508