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