1 #ifndef _GL4CDIRECTSTATEACCESSTESTS_HPP
2 #define _GL4CDIRECTSTATEACCESSTESTS_HPP
3 /*-------------------------------------------------------------------------
4 * OpenGL Conformance Test Suite
5 * -----------------------------
6 *
7 * Copyright (c) 2015-2020 The Khronos Group Inc.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 */ /*!
22 * \file
23 * \brief
24 */ /*-------------------------------------------------------------------*/
25
26 /**
27 */ /*!
28 * \file gl4cDirectStateAccessTests.hpp
29 * \brief Conformance tests for the Direct State Access feature functionality.
30 */ /*-----------------------------------------------------------------------------*/
31
32 /* Includes. */
33
34 #include "glcTestCase.hpp"
35 #include "glwDefs.hpp"
36 #include "tcuDefs.hpp"
37
38 #include <string>
39 #include <typeinfo>
40
41 namespace gl4cts
42 {
43 namespace DirectStateAccess
44 {
45 /** @class Tests
46 *
47 * @brief Direct State Access test group.
48 */
49 class Tests : public deqp::TestCaseGroup
50 {
51 public:
52 /* Public member functions */
53 Tests(deqp::Context& context);
54
55 void init();
56
57 private:
58 /* Private member functions */
59 Tests(const Tests& other);
60 Tests& operator=(const Tests& other);
61 };
62 /* Tests class */
63
64 /* Direct State Access Feature Interfaces */
65
66 /* Direct State Access Transform Feedback Tests */
67 namespace TransformFeedback
68 {
69 /** @class CreationTest
70 *
71 * @brief Direct State Access Transform Feedback Creation test cases.
72 *
73 * Test follows the steps:
74 *
75 * Create at least two transform feedback objects names with
76 * GenTransformFeedbacks function. Check them without binding, using
77 * IsTransformFeedback function. Expect GL_FALSE.
78 *
79 * Create at least two transform feedback objects with
80 * CreateTransformFeedbacks function. Check them without binding, using
81 * IsTransformFeedback function. Expect GL_TRUE.
82 *
83 * Check that transform feedback binding point is unchanged.
84 */
85 class CreationTest : public deqp::TestCase
86 {
87 public:
88 /* Public member functions */
89 CreationTest(deqp::Context& context);
90
91 virtual tcu::TestNode::IterateResult iterate();
92
93 private:
94 /* Private member functions */
95 CreationTest(const CreationTest& other);
96 CreationTest& operator=(const CreationTest& other);
97 };
98 /* CreationTest class */
99
100 /** @class DefaultsTest
101 *
102 * @brief Direct State Access Transform Feedback Default State test cases.
103 *
104 * Test follows the steps:
105 *
106 * Create transform feedback object with CreateTransformFeedbacks function.
107 *
108 * Query parameters TRANSFORM_FEEDBACK_BUFFER_BINDING using
109 * GetTransformFeedbacki_v for all available indexed binding points. For
110 * all queries, expect value equal to 0.
111 *
112 * Query parameters:
113 * - TRANSFORM_FEEDBACK_BUFFER_START and
114 * - TRANSFORM_FEEDBACK_BUFFER_SIZE
115 * using GetTransformFeedbacki64_v for all available indexed binding
116 * points. For all queries, expect value equal to 0.
117 *
118 * Query parameters:
119 * - TRANSFORM_FEEDBACK_PAUSED and
120 * - TRANSFORM_FEEDBACK_ACTIVE
121 * using GetTransformFeedbackiv. For all queries, expect value equal to
122 * FALSE.
123 */
124 class DefaultsTest : public deqp::TestCase
125 {
126 public:
127 /* Public member functions */
128 DefaultsTest(deqp::Context& context);
129
130 virtual tcu::TestNode::IterateResult iterate();
131
132 private:
133 /* Private member functions */
134 DefaultsTest(const DefaultsTest& other);
135 DefaultsTest& operator=(const DefaultsTest& other);
136
137 /* Function pointers type definitions and declarations. */
138 typedef void(GLW_APIENTRY* GetTransformFeedbackiv_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
139 glw::GLint* param);
140 typedef void(GLW_APIENTRY* GetTransformFeedbacki_v_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
141 glw::GLuint index, glw::GLint* param);
142 typedef void(GLW_APIENTRY* GetTransformFeedbacki64_v_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
143 glw::GLuint index, glw::GLint64* param);
144
145 GetTransformFeedbackiv_ProcAddress m_gl_getTransformFeedbackiv;
146 GetTransformFeedbacki_v_ProcAddress m_gl_getTransformFeedbacki_v;
147 GetTransformFeedbacki64_v_ProcAddress m_gl_getTransformFeedbacki64_v;
148
149 /* Private member variables */
150 glw::GLuint m_xfb_dsa;
151 glw::GLint m_xfb_indexed_binding_points_count;
152
153 /* Private member functions. */
154 void prepare();
155 bool testBuffersBindingPoints();
156 bool testBuffersDimensions();
157 bool testActive();
158 bool testPaused();
159 void clean();
160 };
161 /* DefaultsTest class */
162
163 /** @class BuffersTest
164 *
165 * @brief Direct State Access Transform Feedback Buffer Objects binding test cases.
166 * The test follows the steps:
167 *
168 * Create transform feedback object with CreateTransformFeedbacks function.
169 *
170 * Create two buffer objects using GenBuffers and BindBuffer functions.
171 * Allocate storage for them using BufferData.
172 *
173 * Bind the first buffer to transform feedback object indexed binding point
174 * 0 using TransformFeedbackBufferBase function.
175 *
176 * Bind a first half of the second buffer to transform feedback object
177 * indexed binding point 1 using TransformFeedbackBufferRange.
178 *
179 * Bind a second half of the second buffer to transform feedback object
180 * indexed binding point 12 using TransformFeedbackBufferRange.
181 *
182 * Query parameter TRANSFORM_FEEDBACK_BUFFER_BINDING using
183 * GetTransformFeedbacki_v for all 1st, 2nd and 3rd indexed binding point.
184 * For all queries, expect value equal to the corresponding buffers'
185 * identifiers.
186 *
187 * Query parameters:
188 * - TRANSFORM_FEEDBACK_BUFFER_START and
189 * - TRANSFORM_FEEDBACK_BUFFER_SIZE
190 * using GetTransformFeedbacki64_v for indexed binding points 0, 1 and 2.
191 * Verify returned values.
192 */
193 class BuffersTest : public deqp::TestCase
194 {
195 public:
196 /* Public member functions */
197 BuffersTest(deqp::Context& context);
198
199 virtual tcu::TestNode::IterateResult iterate();
200
201 private:
202 /* Private member functions */
203 BuffersTest(const BuffersTest& other);
204 BuffersTest& operator=(const BuffersTest& other);
205
206 /* Function pointers type definitions and declarations. */
207 typedef void(GLW_APIENTRY* GetTransformFeedbacki_v_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
208 glw::GLuint index, glw::GLint* param);
209 typedef void(GLW_APIENTRY* GetTransformFeedbacki64_v_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
210 glw::GLuint index, glw::GLint64* param);
211 typedef void(GLW_APIENTRY* TransformFeedbackBufferBase_ProcAddress)(glw::GLuint xfb, glw::GLuint index,
212 glw::GLuint buffer);
213 typedef void(GLW_APIENTRY* TransformFeedbackBufferRange_ProcAddress)(glw::GLuint xfb, glw::GLuint index,
214 glw::GLuint buffer, glw::GLintptr offset,
215 glw::GLsizeiptr size);
216
217 GetTransformFeedbacki_v_ProcAddress m_gl_getTransformFeedbacki_v;
218 GetTransformFeedbacki64_v_ProcAddress m_gl_getTransformFeedbacki64_v;
219 TransformFeedbackBufferBase_ProcAddress m_gl_TransformFeedbackBufferBase;
220 TransformFeedbackBufferRange_ProcAddress m_gl_TransformFeedbackBufferRange;
221
222 /* Private member variables */
223 glw::GLuint m_xfb_dsa;
224 glw::GLuint m_bo_a;
225 glw::GLuint m_bo_b;
226
227 /* Private static variables */
228 static const glw::GLuint s_bo_size;
229
230 /* Private member functions. */
231 void prepareObjects();
232 bool prepareTestSetup();
233 bool testBindingPoint(glw::GLuint const index, glw::GLint const expected_value,
234 glw::GLchar const* const tested_function_name);
235 bool testStart(glw::GLuint const index, glw::GLint const expected_value,
236 glw::GLchar const* const tested_function_name);
237 bool testSize(glw::GLuint const index, glw::GLint const expected_value,
238 glw::GLchar const* const tested_function_name);
239 void clean();
240 };
241 /* BuffersTest class */
242
243 /** @class ErrorsTest
244 *
245 * @brief Direct State Access Transform Feedback Negative test cases.
246 * The test follows steps:
247 *
248 * Check that CreateTransformFeedbacks generates INVALID_VALUE error if
249 * number of transform feedback objects to create is negative.
250 *
251 * Check that GetTransformFeedbackiv, GetTransformFeedbacki_v and
252 * GetTransformFeedbacki64_v generate INVALID_OPERATION error if xfb is not
253 * zero or the name of an existing transform feedback object.
254 *
255 * Check that GetTransformFeedbackiv generates INVALID_ENUM error if pname
256 * is not TRANSFORM_FEEDBACK_PAUSED or TRANSFORM_FEEDBACK_ACTIVE.
257 *
258 * Check that GetTransformFeedbacki_v generates INVALID_ENUM error if pname
259 * is not TRANSFORM_FEEDBACK_BUFFER_BINDING.
260 *
261 * Check that GetTransformFeedbacki64_v generates INVALID_ENUM error if
262 * pname is not TRANSFORM_FEEDBACK_BUFFER_START or
263 * TRANSFORM_FEEDBACK_BUFFER_SIZE.
264 *
265 * Check that GetTransformFeedbacki_v and GetTransformFeedbacki64_v
266 * generate INVALID_VALUE error by GetTransformFeedbacki_v and
267 * GetTransformFeedbacki64_v if index is greater than or equal to the
268 * number of binding points for transform feedback (the value of
269 * MAX_TRANSFORM_FEEDBACK_BUFFERS).
270 */
271 class ErrorsTest : public deqp::TestCase
272 {
273 public:
274 /* Public member functions */
275 ErrorsTest(deqp::Context& context);
276
277 virtual tcu::TestNode::IterateResult iterate();
278
279 private:
280 /* Private member functions */
281 ErrorsTest(const ErrorsTest& other);
282 ErrorsTest& operator=(const ErrorsTest& other);
283
284 /* Function pointers type definitions and declarations. */
285 typedef void(GLW_APIENTRY* GetTransformFeedbackiv_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
286 glw::GLint* param);
287 typedef void(GLW_APIENTRY* GetTransformFeedbacki_v_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
288 glw::GLuint index, glw::GLint* param);
289 typedef void(GLW_APIENTRY* GetTransformFeedbacki64_v_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
290 glw::GLuint index, glw::GLint64* param);
291
292 GetTransformFeedbackiv_ProcAddress m_gl_getTransformFeedbackiv;
293 GetTransformFeedbacki_v_ProcAddress m_gl_getTransformFeedbacki_v;
294 GetTransformFeedbacki64_v_ProcAddress m_gl_getTransformFeedbacki64_v;
295
296 /* Private member functions. */
297 void prepareFunctionPointers();
298 void cleanErrors();
299
300 bool testCreateTransformFeedbacksForInvalidNumberOfObjects();
301 bool testQueriesForInvalidNameOfObject();
302 bool testGetTransformFeedbackivQueryForInvalidParameterName();
303 bool testGetTransformFeedbacki_vQueryForInvalidParameterName();
304 bool testGetTransformFeedbacki64_vQueryForInvalidParameterName();
305 bool testIndexedQueriesForInvalidBindingPoint();
306 };
307 /* BuffersTest class */
308
309 /** @class FunctionalTest
310 *
311 * @brief Direct State Access Transform Feedback Functional test cases.
312 *
313 * @note The test follows steps:
314 *
315 * Create transform feedback object with CreateTransformFeedbacks function.
316 *
317 * Create buffer object using GenBuffers and BindBuffer functions.
318 * Allocate storage for it using BufferData.
319 *
320 * Bind the buffer to transform feedback object indexed binding point 0
321 * using TransformFeedbackBufferBase function.
322 *
323 * Prepare program with vertex shader which outputs VertexID to transform
324 * feedback varying.
325 *
326 * Create and bind empty vertex array object.
327 *
328 * Begin transform feedback environment.
329 *
330 * Using the program with discarded rasterizer, draw array of 4 indices
331 * using POINTS.
332 *
333 * Pause transform feedback environment.
334 *
335 * Query parameter TRANSFORM_FEEDBACK_PAUSED using GetTransformFeedbackiv.
336 * Expect value equal to TRUE.
337 *
338 * Query parameter TRANSFORM_FEEDBACK_PAUSED using GetTransformFeedbackiv.
339 * Expect value equal to FALSE.
340 *
341 * Resume transform feedback environment.
342 *
343 * Query parameter TRANSFORM_FEEDBACK_PAUSED using GetTransformFeedbackiv.
344 * Expect value equal to FALSE.
345 *
346 * Query parameter TRANSFORM_FEEDBACK_PAUSED using GetTransformFeedbackiv.
347 * Expect value equal to TRUE.
348 *
349 * End Transform feedback environment.
350 *
351 * Verify data in the buffer using MapBuffer function.
352 */
353 class FunctionalTest : public deqp::TestCase
354 {
355 public:
356 /* Public member functions */
357 FunctionalTest(deqp::Context& context);
358
359 virtual tcu::TestNode::IterateResult iterate();
360
361 private:
362 /* Private member functions */
363 FunctionalTest(const FunctionalTest& other);
364 FunctionalTest& operator=(const FunctionalTest& other);
365
366 /* Function pointers type definitions and declarations. */
367 typedef void(GLW_APIENTRY* GetTransformFeedbackiv_ProcAddress)(glw::GLuint xfb, glw::GLenum pname,
368 glw::GLint* param);
369 typedef void(GLW_APIENTRY* TransformFeedbackBufferBase_ProcAddress)(glw::GLuint xfb, glw::GLuint index,
370 glw::GLuint buffer);
371
372 GetTransformFeedbackiv_ProcAddress m_gl_getTransformFeedbackiv;
373 TransformFeedbackBufferBase_ProcAddress m_gl_TransformFeedbackBufferBase;
374
375 /* Private member variables. */
376 glw::GLuint m_xfb_dsa;
377 glw::GLuint m_bo;
378 glw::GLuint m_po;
379 glw::GLuint m_vao;
380
381 /* Private member functions. */
382 void prepareFunctionPointers();
383 void prepareTransformFeedback();
384 void prepareBuffer();
385 void prepareProgram();
386 void prepareVertexArrayObject();
387
388 bool draw();
389 bool testTransformFeedbackStatus(glw::GLenum parameter_name, glw::GLint expected_value);
390 bool verifyBufferContent();
391
392 void clean();
393
394 /* Private static variables. */
395 static const glw::GLuint s_bo_size;
396 static const glw::GLchar s_vertex_shader[];
397 static const glw::GLchar s_fragment_shader[];
398 static const glw::GLchar* const s_xfb_varying;
399 };
400 /* FunctionalTest class */
401 } /* xfb namespace */
402
403 namespace Samplers
404 {
405 /** @class CreationTest
406 *
407 * @brief Direct State Access Sampler Objects Creation test cases.
408 *
409 * Test follows the steps:
410 *
411 * Create at least two Sampler Objects names using GenSamplers function.
412 * Check them without binding, using IsSampler function. Expect GL_FALSE.
413 *
414 * Create at least two Sampler Objects using CreateSamplers function. Check
415 * them without binding, using IsSampler function. Expect GL_TRUE.
416 *
417 * Release objects.
418 */
419 class CreationTest : public deqp::TestCase
420 {
421 public:
422 /* Public member functions */
423 CreationTest(deqp::Context& context);
424
425 virtual tcu::TestNode::IterateResult iterate();
426
427 private:
428 /* Private member functions */
429 CreationTest(const CreationTest& other);
430 CreationTest& operator=(const CreationTest& other);
431 };
432 /* CreationTest class */
433
434 /** @class DefaultsTest
435 *
436 * @brief Direct State Access Sampler Objects Default State test.
437 *
438 * Test follows the steps:
439 *
440 * Create Sampler Object with CreateSamplers function.
441 *
442 * Verify that default value of TEXTURE_BORDER_COLOR queried with function
443 * GetSamplerParameterfv is 0.0, 0.0, 0.0, 0.0.
444 *
445 * Verify that default value of TEXTURE_COMPARE_FUNC queried with function
446 * GetSamplerParameteriv is LEQUAL.
447 *
448 * Verify that default value of TEXTURE_COMPARE_MODE queried with function
449 * GetSamplerParameteriv is NONE.
450 *
451 * Verify that default value of TEXTURE_LOD_BIAS queried with function
452 * GetSamplerParameterfv is 0.0.
453 *
454 * Verify that default value of TEXTURE_MAX_LOD queried with function
455 * GetSamplerParameterfv is 1000.
456 *
457 * Verify that default value of TEXTURE_MAG_FILTER queried with function
458 * GetSamplerParameteriv is LINEAR.
459 *
460 * Verify that default value of TEXTURE_MIN_FILTER queried with function
461 * GetSamplerParameteriv is NEAREST_MIPMAP_LINEAR.
462 *
463 * Verify that default value of TEXTURE_MIN_LOD queried with function
464 * GetSamplerParameterfv is -1000.
465 *
466 * Verify that default value of TEXTURE_WRAP_S queried with function
467 * GetSamplerParameteriv is REPEAT.
468 *
469 * Verify that default value of TEXTURE_WRAP_T queried with function
470 * GetSamplerParameteriv is REPEAT.
471 *
472 * Verify that default value of TEXTURE_WRAP_R queried with function
473 * GetSamplerParameteriv is REPEAT.
474 *
475 * Release objects.
476 */
477 class DefaultsTest : public deqp::TestCase
478 {
479 public:
480 /* Public member functions */
481 DefaultsTest(deqp::Context& context);
482
483 virtual tcu::TestNode::IterateResult iterate();
484
485 private:
486 /* Private member functions */
487 DefaultsTest(const DefaultsTest& other);
488 DefaultsTest& operator=(const DefaultsTest& other);
489
490 /* Private member variables */
491 glw::GLuint m_sampler_dsa;
492
493 /* Private member functions. */
494 void prepare();
495 bool testSamplerIntegerParameter(glw::GLenum pname, glw::GLint expected_value);
496 bool testSamplerFloatParameter(glw::GLenum pname, glw::GLfloat expected_value);
497 bool testSamplerFloatVectorParameter(glw::GLenum pname, glw::GLfloat expected_value[4]);
498 void clean();
499 };
500 /* DefaultsTest class */
501
502 /** @class ErrorsTest
503 *
504 * @brief Direct State Access Samplers Negative test.
505 *
506 * The test follows steps:
507 *
508 * Check that CreateSamplers generates INVALID_VALUE error if
509 * number of sampler objects to create is negative.
510 */
511 class ErrorsTest : public deqp::TestCase
512 {
513 public:
514 /* Public member functions */
515 ErrorsTest(deqp::Context& context);
516
517 virtual tcu::TestNode::IterateResult iterate();
518
519 private:
520 /* Private member functions */
521 ErrorsTest(const ErrorsTest& other);
522 ErrorsTest& operator=(const ErrorsTest& other);
523 };
524 /* ErrorsTest class */
525
526 /** @class FunctionalTest
527 *
528 * @brief Direct State Access Samplers Functional test cases.
529 *
530 * @note The test follows steps:
531 *
532 * Create framebuffer with renderbuffer with color attachment and 1x1 pixel
533 * size. Clean framebuffer content with black color.
534 *
535 * Create and bind empty vertex array object.
536 *
537 * Build and use simple GLSL program drawing full screen textured quad
538 * depending on VertexID. Fragment shader shall output texture point at
539 * (1/3, 1/3).
540 *
541 * Create texture 2 x 2 texels in size. Bind it. Upload texture with
542 * following color data:
543 * RED, GREEN,
544 * BLUE, YELLOW.
545 *
546 * Create Sampler object using CreateSamplers function and bind it to the
547 * texture unit. Setup following sampler parameters:
548 * * TEXTURE_WRAP_S to the value of REPEAT,
549 * * TEXTURE_WRAP_T to REPEAT,
550 * * TEXTURE_MIN_FILTER to NEAREST,
551 * * TEXTURE_MAG_FILTER to NEAREST.
552 *
553 * Draw full screen quad.
554 *
555 * Fetch framebuffer content with ReadPixels function. Check that,
556 * framebuffer is filled with red color.
557 *
558 * Release objects.
559 */
560 class FunctionalTest : public deqp::TestCase
561 {
562 public:
563 /* Public member functions */
564 FunctionalTest(deqp::Context& context);
565
566 virtual tcu::TestNode::IterateResult iterate();
567
568 private:
569 /* Private member functions. */
570 FunctionalTest(const FunctionalTest& other);
571 FunctionalTest& operator=(const FunctionalTest& other);
572
573 void prepareFramebuffer();
574 void prepareVertexArrayObject();
575 void prepareProgram();
576 void prepareTexture();
577 void prepareSampler();
578 void draw();
579 bool checkFramebufferContent();
580 void clean();
581
582 /* Private member variables. */
583 glw::GLuint m_fbo;
584 glw::GLuint m_rbo;
585 glw::GLuint m_vao;
586 glw::GLuint m_to;
587 glw::GLuint m_so;
588 glw::GLuint m_po;
589
590 /* Private static variables. */
591 static const glw::GLchar s_vertex_shader[];
592 static const glw::GLchar s_fragment_shader[];
593 static const glw::GLchar s_uniform_sampler[];
594 static const glw::GLubyte s_texture_data[];
595 };
596 /* FunctionalTest class */
597 } /* Samplers namespace */
598
599 namespace ProgramPipelines
600 {
601 /** @class CreationTest
602 *
603 * @brief Direct State Access Program Pipeline Objects Creation test cases.
604 *
605 * @note Test follows the steps:
606 *
607 * Create at least two Program Pipeline Objects names using
608 * GenProgramPipelines function. Check them without binding, using
609 * IsProgramPipeline function. Expect GL_FALSE.
610 *
611 * Create at least two Program Pipeline Objects using
612 * CreateProgramPipelines function. Check them without binding, using
613 * IsProgramPipeline function. Expect GL_TRUE.
614 *
615 * Release objects.
616 */
617 class CreationTest : public deqp::TestCase
618 {
619 public:
620 /* Public member functions */
621 CreationTest(deqp::Context& context);
622
623 virtual tcu::TestNode::IterateResult iterate();
624
625 private:
626 /* Private member functions */
627 CreationTest(const CreationTest& other);
628 CreationTest& operator=(const CreationTest& other);
629 };
630 /* CreationTest class */
631
632 /** @class DefaultsTest
633 *
634 * @brief Direct State Access Program Pipeline Objects Default State test.
635 *
636 * @note Test follows the steps:
637 *
638 * Create Program Pipeline Object with CreateProgramPipelines function.
639 *
640 * Verify that default value of ACTIVE_PROGRAM queried with function
641 * GetProgramPipelineiv is 0.
642 *
643 * Verify that default value of VERTEX_SHADER queried with function
644 * GetProgramPipelineiv is 0.
645 *
646 * Verify that default value of GEOMETRY_SHADER queried with function
647 * GetProgramPipelineiv is 0.
648 *
649 * Verify that default value of FRAGMENT_SHADER queried with function
650 * GetProgramPipelineiv is 0.
651 *
652 * Verify that default value of COMPUTE_SHADER queried with function
653 * GetProgramPipelineiv is 0.
654 *
655 * Verify that default value of TESS_CONTROL_SHADER queried with function
656 * GetProgramPipelineiv is 0.
657 *
658 * Verify that default value of TESS_EVALUATION_SHADER queried with
659 * function GetProgramPipelineiv is 0.
660 *
661 * Verify that default value of VALIDATE_STATUS queried with function
662 * GetProgramPipelineiv is 0.
663 *
664 * Verify that default value of info log queried with function
665 * GetProgramPiplineInfoLog is 0.
666 *
667 * Verify that default value of INFO_LOG_LENGTH queried with function
668 * GetProgramPipelineiv is 0.
669 *
670 * Release object.
671 */
672 class DefaultsTest : public deqp::TestCase
673 {
674 public:
675 /* Public member functions */
676 DefaultsTest(deqp::Context& context);
677
678 virtual tcu::TestNode::IterateResult iterate();
679
680 private:
681 /* Private member functions */
682 DefaultsTest(const DefaultsTest& other);
683 DefaultsTest& operator=(const DefaultsTest& other);
684
685 /* Private member variables */
686 glw::GLuint m_program_pipeline_dsa;
687
688 /* Private member functions. */
689 void prepare();
690 bool testProgramPipelineParameter(glw::GLenum pname, glw::GLint expected_value);
691 bool testProgramPipelineInfoLog(glw::GLchar* expected_value);
692 void clean();
693 };
694 /* DefaultsTest class */
695
696 /** @class ErrorsTest
697 *
698 * @brief Direct State Access Program Pipeline Negative test.
699 *
700 * The test follows steps:
701 *
702 * Check that CreateProgramPipelines generates INVALID_VALUE error if
703 * number of program pipeline objects to create is negative.
704 */
705 class ErrorsTest : public deqp::TestCase
706 {
707 public:
708 /* Public member functions */
709 ErrorsTest(deqp::Context& context);
710
711 virtual tcu::TestNode::IterateResult iterate();
712
713 private:
714 /* Private member functions */
715 ErrorsTest(const ErrorsTest& other);
716 ErrorsTest& operator=(const ErrorsTest& other);
717 };
718 /* ErrorsTest class */
719
720 /** @class FunctionalTest
721 *
722 * @brief Direct State Access Program Pipeline Functional test cases.
723 *
724 * @note The test follows steps:
725 *
726 * Create framebuffer with renderbuffer with color attachment and 1x1 pixel
727 * size. Clean framebuffer content with black color.
728 *
729 * Create and bind empty vertex array object.
730 *
731 * Make sure that no GLSL program is being used.
732 *
733 * Create two shader programs (with CreateShaderProgramv) - one vertex
734 * shader and one fragment shader. The vertex shader shall output full
735 * screen quad depending on VertexID. The fragment shader shall output red
736 * color.
737 *
738 * Create the Program Pipeline Object using CreateProgramPipelines
739 * function. Bind it using BindProgramPipeline. Setup Program Pipeline
740 * with the created shader programs using UseProgramStages.
741 *
742 * Draw full screen quad.
743 *
744 * Fetch framebuffer content with ReadPixels function. Check that,
745 * framebuffer is filled with red color.
746 *
747 * Release objects.
748 */
749 class FunctionalTest : public deqp::TestCase
750 {
751 public:
752 /* Public member functions */
753 FunctionalTest(deqp::Context& context);
754
755 virtual tcu::TestNode::IterateResult iterate();
756
757 private:
758 /* Private member functions. */
759 FunctionalTest(const FunctionalTest& other);
760 FunctionalTest& operator=(const FunctionalTest& other);
761
762 void prepareFramebuffer();
763 void prepareVertexArrayObject();
764 void prepareShaderPrograms();
765 void preparePipeline();
766 void draw();
767 bool checkFramebufferContent();
768 void clean();
769
770 /* Private member variables. */
771 glw::GLuint m_fbo;
772 glw::GLuint m_rbo;
773 glw::GLuint m_vao;
774 glw::GLuint m_spo_v;
775 glw::GLuint m_spo_f;
776 glw::GLuint m_ppo;
777
778 /* Private static variables. */
779 static const glw::GLchar* s_vertex_shader;
780 static const glw::GLchar* s_fragment_shader;
781 };
782 /* FunctionalTest class */
783 } /* ProgramPipelines namespace */
784
785 namespace Queries
786 {
787 /** @class CreationTest
788 *
789 * @brief Direct State Access Queries Creation test cases.
790 *
791 * @note Test follows the steps:
792 *
793 * Create at least two Query Objects names using GenQueries function.
794 * Check them without binding, using IsQuery function. Expect GL_FALSE.
795 *
796 * Create at least two Query Objects using CreateQueries function. Check
797 * them without binding, using IsQuery function. Expect GL_TRUE.
798 *
799 * Release objects.
800 *
801 * Repeat test for all of following supported targets:
802 * - SAMPLES_PASSED,
803 * - ANY_SAMPLES_PASSED,
804 * - ANY_SAMPLES_PASSED_CONSERVATIVE,
805 * - TIME_ELAPSED,
806 * - TIMESTAMP,
807 * - PRIMITIVES_GENERATED and
808 * - TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN.
809 *
810 * See Ref. OpenGL 4.5 Core Profile, Section 4.2.
811 */
812 class CreationTest : public deqp::TestCase
813 {
814 public:
815 /* Public member functions */
816 CreationTest(deqp::Context& context);
817
818 virtual tcu::TestNode::IterateResult iterate();
819
820 private:
821 /* Private member functions */
822 CreationTest(const CreationTest& other);
823 CreationTest& operator=(const CreationTest& other);
824 };
825 /* CreationTest class */
826
827 /** @class DefaultsTest
828 *
829 * @brief Direct State Access Queries Default State test.
830 *
831 * @note Test follows the steps:
832 *
833 * Create Query Object with CreateQueries function.
834 *
835 * Verify that default value of QUERY_RESULT queried with function
836 * GetQueryObjectuiv is 0 or FALSE.
837 *
838 * Verify that default value of QUERY_RESULT_AVAILABLE queried with
839 * function GetQueryObjectiv is TRUE.
840 *
841 * Release object.
842 *
843 * Repeat test for all of following supported targets:
844 * - SAMPLES_PASSED,
845 * - ANY_SAMPLES_PASSED,
846 * - ANY_SAMPLES_PASSED_CONSERVATIVE,
847 * - TIME_ELAPSED,
848 * - TIMESTAMP,
849 * - PRIMITIVES_GENERATED and
850 * - TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN.
851 *
852 * See Ref. OpenGL 4.5 Core Profile, Section 4.2.
853 */
854 class DefaultsTest : public deqp::TestCase
855 {
856 public:
857 /* Public member functions */
858 DefaultsTest(deqp::Context& context);
859
860 virtual tcu::TestNode::IterateResult iterate();
861
862 private:
863 /* Private member functions */
864 DefaultsTest(const DefaultsTest& other);
865 DefaultsTest& operator=(const DefaultsTest& other);
866
867 /* Private member variables */
868 glw::GLuint m_query_dsa;
869
870 /* Private member functions. */
871 void prepare(const glw::GLenum target);
872 bool testQueryParameter(const glw::GLenum pname, const glw::GLuint expected_value, const glw::GLchar* target_name);
873 void clean();
874 };
875 /* DefaultsTest class */
876
877 /** @class ErrorsTest
878 *
879 * @brief Direct State Access Queries Negative test.
880 *
881 * @note The test follows steps:
882 *
883 * Check that CreateQueries generates INVALID_VALUE error if number of
884 * query objects to create is negative.
885 *
886 * Check that CreateQueries generates INVALID_ENUM error if target is not
887 * one of accepted values:
888 * - SAMPLES_PASSED,
889 * - ANY_SAMPLES_PASSED,
890 * - ANY_SAMPLES_PASSED_CONSERVATIVE,
891 * - TIME_ELAPSED,
892 * - TIMESTAMP,
893 * - PRIMITIVES_GENERATED or
894 * - TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN.
895 *
896 * Check that GetQueryBufferObjectiv, GetQueryBufferObjectuiv,
897 * GetQueryBufferObjecti64v and GetQueryBufferObjectui64v generate
898 * INVALID_OPERATION error if <id> is not the name of a query object, or
899 * if the query object named by <id> is currently active.
900 *
901 * Check that GetQueryBufferObjectiv, GetQueryBufferObjectuiv,
902 * GetQueryBufferObjecti64v and GetQueryBufferObjectui64v generate
903 * INVALID_OPERATION error if <buffer> is not the name of an existing
904 * buffer object.
905 *
906 * Check that GetQueryBufferObjectiv, GetQueryBufferObjectuiv,
907 * GetQueryBufferObjecti64v and GetQueryBufferObjectui64v generate
908 * INVALID_ENUM error if <pname> is not QUERY_RESULT,
909 * QUERY_RESULT_AVAILABLE, QUERY_RESULT_NO_WAIT or QUERY_TARGET.
910 *
911 * Check that GetQueryBufferObjectiv, GetQueryBufferObjectuiv,
912 * GetQueryBufferObjecti64v and GetQueryBufferObjectui64v generate
913 * INVALID_OPERATION error if the query writes to a buffer object, and the
914 * specified buffer offset would cause data to be written beyond the bounds
915 * of that buffer object.
916 *
917 * Check that GetQueryBufferObjectiv, GetQueryBufferObjectuiv,
918 * GetQueryBufferObjecti64v and GetQueryBufferObjectui64v generate
919 * INVALID_VALUE error if <offset> is negative.
920 *
921 * See Ref. OpenGL 4.5 Core Profile, Section 4.2.
922 */
923 class ErrorsTest : public deqp::TestCase
924 {
925 public:
926 /* Public member functions */
927 ErrorsTest(deqp::Context& context);
928
929 virtual tcu::TestNode::IterateResult iterate();
930
931 private:
932 /* Private member functions */
933 ErrorsTest(const ErrorsTest& other);
934 ErrorsTest& operator=(const ErrorsTest& other);
935
936 /* Private member functions. */
937 bool testNegativeNumberOfObjects();
938 bool testInvalidTarget();
939 bool testInvalidQueryName();
940 bool testInvalidBufferName();
941 bool testInvalidParameterName();
942 bool testBufferOverflow();
943 bool testBufferNegativeOffset();
944
945 bool isTarget(glw::GLenum maybe_target);
946 bool isParameterName(glw::GLenum maybe_pname);
947
948 /* Function pointers. */
949 typedef void(GLW_APIENTRY* PFNGLGETQUERYBUFFEROBJECT)(glw::GLuint id, glw::GLuint buffer, glw::GLenum pname,
950 glw::GLintptr offset);
951
952 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjectiv;
953 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjectuiv;
954 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjecti64v;
955 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjectui64v;
956
957 /* Private static variables. */
958 static const glw::GLenum s_targets[];
959 static const glw::GLchar* s_target_names[];
960 static const glw::GLuint s_targets_count;
961 };
962 /* ErrorsTest class */
963
964 /** @class FunctionalTest
965 *
966 * @brief Direct State Access Queries Functional test cases.
967 *
968 * @note The test follows steps:
969 *
970 * Create framebuffer with renderbuffer with color attachment and 1x1 pixel
971 * size. Clean framebuffer content with black color.
972 *
973 * Create and bind empty vertex array object.
974 *
975 * Create buffer object. Bind it to TRANFORM_FEEDBACK_BUFFER binding point.
976 * Bind buffer base to TRANFORM_FEEDBACK_BUFFER binding point with index 0.
977 * Setup data storage of the buffer with size equal to 6 * sizeof(int).
978 *
979 * Build GLSL program consisting of vertex and fragment shader stages.
980 * Vertex shader shall output full screen quad depending on VertexID. The
981 * VertexID shall be saved to transform feedback varying. Fragment shader
982 * shall output red color.
983 *
984 * Create query objects with CreateQueries function for following targets:
985 * - SAMPLES_PASSED,
986 * - PRIMITIVES_GENERATED,
987 * - TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
988 * - TIME_ELAPSED.
989 *
990 * Begin query for every target.
991 *
992 * Begin transform feedback for TRIANGLES primitive type.
993 *
994 * Draw full screen quad with TRIANGLE_STRIP primitive type.
995 *
996 * End transform feedback.
997 *
998 * End all queries.
999 *
1000 * Call Finish function.
1001 *
1002 * Check that framebuffer is filled with red color.
1003 *
1004 * Check that transform feedback buffer contains successive primitive
1005 * vertex ids (0, 1, 2, 2, 1, 3).
1006 *
1007 * For every query objects, using GetQueryBufferObjectiv,
1008 * GetQueryBufferObjectuiv, GetQueryBufferObjecti64v,
1009 * GetQueryBufferObjectui64v functions do following comparisons:
1010 *
1011 * Check that value of parameter QUERY_TARGET is equal to target.
1012 *
1013 * Check that value of parameter QUERY_RESULT_AVAILABLE is TRUE.
1014 *
1015 * Check that value of parameter QUERY_RESULT and QUERY_RESULT_NO_WAIT:
1016 * - is equal to 1 if target is SAMPLES_PASSED; or
1017 * - is equal to 2 if target is PRIMITIVES_GENERATED or
1018 * TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN; or
1019 * - is positive if target is TIME_ELAPSED.
1020 *
1021 * Release objects.
1022 */
1023 class FunctionalTest : public deqp::TestCase
1024 {
1025 public:
1026 /* Public member functions */
1027 FunctionalTest(deqp::Context& context);
1028
1029 virtual tcu::TestNode::IterateResult iterate();
1030
1031 private:
1032 /* Private member functions. */
1033 FunctionalTest(const FunctionalTest& other);
1034 FunctionalTest& operator=(const FunctionalTest& other);
1035
1036 /* Function pointers. */
1037 typedef void(GLW_APIENTRY* PFNGLGETQUERYBUFFEROBJECT)(glw::GLuint id, glw::GLuint buffer, glw::GLenum pname,
1038 glw::GLintptr offset);
1039
1040 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjectiv;
1041 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjectuiv;
1042 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjecti64v;
1043 PFNGLGETQUERYBUFFEROBJECT m_pGetQueryBufferObjectui64v;
1044
1045 /* Private templated functions. */
1046 template <typename T>
1047 static bool equal(T, T);
1048
1049 template <typename T>
1050 static bool less(T, T);
1051
1052 template <typename T>
1053 void GetQueryBufferObject(glw::GLuint id, glw::GLuint buffer, glw::GLenum pname, glw::GLintptr offset);
1054
1055 template <typename T>
1056 bool checkQueryBufferObject(glw::GLuint query, glw::GLenum pname, T expected_value, bool (*comparison)(T, T));
1057
1058 /* Private member functions. */
1059 void prepareView();
1060 void prepareVertexArray();
1061 void prepareBuffers();
1062 void prepareQueries();
1063 void prepareProgram();
1064 void draw();
1065 bool checkView();
1066 bool checkXFB();
1067 void clean();
1068
1069 /* Private member variables. */
1070 glw::GLuint m_fbo;
1071 glw::GLuint m_rbo;
1072 glw::GLuint m_vao;
1073 glw::GLuint m_bo_query;
1074 glw::GLuint m_bo_xfb;
1075 glw::GLuint* m_qo;
1076 glw::GLuint m_po;
1077
1078 /* Private static variables. */
1079 static const glw::GLenum s_targets[];
1080 static const glw::GLuint s_targets_count;
1081
1082 static const glw::GLint s_results[];
1083
1084 static const glw::GLchar s_vertex_shader[];
1085 static const glw::GLchar s_fragment_shader[];
1086 static const glw::GLchar* s_xfb_varying_name;
1087 };
1088 /* FunctionalTest class */
1089
1090 /** @class ReuseTest
1091 *
1092 * @brief Test cases for recycling query handles as different types.
1093 *
1094 * @note Test follows the steps:
1095 *
1096 * Use the EXT_disjoint_timer_query extension to allocate a
1097 * GL_TIMESTAMP_EXT type query.
1098 *
1099 * Try to delete and reuse the object as a GL_TIME_ELAPSED
1100 * type query.
1101 */
1102 class ReuseTest : public deqp::TestCase
1103 {
1104 public:
1105 /* Public member functions */
1106 ReuseTest(deqp::Context& context);
1107
1108 virtual tcu::TestNode::IterateResult iterate();
1109
1110 private:
1111 /* Private member functions */
1112 ReuseTest(const ReuseTest& other);
1113 ReuseTest& operator=(const ReuseTest& other);
1114 };
1115 /* ReuseTest class */
1116
1117 } /* Queries namespace */
1118
1119 namespace Buffers
1120 {
1121 /** @class CreationTest
1122 *
1123 * @brief Direct State Access Buffers Creation test cases.
1124 *
1125 * Test follows the steps:
1126 *
1127 * Create at least two buffer objects using GenBuffers function. Check
1128 * them without binding, using IsBuffer function. Expect GL_FALSE.
1129 *
1130 * Create at least two buffer objects using CreateBuffers function. Check
1131 * them without binding, using IsBuffer function. Expect GL_TRUE.
1132 *
1133 * Release objects.
1134 */
1135 class CreationTest : public deqp::TestCase
1136 {
1137 public:
1138 /* Public member functions */
1139 CreationTest(deqp::Context& context);
1140
1141 virtual tcu::TestNode::IterateResult iterate();
1142
1143 private:
1144 /* Private member functions */
1145 CreationTest(const CreationTest& other);
1146 CreationTest& operator=(const CreationTest& other);
1147 };
1148 /* CreationTest class */
1149
1150 /** @class DataTest
1151 *
1152 * @brief Direct State Access Buffers Data test cases.
1153 *
1154 * Test follows the steps:
1155 *
1156 * Prepare test case with following steps:
1157 *
1158 * Create buffer object using CreateBuffers.
1159 *
1160 * Create data storage using given function and reference data.
1161 *
1162 * Bind buffer.
1163 *
1164 * Check buffer content using MapBuffer function.
1165 *
1166 * Release objects.
1167 *
1168 * Repeat the test case with function for data creation:
1169 * - NamedBufferData,
1170 * - NamedBufferData and it with NamedBufferSubData,
1171 * - NamedBufferStorage,
1172 * - CopyNamedBufferSubData from auxiliary buffer.
1173 *
1174 * If NamedBufferData function is used then repeat the test case for
1175 * usage:
1176 * - STREAM_DRAW,
1177 * - STREAM_READ,
1178 * - STREAM_COPY,
1179 * - STATIC_DRAW,
1180 * - STATIC_READ,
1181 * - STATIC_COPY,
1182 * - DYNAMIC_DRAW,
1183 * - DYNAMIC_READ, and
1184 * - DYNAMIC_COPY.
1185 *
1186 * If NamedBufferStorage function is used then repeat the test case using
1187 * flag MAP_READ_BIT and one of following:
1188 * - DYNAMIC_STORAGE_BIT,
1189 * - MAP_WRITE_BIT,
1190 * - MAP_PERSISTENT_BIT,
1191 * - MAP_COHERENT_BIT and
1192 * - CLIENT_STORAGE_BIT.
1193 */
1194 class DataTest : public deqp::TestCase
1195 {
1196 public:
1197 /* Public member functions */
1198 DataTest(deqp::Context& context);
1199
1200 virtual tcu::TestNode::IterateResult iterate();
1201
1202 private:
1203 /* Private member functions */
1204 DataTest(const DataTest& other);
1205 DataTest& operator=(const DataTest& other);
1206
1207 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1208 glw::GLenum usage);
1209 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr size,
1210 const glw::GLvoid* data);
1211 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSTORAGE)(glw::GLuint buffer, glw::GLsizeiptr size,
1212 const glw::GLvoid* data, glw::GLbitfield flags);
1213 typedef void(GLW_APIENTRY* PFNGLCOPYNAMEDBUFFERSUBDATA)(glw::GLuint readBuffer, glw::GLuint writeBuffer,
1214 glw::GLintptr readOffset, glw::GLintptr writeOffset,
1215 glw::GLsizeiptr size);
1216
1217 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
1218 PFNGLNAMEDBUFFERSUBDATA m_pNamedBufferSubData;
1219 PFNGLNAMEDBUFFERSTORAGE m_pNamedBufferStorage;
1220 PFNGLCOPYNAMEDBUFFERSUBDATA m_pCopyNamedBufferSubData;
1221
1222 bool TestCase(void (DataTest::*UploadDataFunction)(glw::GLuint, glw::GLenum), glw::GLenum parameter);
1223
1224 void UploadUsingNamedBufferData(glw::GLuint id, glw::GLenum parameter);
1225 void UploadUsingNamedBufferSubData(glw::GLuint id, glw::GLenum parameter);
1226 void UploadUsingNamedBufferStorage(glw::GLuint id, glw::GLenum parameter);
1227 void UploadUsingCopyNamedBufferSubData(glw::GLuint id, glw::GLenum parameter);
1228
1229 bool compare(const glw::GLuint* data, const glw::GLuint* reference, const glw::GLsizei count);
1230 void LogFail(void (DataTest::*UploadDataFunction)(glw::GLuint, glw::GLenum), glw::GLenum parameter,
1231 const glw::GLuint* data, const glw::GLuint* reference, const glw::GLsizei count);
1232 void LogError(void (DataTest::*UploadDataFunction)(glw::GLuint, glw::GLenum), glw::GLenum parameter);
1233
1234 static const glw::GLuint s_reference[];
1235 static const glw::GLsizei s_reference_size;
1236 static const glw::GLsizei s_reference_count;
1237 };
1238 /* DataTest class */
1239
1240 /** @class ClearTest
1241 *
1242 * @brief Direct State Access Buffers Clear test cases.
1243 *
1244 * Test follows the steps:
1245 *
1246 * Prepare test case with following steps:
1247 *
1248 * Create buffer object using CreateBuffers.
1249 *
1250 * Create data storage using NamedBufferData without data
1251 * specification.
1252 *
1253 * Clear buffer content using given function.
1254 *
1255 * Bind buffer.
1256 *
1257 * Check buffer content using MapBuffer function.
1258 *
1259 * Release objects.
1260 *
1261 * Repeat test case for following clear functions:
1262 * - ClearNamedBufferData and
1263 * - ClearNamedBufferSubData.
1264 *
1265 * Repeat test case for following internal formats:
1266 * - GL_R8,
1267 * - GL_R16,
1268 * - GL_R16F,
1269 * - GL_R32F,
1270 * - GL_R8I,
1271 * - GL_R16I,
1272 * - GL_R32I,
1273 * - GL_R8UI,
1274 * - GL_R16UI,
1275 * - GL_R32UI,
1276 * - GL_RG8,
1277 * - GL_RG16,
1278 * - GL_RG16F,
1279 * - GL_RG32F,
1280 * - GL_RG8I,
1281 * - GL_RG16I,
1282 * - GL_RG32I,
1283 * - GL_RG8UI,
1284 * - GL_RG16UI,
1285 * - GL_RG32UI,
1286 * - GL_RGB32F,
1287 * - GL_RGB32I,
1288 * - GL_RGB32UI,
1289 * - GL_RGBA8,
1290 * - GL_RGBA16,
1291 * - GL_RGBA16F,
1292 * - GL_RGBA32F,
1293 * - GL_RGBA8I,
1294 * - GL_RGBA16I,
1295 * - GL_RGBA32I,
1296 * - GL_RGBA8UI,
1297 * - GL_RGBA16UI and
1298 * - GL_RGBA32UI.
1299 */
1300 class ClearTest : public deqp::TestCase
1301 {
1302 public:
1303 /* Public member functions */
1304 ClearTest(deqp::Context& context);
1305
1306 virtual tcu::TestNode::IterateResult iterate();
1307
1308 private:
1309 /* Private member functions */
1310 ClearTest(const ClearTest& other);
1311 ClearTest& operator=(const ClearTest& other);
1312
1313 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1314 glw::GLenum usage);
1315 typedef void(GLW_APIENTRY* PFNGLCLEARNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLenum internalformat,
1316 glw::GLenum format, glw::GLenum type,
1317 const glw::GLvoid* data);
1318 typedef void(GLW_APIENTRY* PFNGLCLEARNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLenum internalformat,
1319 glw::GLintptr offset, glw::GLsizeiptr size,
1320 glw::GLenum format, glw::GLenum type,
1321 const glw::GLvoid* data);
1322
1323 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
1324 PFNGLCLEARNAMEDBUFFERDATA m_pClearNamedBufferData;
1325 PFNGLCLEARNAMEDBUFFERSUBDATA m_pClearNamedBufferSubData;
1326
1327 template <typename T, bool USE_SUB_DATA>
1328 bool TestClearNamedBufferData(glw::GLenum internalformat, glw::GLsizei count, glw::GLenum format, glw::GLenum type,
1329 T* data);
1330
1331 template <bool USE_SUB_DATA>
1332 void ClearNamedBuffer(glw::GLuint buffer, glw::GLenum internalformat, glw::GLsizei size, glw::GLenum format,
1333 glw::GLenum type, glw::GLvoid* data);
1334
1335 template <typename T>
1336 bool Compare(const T* data, const T* reference, const glw::GLsizei count);
1337
1338 template <typename T>
1339 void LogFail(bool use_sub_data, glw::GLenum internalformat, const T* data, const T* reference,
1340 const glw::GLsizei count);
1341
1342 void LogError(bool use_sub_data, glw::GLenum internalformat);
1343 };
1344 /* ClearTest class */
1345
1346 /** @class MapReadOnlyTest
1347 *
1348 * @brief Direct State Access Buffers Map Read Only test cases.
1349 *
1350 * Test follows the steps:
1351 *
1352 * Create buffer object using CreateBuffers.
1353 *
1354 * Create data storage using NamedBufferData function and reference
1355 * data.
1356 *
1357 * Map buffer with MapNamedBuffer function and READ_ONLY access flag.
1358 *
1359 * Compare mapped buffer content with reference data.
1360 *
1361 * Unmap buffer using UnmapNamedBuffer. Test if UnmapNamedBuffer
1362 * returned GL_TRUE.
1363 *
1364 * Release buffer.
1365 */
1366 class MapReadOnlyTest : public deqp::TestCase
1367 {
1368 public:
1369 /* Public member functions */
1370 MapReadOnlyTest(deqp::Context& context);
1371
1372 virtual tcu::TestNode::IterateResult iterate();
1373
1374 private:
1375 /* Private member functions */
1376 MapReadOnlyTest(const MapReadOnlyTest& other);
1377 MapReadOnlyTest& operator=(const MapReadOnlyTest& other);
1378
1379 /* API entry points. */
1380 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1381 glw::GLenum usage);
1382 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFER)(glw::GLuint buffer, glw::GLenum access);
1383 typedef glw::GLboolean(GLW_APIENTRY* PFNGLUNMAPNAMEDBUFFER)(glw::GLuint buffer);
1384
1385 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
1386 PFNGLMAPNAMEDBUFFER m_pMapNamedBuffer;
1387 PFNGLUNMAPNAMEDBUFFER m_pUnmapNamedBuffer;
1388
1389 static const glw::GLuint s_reference[]; //<! Reference data.
1390 static const glw::GLsizei s_reference_size; //<! Reference data size.
1391 static const glw::GLsizei s_reference_count; //<! Reference data count (number of GLuint elements).
1392 };
1393 /* MapReadOnlyTest class */
1394
1395 /** @class MapReadWriteTest
1396 *
1397 * @brief Direct State Access Buffers Map Read Write test cases.
1398 *
1399 * Test follows the steps:
1400 *
1401 * Create buffer object using CreateBuffers.
1402 *
1403 * Create data storage using NamedBufferData function and reference
1404 * data.
1405 *
1406 * Map buffer with MapNamedBuffer function and READ_WRITE access flag.
1407 *
1408 * Compare mapped buffer content with reference.
1409 *
1410 * Write to the mapped buffer inverted reference content.
1411 *
1412 * Unmap buffer.
1413 *
1414 * Map buffer with MapNamedBuffer function and READ_WRITE access flag.
1415 *
1416 * Compare mapped buffer content with inverted reference.
1417 *
1418 * Unmap buffer.
1419 *
1420 * Release buffer.
1421 */
1422 class MapReadWriteTest : public deqp::TestCase
1423 {
1424 public:
1425 /* Public member functions */
1426 MapReadWriteTest(deqp::Context& context);
1427
1428 virtual tcu::TestNode::IterateResult iterate();
1429
1430 private:
1431 /* Private member functions */
1432 MapReadWriteTest(const MapReadWriteTest& other);
1433 MapReadWriteTest& operator=(const MapReadWriteTest& other);
1434
1435 /* API entry points. */
1436 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1437 glw::GLenum usage);
1438 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFER)(glw::GLuint buffer, glw::GLenum access);
1439 typedef glw::GLboolean(GLW_APIENTRY* PFNGLUNMAPNAMEDBUFFER)(glw::GLuint buffer);
1440
1441 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
1442 PFNGLMAPNAMEDBUFFER m_pMapNamedBuffer;
1443 PFNGLUNMAPNAMEDBUFFER m_pUnmapNamedBuffer;
1444
1445 static const glw::GLuint s_reference[]; //<! Reference data.
1446 static const glw::GLsizei s_reference_size; //<! Reference data size.
1447 static const glw::GLsizei s_reference_count; //<! Reference data count (number of GLuint elements).
1448 };
1449 /* MapReadWriteTest class */
1450
1451 /** @class MapWriteOnlyTest
1452 *
1453 * @brief Direct State Access Buffers Map Write Only test cases.
1454 *
1455 * Test follows the steps:
1456 *
1457 * Create buffer object using CreateBuffers.
1458 *
1459 * Create data storage using NamedBufferData function.
1460 *
1461 * Map buffer with MapNamedBuffer function and WRITE_ONLY access flag.
1462 *
1463 * Write reference data.
1464 *
1465 * Unmap buffer.
1466 *
1467 * Bind buffer to the binding point.
1468 *
1469 * Map buffer with MapBuffer function and READ_ONLY access flag.
1470 *
1471 * Compare mapped buffer content with reference.
1472 *
1473 * Unmap buffer.
1474 *
1475 * Release buffer.
1476 */
1477 class MapWriteOnlyTest : public deqp::TestCase
1478 {
1479 public:
1480 /* Public member functions */
1481 MapWriteOnlyTest(deqp::Context& context);
1482
1483 virtual tcu::TestNode::IterateResult iterate();
1484
1485 private:
1486 /* Private member functions */
1487 MapWriteOnlyTest(const MapWriteOnlyTest& other);
1488 MapWriteOnlyTest& operator=(const MapWriteOnlyTest& other);
1489
1490 /* API entry points. */
1491 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1492 glw::GLenum usage);
1493 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFER)(glw::GLuint buffer, glw::GLenum access);
1494 typedef glw::GLboolean(GLW_APIENTRY* PFNGLUNMAPNAMEDBUFFER)(glw::GLuint buffer);
1495
1496 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
1497 PFNGLMAPNAMEDBUFFER m_pMapNamedBuffer;
1498 PFNGLUNMAPNAMEDBUFFER m_pUnmapNamedBuffer;
1499
1500 static const glw::GLuint s_reference[]; //<! Reference data.
1501 static const glw::GLsizei s_reference_size; //<! Reference data size.
1502 static const glw::GLsizei s_reference_count; //<! Reference data count (number of GLuint elements).
1503 };
1504 /* MapReadOnlyTest class */
1505
1506 /** @class MapRangeReadBitTest
1507 *
1508 * @brief Direct State Access Buffers Range Map Read Bit test cases.
1509 *
1510 * Test follows the steps:
1511 *
1512 * Create buffer object using CreateBuffers.
1513 *
1514 * Create data storage using NamedBufferStorage function, reference
1515 * data and MAP_READ_BIT access flag.
1516 *
1517 * Map first half of buffer with MapNamedBufferRange and MAP_READ_BIT
1518 * access flag.
1519 *
1520 * Compare mapped buffer content with reference.
1521 *
1522 * Unmap buffer.
1523 *
1524 * Map second half of buffer with MapNamedBufferRange and MAP_READ_BIT
1525 * access flag.
1526 *
1527 * Compare mapped buffer content with reference.
1528 *
1529 * Unmap buffer.
1530 *
1531 * Release buffer.
1532 *
1533 * Repeat the test with also MAP_PERSISTENT_BIT flag turned on.
1534 *
1535 * Repeat the test with also MAP_PERSISTENT_BIT and MAP_COHERENT_BIT
1536 * flags turned on.
1537 */
1538 class MapRangeReadBitTest : public deqp::TestCase
1539 {
1540 public:
1541 /* Public member functions */
1542 MapRangeReadBitTest(deqp::Context& context);
1543
1544 virtual tcu::TestNode::IterateResult iterate();
1545
1546 private:
1547 /* Private member functions */
1548 MapRangeReadBitTest(const MapRangeReadBitTest& other);
1549 MapRangeReadBitTest& operator=(const MapRangeReadBitTest& other);
1550
1551 /* API entry points. */
1552 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSTORAGE)(glw::GLuint buffer, glw::GLsizeiptr size,
1553 const glw::GLvoid* data, glw::GLbitfield flags);
1554 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFERRANGE)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr length,
1555 glw::GLbitfield access);
1556 typedef glw::GLboolean(GLW_APIENTRY* PFNGLUNMAPNAMEDBUFFER)(glw::GLuint buffer);
1557
1558 PFNGLNAMEDBUFFERSTORAGE m_pNamedBufferStorage;
1559 PFNGLMAPNAMEDBUFFERRANGE m_pMapNamedBufferRange;
1560 PFNGLUNMAPNAMEDBUFFER m_pUnmapNamedBuffer;
1561
1562 bool CompareWithReference(glw::GLuint* data, glw::GLintptr offset, glw::GLsizei length);
1563
1564 static const glw::GLuint s_reference[]; //<! Reference data.
1565 static const glw::GLsizei s_reference_size; //<! Reference data size.
1566 static const glw::GLsizei s_reference_count; //<! Reference data count (number of GLuint elements).
1567 };
1568 /* MapRangeReadBitTest class */
1569
1570 /** @class MapRangeWriteBitTest
1571 *
1572 * @brief Direct State Access Buffers Range Map Read Bit test cases.
1573 *
1574 * Test follows the steps:
1575 *
1576 * Create buffer object using CreateBuffers.
1577 *
1578 * Create data storage using NamedBufferStorage function, reference
1579 * data and (MAP_READ_BIT | MAP_WRITE_BIT) access flag.
1580 *
1581 * Map first half of buffer with MapNamedBufferRange and MAP_WRITE_BIT
1582 * access flag.
1583 *
1584 * Write reference data.
1585 *
1586 * Unmap buffer.
1587 *
1588 * Map second half of buffer with MapNamedBufferRange and MAP_WRITE_BIT
1589 * access flag.
1590 *
1591 * Write reference data.
1592 *
1593 * Unmap buffer.
1594 *
1595 * Bind buffer to the binding point.
1596 *
1597 * Map buffer with MapBuffer function and READ_ONLY access flag.
1598 *
1599 * Compare mapped buffer content with reference.
1600 *
1601 * Unmap buffer.
1602 *
1603 * Release buffer.
1604 *
1605 * Repeat the test with also MAP_INVALIDATE_RANGE_BIT flag turned on.
1606 *
1607 * Repeat the test with also MAP_INVALIDATE_BUFFER_BIT flag turned on with
1608 * only the first mapping.
1609 *
1610 * Repeat the test with also MAP_FLUSH_EXPLICIT_BIT flag turned on. Make
1611 * sure that all writes are flushed using FlushNamedMappedBufferRange
1612 * function.
1613 *
1614 * Repeat the test with also MAP_UNSYNCHRONIZED_BIT flag turned on with
1615 * only the second mapping.
1616 */
1617 class MapRangeWriteBitTest : public deqp::TestCase
1618 {
1619 public:
1620 /* Public member functions */
1621 MapRangeWriteBitTest(deqp::Context& context);
1622
1623 virtual tcu::TestNode::IterateResult iterate();
1624
1625 private:
1626 /* Private member functions */
1627 MapRangeWriteBitTest(const MapRangeWriteBitTest& other);
1628 MapRangeWriteBitTest& operator=(const MapRangeWriteBitTest& other);
1629
1630 /* API entry points. */
1631 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSTORAGE)(glw::GLuint buffer, glw::GLsizeiptr size,
1632 const glw::GLvoid* data, glw::GLbitfield flags);
1633 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFERRANGE)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr length,
1634 glw::GLbitfield access);
1635 typedef glw::GLboolean(GLW_APIENTRY* PFNGLUNMAPNAMEDBUFFER)(glw::GLuint buffer);
1636 typedef void(GLW_APIENTRY* PFNGLFLUSHMAPPEDNAMEDBUFFERRANGE)(glw::GLuint buffer, glw::GLintptr offset,
1637 glw::GLsizeiptr length);
1638
1639 PFNGLNAMEDBUFFERSTORAGE m_pNamedBufferStorage;
1640 PFNGLMAPNAMEDBUFFERRANGE m_pMapNamedBufferRange;
1641 PFNGLUNMAPNAMEDBUFFER m_pUnmapNamedBuffer;
1642 PFNGLFLUSHMAPPEDNAMEDBUFFERRANGE m_pFlushMappedNamedBufferRange;
1643
1644 bool CompareWithReference(glw::GLuint buffer, glw::GLbitfield access_flag);
1645
1646 static const glw::GLuint s_reference[]; //<! Reference data.
1647 static const glw::GLsizei s_reference_size; //<! Reference data size.
1648 static const glw::GLsizei s_reference_count; //<! Reference data count (number of GLuint elements).
1649 };
1650 /* MapRangeWriteBitTest class */
1651
1652 /** @class SubDataQueryTest
1653 *
1654 * @brief Direct State Access GetNamedBufferSubData Query test cases.
1655 *
1656 * Test follows the steps:
1657 *
1658 * Create buffer object using CreateBuffers.
1659 *
1660 * Create data storage using NamedBufferData function and reference data.
1661 *
1662 * Fetch first half of the buffer using GetNamedBufferSubData function.
1663 *
1664 * Fetch second half of the buffer using GetNamedBufferSubData function.
1665 *
1666 * Compare fetched data with reference values.
1667 *
1668 * Release object.
1669 */
1670 class SubDataQueryTest : public deqp::TestCase
1671 {
1672 public:
1673 /* Public member functions */
1674 SubDataQueryTest(deqp::Context& context);
1675
1676 virtual tcu::TestNode::IterateResult iterate();
1677
1678 private:
1679 /* Private member functions */
1680 SubDataQueryTest(const SubDataQueryTest& other);
1681 SubDataQueryTest& operator=(const SubDataQueryTest& other);
1682
1683 /* API entry points. */
1684 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1685 glw::GLenum usage);
1686 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr size,
1687 glw::GLvoid* data);
1688
1689 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
1690 PFNGLGETNAMEDBUFFERSUBDATA m_pGetNamedBufferSubData;
1691
1692 static const glw::GLuint s_reference[]; //<! Reference data.
1693 static const glw::GLsizei s_reference_size; //<! Reference data size.
1694 static const glw::GLsizei s_reference_count; //<! Reference data count (number of GLuint elements).
1695 };
1696 /* SubDataQueryTest class */
1697
1698 /** @class DefaultsTest
1699 *
1700 * @brief Direct State Access Buffer Objects Default Values Test.
1701 *
1702 * Test follows the steps:
1703 *
1704 * Create buffer object using CreateBuffers.
1705 *
1706 * Check that GetNamedBufferParameteriv and GetNamedBufferParameteri64v
1707 * function called with parameter name
1708 * - BUFFER_SIZE returns value equal to 0;
1709 * - BUFFER_USAGE returns value equal to STATIC_DRAW;
1710 * - BUFFER_ACCESS returns value equal to READ_WRITE;
1711 * - BUFFER_ACCESS_FLAGS returns value equal to 0;
1712 * - BUFFER_IMMUTABLE_STORAGE returns value equal to FALSE;
1713 * - BUFFER_MAPPED returns value equal to FALSE;
1714 * - BUFFER_MAP_OFFSET returns value equal to 0;
1715 * - BUFFER_MAP_LENGTH returns value equal to 0;
1716 * - BUFFER_STORAGE_FLAGS returns value equal to 0.
1717 *
1718 * Check that GetNamedBufferPointerv function called with parameter name
1719 * BUFFER_MAP_POINTER returns value equal to NULL;
1720 */
1721 class DefaultsTest : public deqp::TestCase
1722 {
1723 public:
1724 /* Public member functions */
1725 DefaultsTest(deqp::Context& context);
1726
1727 virtual tcu::TestNode::IterateResult iterate();
1728
1729 private:
1730 /* Private member functions */
1731 DefaultsTest(const DefaultsTest& other);
1732 DefaultsTest& operator=(const DefaultsTest& other);
1733
1734 bool CheckParameterError(const glw::GLchar* pname_string, const glw::GLchar* function_string);
1735
1736 template <typename T>
1737 bool CheckValue(const T value, const T reference_value, const glw::GLchar* pname_string,
1738 const glw::GLchar* function_string);
1739
1740 /* API entry points. */
1741 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1742 glw::GLenum usage);
1743 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPARAMETERI64V)(glw::GLuint buffer, glw::GLenum pname,
1744 glw::GLint64* data);
1745 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPARAMETERIV)(glw::GLuint buffer, glw::GLenum pname, glw::GLint* data);
1746 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPOINTERV)(glw::GLuint buffer, glw::GLenum pname,
1747 glw::GLvoid** params);
1748
1749 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
1750 PFNGLGETNAMEDBUFFERPARAMETERI64V m_pGetNamedBufferParameteri64v;
1751 PFNGLGETNAMEDBUFFERPARAMETERIV m_pGetNamedBufferParameteriv;
1752 PFNGLGETNAMEDBUFFERPOINTERV m_pGetNamedBufferPointerv;
1753 };
1754 /* DefaultsTest class */
1755
1756 /** @class ErrorsTest
1757 *
1758 * @brief Direct State Access Buffer Objects Errors Test.
1759 *
1760 * Test follows the steps:
1761 *
1762 * Check that INVALID_VALUE is generated by CreateBuffers if n is negative.
1763 *
1764 *
1765 * Check that INVALID_OPERATION is generated by NamedBufferStorage if
1766 * buffer is not the name of an existing buffer object.
1767 *
1768 * Check that INVALID_VALUE is generated by NamedBufferStorage if size is
1769 * less than or equal to zero.
1770 *
1771 * Check that INVALID_VALUE is generated by NamedBufferStorage if flags has
1772 * any bits set other than DYNAMIC_STORAGE_BIT, MAP_READ_BIT,
1773 * MAP_WRITE_BIT, MAP_PERSISTENT_BIT, MAP_COHERENT_BIT or
1774 * CLIENT_STORAGE_BIT.
1775 *
1776 * Check that INVALID_VALUE error is generated by NamedBufferStorage if
1777 * flags contains MAP_PERSISTENT_BIT but does not contain at least one of
1778 * MAP_READ_BIT or MAP_WRITE_BIT.
1779 *
1780 * Check that INVALID_VALUE is generated by NamedBufferStorage if flags
1781 * contains MAP_COHERENT_BIT, but does not also contain MAP_PERSISTENT_BIT.
1782 *
1783 * Check that OUT_OF_MEMORY is generated if the GL is unable to create a
1784 * data store with the specified size. Do not set result, if out of memory
1785 * situation was impossible to generate or unable to verify.
1786 *
1787 *
1788 * Check that INVALID_OPERATION is generated by NamedBufferData if buffer
1789 * is not the name of an existing buffer object.
1790 *
1791 * Check that INVALID_ENUM is generated by NamedBufferData if usage is not
1792 * STREAM_DRAW, STREAM_READ, STREAM_COPY, STATIC_DRAW, STATIC_READ,
1793 * STATIC_COPY, DYNAMIC_DRAW, DYNAMIC_READ or DYNAMIC_COPY.
1794 *
1795 * Check that INVALID_VALUE is generated by NamedBufferData if size is
1796 * negative.
1797 *
1798 * Check that INVALID_OPERATION is generated by NamedBufferData if the
1799 * BUFFER_IMMUTABLE_STORAGE flag of the buffer object is TRUE.
1800 *
1801 * Check that OUT_OF_MEMORY is generated if the GL is unable to create a
1802 * data store with the specified size. Do not set result, if out of memory
1803 * situation was impossible to generate or unable to verify.
1804 *
1805 *
1806 * Check that INVALID_OPERATION is generated by NamedBufferSubData if
1807 * buffer is not the name of an existing buffer object.
1808 *
1809 * Check that INVALID_VALUE is generated by NamedBufferSubData if offset or
1810 * size is negative, or if offset+size is greater than the value of
1811 * BUFFER_SIZE for the specified buffer object.
1812 *
1813 * Check that INVALID_OPERATION is generated by NamedBufferSubData if any
1814 * part of the specified range of the buffer object is mapped with
1815 * MapBufferRange or MapBuffer, unless it was mapped with the
1816 * MAP_PERSISTENT_BIT bit set in the MapBufferRange access flags.
1817 *
1818 * Check that INVALID_OPERATION is generated by NamedBufferSubData if the
1819 * value of the BUFFER_IMMUTABLE_STORAGE flag of the buffer object is TRUE
1820 * and the value of BUFFER_STORAGE_FLAGS for the buffer object does not
1821 * have the DYNAMIC_STORAGE_BIT bit set.
1822 *
1823 *
1824 * Check that INVALID_OPERATION is generated by ClearNamedBufferData if
1825 * buffer is not the name of an existing buffer object.
1826 *
1827 * Check that INVALID_ENUM is generated by ClearNamedBufferData if
1828 * internal format is not one of the valid sized internal formats listed in
1829 * the table above.
1830 *
1831 * Check that INVALID_OPERATION is generated by ClearNamedBufferData if
1832 * any part of the specified range of the buffer object is mapped with
1833 * MapBufferRange or MapBuffer, unless it was mapped with the
1834 * MAP_PERSISTENT_BIT bit set in the MapBufferRange access flags.
1835 *
1836 * Check that INVALID_VALUE is generated by ClearNamedBufferData if
1837 * format is not a valid format, or type is not a valid type.
1838 *
1839 *
1840 * Check that INVALID_OPERATION is generated by ClearNamedBufferSubData
1841 * if buffer is not the name of an existing buffer object.
1842 *
1843 * Check that INVALID_ENUM is generated by ClearNamedBufferSubData if
1844 * internal format is not one of the valid sized internal formats listed in
1845 * the table above.
1846 *
1847 * Check that INVALID_VALUE is generated by ClearNamedBufferSubData if
1848 * offset or range are not multiples of the number of basic machine units
1849 * per-element for the internal format specified by internal format. This
1850 * value may be computed by multiplying the number of components for
1851 * internal format from the table by the size of the base type from the
1852 * specification table.
1853 *
1854 * Check that INVALID_VALUE is generated by ClearNamedBufferSubData if
1855 * offset or size is negative, or if offset+size is greater than the value
1856 * of BUFFER_SIZE for the buffer object.
1857 *
1858 * Check that INVALID_OPERATION is generated by ClearNamedBufferSubData
1859 * if any part of the specified range of the buffer object is mapped with
1860 * MapBufferRange or MapBuffer, unless it was mapped with the
1861 * MAP_PERSISTENT_BIT bit set in the MapBufferRange access flags.
1862 *
1863 * Check that INVALID_VALUE is generated by ClearNamedBufferSubData if
1864 * format is not a valid format, or type is not a valid type.
1865 *
1866 *
1867 * Check that INVALID_OPERATION is generated by CopyNamedBufferSubData if
1868 * readBuffer or writeBuffer is not the name of an existing buffer object.
1869 *
1870 * Check that INVALID_VALUE is generated by CopyNamedBufferSubData if any of
1871 * readOffset, writeOffset or size is negative, if readOffset+size is
1872 * greater than the size of the source buffer object (its value of
1873 * BUFFER_SIZE), or if writeOffset+size is greater than the size of the
1874 * destination buffer object.
1875 *
1876 * Check that INVALID_VALUE is generated by CopyNamedBufferSubData if the
1877 * source and destination are the same buffer object, and the ranges
1878 * [readOffset,readOffset+size) and [writeOffset,writeOffset+size) overlap.
1879 *
1880 * Check that INVALID_OPERATION is generated by CopyNamedBufferSubData if
1881 * either the source or destination buffer object is mapped with
1882 * MapBufferRange or MapBuffer, unless they were mapped with the
1883 * MAP_PERSISTENT bit set in the MapBufferRange access flags.
1884 *
1885 *
1886 * Check that INVALID_OPERATION is generated by MapNamedBuffer if buffer is
1887 * not the name of an existing buffer object.
1888 *
1889 * Check that INVALID_ENUM is generated by MapNamedBuffer if access is not
1890 * READ_ONLY, WRITE_ONLY, or READ_WRITE.
1891 *
1892 * Check that INVALID_OPERATION is generated by MapNamedBuffer if the
1893 * buffer object is in a mapped state.
1894 *
1895 *
1896 * Check that INVALID_OPERATION is generated by MapNamedBufferRange if
1897 * buffer is not the name of an existing buffer object.
1898 *
1899 * Check that INVALID_VALUE is generated by MapNamedBufferRange if offset
1900 * or length is negative, if offset+length is greater than the value of
1901 * BUFFER_SIZE for the buffer object, or if access has any bits set other
1902 * than those defined above.
1903 *
1904 * Check that INVALID_OPERATION is generated by MapNamedBufferRange for any
1905 * of the following conditions:
1906 * - length is zero.
1907 * - The buffer object is already in a mapped state.
1908 * - Neither MAP_READ_BIT nor MAP_WRITE_BIT is set.
1909 * - MAP_READ_BIT is set and any of MAP_INVALIDATE_RANGE_BIT,
1910 * MAP_INVALIDATE_BUFFER_BIT or MAP_UNSYNCHRONIZED_BIT is set.
1911 * - MAP_FLUSH_EXPLICIT_BIT is set and MAP_WRITE_BIT is not set.
1912 * - Any of MAP_READ_BIT, MAP_WRITE_BIT, MAP_PERSISTENT_BIT, or
1913 * MAP_COHERENT_BIT are set, but the same bit is not included in the
1914 * buffer's storage flags.
1915 *
1916 *
1917 * Check that INVALID_OPERATION is generated by UnmapNamedBuffer if buffer
1918 * is not the name of an existing buffer object.
1919 *
1920 * Check that INVALID_OPERATION is generated by UnmapNamedBuffer if the
1921 * buffer object is not in a mapped state.
1922 *
1923 *
1924 * Check that INVALID_OPERATION is generated by FlushMappedNamedBufferRange
1925 * if buffer is not the name of an existing buffer object.
1926 *
1927 * Check that INVALID_VALUE is generated by FlushMappedNamedBufferRange if
1928 * offset or length is negative, or if offset + length exceeds the size of
1929 * the mapping.
1930 *
1931 * Check that INVALID_OPERATION is generated by FlushMappedNamedBufferRange
1932 * if the buffer object is not mapped, or is mapped without the
1933 * MAP_FLUSH_EXPLICIT_BIT flag.
1934 *
1935 *
1936 * Check that INVALID_OPERATION is generated by GetNamedBufferParameter* if
1937 * buffer is not the name of an existing buffer object.
1938 *
1939 * Check that INVALID_ENUM is generated by GetNamedBufferParameter* if
1940 * pname is not one of the buffer object parameter names: BUFFER_ACCESS,
1941 * BUFFER_ACCESS_FLAGS, BUFFER_IMMUTABLE_STORAGE, BUFFER_MAPPED,
1942 * BUFFER_MAP_LENGTH, BUFFER_MAP_OFFSET, BUFFER_SIZE, BUFFER_STORAGE_FLAGS,
1943 * BUFFER_USAGE.
1944 *
1945 *
1946 * Check that INVALID_OPERATION is generated by GetNamedBufferPointerv
1947 * if buffer is not the name of an existing buffer object.
1948 *
1949 *
1950 * Check that INVALID_OPERATION is generated by GetNamedBufferSubData if
1951 * buffer is not the name of an existing buffer object.
1952 *
1953 * Check that INVALID_VALUE is generated by GetNamedBufferSubData if offset
1954 * or size is negative, or if offset+size is greater than the value of
1955 * BUFFER_SIZE for the buffer object.
1956 *
1957 * Check that INVALID_OPERATION is generated by GetNamedBufferSubData if
1958 * the buffer object is mapped with MapBufferRange or MapBuffer, unless it
1959 * was mapped with the MAP_PERSISTENT_BIT bit set in the MapBufferRange
1960 * access flags.
1961 */
1962 class ErrorsTest : public deqp::TestCase
1963 {
1964 public:
1965 /* Public member functions */
1966 ErrorsTest(deqp::Context& context);
1967
1968 virtual tcu::TestNode::IterateResult iterate();
1969
1970 private:
1971 /* Private member functions */
1972 ErrorsTest(const ErrorsTest& other);
1973 ErrorsTest& operator=(const ErrorsTest& other);
1974
1975 /* API entry points. */
1976 typedef void(GLW_APIENTRY* PFNGLCLEARNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLenum internalformat,
1977 glw::GLenum format, glw::GLenum type,
1978 const glw::GLvoid* data);
1979 typedef void(GLW_APIENTRY* PFNGLCLEARNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLenum internalformat,
1980 glw::GLintptr offset, glw::GLsizeiptr size,
1981 glw::GLenum format, glw::GLenum type,
1982 const glw::GLvoid* data);
1983 typedef void(GLW_APIENTRY* PFNGLCOPYNAMEDBUFFERSUBDATA)(glw::GLuint readBuffer, glw::GLuint writeBuffer,
1984 glw::GLintptr readOffset, glw::GLintptr writeOffset,
1985 glw::GLsizeiptr size);
1986 typedef void(GLW_APIENTRY* PFNGLFLUSHMAPPEDNAMEDBUFFERRANGE)(glw::GLuint buffer, glw::GLintptr offset,
1987 glw::GLsizeiptr length);
1988 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPARAMETERI64V)(glw::GLuint buffer, glw::GLenum pname,
1989 glw::GLint64* data);
1990 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPARAMETERIV)(glw::GLuint buffer, glw::GLenum pname, glw::GLint* data);
1991 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPOINTERV)(glw::GLuint buffer, glw::GLenum pname,
1992 glw::GLvoid** params);
1993 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr size,
1994 glw::GLvoid* data);
1995 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFER)(glw::GLuint buffer, glw::GLenum access);
1996 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFERRANGE)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr length,
1997 glw::GLbitfield access);
1998 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
1999 glw::GLenum usage);
2000 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSTORAGE)(glw::GLuint buffer, glw::GLsizeiptr size,
2001 const glw::GLvoid* data, glw::GLbitfield flags);
2002 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr size,
2003 const glw::GLvoid* data);
2004 typedef glw::GLboolean(GLW_APIENTRY* PFNGLUNMAPNAMEDBUFFER)(glw::GLuint buffer);
2005
2006 PFNGLCLEARNAMEDBUFFERDATA m_pClearNamedBufferData;
2007 PFNGLCLEARNAMEDBUFFERSUBDATA m_pClearNamedBufferSubData;
2008 PFNGLCOPYNAMEDBUFFERSUBDATA m_pCopyNamedBufferSubData;
2009 PFNGLFLUSHMAPPEDNAMEDBUFFERRANGE m_pFlushMappedNamedBufferRange;
2010 PFNGLGETNAMEDBUFFERPARAMETERI64V m_pGetNamedBufferParameteri64v;
2011 PFNGLGETNAMEDBUFFERPARAMETERIV m_pGetNamedBufferParameteriv;
2012 PFNGLGETNAMEDBUFFERPOINTERV m_pGetNamedBufferPointerv;
2013 PFNGLGETNAMEDBUFFERSUBDATA m_pGetNamedBufferSubData;
2014 PFNGLMAPNAMEDBUFFER m_pMapNamedBuffer;
2015 PFNGLMAPNAMEDBUFFERRANGE m_pMapNamedBufferRange;
2016 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
2017 PFNGLNAMEDBUFFERSTORAGE m_pNamedBufferStorage;
2018 PFNGLNAMEDBUFFERSUBDATA m_pNamedBufferSubData;
2019 PFNGLUNMAPNAMEDBUFFER m_pUnmapNamedBuffer;
2020
2021 /* Private member functions */
2022 bool TestErrorsOfClearNamedBufferData();
2023 bool TestErrorsOfClearNamedBufferSubData();
2024 bool TestErrorsOfCopyNamedBufferSubData();
2025 bool TestErrorsOfCreateBuffers();
2026 bool TestErrorsOfFlushMappedNamedBufferRange();
2027 bool TestErrorsOfGetNamedBufferParameter();
2028 bool TestErrorsOfGetNamedBufferPointerv();
2029 bool TestErrorsOfGetNamedBufferSubData();
2030 bool TestErrorsOfMapNamedBuffer();
2031 bool TestErrorsOfMapNamedBufferRange();
2032 bool TestErrorsOfNamedBufferData();
2033 bool TestErrorsOfNamedBufferStorage();
2034 bool TestErrorsOfNamedBufferSubData();
2035 bool TestErrorsOfUnmapNamedBuffer();
2036
2037 bool ErrorCheckAndLog(const glw::GLchar* function_name, const glw::GLenum expected_error,
2038 const glw::GLchar* when_shall_be_generated);
2039 };
2040 /* ErrorsTest class */
2041
2042 /** @class FunctionalTest
2043 *
2044 * @brief Direct State Access Buffer Objects Functional Test.
2045 *
2046 * This test verifies basic usage in rendering pipeline of the tested
2047 * functions:
2048 * - ClearNamedBufferData,
2049 * - ClearNamedBufferSubData,
2050 * - CopyNamedBufferSubData,
2051 * - FlushMappedNamedBufferRange,
2052 * - GetNamedBufferParameteri64v,
2053 * - GetNamedBufferParameteriv,
2054 * - GetNamedBufferPointerv,
2055 * - GetNamedBufferSubData,
2056 * - MapNamedBuffer,
2057 * - MapNamedBufferRange,
2058 * - NamedBufferData,
2059 * - NamedBufferStorage,
2060 * - NamedBufferSubData and
2061 * - UnmapNamedBuffer.
2062 *
2063 * Test follows the steps:
2064 *
2065 * Prepare program with vertex shader and fragment shader. Fragment shader
2066 * shall be pass-trough. Vertex shader shall have one integer input
2067 * variable. Vertex shader shall output (to transform feedback) square of
2068 * input variable. gl_Position shall be set up to vec4(0.0, 0.0, 0.0, 1.0).
2069 * Build and use the program.
2070 *
2071 * Create and bind empty vertex array object.
2072 *
2073 * Prepare one buffer using CreateBuffers and NamedBufferStorage with size
2074 * of 6 integers and passing pointer to data {1, 2, 3, 4, 5, 5} and dynamic
2075 * storage flag set on. Clear (with 0) the first element with
2076 * ClearNamedBufferSubData. Set second data element to 1 using
2077 * NamedBufferSubData. Set third data element to 2 using MapNamedBuffer
2078 * and UnmapNamedBuffer. Bind it to ARRAY_BUFFER binding point. Copy forth
2079 * element into fifth element using CopyNamedBufferSubData. Set fourth data
2080 * element using MapNamedBufferRange and FlushMappedNamedBuffer to 3.
2081 * During mapping check that GetNamedBufferPointerv called with
2082 * BUFFER_MAP_POINTER returns proper pointer. Unmap it using
2083 * UnmapNamedBuffer function. Setup buffer as an input attribute to GLSL
2084 * program. Consequently, the resulting buffer shall be {0, 1, 2, 3, 4, 5}.
2085 *
2086 * Prepare one buffer using GenBuffers. Bind it to transform feedback.
2087 * Allocate it's storage using NamedBufferData with size of 7 integers and
2088 * passing pointer to data {0, 0, 0, 0, 0, 0, 36}. Set up this buffer as
2089 * transform feedback output.
2090 *
2091 * Begin transform feedback.
2092 *
2093 * Draw six indices using points.
2094 *
2095 * End transform feedback.
2096 *
2097 * Query array buffer's parameter BUFFER_IMMUTABLE_STORAGE with
2098 * GetNamedBufferParameteriv and compare with previous setup.
2099 *
2100 * Query transform feedback buffer size with GetNamedBufferParameteri64v
2101 * and compare with previous setup.
2102 *
2103 * Fetch transform feedback buffer content using GetNamedBufferSubData and
2104 * queried size.
2105 *
2106 * Check that fetched data is equal to {0, 1, 4, 9, 16, 25, 36}.
2107 *
2108 * If any check fails, test shall fail.
2109 *
2110 * If any of the tested functions generates error, test shall fail.
2111 */
2112 class FunctionalTest : public deqp::TestCase
2113 {
2114 public:
2115 /* Public member functions */
2116 FunctionalTest(deqp::Context& context);
2117
2118 virtual tcu::TestNode::IterateResult iterate();
2119
2120 private:
2121 /* Private member functions */
2122 FunctionalTest(const FunctionalTest& other);
2123 FunctionalTest& operator=(const FunctionalTest& other);
2124
2125 /* API entry points. */
2126 typedef void(GLW_APIENTRY* PFNGLCLEARNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLenum internalformat,
2127 glw::GLenum format, glw::GLenum type,
2128 const glw::GLvoid* data);
2129 typedef void(GLW_APIENTRY* PFNGLCLEARNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLenum internalformat,
2130 glw::GLintptr offset, glw::GLsizeiptr size,
2131 glw::GLenum format, glw::GLenum type,
2132 const glw::GLvoid* data);
2133 typedef void(GLW_APIENTRY* PFNGLCOPYNAMEDBUFFERSUBDATA)(glw::GLuint readBuffer, glw::GLuint writeBuffer,
2134 glw::GLintptr readOffset, glw::GLintptr writeOffset,
2135 glw::GLsizeiptr size);
2136 typedef void(GLW_APIENTRY* PFNGLFLUSHMAPPEDNAMEDBUFFERRANGE)(glw::GLuint buffer, glw::GLintptr offset,
2137 glw::GLsizeiptr length);
2138 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPARAMETERI64V)(glw::GLuint buffer, glw::GLenum pname,
2139 glw::GLint64* data);
2140 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPARAMETERIV)(glw::GLuint buffer, glw::GLenum pname, glw::GLint* data);
2141 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERPOINTERV)(glw::GLuint buffer, glw::GLenum pname,
2142 glw::GLvoid** params);
2143 typedef void(GLW_APIENTRY* PFNGLGETNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr size,
2144 glw::GLvoid* data);
2145 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFER)(glw::GLuint buffer, glw::GLenum access);
2146 typedef void*(GLW_APIENTRY* PFNGLMAPNAMEDBUFFERRANGE)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr length,
2147 glw::GLbitfield access);
2148 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERDATA)(glw::GLuint buffer, glw::GLsizeiptr size, const glw::GLvoid* data,
2149 glw::GLenum usage);
2150 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSTORAGE)(glw::GLuint buffer, glw::GLsizeiptr size,
2151 const glw::GLvoid* data, glw::GLbitfield flags);
2152 typedef void(GLW_APIENTRY* PFNGLNAMEDBUFFERSUBDATA)(glw::GLuint buffer, glw::GLintptr offset, glw::GLsizeiptr size,
2153 const glw::GLvoid* data);
2154 typedef glw::GLboolean(GLW_APIENTRY* PFNGLUNMAPNAMEDBUFFER)(glw::GLuint buffer);
2155
2156 PFNGLCLEARNAMEDBUFFERDATA m_pClearNamedBufferData;
2157 PFNGLCLEARNAMEDBUFFERSUBDATA m_pClearNamedBufferSubData;
2158 PFNGLCOPYNAMEDBUFFERSUBDATA m_pCopyNamedBufferSubData;
2159 PFNGLFLUSHMAPPEDNAMEDBUFFERRANGE m_pFlushMappedNamedBufferRange;
2160 PFNGLGETNAMEDBUFFERPARAMETERI64V m_pGetNamedBufferParameteri64v;
2161 PFNGLGETNAMEDBUFFERPARAMETERIV m_pGetNamedBufferParameteriv;
2162 PFNGLGETNAMEDBUFFERPOINTERV m_pGetNamedBufferPointerv;
2163 PFNGLGETNAMEDBUFFERSUBDATA m_pGetNamedBufferSubData;
2164 PFNGLMAPNAMEDBUFFER m_pMapNamedBuffer;
2165 PFNGLMAPNAMEDBUFFERRANGE m_pMapNamedBufferRange;
2166 PFNGLNAMEDBUFFERDATA m_pNamedBufferData;
2167 PFNGLNAMEDBUFFERSTORAGE m_pNamedBufferStorage;
2168 PFNGLNAMEDBUFFERSUBDATA m_pNamedBufferSubData;
2169 PFNGLUNMAPNAMEDBUFFER m_pUnmapNamedBuffer;
2170
2171 /* Private member variables. */
2172 glw::GLuint m_po;
2173 glw::GLuint m_vao;
2174 glw::GLuint m_bo_in;
2175 glw::GLuint m_bo_out;
2176 glw::GLint m_attrib_location;
2177
2178 /* Private static variables. */
2179 static const glw::GLchar s_vertex_shader[];
2180 static const glw::GLchar s_fragment_shader[];
2181 static const glw::GLchar s_vertex_shader_input_name[];
2182 static const glw::GLchar* s_vertex_shader_output_name;
2183
2184 static const glw::GLint s_initial_data_a[];
2185 static const glw::GLint s_initial_data_b[];
2186 static const glw::GLint s_expected_data[];
2187
2188 /* Private member functions */
2189 void BuildProgram();
2190 void PrepareVertexArrayObject();
2191 bool PrepareInputBuffer();
2192 bool PrepareOutputBuffer();
2193 void Draw();
2194 bool CheckArrayBufferImmutableFlag();
2195 bool CheckTransformFeedbackBufferSize();
2196 bool CheckTransformFeedbackResult();
2197 void Cleanup();
2198 };
2199 /* FunctionalTest class */
2200 } /* Buffers namespace */
2201
2202 namespace Framebuffers
2203 {
2204 /** Framebuffer Creation
2205 *
2206 * Create at least two framebuffer objects using GenFramebuffers function.
2207 * Check them without binding, using IsFramebuffer function. Expect FALSE.
2208 *
2209 * Create at least two framebuffer objects using CreateFramebuffers
2210 * function. Check them without binding, using IsFramebuffer function.
2211 * Expect TRUE.
2212 *
2213 * Release objects.
2214 */
2215 class CreationTest : public deqp::TestCase
2216 {
2217 public:
2218 /* Public member functions */
2219 CreationTest(deqp::Context& context);
2220
2221 virtual tcu::TestNode::IterateResult iterate();
2222
2223 private:
2224 /* Private member functions */
2225 CreationTest(const CreationTest& other);
2226 CreationTest& operator=(const CreationTest& other);
2227 };
2228 /* CreationTest class */
2229
2230 /** Framebuffer Renderbuffer Attachment
2231 *
2232 * Create renderbuffer using GenRenderbuffers function. Bind it. Prepare
2233 * its storage using RenderbufferStorage. Unbind it.
2234 *
2235 * Create framebuffer using CreateFramebuffers. Setup renderbuffer storage.
2236 * Attach the renderbuffer to the framebuffer using
2237 * NamedFramebufferRenderbuffer function.
2238 *
2239 * Bind framebuffer and check its status using CheckFramebufferStatus
2240 * function call.
2241 *
2242 * Clear the framebuffer's content with the reference value. Fetch the
2243 * framebuffer's content using ReadPixels and compare it with reference
2244 * values.
2245 *
2246 * Repeat the test for following attachment types:
2247 * - COLOR_ATTACHMENTi for i from 0 to value of MAX_COLOR_ATTACHMENTS
2248 * minus one,
2249 * - DEPTH_ATTACHMENT,
2250 * - STENCIL_ATTACHMENT and
2251 * - DEPTH_STENCIL_ATTACHMENT.
2252 */
2253 class RenderbufferAttachmentTest : public deqp::TestCase
2254 {
2255 public:
2256 /* Public member functions */
2257 RenderbufferAttachmentTest(deqp::Context& context);
2258
2259 virtual tcu::TestNode::IterateResult iterate();
2260
2261 private:
2262 /* Private member functions */
2263 RenderbufferAttachmentTest(const RenderbufferAttachmentTest& other);
2264 RenderbufferAttachmentTest& operator=(const RenderbufferAttachmentTest& other);
2265
2266 bool Test(glw::GLenum attachment, glw::GLenum internalformat);
2267 void Clean();
2268
2269 /* Private member variables. */
2270 glw::GLuint m_fbo;
2271 glw::GLuint m_rbo;
2272 };
2273 /* RenderbufferAttachmentTest class */
2274
2275 /** Named Framebuffer Texture Attachment
2276 *
2277 * Create texture using CreateTexture function. Prepare its storage using
2278 * TexStorage*D*.
2279 *
2280 * Create framebuffer using CreateFramebuffers. Attach the texture to
2281 * the framebuffer using NamedFramebufferTexture function. Repeat
2282 * attachment for all texture levels.
2283 *
2284 * Bind framebuffer and check its status using CheckFramebufferStatus
2285 * function call.
2286 *
2287 * Clear the framebuffer's content with the reference value. Fetch the
2288 * framebuffer's content using ReadPixels and compare it with reference
2289 * values.
2290 *
2291 * Repeat the test for following attachment types:
2292 * - COLOR_ATTACHMENTi for i from 0 to value of MAX_COLOR_ATTACHMENTS
2293 * minus one,
2294 * - DEPTH_ATTACHMENT,
2295 * - STENCIL_ATTACHMENT and
2296 * - DEPTH_STENCIL_ATTACHMENT.
2297 *
2298 * Repeat the test for following texture targets:
2299 * - TEXTURE_RECTANGLE,
2300 * - TEXTURE_2D,
2301 * - TEXTURE_2D_MULTISAMPLE,
2302 * - TEXTURE_CUBE_MAP.
2303 *
2304 * Repeat the test with each possible texture level, that is:
2305 * - 0 for TEXTURE_RECTANGLE and TEXTURE_2D_MULTISAMPLE targets;
2306 * - from zero to value one less than base 2 logarithm of the value of
2307 * MAX_3D_TEXTURE_SIZE for TEXTURE_2D target
2308 * - from zero to value one less than base 2 logarithm of the value of
2309 * MAX_CUBE_MAP_TEXTURE_SIZE for TEXTURE_CUBE_MAP target.
2310 */
2311 class TextureAttachmentTest : public deqp::TestCase
2312 {
2313 public:
2314 /* Public member functions */
2315 TextureAttachmentTest(deqp::Context& context);
2316
2317 virtual tcu::TestNode::IterateResult iterate();
2318
2319 private:
2320 /* Private member functions */
2321 TextureAttachmentTest(const TextureAttachmentTest& other);
2322 TextureAttachmentTest& operator=(const TextureAttachmentTest& other);
2323
2324 bool Test(glw::GLenum attachment, bool is_color_attachment, glw::GLenum texture_target, glw::GLenum internalformat,
2325 glw::GLuint levels);
2326 bool SubTestAttachmentError(glw::GLenum attachment, glw::GLenum texture_target, glw::GLuint level,
2327 glw::GLuint levels);
2328 bool SubTestStatus(glw::GLenum attachment, glw::GLenum texture_target, glw::GLuint level, glw::GLuint levels);
2329 bool SubTestContent(glw::GLenum attachment, glw::GLenum texture_target, glw::GLenum internalformat,
2330 glw::GLuint level, glw::GLuint levels);
2331 glw::GLuint MaxTextureLevels(glw::GLenum texture_target);
2332 void Clear();
2333 void Clean();
2334
2335 /* Private member variables. */
2336 glw::GLuint m_fbo;
2337 glw::GLuint m_to;
2338
2339 /* Static private variables. */
2340 static const glw::GLenum s_targets[];
2341 static const glw::GLuint s_targets_count;
2342
2343 static const glw::GLfloat s_reference_color[4];
2344 static const glw::GLint s_reference_color_integer[4];
2345 static const glw::GLfloat s_reference_depth;
2346 static const glw::GLint s_reference_stencil;
2347 };
2348 /* TextureAttachmentTest class */
2349
2350 /** Named Framebuffer Texture Layer Attachment
2351 *
2352 * Create texture using CreateTexture function. Prepare its storage using
2353 * TexStorage*D*.
2354 *
2355 * Create framebuffer using CreateFramebuffers. Attach the texture to the
2356 * framebuffer using NamedFramebufferTextureLayer function.
2357 *
2358 * Bind framebuffer and check its status using CheckFramebufferStatus
2359 * function call.
2360 *
2361 * For non multisample target, clean the framebuffer's content with the
2362 * reference value. Fetch one pixel from framebuffer's content using
2363 * ReadPixels and compare it with reference values.
2364 *
2365 * Repeat the test for following attachment types:
2366 * - COLOR_ATTACHMENTi for i from 0 to value of MAX_COLOR_ATTACHMENTS
2367 * minus one,
2368 * - DEPTH_ATTACHMENT,
2369 * - STENCIL_ATTACHMENT and
2370 * - DEPTH_STENCIL_ATTACHMENT.
2371 *
2372 * Repeat the test for following texture targets:
2373 * - TEXTURE_2D_MULTISAMPLE_ARRAY,
2374 * - TEXTURE_2D_ARRAY,
2375 * - TEXTURE_CUBE_MAP_ARRAY,
2376 * - TEXTURE_3D.
2377 *
2378 * Repeat the test for texture levels from zero to value one less than base
2379 * 2 logarithm of the value of MAX_3D_TEXTURE_SIZE.
2380 *
2381 * Repeat with texture which has number of layers:
2382 * - 1,
2383 * - 256,
2384 * - value of MAX_CUBE_MAP_TEXTURE_SIZE for TEXTURE_CUBE_ARRAY or value
2385 * of MAX_3D_TEXTURE_SIZE.
2386 * Test only limited set of the layers of the above textures to reduce time
2387 * complexity of the test.
2388 */
2389 class TextureLayerAttachmentTest : public deqp::TestCase
2390 {
2391 public:
2392 /* Public member functions */
2393 TextureLayerAttachmentTest(deqp::Context& context);
2394
2395 virtual tcu::TestNode::IterateResult iterate();
2396
2397 private:
2398 /* Private member functions */
2399 TextureLayerAttachmentTest(const TextureLayerAttachmentTest& other);
2400 TextureLayerAttachmentTest& operator=(const TextureLayerAttachmentTest& other);
2401
2402 bool Test(glw::GLenum attachment, bool is_color_attachment, glw::GLenum texture_target, glw::GLenum internalformat,
2403 glw::GLuint levels, glw::GLint layers);
2404 bool SubTestAttachmentError(glw::GLenum attachment, glw::GLenum texture_target, glw::GLuint level, glw::GLint layer,
2405 glw::GLuint levels, glw::GLint layers);
2406 bool SubTestStatus(glw::GLenum attachment, glw::GLenum texture_target, glw::GLuint level, glw::GLint layer,
2407 glw::GLuint levels, glw::GLint layers);
2408 bool SubTestContent(glw::GLenum attachment, glw::GLenum texture_target, glw::GLenum internalformat,
2409 glw::GLuint level, glw::GLint layer, glw::GLuint levels, glw::GLint layers);
2410 void Clear();
2411 glw::GLuint MaxTextureLevels(glw::GLenum texture_target);
2412 glw::GLuint MaxTextureLayers(glw::GLenum texture_target);
2413 void Clean();
2414
2415 /* Private member variables. */
2416 glw::GLuint m_fbo;
2417 glw::GLuint m_to;
2418
2419 /* Static private variables. */
2420 static const glw::GLenum s_targets[];
2421 static const glw::GLuint s_targets_count;
2422
2423 static const glw::GLfloat s_reference_color[4];
2424 static const glw::GLint s_reference_color_integer[4];
2425 static const glw::GLfloat s_reference_depth;
2426 static const glw::GLint s_reference_stencil;
2427 };
2428 /* TextureLayerAttachmentTest class */
2429
2430 /** Named Framebuffer Draw Read Buffer
2431 *
2432 * Create named framebuffer with maximum number of color attachments (use
2433 * named renderbuffer storage).
2434 *
2435 * For each color attachment use NamedFramebufferDrawBuffer to set up it as
2436 * a draw buffer. Clear it with unique color.
2437 *
2438 * For each color attachment use NamedFramebufferReadBuffer to set up it as
2439 * a read buffer. Fetch the pixel data and compare that it contains unique
2440 * color with the attachment was cleared
2441 *
2442 * Check that NamedFramebufferDrawBuffer and NamedFramebufferReadBuffer
2443 * accept GL_NONE as mode without error.
2444 *
2445 * Release all objects.
2446 */
2447 class DrawReadBufferTest : public deqp::TestCase
2448 {
2449 public:
2450 /* Public member functions */
2451 DrawReadBufferTest(deqp::Context& context);
2452
2453 virtual tcu::TestNode::IterateResult iterate();
2454
2455 private:
2456 /* Private member functions */
2457 DrawReadBufferTest(const DrawReadBufferTest& other);
2458 DrawReadBufferTest& operator=(const DrawReadBufferTest& other);
2459 };
2460 /* DrawReadBufferTest class */
2461
2462 /** Named Framebuffer Draw Buffers
2463 *
2464 * Create named framebuffer with maximum number of color attachments (use
2465 * named renderbuffer storage).
2466 *
2467 * Set up all attachments as a draw buffer using the function
2468 * NamedFramebufferDrawBuffers. Then clear them at once with unique color.
2469 *
2470 * For each color attachment fetch pixel data and compare that contain
2471 * the same unique color.
2472 *
2473 * Release all objects.
2474 */
2475 class DrawBuffersTest : public deqp::TestCase
2476 {
2477 public:
2478 /* Public member functions */
2479 DrawBuffersTest(deqp::Context& context);
2480
2481 virtual tcu::TestNode::IterateResult iterate();
2482
2483 private:
2484 /* Private member functions */
2485 DrawBuffersTest(const DrawBuffersTest& other);
2486 DrawBuffersTest& operator=(const DrawBuffersTest& other);
2487
2488 /* Private static constants. */
2489 static const glw::GLfloat s_rgba[4];
2490 };
2491 /* DrawReadBuffersTest class */
2492
2493 /** Invalidate Named Framebuffer Data
2494 *
2495 * For default framebuffer try to invalidate each of COLOR, DEPTH, and
2496 * STENCIL attachments. Expect no error.
2497 *
2498 * For default framebuffer try to invalidate all (COLOR, DEPTH, and
2499 * STENCIL) attachments. Expect no error.
2500 *
2501 * Create named framebuffer with maximum number of color attachments (use
2502 * named renderbuffer storage), depth attachment and stencil attachment.
2503 *
2504 * Clear all attachments.
2505 *
2506 * Try to invalidate content of all attachments using
2507 * InvalidateNamedFramebufferData. Expect no error.
2508 *
2509 * Try to invalidate content of each attachment using
2510 * InvalidateNamedFramebufferData. Expect no error.
2511 *
2512 * Release all objects.
2513 */
2514 class InvalidateDataTest : public deqp::TestCase
2515 {
2516 public:
2517 /* Public member functions */
2518 InvalidateDataTest(deqp::Context& context);
2519
2520 virtual tcu::TestNode::IterateResult iterate();
2521
2522 private:
2523 /* Private member functions */
2524 InvalidateDataTest(const InvalidateDataTest& other);
2525 InvalidateDataTest& operator=(const InvalidateDataTest& other);
2526
2527 bool CheckErrorAndLog(const glw::GLenum attachment);
2528 bool CheckErrorAndLog(const glw::GLenum attachments[], const glw::GLuint count);
2529 };
2530 /* InvalidateDataTest class */
2531
2532 /** Invalidate Named Framebuffer SubData
2533 *
2534 * For default framebuffer try to invalidate part of each of COLOR, DEPTH,
2535 * and STENCIL attachments. Expect no error.
2536 *
2537 * For default framebuffer try to invalidate part of all (COLOR, DEPTH, and
2538 * STENCIL) attachments. Expect no error.
2539 *
2540 * Create named framebuffer with maximum number of color attachments (use
2541 * named renderbuffer storage), depth attachment and stencil attachment.
2542 *
2543 * Clear all attachments.
2544 *
2545 * Try to invalidate content of part of all attachments using
2546 * InvalidateNamedFramebufferData. Expect no error.
2547 *
2548 * Try to invalidate content of part of each attachment using
2549 * InvalidateNamedFramebufferData. Expect no error.
2550 *
2551 * Release all objects.
2552 */
2553 class InvalidateSubDataTest : public deqp::TestCase
2554 {
2555 public:
2556 /* Public member functions */
2557 InvalidateSubDataTest(deqp::Context& context);
2558
2559 virtual tcu::TestNode::IterateResult iterate();
2560
2561 private:
2562 /* Private member functions */
2563 InvalidateSubDataTest(const InvalidateSubDataTest& other);
2564 InvalidateSubDataTest& operator=(const InvalidateSubDataTest& other);
2565
2566 bool CheckErrorAndLog(const glw::GLenum attachment);
2567 bool CheckErrorAndLog(const glw::GLenum attachments[], const glw::GLuint count);
2568 };
2569 /* InvalidateSubDataTest class */
2570
2571 /** Clear Named Framebuffer
2572 *
2573 * Repeat following steps for fixed-point, floating-point, signed integer,
2574 * and unsigned integer color attachments.
2575 *
2576 * Create named framebuffer with maximum number of color attachments
2577 * (use named renderbuffer storage).
2578 *
2579 * Clear each of the color attachment with unique color using proper
2580 * ClearNamedFramebuffer* function.
2581 *
2582 * For each color attachment fetch pixel data and compare that contain
2583 * unique color with which it was cleared.
2584 *
2585 * Release all objects.
2586 *
2587 * Next, do following steps:
2588 *
2589 * Create named framebuffer with depth attachment and stencil
2590 * attachment.
2591 *
2592 * Clear each of the attachments with unique value using proper
2593 * ClearNamedFramebufferfi function.
2594 *
2595 * Fetch pixel data of each attachment and compare that contain unique
2596 * value with which it was cleared.
2597 *
2598 * Release all objects.
2599 */
2600 class ClearTest : public deqp::TestCase
2601 {
2602 public:
2603 /* Public member functions */
2604 ClearTest(deqp::Context& context);
2605
2606 virtual tcu::TestNode::IterateResult iterate();
2607
2608 private:
2609 /* Private member functions */
2610 ClearTest(const ClearTest& other);
2611 ClearTest& operator=(const ClearTest& other);
2612
2613 void PrepareFramebuffer(glw::GLenum buffer, glw::GLenum internalformat);
2614
2615 template <typename T>
2616 bool TestClearColor(glw::GLenum buffer, glw::GLenum attachment, T value);
2617
2618 template <typename T>
2619 bool ClearColor(glw::GLenum buffer, glw::GLint drawbuffer, T value);
2620
2621 bool TestClearDepthAndStencil(glw::GLfloat depth, glw::GLint stencil);
2622
2623 template <typename T>
2624 glw::GLenum Format();
2625
2626 template <typename T>
2627 glw::GLenum Type();
2628
2629 template <typename T>
2630 bool Compare(const T first, const T second);
2631
2632 void Clean();
2633
2634 /* Private member variables. */
2635 glw::GLuint m_fbo;
2636 glw::GLuint* m_renderbuffers;
2637 glw::GLuint m_renderbuffers_count;
2638 };
2639 /* ClearTest class */
2640
2641 /** Blit Named Framebuffer
2642 *
2643 * Create named framebuffer with color, depth and stencil attachments with
2644 * size 2x2 pixels(use named renderbuffer storage).
2645 *
2646 * Create named framebuffer with color, depth and stencil attachments with
2647 * size 2x3 pixels(use named renderbuffer storage).
2648 *
2649 * Clear the first framebuffer with red color, 0.5 depth and 1 as a stencil
2650 * index.
2651 *
2652 * Blit one pixel of the first framebuffer to the second framebuffer to the
2653 * pixel at (0, 0) position with NEAREST filter.
2654 *
2655 * Clear first the framebuffer with green color, 0.25 depth and 2 as a
2656 * stencil index.
2657 *
2658 * Blit one pixel of the first framebuffer to the second framebuffer to the
2659 * pixel at (1, 0) position with LINEAR filter for color attachment, but
2660 * NEAREST filter for depth and stencil attachments.
2661 *
2662 * Clear the first framebuffer with blue color, 0.125 depth and 3 as a
2663 * stencil index.
2664 *
2665 * Blit the whole first framebuffer to the second framebuffer by shrinking
2666 * it to the single pixel at (2, 0) position.
2667 *
2668 * Clear the first framebuffer with yellow color, 0.0625 depth and 4 as a
2669 * stencil index.
2670 *
2671 * Blit one pixel of the framebuffer to the second framebuffer by expanding
2672 * it to the three pixel constructing horizontal line at (0, 1) position.
2673 *
2674 * Expect no error.
2675 *
2676 * Check that color attachment of the second framebuffer has following
2677 * values:
2678 * red, green, blue,
2679 * yellow, yellow, yellow.
2680 *
2681 * Check that depth attachment of the second framebuffer has following
2682 * values:
2683 * 0.5, 0.25, 0.125
2684 * 0.0625, 0.0625, 0.0625.
2685 *
2686 * Check that stencil attachment of the second framebuffer has following
2687 * values:
2688 * 1, 2, 3
2689 * 4, 4, 4.
2690 *
2691 * Release all objects.
2692 */
2693 class BlitTest : public deqp::TestCase
2694 {
2695 public:
2696 /* Public member functions */
2697 BlitTest(deqp::Context& context);
2698
2699 virtual tcu::TestNode::IterateResult iterate();
2700
2701 private:
2702 /* Private member functions */
2703 BlitTest(const BlitTest& other);
2704 BlitTest& operator=(const BlitTest& other);
2705
2706 void PrepareFramebuffers();
2707 bool Test();
2708 void ClearFramebuffer(glw::GLfloat red, glw::GLfloat green, glw::GLfloat blue, glw::GLfloat depth,
2709 glw::GLint stencil);
2710 bool CheckErrorAndLog();
2711 bool CheckColor();
2712 bool CheckDepth();
2713 bool CheckStencil();
2714 void Clean();
2715
2716 /* Private member variables. */
2717 glw::GLuint m_fbo_src;
2718 glw::GLuint m_rbo_color_src;
2719 glw::GLuint m_rbo_depth_stencil_src;
2720 glw::GLuint m_fbo_dst;
2721 glw::GLuint m_rbo_color_dst;
2722 glw::GLuint m_rbo_depth_stencil_dst;
2723 };
2724 /* BlitTest class */
2725
2726 /** Check Named Framebuffer Status
2727 *
2728 * Do following test cases:
2729 *
2730 * Incomplete attachment case
2731 *
2732 * Prepare framebuffer with one incomplete attachment.
2733 *
2734 * Check the framebuffer status using CheckNamedFramebufferStatus.
2735 * Expect FRAMEBUFFER_INCOMPLETE_ATTACHMENT return value.
2736 *
2737 * Release all objects.
2738 *
2739 * Repeat the test case for all possible color, depth and stencil
2740 * attachments.
2741 *
2742 * Missing attachment case
2743 *
2744 * Prepare framebuffer without any attachment.
2745 *
2746 * Check the framebuffer status using CheckNamedFramebufferStatus.
2747 * Expect FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT return value.
2748 *
2749 * Release all objects.
2750 *
2751 * Incomplete multisample renderbuffer case
2752 *
2753 * Prepare framebuffer with two multisampled renderbuffer color
2754 * attachments which have different number of samples.
2755 *
2756 * Check the framebuffer status using CheckNamedFramebufferStatus.
2757 * Expect FRAMEBUFFER_INCOMPLETE_MULTISAMPLE return value. If the
2758 * check fails return TEST_RESULT_COMPATIBILITY_WARNING.
2759 *
2760 * Release all objects.
2761 *
2762 * Incomplete multisample texture case
2763 *
2764 * Prepare framebuffer with two multisampled texture color
2765 * attachments and one multisampled renderbuffer which all have
2766 * different number of sample locations. One of the textures shall
2767 * have fixed sample locations set, one not.
2768 *
2769 * Check the framebuffer status using CheckNamedFramebufferStatus.
2770 * Expect FRAMEBUFFER_INCOMPLETE_MULTISAMPLE return value. If the
2771 * check fails return TEST_RESULT_COMPATIBILITY_WARNING.
2772 *
2773 * Release all objects.
2774 *
2775 * Incomplete layer targets case
2776 *
2777 * Prepare framebuffer with one 3D texture and one 2D texture.
2778 *
2779 * Check the framebuffer status using CheckNamedFramebufferStatus.
2780 * Expect FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS return value. If the
2781 * check fails return TEST_RESULT_COMPATIBILITY_WARNING.
2782 *
2783 * Release all objects.
2784 *
2785 * Note
2786 *
2787 * The specification is not clear about framebuffer completeness. The
2788 * OpenGL 4.5 Core Profile Specification in chapter 9.4.2 says:
2789 *
2790 * "The framebuffer object bound to target is said to be framebuffer
2791 * complete if all the following conditions are true [...]"
2792 *
2793 * It does not say that framebuffer is incomplete when any of the
2794 * conditions are not met. Due to this wording, except for obvious cases
2795 * (incomplete attachment and missing attachments) other tests are optional
2796 * and may result in QP_TEST_RESULT_COMPATIBILITY_WARNING when fail.
2797 */
2798 class CheckStatusTest : public deqp::TestCase
2799 {
2800 public:
2801 /* Public member functions */
2802 CheckStatusTest(deqp::Context& context);
2803
2804 virtual tcu::TestNode::IterateResult iterate();
2805
2806 private:
2807 /* Private member functions */
2808 CheckStatusTest(const CheckStatusTest& other);
2809 CheckStatusTest& operator=(const CheckStatusTest& other);
2810
2811 bool IncompleteAttachmentTestCase();
2812 bool MissingAttachmentTestCase();
2813 bool IncompleteMultisampleRenderbufferTestCase();
2814 bool IncompleteMultisampleTextureTestCase();
2815 bool IncompleteLayerTargetsTestCase();
2816 };
2817 /* CheckStatusTest class */
2818
2819 /** Get Named Framebuffer Parameters
2820 *
2821 * Prepare framebuffer with read and write buffers and renderbuffer color
2822 * attachment.
2823 *
2824 * Do following checks for the created framebuffer:
2825 *
2826 * Check that GetNamedFramebufferParameteriv called with parameter name
2827 * FRAMEBUFFER_DEFAULT_WIDTH returns the value of
2828 * FRAMEBUFFER_DEFAULT_WIDTH for the framebuffer object.
2829 *
2830 * Check that GetNamedFramebufferParameteriv called with parameter name
2831 * FRAMEBUFFER_DEFAULT_HEIGHT returns the value of
2832 * FRAMEBUFFER_DEFAULT_HEIGHT for the framebuffer object.
2833 *
2834 * Check that GetNamedFramebufferParameteriv called with parameter name
2835 * FRAMEBUFFER_DEFAULT_LAYERS returns the value of
2836 * FRAMEBUFFER_DEFAULT_LAYERS for the framebuffer object.
2837 * Check that GetNamedFramebufferParameteriv called with parameter name
2838 * FRAMEBUFFER_DEFAULT_SAMPLES returns the value of
2839 * FRAMEBUFFER_DEFAULT_SAMPLES for the framebuffer object.
2840 * Check that GetNamedFramebufferParameteriv called with parameter name
2841 * FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS returns the boolean value
2842 * of FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS.
2843 *
2844 * Do following checks for the created and default (if available)
2845 * framebuffer:
2846 *
2847 * Check that GetNamedFramebufferParameteriv called with parameter name
2848 * DOUBLEBUFFER returns a boolean value indicating whether double
2849 * buffering is supported for the framebuffer object.
2850 *
2851 * Check that GetNamedFramebufferParameteriv called with parameter name
2852 * IMPLEMENTATION_COLOR_READ_FORMAT returns a GLenum value indicating
2853 * the preferred pixel data format for the framebuffer object.
2854 *
2855 * Check that GetNamedFramebufferParameteriv called with parameter name
2856 * IMPLEMENTATION_COLOR_READ_TYPE returns a GLenum value indicating the
2857 * implementation's preferred pixel data type for the framebuffer
2858 * object.
2859 *
2860 * Check that GetNamedFramebufferParameteriv called with parameter name
2861 * SAMPLES returns an integer value indicating the coverage mask size
2862 * for the framebuffer object.
2863 *
2864 * Check that GetNamedFramebufferParameteriv called with parameter name
2865 * SAMPLE_BUFFERS returns an integer value indicating the number of
2866 * sample buffers associated with the framebuffer object.
2867 *
2868 * Check that GetNamedFramebufferParameteriv called with parameter name
2869 * STEREO returns a boolean value indicating whether stereo buffers
2870 * (left and right) are supported for the framebuffer object.
2871 *
2872 * Release all objects.
2873 */
2874 class GetParametersTest : public deqp::TestCase
2875 {
2876 public:
2877 /* Public member functions */
2878 GetParametersTest(deqp::Context& context);
2879
2880 virtual tcu::TestNode::IterateResult iterate();
2881
2882 private:
2883 /* Private member functions */
2884 GetParametersTest(const GetParametersTest& other);
2885 GetParametersTest& operator=(const GetParametersTest& other);
2886
2887 void PrepareFramebuffer();
2888 bool TestDefaultFramebuffer();
2889 bool TestCustomFramebuffer();
2890 void Clean();
2891
2892 /* Private member variables. */
2893 glw::GLuint m_fbo;
2894 glw::GLuint m_rbo;
2895 };
2896 /* GetParametersTest class */
2897
2898 /** Get Named Framebuffer Attachment Parameters
2899 *
2900 * For default framebuffer, for all attachments:
2901 * FRONT_LEFT,
2902 * FRONT_RIGHT,
2903 * BACK_LEFT,
2904 * BACK_RIGHT,
2905 * DEPTH,
2906 * STENCIL
2907 * query FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE using
2908 * GetNamedFramebufferAttachmentParameteriv function. Expect
2909 * FRAMEBUFFER_DEFAULT return value (as queried with non-DSA way).
2910 *
2911 * For any attachments not equal to GL_NONE do following queries using
2912 * GetNamedFramebufferAttachmentParameteriv function:
2913 * FRAMEBUFFER_ATTACHMENT_RED_SIZE,
2914 * FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
2915 * FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
2916 * FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
2917 * FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
2918 * FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
2919 * FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE,
2920 * FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING.
2921 * Expect value equal to framebuffers setup (as queried with non-DSA way).
2922 * Expect no error.
2923 *
2924 * Create 3 framebuffer objects with renderbuffer color attachment, and
2925 * depth or stencil or depth-stencil attachments.
2926 *
2927 * For each of framebuffers, for each of following attachments:
2928 * DEPTH_ATTACHMENT,
2929 * STENCIL_ATTACHMENT,
2930 * DEPTH_STENCIL_ATTACHMENT,
2931 * COLOR_ATTACHMENT0,
2932 * COLOR_ATTACHMENT1
2933 * query FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE using
2934 * GetNamedFramebufferAttachmentParameteriv function. Expect the same
2935 * return value as queried with non-DSA way.
2936 *
2937 * For each of framebuffers, for any attachments not equal to GL_NONE do
2938 * following queries using GetNamedFramebufferAttachmentParameteriv
2939 * function:
2940 * FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
2941 * FRAMEBUFFER_ATTACHMENT_RED_SIZE,
2942 * FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
2943 * FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
2944 * FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
2945 * FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
2946 * FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
2947 * FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE,
2948 * FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
2949 * Expect value equal to framebuffers setup (as queried with non-DSA way).
2950 * Expect no error.
2951 *
2952 * Release objects.
2953 *
2954 * Create 3 framebuffer objects with texture color attachment, and
2955 * depth or stencil or depth-stencil attachments.
2956 *
2957 * For each of framebuffers, for each of following attachments:
2958 * DEPTH_ATTACHMENT,
2959 * STENCIL_ATTACHMENT,
2960 * DEPTH_STENCIL_ATTACHMENT,
2961 * COLOR_ATTACHMENT0,
2962 * COLOR_ATTACHMENT1
2963 * query FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE using
2964 * GetNamedFramebufferAttachmentParameteriv function. Expect the same
2965 * return value as queried with non-DSA way.
2966 *
2967 * For each of framebuffers, for any attachments not equal to GL_NONE do
2968 * following queries using GetNamedFramebufferAttachmentParameteriv
2969 * function:
2970 * FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
2971 * FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL,
2972 * FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE,
2973 * FRAMEBUFFER_ATTACHMENT_LAYERED,
2974 * FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER,
2975 * FRAMEBUFFER_ATTACHMENT_RED_SIZE,
2976 * FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
2977 * FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
2978 * FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
2979 * FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
2980 * FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
2981 * FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE,
2982 * FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
2983 * Expect value equal to framebuffers setup (as queried with non-DSA way).
2984 * Expect no error.
2985 *
2986 * Release objects.
2987 *
2988 * Additional conditions:
2989 *
2990 * Do not query DEPTH_STENCIL_ATTACHMENT attachment if the renderbuffer
2991 * or texture is not depth-stencil.
2992 *
2993 * Do not query FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE pname with
2994 * DEPTH_STENCIL_ATTACHMENT attachment.
2995 */
2996 class GetAttachmentParametersTest : public deqp::TestCase
2997 {
2998 public:
2999 /* Public member functions */
3000 GetAttachmentParametersTest(deqp::Context& context);
3001
3002 virtual tcu::TestNode::IterateResult iterate();
3003
3004 private:
3005 /* Private member functions */
3006 GetAttachmentParametersTest(const GetAttachmentParametersTest& other);
3007 GetAttachmentParametersTest& operator=(const GetAttachmentParametersTest& other);
3008
3009 void CreateRenderbufferFramebuffer(bool depth, bool stencil);
3010 void CreateTextureFramebuffer(bool depth, bool stencil);
3011 bool TestDefaultFramebuffer();
3012 bool TestRenderbufferFramebuffer(bool depth_stencil);
3013 bool TestTextureFramebuffer(bool depth_stencil);
3014 void Clean();
3015
3016 /* Private member variables. */
3017 glw::GLuint m_fbo;
3018 glw::GLuint m_rbo[2];
3019 glw::GLuint m_to[2];
3020 };
3021 /* GetParametersTest class */
3022
3023 /** Create Named Framebuffers Errors
3024 *
3025 * Check that INVALID_VALUE is generated by CreateFramebuffers if n is
3026 * negative.
3027 */
3028 class CreationErrorsTest : public deqp::TestCase
3029 {
3030 public:
3031 /* Public member functions */
3032 CreationErrorsTest(deqp::Context& context);
3033
3034 virtual tcu::TestNode::IterateResult iterate();
3035
3036 private:
3037 /* Private member functions */
3038 CreationErrorsTest(const CreationErrorsTest& other);
3039 CreationErrorsTest& operator=(const CreationErrorsTest& other);
3040 };
3041 /* CreationErrorsTest class */
3042
3043 /** Named Framebuffer Renderbuffer Errors
3044 *
3045 * Check that INVALID_OPERATION is generated by
3046 * NamedFramebufferRenderbuffer if framebuffer is not the name of an
3047 * existing framebuffer object.
3048 *
3049 * Check that INVALID_OPERATION is generated by NamedFramebufferRenderbuffer
3050 * if attachment is COLOR_ATTACHMENTm where m is greater than or equal to
3051 * the value of MAX_COLOR_ATTACHMENTS.
3052 *
3053 * Check that INVALID_ENUM is generated by NamedFramebufferRenderbuffer if
3054 * attachment is not one of the attachments in table 9.2, and attachment is
3055 * not COLOR_ATTACHMENTm where m is greater than or equal to the value of
3056 * MAX_COLOR_ATTACHMENTS.
3057 *
3058 * Check that INVALID_ENUM is generated by NamedFramebufferRenderbuffer if
3059 * renderbuffer target is not RENDERBUFFER.
3060 *
3061 * Check that INVALID_OPERATION is generated by
3062 * NamedFramebufferRenderbuffer if renderbuffer target is not zero or the
3063 * name of an existing renderbuffer object of type RENDERBUFFER.
3064 */
3065 class RenderbufferAttachmentErrorsTest : public deqp::TestCase
3066 {
3067 public:
3068 /* Public member functions */
3069 RenderbufferAttachmentErrorsTest(deqp::Context& context);
3070
3071 virtual tcu::TestNode::IterateResult iterate();
3072
3073 private:
3074 /* Private member functions */
3075 RenderbufferAttachmentErrorsTest(const RenderbufferAttachmentErrorsTest& other);
3076 RenderbufferAttachmentErrorsTest& operator=(const RenderbufferAttachmentErrorsTest& other);
3077
3078 void PrepareObjects();
3079 bool ExpectError(glw::GLenum expected_error, bool framebuffer, bool attachment, bool color_attachment,
3080 bool renderbuffertarget, bool renderbuffer);
3081 void Clean();
3082
3083 /* Private member variables. */
3084 glw::GLuint m_fbo_valid;
3085 glw::GLuint m_rbo_valid;
3086 glw::GLuint m_fbo_invalid;
3087 glw::GLuint m_rbo_invalid;
3088 glw::GLenum m_color_attachment_invalid;
3089 glw::GLenum m_attachment_invalid;
3090 glw::GLenum m_renderbuffer_target_invalid;
3091 };
3092 /* RenderbufferAttachmentErrorsTest class */
3093
3094 /** Named Framebuffer Texture Errors
3095 *
3096 * Check that GL_INVALID_OPERATION is generated by glNamedFramebufferTexture and glNamedFramebufferTextureLayer
3097 * if framebuffer is not the name of an existing framebuffer object.
3098 *
3099 * Check that INVALID_OPERATION is generated by glNamedFramebufferTexture and glNamedFramebufferTextureLayer
3100 * if attachment is COLOR_ATTACHMENTm where m is greater than or equal to
3101 * the value of MAX_COLOR_ATTACHMENTS.
3102 *
3103 * Check that INVALID_ENUM is generated by glNamedFramebufferTexture and glNamedFramebufferTextureLayer if
3104 * attachment is not one of the attachments in table 9.2, and attachment is
3105 * not COLOR_ATTACHMENTm where m is greater than or equal to the value of
3106 * MAX_COLOR_ATTACHMENTS.
3107 *
3108 * Check that INVALID_VALUE is generated by glNamedFramebufferTexture if texture is not zero or the name
3109 * of an existing texture object.
3110 *
3111 * Check that INVALID_OPERATION is generated by glNamedFramebufferTextureLayer if texture is not zero or
3112 * the name of an existing texture object.
3113 *
3114 * Check that INVALID_VALUE is generated by glNamedFramebufferTexture and glNamedFramebufferTextureLayer if
3115 * texture is not zero and level is not a supported texture level for
3116 * texture.
3117 *
3118 * Check that INVALID_OPERATION is generated by glNamedFramebufferTexture and glNamedFramebufferTextureLayer
3119 * if texture is a buffer texture.
3120 *
3121 * Check that INVALID_VALUE error is generated by NamedFramebufferTextureLayer if texture is a three-dimensional
3122 * texture, and layer is larger than the value of MAX_3D_TEXTURE_SIZE minus one.
3123 *
3124 * Check that INVALID_VALUE error is generated by NamedFramebufferTextureLayer if texture is an array texture,
3125 * and layer is larger than the value of MAX_ARRAY_TEXTURE_LAYERS minus one.
3126 *
3127 * Check that INVALID_VALUE error is generated by NamedFramebufferTextureLayer if texture is a cube map array texture,
3128 * and (layer / 6) is larger than the value of MAX_CUBE_MAP_TEXTURE_SIZE minus one (see section 9.8).
3129 * Check that INVALID_VALUE error is generated by NamedFramebufferTextureLayer if texture is non-zero
3130 * and layer is negative.
3131 *
3132 * Check that INVALID_OPERATION error is generated by NamedFramebufferTextureLayer if texture is non-zero
3133 * and is not the name of a three-dimensional, two-dimensional multisample array, one- or two-dimensional array,
3134 * or cube map array texture.
3135 */
3136 class TextureAttachmentErrorsTest : public deqp::TestCase
3137 {
3138 public:
3139 /* Public member functions */
3140 TextureAttachmentErrorsTest(deqp::Context& context);
3141
3142 virtual tcu::TestNode::IterateResult iterate();
3143
3144 private:
3145 /* Private member functions */
3146 TextureAttachmentErrorsTest(const TextureAttachmentErrorsTest& other);
3147 TextureAttachmentErrorsTest& operator=(const TextureAttachmentErrorsTest& other);
3148
3149 void PrepareObjects();
3150 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function_name, bool framebuffer, bool attachment,
3151 bool color_attachment, bool texture, bool level, const glw::GLchar* texture_type, bool layer);
3152 void Clean();
3153
3154 /* Private member variables. */
3155 glw::GLuint m_fbo_valid;
3156 glw::GLuint m_to_valid;
3157 glw::GLuint m_to_3d_valid;
3158 glw::GLuint m_to_array_valid;
3159 glw::GLuint m_to_cubearray_valid;
3160 glw::GLuint m_tbo_valid;
3161 glw::GLuint m_fbo_invalid;
3162 glw::GLuint m_to_invalid;
3163 glw::GLuint m_to_layer_invalid; /* it is valid rectangle texture, but invalid for NamedFramebufferTextureLayer */
3164 glw::GLenum m_color_attachment_invalid;
3165 glw::GLenum m_attachment_invalid;
3166 glw::GLint m_level_invalid;
3167 glw::GLint m_max_3d_texture_size;
3168 glw::GLint m_max_3d_texture_depth;
3169 glw::GLint m_max_array_texture_layers;
3170 glw::GLint m_max_cube_map_texture_size;
3171 };
3172 /* TextureAttachmentErrorsTest class */
3173
3174 /** Named Framebuffer Draw Read Buffers Errors
3175 *
3176 * Check that INVALID_OPERATION error is generated by
3177 * NamedFramebufferDrawBuffer if framebuffer is not zero or the name of an
3178 * existing framebuffer object.
3179 *
3180 * Check that INVALID_ENUM is generated by NamedFramebufferDrawBuffer if
3181 * buf is not an accepted value.
3182 *
3183 * Check that INVALID_OPERATION is generated by NamedFramebufferDrawBuffer
3184 * if the GL is bound to a draw framebuffer object and the ith argument is
3185 * a value other than COLOR_ATTACHMENTi or NONE.
3186 *
3187 * Check that INVALID_OPERATION error is generated by
3188 * NamedFramebufferDrawBuffers if framebuffer is not zero or the name of an
3189 * existing framebuffer object.
3190 *
3191 * Check that INVALID_VALUE is generated by NamedFramebufferDrawBuffers if
3192 * n is less than 0.
3193 *
3194 * Check that INVALID_VALUE is generated by NamedFramebufferDrawBuffers if
3195 * n is greater than MAX_DRAW_BUFFERS.
3196 *
3197 * Check that INVALID_ENUM is generated by NamedFramebufferDrawBuffers if
3198 * one of the values in bufs is not an accepted value.
3199 *
3200 * Check that INVALID_OPERATION is generated by NamedFramebufferDrawBuffers
3201 * if a symbolic constant other than GL_NONE appears more than once in
3202 * bufs.
3203 *
3204 * Check that INVALID_ENUM error is generated by
3205 * NamedFramebufferDrawBuffers if any value in bufs is FRONT, LEFT, RIGHT,
3206 * or FRONT_AND_BACK. This restriction applies to both the default
3207 * framebuffer and framebuffer objects, and exists because these constants
3208 * may themselves refer to multiple buffers, as shown in table 17.4.
3209 *
3210 * Check that INVALID_OPERATION is generated by NamedFramebufferDrawBuffers
3211 * if any value in bufs is BACK, and n is not one.
3212 *
3213 * Check that INVALID_OPERATION is generated by NamedFramebufferDrawBuffers
3214 * if the API call refers to a framebuffer object and one or more of the
3215 * values in bufs is anything other than NONE or one of the
3216 * COLOR_ATTACHMENTn tokens.
3217 *
3218 * Check that INVALID_OPERATION is generated by NamedFramebufferDrawBuffers
3219 * if the API call refers to the default framebuffer and one or more of the
3220 * values in bufs is one of the COLOR_ATTACHMENTn tokens.
3221 *
3222 * Check that INVALID_OPERATION is generated by NamedFramebufferReadBuffer
3223 * if framebuffer is not zero or the name of an existing framebuffer
3224 * object.
3225 *
3226 * Check that INVALID_ENUM is generated by NamedFramebufferReadBuffer if
3227 * src is not one of the accepted values (tables 17.4 and 17.5 of OpenGL
3228 * 4.5 Core Profile Specification).
3229 *
3230 * Check that INVALID_OPERATION is generated by NamedFramebufferReadBuffer
3231 * if the default framebuffer is affected and src is a value (other than
3232 * NONE) that does not indicate any of the color buffers allocated to the
3233 * default framebuffer.
3234 *
3235 * Check that INVALID_OPERATION is generated by NamedFramebufferReadBuffer
3236 * if a framebuffer object is affected, and src is one of the constants
3237 * from table 17.4 (other than NONE, or COLOR_ATTACHMENTm where m is
3238 * greater than or equal to the value of MAX_COLOR_ATTACHMENTS).
3239 */
3240 class DrawReadBuffersErrorsTest : public deqp::TestCase
3241 {
3242 public:
3243 /* Public member functions */
3244 DrawReadBuffersErrorsTest(deqp::Context& context);
3245
3246 virtual tcu::TestNode::IterateResult iterate();
3247
3248 private:
3249 /* Private member functions */
3250 DrawReadBuffersErrorsTest(const DrawReadBuffersErrorsTest& other);
3251 DrawReadBuffersErrorsTest operator=(const DrawReadBuffersErrorsTest& other);
3252
3253 void PrepareObjects();
3254 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3255 void Clean();
3256
3257 /* Private member variables. */
3258 glw::GLuint m_fbo_valid;
3259 glw::GLuint m_fbo_invalid;
3260 glw::GLenum m_attachment_color;
3261 glw::GLenum m_attachment_back_left;
3262 glw::GLenum m_attachment_right;
3263 glw::GLenum m_attachment_left;
3264 glw::GLenum m_attachment_front;
3265 glw::GLenum m_attachment_front_and_back;
3266 glw::GLenum m_attachment_back;
3267 glw::GLenum m_attachment_invalid;
3268 glw::GLenum m_attachments_invalid[2];
3269 glw::GLenum m_attachments_back_invalid[2];
3270 glw::GLint m_attachments_too_many_count;
3271 glw::GLenum* m_attachments_too_many;
3272 glw::GLint m_max_color_attachments;
3273 };
3274 /* DrawReadBuffersErrorsTest class */
3275
3276 /** Invalidate Framebuffer Data and SubData Errors
3277
3278 Check that INVALID_OPERATION error is generated by
3279 InvalidateNamedFramebufferData if framebuffer is not zero or the name of
3280 an existing framebuffer object.
3281
3282 Check that INVALID_ENUM error is generated by
3283 InvalidateNamedFramebufferData if a framebuffer object is affected, and
3284 any element of of attachments is not one of the values
3285 {COLOR_ATTACHMENTi, DEPTH_ATTACHMENT, STENCIL_ATTACHMENT,
3286 DEPTH_STENCIL_ATTACHMENT}.
3287
3288 Check that INVALID_OPERATION error is generated by
3289 InvalidateNamedFramebufferData if attachments contains COLOR_ATTACHMENTm
3290 where m is greater than or equal to the value of MAX_COLOR_ATTACHMENTS.
3291
3292 Check that INVALID_ENUM error is generated by
3293 InvalidateNamedFramebufferData if the default framebuffer is affected,
3294 and any elements of attachments are not one of:
3295 - FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, and BACK_RIGHT, identifying that
3296 specific buffer,
3297 - COLOR, which is treated as BACK_LEFT for a double-buffered context
3298 and FRONT_LEFT for a single-buffered context,
3299 - DEPTH, identifying the depth buffer,
3300 - STENCIL, identifying the stencil buffer.
3301
3302 Check that INVALID_OPERATION error is generated by
3303 InvalidateNamedSubFramebuffer if framebuffer is not zero or the name of
3304 an existing framebuffer object.
3305
3306 Check that INVALID_VALUE error is generated by
3307 InvalidateNamedSubFramebuffer if numAttachments, width, or height is
3308 negative.
3309
3310 Check that INVALID_ENUM error is generated by
3311 InvalidateNamedSubFramebuffer if a framebuffer object is affected, and
3312 any element of attachments is not one of the values {COLOR_ATTACHMENTi,
3313 DEPTH_ATTACHMENT, STENCIL_ATTACHMENT, DEPTH_STENCIL_ATTACHMENT}.
3314
3315 Check that INVALID_OPERATION error is generated by
3316 InvalidateNamedSubFramebuffer if attachments contains COLOR_ATTACHMENTm
3317 where m is greater than or equal to the value of MAX_COLOR_ATTACHMENTS.
3318
3319 Check that INVALID_ENUM error is generated by
3320 InvalidateNamedSubFramebuffer if the default framebuffer is affected,
3321 and any elements of attachments are not one of:
3322 - FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, and BACK_RIGHT, identifying that
3323 specific buffer,
3324 - COLOR, which is treated as BACK_LEFT for a double-buffered context
3325 and FRONT_LEFT for a single-buffered context,
3326 - DEPTH, identifying the depth buffer,
3327 - STENCIL, identifying the stencil buffer.
3328 */
3329 class InvalidateDataAndSubDataErrorsTest : public deqp::TestCase
3330 {
3331 public:
3332 /* Public member functions */
3333 InvalidateDataAndSubDataErrorsTest(deqp::Context& context);
3334
3335 virtual tcu::TestNode::IterateResult iterate();
3336
3337 private:
3338 /* Private member functions */
3339 InvalidateDataAndSubDataErrorsTest(const InvalidateDataAndSubDataErrorsTest& other);
3340 InvalidateDataAndSubDataErrorsTest operator=(const InvalidateDataAndSubDataErrorsTest& other);
3341
3342 void PrepareObjects();
3343 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3344 void Clean();
3345
3346 /* Private member variables. */
3347 glw::GLuint m_fbo_valid;
3348 glw::GLuint m_rbo;
3349 glw::GLuint m_fbo_invalid;
3350 glw::GLenum m_fbo_attachment_valid;
3351 glw::GLenum m_fbo_attachment_invalid;
3352 glw::GLenum m_color_attachment_invalid;
3353 glw::GLenum m_default_attachment_invalid;
3354 };
3355 /* InvalidateDataAndSubDataErrorsTest class */
3356
3357 /** Clear Named Framebuffer Errors
3358 *
3359 * Check that INVALID_OPERATION is generated by ClearNamedFramebuffer* if
3360 * framebuffer is not zero or the name of an existing framebuffer object.
3361 *
3362 * Check that INVALID_ENUM is generated by ClearNamedFramebufferiv buffer
3363 * is not COLOR or STENCIL.
3364 *
3365 * Check that INVALID_ENUM is generated by ClearNamedFramebufferuiv buffer
3366 * is not COLOR.
3367 *
3368 * Check that INVALID_ENUM is generated by ClearNamedFramebufferfv buffer
3369 * is not COLOR or DEPTH.
3370 *
3371 * Check that INVALID_ENUM is generated by ClearNamedFramebufferfi buffer
3372 * is not DEPTH_STENCIL.
3373 *
3374 * Check that INVALID_VALUE is generated if buffer is COLOR drawbuffer is
3375 * negative, or greater than the value of MAX_DRAW_BUFFERS minus one.
3376 *
3377 * Check that INVALID_VALUE is generated if buffer is DEPTH, STENCIL or
3378 * DEPTH_STENCIL and drawbuffer is not zero.
3379 */
3380 class ClearNamedFramebufferErrorsTest : public deqp::TestCase
3381 {
3382 public:
3383 /* Public member functions */
3384 ClearNamedFramebufferErrorsTest(deqp::Context& context);
3385
3386 virtual tcu::TestNode::IterateResult iterate();
3387
3388 private:
3389 /* Private member functions */
3390 ClearNamedFramebufferErrorsTest(const ClearNamedFramebufferErrorsTest& other);
3391 ClearNamedFramebufferErrorsTest& operator=(const ClearNamedFramebufferErrorsTest& other);
3392
3393 void PrepareObjects();
3394 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3395 void Clean();
3396
3397 /* Private member variables. */
3398 glw::GLuint m_fbo_valid;
3399 glw::GLuint m_rbo_color;
3400 glw::GLuint m_rbo_depth_stencil;
3401 glw::GLuint m_fbo_invalid;
3402 };
3403 /* ClearNamedFramebufferErrorsTest class */
3404
3405 /** Check Named Framebuffer Status Errors
3406 *
3407 * Check that INVALID_ENUM is generated by CheckNamedFramebufferStatus if
3408 * target is not DRAW_FRAMEBUFFER, READ_FRAMEBUFFER or FRAMEBUFFER.
3409 *
3410 * Check that INVALID_OPERATION is generated by CheckNamedFramebufferStatus
3411 * if framebuffer is not zero or the name of an existing framebuffer
3412 * object.
3413 */
3414 class CheckStatusErrorsTest : public deqp::TestCase
3415 {
3416 public:
3417 /* Public member functions */
3418 CheckStatusErrorsTest(deqp::Context& context);
3419
3420 virtual tcu::TestNode::IterateResult iterate();
3421
3422 private:
3423 /* Private member functions */
3424 CheckStatusErrorsTest(const CheckStatusErrorsTest& other);
3425 CheckStatusErrorsTest& operator=(const CheckStatusErrorsTest& other);
3426
3427 void PrepareObjects();
3428 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3429 void Clean();
3430
3431 /* Private member variables. */
3432 glw::GLuint m_fbo_valid;
3433 glw::GLuint m_fbo_invalid;
3434 glw::GLuint m_target_invalid;
3435 };
3436 /* CheckStatusErrorsTest class */
3437
3438 /** Get Named Framebuffer Parameter Errors
3439 *
3440 * Check that INVALID_OPERATION is generated by
3441 * GetNamedFramebufferParameteriv if framebuffer is not zero or the name of
3442 * an existing framebuffer object.
3443 *
3444 * Check that INVALID_ENUM is generated by GetNamedFramebufferParameteriv
3445 * if pname is not one of the accepted parameter names.
3446 *
3447 * Check that INVALID_OPERATION is generated if a default framebuffer is
3448 * queried, and pname is not one of DOUBLEBUFFER,
3449 * IMPLEMENTATION_COLOR_READ_FORMAT, IMPLEMENTATION_COLOR_READ_TYPE,
3450 * SAMPLES, SAMPLE_BUFFERS or STEREO.
3451 */
3452 class GetParameterErrorsTest : public deqp::TestCase
3453 {
3454 public:
3455 /* Public member functions */
3456 GetParameterErrorsTest(deqp::Context& context);
3457
3458 virtual tcu::TestNode::IterateResult iterate();
3459
3460 private:
3461 /* Private member functions */
3462 GetParameterErrorsTest(const GetParameterErrorsTest& other);
3463 GetParameterErrorsTest& operator=(const GetParameterErrorsTest& other);
3464
3465 void PrepareObjects();
3466 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3467 void Clean();
3468
3469 /* Private member variables. */
3470 glw::GLuint m_fbo_valid;
3471 glw::GLuint m_fbo_invalid;
3472 glw::GLuint m_parameter_invalid;
3473 };
3474 /* GetParameterErrorsTest class */
3475
3476 /** Get Named Framebuffer Attachment Parameter Errors
3477 *
3478 * Check that GL_INVALID_OPERATION is generated by
3479 * GetNamedFramebufferAttachmentParameteriv if framebuffer is not zero or
3480 * the name of an existing framebuffer object.
3481 *
3482 * Check that INVALID_ENUM is generated by
3483 * GetNamedFramebufferAttachmentParameteriv if pname is not valid for the
3484 * value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, as described above.
3485 *
3486 * Check that INVALID_ENUM error is generated if a framebuffer object is queried, attachment
3487 * is not one of the attachments in table 9.2 (COLOR_ATTACHMENTi, DEPTH_ATTACHMENT, STENCIL_ATTACHMENT, DEPTH_STENCIL_ATTACHMENT), and attachment is not
3488 * COLOR_ATTACHMENTm where m is greater than or equal to the value of MAX_COLOR_ATTACHMENTS.
3489 *
3490 * Check that INVALID_OPERATION is generated by
3491 * GetNamedFramebufferAttachmentParameteriv if the value of
3492 * FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is GL_NONE and pname is not
3493 * FRAMEBUFFER_ATTACHMENT_OBJECT_NAME or
3494 * FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE.
3495 *
3496 * Check that INVALID_OPERATION is generated by
3497 * GetNamedFramebufferAttachmentParameteriv if attachment is
3498 * DEPTH_STENCIL_ATTACHMENT and pname is
3499 * FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE.
3500 *
3501 * Check that an INVALID_ENUM error is generated if the default framebuffer is
3502 * queried and attachment is not one the values specified in table 9.1.
3503 *
3504 * Check that an INVALID_OPERATION error is generated if a framebuffer object is
3505 * bound to target and attachment is COLOR_ATTACHMENTm where m is greater than or
3506 * equal to the value of MAX_COLOR_ATTACHMENTS.
3507 *
3508 * Check that an INVALID_ENUM error is generated if a framebuffer object is
3509 * queried, attachment is not one of the attachments in table 9.2, and attachment
3510 * is not COLOR_ATTACHMENTm where m is greater than or equal to the value of
3511 * MAX_COLOR_ATTACHMENTS.
3512 */
3513 class GetAttachmentParameterErrorsTest : public deqp::TestCase
3514 {
3515 public:
3516 /* Public member functions */
3517 GetAttachmentParameterErrorsTest(deqp::Context& context);
3518
3519 virtual tcu::TestNode::IterateResult iterate();
3520
3521 private:
3522 /* Private member functions */
3523 GetAttachmentParameterErrorsTest(const GetAttachmentParameterErrorsTest& other);
3524 GetAttachmentParameterErrorsTest& operator=(const GetAttachmentParameterErrorsTest& other);
3525
3526 void PrepareObjects();
3527 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3528 void Clean();
3529
3530 /* Private member variables. */
3531 glw::GLuint m_fbo_valid;
3532 glw::GLuint m_rbo_color;
3533 glw::GLuint m_rbo_depth_stencil;
3534 glw::GLuint m_fbo_invalid;
3535 glw::GLuint m_parameter_invalid;
3536 glw::GLenum m_attachment_invalid;
3537 glw::GLenum m_default_attachment_invalid;
3538 glw::GLint m_max_color_attachments;
3539 };
3540 /* GetAttachmentParameterErrorsTest class */
3541
3542 /** Framebuffer and Renderbuffer Functional
3543 *
3544 * Create two framebuffer objects using CreateFramebuffers.
3545 *
3546 * Setup first framebuffer with renderbuffer color, depth and stencil
3547 * attachments. Setup storage size with width and height equal to 8. Set
3548 * them as draw and read buffers. Clean up it, use black color. Check the
3549 * framebuffer status.
3550 *
3551 * Setup second framebuffer with texture color attachment. Setup storage
3552 * size with width equal to 4 and height equal to 3. Check the framebuffer
3553 * status.
3554 *
3555 * Prepare GLSL program which can draw triangles using orthographic
3556 * projection. Fragment shader
3557 *
3558 * Clean both framebuffers using ClearNamedFramebuffer* functions.
3559 *
3560 * Use first framebuffer.
3561 *
3562 * Draw to stencil a quad with screen positions [-0.5, -0.5], [-0.5, 0.5],
3563 * [0.5, -0.5] and [0.5, 0.5].
3564 *
3565 * Draw to depth buffer a quad with positions [-1, -1, -1], [-1, 1, -1],
3566 * [1, -1, 0] and [1, 1, 0].
3567 *
3568 * Turn on depth and stencil tests. Depth test shall pass if incoming depth
3569 * value is LESS than stored. The Stencil test shall pass only for any
3570 * stencil pass.
3571 *
3572 * Draw Full screen quad to draw buffer with z = 0.5.
3573 *
3574 * Blit the color content of the first framebuffer to the second with
3575 * nearest filter.
3576 *
3577 * Fetch data. Expect that second framebuffer contain following data
3578 * black, black, black, black,
3579 * black, black, white, black,
3580 * black, black, black, black.
3581 */
3582 class FunctionalTest : public deqp::TestCase
3583 {
3584 public:
3585 /* Public member functions */
3586 FunctionalTest(deqp::Context& context);
3587
3588 virtual tcu::TestNode::IterateResult iterate();
3589
3590 private:
3591 /* Private member functions */
3592 FunctionalTest(const FunctionalTest& other);
3593 FunctionalTest& operator=(const FunctionalTest& other);
3594
3595 bool PrepareFirstFramebuffer();
3596 bool PrepareSecondFramebuffer();
3597 bool ClearFramebuffers();
3598 void PrepareProgram();
3599 void PrepareBuffersAndVertexArrays();
3600 bool DrawAndBlit();
3601 bool CheckSecondFramebufferContent();
3602 void Clean();
3603
3604 /* Private member variables. */
3605 glw::GLuint m_fbo_1st;
3606 glw::GLuint m_fbo_2nd;
3607 glw::GLuint m_rbo_color;
3608 glw::GLuint m_rbo_depth_stencil;
3609 glw::GLuint m_to_color;
3610 glw::GLuint m_po;
3611 glw::GLuint m_vao_stencil_pass_quad;
3612 glw::GLuint m_vao_depth_pass_quad;
3613 glw::GLuint m_vao_color_pass_quad;
3614 glw::GLuint m_bo_stencil_pass_quad;
3615 glw::GLuint m_bo_depth_pass_quad;
3616 glw::GLuint m_bo_color_pass_quad;
3617
3618 /* Private static variables. */
3619 static const glw::GLchar s_vertex_shader[];
3620 static const glw::GLchar s_fragment_shader[];
3621 static const glw::GLchar s_attribute[];
3622 static const glw::GLfloat s_stencil_pass_quad[];
3623 static const glw::GLfloat s_depth_pass_quad[];
3624 static const glw::GLfloat s_color_pass_quad[];
3625 static const glw::GLuint s_stencil_pass_quad_size;
3626 static const glw::GLuint s_depth_pass_quad_size;
3627 static const glw::GLuint s_color_pass_quad_size;
3628 };
3629 /* FunctionalTest class */
3630 } /* Framebuffers namespace */
3631
3632 namespace Renderbuffers
3633 {
3634 /** Renderbuffer Creation
3635 *
3636 * Create at least two renderbuffer objects using GenRenderbuffers
3637 * function. Check them without binding, using IsRenderbuffer function.
3638 * Expect FALSE.
3639 *
3640 * Create at least two renderbuffer objects using CreateRenderbuffers
3641 * function. Check them without binding, using IsRenderbuffer function.
3642 * Expect TRUE.
3643 *
3644 * Release objects.
3645 */
3646 class CreationTest : public deqp::TestCase
3647 {
3648 public:
3649 /* Public member functions */
3650 CreationTest(deqp::Context& context);
3651
3652 virtual tcu::TestNode::IterateResult iterate();
3653
3654 private:
3655 /* Private member functions */
3656 CreationTest(const CreationTest& other);
3657 CreationTest& operator=(const CreationTest& other);
3658 };
3659 /* CreationTest class */
3660
3661 /** Named Renderbuffer Storage
3662 *
3663 * Create renderbuffer object. Prepare its storage using
3664 * NamedRenderbufferStorage function.
3665 *
3666 * Create framebuffer object. Attach renderbuffer to proper attachment
3667 * point.
3668 *
3669 * Clear framebuffer's renderbuffer attachment with reference value. Fetch
3670 * the data from framebuffer's attachment using ReadPixels. Compare the
3671 * fetched values with the reference.
3672 *
3673 * Release all objects.
3674 *
3675 * Repeat the test for following internal formats:
3676 *
3677 * R8, R16, RG8, RG16, RGB565, RGBA4, RGB5_A1, RGBA8, RGB10_A2,
3678 * RGB10_A2UI, RGBA16, SRGB8_ALPHA8, R16F, RG16F, RGBA16F, R32F, RG32F,
3679 * RGBA32F, R11F_G11F_B10F, R8I, R8UI, R16I, R16UI, R32I, R32UI, RG8I,
3680 * RG8UI, RG16I, RG16UI, RG32I, RG32UI, RGBA8I, RGBA8UI, RGBA16I,
3681 * RGBA16UI, RGBA32I, RGBA32UI, DEPTH_COMPONENT16, DEPTH_COMPONENT24,
3682 * DEPTH_COMPONENT32F, DEPTH24_STENCIL8, DEPTH32F_STENCIL8 and
3683 * STENCIL_INDEX8.
3684 *
3685 * Repeat the test for following width and height:
3686 * width = 1 and height = 1;
3687 * width = 256 and height = 512;
3688 * width = 1280 and height = 720;
3689 * width = value of MAX_RENDERBUFFER_SIZE and height = 1;
3690 * width = 1 and height = value of MAX_RENDERBUFFER_SIZE.
3691 */
3692 class StorageTest : public deqp::TestCase
3693 {
3694 public:
3695 /* Public member functions */
3696 StorageTest(deqp::Context& context);
3697
3698 virtual tcu::TestNode::IterateResult iterate();
3699
3700 private:
3701 /* Private static variables. */
3702 static const struct RenderbufferInternalFormatConfiguration
3703 {
3704 glw::GLenum internalformat;
3705 const glw::GLchar* internalformat_name;
3706 bool hasRedComponent;
3707 bool hasGreenComponent;
3708 bool hasBlueComponent;
3709 bool hasAlphaComponent;
3710 bool hasDepthComponent;
3711 bool hasStencilComponent;
3712 bool isColorIntegralFormat;
3713 } s_renderbuffer_internalformat_configuration[];
3714
3715 static const glw::GLuint s_renderbuffer_internalformat_configuration_count;
3716
3717 static const glw::GLfloat s_reference_color[4];
3718 static const glw::GLint s_reference_color_integer[4];
3719 static const glw::GLfloat s_reference_depth;
3720 static const glw::GLint s_reference_stencil;
3721
3722 /* Private member functions */
3723 StorageTest(const StorageTest& other);
3724 StorageTest& operator=(const StorageTest& other);
3725
3726 bool PrepareRenderbuffer(StorageTest::RenderbufferInternalFormatConfiguration format, glw::GLuint width,
3727 glw::GLuint height);
3728 void Clear(bool isIntegralFormat);
3729 bool Check(StorageTest::RenderbufferInternalFormatConfiguration format, glw::GLuint width, glw::GLuint height);
3730 void Clean();
3731
3732 /* Private member variables. */
3733 glw::GLuint m_fbo;
3734 glw::GLuint m_rbo;
3735 };
3736 /* StorageTest class */
3737
3738 /** Named Renderbuffer Storage Multisample
3739 *
3740 * Create two renderbuffer objects. Prepare storage of the first one using
3741 * NamedRenderbufferStorageMultisample function. Prepare storage of the
3742 * second one using NamedRenderbufferStorage function.
3743 *
3744 * Create two framebuffer objects. Attach multisampled renderbuffer to
3745 * proper attachment points of the first framebuffer. Attach second
3746 * renderbuffer to proper attachment points of the second framebuffer.
3747 *
3748 * Clear framebuffer's renderbuffer attachment with reference value. Blit
3749 * surface of the first framebuffer (multisampled renderbuffer) to the
3750 * second framebuffer. Fetch the data from the second framebuffer using
3751 * ReadPixels function. Compare the fetched values with the reference.
3752 *
3753 * Release all objects.
3754 *
3755 * Repeat the test for following internal formats:
3756 *
3757 * R8, R16, RG8, RG16, RGB565, RGBA4, RGB5_A1, RGBA8, RGB10_A2,
3758 * RGB10_A2UI, RGBA16, SRGB8_ALPHA8, R16F, RG16F, RGBA16F, R32F, RG32F,
3759 * RGBA32F, R11F_G11F_B10F, R8I, R8UI, R16I, R16UI, R32I, R32UI, RG8I,
3760 * RG8UI, RG16I, RG16UI, RG32I, RG32UI, RGBA8I, RGBA8UI, RGBA16I,
3761 * RGBA16UI, RGBA32I, RGBA32UI, DEPTH_COMPONENT16, DEPTH_COMPONENT24,
3762 * DEPTH_COMPONENT32F, DEPTH24_STENCIL8, DEPTH32F_STENCIL8 and
3763 * STENCIL_INDEX8.
3764 *
3765 * Repeat the test for following width and height:
3766 * width = 1 and height = 1;
3767 * width = value of MAX_RENDERBUFFER_SIZE and height = 1;
3768 * width = 1 and height = value of MAX_RENDERBUFFER_SIZE.
3769 *
3770 * Repeat the test for number of samples in range from 1 to value of
3771 * MAX_INTEGER_SAMPLES for signed and unsigned integer internal formats or
3772 * in range from 1 to value of MAX_SAMPLES for all other internal formats.
3773 */
3774 class StorageMultisampleTest : public deqp::TestCase
3775 {
3776 public:
3777 /* Public member functions */
3778 StorageMultisampleTest(deqp::Context& context);
3779
3780 virtual tcu::TestNode::IterateResult iterate();
3781
3782 private:
3783 /* Private static variables. */
3784 static const struct RenderbufferInternalFormatConfiguration
3785 {
3786 glw::GLenum internalformat;
3787 const glw::GLchar* internalformat_name;
3788 bool hasRedComponent;
3789 bool hasGreenComponent;
3790 bool hasBlueComponent;
3791 bool hasAlphaComponent;
3792 bool hasDepthComponent;
3793 bool hasStencilComponent;
3794 bool isColorIntegralFormat;
3795 } s_renderbuffer_internalformat_configuration[];
3796
3797 static const glw::GLuint s_renderbuffer_internalformat_configuration_count;
3798
3799 static const glw::GLfloat s_reference_color[4];
3800 static const glw::GLint s_reference_color_integer[4];
3801 static const glw::GLfloat s_reference_depth;
3802 static const glw::GLint s_reference_stencil;
3803
3804 /* Private member functions */
3805 StorageMultisampleTest(const StorageMultisampleTest& other);
3806 StorageMultisampleTest& operator=(const StorageMultisampleTest& other);
3807
3808 bool PrepareRenderbuffer(StorageMultisampleTest::RenderbufferInternalFormatConfiguration format, glw::GLuint width,
3809 glw::GLuint height, glw::GLsizei samples);
3810 void Bind(glw::GLenum target, glw::GLuint selector);
3811 void Blit(glw::GLuint width, glw::GLuint height);
3812 void Clear(bool isIntegralFormat);
3813 bool Check(StorageMultisampleTest::RenderbufferInternalFormatConfiguration format, glw::GLuint width,
3814 glw::GLuint height);
3815 void Clean();
3816 glw::GLint GetMaxConformantSampleCount(glw::GLenum target, glw::GLenum internalFormat);
3817
3818 /* Private member variables. */
3819 glw::GLuint m_fbo[2];
3820 glw::GLuint m_rbo[2];
3821 };
3822 /* StorageMultisampleTest class */
3823
3824 /** Get Named Renderbuffer Parameter
3825 *
3826 * Create named renderbuffer object with varying width = 1,
3827 * height = 2, and varying internalformat.
3828 *
3829 * For following parameter names:
3830 * - RENDERBUFFER_WIDTH,
3831 * - RENDERBUFFER_HEIGHT,
3832 * - RENDERBUFFER_INTERNAL_FORMAT,
3833 * - RENDERBUFFER_SAMPLES,
3834 * - RENDERBUFFER_RED_SIZE,
3835 * - RENDERBUFFER_GREEN_SIZE,
3836 * - RENDERBUFFER_BLUE_SIZE,
3837 * - RENDERBUFFER_ALPHA_SIZE,
3838 * - RENDERBUFFER_DEPTH_SIZE,
3839 * - RENDERBUFFER_STENCIL_SIZE
3840 * query value using GetNamedRenderbufferParameteriv. Expect no error.
3841 * Compare it with value returned in non-DSA way. Expect equality.
3842 *
3843 * Repeat test for following internalformats:
3844 * - RGBA8,
3845 * - DEPTH_COMPONENT24,
3846 * - STENCIL_INDEX8,
3847 * - DEPTH24_STENCIL8.
3848 *
3849 * Release objects.
3850 */
3851 class GetParametersTest : public deqp::TestCase
3852 {
3853 public:
3854 /* Public member functions */
3855 GetParametersTest(deqp::Context& context);
3856
3857 virtual tcu::TestNode::IterateResult iterate();
3858
3859 private:
3860 /* Private member functions */
3861 GetParametersTest(const GetParametersTest& other);
3862 GetParametersTest& operator=(const GetParametersTest& other);
3863
3864 /* Private member variables. */
3865 glw::GLuint m_fbo;
3866 glw::GLuint m_rbo;
3867 };
3868 /* GetParametersTest class */
3869
3870 /** Create Renderbuffer Errors
3871 *
3872 * Check that INVALID_VALUE is generated by CreateRenderbuffers if n is
3873 * negative.
3874 */
3875 class CreationErrorsTest : public deqp::TestCase
3876 {
3877 public:
3878 /* Public member functions */
3879 CreationErrorsTest(deqp::Context& context);
3880
3881 virtual tcu::TestNode::IterateResult iterate();
3882
3883 private:
3884 /* Private member functions */
3885 CreationErrorsTest(const CreationErrorsTest& other);
3886 CreationErrorsTest& operator=(const CreationErrorsTest& other);
3887 };
3888 /* CreationErrorsTest class */
3889
3890 /** Named Renderbuffer Storage Errors
3891 *
3892 * Check that INVALID_OPERATION is generated by NamedRenderbufferStorage if
3893 * renderbuffer is not the name of an existing renderbuffer object.
3894 *
3895 * Check that INVALID_VALUE is generated by NamedRenderbufferStorage if
3896 * either of width or height is negative, or greater than the value of
3897 * MAX_RENDERBUFFER_SIZE.
3898 */
3899 class StorageErrorsTest : public deqp::TestCase
3900 {
3901 public:
3902 /* Public member functions */
3903 StorageErrorsTest(deqp::Context& context);
3904
3905 virtual tcu::TestNode::IterateResult iterate();
3906
3907 private:
3908 /* Private member functions */
3909 StorageErrorsTest(const StorageErrorsTest& other);
3910 StorageErrorsTest& operator=(const StorageErrorsTest& other);
3911
3912 void PrepareObjects();
3913 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3914 void Clean();
3915
3916 /* Private member variables. */
3917 glw::GLuint m_rbo_valid;
3918 glw::GLuint m_rbo_invalid;
3919 glw::GLenum m_internalformat_invalid;
3920 };
3921 /* StorageErrorsTest class */
3922
3923 /** Named Renderbuffer Storage Multisample Errors
3924 *
3925 * Check that INVALID_OPERATION is generated by
3926 * NamedRenderbufferStorageMultisample function if renderbuffer is not the
3927 * name of an existing renderbuffer object.
3928 *
3929 * Check that INVALID_VALUE is generated by
3930 * NamedRenderbufferStorageMultisample if samples is greater than
3931 * MAX_SAMPLES.
3932 *
3933 * Check that INVALID_ENUM is generated by
3934 * NamedRenderbufferStorageMultisample if internalformat is not a
3935 * color-renderable, depth-renderable, or stencil-renderable format.
3936 *
3937 * Check that INVALID_OPERATION is generated by
3938 * NamedRenderbufferStorageMultisample if internalformat is a signed or
3939 * unsigned integer format and samples is greater than the value of
3940 * MAX_INTEGER_SAMPLES.
3941 *
3942 * Check that INVALID_VALUE is generated by
3943 * NamedRenderbufferStorageMultisample if either of width or height is
3944 * negative, or greater than the value of GL_MAX_RENDERBUFFER_SIZE.
3945 */
3946 class StorageMultisampleErrorsTest : public deqp::TestCase
3947 {
3948 public:
3949 /* Public member functions */
3950 StorageMultisampleErrorsTest(deqp::Context& context);
3951
3952 virtual tcu::TestNode::IterateResult iterate();
3953
3954 private:
3955 /* Private member functions */
3956 StorageMultisampleErrorsTest(const StorageMultisampleErrorsTest& other);
3957 StorageMultisampleErrorsTest& operator=(const StorageMultisampleErrorsTest& other);
3958
3959 void PrepareObjects();
3960 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3961 void Clean();
3962
3963 /* Private member variables. */
3964 glw::GLuint m_rbo_valid;
3965 glw::GLuint m_rbo_invalid;
3966 glw::GLenum m_internalformat_invalid;
3967 glw::GLint m_max_samples;
3968 glw::GLint m_max_integer_samples;
3969 };
3970 /* StorageMultisampleErrorsTest class */
3971
3972 /** Get Named Renderbuffer Parameter Errors
3973 *
3974 * Check that INVALID_OPERATION is generated by
3975 * GetNamedRenderbufferParameteriv if renderbuffer is not the name of an
3976 * existing renderbuffer object.
3977 *
3978 * Check that INVALID_ENUM is generated by GetNamedRenderbufferParameteriv
3979 * if parameter name is not one of the accepted parameter names described
3980 * in specification.
3981 */
3982 class GetParameterErrorsTest : public deqp::TestCase
3983 {
3984 public:
3985 /* Public member functions */
3986 GetParameterErrorsTest(deqp::Context& context);
3987
3988 virtual tcu::TestNode::IterateResult iterate();
3989
3990 private:
3991 /* Private member functions */
3992 GetParameterErrorsTest(const GetParameterErrorsTest& other);
3993 GetParameterErrorsTest& operator=(const GetParameterErrorsTest& other);
3994
3995 void PrepareObjects();
3996 bool ExpectError(glw::GLenum expected_error, const glw::GLchar* function, const glw::GLchar* conditions);
3997 void Clean();
3998
3999 /* Private member variables. */
4000 glw::GLuint m_rbo_valid;
4001 glw::GLuint m_rbo_invalid;
4002 glw::GLenum m_parameter_invalid;
4003 };
4004 /* GetParameterErrorsTest class */
4005 } /* Renderbuffers namespace */
4006
4007 namespace VertexArrays
4008 {
4009 /** Vertex Array Object Creation
4010 *
4011 * Create at least two vertex array objects using GenVertexArrays function.
4012 * Check them without binding, using IsVertexArray function. Expect FALSE.
4013 *
4014 * Create at least two vertex array objects using CreateVertexArrays
4015 * function. Check them without binding, using IsVertexArray function.
4016 * Expect TRUE.
4017 *
4018 * Release objects.
4019 */
4020 class CreationTest : public deqp::TestCase
4021 {
4022 public:
4023 /* Public member functions */
4024 CreationTest(deqp::Context& context);
4025
4026 virtual tcu::TestNode::IterateResult iterate();
4027
4028 private:
4029 /* Private member functions */
4030 CreationTest(const CreationTest& other);
4031 CreationTest& operator=(const CreationTest& other);
4032 };
4033 /* CreationTest class */
4034
4035 /** Vertex Array Object Enable Disable Attributes
4036 *
4037 * Prepare vertex shader with (MAX_VERTEX_ATTRIBS / 2) attribute variables.
4038 * Vertex shader shall sum all input attribute variables and pass the sum
4039 * to transform feedback varying. Build program in two versions:
4040 * 1) with attribute variable names bound to even attribute indexes;
4041 * 2) with attribute variable names bound to odd attribute indexes.
4042 *
4043 * Prepare and bind vertex array object.
4044 *
4045 * Prepare buffer object with MAX_VERTEX_ATTRIBS of consecutive numbers.
4046 * Bound each of the numbers to separate index. Prepare second object for
4047 * transform feedback result.
4048 *
4049 * Unbind vertex array object.
4050 *
4051 * Enable even attribute indexes using EnableVertexArrayAttrib. Expect no
4052 * error.
4053 *
4054 * Bind vertex array object.
4055 *
4056 * Use first program. Draw single point using transform feedback. Expect
4057 * sum of numbers at even positions in the input (reference) buffer object.
4058 *
4059 * Unbind vertex array object.
4060 *
4061 * Disable even attribute indexes using DisableVertexArrayAttrib. Expect no
4062 * error.
4063 *
4064 * Enable odd attribute indexes using EnableVertexArrayAttrib. Expect no
4065 * error.
4066 *
4067 * Bind vertex array object.
4068 *
4069 * Use second program. Draw single point using transform feedback. Expect
4070 * sum of numbers at odd positions in the input (reference) buffer object.
4071 *
4072 * Unbind vertex array object.
4073 *
4074 * Release all objects.
4075 */
4076 class EnableDisableAttributesTest : public deqp::TestCase
4077 {
4078 public:
4079 /* Public member functions */
4080 EnableDisableAttributesTest(deqp::Context& context);
4081
4082 virtual tcu::TestNode::IterateResult iterate();
4083
4084 private:
4085 /* Private member functions. */
4086 EnableDisableAttributesTest(const EnableDisableAttributesTest& other);
4087 EnableDisableAttributesTest& operator=(const EnableDisableAttributesTest& other);
4088
4089 glw::GLuint PrepareProgram(const bool bind_even_or_odd);
4090 glw::GLuint BuildProgram(const char* vertex_shader, const bool bind_even_or_odd);
4091 void PrepareVAO();
4092 void PrepareXFB();
4093 bool DrawAndCheck(bool bind_even_or_odd);
4094 bool TurnOnAttributes(bool enable_even, bool enable_odd);
4095 void Clean();
4096
4097 /* Private member variables. */
4098 glw::GLuint m_po_even;
4099 glw::GLuint m_po_odd;
4100 glw::GLuint m_vao;
4101 glw::GLuint m_bo;
4102 glw::GLuint m_bo_xfb;
4103 glw::GLint m_max_attributes;
4104
4105 /* Private static constants. */
4106 static const glw::GLchar s_vertex_shader_template[];
4107 static const glw::GLchar s_fragment_shader[];
4108 };
4109 /* EnableDisableAttributesTest class */
4110
4111 /** Vertex Array Object Element Buffer
4112 *
4113 * Prepare GLSL program which passes input attribute to transform feedback
4114 * varying.
4115 *
4116 * Create and bind vertex array object.
4117 *
4118 * Prepare buffer object with integer data {2, 1, 0}. Set this buffer as an
4119 * input attribute. Use non-DSA functions.
4120 *
4121 * Unbind vertex array object.
4122 *
4123 * Prepare buffer object with integer data {2, 1, 0}. Set this buffer as an
4124 * element buffer using VertexArrayElementBuffer function.
4125 *
4126 * Bind vertex array object.
4127 *
4128 * Use the program. Draw three points using transform feedback. Expect
4129 * result equal to {0, 1, 2}.
4130 *
4131 * Release all objects.
4132 */
4133 class ElementBufferTest : public deqp::TestCase
4134 {
4135 public:
4136 /* Public member functions */
4137 ElementBufferTest(deqp::Context& context);
4138
4139 virtual tcu::TestNode::IterateResult iterate();
4140
4141 private:
4142 /* Private member functions. */
4143 ElementBufferTest(const ElementBufferTest& other);
4144 ElementBufferTest& operator=(const ElementBufferTest& other);
4145
4146 void PrepareProgram();
4147 bool PrepareVAO();
4148 void PrepareXFB();
4149 bool DrawAndCheck();
4150 void Clean();
4151
4152 /* Private member variables. */
4153 glw::GLuint m_po;
4154 glw::GLuint m_vao;
4155 glw::GLuint m_bo_array;
4156 glw::GLuint m_bo_elements;
4157 glw::GLuint m_bo_xfb;
4158
4159 /* Private static constants. */
4160 static const glw::GLchar s_vertex_shader[];
4161 static const glw::GLchar s_fragment_shader[];
4162 };
4163 /* ElementBufferTest class */
4164
4165 /** Vertex Array Object Vertex Buffer and Buffers
4166 *
4167 * Prepare GLSL program which passes sum of three input integer attributes
4168 * to the transform feedback varying.
4169 *
4170 * Prepare two vertex buffer objects. Setup first buffer with data {0, 1,
4171 * 2, 3}.
4172 * Setup second buffer with data {4, 5}.
4173 *
4174 * Create vertex array object. Setup three vertex attributes. Set first
4175 * buffer object as an input attribute 0 and 1 in interleaved way using
4176 * VertexArrayVertexBuffer function. Set second buffer object as an input
4177 * attribute 2 using VertexArrayVertexBuffer function.
4178 *
4179 * Use program. Draw 2 points using transform feedback. Query results.
4180 * Expect two values {0+2+4, 1+3+5}.
4181 *
4182 * Release all data.
4183 *
4184 * Repeat the test using VertexArrayVertexBuffers function instead of
4185 * VertexArrayVertexBuffer.
4186 */
4187 class VertexBuffersTest : public deqp::TestCase
4188 {
4189 public:
4190 /* Public member functions */
4191 VertexBuffersTest(deqp::Context& context);
4192
4193 virtual tcu::TestNode::IterateResult iterate();
4194
4195 private:
4196 /* Private member functions. */
4197 VertexBuffersTest(const VertexBuffersTest& other);
4198 VertexBuffersTest& operator=(const VertexBuffersTest& other);
4199
4200 void PrepareProgram();
4201 bool PrepareVAO(bool use_multiple_buffers_function);
4202 void PrepareXFB();
4203 bool DrawAndCheck();
4204 void Clean();
4205
4206 /* Private member variables. */
4207 glw::GLuint m_po;
4208 glw::GLuint m_vao;
4209 glw::GLuint m_bo_array_0;
4210 glw::GLuint m_bo_array_1;
4211 glw::GLuint m_bo_xfb;
4212
4213 /* Private static constants. */
4214 static const glw::GLchar s_vertex_shader[];
4215 static const glw::GLchar s_fragment_shader[];
4216 };
4217 /* VertexBuffersTest class */
4218
4219 /** Vertex Array Object Attribute Format
4220 *
4221 * Prepare GLSL program which passes sum of two input attributes to the
4222 * transform feedback varying.
4223 *
4224 * Create vertex array object.
4225 *
4226 * Prepare vertex buffer object with reference data of two interleaved
4227 * arrays. Setup it as input interleaved attributes.
4228 *
4229 * Setup two consecutive attributes using VertexArrayAttribFormat function.
4230 *
4231 * Use program. Draw 2 points using transform feedback. Query results.
4232 * Expect sum of adequate reference values.
4233 *
4234 * Release all data.
4235 *
4236 * Repeat the test using VertexArrayAttribIFormat VertexArrayAttribLFormat
4237 * function instead of VertexArrayAttribFormat.
4238 *
4239 * Repeat the test using size 1, 2, 3, and 4 (if possible by type).
4240 *
4241 * Repeat the test using type BYTE, SHORT, INT, FLOAT, DOUBLE,
4242 * UNSIGNED_BYTE, UNSIGNED_SHORT, UNSIGNED_INT.
4243 *
4244 * For test with VertexArrayAttribFormat function repeat for normalized and
4245 * not normalized values.
4246 */
4247 class AttributeFormatTest : public deqp::TestCase
4248 {
4249 public:
4250 /* Public member functions */
4251 AttributeFormatTest(deqp::Context& context);
4252
4253 virtual tcu::TestNode::IterateResult iterate();
4254
4255 private:
4256 /* Private state enumerations. */
4257 enum AtributeFormatFunctionType
4258 {
4259 ATTRIBUTE_FORMAT_FUNCTION_FLOAT,
4260 ATTRIBUTE_FORMAT_FUNCTION_DOUBLE,
4261 ATTRIBUTE_FORMAT_FUNCTION_INTEGER,
4262 ATTRIBUTE_FORMAT_FUNCTION_COUNT /* Must be last */
4263 };
4264
4265 /* Private member functions. */
4266 AttributeFormatTest(const AttributeFormatTest& other);
4267 AttributeFormatTest& operator=(const AttributeFormatTest& other);
4268
4269 template <typename T>
4270 bool compare(T a, T b);
4271
4272 void PrepareProgram(glw::GLint size, AtributeFormatFunctionType function_selector);
4273
4274 template <typename T>
4275 glw::GLdouble NormalizationScaleFactor();
4276
4277 template <typename T>
4278 bool PrepareVAO(glw::GLint size, glw::GLenum type_gl_name, bool normalized,
4279 AtributeFormatFunctionType function_selector);
4280
4281 void PrepareXFB();
4282
4283 template <typename T>
4284 bool DrawAndCheck(glw::GLint size, bool normalized);
4285
4286 void CleanVAO();
4287 void CleanProgram();
4288 void CleanXFB();
4289
4290 /* Private member variables. */
4291 glw::GLuint m_po;
4292 glw::GLuint m_vao;
4293 glw::GLuint m_bo_array;
4294 glw::GLuint m_bo_xfb;
4295
4296 /* Private static constants. */
4297 static const glw::GLchar* s_vertex_shader_head;
4298 static const glw::GLchar* s_vertex_shader_body;
4299 static const glw::GLchar* s_vertex_shader_declaration[ATTRIBUTE_FORMAT_FUNCTION_COUNT][4 /* sizes count */];
4300 static const glw::GLchar* s_fragment_shader;
4301 };
4302 /* AttributeFormatTest class */
4303
4304 /** Vertex Array Attribute Binding
4305 *
4306 * Prepare GLSL program which passes two integer input attributes to the
4307 * two-component transform feedback varying vector. Bind first attribute
4308 * to attribute index 0. Bind second attribute to attribute index 1.
4309 *
4310 * Create vertex array object.
4311 *
4312 * Prepare vertex buffer object. Setup the buffer with data {1, 0}.
4313 * Setup two integer attribute pointers in consecutive way.
4314 *
4315 * Using VertexArrayAttribBinding function, set up binding index 0 to the
4316 * attribute index 1. Using VertexArrayAttribBinding function, set up
4317 * binding index 1 to the attribute index 0.
4318 *
4319 * Prepare transform feedback buffer object.
4320 *
4321 * Release all data.
4322 */
4323 class AttributeBindingTest : public deqp::TestCase
4324 {
4325 public:
4326 /* Public member functions */
4327 AttributeBindingTest(deqp::Context& context);
4328
4329 virtual tcu::TestNode::IterateResult iterate();
4330
4331 private:
4332 /* Private member functions. */
4333 AttributeBindingTest(const AttributeBindingTest& other);
4334 AttributeBindingTest& operator=(const AttributeBindingTest& other);
4335
4336 void PrepareProgram();
4337 bool PrepareVAO();
4338 void PrepareXFB();
4339 bool DrawAndCheck();
4340 void Clean();
4341
4342 /* Private member variables. */
4343 glw::GLuint m_po;
4344 glw::GLuint m_vao;
4345 glw::GLuint m_bo_array;
4346 glw::GLuint m_bo_xfb;
4347
4348 /* Private static constants. */
4349 static const glw::GLchar s_vertex_shader[];
4350 static const glw::GLchar s_fragment_shader[];
4351 };
4352 /* AttributeBindingTest class */
4353
4354 class AttributeBindingDivisorTest : public deqp::TestCase
4355 {
4356 public:
4357 /* Public member functions */
4358 AttributeBindingDivisorTest(deqp::Context& context);
4359
4360 virtual tcu::TestNode::IterateResult iterate();
4361
4362 private:
4363 /* Private member functions. */
4364 AttributeBindingDivisorTest(const AttributeBindingDivisorTest& other);
4365 AttributeBindingDivisorTest& operator=(const AttributeBindingDivisorTest& other);
4366
4367 void PrepareProgram();
4368 void PrepareVAO();
4369 void PrepareXFB();
4370 void Draw(glw::GLuint number_of_points, glw::GLuint number_of_instances);
4371 bool SetDivisor(glw::GLuint divisor);
4372 bool CheckXFB(const glw::GLuint count, const glw::GLint expected[], const glw::GLchar* log_message);
4373 void Clean();
4374
4375 /* Private member variables. */
4376 glw::GLuint m_po;
4377 glw::GLuint m_vao;
4378 glw::GLuint m_bo_array;
4379 glw::GLuint m_bo_xfb;
4380
4381 /* Private static constants. */
4382 static const glw::GLchar s_vertex_shader[];
4383 static const glw::GLchar s_fragment_shader[];
4384 };
4385 /* AttributeBindingDivisorTest class */
4386
4387 /* Get Vertex Array
4388 *
4389 * Create vertex array object.
4390 *
4391 * Create buffer object. Set this buffer as an element buffer of the vertex
4392 * array object.
4393 *
4394 * Query ELEMENT_ARRAY_BUFFER_BINDING using GetVertexArrayiv. Expect buffer
4395 * ID.
4396 *
4397 * Release all objects.
4398 */
4399 class GetVertexArrayTest : public deqp::TestCase
4400 {
4401 public:
4402 /* Public member functions */
4403 GetVertexArrayTest(deqp::Context& context);
4404
4405 virtual tcu::TestNode::IterateResult iterate();
4406
4407 private:
4408 /* Private member functions. */
4409 GetVertexArrayTest(const GetVertexArrayTest& other);
4410 GetVertexArrayTest& operator=(const GetVertexArrayTest& other);
4411 };
4412 /* GetVertexArrayTest class */
4413
4414 /** Get Vertex Array Indexed
4415 *
4416 * Create vertex array object.
4417 *
4418 * Enable attribute indexes 0, 1, 2 and 3.
4419 *
4420 * Create 4 buffer objects. Set these buffer as attribute arrays:
4421 * - attribute 0 with size 1, type BYTE, normalized, stride 0, offset 0,
4422 * relative offset 0, binding divisor to 3;
4423 * - integer attribute 1 with size 2, type SHORT, stride 2, offset 2,
4424 * relative offset 0, binding divisor to 2;
4425 * - attribute 2 with size 3, type FLOAT, not normalized, stride 0,
4426 * offset 8, relative offset 4, binding divisor to 1;
4427 * - attribute 3 with size 4, type UNSIGNED_INT_2_10_10_10_REV, not
4428 * normalized, stride 8, offset 4, relative offset 0,
4429 * binding divisor to 0.
4430 *
4431 * Query VERTEX_ATTRIB_ARRAY_ENABLED using GetVertexArrayIndexediv. Expect
4432 * TRUE for consecutive indexes 0-3 and FALSE for index 4.
4433 *
4434 * Query VERTEX_ATTRIB_ARRAY_SIZE using GetVertexArrayIndexediv. Expect
4435 * 1, 2, 3, 4 for consecutive indexes.
4436 *
4437 * Query VERTEX_ATTRIB_ARRAY_STRIDE using GetVertexArrayIndexediv. Expect
4438 * 0, 2, 0, 8 for consecutive indexes.
4439 *
4440 * Query VERTEX_ATTRIB_ARRAY_TYPE using GetVertexArrayIndexediv. Expect
4441 * BYTE, SHORT, FLOAT, UNSIGNED_INT_2_10_10_10_REV for consecutive indexes.
4442 *
4443 * Query VERTEX_ATTRIB_ARRAY_NORMALIZED using GetVertexArrayIndexediv.
4444 * Expect true, false, false, false for consecutive indexes.
4445 *
4446 * Query VERTEX_ATTRIB_ARRAY_INTEGER using GetVertexArrayIndexediv.
4447 * Expect true, true, false, true for consecutive indexes.
4448 *
4449 * Query VERTEX_ATTRIB_ARRAY_LONG using GetVertexArrayIndexediv. Expect
4450 * false for consecutive indexes.
4451 *
4452 * Query VERTEX_ATTRIB_ARRAY_DIVISOR using GetVertexArrayIndexediv. Expect
4453 * 3, 2, 1, 0 for consecutive indexes.
4454 *
4455 * Query VERTEX_ATTRIB_RELATIVE_OFFSET using GetVertexArrayIndexediv.
4456 * Expect 0, 0, 4, 0 for consecutive indexes.
4457 *
4458 * Query VERTEX_BINDING_OFFSET using GetVertexArrayIndexed64iv. Expect 0,
4459 * 2, 8, 4 for consecutive indexes.
4460 *
4461 * Release all objects.
4462 */
4463 class GetVertexArrayIndexedTest : public deqp::TestCase
4464 {
4465 public:
4466 /* Public member functions */
4467 GetVertexArrayIndexedTest(deqp::Context& context);
4468
4469 virtual tcu::TestNode::IterateResult iterate();
4470
4471 private:
4472 /* Private member functions. */
4473 GetVertexArrayIndexedTest(const GetVertexArrayIndexedTest& other);
4474 GetVertexArrayIndexedTest& operator=(const GetVertexArrayIndexedTest& other);
4475
4476 void PrepareVAO();
4477 bool Check(const glw::GLenum pname, const glw::GLuint index, const glw::GLint expected);
4478 bool Check64(const glw::GLenum pname, const glw::GLuint index, const glw::GLint64 expected);
4479
4480 /* Private member variables. */
4481 glw::GLuint m_vao;
4482 glw::GLuint m_bo[4];
4483 };
4484 /* GetVertexArrayIndexedTest class */
4485
4486 /** Vertex Array Defaults
4487 *
4488 * Create empty vertex array object using CreateVertexArrays function.
4489 *
4490 * Check that parameter VERTEX_ATTRIB_ARRAY_ENABLED for all possible
4491 * attributes is equal to value FALSE.
4492 *
4493 * Check that parameter VERTEX_ATTRIB_ARRAY_SIZE for all possible
4494 * attributes is equal to value 4.
4495 *
4496 * Check that parameter VERTEX_ATTRIB_ARRAY_STRIDE for all possible
4497 * attributes is equal to value 0.
4498 *
4499 * Check that parameter VERTEX_ATTRIB_ARRAY_TYPE for all possible
4500 * attributes is equal to value FLOAT.
4501 *
4502 * Check that parameter VERTEX_ATTRIB_ARRAY_NORMALIZED for all possible
4503 * attributes is equal to value FALSE.
4504 *
4505 * Check that parameter VERTEX_ATTRIB_ARRAY_INTEGER for all possible
4506 * attributes is equal to value FALSE.
4507 *
4508 * Check that parameter VERTEX_ATTRIB_ARRAY_LONG for all possible
4509 * attributes is equal to value FALSE.
4510 *
4511 * Check that parameter VERTEX_ATTRIB_ARRAY_DIVISOR for all possible
4512 * attributes is equal to value 0.
4513 *
4514 * Check that parameter VERTEX_ATTRIB_RELATIVE_OFFSET for all possible
4515 * attributes is equal to value 0.
4516 *
4517 * Check that parameter VERTEX_BINDING_OFFSET for all possible attributes
4518 * is equal to value 0.
4519 *
4520 * Check that parameter ELEMENT_ARRAY_BUFFER_BINDING is equal to value 0.
4521 *
4522 * Release vertex array object.
4523 */
4524 class DefaultsTest : public deqp::TestCase
4525 {
4526 public:
4527 /* Public member functions */
4528 DefaultsTest(deqp::Context& context);
4529
4530 virtual tcu::TestNode::IterateResult iterate();
4531
4532 private:
4533 /* Private member functions. */
4534 DefaultsTest(const DefaultsTest& other);
4535 DefaultsTest& operator=(const DefaultsTest& other);
4536
4537 void PrepareVAO();
4538 bool Check(const glw::GLenum pname, const glw::GLint expected);
4539 bool CheckIndexed(const glw::GLenum pname, const glw::GLuint index, const glw::GLint expected);
4540 bool CheckIndexed64(const glw::GLenum pname, const glw::GLuint index, const glw::GLint64 expected);
4541
4542 /* Private member variables. */
4543 glw::GLuint m_vao;
4544 };
4545 /* DefaultsTest class */
4546
4547 /** Vertex Array Object Creation Error
4548 *
4549 * Check that INVALID_VALUE is generated if n is negative.
4550 */
4551 class CreationErrorTest : public deqp::TestCase
4552 {
4553 public:
4554 /* Public member functions */
4555 CreationErrorTest(deqp::Context& context);
4556
4557 virtual tcu::TestNode::IterateResult iterate();
4558
4559 private:
4560 /* Private member functions. */
4561 CreationErrorTest(const CreationErrorTest& other);
4562 CreationErrorTest& operator=(const CreationErrorTest& other);
4563
4564 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4565 };
4566 /* CreationErrorTest class */
4567
4568 /** Vertex Array Object Enable Disable Attribute Errors
4569 *
4570 * Check that INVALID_OPERATION is generated by EnableVertexArrayAttrib and
4571 * DisableVertexArrayAttrib if vaobj is not the name of an existing vertex
4572 * array object.
4573 *
4574 * Check that INVALID_VALUE is generated if index is greater than or equal
4575 * to MAX_VERTEX_ATTRIBS.
4576 */
4577 class EnableDisableAttributeErrorsTest : public deqp::TestCase
4578 {
4579 public:
4580 /* Public member functions */
4581 EnableDisableAttributeErrorsTest(deqp::Context& context);
4582
4583 virtual tcu::TestNode::IterateResult iterate();
4584
4585 private:
4586 /* Private member functions. */
4587 EnableDisableAttributeErrorsTest(const EnableDisableAttributeErrorsTest& other);
4588 EnableDisableAttributeErrorsTest& operator=(const EnableDisableAttributeErrorsTest& other);
4589
4590 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4591 };
4592 /* EnableDisableAttributeErrorsTest class */
4593
4594 /** Vertex Array Object Element Buffer Errors
4595 *
4596 * Check that INVALID_OPERATION error is generated by VertexArrayElementBuffer if vaobj is not the name
4597 * of an existing vertex array object.
4598 *
4599 * Check that INVALID_OPERATION error is generated by VertexArrayElementBuffer if buffer is not zero or
4600 * the name of an existing buffer object.
4601 */
4602 class ElementBufferErrorsTest : public deqp::TestCase
4603 {
4604 public:
4605 /* Public member functions */
4606 ElementBufferErrorsTest(deqp::Context& context);
4607
4608 virtual tcu::TestNode::IterateResult iterate();
4609
4610 private:
4611 /* Private member functions. */
4612 ElementBufferErrorsTest(const ElementBufferErrorsTest& other);
4613 ElementBufferErrorsTest& operator=(const ElementBufferErrorsTest& other);
4614
4615 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4616 };
4617 /* ElementBuffersErrorsTest class */
4618
4619 /** Vertex Array Object Buffer and Buffers Errors
4620 *
4621 * Check that INVALID_OPERATION is generated by VertexArrayVertexBuffer and
4622 * VertexArrayVertexBuffers if vaobj is not the name of an existing vertex
4623 * array object.
4624 *
4625 * Check that INVALID_VALUE is generated by VertexArrayVertexBuffer if
4626 * buffer is not zero or the name of an existing buffer object (as returned
4627 * by GenBuffers or CreateBuffers).
4628 *
4629 * Check that INVALID_OPERATION is generated by VertexArrayVertexBuffers if
4630 * any value in buffers is not zero or the name of an existing buffer
4631 * object.
4632 *
4633 * Check that INVALID_VALUE is generated by VertexArrayVertexBuffer if
4634 * bindingindex is greater than or equal to the value of
4635 * MAX_VERTEX_ATTRIB_BINDINGS.
4636 *
4637 * Check that INVALID_OPERATION is generated by VertexArrayVertexBuffers if
4638 * first+count is greater than the value of MAX_VERTEX_ATTRIB_BINDINGS.
4639 *
4640 * Check that INVALID_VALUE is generated by VertexArrayVertexBuffer if
4641 * offset or stride is less than zero, or if stride is greater than the
4642 * value of MAX_VERTEX_ATTRIB_STRIDE.
4643 *
4644 * Check that INVALID_VALUE is generated by VertexArrayVertexBuffers if any
4645 * value in offsets or strides is negative, or if a value is stride is
4646 * greater than the value of MAX_VERTEX_ATTRIB_STRIDE.
4647 */
4648 class VertexBuffersErrorsTest : public deqp::TestCase
4649 {
4650 public:
4651 /* Public member functions */
4652 VertexBuffersErrorsTest(deqp::Context& context);
4653
4654 virtual tcu::TestNode::IterateResult iterate();
4655
4656 private:
4657 /* Private member functions. */
4658 VertexBuffersErrorsTest(const VertexBuffersErrorsTest& other);
4659 VertexBuffersErrorsTest& operator=(const VertexBuffersErrorsTest& other);
4660
4661 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4662 };
4663 /* VertexBuffersErrorsTest class */
4664
4665 /** Vertex Array Object Attribute Format Errors
4666 *
4667 * Check that INVALID_VALUE is generated by VertexArrayAttrib*Format if
4668 * attribindex is greater than or equal to the value of MAX_VERTEX_ATTRIBS.
4669 *
4670 * Check that INVALID_VALUE is generated by VertexArrayAttrib*Format if
4671 * size is not one of the accepted values.
4672 *
4673 * Check that INVALID_VALUE is generated by VertexArrayAttrib*Format if
4674 * relativeoffset is greater than the value of
4675 * MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.
4676 *
4677 * Check that INVALID_ENUM is generated by VertexArrayAttrib*Format if type
4678 * is not one of the accepted tokens.
4679 *
4680 * Check that INVALID_ENUM is generated by VertexArrayAttrib{IL}Format if
4681 * type is UNSIGNED_INT_10F_11F_11F_REV.
4682 *
4683 * Check that INVALID_OPERATION is generated by VertexArrayAttrib*Format if
4684 * vaobj is not the name of an existing vertex array object.
4685 *
4686 * Check that INVALID_OPERATION is generated by VertexArrayAttribFormat
4687 * under any of the following conditions:
4688 * - size is BGRA and type is not UNSIGNED_BYTE, INT_2_10_10_10_REV or
4689 * UNSIGNED_INT_2_10_10_10_REV,
4690 * - type is INT_2_10_10_10_REV or UNSIGNED_INT_2_10_10_10_REV, and size
4691 * is neither 4 nor BGRA,
4692 * - type is UNSIGNED_INT_10F_11F_11F_REV and size is not 3,
4693 * - size is BGRA and normalized is FALSE.
4694 */
4695 class AttributeFormatErrorsTest : public deqp::TestCase
4696 {
4697 public:
4698 /* Public member functions */
4699 AttributeFormatErrorsTest(deqp::Context& context);
4700
4701 virtual tcu::TestNode::IterateResult iterate();
4702
4703 private:
4704 /* Private member functions. */
4705 AttributeFormatErrorsTest(const AttributeFormatErrorsTest& other);
4706 AttributeFormatErrorsTest& operator=(const AttributeFormatErrorsTest& other);
4707
4708 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4709 };
4710 /* AttributeFormatErrorsTest class */
4711
4712 /** Vertex Array Attribute Binding Errors
4713 *
4714 * Check that INVALID_OPERATION is generated by VertexArrayAttribBinding if
4715 * vaobj is not the name of an existing vertex array object.
4716 *
4717 * Check that INVALID_VALUE is generated by VertexArrayAttribBinding if
4718 * attribindex is greater than or equal to the value of MAX_VERTEX_ATTRIBS.
4719 *
4720 * Check that INVALID_VALUE is generated by VertexArrayAttribBinding if
4721 * bindingindex is greater than or equal to the value of
4722 * MAX_VERTEX_ATTRIB_BINDINGS.
4723 */
4724 class AttributeBindingErrorsTest : public deqp::TestCase
4725 {
4726 public:
4727 /* Public member functions */
4728 AttributeBindingErrorsTest(deqp::Context& context);
4729
4730 virtual tcu::TestNode::IterateResult iterate();
4731
4732 private:
4733 /* Private member functions. */
4734 AttributeBindingErrorsTest(const AttributeBindingErrorsTest& other);
4735 AttributeBindingErrorsTest& operator=(const AttributeBindingErrorsTest& other);
4736
4737 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4738 };
4739 /* AttributeBindingErrorsTest class */
4740
4741 /** Vertex Array Binding Divisor Errors
4742 *
4743 * Check that INVALID_VALUE is generated by VertexArrayBindingDivisor if
4744 * bindingindex is greater than or equal to the value of
4745 * MAX_VERTEX_ATTRIB_BINDINGS.
4746 *
4747 * Check that INVALID_OPERATION is generated by VertexArrayBindingDivisor
4748 * if vaobj is not the name of an existing vertex array object.
4749 */
4750 class AttributeBindingDivisorErrorsTest : public deqp::TestCase
4751 {
4752 public:
4753 /* Public member functions */
4754 AttributeBindingDivisorErrorsTest(deqp::Context& context);
4755
4756 virtual tcu::TestNode::IterateResult iterate();
4757
4758 private:
4759 /* Private member functions. */
4760 AttributeBindingDivisorErrorsTest(const AttributeBindingDivisorErrorsTest& other);
4761 AttributeBindingDivisorErrorsTest& operator=(const AttributeBindingDivisorErrorsTest& other);
4762
4763 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4764 };
4765 /* AttributeBindingDivisorErrorsTest class */
4766
4767 /** Get Vertex Array Errors
4768 *
4769 * Check that INVALID_OPERATION error is generated by GetVertexArrayiv if
4770 * vaobj is not the name of an existing vertex array object.
4771 *
4772 * Check that INVALID_ENUM error is generated by GetVertexArrayiv if pname
4773 * is not ELEMENT_ARRAY_BUFFER_BINDING.
4774 */
4775 class GetVertexArrayErrorsTest : public deqp::TestCase
4776 {
4777 public:
4778 /* Public member functions */
4779 GetVertexArrayErrorsTest(deqp::Context& context);
4780
4781 virtual tcu::TestNode::IterateResult iterate();
4782
4783 private:
4784 /* Private member functions. */
4785 GetVertexArrayErrorsTest(const GetVertexArrayErrorsTest& other);
4786 GetVertexArrayErrorsTest& operator=(const GetVertexArrayErrorsTest& other);
4787
4788 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4789 };
4790 /* GetVertexArrayErrorsTest class */
4791
4792 /** Get Vertex Array Indexed Errors
4793 *
4794 * Check that INVALID_OPERATION error is generated by
4795 * GetVertexArrayIndexediv and GetVertexArrayIndexed64iv if vaobj is not
4796 * the name of an existing vertex array object.
4797 *
4798 * Check that INVALID_VALUE error is generated by GetVertexArrayIndexediv
4799 * and GetVertexArrayIndexed64iv if index is greater than or equal to the
4800 * value of MAX_VERTEX_ATTRIBS.
4801 *
4802 * Check that INVALID_ENUM error is generated by GetVertexArrayIndexediv if
4803 * pname is not one of the valid values:
4804 * - VERTEX_ATTRIB_ARRAY_ENABLED,
4805 * - VERTEX_ATTRIB_ARRAY_SIZE,
4806 * - VERTEX_ATTRIB_ARRAY_STRIDE,
4807 * - VERTEX_ATTRIB_ARRAY_TYPE,
4808 * - VERTEX_ATTRIB_ARRAY_NORMALIZED,
4809 * - VERTEX_ATTRIB_ARRAY_INTEGER,
4810 * - VERTEX_ATTRIB_ARRAY_LONG,
4811 * - VERTEX_ATTRIB_ARRAY_DIVISOR,
4812 * - VERTEX_ATTRIB_RELATIVE_OFFSET.
4813 *
4814 * Check that INVALID_ENUM error is generated by GetVertexArrayIndexed64iv
4815 * if pname is not VERTEX_BINDING_OFFSET.
4816 */
4817 class GetVertexArrayIndexedErrorsTest : public deqp::TestCase
4818 {
4819 public:
4820 /* Public member functions */
4821 GetVertexArrayIndexedErrorsTest(deqp::Context& context);
4822
4823 virtual tcu::TestNode::IterateResult iterate();
4824
4825 private:
4826 /* Private member functions. */
4827 GetVertexArrayIndexedErrorsTest(const GetVertexArrayIndexedErrorsTest& other);
4828 GetVertexArrayIndexedErrorsTest& operator=(const GetVertexArrayIndexedErrorsTest& other);
4829
4830 bool CheckError(const glw::GLenum expected, const glw::GLchar* log_message);
4831 };
4832 /* GetVertexArrayIndexedErrorsTest class */
4833
4834 namespace Utilities
4835 {
4836 std::string itoa(glw::GLuint i);
4837 std::string replace(const std::string& src, const std::string& key, const std::string& value);
4838 } /* Vertex Arrays utilities class */
4839 } /* VertexArrays namespace */
4840
4841 /* Direct State Access Textures Tests */
4842 namespace Textures
4843 {
4844 /** @class CreationTest
4845 *
4846 * @brief Direct State Access Texture Creation test cases.
4847 *
4848 * Test follows the steps:
4849 *
4850 * Create at least two texture objects using GenTextures function. Check
4851 * them without binding, using IsTexture function. Expect FALSE.
4852 *
4853 * Create at least two texture objects using CreateTextures function. Check
4854 * them without binding, using IsTexture function. Expect TRUE. Repeat this
4855 * step for all targets:
4856 * - TEXTURE_1D,
4857 * - TEXTURE_2D,
4858 * - TEXTURE_3D,
4859 * - TEXTURE_1D_ARRAY,
4860 * - TEXTURE_2D_ARRAY,
4861 * - TEXTURE_RECTANGLE,
4862 * - TEXTURE_CUBE_MAP,
4863 * - TEXTURE_CUBE_MAP_ARRAY,
4864 * - TEXTURE_BUFFER,
4865 * - TEXTURE_2D_MULTISAMPLE and
4866 * - TEXTURE_2D_MULTISAMPLE_ARRAY.
4867 *
4868 * Release objects.
4869 */
4870 class CreationTest : public deqp::TestCase
4871 {
4872 public:
4873 /* Public member functions */
4874 CreationTest(deqp::Context& context);
4875
4876 virtual tcu::TestNode::IterateResult iterate();
4877
4878 private:
4879 /* Private member functions */
4880 CreationTest(const CreationTest& other);
4881 CreationTest& operator=(const CreationTest& other);
4882 };
4883 /* CreationTest class */
4884
4885 class Reference
4886 {
4887 public:
4888 template <typename T, glw::GLint S, bool N>
4889 static glw::GLenum InternalFormat();
4890
4891 template <glw::GLint S, bool N>
4892 static glw::GLenum Format();
4893
4894 template <typename T>
4895 static glw::GLenum Type();
4896
4897 template <typename T, bool N>
4898 static const T* ReferenceData();
4899
4900 static glw::GLuint ReferenceDataCount();
4901
4902 template <typename T>
4903 static glw::GLuint ReferenceDataSize();
4904
4905 template <typename T>
4906 static bool Compare(const T a, const T b);
4907
4908 private:
4909 static const glw::GLuint s_reference_count = 2 /* 1D */ * 3 /* 2D */ * 4 /* 3D */ * 4 /* components */;
4910 };
4911
4912 /** @class BufferTest
4913 *
4914 * @brief Direct State Access of texture buffers.
4915 *
4916 * @tparam T Type.
4917 * @tparam S Size.
4918 * @tparam N Is normalized.
4919 *
4920 * Test follows the steps:
4921 *
4922 * Make test for following DSA functions:
4923 * - TextureBuffer,
4924 * - TextureBufferRange
4925 * and following texture internal formats:
4926 * - R8,
4927 * - R16,
4928 * - R16F,
4929 * - R32F,
4930 * - R8I,
4931 * - R16I,
4932 * - R32I,
4933 * - R8UI,
4934 * - R16UI,
4935 * - R32UI,
4936 * - RG8,
4937 * - RG16,
4938 * - RG16F,
4939 * - RG32F,
4940 * - RG8I,
4941 * - RG16I,
4942 * - RG32I,
4943 * - RG8UI,
4944 * - RG16UI,
4945 * - RG32UI,
4946 * - RGB32F,
4947 * - RGB32I,
4948 * - RGB32UI,
4949 * - RGBA8,
4950 * - RGBA16,
4951 * - RGBA16F,
4952 * - RGBA32F,
4953 * - RGBA8I,
4954 * - RGBA16I,
4955 * - RGBA32I,
4956 * - RGBA8UI,
4957 * - RGBA16UI,
4958 * - RGBA32UI.
4959 *
4960 * Prepare program which draws textured quad 6 x 1 pixels in size. The
4961 * sampled texture shall be buffer texture which linearly store two rows
4962 * of three pixels.
4963 *
4964 * Prepare framebuffer 6 x 1 pixels in size.
4965 *
4966 * Prepare texture object with attached buffer object as a storage using
4967 * TextureBuffer or TextureBufferRange function. When TextureBufferRange is
4968 * being used, test non-zero offset setup. The buffer object shall contain
4969 * unique reference values. Texture filtering shall be set to NEAREST.
4970 *
4971 * Using prepared GL objects draw a quad. Fetch framebuffer data using
4972 * ReadPixels function. Compare the results with the reference data. Expect
4973 * equality.
4974 *
4975 * Release all objects.
4976 */
4977 template <typename T, glw::GLint S, bool N>
4978 class BufferTest : public deqp::TestCase, Reference
4979 {
4980 public:
4981 /* Public member functions. */
4982 BufferTest(deqp::Context& context, const char* name);
4983
4984 virtual tcu::TestNode::IterateResult iterate();
4985
4986 private:
4987 /* Private constructors. */
4988 BufferTest(const BufferTest& other);
4989 BufferTest& operator=(const BufferTest& other);
4990
4991 /* Private member functions. */
4992 static glw::GLuint TestReferenceDataCount();
4993
4994 static glw::GLuint TestReferenceDataSize();
4995
4996 static const glw::GLchar* FragmentShaderDeclaration();
4997
4998 bool CreateBufferTexture(bool use_range_version);
4999
5000 bool Check();
5001
5002 bool Test(bool use_range_version);
5003
5004 bool PrepareFramebuffer(const glw::GLenum internal_format);
5005 void PrepareProgram(const glw::GLchar* variable_declaration);
5006 void PrepareVertexArray();
5007 void Draw();
5008 void CleanBufferTexture();
5009 void CleanFramebuffer();
5010 void CleanProgram();
5011 void CleanErrors();
5012 void CleanVertexArray();
5013
5014 /* Private member variables. */
5015 glw::GLuint m_fbo;
5016 glw::GLuint m_rbo;
5017 glw::GLuint m_po;
5018 glw::GLuint m_to;
5019 glw::GLuint m_bo;
5020 glw::GLuint m_vao;
5021
5022 /* Private static constants. */
5023 static const glw::GLuint s_fbo_size_x = 6;
5024 static const glw::GLuint s_fbo_size_y = 1;
5025 static const glw::GLchar* s_vertex_shader;
5026 static const glw::GLchar* s_fragment_shader_head;
5027 static const glw::GLchar* s_fragment_shader_fdecl_lowp;
5028 static const glw::GLchar* s_fragment_shader_idecl_lowp;
5029 static const glw::GLchar* s_fragment_shader_udecl_lowp;
5030 static const glw::GLchar* s_fragment_shader_fdecl_mediump;
5031 static const glw::GLchar* s_fragment_shader_idecl_mediump;
5032 static const glw::GLchar* s_fragment_shader_udecl_mediump;
5033 static const glw::GLchar* s_fragment_shader_fdecl_highp;
5034 static const glw::GLchar* s_fragment_shader_idecl_highp;
5035 static const glw::GLchar* s_fragment_shader_udecl_highp;
5036 static const glw::GLchar* s_fragment_shader_tail;
5037 };
5038
5039 /** @brief Fragment shader part selector.
5040 *
5041 * @return Array of characters with source code.
5042 */
5043 template <typename T, glw::GLint S, bool N>
FragmentShaderDeclaration()5044 const glw::GLchar* BufferTest<T, S, N>::FragmentShaderDeclaration()
5045 {
5046 if (typeid(T) == typeid(glw::GLbyte))
5047 {
5048 return s_fragment_shader_idecl_lowp;
5049 }
5050
5051 if (typeid(T) == typeid(glw::GLubyte))
5052 {
5053 return N ? s_fragment_shader_fdecl_lowp : s_fragment_shader_udecl_lowp;
5054 }
5055
5056 if (typeid(T) == typeid(glw::GLshort))
5057 {
5058 return s_fragment_shader_idecl_mediump;
5059 }
5060
5061 if (typeid(T) == typeid(glw::GLushort))
5062 {
5063 return N ? s_fragment_shader_fdecl_mediump : s_fragment_shader_udecl_mediump;
5064 }
5065
5066 if (typeid(T) == typeid(glw::GLint))
5067 {
5068 return s_fragment_shader_idecl_highp;
5069 }
5070
5071 if (typeid(T) == typeid(glw::GLuint))
5072 {
5073 return s_fragment_shader_udecl_highp;
5074 }
5075
5076 return s_fragment_shader_fdecl_highp;
5077 }
5078
5079 /* BufferTest class */
5080
5081 /** @class StorageAndSubImageTest
5082 *
5083 * @tparam T Type.
5084 * @tparam S Size.
5085 * @tparam N Is normalized.
5086 * @tparam D Texture dimension.
5087 * @tparam I Choose between SubImage and Storage tests.
5088 *
5089 * Make test for following DSA storage functions:
5090 * - TextureStorage1D,
5091 * - TextureStorage2D,
5092 * - TextureStorage3D
5093 * and DSA SubImage functions:
5094 * - TextureSubImage1D,
5095 * - TextureSubImage2D,
5096 * - TextureSubImage3D.
5097 *
5098 * Test following internal formats:
5099 * - R8,
5100 * - R16,
5101 * - R16F,
5102 * - R32F,
5103 * - R8I,
5104 * - R16I,
5105 * - R32I,
5106 * - R8UI,
5107 * - R16UI,
5108 * - R32UI,
5109 * - RG8,
5110 * - RG16,
5111 * - RG16F,
5112 * - RG32F,
5113 * - RG8I,
5114 * - RG16I,
5115 * - RG32I,
5116 * - RG8UI,
5117 * - RG16UI,
5118 * - RG32UI,
5119 * - RGB32F,
5120 * - RGB32I,
5121 * - RGB32UI,
5122 * - RGBA8,
5123 * - RGBA16,
5124 * - RGBA16F,
5125 * - RGBA32F,
5126 * - RGBA8I,
5127 * - RGBA16I,
5128 * - RGBA32I,
5129 * - RGBA8UI,
5130 * - RGBA16UI,
5131 * - RGBA32UI.
5132 *
5133 * Create texture and prepare its storage with the tested function and
5134 * reference data. The texture dimensions shall be 2x3x4 texels in
5135 * corresponding directions (if available).
5136 *
5137 * Prepare GLSL program with fragment shader which fetches texture and passes
5138 * it to the framebuffer in serialized way.
5139 *
5140 * Prepare framebuffer 24 x 1 pixels in size.
5141 *
5142 * Make draw call with prepared texture and program. Fetch framebuffer and
5143 * compare values with the reference data. Expect equality.
5144 *
5145 * Release all objects.
5146 */
5147 template <typename T, glw::GLint S, bool N, glw::GLuint D, bool I>
5148 class StorageAndSubImageTest : public deqp::TestCase, Reference
5149 {
5150 public:
5151 /* Public member functions. */
5152 StorageAndSubImageTest(deqp::Context& context, const char* name);
5153
5154 virtual tcu::TestNode::IterateResult iterate();
5155
5156 private:
5157 /* Private constructors. */
5158 StorageAndSubImageTest(const StorageAndSubImageTest& other);
5159 StorageAndSubImageTest& operator=(const StorageAndSubImageTest& other);
5160
5161 /* Private member functions. */
5162 static glw::GLuint TestReferenceDataCount();
5163
5164 static glw::GLuint TestReferenceDataWidth();
5165
5166 static glw::GLuint TestReferenceDataHeight();
5167
5168 static glw::GLuint TestReferenceDataDepth();
5169
5170 static glw::GLuint TestReferenceDataSize();
5171
5172 static const glw::GLchar* FragmentShaderDeclaration();
5173
5174 static const glw::GLchar* FragmentShaderTail();
5175
5176 static glw::GLenum TextureTarget();
5177
5178 bool TextureSubImage(glw::GLenum target, glw::GLuint texture, glw::GLint level,
5179 glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth, glw::GLenum format,
5180 glw::GLenum type, const glw::GLvoid* data);
5181
5182 bool TextureStorage(glw::GLenum target, glw::GLuint texture, glw::GLsizei levels, glw::GLenum internalformat,
5183 glw::GLsizei width, glw::GLsizei height, glw::GLsizei depth);
5184
5185 bool CreateTexture();
5186
5187 bool Check();
5188
5189 bool Test();
5190
5191 void PrepareFramebuffer(const glw::GLenum internal_format);
5192 void PrepareProgram(const glw::GLchar* variable_declaration, const glw::GLchar* tail);
5193 void PrepareVertexArray();
5194 void Draw();
5195 void CleanTexture();
5196 void CleanFramebuffer();
5197 void CleanProgram();
5198 void CleanErrors();
5199 void CleanVertexArray();
5200
5201 /* Private member variables. */
5202 glw::GLuint m_fbo;
5203 glw::GLuint m_rbo;
5204 glw::GLuint m_po;
5205 glw::GLuint m_to;
5206 glw::GLuint m_vao;
5207
5208 /* Private static constants. */
5209 static const glw::GLchar* s_vertex_shader;
5210 static const glw::GLchar* s_fragment_shader_head;
5211 static const glw::GLchar* s_fragment_shader_1D_fdecl_lowp;
5212 static const glw::GLchar* s_fragment_shader_1D_idecl_lowp;
5213 static const glw::GLchar* s_fragment_shader_1D_udecl_lowp;
5214 static const glw::GLchar* s_fragment_shader_1D_fdecl_mediump;
5215 static const glw::GLchar* s_fragment_shader_1D_idecl_mediump;
5216 static const glw::GLchar* s_fragment_shader_1D_udecl_mediump;
5217 static const glw::GLchar* s_fragment_shader_1D_fdecl_highp;
5218 static const glw::GLchar* s_fragment_shader_1D_idecl_highp;
5219 static const glw::GLchar* s_fragment_shader_1D_udecl_highp;
5220 static const glw::GLchar* s_fragment_shader_2D_fdecl_lowp;
5221 static const glw::GLchar* s_fragment_shader_2D_idecl_lowp;
5222 static const glw::GLchar* s_fragment_shader_2D_udecl_lowp;
5223 static const glw::GLchar* s_fragment_shader_2D_fdecl_mediump;
5224 static const glw::GLchar* s_fragment_shader_2D_idecl_mediump;
5225 static const glw::GLchar* s_fragment_shader_2D_udecl_mediump;
5226 static const glw::GLchar* s_fragment_shader_2D_fdecl_highp;
5227 static const glw::GLchar* s_fragment_shader_2D_idecl_highp;
5228 static const glw::GLchar* s_fragment_shader_2D_udecl_highp;
5229 static const glw::GLchar* s_fragment_shader_3D_fdecl_lowp;
5230 static const glw::GLchar* s_fragment_shader_3D_idecl_lowp;
5231 static const glw::GLchar* s_fragment_shader_3D_udecl_lowp;
5232 static const glw::GLchar* s_fragment_shader_3D_fdecl_mediump;
5233 static const glw::GLchar* s_fragment_shader_3D_idecl_mediump;
5234 static const glw::GLchar* s_fragment_shader_3D_udecl_mediump;
5235 static const glw::GLchar* s_fragment_shader_3D_fdecl_highp;
5236 static const glw::GLchar* s_fragment_shader_3D_idecl_highp;
5237 static const glw::GLchar* s_fragment_shader_3D_udecl_highp;
5238 static const glw::GLchar* s_fragment_shader_1D_tail;
5239 static const glw::GLchar* s_fragment_shader_2D_tail;
5240 static const glw::GLchar* s_fragment_shader_3D_tail;
5241 };
5242 /* StorageAndSubImageTest class */
5243
5244 /** class StorageMultisampleTest
5245 *
5246 * @tparam T Type.
5247 * @tparam S Size.
5248 * @tparam N Is normalized.
5249 * @tparam D Texture dimension.
5250 *
5251 * Make test for following DSA functions:
5252 * - TextureStorage2DMultisample and
5253 * - TextureStorage3DMultisample.
5254 *
5255 * Test following internal formats:
5256 * - R8,
5257 * - R16,
5258 * - R16F,
5259 * - R32F,
5260 * - R8I,
5261 * - R16I,
5262 * - R32I,
5263 * - R8UI,
5264 * - R16UI,
5265 * - R32UI,
5266 * - RG8,
5267 * - RG16,
5268 * - RG16F,
5269 * - RG32F,
5270 * - RG8I,
5271 * - RG16I,
5272 * - RG32I,
5273 * - RG8UI,
5274 * - RG16UI,
5275 * - RG32UI,
5276 * - RGB32F,
5277 * - RGB32I,
5278 * - RGB32UI,
5279 * - RGBA8,
5280 * - RGBA16,
5281 * - RGBA16F,
5282 * - RGBA32F,
5283 * - RGBA8I,
5284 * - RGBA16I,
5285 * - RGBA32I,
5286 * - RGBA8UI,
5287 * - RGBA16UI,
5288 * - RGBA32UI.
5289 *
5290 * Create multisample texture and prepare its storage with the tested
5291 * function. The texture dimensions shall be 2x3x4 texels in corresponding
5292 * directions (if available) and two samples per texel.
5293 *
5294 * Prepare two framebuffers. The first one with the multisample texture
5295 * as a color attachment with size 2x3 pixels and 4 color attachments
5296 * (layers). The second one with non-multisample renderbuffer storage
5297 * similar in size.
5298 *
5299 * Prepare GLSL program which draws explicitly reference data to
5300 * multisample texture framebuffer.
5301 *
5302 * Use program to draw the reference data into multisample texture.
5303 *
5304 * Prepare second GLSL program with fragment shader which passes samples of
5305 * the input texture to the separate framebuffer pixels.
5306 *
5307 * Use the second program to draw the multisample texture into
5308 * renderbuffer.
5309 *
5310 * Fetch framebuffer data and compare with the reference values. Expect
5311 * equality.
5312 *
5313 * Release all objects.
5314 */
5315 template <typename T, glw::GLint S, bool N, glw::GLuint D>
5316 class StorageMultisampleTest : public deqp::TestCase, Reference
5317 {
5318 public:
5319 /* Public member functions. */
5320 StorageMultisampleTest(deqp::Context& context, const char *name);
5321
5322 virtual tcu::TestNode::IterateResult iterate();
5323
5324 private:
5325 /* Private constructors. */
5326 StorageMultisampleTest(const StorageMultisampleTest& other);
5327 StorageMultisampleTest& operator=(const StorageMultisampleTest& other);
5328
5329 /* Private member functions. */
5330 static glw::GLuint TestReferenceDataCount();
5331
5332 static glw::GLuint TestReferenceDataWidth();
5333
5334 static glw::GLuint TestReferenceDataHeight();
5335
5336 static glw::GLuint TestReferenceDataDepth();
5337
5338 static glw::GLuint TestReferenceDataSize();
5339
5340 static const glw::GLchar* FragmentShaderDeclarationMultisample();
5341
5342 static const glw::GLchar* FragmentShaderDeclarationAuxiliary();
5343
5344 static const glw::GLchar* FragmentShaderTail();
5345
5346 static glw::GLenum InputTextureTarget();
5347
5348 static glw::GLenum MultisampleTextureTarget();
5349
5350 void InputTextureImage(const glw::GLenum internal_format, const glw::GLuint width, const glw::GLuint height,
5351 const glw::GLuint depth, const glw::GLenum format, const glw::GLenum type,
5352 const glw::GLvoid* data);
5353
5354 void CreateInputTexture();
5355
5356 bool Check();
5357
5358 bool Test();
5359
5360 bool PrepareFramebufferMultisample(const glw::GLenum internal_format);
5361
5362 void PrepareFramebufferAuxiliary(const glw::GLenum internal_format);
5363
5364 glw::GLuint PrepareProgram(const glw::GLchar* variable_declaration, const glw::GLchar* tail);
5365 void PrepareVertexArray();
5366
5367 void Draw();
5368
5369 void CleanInputTexture();
5370 void CleanAuxiliaryTexture();
5371 void CleanFramebuffers();
5372 void CleanPrograms();
5373 void CleanErrors();
5374 void CleanVertexArray();
5375
5376 /* Private member variables. */
5377 glw::GLuint m_fbo_ms;
5378 glw::GLuint m_fbo_aux;
5379 glw::GLuint m_to_ms;
5380 glw::GLuint m_po_ms;
5381 glw::GLuint m_po_aux;
5382 glw::GLuint m_to;
5383 glw::GLuint m_to_aux;
5384 glw::GLuint m_vao;
5385
5386 /* Private static constants. */
5387 static const glw::GLchar* s_vertex_shader;
5388 static const glw::GLchar* s_fragment_shader_head;
5389 static const glw::GLchar* s_fragment_shader_ms_2D_fdecl_lowp;
5390 static const glw::GLchar* s_fragment_shader_ms_2D_idecl_lowp;
5391 static const glw::GLchar* s_fragment_shader_ms_2D_udecl_lowp;
5392 static const glw::GLchar* s_fragment_shader_ms_2D_fdecl_mediump;
5393 static const glw::GLchar* s_fragment_shader_ms_2D_idecl_mediump;
5394 static const glw::GLchar* s_fragment_shader_ms_2D_udecl_mediump;
5395 static const glw::GLchar* s_fragment_shader_ms_2D_fdecl_highp;
5396 static const glw::GLchar* s_fragment_shader_ms_2D_idecl_highp;
5397 static const glw::GLchar* s_fragment_shader_ms_2D_udecl_highp;
5398
5399 static const glw::GLchar* s_fragment_shader_ms_3D_fdecl_lowp;
5400 static const glw::GLchar* s_fragment_shader_ms_3D_idecl_lowp;
5401 static const glw::GLchar* s_fragment_shader_ms_3D_udecl_lowp;
5402 static const glw::GLchar* s_fragment_shader_ms_3D_fdecl_mediump;
5403 static const glw::GLchar* s_fragment_shader_ms_3D_idecl_mediump;
5404 static const glw::GLchar* s_fragment_shader_ms_3D_udecl_mediump;
5405 static const glw::GLchar* s_fragment_shader_ms_3D_fdecl_highp;
5406 static const glw::GLchar* s_fragment_shader_ms_3D_idecl_highp;
5407 static const glw::GLchar* s_fragment_shader_ms_3D_udecl_highp;
5408
5409 static const glw::GLchar* s_fragment_shader_aux_2D_fdecl_lowp;
5410 static const glw::GLchar* s_fragment_shader_aux_2D_idecl_lowp;
5411 static const glw::GLchar* s_fragment_shader_aux_2D_udecl_lowp;
5412 static const glw::GLchar* s_fragment_shader_aux_2D_fdecl_mediump;
5413 static const glw::GLchar* s_fragment_shader_aux_2D_idecl_mediump;
5414 static const glw::GLchar* s_fragment_shader_aux_2D_udecl_mediump;
5415 static const glw::GLchar* s_fragment_shader_aux_2D_fdecl_highp;
5416 static const glw::GLchar* s_fragment_shader_aux_2D_idecl_highp;
5417 static const glw::GLchar* s_fragment_shader_aux_2D_udecl_highp;
5418
5419 static const glw::GLchar* s_fragment_shader_aux_3D_fdecl_lowp;
5420 static const glw::GLchar* s_fragment_shader_aux_3D_idecl_lowp;
5421 static const glw::GLchar* s_fragment_shader_aux_3D_udecl_lowp;
5422 static const glw::GLchar* s_fragment_shader_aux_3D_fdecl_mediump;
5423 static const glw::GLchar* s_fragment_shader_aux_3D_idecl_mediump;
5424 static const glw::GLchar* s_fragment_shader_aux_3D_udecl_mediump;
5425 static const glw::GLchar* s_fragment_shader_aux_3D_fdecl_highp;
5426 static const glw::GLchar* s_fragment_shader_aux_3D_idecl_highp;
5427 static const glw::GLchar* s_fragment_shader_aux_3D_udecl_highp;
5428 static const glw::GLchar* s_fragment_shader_tail_2D;
5429 static const glw::GLchar* s_fragment_shader_tail_3D;
5430 };
5431 /* StorageMultisampleTest class */
5432
5433 /** @class CompressedSubImage
5434 *
5435 * Make test for following DSA functions:
5436 * - CompressedTextureSubImage1D,
5437 * - CompressedTextureSubImage2D,
5438 * - CompressedTextureSubImage3D.
5439 *
5440 * Make test for following uncompressed internal formats:
5441 * - R8,
5442 * - R8_SNORM,
5443 * - R16,
5444 * - R16_SNORM,
5445 * - RG8,
5446 * - RG8_SNORM,
5447 * - RG16,
5448 * - RG16_SNORM,
5449 * - R3_G3_B2,
5450 * - RGB4,
5451 * - RGB5,
5452 * - RGB8,
5453 * - RGB8_SNORM,
5454 * - RGB10,
5455 * - RGB12,
5456 * - RGB16_SNORM,
5457 * - RGBA2,
5458 * - RGBA4,
5459 * - RGB5_A1,
5460 * - RGBA8,
5461 * - RGBA8_SNORM,
5462 * - RGB10_A2,
5463 * - RGB10_A2UI,
5464 * - RGBA12,
5465 * - RGBA16,
5466 * - SRGB8,
5467 * - SRGB8_ALPHA8,
5468 * - R16F,
5469 * - RG16F,
5470 * - RGB16F,
5471 * - RGBA16F,
5472 * - R32F,
5473 * - RG32F,
5474 * - RGB32F,
5475 * - RGBA32F,
5476 * - R11F_G11F_B10F,
5477 * - RGB9_E5,
5478 * - R8I,
5479 * - R8UI,
5480 * - R16I,
5481 * - R16UI,
5482 * - R32I,
5483 * - R32UI,
5484 * - RG8I,
5485 * - RG8UI,
5486 * - RG16I,
5487 * - RG16UI,
5488 * - RG32I,
5489 * - RG32UI,
5490 * - RGB8I,
5491 * - RGB8UI,
5492 * - RGB16I,
5493 * - RGB16UI,
5494 * - RGB32I,
5495 * - RGB32UI,
5496 * - RGBA8I,
5497 * - RGBA8UI,
5498 * - RGBA16I,
5499 * - RGBA16UI,
5500 * - RGBA32I,
5501 * - RGBA32UI.
5502 * and compressed internal formats:
5503 * - COMPRESSED_RGBA8_ETC2_EAC.
5504 *
5505 * Create texture and setup its storage and data using tested function with
5506 * size 2x3 pixels.
5507 *
5508 * Prepare framebuffer with renderbuffer color attachment with floating
5509 * point internal format and with size 2x3 pixels
5510 *
5511 * Prepare GLSL program with fragment shader which passes input texture to
5512 * the framebuffer.
5513 *
5514 * Draw a full screen quad with the prepared texture, program and
5515 * framebuffer. Read the framebuffer content. Compare framebuffer's values
5516 * with the reference values. Take normalization and precision into
5517 * account. Expect equality.
5518 *
5519 * Release all objects.
5520 */
5521 class CompressedSubImageTest : public deqp::TestCase
5522 {
5523 public:
5524 /* Public member functions. */
5525 CompressedSubImageTest(deqp::Context& context);
5526
5527 virtual tcu::TestNode::IterateResult iterate();
5528
5529 private:
5530 /* Private constructors. */
5531 CompressedSubImageTest(const CompressedSubImageTest& other);
5532 CompressedSubImageTest& operator=(const CompressedSubImageTest& other);
5533
5534 void CreateTextures(glw::GLenum target);
5535
5536 template <glw::GLuint D>
5537 glw::GLenum TextureTarget();
5538
5539 template <glw::GLuint D>
5540 bool TextureImage(glw::GLint internalformat);
5541
5542 template <glw::GLuint D>
5543 void CompressedTexImage(glw::GLint internalformat);
5544
5545 template <glw::GLuint D>
5546 bool CompressedTextureSubImage(glw::GLint internalformat);
5547
5548 template <glw::GLuint D>
5549 bool PrepareReferenceData(glw::GLenum internalformat);
5550
5551 template <glw::GLuint D>
5552 void PrepareStorage(glw::GLenum internalformat);
5553
5554 template <glw::GLuint D>
5555 void PrepareCompressedStorage(glw::GLenum internalformat);
5556
5557 template <glw::GLuint D>
5558 bool CheckData(glw::GLenum internalformat);
5559 void CleanAll();
5560 std::string DataToString(glw::GLuint count, const glw::GLubyte data[]);
5561
5562 template <glw::GLuint D>
5563 bool Test(glw::GLenum internalformat, bool can_be_unsupported);
5564
5565 /* Private member variables. */
5566 glw::GLuint m_to;
5567 glw::GLuint m_to_aux;
5568 glw::GLubyte* m_compressed_texture_data;
5569 glw::GLubyte* m_reference;
5570 glw::GLubyte* m_result;
5571 glw::GLuint m_reference_size;
5572 glw::GLuint m_reference_internalformat;
5573
5574 /* Private static constants. */
5575 static const glw::GLubyte s_texture_data[];
5576 static const glw::GLuint s_texture_width;
5577 static const glw::GLuint s_texture_height;
5578 static const glw::GLuint s_texture_depth;
5579 static const glw::GLuint s_block_count;
5580 static const glw::GLuint s_block_2d_size_x;
5581 static const glw::GLuint s_block_2d_size_y;
5582 static const glw::GLuint s_block_3d_size;
5583 };
5584 /* CompressedSubImageTest class */
5585
5586 /** @class CopyTest
5587 *
5588 * Make test for following DSA functions:
5589 * - CopyTextureSubImage1D,
5590 * - CopyTextureSubImage2D and
5591 * - CopyTextureSubImage3D.
5592 *
5593 * Prepare two textures 2x3x4 texels in size for corresponding directions
5594 * (if available). Setup the first one with reference data.
5595 *
5596 * Prepare framebuffer with the first texture attached to the a color
5597 * attachment point. Bind the framebuffer.
5598 *
5599 * Copy framebuffer content to the texture using tested function. The
5600 * images shall be copied in ranges, two per direction (to test offsets,
5601 * positions and size variables). For 3D textures copy each layer
5602 * substituting the framebuffer attachment.
5603 *
5604 * After the copy fetch texture data and compare it with the reference
5605 * values. Expect equality.
5606 *
5607 * Release all objects.
5608 */
5609 class CopyTest : public deqp::TestCase
5610 {
5611 public:
5612 /* Public member functions. */
5613 CopyTest(deqp::Context& context);
5614
5615 virtual tcu::TestNode::IterateResult iterate();
5616
5617 private:
5618 /* Private constructors. */
5619 CopyTest(const CopyTest& other);
5620 CopyTest& operator=(const CopyTest& other);
5621
5622 /* Private member functions. */
5623 template <glw::GLuint D>
5624 glw::GLenum TextureTarget();
5625
5626 bool CopyTextureSubImage1DAndCheckErrors(glw::GLuint texture, glw::GLint level, glw::GLint xoffset, glw::GLint x,
5627 glw::GLint y, glw::GLsizei width);
5628 bool CopyTextureSubImage2DAndCheckErrors(glw::GLuint texture, glw::GLint level, glw::GLint xoffset,
5629 glw::GLint yoffset, glw::GLint x, glw::GLint y, glw::GLsizei width,
5630 glw::GLsizei height);
5631 bool CopyTextureSubImage3DAndCheckErrors(glw::GLuint texture, glw::GLint level, glw::GLint xoffset,
5632 glw::GLint yoffset, glw::GLint zoffset, glw::GLint x, glw::GLint y,
5633 glw::GLsizei width, glw::GLsizei height);
5634
5635 template <glw::GLuint D>
5636 void CreateSourceTexture();
5637
5638 template <glw::GLuint D>
5639 void CreateDestinationTexture();
5640
5641 template <glw::GLuint D>
5642 void CreateSourceFramebuffer();
5643
5644 template <glw::GLuint D>
5645 void CreateAll();
5646
5647 template <glw::GLuint D>
5648 bool Test();
5649
5650 bool CheckData(glw::GLenum target, glw::GLuint size);
5651 std::string DataToString(glw::GLuint count, const glw::GLubyte data[]);
5652 void CleanAll();
5653
5654 /* Private member variables. */
5655 glw::GLuint m_fbo;
5656 glw::GLuint m_to_src;
5657 glw::GLuint m_to_dst;
5658 glw::GLubyte* m_result;
5659
5660 /* Private static constants. */
5661 static const glw::GLubyte s_texture_data[];
5662 static const glw::GLuint s_texture_width;
5663 static const glw::GLuint s_texture_height;
5664 static const glw::GLuint s_texture_depth;
5665 };
5666 /* CopyTest class */
5667
5668 /** @class GetSetParameterTest
5669 *
5670 * Do following:
5671 * Prepare texture object.
5672 *
5673 * Prepare the following test case.
5674 *
5675 * Prepare test case which sets a parameter to the desired value using
5676 * one of the following functions (depending on the parameter type):
5677 * - TextureParameterf,
5678 * - TextureParameterfv,
5679 * - TextureParameteri,
5680 * - TextureParameterIiv,
5681 * - TextureParameterIuiv,
5682 * - TextureParameteriv.
5683 *
5684 * Read back the texture parameter using one of the DSA-like functions
5685 * - GetTextureParameterfv,
5686 * - GetTextureParameteriv,
5687 * - GetTextureParameterIiv,
5688 * - GetTextureParameterIuiv.
5689 * Expect equality.
5690 *
5691 * Run the test case for following parameters and values:
5692 * - parameter DEPTH_STENCIL_TEXTURE_MODE with value DEPTH_COMPONENT;
5693 * - parameter TEXTURE_BASE_LEVEL with value 2;
5694 * - parameter TEXTURE_BORDER_COLOR with value {0.25, 0.5, 0.75, 1.0}
5695 * - parameter TEXTURE_COMPARE_FUNC with value LEQUAL;
5696 * - parameter TEXTURE_COMPARE_MODE with value COMPARE_REF_TO_TEXTURE;
5697 * - parameter TEXTURE_LOD_BIAS with value -2.0 (which is
5698 * minimum required implementation maximum value);
5699 * - parameter TEXTURE_MIN_FILTER with value LINEAR_MIPMAP_NEAREST;
5700 * - parameter TEXTURE_MAG_FILTER with value NEAREST;
5701 * - parameter TEXTURE_MIN_LOD with value -100;
5702 * - parameter TEXTURE_MAX_LOD with value 100;
5703 * - parameter TEXTURE_MAX_LEVEL with value 100;
5704 * - parameter TEXTURE_SWIZZLE_R with value BLUE;
5705 * - parameter TEXTURE_SWIZZLE_G with value ALPHA;
5706 * - parameter TEXTURE_SWIZZLE_B with value RED;
5707 * - parameter TEXTURE_SWIZZLE_A with value GREEN;
5708 * - parameter TEXTURE_SWIZZLE_RGBA with value { ZERO, ONE, ZERO, ONE };
5709 * - parameter TEXTURE_WRAP_S with value MIRROR_CLAMP_TO_EDGE;
5710 * - parameter TEXTURE_WRAP_T with value CLAMP_TO_EDGE;
5711 * - parameter TEXTURE_WRAP_R with value CLAMP_TO_EDGE.
5712 *
5713 * Release the texture object.
5714 */
5715 class GetSetParameterTest : public deqp::TestCase
5716 {
5717 public:
5718 /* Public member functions. */
5719 GetSetParameterTest(deqp::Context& context);
5720
5721 virtual tcu::TestNode::IterateResult iterate();
5722
5723 private:
5724 /* Private constructors. */
5725 GetSetParameterTest(const GetSetParameterTest& other);
5726 GetSetParameterTest& operator=(const GetSetParameterTest& other);
5727
5728 bool CheckErrorAndLog(const glw::GLchar* fname, glw::GLenum pname);
5729 bool CompareAndLog(glw::GLint value_src, glw::GLint value_dst, glw::GLenum pname);
5730 bool CompareAndLog(glw::GLuint value_src, glw::GLuint value_dst, glw::GLenum pname);
5731 bool CompareAndLog(glw::GLfloat value_src, glw::GLfloat value_dst, glw::GLenum pname);
5732 bool CompareAndLog(glw::GLfloat value_src[4], glw::GLfloat value_dst[4], glw::GLenum pname);
5733 bool CompareAndLog(glw::GLint value_src[4], glw::GLint value_dst[4], glw::GLenum pname);
5734 bool CompareAndLog(glw::GLuint value_src[4], glw::GLuint value_dst[4], glw::GLenum pname);
5735 };
5736 /* GetSetParameterTest class */
5737
5738 /** @class DefaultsTest
5739 *
5740 * Create texture object with CreateTextures. Do not bind it.
5741 *
5742 * Using one of the functions
5743 * - GetTextureParameterfv,
5744 * - GetTextureParameteriv,
5745 * - GetTextureParameterIiv,
5746 * - GetTextureParameterIuiv
5747 * check that initial object parameter values are set to the following
5748 * defaults:
5749 * - for parameter DEPTH_STENCIL_TEXTURE_MODE initial value is
5750 * DEPTH_COMPONENT;
5751 * - for parameter TEXTURE_BASE_LEVEL initial value is 0;
5752 * - for parameter TEXTURE_BORDER_COLOR initial value is {0.0, 0.0, 0.0,
5753 * 0.0};
5754 * - for parameter TEXTURE_COMPARE_FUNC initial value is LEQUAL;
5755 * - for parameter TEXTURE_COMPARE_MODE initial value is NONE;
5756 * - for parameter TEXTURE_LOD_BIAS initial value is 0.0;
5757 * - for parameter TEXTURE_MIN_FILTER initial value is
5758 * NEAREST_MIPMAP_LINEAR;
5759 * - for parameter TEXTURE_MAG_FILTER initial value is LINEAR;
5760 * - for parameter TEXTURE_MIN_LOD initial value is -1000;
5761 * - for parameter TEXTURE_MAX_LOD initial value is 1000;
5762 * - for parameter TEXTURE_MAX_LEVEL initial value is 1000;
5763 * - for parameter TEXTURE_SWIZZLE_R initial value is RED;
5764 * - for parameter TEXTURE_SWIZZLE_G initial value is GREEN;
5765 * - for parameter TEXTURE_SWIZZLE_B initial value is BLUE;
5766 * - for parameter TEXTURE_SWIZZLE_A initial value is ALPHA;
5767 * - for parameter TEXTURE_WRAP_S initial value is REPEAT;
5768 * - for parameter TEXTURE_WRAP_T initial value is REPEAT;
5769 * - for parameter TEXTURE_WRAP_R initial value is REPEAT.
5770 */
5771 class DefaultsTest : public deqp::TestCase
5772 {
5773 public:
5774 /* Public member functions. */
5775 DefaultsTest(deqp::Context& context);
5776
5777 virtual tcu::TestNode::IterateResult iterate();
5778
5779 private:
5780 /* Private constructors. */
5781 DefaultsTest(const DefaultsTest& other);
5782 DefaultsTest& operator=(const DefaultsTest& other);
5783
5784 bool CompareAndLog(glw::GLint value_ref, glw::GLint value_dst, glw::GLenum pname);
5785 bool CompareAndLog(glw::GLuint value_ref, glw::GLuint value_dst, glw::GLenum pname);
5786 bool CompareAndLog(glw::GLfloat value_ref, glw::GLfloat value_dst, glw::GLenum pname);
5787 bool CompareAndLog(glw::GLfloat value_ref[4], glw::GLfloat value_dst[4], glw::GLenum pname);
5788 bool CompareAndLog(glw::GLint value_ref[4], glw::GLint value_dst[4], glw::GLenum pname);
5789 bool CompareAndLog(glw::GLuint value_ref[4], glw::GLuint value_dst[4], glw::GLenum pname);
5790 };
5791 /* DefaultsTest class */
5792
5793 /** @class GenerateMipmapTest
5794 *
5795 * Create one dimensional texture. Setup its image data with successive
5796 * numbers {0..255} stored as red color.
5797 *
5798 * Generate mipmaps for the texture using GenerateTextureMipmap function.
5799 *
5800 * Download each of the generated mipmap levels. Check that each of the
5801 * mipmaps contains series of not decreasing values.
5802 *
5803 * Release texture object.
5804 */
5805 class GenerateMipmapTest : public deqp::TestCase
5806 {
5807 public:
5808 /* Public member functions. */
5809 GenerateMipmapTest(deqp::Context& context);
5810
5811 virtual tcu::TestNode::IterateResult iterate();
5812
5813 private:
5814 /* Private constructors. */
5815 GenerateMipmapTest(const GenerateMipmapTest& other);
5816 GenerateMipmapTest& operator=(const GenerateMipmapTest& other);
5817
5818 /* Private static constants. */
5819 static const glw::GLubyte s_texture_data[];
5820 static const glw::GLuint s_texture_width;
5821 static const glw::GLuint s_texture_width_log;
5822 };
5823 /* GenerateMipmapTest class */
5824
5825 /** @class BindUnitTest
5826 *
5827 * Create four 2D textures, filled with 2x3 texels of reference data in RED
5828 * format and R8 internal format.
5829 *
5830 * Create framebuffer 2x3 pixels of size with the same internal format as
5831 * textures but RGBA format.
5832 *
5833 * Bind each texture to the separate unit using BindTextureUnit function.
5834 *
5835 * Prepare GLSL program which draws full screen quad. A fragment shader of
5836 * the program shall pass each of the four input texture red values into
5837 * separate RGBA channel of the output framebuffer.
5838 *
5839 * Make a draw call with prepared objects.
5840 *
5841 * Fetch framebuffer data. Expect interleaved reference data.
5842 *
5843 * Release all objects.
5844 */
5845 class BindUnitTest : public deqp::TestCase
5846 {
5847 public:
5848 /* Public member functions. */
5849 BindUnitTest(deqp::Context& context);
5850
5851 virtual tcu::TestNode::IterateResult iterate();
5852
5853 private:
5854 /* Private constructors. */
5855 BindUnitTest(const BindUnitTest& other);
5856 BindUnitTest& operator=(const BindUnitTest& other);
5857
5858 void CreateProgram();
5859 void CreateTextures();
5860 void CreateFrambuffer();
5861 void CreateVertexArray();
5862 bool Draw();
5863 bool Check();
5864 void CleanAll();
5865 std::string DataToString(glw::GLuint count, const glw::GLubyte data[]);
5866
5867 /* Private member variables. */
5868 glw::GLuint m_po;
5869 glw::GLuint m_to[4];
5870 glw::GLuint m_fbo;
5871 glw::GLuint m_rbo;
5872 glw::GLuint m_vao;
5873 glw::GLubyte* m_result;
5874
5875 /* Private static constants. */
5876 static const glw::GLubyte s_texture_data_r[];
5877 static const glw::GLubyte s_texture_data_g[];
5878 static const glw::GLubyte s_texture_data_b[];
5879 static const glw::GLubyte s_texture_data_a[];
5880 static const glw::GLubyte s_texture_data_rgba[];
5881 static const glw::GLuint s_texture_width;
5882 static const glw::GLuint s_texture_height;
5883 static const glw::GLuint s_texture_count_rgba;
5884 static const glw::GLchar* s_vertex_shader;
5885 static const glw::GLchar* s_fragment_shader;
5886 static const glw::GLchar* s_fragment_shader_samplers[4];
5887 };
5888 /* GenerateMipmapTest class */
5889
5890 /** @class GetImageTest
5891 *
5892 * Make test for following DSA functions:
5893 * - GetTextureImage,
5894 * - GetCompressedTextureImage.
5895 *
5896 * Create two 2D textures, one with compressed reference image, one with
5897 * uncompressed reference image.
5898 *
5899 * Fetch textures with corresponding test functions. Compare fetched values
5900 * with the reference data. Expect equality.
5901 *
5902 * Release textures.
5903 */
5904 class GetImageTest : public deqp::TestCase
5905 {
5906 public:
5907 /* Public member functions. */
5908 GetImageTest(deqp::Context& context);
5909
5910 virtual tcu::TestNode::IterateResult iterate();
5911
5912 private:
5913 /* Private constructors. */
5914 GetImageTest(const GetImageTest& other);
5915 GetImageTest& operator=(const GetImageTest& other);
5916
5917 std::string DataToString(glw::GLuint count, const glw::GLubyte data[]);
5918
5919 /* Private static constants. */
5920 static const glw::GLubyte s_texture_data[];
5921 static const glw::GLubyte s_texture_data_compressed[];
5922 static const glw::GLuint s_texture_width;
5923 static const glw::GLuint s_texture_height;
5924 static const glw::GLuint s_texture_size;
5925 static const glw::GLuint s_texture_size_compressed;
5926 static const glw::GLuint s_texture_count;
5927 static const glw::GLuint s_texture_count_compressed;
5928 };
5929 /* GetImageTest class */
5930
5931 /** @class GetLevelParameterTest
5932 *
5933 * Make test for following DSA functions:
5934 * - GetTextureLevelParameterfv,
5935 * - GetTextureLevelParameteriv.
5936 *
5937 * Create 3D texture with two levels of detail.
5938 *
5939 * Fetch following parameters with test functions:
5940 * - TEXTURE_WIDTH,
5941 * - TEXTURE_HEIGHT,
5942 * - TEXTURE_DEPTH,
5943 * - TEXTURE_INTERNAL_FORMAT,
5944 * - TEXTURE_RED_TYPE,
5945 * - TEXTURE_GREEN_TYPE,
5946 * - TEXTURE_BLUE_TYPE,
5947 * - TEXTURE_ALPHA_TYPE,
5948 * - TEXTURE_DEPTH_TYPE,
5949 * - TEXTURE_RED_SIZE,
5950 * - TEXTURE_GREEN_SIZE,
5951 * - TEXTURE_BLUE_SIZE,
5952 * - TEXTURE_ALPHA_SIZE,
5953 * - TEXTURE_DEPTH_SIZE and
5954 * - TEXTURE_COMPRESSED
5955 * and compare values with expected set.
5956 *
5957 * Release texture.
5958 */
5959 class GetLevelParameterTest : public deqp::TestCase
5960 {
5961 public:
5962 /* Public member functions. */
5963 GetLevelParameterTest(deqp::Context& context);
5964
5965 virtual tcu::TestNode::IterateResult iterate();
5966
5967 private:
5968 /* Private constructors. */
5969 GetLevelParameterTest(const GetLevelParameterTest& other);
5970 GetLevelParameterTest& operator=(const GetLevelParameterTest& other);
5971
5972 /* Private static constants. */
5973 static const glw::GLubyte s_texture_data[];
5974 static const glw::GLuint s_texture_width;
5975 static const glw::GLuint s_texture_height;
5976 static const glw::GLuint s_texture_depth;
5977 };
5978 /* GetLevelParameterTest class */
5979
5980 /** @class ErrorsUtilities
5981 *
5982 * This class contain utility methods for all negative tests.
5983 */
5984 class ErrorsUtilities
5985 {
5986 public:
5987 bool CheckErrorAndLog(deqp::Context& context, glw::GLuint expected_error, const glw::GLchar* function_name,
5988 const glw::GLchar* log);
5989 };
5990 /* ErrorsUtilities */
5991
5992 /** @class CreationErrorsTest
5993 *
5994 * Check that INVALID_ENUM is generated if target is not one of the
5995 * allowable values.
5996 *
5997 * Check that INVALID_VALUE is generated if n is negative.
5998 */
5999 class CreationErrorsTest : public deqp::TestCase, ErrorsUtilities
6000 {
6001 public:
6002 /* Public member functions. */
6003 CreationErrorsTest(deqp::Context& context);
6004
6005 virtual tcu::TestNode::IterateResult iterate();
6006
6007 private:
6008 /* Private constructors. */
6009 CreationErrorsTest(const CreationErrorsTest& other);
6010 CreationErrorsTest& operator=(const CreationErrorsTest& other);
6011
6012 glw::GLenum NotATarget();
6013 };
6014 /* CreationErrorsTest class */
6015
6016 /** @class BufferErrorsTest
6017 *
6018 * Check that INVALID_OPERATION is generated by glTextureBuffer if texture
6019 * is not the name of an existing texture object.
6020 *
6021 * Check that INVALID_ENUM is generated by glTextureBuffer if the effective
6022 * target of texture is not TEXTURE_BUFFER.
6023 *
6024 * Check that INVALID_ENUM is generated if internalformat is not one of the
6025 * sized internal formats described above.
6026 *
6027 * Check that INVALID_OPERATION is generated if buffer is not zero and is
6028 * not the name of an existing buffer object.
6029 */
6030 class BufferErrorsTest : public deqp::TestCase, ErrorsUtilities
6031 {
6032 public:
6033 /* Public member functions. */
6034 BufferErrorsTest(deqp::Context& context);
6035
6036 virtual tcu::TestNode::IterateResult iterate();
6037
6038 private:
6039 /* Private constructors. */
6040 BufferErrorsTest(const BufferErrorsTest& other);
6041 BufferErrorsTest& operator=(const BufferErrorsTest& other);
6042 };
6043 /* BufferErrorsTest class */
6044
6045 /** @class BufferRangeErrorsTest
6046 *
6047 * Check that INVALID_OPERATION is generated by TextureBufferRange if
6048 * texture is not the name of an existing texture object.
6049 *
6050 * Check that INVALID_ENUM is generated by TextureBufferRange if the
6051 * effective target of texture is not TEXTURE_BUFFER.
6052 *
6053 * Check that INVALID_ENUM is generated by TextureBufferRange if
6054 * internalformat is not one of the sized internal formats described above.
6055 *
6056 * Check that INVALID_OPERATION is generated by TextureBufferRange if
6057 * buffer is not zero and is not the name of an existing buffer object.
6058 *
6059 * Check that INVALID_VALUE is generated by TextureBufferRange if offset
6060 * is negative, if size is less than or equal to zero, or if offset + size
6061 * is greater than the value of BUFFER_SIZE for buffer.
6062 *
6063 * Check that INVALID_VALUE is generated by TextureBufferRange if offset is
6064 * not an integer multiple of the value of TEXTURE_BUFFER_OFFSET_ALIGNMENT.
6065 */
6066 class BufferRangeErrorsTest : public deqp::TestCase, ErrorsUtilities
6067 {
6068 public:
6069 /* Public member functions. */
6070 BufferRangeErrorsTest(deqp::Context& context);
6071
6072 virtual tcu::TestNode::IterateResult iterate();
6073
6074 private:
6075 /* Private constructors. */
6076 BufferRangeErrorsTest(const BufferRangeErrorsTest& other);
6077 BufferRangeErrorsTest& operator=(const BufferRangeErrorsTest& other);
6078 };
6079 /* BufferErrorsTest class */
6080
6081 /** @class StorageErrorsTest
6082 *
6083 * Check that INVALID_OPERATION is generated by TextureStorage1D if texture
6084 * is not the name of an existing texture object.
6085 *
6086 * Check that INVALID_ENUM is generated by TextureStorage1D if
6087 * internalformat is not a valid sized internal format.
6088 *
6089 * Check that INVALID_ENUM is generated by TextureStorage1D if target or
6090 * the effective target of texture is not one of the accepted targets
6091 * described above.
6092 *
6093 * Check that INVALID_VALUE is generated by TextureStorage1D if width or
6094 * levels are less than 1.
6095 *
6096 * Check that INVALID_OPERATION is generated by TextureStorage1D if levels
6097 * is greater than log2(width)+1.
6098 *
6099 *
6100 * Check that INVALID_OPERATION is generated by TextureStorage2D if
6101 * texture is not the name of an existing texture object.
6102 *
6103 * Check that INVALID_ENUM is generated by TextureStorage2D if
6104 * internalformat is not a valid sized internal format.
6105 *
6106 * Check that INVALID_ENUM is generated by TextureStorage2D if target or
6107 * the effective target of texture is not one of the accepted targets
6108 * described above.
6109 *
6110 * Check that INVALID_VALUE is generated by TextureStorage2D if width,
6111 * height or levels are less than 1.
6112 *
6113 * Check that INVALID_OPERATION is generated by TextureStorage2D if target
6114 * is TEXTURE_1D_ARRAY or PROXY_TEXTURE_1D_ARRAY and levels is greater than
6115 * log2(width)+1.
6116 *
6117 * Check that INVALID_OPERATION is generated by TextureStorage2D if target
6118 * is not TEXTURE_1D_ARRAY or PROXY_TEXTURE_1D_ARRAY and levels is greater
6119 * than log2(max(width, height))+1.
6120 *
6121 *
6122 * Check that INVALID_OPERATION is generated by TextureStorage2DMultisample
6123 * if texture is not the name of an existing texture object.
6124 *
6125 * Check that INVALID_ENUM is generated by TextureStorage2DMultisample if
6126 * internalformat is not a valid color-renderable, depth-renderable or
6127 * stencil-renderable format.
6128 *
6129 * Check that INVALID_ENUM is generated by TextureStorage2DMultisample if
6130 * target or the effective target of texture is not one of the accepted
6131 * targets described above.
6132 *
6133 * Check that INVALID_VALUE is generated by TextureStorage2DMultisample if
6134 * width or height are less than 1 or greater than the value of
6135 * MAX_TEXTURE_SIZE.
6136 *
6137 *
6138 * Check that INVALID_VALUE is generated by TextureStorage2DMultisample if
6139 * samples is greater than the value of MAX_SAMPLES.
6140 *
6141 * Check that INVALID_OPERATION is generated by TextureStorage2DMultisample
6142 * if the value of TEXTURE_IMMUTABLE_FORMAT for the texture bound to target
6143 * is not FALSE.
6144 *
6145 *
6146 * Check that INVALID_OPERATION is generated by TextureStorage3D if texture
6147 * is not the name of an existing texture object.
6148 *
6149 * Check that INVALID_ENUM is generated by TextureStorage3D if
6150 * internalformat is not a valid sized internal format.
6151 *
6152 * Check that INVALID_ENUM is generated by TextureStorage3D if target or
6153 * the effective target of texture is not one of the accepted targets
6154 * described above.
6155 *
6156 * Check that INVALID_VALUE is generated by TextureStorage3D if width,
6157 * height, depth or levels are less than 1.
6158 *
6159 * Check that INVALID_OPERATION is generated by TextureStorage3D if target
6160 * is TEXTURE_3D or PROXY_TEXTURE_3D and levels is greater than
6161 * log2(max(width, height, depth))+1.
6162 *
6163 * Check that INVALID_OPERATION is generated by TextureStorage3D if target
6164 * is TEXTURE_2D_ARRAY, PROXY_TEXTURE_2D_ARRAY, TEXURE_CUBE_ARRAY,
6165 * or PROXY_TEXTURE_CUBE_MAP_ARRAY and levels is greater than
6166 * log2(max(width, height))+1.
6167 *
6168 *
6169 * Check that INVALID_OPERATION is generated by TextureStorage3DMultisample
6170 * if texture is not the name of an existing texture object.
6171 *
6172 * Check that INVALID_ENUM is generated by TextureStorage3DMultisample if
6173 * internalformat is not a valid color-renderable, depth-renderable or
6174 * stencil-renderable format.
6175 *
6176 * Check that INVALID_ENUM is generated by TextureStorage3DMultisample if
6177 * target or the effective target of texture is not one of the accepted
6178 * targets described above.
6179 *
6180 * Check that INVALID_VALUE is generated by TextureStorage3DMultisample if
6181 * width or height are less than 1 or greater than the value of
6182 * MAX_TEXTURE_SIZE.
6183 *
6184 * Check that INVALID_VALUE is generated by TextureStorage3DMultisample if
6185 * depth is less than 1 or greater than the value of
6186 * MAX_ARRAY_TEXTURE_LAYERS.
6187 *
6188 * Check that INVALID_VALUE is generated by TextureStorage3DMultisample if
6189 * samples is greater than the value of MAX_SAMPLES.
6190 *
6191 * Check that INVALID_OPERATION is generated by TextureStorage3DMultisample
6192 * if the value of TEXTURE_IMMUTABLE_FORMAT for the texture bound to
6193 * target is not FALSE.
6194 */
6195 class StorageErrorsTest : public deqp::TestCase, ErrorsUtilities
6196 {
6197 public:
6198 /* Public member functions. */
6199 StorageErrorsTest(deqp::Context& context);
6200
6201 virtual tcu::TestNode::IterateResult iterate();
6202
6203 private:
6204 /* Private constructors. */
6205 StorageErrorsTest(const StorageErrorsTest& other);
6206 StorageErrorsTest& operator=(const StorageErrorsTest& other);
6207
6208 glw::GLuint m_to_1D;
6209 glw::GLuint m_to_1D_array;
6210 glw::GLuint m_to_2D;
6211 glw::GLuint m_to_2D_array;
6212 glw::GLuint m_to_3D;
6213 glw::GLuint m_to_2D_ms;
6214 glw::GLuint m_to_2D_ms_immutable;
6215 glw::GLuint m_to_3D_ms;
6216 glw::GLuint m_to_3D_ms_immutable;
6217 glw::GLuint m_to_invalid;
6218 glw::GLuint m_internalformat_invalid;
6219 glw::GLint m_max_texture_size;
6220 glw::GLint m_max_samples;
6221 glw::GLint m_max_array_texture_layers;
6222
6223 void Prepare();
6224 bool Test1D();
6225 bool Test2D();
6226 bool Test3D();
6227 bool Test2DMultisample();
6228 bool Test3DMultisample();
6229 void Clean();
6230 };
6231 /* StorageErrorsTest class */
6232
6233 /** @class SubImageErrorsTest
6234 *
6235 * Check that INVALID_OPERATION is generated by TextureSubImage1D if
6236 * texture is not the name of an existing texture object.
6237 *
6238 * Check that INVALID_ENUM is generated by TextureSubImage1D if format is
6239 * not an accepted format constant.
6240 *
6241 * Check that INVALID_ENUM is generated by TextureSubImage1D if type is not
6242 * a type constant.
6243 *
6244 * Check that INVALID_VALUE is generated by TextureSubImage1D if level is
6245 * less than 0.
6246 *
6247 * Check that INVALID_VALUE may be generated by TextureSubImage1D if level
6248 * is greater than log2 max, where max is the returned value of
6249 * MAX_TEXTURE_SIZE.
6250 *
6251 * Check that INVALID_VALUE is generated by TextureSubImage1D if
6252 * xoffset<-b, or if (xoffset+width)>(w-b), where w is the TEXTURE_WIDTH,
6253 * and b is the width of the TEXTURE_BORDER of the texture image being
6254 * modified. Note that w includes twice the border width.
6255 * Check that INVALID_VALUE is generated by TextureSubImage1D if width is
6256 * less than 0.
6257 *
6258 * Check that INVALID_OPERATION is generated by TextureSubImage1D if type
6259 * is one of UNSIGNED_BYTE_3_3_2, UNSIGNED_BYTE_2_3_3_REV,
6260 * UNSIGNED_SHORT_5_6_5, or UNSIGNED_SHORT_5_6_5_REV and format is not RGB.
6261 *
6262 * Check that INVALID_OPERATION is generated by TextureSubImage1D if type
6263 * is one of UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_4_4_4_4_REV,
6264 * UNSIGNED_SHORT_5_5_5_1, UNSIGNED_SHORT_1_5_5_5_REV,
6265 * UNSIGNED_INT_8_8_8_8, UNSIGNED_INT_8_8_8_8_REV, UNSIGNED_INT_10_10_10_2,
6266 * or UNSIGNED_INT_2_10_10_10_REV and format is neither RGBA nor BGRA.
6267 *
6268 * Check that INVALID_OPERATION is generated by TextureSubImage1D if a
6269 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6270 * and the buffer object's data store is currently mapped.
6271 *
6272 * Check that INVALID_OPERATION is generated by TextureSubImage1D if a
6273 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6274 * and the data would be unpacked from the buffer object such that the
6275 * memory reads required would exceed the data store size.
6276 *
6277 * Check that INVALID_OPERATION is generated by TextureSubImage1D if a
6278 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6279 * and pixels is not evenly divisible into the number of bytes needed to
6280 * store in memory a datum indicated by type.
6281 *
6282 *
6283 * Check that INVALID_OPERATION is generated by TextureSubImage2D if
6284 * texture is not the name of an existing texture object.
6285 *
6286 * Check that INVALID_ENUM is generated by TextureSubImage2D if format is
6287 * not an accepted format constant.
6288 *
6289 * Check that INVALID_ENUM is generated if type is not a type constant.
6290 *
6291 * Check that INVALID_VALUE is generated by TextureSubImage2D if level is
6292 * less than 0.
6293 *
6294 * Check that INVALID_VALUE may be generated by TextureSubImage2D if level
6295 * is greater than log2 max, where max is the returned value of
6296 * MAX_TEXTURE_SIZE.
6297 * Check that INVALID_VALUE is generated by TextureSubImage2D if
6298 * xoffset<-b, (xoffset+width)>(w-b), yoffset<-b, or
6299 * (yoffset+height)>(h-b), where w is the TEXTURE_WIDTH, h is the
6300 * TEXTURE_HEIGHT, and b is the border width of the texture image being
6301 * modified. Note that w and h include twice the border width.
6302 * Check that INVALID_VALUE is generated by TextureSubImage2D if width or
6303 * height is less than 0.
6304 *
6305 * Check that INVALID_OPERATION is generated by TextureSubImage2D if type
6306 * is one of UNSIGNED_BYTE_3_3_2, UNSIGNED_BYTE_2_3_3_REV,
6307 * UNSIGNED_SHORT_5_6_5, or UNSIGNED_SHORT_5_6_5_REV and format is not RGB.
6308 *
6309 * Check that INVALID_OPERATION is generated by TextureSubImage2D if type
6310 * is one of UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_4_4_4_4_REV,
6311 * UNSIGNED_SHORT_5_5_5_1, UNSIGNED_SHORT_1_5_5_5_REV, UNSIGNED_INT_8_8_8_8,
6312 * UNSIGNED_INT_8_8_8_8_REV, UNSIGNED_INT_10_10_10_2, or
6313 * UNSIGNED_INT_2_10_10_10_REV and format is neither RGBA
6314 * nor BGRA.
6315 *
6316 * Check that INVALID_OPERATION is generated by TextureSubImage2D if a
6317 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6318 * and the buffer object's data store is currently mapped.
6319 *
6320 * Check that INVALID_OPERATION is generated by TextureSubImage2D if a
6321 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6322 * and the data would be unpacked from the buffer object such that the
6323 * memory reads required would exceed the data store size.
6324 *
6325 * Check that INVALID_OPERATION is generated by TextureSubImage2D if a
6326 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6327 * and pixels is not evenly divisible into the number of bytes needed to
6328 * store in memory a datum indicated by type.
6329 *
6330 *
6331 * Check that INVALID_OPERATION is generated by TextureSubImage3D if
6332 * texture is not the name of an existing texture object.
6333 *
6334 * Check that INVALID_ENUM is generated by TextureSubImage3D if format is
6335 * not an accepted format constant.
6336 *
6337 * Check that INVALID_ENUM is generated by TextureSubImage3D if type is
6338 * not a type constant.
6339 *
6340 * Check that INVALID_VALUE is generated by TextureSubImage3D if level
6341 * is less than 0.
6342 *
6343 * Check that INVALID_VALUE may be generated by TextureSubImage3D if level
6344 * is greater than log2 max, where max is the returned value of
6345 * MAX_TEXTURE_SIZE.
6346 *
6347 * Check that INVALID_VALUE is generated by TextureSubImage3D if
6348 * xoffset<-b, (xoffset+width)>(w-b), yoffset<-b, or
6349 * (yoffset+height)>(h-b), or zoffset<-b, or (zoffset+depth)>(d-b), where w
6350 * is the TEXTURE_WIDTH, h is the TEXTURE_HEIGHT, d is the TEXTURE_DEPTH
6351 * and b is the border width of the texture image being modified. Note
6352 * that w, h, and d include twice the border width.
6353 *
6354 * Check that INVALID_VALUE is generated by TextureSubImage3D if width,
6355 * height, or depth is less than 0.
6356 *
6357 * Check that INVALID_OPERATION is generated by TextureSubImage3D if type
6358 * is one of UNSIGNED_BYTE_3_3_2, UNSIGNED_BYTE_2_3_3_REV,
6359 * UNSIGNED_SHORT_5_6_5, or UNSIGNED_SHORT_5_6_5_REV and format is not RGB.
6360 *
6361 * Check that INVALID_OPERATION is generated by TextureSubImage3D if type
6362 * is one of UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_4_4_4_4_REV,
6363 * UNSIGNED_SHORT_5_5_5_1, UNSIGNED_SHORT_1_5_5_5_REV,
6364 * UNSIGNED_INT_8_8_8_8, UNSIGNED_INT_8_8_8_8_REV, UNSIGNED_INT_10_10_10_2,
6365 * or UNSIGNED_INT_2_10_10_10_REV and format is neither RGBA nor BGRA.
6366 *
6367 * Check that INVALID_OPERATION is generated by TextureSubImage3D if a
6368 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6369 * and the buffer object's data store is currently mapped.
6370 *
6371 * Check that INVALID_OPERATION is generated by TextureSubImage3D if a
6372 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6373 * and the data would be unpacked from the buffer object such that the
6374 * memory reads required would exceed the data store size.
6375 *
6376 * Check that INVALID_OPERATION is generated by TextureSubImage3D if a
6377 * non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER target
6378 * and pixels is not evenly divisible into the number of bytes needed to
6379 * store in memory a datum indicated by type.
6380 *
6381 *
6382 * Check that INVALID_ENUM is generated by CompressedTextureSubImage1D if
6383 * internalformat is not one of the generic compressed internal formats:
6384 * COMPRESSED_RED, COMPRESSED_RG, COMPRESSED_RGB, COMPRESSED_RGBA.
6385 * COMPRESSED_SRGB, or COMPRESSED_SRGB_ALPHA.
6386 *
6387 * Check that INVALID_VALUE is generated by CompressedTextureSubImage1D if
6388 * imageSize is not consistent with the format, dimensions, and contents of
6389 * the specified compressed image data.
6390 *
6391 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage1D
6392 * if parameter combinations are not supported by the specific compressed
6393 * internal format as specified in the specific texture compression
6394 * extension.
6395 *
6396 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage1D
6397 * if a non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER
6398 * target and the buffer object's data store is currently mapped.
6399 *
6400 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage1D
6401 * if a non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER
6402 * target and the data would be unpacked from the buffer object such that
6403 * the memory reads required would exceed the data store size.
6404 *
6405 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage1D
6406 * function if texture is not the name of an existing texture object.
6407 *
6408 *
6409 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage2D
6410 * if texture is not the name of an existing texture object.
6411 *
6412 * Check that INVALID_ENUM is generated by CompressedTextureSubImage2D if
6413 * internalformat is of the generic compressed internal formats:
6414 * COMPRESSED_RED, COMPRESSED_RG, COMPRESSED_RGB, COMPRESSED_RGBA.
6415 * COMPRESSED_SRGB, or COMPRESSED_SRGB_ALPHA.
6416 *
6417 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage2D
6418 * if format does not match the internal format of the texture image being
6419 * modified, since these commands do not provide for image format
6420 * conversion.
6421 *
6422 * Check that INVALID_VALUE is generated by CompressedTextureSubImage2D if
6423 * imageSize is not consistent with the format, dimensions, and contents of
6424 * the specified compressed image data.
6425 *
6426 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage2D
6427 * if a non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER
6428 * target and the buffer object's data store is currently mapped.
6429 *
6430 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage2D
6431 * if a non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER
6432 * target and the data would be unpacked from the buffer object such that
6433 * the memory reads required would exceed the data store size.
6434 *
6435 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage2D
6436 * if the effective target is TEXTURE_RECTANGLE.
6437 *
6438 *
6439 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage3D
6440 * if texture is not the name of an existing texture object.
6441 *
6442 * Check that INVALID_ENUM is generated by CompressedTextureSubImage3D if
6443 * internalformat is one of the generic compressed internal formats:
6444 * COMPRESSED_RED, COMPRESSED_RG, COMPRESSED_RGB, COMPRESSED_RGBA.
6445 * COMPRESSED_SRGB, or COMPRESSED_SRGB_ALPHA.
6446 *
6447 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage3D
6448 * if format does not match the internal format of the texture image being
6449 * modified, since these commands do not provide for image format
6450 * conversion.
6451 *
6452 * Check that INVALID_VALUE is generated by CompressedTextureSubImage3D if
6453 * imageSize is not consistent with the format, dimensions, and contents of
6454 * the specified compressed image data.
6455 *
6456 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage3D
6457 * if a non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER
6458 * target and the buffer object's data store is currently mapped.
6459 *
6460 * Check that INVALID_OPERATION is generated by CompressedTextureSubImage3D
6461 * if a non-zero buffer object name is bound to the PIXEL_UNPACK_BUFFER
6462 * target and the data would be unpacked from the buffer object such that
6463 * the memory reads required would exceed the data store size.
6464 */
6465 class SubImageErrorsTest : public deqp::TestCase, ErrorsUtilities
6466 {
6467 public:
6468 /* Public member functions. */
6469 SubImageErrorsTest(deqp::Context& context);
6470
6471 virtual tcu::TestNode::IterateResult iterate();
6472
6473 private:
6474 /* Private constructors. */
6475 SubImageErrorsTest(const SubImageErrorsTest& other);
6476 SubImageErrorsTest& operator=(const SubImageErrorsTest& other);
6477
6478 glw::GLuint m_to_1D_empty;
6479 glw::GLuint m_to_2D_empty;
6480 glw::GLuint m_to_3D_empty;
6481 glw::GLuint m_to_1D;
6482 glw::GLuint m_to_2D;
6483 glw::GLuint m_to_3D;
6484 glw::GLuint m_to_1D_compressed;
6485 glw::GLuint m_to_2D_compressed;
6486 glw::GLuint m_to_3D_compressed;
6487 glw::GLuint m_to_rectangle_compressed;
6488 glw::GLuint m_to_invalid;
6489 glw::GLuint m_bo;
6490 glw::GLuint m_format_invalid;
6491 glw::GLuint m_type_invalid;
6492 glw::GLint m_max_texture_size;
6493 glw::GLubyte* m_reference_compressed_1D;
6494 glw::GLubyte* m_reference_compressed_2D;
6495 glw::GLubyte* m_reference_compressed_3D;
6496 glw::GLubyte* m_reference_compressed_rectangle;
6497 glw::GLint m_reference_compressed_1D_size;
6498 glw::GLint m_reference_compressed_2D_size;
6499 glw::GLint m_reference_compressed_3D_size;
6500 glw::GLint m_reference_compressed_rectangle_size;
6501 glw::GLint m_reference_compressed_1D_format;
6502 glw::GLint m_reference_compressed_2D_format;
6503 glw::GLint m_reference_compressed_3D_format;
6504 glw::GLint m_reference_compressed_rectangle_format;
6505 glw::GLint m_not_matching_compressed_1D_format;
6506 glw::GLint m_not_matching_compressed_1D_size;
6507 glw::GLint m_not_matching_compressed_2D_format;
6508 glw::GLint m_not_matching_compressed_2D_size;
6509 glw::GLint m_not_matching_compressed_3D_format;
6510 glw::GLint m_not_matching_compressed_3D_size;
6511
6512 void Prepare();
6513 bool Test1D();
6514 bool Test2D();
6515 bool Test3D();
6516 bool Test1DCompressed();
6517 bool Test2DCompressed();
6518 bool Test3DCompressed();
6519 void Clean();
6520
6521 static const glw::GLushort s_reference[];
6522 static const glw::GLuint s_reference_width;
6523 static const glw::GLuint s_reference_height;
6524 static const glw::GLuint s_reference_depth;
6525 static const glw::GLuint s_reference_size;
6526 static const glw::GLenum s_reference_internalformat;
6527 static const glw::GLenum s_reference_internalformat_compressed;
6528 static const glw::GLenum s_reference_format;
6529 static const glw::GLenum s_reference_type;
6530 };
6531 /* SubImageErrorsTest class */
6532
6533 /** @class CopyErrorsTest
6534 *
6535 * Check that INVALID_FRAMEBUFFER_OPERATION is generated by
6536 * CopyTextureSubImage1D if the object bound to READ_FRAMEBUFFER_BINDING is
6537 * not framebuffer complete.
6538 *
6539 * Check that INVALID_OPERATION is generated by CopyTextureSubImage1D if
6540 * texture is not the name of an existing texture object, or if the
6541 * effective target of texture is not TEXTURE_1D.
6542 *
6543 * Check that INVALID_VALUE is generated by CopyTextureSubImage1D if level
6544 * is less than 0.
6545 *
6546 * Check that INVALID_VALUE is generated by CopyTextureSubImage1D if
6547 * xoffset<0, or (xoffset+width)>w, where w is the TEXTURE_WIDTH of the
6548 * texture image being modified.
6549 *
6550 * Check that INVALID_OPERATION is generated by CopyTextureSubImage1D if
6551 * the read buffer is NONE, or the value of READ_FRAMEBUFFER_BINDING is
6552 * non-zero, and: the read buffer selects an attachment that has no image
6553 * attached, or the effective value of SAMPLE_BUFFERS for the read
6554 * framebuffer is one.
6555 *
6556 *
6557 * Check that INVALID_FRAMEBUFFER_OPERATION is generated by
6558 * CopyTextureSubImage2D if the object bound to READ_FRAMEBUFFER_BINDING is
6559 * not framebuffer complete.
6560 *
6561 * Check that INVALID_OPERATION is generated by CopyTextureSubImage2D if
6562 * texture is not the name of an existing texture object.
6563 *
6564 * Check that INVALID_OPERATION is generated by CopyTextureSubImage2D if
6565 * the effective target of texture does not correspond to one of the
6566 * texture targets supported by the function.
6567 *
6568 * Check that INVALID_VALUE is generated by CopyTextureSubImage2D if level
6569 * is less than 0.
6570 *
6571 * Check that INVALID_VALUE is generated by CopyTextureSubImage2D if
6572 * xoffset<0, (xoffset+width)>w, yoffset<0, or (yoffset+height)>0, where w
6573 * is the TEXTURE_WIDTH, h is the TEXTURE_HEIGHT and of the texture image
6574 * being modified.
6575 *
6576 * Check that INVALID_OPERATION is generated by CopyTextureSubImage2D if:
6577 * the read buffer is NONE, or the value of READ_FRAMEBUFFER_BINDING is
6578 * non-zero, and: the read buffer selects an attachment that has no image
6579 * attached, or the effective value of SAMPLE_BUFFERS for the read
6580 * framebuffer is one.
6581 *
6582 *
6583 * Check that INVALID_OPERATION is generated by CopyTextureSubImage3D if
6584 * the effective target is not TEXTURE_3D, TEXTURE_2D_ARRAY,
6585 * TEXTURE_CUBE_MAP_ARRAY or TEXTURE_CUBE_MAP.
6586 *
6587 * Check that INVALID_FRAMEBUFFER_OPERATION is generated by
6588 * CopyTextureSubImage3D if the object bound to READ_FRAMEBUFFER_BINDING is
6589 * not framebuffer complete.
6590 *
6591 * Check that INVALID_OPERATION is generated by CopyTextureSubImage3D if
6592 * texture is not the name of an existing texture object.
6593 *
6594 * Check that INVALID_VALUE is generated by CopyTextureSubImage3D if level
6595 * is less than 0.
6596 *
6597 * Check that INVALID_VALUE is generated by CopyTextureSubImage3D if
6598 * xoffset<0, (xoffset+width)>w, yoffset<0, (yoffset+height)>h, zoffset<0,
6599 * or (zoffset+1)>d, where w is the TEXTURE_WIDTH, h is the TEXTURE_HEIGHT,
6600 * d is the TEXTURE_DEPTH and of the texture image being modified. Note
6601 * that w, h, and d include twice the border width.
6602 *
6603 * Check that INVALID_OPERATION is generated by CopyTextureSubImage3D if:
6604 * the read buffer is NONE, or the value of READ_FRAMEBUFFER_BINDING is
6605 * non-zero, and: the read buffer selects an attachment that has no image
6606 * attached, or the effective value of SAMPLE_BUFFERS for the read
6607 * framebuffer is one.
6608 */
6609 class CopyErrorsTest : public deqp::TestCase, ErrorsUtilities
6610 {
6611 public:
6612 /* Public member functions. */
6613 CopyErrorsTest(deqp::Context& context);
6614
6615 virtual tcu::TestNode::IterateResult iterate();
6616
6617 private:
6618 /* Private constructors. */
6619 CopyErrorsTest(const CopyErrorsTest& other);
6620 CopyErrorsTest& operator=(const CopyErrorsTest& other);
6621
6622 glw::GLuint m_fbo;
6623 glw::GLuint m_fbo_ms;
6624 glw::GLuint m_fbo_incomplete;
6625 glw::GLuint m_to_src;
6626 glw::GLuint m_to_src_ms;
6627 glw::GLuint m_to_1D_dst;
6628 glw::GLuint m_to_2D_dst;
6629 glw::GLuint m_to_3D_dst;
6630 glw::GLuint m_to_invalid;
6631
6632 void Prepare();
6633 bool Test1D();
6634 bool Test2D();
6635 bool Test3D();
6636 void Clean();
6637
6638 static const glw::GLuint s_width;
6639 static const glw::GLuint s_height;
6640 static const glw::GLuint s_depth;
6641 static const glw::GLuint s_internalformat;
6642 };
6643 /* CopyErrorsTest class */
6644
6645 /** @class ParameterSetupErrorsTest
6646 *
6647 * Check that INVALID_ENUM is generated by TextureParameter* if pname is
6648 * not one of the accepted defined values.
6649 *
6650 * Check that INVALID_ENUM is generated by TextureParameter* if params
6651 * should have a defined constant value (based on the value of pname) and
6652 * does not.
6653 *
6654 * Check that INVALID_ENUM is generated if TextureParameter{if} is called
6655 * for a non-scalar parameter (pname TEXTURE_BORDER_COLOR or
6656 * TEXTURE_SWIZZLE_RGBA).
6657 *
6658 * Check that INVALID_ENUM is generated by TextureParameter* if the
6659 * effective target is either TEXTURE_2D_MULTISAMPLE or
6660 * TEXTURE_2D_MULTISAMPLE_ARRAY, and pname is any of the sampler states.
6661 *
6662 * Check that INVALID_ENUM is generated by TextureParameter* if the
6663 * effective target is TEXTURE_RECTANGLE and either of pnames
6664 * TEXTURE_WRAP_S or TEXTURE_WRAP_T is set to either MIRROR_CLAMP_TO_EDGE,
6665 * MIRRORED_REPEAT or REPEAT.
6666 *
6667 * Check that INVALID_ENUM is generated by TextureParameter* if the
6668 * effective target is TEXTURE_RECTANGLE and pname TEXTURE_MIN_FILTER is
6669 * set to a value other than NEAREST or LINEAR (no mipmap filtering is
6670 * permitted).
6671 *
6672 * Check that INVALID_OPERATION is generated by TextureParameter* if the
6673 * effective target is either TEXTURE_2D_MULTISAMPLE or
6674 * TEXTURE_2D_MULTISAMPLE_ARRAY, and pname TEXTURE_BASE_LEVEL is set to a
6675 * value other than zero.
6676 *
6677 * Check that INVALID_OPERATION is generated by TextureParameter* if
6678 * texture is not the name of an existing texture object.
6679 *
6680 * Check that INVALID_OPERATION is generated by TextureParameter* if the
6681 * effective target is TEXTURE_RECTANGLE and pname TEXTURE_BASE_LEVEL is
6682 * set to any value other than zero.
6683 *
6684 * Check that INVALID_VALUE is generated by TextureParameter* if pname is
6685 * TEXTURE_BASE_LEVEL or TEXTURE_MAX_LEVEL, and param or params is
6686 * negative.
6687 */
6688 class ParameterSetupErrorsTest : public deqp::TestCase, ErrorsUtilities
6689 {
6690 public:
6691 /* Public member functions. */
6692 ParameterSetupErrorsTest(deqp::Context& context);
6693
6694 virtual tcu::TestNode::IterateResult iterate();
6695
6696 private:
6697 /* Private constructors. */
6698 ParameterSetupErrorsTest(const ParameterSetupErrorsTest& other);
6699 ParameterSetupErrorsTest& operator=(const ParameterSetupErrorsTest& other);
6700
6701 glw::GLuint m_to_2D;
6702 glw::GLuint m_to_2D_ms;
6703 glw::GLuint m_to_rectangle;
6704 glw::GLuint m_to_invalid;
6705 glw::GLenum m_pname_invalid;
6706 glw::GLenum m_depth_stencil_mode_invalid;
6707
6708 void Prepare();
6709 bool Testf();
6710 bool Testi();
6711 bool Testfv();
6712 bool Testiv();
6713 bool TestIiv();
6714 bool TestIuiv();
6715 void Clean();
6716
6717 static const glw::GLuint s_width;
6718 static const glw::GLuint s_height;
6719 static const glw::GLuint s_depth;
6720 static const glw::GLuint s_internalformat;
6721 };
6722 /* ParameterSetupErrorsTest class */
6723
6724 /** @class GenerateMipmapErrorsTest
6725 *
6726 * Check that INVALID_OPERATION is generated by GenerateTextureMipmap if
6727 * texture is not the name of an existing texture object.
6728 *
6729 * Check that INVALID_OPERATION is generated by GenerateTextureMipmap if
6730 * target is TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and the specified
6731 * texture object is not cube complete or cube array complete,
6732 * respectively.
6733 */
6734 class GenerateMipmapErrorsTest : public deqp::TestCase, ErrorsUtilities
6735 {
6736 public:
6737 /* Public member functions. */
6738 GenerateMipmapErrorsTest(deqp::Context& context);
6739
6740 virtual tcu::TestNode::IterateResult iterate();
6741
6742 private:
6743 /* Private constructors. */
6744 GenerateMipmapErrorsTest(const GenerateMipmapErrorsTest& other);
6745 GenerateMipmapErrorsTest& operator=(const GenerateMipmapErrorsTest& other);
6746
6747 static const glw::GLubyte s_reference_data[];
6748 static const glw::GLuint s_reference_width;
6749 static const glw::GLuint s_reference_height;
6750 static const glw::GLenum s_reference_internalformat;
6751 static const glw::GLenum s_reference_format;
6752 static const glw::GLenum s_reference_type;
6753 };
6754 /* GenerateMipmapErrorsTest class */
6755
6756 /** @class BindUnitErrorsTest
6757 *
6758 * Check that INVALID_OPERATION error is generated if texture is not zero
6759 * or the name of an existing texture object.
6760 */
6761 class BindUnitErrorsTest : public deqp::TestCase, ErrorsUtilities
6762 {
6763 public:
6764 /* Public member functions. */
6765 BindUnitErrorsTest(deqp::Context& context);
6766
6767 virtual tcu::TestNode::IterateResult iterate();
6768
6769 private:
6770 /* Private constructors. */
6771 BindUnitErrorsTest(const BindUnitErrorsTest& other);
6772 BindUnitErrorsTest& operator=(const BindUnitErrorsTest& other);
6773 };
6774 /* BindUnitErrorsTest class */
6775
6776 /** @class ImageQueryErrorsTest
6777 *
6778 * Check that INVALID_OPERATION is generated by GetTextureImage if texture
6779 * is not the name of an existing texture object.
6780 *
6781 * Check that INVALID_ENUM is generated by GetTextureImage functions if
6782 * resulting texture target is not an accepted value TEXTURE_1D,
6783 * TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY,
6784 * TEXTURE_CUBE_MAP_ARRAY, TEXTURE_RECTANGLE, and TEXTURE_CUBE_MAP.
6785 *
6786 * Check that INVALID_OPERATION error is generated by GetTextureImage if
6787 * the effective target is TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and
6788 * the texture object is not cube complete or cube array complete,
6789 * respectively.
6790 *
6791 * Check that GL_INVALID_VALUE is generated if level is less than 0 or
6792 * larger than the maximum allowable level.
6793 *
6794 * Check that INVALID_VALUE error is generated if level is non-zero and the
6795 * effective target is TEXTURE_RECTANGLE.
6796 *
6797 * Check that INVALID_OPERATION error is generated if any of the following
6798 * mismatches between format and the internal format of the texture image
6799 * exist:
6800 * - format is a color format (one of the formats in table 8.3 whose
6801 * target is the color buffer) and the base internal format of the
6802 * texture image is not a color format.
6803 * - format is DEPTH_COMPONENT and the base internal format is not
6804 * DEPTH_COMPONENT or DEPTH_STENCIL
6805 * - format is DEPTH_STENCIL and the base internal format is not
6806 * DEPTH_STENCIL
6807 * - format is STENCIL_INDEX and the base internal format is not
6808 * STENCIL_INDEX or DEPTH_STENCIL
6809 * - format is one of the integer formats in table 8.3 and the internal
6810 * format of the texture image is not integer, or format is not one of
6811 * the integer formats in table 8.3 and the internal format is integer.
6812 *
6813 * Check that INVALID_OPERATION error is generated if a pixel pack buffer
6814 * object is bound and packing the texture image into the buffer's memory
6815 * would exceed the size of the buffer.
6816 *
6817 * Check that INVALID_OPERATION error is generated if a pixel pack buffer
6818 * object is bound and pixels is not evenly divisible by the number of
6819 * basic machine units needed to store in memory the GL data type
6820 * corresponding to type (see table 8.2).
6821 *
6822 * Check that INVALID_OPERATION error is generated by GetTextureImage if
6823 * the buffer size required to store the requested data is greater than
6824 * bufSize.
6825 *
6826 *
6827 * Check that INVALID_OPERATION is generated by GetCompressedTextureImage
6828 * if texture is not the name of an existing texture object.
6829 *
6830 * Check that INVALID_VALUE is generated by GetCompressedTextureImage if
6831 * level is less than zero or greater than the maximum number of LODs
6832 * permitted by the implementation.
6833 *
6834 * Check that INVALID_OPERATION is generated if GetCompressedTextureImage
6835 * is used to retrieve a texture that is in an uncompressed internal
6836 * format.
6837 *
6838 * Check that INVALID_OPERATION is generated by GetCompressedTextureImage
6839 * if a non-zero buffer object name is bound to the PIXEL_PACK_BUFFER
6840 * target, the buffer storage was not initialized with BufferStorage using
6841 * MAP_PERSISTENT_BIT flag, and the buffer object's data store is currently
6842 * mapped.
6843 *
6844 * Check that INVALID_OPERATION is generated by GetCompressedTextureImage
6845 * if a non-zero buffer object name is bound to the PIXEL_PACK_BUFFER
6846 * target and the data would be packed to the buffer object such that the
6847 * memory writes required would exceed the data store size.
6848 */
6849 class ImageQueryErrorsTest : public deqp::TestCase, ErrorsUtilities
6850 {
6851 public:
6852 /* Public member functions. */
6853 ImageQueryErrorsTest(deqp::Context& context);
6854
6855 virtual tcu::TestNode::IterateResult iterate();
6856
6857 private:
6858 /* Private constructors. */
6859 ImageQueryErrorsTest(const ImageQueryErrorsTest& other);
6860 ImageQueryErrorsTest& operator=(const ImageQueryErrorsTest& other);
6861
6862 static const glw::GLuint s_reference_data[];
6863 static const glw::GLuint s_reference_width;
6864 static const glw::GLuint s_reference_height;
6865 static const glw::GLuint s_reference_size;
6866 static const glw::GLenum s_reference_internalformat;
6867 static const glw::GLenum s_reference_internalformat_int;
6868 static const glw::GLenum s_reference_internalformat_compressed;
6869 static const glw::GLenum s_reference_format;
6870 static const glw::GLenum s_reference_type;
6871 };
6872 /* ImageQueryErrorsTest class */
6873
6874 /** @class LevelParameterErrorsTest
6875 *
6876 * Check that INVALID_OPERATION is generated by GetTextureLevelParameterfv
6877 * and GetTextureLevelParameteriv functions if texture is not the name of
6878 * an existing texture object.
6879 *
6880 * Check that INVALID_VALUE is generated by GetTextureLevelParameter* if
6881 * level is less than 0.
6882 *
6883 * Check that INVALID_VALUE may be generated if level is greater than
6884 * log2 max, where max is the returned value of MAX_TEXTURE_SIZE.
6885 *
6886 * Check that INVALID_OPERATION is generated by GetTextureLevelParameter*
6887 * if TEXTURE_COMPRESSED_IMAGE_SIZE is queried on texture images with an
6888 * uncompressed internal format or on proxy targets.
6889 *
6890 * Check that INVALID_ENUM error is generated by GetTextureLevelParameter*
6891 * if pname is not one of supported constants.
6892 */
6893 class LevelParameterErrorsTest : public deqp::TestCase, ErrorsUtilities
6894 {
6895 public:
6896 /* Public member functions. */
6897 LevelParameterErrorsTest(deqp::Context& context);
6898
6899 virtual tcu::TestNode::IterateResult iterate();
6900
6901 private:
6902 /* Private constructors. */
6903 LevelParameterErrorsTest(const LevelParameterErrorsTest& other);
6904 LevelParameterErrorsTest& operator=(const LevelParameterErrorsTest& other);
6905 };
6906 /* LevelParameterErrorsTest class */
6907
6908 /** @class
6909 * Check that INVALID_ENUM is generated by glGetTextureParameter* if pname
6910 * is not an accepted value.
6911 *
6912 * Check that INVALID_OPERATION is generated by glGetTextureParameter* if
6913 * texture is not the name of an existing texture object.
6914 *
6915 * Check that INVALID_ENUM error is generated if the effective target is
6916 * not one of the supported texture targets (eg. TEXTURE_BUFFER).
6917 */
6918 class ParameterErrorsTest : public deqp::TestCase, ErrorsUtilities
6919 {
6920 public:
6921 /* Public member functions. */
6922 ParameterErrorsTest(deqp::Context& context);
6923
6924 virtual tcu::TestNode::IterateResult iterate();
6925
6926 private:
6927 /* Private constructors. */
6928 ParameterErrorsTest(const ParameterErrorsTest& other);
6929 ParameterErrorsTest& operator=(const ParameterErrorsTest& other);
6930 };
6931 /* ParameterErrorsTest class */
6932 } /* Textures namespace */
6933 } /* DirectStateAccess namespace */
6934 } /* gl4cts namespace */
6935
6936 #endif // _GL4CDIRECTSTATEACCESSTESTS_HPP
6937