1 #ifndef _GL4CGETTEXTURESUBIMAGETESTS_HPP
2 #define _GL4CGETTEXTURESUBIMAGETESTS_HPP
3 /*-------------------------------------------------------------------------
4 * OpenGL Conformance Test Suite
5 * -----------------------------
7 * Copyright (c) 2015-2016 The Khronos Group Inc.
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 */ /*-------------------------------------------------------------------*/
28 * \file gl4cGetTextureSubImageTests.hpp
29 * \brief Get Texture Sub Image Tests Suite Interface
30 */ /*-------------------------------------------------------------------*/
34 #include "glcTestCase.hpp"
35 #include "glwDefs.hpp"
36 #include "tcuDefs.hpp"
38 #include "glwEnums.hpp"
39 #include "glwFunctions.hpp"
45 namespace GetTextureSubImage
47 /** Tests group for GetTextureSubImage tests.
49 * Following tests will be run:
53 class Tests : public deqp::TestCaseGroup
56 Tests(deqp::Context& context);
58 virtual void init(void);
61 /* Private member functions. */
62 Tests(const Tests& other);
63 Tests& operator=(const Tests& other);
67 /** Error Generation Tests
69 * The Errors test verifies that functions glGetTextureSubImage and
70 * glGetCompressedTextureSubImage generate proper error values if used
71 * improperly. For reference see OpenGL 4.5 Core Specification chapter
74 * * Check that GL_INVALID_VALUE error is generated by
75 * glGetTextureSubImage if texture is not the name of an existing
78 * * Check that GL_INVALID_VALUE error is generated by
79 * glGetCompressedTextureSubImage if texture is not the name
80 * of an existingtexture object.
82 * * Check that GL_INVALID_OPERATION error is generated if texture is the
83 * name of a buffer or multisample texture.
85 * * Check that GL_INVALID_VALUE is generated if xoffset, yoffset or
86 * zoffset are negative.
88 * * Check that GL_INVALID_VALUE is generated if xoffset + width is
89 * greater than the texture's width, yoffset + height is greater than
90 * the texture's height, or zoffset + depth is greater than the
93 * * Check that GL_INVALID_VALUE error is generated if the effective
94 * target is GL_TEXTURE_1D and either yoffset is not zero, or height
97 * * Check that GL_INVALID_VALUE error is generated if the effective
98 * target is GL_TEXTURE_1D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D or
99 * GL_TEXTURE_RECTANGLE and either zoffset is not zero, or depth
102 * * Check that GL_INVALID_OPERATION error is generated if the buffer
103 * size required to store the requested data is greater than bufSize.
105 class Errors : public deqp::TestCase
108 Errors(deqp::Context& context);
110 IterateResult iterate(void);
113 /* Private member variables. */
114 deqp::Context& m_context;
115 glw::GLuint m_texture_1D;
116 glw::GLuint m_texture_1D_array;
117 glw::GLuint m_texture_2D;
118 glw::GLuint m_texture_rectangle;
119 glw::GLuint m_texture_2D_compressed;
120 glw::GLuint m_texture_2D_multisampled;
121 glw::GLubyte* m_destination_buffer;
123 /* Get(Compressed)TextureSubImage function pointer and type declarations. */
124 typedef void(GLW_APIENTRY* PFNGLGETTEXTURESUBIMAGEPROC)(glw::GLuint texture, glw::GLint level, glw::GLint xoffset,
125 glw::GLint yoffset, glw::GLint zoffset, glw::GLsizei width,
126 glw::GLsizei height, glw::GLsizei depth, glw::GLenum format,
127 glw::GLenum type, glw::GLsizei bufSize, void* pixels);
129 typedef void(GLW_APIENTRY* PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)(glw::GLuint texture, glw::GLint level,
130 glw::GLint xoffset, glw::GLint yoffset,
131 glw::GLint zoffset, glw::GLsizei width,
132 glw::GLsizei height, glw::GLsizei depth,
133 glw::GLsizei bufSize, void* pixels);
135 PFNGLGETTEXTURESUBIMAGEPROC m_gl_GetTextureSubImage;
136 PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC m_gl_GetCompressedTextureSubImage;
138 /* Private member functions. */
141 bool testExistingTextureObjectError();
143 bool testBufferOrMultisampledTargetError();
145 bool testNegativeOffsetError();
147 bool testBoundsError();
149 bool testOneDimmensionalTextureErrors();
151 bool testTwoDimmensionalTextureErrors();
153 bool testBufferSizeError();
157 /* Private static constants. */
158 static const glw::GLubyte s_texture_data[];
159 static const glw::GLuint s_texture_data_size;
160 static const glw::GLuint s_texture_data_width;
161 static const glw::GLuint s_texture_data_height;
163 static const glw::GLubyte s_texture_data_compressed[];
164 static const glw::GLuint s_texture_data_compressed_size;
165 static const glw::GLuint s_texture_data_compressed_width;
166 static const glw::GLuint s_texture_data_compressed_height;
168 static const glw::GLuint s_destination_buffer_size;
174 * The Functional test verifies that functions glGetTextureSubImage and
175 * glGetCompressedTextureSubImage works properly. The whole test shall be
176 * constructed as follows:
178 * for each tested function
179 * for each supported texture target
180 * prepare and upload texture
181 * download texture using the function
182 * compare uploaded texture with downloaded texture
186 * * tested functions are:
187 * - GetTextureSubImage,
188 * - GetCompressedTextureSubImage;
189 * * supported uncompressed texture targets are:
191 * - GL_TEXTURE_1D_ARRAY,
193 * - GL_TEXTURE_2D_ARRAY,
195 * - GL_TEXTURE_CUBE_MAP,
196 * - GL_TEXTURE_CUBE_MAP_ARRAY,
197 * - GL_TEXTURE_RECTANGLE;
198 * * supported compressed texture targets are:
200 * - GL_TEXTURE_2D_ARRAY,
201 * - GL_TEXTURE_CUBE_MAP,
202 * - GL_TEXTURE_CUBE_MAP_ARRAY;
203 * * texture internal format shall be GL_RGBA8 and
204 * GL_COMPRESSED_RGB8_ETC2;
205 * * use linear dimmension of texture equal to 8;
206 * * use offset of 4 (if dimmension is available);
207 * * use width/height/depth of 4 (if dimmension is available).
209 class Functional : public deqp::TestCase
212 Functional(deqp::Context& context);
214 IterateResult iterate(void);
217 /* Private member variables. */
218 deqp::Context& m_context;
219 glw::GLuint m_texture;
221 /* Private member functions. */
222 void prepare(glw::GLenum target, bool is_compressed);
223 bool check(glw::GLenum target, bool is_compressed);
226 /* Get(Compressed)TextureSubImage function pointer and type declarations. */
227 typedef void(GLW_APIENTRY* PFNGLGETTEXTURESUBIMAGEPROC)(glw::GLuint texture, glw::GLint level, glw::GLint xoffset,
228 glw::GLint yoffset, glw::GLint zoffset, glw::GLsizei width,
229 glw::GLsizei height, glw::GLsizei depth, glw::GLenum format,
230 glw::GLenum type, glw::GLsizei bufSize, void* pixels);
232 typedef void(GLW_APIENTRY* PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)(glw::GLuint texture, glw::GLint level,
233 glw::GLint xoffset, glw::GLint yoffset,
234 glw::GLint zoffset, glw::GLsizei width,
235 glw::GLsizei height, glw::GLsizei depth,
236 glw::GLsizei bufSize, void* pixels);
238 PFNGLGETTEXTURESUBIMAGEPROC m_gl_GetTextureSubImage;
239 PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC m_gl_GetCompressedTextureSubImage;
241 /* Static constants. */
242 static const glw::GLubyte s_texture_data[];
243 static const glw::GLsizei s_texture_data_size;
244 static const glw::GLsizei s_texture_data_width;
245 static const glw::GLsizei s_texture_data_height;
246 static const glw::GLsizei s_texture_data_depth;
248 static const glw::GLubyte s_texture_data_compressed[];
249 static const glw::GLsizei s_texture_data_compressed_size;
252 /* Functional class */
253 } /* namespace GetTextureSubImage */
254 } /* namespace gl4cts */
256 #endif // _GL4CGETTEXTURESUBIMAGETESTS_HPP