xref: /aosp_15_r20/external/deqp/external/openglcts/modules/gl/gl4cGetTextureSubImageTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2015-2016 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */ /*!
20  * \file
21  * \brief
22  */ /*-------------------------------------------------------------------*/
23 
24 /**
25  */ /*!
26  * \file  gl4cGetTextureSubImageTests.cpp
27  * \brief Get Texture Sub Image Tests Suite Implementation
28  */ /*-------------------------------------------------------------------*/
29 
30 /* Includes. */
31 #include "gl4cGetTextureSubImageTests.hpp"
32 #include "gluContextInfo.hpp"
33 #include "gluDefs.hpp"
34 #include "gluRenderContext.hpp"
35 #include "gluStrUtil.hpp"
36 #include "tcuTestLog.hpp"
37 #include <cstdlib>
38 
39 /* Implementation */
40 
41 /**************************************************************************************************
42  * Tests Group Implementation                                                                     *
43  **************************************************************************************************/
44 
Tests(deqp::Context & context)45 gl4cts::GetTextureSubImage::Tests::Tests(deqp::Context &context)
46     : TestCaseGroup(context, "get_texture_sub_image", "Get Texture Sub Image Tests Suite")
47 {
48     addChild(new GetTextureSubImage::Errors(m_context));
49     addChild(new GetTextureSubImage::Functional(m_context));
50 }
51 
~Tests(void)52 gl4cts::GetTextureSubImage::Tests::~Tests(void)
53 {
54 }
55 
init(void)56 void gl4cts::GetTextureSubImage::Tests::init(void)
57 {
58 }
59 
60 /**************************************************************************************************
61  * Errors Tests Implementation                                                                    *
62  **************************************************************************************************/
63 
64 /** Constructor of API Errors tests.
65  *
66  *  @return [in] context    OpenGL context in which test shall run.
67  */
Errors(deqp::Context & context)68 gl4cts::GetTextureSubImage::Errors::Errors(deqp::Context &context)
69     : deqp::TestCase(context, "errors_test", "Get Texture SubImage Errors Test")
70     , m_context(context)
71     , m_texture_1D(0)
72     , m_texture_1D_array(0)
73     , m_texture_2D(0)
74     , m_texture_rectangle(0)
75     , m_texture_2D_compressed(0)
76     , m_texture_2D_multisampled(0)
77     , m_destination_buffer(DE_NULL)
78     , m_gl_GetTextureSubImage(DE_NULL)
79     , m_gl_GetCompressedTextureSubImage(DE_NULL)
80 {
81 }
82 
83 /** Destructor of API Errors tests.
84  */
~Errors(void)85 gl4cts::GetTextureSubImage::Errors::~Errors(void)
86 {
87 }
88 
89 /** This function iterate over API Errors tests.
90  */
iterate(void)91 tcu::TestNode::IterateResult gl4cts::GetTextureSubImage::Errors::iterate(void)
92 {
93     bool is_ok      = true;
94     bool test_error = false;
95 
96     bool is_at_least_gl_45 = (glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 5)));
97     bool is_arb_get_texture_sub_image = m_context.getContextInfo().isExtensionSupported("GL_ARB_get_texture_sub_image");
98 
99     try
100     {
101         if (is_at_least_gl_45 || is_arb_get_texture_sub_image)
102         {
103             /* Prepare texture objects */
104             prepare();
105 
106             /* Do tests. */
107             is_ok &= testExistingTextureObjectError();
108 
109             is_ok &= testBufferOrMultisampledTargetError();
110 
111             is_ok &= testNegativeOffsetError();
112 
113             is_ok &= testBoundsError();
114 
115             is_ok &= testOneDimmensionalTextureErrors();
116 
117             is_ok &= testTwoDimmensionalTextureErrors();
118 
119             is_ok &= testBufferSizeError();
120         }
121     }
122     catch (...)
123     {
124         is_ok      = false;
125         test_error = true;
126     }
127 
128     /* Clean up */
129     clean();
130 
131     /* Result's setup. */
132     if (is_ok)
133     {
134         m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
135     }
136     else
137     {
138         if (test_error)
139         {
140             m_testCtx.setTestResult(QP_TEST_RESULT_INTERNAL_ERROR, "Error");
141         }
142         else
143         {
144             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
145         }
146     }
147 
148     return STOP;
149 }
150 
151 /** Preparation of source textures and destination buffer.
152  */
prepare()153 void gl4cts::GetTextureSubImage::Errors::prepare()
154 {
155     /* OpenGL functions access point. */
156     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
157 
158     /* If already initialized throw exception. */
159     if (m_texture_1D || m_texture_1D_array || m_texture_2D || m_texture_rectangle || m_texture_2D_compressed ||
160         m_texture_2D_multisampled)
161     {
162         throw 0;
163     }
164 
165     /* Generate texture ids. */
166     gl.genTextures(1, &m_texture_1D);
167     gl.genTextures(1, &m_texture_1D_array);
168     gl.genTextures(1, &m_texture_2D);
169     gl.genTextures(1, &m_texture_rectangle);
170     gl.genTextures(1, &m_texture_2D_compressed);
171     gl.genTextures(1, &m_texture_2D_multisampled);
172 
173     GLU_EXPECT_NO_ERROR(gl.getError(), "glGenTextures call failed.");
174 
175     /* If one is not initialized throw exception. */
176     if (!(m_texture_1D && m_texture_1D_array && m_texture_2D))
177     {
178         throw 0;
179     }
180 
181     /* Upload texture data. */
182     gl.bindTexture(GL_TEXTURE_1D, m_texture_1D);
183     GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
184 
185     gl.texImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, s_texture_data_width, 0, GL_RGBA, GL_UNSIGNED_BYTE, s_texture_data);
186     GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage1D call failed.");
187 
188     gl.bindTexture(GL_TEXTURE_1D_ARRAY, m_texture_1D_array);
189     GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
190 
191     gl.texImage2D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0, GL_RGBA,
192                   GL_UNSIGNED_BYTE, s_texture_data);
193     GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage1D call failed.");
194 
195     gl.bindTexture(GL_TEXTURE_2D, m_texture_2D);
196     GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
197 
198     gl.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
199                   s_texture_data);
200     GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage1D call failed.");
201 
202     gl.bindTexture(GL_TEXTURE_RECTANGLE, m_texture_rectangle);
203     GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
204 
205     gl.texImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0, GL_RGBA,
206                   GL_UNSIGNED_BYTE, s_texture_data);
207     GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage1D call failed.");
208 
209     /* Upload compressed texture data. */
210     gl.bindTexture(GL_TEXTURE_2D, m_texture_2D_compressed);
211     GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
212 
213     gl.compressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, s_texture_data_compressed_width,
214                             s_texture_data_compressed_height, 0, s_texture_data_compressed_size,
215                             s_texture_data_compressed);
216     GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage1D call failed.");
217 
218     /* Prepare multisampled texture storage. */
219     gl.bindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_texture_2D_multisampled);
220     GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
221 
222     gl.texImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 1, GL_R8, s_texture_data_width, s_texture_data_height, GL_TRUE);
223     GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage1D call failed.");
224 
225     /* Prepare function pointers. */
226     m_gl_GetTextureSubImage =
227         (PFNGLGETTEXTURESUBIMAGEPROC)m_context.getRenderContext().getProcAddress("glGetTextureSubImage");
228     m_gl_GetCompressedTextureSubImage =
229         (PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)m_context.getRenderContext().getProcAddress(
230             "glGetCompressedTextureSubImage");
231 
232     if ((DE_NULL == m_gl_GetTextureSubImage) || (DE_NULL == m_gl_GetCompressedTextureSubImage))
233     {
234         throw 0;
235     }
236 
237     /* Allocate destination buffer. */
238     m_destination_buffer = (glw::GLubyte *)malloc(s_destination_buffer_size);
239 
240     if (DE_NULL == m_destination_buffer)
241     {
242         throw 0;
243     }
244 }
245 
246 /** The function checks that GL_INVALID_OPERATION error is generated by GetTextureSubImage if
247  *  texture is not the name of an existing texture object. It also checks that
248  *  GL_INVALID_OPERATION error is generated by GetCompressedTextureSubImage if texture is not
249  *  the name of an existing texture object. For reference see the OpenGL 4.5 Core Specification
250  *  chapter 8.11.4.
251  *
252  *  @return True if proper error values are generated, false otherwise.
253  */
testExistingTextureObjectError()254 bool gl4cts::GetTextureSubImage::Errors::testExistingTextureObjectError()
255 {
256     /* OpenGL functions access point. */
257     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
258 
259     /* Prepare invalid texture name. */
260     glw::GLuint invalid_texture = m_texture_2D_multisampled;
261 
262     while (gl.isTexture(++invalid_texture))
263         ;
264 
265     m_gl_GetTextureSubImage(invalid_texture, 0, 0, 0, 0, s_texture_data_width, s_texture_data_height, 1, GL_RGBA,
266                             GL_UNSIGNED_BYTE, s_destination_buffer_size, m_destination_buffer);
267 
268     glw::GLint error_value     = gl.getError();
269     glw::GLint is_proper_error = (GL_INVALID_OPERATION == error_value);
270 
271     if (!is_proper_error)
272     {
273         m_testCtx.getLog() << tcu::TestLog::Message
274                            << "GL_INVALID_OPERATION error is expected to be generated by "
275                               "glGetTextureSubImage if texture is not the name of an existing "
276                               "texture object (OpenGL 4.5 Core Specification chapter 8.11.4)."
277                            << " However, the error value " << glu::getErrorName(error_value) << " was generated."
278                            << tcu::TestLog::EndMessage;
279     }
280 
281     m_gl_GetCompressedTextureSubImage(invalid_texture, 0, 0, 0, 0, s_texture_data_compressed_width,
282                                       s_texture_data_compressed_height, 1, s_destination_buffer_size,
283                                       m_destination_buffer);
284 
285     error_value = gl.getError();
286 
287     glw::GLint is_proper_error_compressed = (GL_INVALID_OPERATION == error_value);
288 
289     if (!is_proper_error_compressed)
290     {
291         m_testCtx.getLog()
292             << tcu::TestLog::Message
293             << "GL_INVALID_OPERATION error is expected to be generated by glGetCompressedTextureSubImage "
294                "if texture is not the name of an existing texture object (OpenGL 4.5 Core Specification "
295                "chapter 8.11.4)."
296             << " However, the error value " << glu::getErrorName(error_value) << " was generated."
297             << tcu::TestLog::EndMessage;
298     }
299 
300     if (is_proper_error && is_proper_error_compressed)
301     {
302         return true;
303     }
304 
305     return false;
306 }
307 
308 /** The function checks that GL_INVALID_OPERATION error is generated if texture is the
309  *  name of a buffer or multisample texture. For reference see OpenGL 4.5 Core Specification
310  *  chapter 8.11.4.
311  *
312  *  @return True if proper error values are generated, false otherwise.
313  */
testBufferOrMultisampledTargetError()314 bool gl4cts::GetTextureSubImage::Errors::testBufferOrMultisampledTargetError()
315 {
316     /* OpenGL functions access point. */
317     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
318 
319     /* Test. */
320     m_gl_GetTextureSubImage(m_texture_2D_multisampled, 0, 0, 0, 0, s_texture_data_width, s_texture_data_height, 1,
321                             GL_RGBA, GL_UNSIGNED_BYTE, s_destination_buffer_size, m_destination_buffer);
322 
323     glw::GLint error_value     = gl.getError();
324     glw::GLint is_proper_error = (GL_INVALID_OPERATION == error_value);
325 
326     if (!is_proper_error)
327     {
328         m_testCtx.getLog() << tcu::TestLog::Message
329                            << "GL_INVALID_OPERATION error is expected to be generated by "
330                               "glGetTextureSubImage if texture is the name of multisample "
331                               "texture (OpenGL 4.5 Core Specification chapter 8.11.4)."
332                            << " However, the error value " << glu::getErrorName(error_value) << " was generated."
333                            << tcu::TestLog::EndMessage;
334     }
335 
336     if (is_proper_error)
337     {
338         return true;
339     }
340 
341     return false;
342 }
343 
344 /** The functions checks that GL_INVALID_VALUE is generated if xoffset, yoffset or
345  *  zoffset are negative. For reference see OpenGL 4.5 Core Specification
346  *  chapter 8.11.4.
347  *
348  *  @return True if proper error values are generated, false otherwise.
349  */
testNegativeOffsetError()350 bool gl4cts::GetTextureSubImage::Errors::testNegativeOffsetError()
351 {
352     /* OpenGL functions access point. */
353     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
354 
355     /* Test. */
356     m_gl_GetTextureSubImage(m_texture_2D, 0, -1, 0, 0, s_texture_data_width, s_texture_data_height, 1, GL_RGBA,
357                             GL_UNSIGNED_BYTE, s_destination_buffer_size, m_destination_buffer);
358 
359     glw::GLint error_value     = gl.getError();
360     glw::GLint is_proper_error = (GL_INVALID_VALUE == error_value);
361 
362     if (!is_proper_error)
363     {
364         m_testCtx.getLog() << tcu::TestLog::Message
365                            << "GL_INVALID_VALUE error is expected to be generated by glGetTextureSubImage if xoffset, "
366                               "yoffset or zoffset are negative (OpenGL 4.5 Core Specification chapter 8.11.4)."
367                            << " However, the error value " << glu::getErrorName(error_value) << " was generated."
368                            << tcu::TestLog::EndMessage;
369     }
370 
371     m_gl_GetCompressedTextureSubImage(m_texture_2D_compressed, 0, -1, 0, 0, s_texture_data_compressed_width,
372                                       s_texture_data_compressed_height, 1, s_destination_buffer_size,
373                                       m_destination_buffer);
374 
375     error_value = gl.getError();
376 
377     glw::GLint is_proper_error_compressed = (GL_INVALID_VALUE == error_value);
378 
379     if (!is_proper_error_compressed)
380     {
381         m_testCtx.getLog() << tcu::TestLog::Message
382                            << "GL_INVALID_VALUE error is expected to be generated by glGetCompressedTextureSubImage if "
383                               "xoffset, yoffset or zoffset are negative (OpenGL 4.5 Core Specification chapter 8.11.4)."
384                            << " However, the error value " << glu::getErrorName(error_value) << " was generated."
385                            << tcu::TestLog::EndMessage;
386     }
387 
388     if (is_proper_error && is_proper_error_compressed)
389     {
390         return true;
391     }
392 
393     return false;
394 }
395 
396 /** The functions checks that GL_INVALID_VALUE is generated if xoffset + width is
397  *  greater than the texture's width, yoffset + height is greater than
398  *  the texture's height, or zoffset + depth is greater than the
399  *  texture's depth. For reference see OpenGL 4.5 Core Specification
400  *  chapter 8.11.4.
401  *
402  *  @return True if proper error values are generated, false otherwise.
403  */
testBoundsError()404 bool gl4cts::GetTextureSubImage::Errors::testBoundsError()
405 {
406     /* OpenGL functions access point. */
407     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
408 
409     /* Uncompresse texture test. */
410     m_gl_GetTextureSubImage(m_texture_2D, 0, s_texture_data_width, s_texture_data_height, 0, s_texture_data_width * 2,
411                             s_texture_data_height * 2, 1, GL_RGBA, GL_UNSIGNED_BYTE, s_destination_buffer_size,
412                             m_destination_buffer);
413 
414     glw::GLint error_value     = gl.getError();
415     glw::GLint is_proper_error = (GL_INVALID_VALUE == error_value);
416 
417     if (!is_proper_error)
418     {
419         m_testCtx.getLog()
420             << tcu::TestLog::Message
421             << "GL_INVALID_VALUE error is expected to be generated by glGetTextureSubImage if xoffset + width is"
422                " greater than the texture's width, yoffset + height is greater than"
423                " the texture's height, or zoffset + depth is greater than the"
424                " texture's depth. (OpenGL 4.5 Core Specification chapter 8.11.4)."
425                " However, the error value "
426             << glu::getErrorName(error_value) << " was generated." << tcu::TestLog::EndMessage;
427     }
428 
429     /* Compresse texture test. */
430     m_gl_GetCompressedTextureSubImage(m_texture_2D_compressed, 0, s_texture_data_compressed_width,
431                                       s_texture_data_compressed_height, 0, s_texture_data_compressed_width * 2,
432                                       s_texture_data_compressed_height * 2, 1, s_destination_buffer_size,
433                                       m_destination_buffer);
434 
435     error_value = gl.getError();
436 
437     glw::GLint is_proper_error_compressed = (GL_INVALID_VALUE == error_value);
438 
439     if (!is_proper_error_compressed)
440     {
441         m_testCtx.getLog() << tcu::TestLog::Message
442                            << "GL_INVALID_VALUE error is expected to be generated by glGetCompressedTextureSubImage if "
443                               "xoffset + width is"
444                               " greater than the texture's width, yoffset + height is greater than"
445                               " the texture's height, or zoffset + depth is greater than the"
446                               " texture's depth. (OpenGL 4.5 Core Specification chapter 8.11.4)."
447                               " However, the error value "
448                            << glu::getErrorName(error_value) << " was generated." << tcu::TestLog::EndMessage;
449     }
450 
451     if (is_proper_error && is_proper_error_compressed)
452     {
453         return true;
454     }
455 
456     return false;
457 }
458 
459 /** The functions checks that GL_INVALID_VALUE error is generated if the effective
460  *  target is GL_TEXTURE_1D and either yoffset is not zero, or height
461  *  is not one. For reference see OpenGL 4.5 Core Specification
462  *  chapter 8.11.4.
463  *
464  *  @return True if proper error values are generated, false otherwise.
465  */
testOneDimmensionalTextureErrors()466 bool gl4cts::GetTextureSubImage::Errors::testOneDimmensionalTextureErrors()
467 {
468     /* OpenGL functions access point. */
469     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
470 
471     /* Test. */
472     m_gl_GetTextureSubImage(m_texture_1D, 0, 0, 1, 0, s_texture_data_width, 2, 1, GL_RGBA, GL_UNSIGNED_BYTE,
473                             s_destination_buffer_size, m_destination_buffer);
474 
475     glw::GLint error_value     = gl.getError();
476     glw::GLint is_proper_error = (GL_INVALID_VALUE == error_value);
477 
478     if (!is_proper_error)
479     {
480         m_testCtx.getLog()
481             << tcu::TestLog::Message
482             << "GL_INVALID_VALUE error is expected to be generated by glGetTextureSubImage if the effective"
483                " target is GL_TEXTURE_1D and either yoffset is not zero, or height"
484                " is not one (OpenGL 4.5 Core Specification chapter 8.11.4)."
485                " However, the error value "
486             << glu::getErrorName(error_value) << " was generated." << tcu::TestLog::EndMessage;
487     }
488 
489     if (is_proper_error)
490     {
491         return true;
492     }
493 
494     return false;
495 }
496 
497 /** The functions checks that GL_INVALID_VALUE error is generated if the effective
498  *  target is GL_TEXTURE_1D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D or
499  *  GL_TEXTURE_RECTANGLE and either zoffset is not zero, or depth
500  *  is not one. For reference see OpenGL 4.5 Core Specification
501  *  chapter 8.11.4.
502  *
503  *  @return True if proper error values are generated, false otherwise.
504  */
testTwoDimmensionalTextureErrors()505 bool gl4cts::GetTextureSubImage::Errors::testTwoDimmensionalTextureErrors()
506 {
507     /* OpenGL functions access point. */
508     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
509 
510     /* Test. */
511     const struct
512     {
513         glw::GLuint id;
514         const glw::GLchar *target_name;
515     } test_textures[] = {
516         {m_texture_1D, "GL_TEXTURE_1D"}, {m_texture_1D_array, "GL_TEXTURE_1D_ARRAY"}, {m_texture_2D, "GL_TEXTURE_2D"}};
517 
518     static const glw::GLuint test_textures_size = sizeof(test_textures) / sizeof(test_textures[0]);
519 
520     glw::GLint is_error = true;
521 
522     for (glw::GLuint i = 0; i < test_textures_size; ++i)
523     {
524         m_gl_GetTextureSubImage(test_textures[i].id, 0, 0, 0, 1, s_texture_data_width,
525                                 (test_textures[i].id == m_texture_1D) ? 1 : s_texture_data_height, 2, GL_RGBA,
526                                 GL_UNSIGNED_BYTE, s_destination_buffer_size, m_destination_buffer);
527 
528         glw::GLint error_value     = gl.getError();
529         glw::GLint is_proper_error = (GL_INVALID_VALUE == error_value);
530 
531         if (!is_proper_error)
532         {
533             is_error = false;
534 
535             m_testCtx.getLog()
536                 << tcu::TestLog::Message
537                 << "GL_INVALID_VALUE error is expected to be generated by glGetTextureSubImage if the effective"
538                    " target is "
539                 << test_textures[i].target_name
540                 << " and either zoffset is not zero, or depth"
541                    " is not one. (OpenGL 4.5 Core Specification chapter 8.11.4)."
542                    " However, the error value "
543                 << glu::getErrorName(error_value) << " was generated." << tcu::TestLog::EndMessage;
544         }
545     }
546 
547     /* Test (compressed textures). */
548     const struct
549     {
550         glw::GLuint id;
551         const glw::GLchar *target_name;
552     } test_compressed_textures[] = {{m_texture_2D_compressed, "GL_TEXTURE_2D"}};
553 
554     static const glw::GLuint test_compressed_textures_size =
555         sizeof(test_compressed_textures) / sizeof(test_compressed_textures[0]);
556 
557     for (glw::GLuint i = 0; i < test_compressed_textures_size; ++i)
558     {
559         m_gl_GetCompressedTextureSubImage(test_compressed_textures[i].id, 0, 0, 0, 1, s_texture_data_compressed_width,
560                                           s_texture_data_compressed_height, 2, s_destination_buffer_size,
561                                           m_destination_buffer);
562 
563         glw::GLint error_value = gl.getError();
564 
565         glw::GLint is_proper_error_compressed = (GL_INVALID_VALUE == error_value);
566 
567         if (!is_proper_error_compressed)
568         {
569             is_error = false;
570 
571             m_testCtx.getLog() << tcu::TestLog::Message
572                                << "GL_INVALID_VALUE error is expected to be generated by "
573                                   "glGetCompressedTextureSubImage if the effective"
574                                   " target is "
575                                << test_compressed_textures[i].target_name
576                                << " and either zoffset is not zero, or depth"
577                                   " is not one. (OpenGL 4.5 Core Specification chapter 8.11.4)."
578                                   " However, the error value "
579                                << glu::getErrorName(error_value) << " was generated." << tcu::TestLog::EndMessage;
580         }
581     }
582 
583     if (is_error)
584     {
585         return true;
586     }
587 
588     return false;
589 }
590 
591 /** The functions checks that GL_INVALID_OPERATION error is generated if the buffer
592  *  size required to store the requested data is greater than bufSize.
593  *  For reference see OpenGL 4.5 Core Specification chapter 8.11.4.
594  *
595  *  @return True if proper error values are generated, false otherwise.
596  */
testBufferSizeError()597 bool gl4cts::GetTextureSubImage::Errors::testBufferSizeError()
598 {
599     /* OpenGL functions access point. */
600     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
601 
602     /* Test for uncompressed texture. */
603     m_gl_GetTextureSubImage(m_texture_2D, 0, 0, 0, 0, s_texture_data_width, s_texture_data_height, 1, GL_RGBA,
604                             GL_UNSIGNED_BYTE, 1, m_destination_buffer);
605 
606     glw::GLint error_value     = gl.getError();
607     glw::GLint is_proper_error = (GL_INVALID_OPERATION == error_value);
608 
609     if (!is_proper_error)
610     {
611         m_testCtx.getLog()
612             << tcu::TestLog::Message
613             << "GL_INVALID_OPERATION error is expected to be generated by glGetTextureSubImage if the buffer"
614                " size required to store the requested data is greater than bufSize. (OpenGL 4.5 Core Specification "
615                "chapter 8.11.4)."
616                " However, the error value "
617             << glu::getErrorName(error_value) << " was generated." << tcu::TestLog::EndMessage;
618     }
619 
620     /* Test for compressed texture. */
621     m_gl_GetCompressedTextureSubImage(m_texture_2D_compressed, 0, 0, 0, 0, s_texture_data_compressed_width,
622                                       s_texture_data_compressed_height, 1, 1, m_destination_buffer);
623 
624     error_value = gl.getError();
625 
626     glw::GLint is_proper_error_compressed = (GL_INVALID_OPERATION == error_value);
627 
628     if (!is_proper_error_compressed)
629     {
630         m_testCtx.getLog()
631             << tcu::TestLog::Message
632             << "GL_INVALID_OPERATION error is expected to be generated by glGetCompressedTextureSubImage if the buffer"
633                " size required to store the requested data is greater than bufSize. (OpenGL 4.5 Core Specification "
634                "chapter 8.11.4)."
635                " However, the error value "
636             << glu::getErrorName(error_value) << " was generated." << tcu::TestLog::EndMessage;
637     }
638 
639     /* Return results. */
640     if (is_proper_error && is_proper_error_compressed)
641     {
642         return true;
643     }
644 
645     return false;
646 }
647 
clean()648 void gl4cts::GetTextureSubImage::Errors::clean()
649 {
650     /* OpenGL functions access point. */
651     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
652 
653     /*Textures cleanup. */
654     if (m_texture_1D)
655     {
656         gl.deleteTextures(1, &m_texture_1D);
657         m_texture_1D = 0;
658     }
659 
660     if (m_texture_1D_array)
661     {
662         gl.deleteTextures(1, &m_texture_1D_array);
663         m_texture_1D_array = 0;
664     }
665 
666     if (m_texture_2D)
667     {
668         gl.deleteTextures(1, &m_texture_2D);
669         m_texture_2D = 0;
670     }
671     if (m_texture_rectangle)
672     {
673         gl.deleteTextures(1, &m_texture_rectangle);
674         m_texture_rectangle = 0;
675     }
676 
677     if (m_texture_2D_compressed)
678     {
679         gl.deleteTextures(1, &m_texture_2D_compressed);
680         m_texture_2D_compressed = 0;
681     }
682 
683     if (m_texture_2D_multisampled)
684     {
685         gl.deleteTextures(1, &m_texture_2D_multisampled);
686         m_texture_2D_multisampled = 0;
687     }
688 
689     /* CPU buffers */
690     if (m_destination_buffer)
691     {
692         free(m_destination_buffer);
693         m_destination_buffer = DE_NULL;
694     }
695 }
696 
697 /* Uncompressed source texture 2x2 pixels */
698 
699 const glw::GLubyte gl4cts::GetTextureSubImage::Errors::s_texture_data[] = {
700     0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; //<! uncompressed texture
701 
702 const glw::GLuint gl4cts::GetTextureSubImage::Errors::s_texture_data_size =
703     sizeof(s_texture_data); //<! uncompressed texture size
704 
705 const glw::GLuint gl4cts::GetTextureSubImage::Errors::s_texture_data_width = 2; //<! uncompressed texture width
706 
707 const glw::GLuint gl4cts::GetTextureSubImage::Errors::s_texture_data_height = 2; //<! uncompressed texture height
708 
709 /* ETC2 compressed texture (4x4 pixels === 1 block) */
710 
711 const glw::GLubyte gl4cts::GetTextureSubImage::Errors::s_texture_data_compressed[] = {
712     0x15, 0x90, 0x33, 0x6f, 0xaf, 0xcc, 0x16, 0x98}; //<! ETC2 compressed texture
713 
714 const glw::GLuint gl4cts::GetTextureSubImage::Errors::s_texture_data_compressed_size =
715     sizeof(s_texture_data_compressed); //<! ETC2 compressed texture size
716 
717 const glw::GLuint gl4cts::GetTextureSubImage::Errors::s_texture_data_compressed_width =
718     4; //<! ETC2 compressed texture width
719 
720 const glw::GLuint gl4cts::GetTextureSubImage::Errors::s_texture_data_compressed_height =
721     4; //<! ETC2 compressed texture height
722 
723 const glw::GLuint gl4cts::GetTextureSubImage::Errors::s_destination_buffer_size =
724     (s_texture_data_size > s_texture_data_compressed_size) ?
725         s_texture_data_size :
726         s_texture_data_compressed_size; //<! size of the destination buffer (for fetched data)
727 
728 /*****************************************************************************************************
729  * Functional Test Implementation                                                                    *
730  *****************************************************************************************************/
731 
732 /** Constructor of the functional test.
733  *
734  *  @param [in] context     OpenGL context in which test shall run.
735  */
Functional(deqp::Context & context)736 gl4cts::GetTextureSubImage::Functional::Functional(deqp::Context &context)
737     : deqp::TestCase(context, "functional_test", "Get Texture SubImage Functional Test")
738     , m_context(context)
739     , m_texture(0)
740 {
741 }
742 
743 /** Destructor of the functional test.
744  */
~Functional(void)745 gl4cts::GetTextureSubImage::Functional::~Functional(void)
746 {
747 }
748 
749 /** Iterate over functional test cases.
750  */
iterate(void)751 tcu::TestNode::IterateResult gl4cts::GetTextureSubImage::Functional::iterate(void)
752 {
753     bool is_ok      = true;
754     bool test_error = false;
755 
756     bool is_at_least_gl_45 = (glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 5)));
757     bool is_arb_get_texture_sub_image = m_context.getContextInfo().isExtensionSupported("GL_ARB_get_texture_sub_image");
758 
759     /* Bind function pointers. */
760     m_gl_GetCompressedTextureSubImage =
761         (PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)m_context.getRenderContext().getProcAddress(
762             "glGetCompressedTextureSubImage");
763     m_gl_GetTextureSubImage =
764         (PFNGLGETTEXTURESUBIMAGEPROC)m_context.getRenderContext().getProcAddress("glGetTextureSubImage");
765 
766     try
767     {
768         /* Report error when function pointers are not available. */
769         if ((DE_NULL == m_gl_GetCompressedTextureSubImage) || (DE_NULL == m_gl_GetTextureSubImage))
770         {
771             m_testCtx.getLog()
772                 << tcu::TestLog::Message
773                 << "Cannot obtain glGetCompressedTextureSubImage or glGetTextureSubImage function pointer."
774                 << tcu::TestLog::EndMessage;
775             throw 0;
776         }
777 
778         /* Run tests. */
779         if (is_at_least_gl_45 || is_arb_get_texture_sub_image)
780         {
781             /* Tested targets. */
782             glw::GLenum targets[] = {GL_TEXTURE_1D,        GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D,
783                                      GL_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE_MAP_ARRAY,
784                                      GL_TEXTURE_2D_ARRAY,  GL_TEXTURE_3D};
785 
786             glw::GLuint targets_count = sizeof(targets) / sizeof(targets[0]);
787 
788             for (glw::GLuint i = 0; i < targets_count; ++i)
789             {
790                 prepare(targets[i], false);
791 
792                 is_ok &= check(targets[i], false);
793 
794                 clean();
795             }
796 
797             /* Compressed textures tested targets. */
798             glw::GLenum compressed_targets[] = {GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE_MAP_ARRAY,
799                                                 GL_TEXTURE_2D_ARRAY};
800 
801             glw::GLuint compressed_targets_count = sizeof(compressed_targets) / sizeof(compressed_targets[0]);
802 
803             for (glw::GLuint i = 0; i < compressed_targets_count; ++i)
804             {
805                 prepare(compressed_targets[i], true);
806 
807                 is_ok &= check(compressed_targets[i], true);
808 
809                 clean();
810             }
811         }
812     }
813     catch (...)
814     {
815         m_testCtx.getLog() << tcu::TestLog::Message << "Test error has occured." << tcu::TestLog::EndMessage;
816 
817         is_ok      = false;
818         test_error = true;
819 
820         clean();
821     }
822 
823     /* Result's setup. */
824     if (is_ok)
825     {
826         m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
827     }
828     else
829     {
830         if (test_error)
831         {
832             m_testCtx.setTestResult(QP_TEST_RESULT_INTERNAL_ERROR, "Error");
833         }
834         else
835         {
836             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
837         }
838     }
839 
840     return STOP;
841 }
842 
843 /** Prepare source texture for the test.
844  *
845  *  @param [in] target          Target of the texture to be prepared.
846  *  @param [in] is_compressed   Flag indicating that texture shall be compressed (true) or uncompressed (false).
847  */
prepare(glw::GLenum target,bool is_compressed)848 void gl4cts::GetTextureSubImage::Functional::prepare(glw::GLenum target, bool is_compressed)
849 {
850     /* OpenGL functions access point. */
851     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
852 
853     /* Generate and bind texture. */
854     gl.genTextures(1, &m_texture);
855     GLU_EXPECT_NO_ERROR(gl.getError(), "glGenTextures call failed.");
856 
857     gl.bindTexture(target, m_texture);
858     GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
859 
860     /* Upload data to the texture. */
861     if (is_compressed)
862     {
863         /* Upload compressed texture. */
864         switch (target)
865         {
866         case GL_TEXTURE_2D:
867             gl.compressedTexImage2D(target, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
868                                     s_texture_data_height, 0, s_texture_data_compressed_size / s_texture_data_depth,
869                                     s_texture_data_compressed);
870             GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage2D call failed.");
871             break;
872         case GL_TEXTURE_CUBE_MAP:
873             gl.compressedTexImage2D(
874                 GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
875                 s_texture_data_height, 0, s_texture_data_compressed_size / s_texture_data_depth,
876                 &s_texture_data_compressed[0 * s_texture_data_compressed_size / s_texture_data_depth]);
877             gl.compressedTexImage2D(
878                 GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
879                 s_texture_data_height, 0, s_texture_data_compressed_size / s_texture_data_depth,
880                 &s_texture_data_compressed[1 * s_texture_data_compressed_size / s_texture_data_depth]);
881             gl.compressedTexImage2D(
882                 GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
883                 s_texture_data_height, 0, s_texture_data_compressed_size / s_texture_data_depth,
884                 &s_texture_data_compressed[2 * s_texture_data_compressed_size / s_texture_data_depth]);
885             gl.compressedTexImage2D(
886                 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
887                 s_texture_data_height, 0, s_texture_data_compressed_size / s_texture_data_depth,
888                 &s_texture_data_compressed[3 * s_texture_data_compressed_size / s_texture_data_depth]);
889             gl.compressedTexImage2D(
890                 GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
891                 s_texture_data_height, 0, s_texture_data_compressed_size / s_texture_data_depth,
892                 &s_texture_data_compressed[4 * s_texture_data_compressed_size / s_texture_data_depth]);
893             gl.compressedTexImage2D(
894                 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
895                 s_texture_data_height, 0, s_texture_data_compressed_size / s_texture_data_depth,
896                 &s_texture_data_compressed[5 * s_texture_data_compressed_size / s_texture_data_depth]);
897             GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage2D call failed.");
898             break;
899         case GL_TEXTURE_CUBE_MAP_ARRAY:
900             gl.compressedTexImage3D(
901                 target, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width, s_texture_data_height, 6, 0,
902                 s_texture_data_compressed_size / s_texture_data_depth * 6, s_texture_data_compressed);
903             GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage3D call failed.");
904             break;
905         case GL_TEXTURE_2D_ARRAY:
906             gl.compressedTexImage3D(target, 0, GL_COMPRESSED_RGBA_BPTC_UNORM, s_texture_data_width,
907                                     s_texture_data_height, s_texture_data_depth, 0, s_texture_data_compressed_size,
908                                     s_texture_data_compressed);
909             GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage3D call failed.");
910             break;
911         default:
912             throw 0;
913         }
914     }
915     else
916     {
917         /* Upload uncompressed texture. */
918         switch (target)
919         {
920         case GL_TEXTURE_1D:
921             gl.texImage1D(target, 0, GL_RGBA8, s_texture_data_width, 0, GL_RGBA, GL_UNSIGNED_BYTE, s_texture_data);
922             GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage1D call failed.");
923             break;
924         case GL_TEXTURE_1D_ARRAY:
925         case GL_TEXTURE_2D:
926         case GL_TEXTURE_RECTANGLE:
927             gl.texImage2D(target, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0, GL_RGBA,
928                           GL_UNSIGNED_BYTE, s_texture_data);
929             GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage2D call failed.");
930             break;
931         case GL_TEXTURE_CUBE_MAP:
932             gl.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0,
933                           GL_RGBA, GL_UNSIGNED_BYTE,
934                           &s_texture_data[0 * s_texture_data_width * s_texture_data_height * 4 /* RGBA */]);
935             gl.texImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0,
936                           GL_RGBA, GL_UNSIGNED_BYTE,
937                           &s_texture_data[1 * s_texture_data_width * s_texture_data_height * 4 /* RGBA */]);
938             gl.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0,
939                           GL_RGBA, GL_UNSIGNED_BYTE,
940                           &s_texture_data[2 * s_texture_data_width * s_texture_data_height * 4 /* RGBA */]);
941             gl.texImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0,
942                           GL_RGBA, GL_UNSIGNED_BYTE,
943                           &s_texture_data[3 * s_texture_data_width * s_texture_data_height * 4 /* RGBA */]);
944             gl.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0,
945                           GL_RGBA, GL_UNSIGNED_BYTE,
946                           &s_texture_data[4 * s_texture_data_width * s_texture_data_height * 4 /* RGBA */]);
947             gl.texImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 0,
948                           GL_RGBA, GL_UNSIGNED_BYTE,
949                           &s_texture_data[5 * s_texture_data_width * s_texture_data_height * 4 /* RGBA */]);
950             GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage2D call failed.");
951             break;
952         case GL_TEXTURE_CUBE_MAP_ARRAY:
953             gl.texImage3D(target, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, 6, 0, GL_RGBA,
954                           GL_UNSIGNED_BYTE, s_texture_data);
955             GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage3D call failed.");
956             break;
957         case GL_TEXTURE_2D_ARRAY:
958         case GL_TEXTURE_3D:
959             gl.texImage3D(target, 0, GL_RGBA8, s_texture_data_width, s_texture_data_height, s_texture_data_depth, 0,
960                           GL_RGBA, GL_UNSIGNED_BYTE, s_texture_data);
961             GLU_EXPECT_NO_ERROR(gl.getError(), "glTexImage3D call failed.");
962             break;
963         default:
964             throw 0;
965         }
966     }
967 }
968 
969 /** Test that Get(Compressed)TextureSubImage resturns expected texture data.
970  *
971  *  @param [in] target          Target of the texture to be prepared.
972  *  @param [in] is_compressed   Flag indicating that texture shall be compressed (true) or uncompressed (false).
973  *
974  *  @return True if test succeeded, false otherwise.
975  */
check(glw::GLenum target,bool is_compressed)976 bool gl4cts::GetTextureSubImage::Functional::check(glw::GLenum target, bool is_compressed)
977 {
978     /* OpenGL functions access point. */
979     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
980 
981     /* Arguments setup (depends on dimmension) */
982     glw::GLint x_offset = s_texture_data_width / 2 /* half */;
983     glw::GLint width    = s_texture_data_width / 2 /* half */;
984 
985     glw::GLint y_offset = 0;
986     glw::GLint height   = 1;
987 
988     glw::GLint z_offset = 0;
989     glw::GLint depth    = 1;
990 
991     /* For 2 and 3 -dimensional textures setup y-direction. */
992     if (GL_TEXTURE_1D != target)
993     {
994         y_offset = s_texture_data_height / 2 /* half */;
995         height   = s_texture_data_height / 2 /* half */;
996     }
997 
998     /* For 3-dimensional textures setup z-direction. */
999     if ((GL_TEXTURE_3D == target) || (GL_TEXTURE_2D_ARRAY == target))
1000     {
1001         z_offset = s_texture_data_depth / 2 /* half */;
1002         depth    = s_texture_data_depth / 2 /* half */;
1003     }
1004 
1005     /* For cube-map texture stup 6-cube faces. */
1006     if ((GL_TEXTURE_CUBE_MAP == target) || (GL_TEXTURE_CUBE_MAP_ARRAY == target))
1007     {
1008         z_offset = 3; /* half of cube map */
1009         depth    = 3; /* half of cube map */
1010     }
1011 
1012     /* Setup number of components. */
1013     glw::GLint number_of_components = 0;
1014 
1015     if (is_compressed)
1016     {
1017         number_of_components = 16; /* 128 bit block of 4x4 compressed pixels. */
1018     }
1019     else
1020     {
1021         number_of_components = 4; /* RGBA components. */
1022     }
1023 
1024     /* Setup size. */
1025     glw::GLsizei size = 0;
1026 
1027     /* Iterate over pixels. */
1028     glw::GLint x_block = 1;
1029     glw::GLint y_block = 1;
1030 
1031     if (is_compressed)
1032     {
1033         /* Iterate over 4x4 compressed pixel block. */
1034         x_block = 4;
1035         y_block = 4;
1036 
1037         size = static_cast<glw::GLsizei>((width / x_block) * (height / y_block) * depth * number_of_components *
1038                                          sizeof(glw::GLubyte));
1039     }
1040     else
1041     {
1042         size = static_cast<glw::GLsizei>(width * height * depth * number_of_components * sizeof(glw::GLubyte));
1043     }
1044 
1045     /* Storage for fetched texturte. */
1046     glw::GLubyte *texture_data = new glw::GLubyte[size];
1047 
1048     if (DE_NULL == texture_data)
1049     {
1050         throw 0;
1051     }
1052 
1053     /* Fetching texture. */
1054     if (is_compressed)
1055     {
1056         m_gl_GetCompressedTextureSubImage(m_texture, 0, x_offset, y_offset, z_offset, width, height, depth, size,
1057                                           texture_data);
1058     }
1059     else
1060     {
1061         m_gl_GetTextureSubImage(m_texture, 0, x_offset, y_offset, z_offset, width, height, depth, GL_RGBA,
1062                                 GL_UNSIGNED_BYTE, size, texture_data);
1063     }
1064 
1065     /* Comprae fetched texture with reference. */
1066     glw::GLint error = gl.getError();
1067 
1068     bool is_ok = true;
1069 
1070     if (GL_NO_ERROR == error)
1071     {
1072         for (glw::GLint k = 0; k < depth; ++k)
1073         {
1074             for (glw::GLint j = 0; j < height / y_block; ++j)
1075             {
1076                 for (glw::GLint i = 0; i < width / x_block; ++i)
1077                 {
1078                     for (glw::GLint c = 0; c < number_of_components; ++c) /* RGBA components iterating */
1079                     {
1080                         glw::GLuint reference_data_position =
1081                             (i + (x_offset / x_block)) * number_of_components +
1082                             (j + (y_offset / y_block)) * s_texture_data_width / x_block * number_of_components +
1083                             (k + z_offset) * s_texture_data_width / x_block * s_texture_data_height / y_block *
1084                                 number_of_components +
1085                             c;
1086 
1087                         glw::GLuint tested_data_position =
1088                             i * number_of_components + j * width / x_block * number_of_components +
1089                             k * width / x_block * height / y_block * number_of_components + c;
1090 
1091                         glw::GLubyte reference_value = (is_compressed) ?
1092                                                            s_texture_data_compressed[reference_data_position] :
1093                                                            s_texture_data[reference_data_position];
1094                         glw::GLubyte tested_value    = texture_data[tested_data_position];
1095 
1096                         if (reference_value != tested_value)
1097                         {
1098                             is_ok = false;
1099                             break;
1100                         }
1101                     }
1102                 }
1103             }
1104         }
1105     }
1106     else
1107     {
1108         /* GL error. */
1109         delete[] texture_data;
1110         throw 0;
1111     }
1112 
1113     /* Cleanup. */
1114     delete[] texture_data;
1115 
1116     /* Error reporting. */
1117     if (!is_ok)
1118     {
1119         m_testCtx.getLog() << tcu::TestLog::Message << "Functional test of "
1120                            << ((is_compressed) ? "glGetCompressedTextureSubImage " : "glGetTextureSubImage ")
1121                            << "function has failed with target " << glu::getTextureTargetStr(target) << "."
1122                            << tcu::TestLog::EndMessage;
1123     }
1124 
1125     /* Return result. */
1126     return is_ok;
1127 }
1128 
1129 /** Clean texture. */
clean()1130 void gl4cts::GetTextureSubImage::Functional::clean()
1131 {
1132     /* OpenGL functions access point. */
1133     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1134 
1135     if (m_texture)
1136     {
1137         gl.deleteTextures(1, &m_texture);
1138 
1139         m_texture = 0;
1140     }
1141 }
1142 
1143 /** RGBA 8x8x8 pixels in size source texture for testing GetTextureSubImage. */
1144 const glw::GLubyte gl4cts::GetTextureSubImage::Functional::s_texture_data[] = {
1145     0,   0,   0,   0,  0,   0,   32,  1,  0,   0,   64,  2,  0,   0,   96,  3,
1146     0,   0,   128, 4,  0,   0,   160, 5,  0,   0,   192, 6,  0,   0,   224, 7,
1147 
1148     0,   32,  0,   1,  0,   32,  32,  2,  0,   32,  64,  3,  0,   32,  96,  4,
1149     0,   32,  128, 5,  0,   32,  160, 6,  0,   32,  192, 7,  0,   32,  224, 8,
1150 
1151     0,   64,  0,   2,  0,   64,  32,  3,  0,   64,  64,  4,  0,   64,  96,  5,
1152     0,   64,  128, 6,  0,   64,  160, 7,  0,   64,  192, 8,  0,   64,  224, 9,
1153 
1154     0,   96,  0,   3,  0,   96,  32,  4,  0,   96,  64,  5,  0,   96,  96,  6,
1155     0,   96,  128, 7,  0,   96,  160, 8,  0,   96,  192, 9,  0,   96,  224, 10,
1156 
1157     0,   128, 0,   4,  0,   128, 32,  5,  0,   128, 64,  6,  0,   128, 96,  7,
1158     0,   128, 128, 8,  0,   128, 160, 9,  0,   128, 192, 10, 0,   128, 224, 11,
1159 
1160     0,   160, 0,   5,  0,   160, 32,  6,  0,   160, 64,  7,  0,   160, 96,  8,
1161     0,   160, 128, 9,  0,   160, 160, 10, 0,   160, 192, 11, 0,   160, 224, 12,
1162 
1163     0,   192, 0,   6,  0,   192, 32,  7,  0,   192, 64,  8,  0,   192, 96,  9,
1164     0,   192, 128, 10, 0,   192, 160, 11, 0,   192, 192, 12, 0,   192, 224, 13,
1165 
1166     0,   224, 0,   7,  0,   224, 32,  8,  0,   224, 64,  9,  0,   224, 96,  10,
1167     0,   224, 128, 11, 0,   224, 160, 12, 0,   224, 192, 13, 0,   224, 224, 14,
1168 
1169     32,  0,   0,   1,  32,  0,   32,  2,  32,  0,   64,  3,  32,  0,   96,  4,
1170     32,  0,   128, 5,  32,  0,   160, 6,  32,  0,   192, 7,  32,  0,   224, 8,
1171 
1172     32,  32,  0,   2,  32,  32,  32,  3,  32,  32,  64,  4,  32,  32,  96,  5,
1173     32,  32,  128, 6,  32,  32,  160, 7,  32,  32,  192, 8,  32,  32,  224, 9,
1174 
1175     32,  64,  0,   3,  32,  64,  32,  4,  32,  64,  64,  5,  32,  64,  96,  6,
1176     32,  64,  128, 7,  32,  64,  160, 8,  32,  64,  192, 9,  32,  64,  224, 10,
1177 
1178     32,  96,  0,   4,  32,  96,  32,  5,  32,  96,  64,  6,  32,  96,  96,  7,
1179     32,  96,  128, 8,  32,  96,  160, 9,  32,  96,  192, 10, 32,  96,  224, 11,
1180 
1181     32,  128, 0,   5,  32,  128, 32,  6,  32,  128, 64,  7,  32,  128, 96,  8,
1182     32,  128, 128, 9,  32,  128, 160, 10, 32,  128, 192, 11, 32,  128, 224, 12,
1183 
1184     32,  160, 0,   6,  32,  160, 32,  7,  32,  160, 64,  8,  32,  160, 96,  9,
1185     32,  160, 128, 10, 32,  160, 160, 11, 32,  160, 192, 12, 32,  160, 224, 13,
1186 
1187     32,  192, 0,   7,  32,  192, 32,  8,  32,  192, 64,  9,  32,  192, 96,  10,
1188     32,  192, 128, 11, 32,  192, 160, 12, 32,  192, 192, 13, 32,  192, 224, 14,
1189 
1190     32,  224, 0,   8,  32,  224, 32,  9,  32,  224, 64,  10, 32,  224, 96,  11,
1191     32,  224, 128, 12, 32,  224, 160, 13, 32,  224, 192, 14, 32,  224, 224, 15,
1192 
1193     64,  0,   0,   2,  64,  0,   32,  3,  64,  0,   64,  4,  64,  0,   96,  5,
1194     64,  0,   128, 6,  64,  0,   160, 7,  64,  0,   192, 8,  64,  0,   224, 9,
1195 
1196     64,  32,  0,   3,  64,  32,  32,  4,  64,  32,  64,  5,  64,  32,  96,  6,
1197     64,  32,  128, 7,  64,  32,  160, 8,  64,  32,  192, 9,  64,  32,  224, 10,
1198 
1199     64,  64,  0,   4,  64,  64,  32,  5,  64,  64,  64,  6,  64,  64,  96,  7,
1200     64,  64,  128, 8,  64,  64,  160, 9,  64,  64,  192, 10, 64,  64,  224, 11,
1201 
1202     64,  96,  0,   5,  64,  96,  32,  6,  64,  96,  64,  7,  64,  96,  96,  8,
1203     64,  96,  128, 9,  64,  96,  160, 10, 64,  96,  192, 11, 64,  96,  224, 12,
1204 
1205     64,  128, 0,   6,  64,  128, 32,  7,  64,  128, 64,  8,  64,  128, 96,  9,
1206     64,  128, 128, 10, 64,  128, 160, 11, 64,  128, 192, 12, 64,  128, 224, 13,
1207 
1208     64,  160, 0,   7,  64,  160, 32,  8,  64,  160, 64,  9,  64,  160, 96,  10,
1209     64,  160, 128, 11, 64,  160, 160, 12, 64,  160, 192, 13, 64,  160, 224, 14,
1210 
1211     64,  192, 0,   8,  64,  192, 32,  9,  64,  192, 64,  10, 64,  192, 96,  11,
1212     64,  192, 128, 12, 64,  192, 160, 13, 64,  192, 192, 14, 64,  192, 224, 15,
1213 
1214     64,  224, 0,   9,  64,  224, 32,  10, 64,  224, 64,  11, 64,  224, 96,  12,
1215     64,  224, 128, 13, 64,  224, 160, 14, 64,  224, 192, 15, 64,  224, 224, 16,
1216 
1217     96,  0,   0,   3,  96,  0,   32,  4,  96,  0,   64,  5,  96,  0,   96,  6,
1218     96,  0,   128, 7,  96,  0,   160, 8,  96,  0,   192, 9,  96,  0,   224, 10,
1219 
1220     96,  32,  0,   4,  96,  32,  32,  5,  96,  32,  64,  6,  96,  32,  96,  7,
1221     96,  32,  128, 8,  96,  32,  160, 9,  96,  32,  192, 10, 96,  32,  224, 11,
1222 
1223     96,  64,  0,   5,  96,  64,  32,  6,  96,  64,  64,  7,  96,  64,  96,  8,
1224     96,  64,  128, 9,  96,  64,  160, 10, 96,  64,  192, 11, 96,  64,  224, 12,
1225 
1226     96,  96,  0,   6,  96,  96,  32,  7,  96,  96,  64,  8,  96,  96,  96,  9,
1227     96,  96,  128, 10, 96,  96,  160, 11, 96,  96,  192, 12, 96,  96,  224, 13,
1228 
1229     96,  128, 0,   7,  96,  128, 32,  8,  96,  128, 64,  9,  96,  128, 96,  10,
1230     96,  128, 128, 11, 96,  128, 160, 12, 96,  128, 192, 13, 96,  128, 224, 14,
1231 
1232     96,  160, 0,   8,  96,  160, 32,  9,  96,  160, 64,  10, 96,  160, 96,  11,
1233     96,  160, 128, 12, 96,  160, 160, 13, 96,  160, 192, 14, 96,  160, 224, 15,
1234 
1235     96,  192, 0,   9,  96,  192, 32,  10, 96,  192, 64,  11, 96,  192, 96,  12,
1236     96,  192, 128, 13, 96,  192, 160, 14, 96,  192, 192, 15, 96,  192, 224, 16,
1237 
1238     96,  224, 0,   10, 96,  224, 32,  11, 96,  224, 64,  12, 96,  224, 96,  13,
1239     96,  224, 128, 14, 96,  224, 160, 15, 96,  224, 192, 16, 96,  224, 224, 17,
1240 
1241     128, 0,   0,   4,  128, 0,   32,  5,  128, 0,   64,  6,  128, 0,   96,  7,
1242     128, 0,   128, 8,  128, 0,   160, 9,  128, 0,   192, 10, 128, 0,   224, 11,
1243 
1244     128, 32,  0,   5,  128, 32,  32,  6,  128, 32,  64,  7,  128, 32,  96,  8,
1245     128, 32,  128, 9,  128, 32,  160, 10, 128, 32,  192, 11, 128, 32,  224, 12,
1246 
1247     128, 64,  0,   6,  128, 64,  32,  7,  128, 64,  64,  8,  128, 64,  96,  9,
1248     128, 64,  128, 10, 128, 64,  160, 11, 128, 64,  192, 12, 128, 64,  224, 13,
1249 
1250     128, 96,  0,   7,  128, 96,  32,  8,  128, 96,  64,  9,  128, 96,  96,  10,
1251     128, 96,  128, 11, 128, 96,  160, 12, 128, 96,  192, 13, 128, 96,  224, 14,
1252 
1253     128, 128, 0,   8,  128, 128, 32,  9,  128, 128, 64,  10, 128, 128, 96,  11,
1254     128, 128, 128, 12, 128, 128, 160, 13, 128, 128, 192, 14, 128, 128, 224, 15,
1255 
1256     128, 160, 0,   9,  128, 160, 32,  10, 128, 160, 64,  11, 128, 160, 96,  12,
1257     128, 160, 128, 13, 128, 160, 160, 14, 128, 160, 192, 15, 128, 160, 224, 16,
1258 
1259     128, 192, 0,   10, 128, 192, 32,  11, 128, 192, 64,  12, 128, 192, 96,  13,
1260     128, 192, 128, 14, 128, 192, 160, 15, 128, 192, 192, 16, 128, 192, 224, 17,
1261 
1262     128, 224, 0,   11, 128, 224, 32,  12, 128, 224, 64,  13, 128, 224, 96,  14,
1263     128, 224, 128, 15, 128, 224, 160, 16, 128, 224, 192, 17, 128, 224, 224, 18,
1264 
1265     160, 0,   0,   5,  160, 0,   32,  6,  160, 0,   64,  7,  160, 0,   96,  8,
1266     160, 0,   128, 9,  160, 0,   160, 10, 160, 0,   192, 11, 160, 0,   224, 12,
1267 
1268     160, 32,  0,   6,  160, 32,  32,  7,  160, 32,  64,  8,  160, 32,  96,  9,
1269     160, 32,  128, 10, 160, 32,  160, 11, 160, 32,  192, 12, 160, 32,  224, 13,
1270 
1271     160, 64,  0,   7,  160, 64,  32,  8,  160, 64,  64,  9,  160, 64,  96,  10,
1272     160, 64,  128, 11, 160, 64,  160, 12, 160, 64,  192, 13, 160, 64,  224, 14,
1273 
1274     160, 96,  0,   8,  160, 96,  32,  9,  160, 96,  64,  10, 160, 96,  96,  11,
1275     160, 96,  128, 12, 160, 96,  160, 13, 160, 96,  192, 14, 160, 96,  224, 15,
1276 
1277     160, 128, 0,   9,  160, 128, 32,  10, 160, 128, 64,  11, 160, 128, 96,  12,
1278     160, 128, 128, 13, 160, 128, 160, 14, 160, 128, 192, 15, 160, 128, 224, 16,
1279 
1280     160, 160, 0,   10, 160, 160, 32,  11, 160, 160, 64,  12, 160, 160, 96,  13,
1281     160, 160, 128, 14, 160, 160, 160, 15, 160, 160, 192, 16, 160, 160, 224, 17,
1282 
1283     160, 192, 0,   11, 160, 192, 32,  12, 160, 192, 64,  13, 160, 192, 96,  14,
1284     160, 192, 128, 15, 160, 192, 160, 16, 160, 192, 192, 17, 160, 192, 224, 18,
1285 
1286     160, 224, 0,   12, 160, 224, 32,  13, 160, 224, 64,  14, 160, 224, 96,  15,
1287     160, 224, 128, 16, 160, 224, 160, 17, 160, 224, 192, 18, 160, 224, 224, 19,
1288 
1289     192, 0,   0,   6,  192, 0,   32,  7,  192, 0,   64,  8,  192, 0,   96,  9,
1290     192, 0,   128, 10, 192, 0,   160, 11, 192, 0,   192, 12, 192, 0,   224, 13,
1291 
1292     192, 32,  0,   7,  192, 32,  32,  8,  192, 32,  64,  9,  192, 32,  96,  10,
1293     192, 32,  128, 11, 192, 32,  160, 12, 192, 32,  192, 13, 192, 32,  224, 14,
1294 
1295     192, 64,  0,   8,  192, 64,  32,  9,  192, 64,  64,  10, 192, 64,  96,  11,
1296     192, 64,  128, 12, 192, 64,  160, 13, 192, 64,  192, 14, 192, 64,  224, 15,
1297 
1298     192, 96,  0,   9,  192, 96,  32,  10, 192, 96,  64,  11, 192, 96,  96,  12,
1299     192, 96,  128, 13, 192, 96,  160, 14, 192, 96,  192, 15, 192, 96,  224, 16,
1300 
1301     192, 128, 0,   10, 192, 128, 32,  11, 192, 128, 64,  12, 192, 128, 96,  13,
1302     192, 128, 128, 14, 192, 128, 160, 15, 192, 128, 192, 16, 192, 128, 224, 17,
1303 
1304     192, 160, 0,   11, 192, 160, 32,  12, 192, 160, 64,  13, 192, 160, 96,  14,
1305     192, 160, 128, 15, 192, 160, 160, 16, 192, 160, 192, 17, 192, 160, 224, 18,
1306 
1307     192, 192, 0,   12, 192, 192, 32,  13, 192, 192, 64,  14, 192, 192, 96,  15,
1308     192, 192, 128, 16, 192, 192, 160, 17, 192, 192, 192, 18, 192, 192, 224, 19,
1309 
1310     192, 224, 0,   13, 192, 224, 32,  14, 192, 224, 64,  15, 192, 224, 96,  16,
1311     192, 224, 128, 17, 192, 224, 160, 18, 192, 224, 192, 19, 192, 224, 224, 20,
1312 
1313     224, 0,   0,   7,  224, 0,   32,  8,  224, 0,   64,  9,  224, 0,   96,  10,
1314     224, 0,   128, 11, 224, 0,   160, 12, 224, 0,   192, 13, 224, 0,   224, 14,
1315 
1316     224, 32,  0,   8,  224, 32,  32,  9,  224, 32,  64,  10, 224, 32,  96,  11,
1317     224, 32,  128, 12, 224, 32,  160, 13, 224, 32,  192, 14, 224, 32,  224, 15,
1318 
1319     224, 64,  0,   9,  224, 64,  32,  10, 224, 64,  64,  11, 224, 64,  96,  12,
1320     224, 64,  128, 13, 224, 64,  160, 14, 224, 64,  192, 15, 224, 64,  224, 16,
1321 
1322     224, 96,  0,   10, 224, 96,  32,  11, 224, 96,  64,  12, 224, 96,  96,  13,
1323     224, 96,  128, 14, 224, 96,  160, 15, 224, 96,  192, 16, 224, 96,  224, 17,
1324 
1325     224, 128, 0,   11, 224, 128, 32,  12, 224, 128, 64,  13, 224, 128, 96,  14,
1326     224, 128, 128, 15, 224, 128, 160, 16, 224, 128, 192, 17, 224, 128, 224, 18,
1327 
1328     224, 160, 0,   12, 224, 160, 32,  13, 224, 160, 64,  14, 224, 160, 96,  15,
1329     224, 160, 128, 16, 224, 160, 160, 17, 224, 160, 192, 18, 224, 160, 224, 19,
1330 
1331     224, 192, 0,   13, 224, 192, 32,  14, 224, 192, 64,  15, 224, 192, 96,  16,
1332     224, 192, 128, 17, 224, 192, 160, 18, 224, 192, 192, 19, 224, 192, 224, 20,
1333 
1334     224, 224, 0,   14, 224, 224, 32,  15, 224, 224, 64,  16, 224, 224, 96,  17,
1335     224, 224, 128, 18, 224, 224, 160, 19, 224, 224, 192, 20, 224, 224, 224, 21};
1336 
1337 const glw::GLsizei gl4cts::GetTextureSubImage::Functional::s_texture_data_size =
1338     sizeof(s_texture_data); //!< Size of the uncompressed texture.
1339 
1340 const glw::GLsizei gl4cts::GetTextureSubImage::Functional::s_texture_data_width =
1341     8; //!< Width  of compressed and uncompressed textures.
1342 const glw::GLsizei gl4cts::GetTextureSubImage::Functional::s_texture_data_height =
1343     8; //!< Height of compressed and uncompressed textures.
1344 const glw::GLsizei gl4cts::GetTextureSubImage::Functional::s_texture_data_depth =
1345     8; //!< Depth  of compressed and uncompressed textures.
1346 
1347 /** ETC2 8x8x8(layers) pixels in size source texture for testing GetCompressedTextureSubImage. */
1348 const glw::GLubyte gl4cts::GetTextureSubImage::Functional::s_texture_data_compressed[] = {
1349     /* Layer 0 */
1350     0x80, 0x80, 0x4, 0x2, 0x1, 0x0, 0x10, 0x0, 0x80, 0x81, 0x4, 0x2, 0x1, 0xf8, 0x10, 0x20, 0x81, 0x80, 0x4, 0x2, 0x81,
1351     0x0, 0x1f, 0xc0, 0x81, 0x81, 0x4, 0x2, 0x81, 0xf8, 0x1f, 0xe0, 0x80, 0x80, 0x5, 0x2, 0x1, 0x0, 0x10, 0x0, 0x80,
1352     0x81, 0x5, 0x2, 0x1, 0xf8, 0x10, 0x20, 0x81, 0x80, 0x5, 0x2, 0x81, 0x0, 0x1f, 0xc0, 0x81, 0x81, 0x5, 0x2, 0x81,
1353     0xf8, 0x1f, 0xe0,
1354 
1355     /* Layer 1 */
1356     0x90, 0x80, 0x4, 0x12, 0x1, 0x1, 0x10, 0x0, 0x90, 0x81, 0x4, 0x12, 0x1, 0xf9, 0x10, 0x20, 0x91, 0x80, 0x4, 0x12,
1357     0x81, 0x1, 0x1f, 0xc0, 0x91, 0x81, 0x4, 0x12, 0x81, 0xf9, 0x1f, 0xe0, 0x90, 0x80, 0x5, 0x12, 0x1, 0x1, 0x10, 0x0,
1358     0x90, 0x81, 0x5, 0x12, 0x1, 0xf9, 0x10, 0x20, 0x91, 0x80, 0x5, 0x12, 0x81, 0x1, 0x1f, 0xc0, 0x91, 0x81, 0x5, 0x12,
1359     0x81, 0xf9, 0x1f, 0xe0,
1360 
1361     /* Layer 2 */
1362     0xa0, 0x80, 0x4, 0x22, 0x1, 0x2, 0x10, 0x0, 0xa0, 0x81, 0x4, 0x22, 0x1, 0xfa, 0x10, 0x20, 0xa1, 0x80, 0x4, 0x22,
1363     0x81, 0x2, 0x1f, 0xc0, 0xa1, 0x81, 0x4, 0x22, 0x81, 0xfa, 0x1f, 0xe0, 0xa0, 0x80, 0x5, 0x22, 0x1, 0x2, 0x10, 0x0,
1364     0xa0, 0x81, 0x5, 0x22, 0x1, 0xfa, 0x10, 0x20, 0xa1, 0x80, 0x5, 0x22, 0x81, 0x2, 0x1f, 0xc0, 0xa1, 0x81, 0x5, 0x22,
1365     0x81, 0xfa, 0x1f, 0xe0,
1366 
1367     /* Layer 3 */
1368     0xb0, 0x80, 0x4, 0x32, 0x1, 0x3, 0x10, 0x0, 0xb0, 0x81, 0x4, 0x32, 0x1, 0xfb, 0x10, 0x20, 0xb1, 0x80, 0x4, 0x32,
1369     0x81, 0x3, 0x1f, 0xc0, 0xb1, 0x81, 0x4, 0x32, 0x81, 0xfb, 0x1f, 0xe0, 0xb0, 0x80, 0x5, 0x32, 0x1, 0x3, 0x10, 0x0,
1370     0xb0, 0x81, 0x5, 0x32, 0x1, 0xfb, 0x10, 0x20, 0xb1, 0x80, 0x5, 0x32, 0x81, 0x3, 0x1f, 0xc0, 0xb1, 0x81, 0x5, 0x32,
1371     0x81, 0xfb, 0x1f, 0xe0,
1372 
1373     /* Layer 4 */
1374     0x40, 0x80, 0x4, 0x42, 0x1, 0x4, 0x10, 0x0, 0x40, 0x81, 0x4, 0x42, 0x1, 0xfc, 0x10, 0x20, 0x41, 0x80, 0x4, 0x42,
1375     0x81, 0x4, 0x1f, 0xc0, 0x41, 0x81, 0x4, 0x42, 0x81, 0xfc, 0x1f, 0xe0, 0x40, 0x80, 0x5, 0x42, 0x1, 0x4, 0x10, 0x0,
1376     0x40, 0x81, 0x5, 0x42, 0x1, 0xfc, 0x10, 0x20, 0x41, 0x80, 0x5, 0x42, 0x81, 0x4, 0x1f, 0xc0, 0x41, 0x81, 0x5, 0x42,
1377     0x81, 0xfc, 0x1f, 0xe0,
1378 
1379     /* Layer 5 */
1380     0x50, 0x80, 0x4, 0x52, 0x1, 0x5, 0x10, 0x0, 0x50, 0x81, 0x4, 0x52, 0x1, 0xfd, 0x10, 0x20, 0x51, 0x80, 0x4, 0x52,
1381     0x81, 0x5, 0x1f, 0xc0, 0x51, 0x81, 0x4, 0x52, 0x81, 0xfd, 0x1f, 0xe0, 0x50, 0x80, 0x5, 0x52, 0x1, 0x5, 0x10, 0x0,
1382     0x50, 0x81, 0x5, 0x52, 0x1, 0xfd, 0x10, 0x20, 0x51, 0x80, 0x5, 0x52, 0x81, 0x5, 0x1f, 0xc0, 0x51, 0x81, 0x5, 0x52,
1383     0x81, 0xfd, 0x1f, 0xe0,
1384 
1385     /* Layer 6 */
1386     0x5e, 0x80, 0x4, 0x5f, 0x1, 0x5, 0xf0, 0x0, 0x5e, 0x81, 0x4, 0x5f, 0x1, 0xfd, 0xf0, 0x20, 0x5f, 0x80, 0x4, 0x5f,
1387     0x81, 0x5, 0xff, 0xc0, 0x5f, 0x81, 0x4, 0x5f, 0x81, 0xfd, 0xff, 0xe0, 0x5e, 0x80, 0x5, 0x5f, 0x1, 0x5, 0xf0, 0x0,
1388     0x5e, 0x81, 0x5, 0x5f, 0x1, 0xfd, 0xf0, 0x20, 0x5f, 0x80, 0x5, 0x5f, 0x81, 0x5, 0xff, 0xc0, 0x5f, 0x81, 0x5, 0x5f,
1389     0x81, 0xfd, 0xff, 0xe0,
1390 
1391     /* Layer 7 */
1392     0x6e, 0x80, 0x4, 0x6f, 0x1, 0x6, 0xf0, 0x0, 0x6e, 0x81, 0x4, 0x6f, 0x1, 0xfe, 0xf0, 0x20, 0x6f, 0x80, 0x4, 0x6f,
1393     0x81, 0x6, 0xff, 0xc0, 0x6f, 0x81, 0x4, 0x6f, 0x81, 0xfe, 0xff, 0xe0, 0x6e, 0x80, 0x5, 0x6f, 0x1, 0x6, 0xf0, 0x0,
1394     0x6e, 0x81, 0x5, 0x6f, 0x1, 0xfe, 0xf0, 0x20, 0x6f, 0x80, 0x5, 0x6f, 0x81, 0x6, 0xff, 0xc0, 0x6f, 0x81, 0x5, 0x6f,
1395     0x81, 0xfe, 0xff, 0xe0};
1396 
1397 const glw::GLsizei gl4cts::GetTextureSubImage::Functional::s_texture_data_compressed_size =
1398     sizeof(s_texture_data_compressed); //!< Size of compressed texture.
1399