1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2014-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  * \file esextcTextureBorderClampTests.cpp
26  * \brief Test group for texture border clamp tests
27  */ /*-------------------------------------------------------------------*/
28 
29 #include "esextcTextureBorderClampTests.hpp"
30 #include "esextcTextureBorderClampGetTexParameterIErrors.hpp"
31 #include "esextcTextureBorderClampParameterBorderColorError.hpp"
32 #include "esextcTextureBorderClampParameterTextureBorderColor.hpp"
33 #include "esextcTextureBorderClampSamplerParameterIError.hpp"
34 #include "esextcTextureBorderClampSamplerParameterIWithWrongPname.hpp"
35 #include "esextcTextureBorderClampSamplingTexture.cpp"
36 #include "esextcTextureBorderClampSamplingTextureGroup.hpp"
37 #include "esextcTextureBorderClampTexParameterIErrors.hpp"
38 #include "glwEnums.hpp"
39 
40 namespace glcts
41 {
42 
43 /** Constructor
44  *
45  * @param context       Test context
46  * @param glslVersion   GLSL version
47  **/
TextureBorderClampTests(glcts::Context & context,const ExtParameters & extParams)48 TextureBorderClampTests::TextureBorderClampTests(glcts::Context &context, const ExtParameters &extParams)
49     : TestCaseGroupBase(context, extParams, "texture_border_clamp", "Texture Border Clamp Tests")
50 {
51     /* No implementation needed */
52 }
53 
54 /** Initializes test cases for texture border clamp tests
55  **/
init(void)56 void TextureBorderClampTests::init(void)
57 {
58     /* Initialize base class */
59     TestCaseGroupBase::init();
60 
61     /* Texture Border Clamp Border Color Errors (Test 1) */
62     addChild(
63         new TextureBorderClampParameterBorderColorErrorTest(m_context, m_extParams, "border_color_errors", "Test 1"));
64 
65     /* Texture Border Clamp glTexParameterIivEXT(), glTexParameterIuivEXT() Errors (Test 2) */
66     addChild(new TextureBorderClampTexParameterIErrorsTest(m_context, m_extParams, "texparameteri_errors", "Test 2"));
67 
68     /* Texture Border Clamp glGetTexParameterIivEXT(), glGetTexParameterIuivEXT() Errors (Test 3)*/
69     addChild(
70         new TextureBorderClampGetTexParameterIErrorsTest(m_context, m_extParams, "gettexparameteri_errors", "Test 3"));
71 
72     /* Texture Border Clamp glGetSamplerParameterI* and glSamplerParameterI* errors for non generate sampler (Test 4)*/
73     addChild(new TextureBorderClampSamplerParameterIErrorTest(m_context, m_extParams,
74                                                               "samplerparameteri_non_gen_sampler_error", "Test 4"));
75 
76     /* Texture Border Clamp glGetSamplerParameterI* and glSamplerParameterI* errors for non generate sampler (Test 5)*/
77     addChild(new TextureBorderClampSamplerParameterIWithWrongPnameTest(m_context, m_extParams,
78                                                                        "samplerparameteri_with_wrong_pname", "Test 5"));
79 
80     /* Texture Border Clamp glGetSamplerParameterI* and glSamplerParameterI* errors for non GL_TEXTURE_BORDER_COLOR_EXT (Test 6)*/
81     addChild(new TextureBorderClampParameterTextureBorderColor(m_context, m_extParams, "samplerparameteri_border_color",
82                                                                "Test 6"));
83 
84     /* Texture Border Clamp Sampling Texture (Test 7) */
85     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DRGBA32F(
86         4, 4, GL_TEXTURE_2D, GL_RGBA32F, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 256, 256, 1, 0.0f, 1.0f, 0, 255,
87         GL_FLOAT, GL_UNSIGNED_BYTE);
88 
89     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
90         m_context, m_extParams, "Texture2DRGBA32F", "Test 7", configurationTexture2DRGBA32F));
91 
92     /* GL_R32I */
93     TestConfiguration<glw::GLint, glw::GLint> configurationTexture2DR32I(1, 4, GL_TEXTURE_2D, GL_R32I, GL_R32I,
94                                                                          GL_NEAREST, GL_RED_INTEGER, GL_RGBA_INTEGER,
95                                                                          256, 256, 1, 0, 255, 0, 255, GL_INT, GL_INT);
96 
97     addChild(new TextureBorderClampSamplingTexture<glw::GLint, glw::GLint>(m_context, m_extParams, "Texture2DR32I",
98                                                                            "Test 7", configurationTexture2DR32I));
99 
100     /* GL_R32UI */
101     TestConfiguration<glw::GLuint, glw::GLuint> configurationTexture2DR32UI(
102         1, 4, GL_TEXTURE_2D, GL_R32UI, GL_R32UI, GL_NEAREST, GL_RED_INTEGER, GL_RGBA_INTEGER, 256, 256, 1, 0, 255, 0,
103         255, GL_UNSIGNED_INT, GL_UNSIGNED_INT);
104 
105     addChild(new TextureBorderClampSamplingTexture<glw::GLuint, glw::GLuint>(m_context, m_extParams, "Texture2DR32UI",
106                                                                              "Test 7", configurationTexture2DR32UI));
107 
108     /* GL_RGBA8 */
109     TestConfiguration<glw::GLubyte, glw::GLubyte> configurationTexture2DRGBA8(
110         4, 4, GL_TEXTURE_2D, GL_RGBA8, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 256, 256, 1, 0, 255, 0, 255,
111         GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE);
112 
113     addChild(new TextureBorderClampSamplingTexture<glw::GLubyte, glw::GLubyte>(m_context, m_extParams, "Texture2DRGBA8",
114                                                                                "Test 7", configurationTexture2DRGBA8));
115 
116     /* GL_DEPTH_COMPONENT32F */
117     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DDC32F(
118         1, 1, GL_TEXTURE_2D, GL_DEPTH_COMPONENT32F, GL_R8, GL_NEAREST, GL_DEPTH_COMPONENT, GL_RED, 256, 256, 1, 0, 255,
119         0, 255, GL_FLOAT, GL_UNSIGNED_BYTE);
120 
121     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(m_context, m_extParams, "Texture2DDC32F",
122                                                                                "Test 7", configurationTexture2DDC32F));
123 
124     /* GL_DEPTH_COMPONENT16 */
125     TestConfiguration<glw::GLushort, glw::GLubyte> configurationTexture2DDC16(
126         1, 1, GL_TEXTURE_2D, GL_DEPTH_COMPONENT16, GL_R8, GL_NEAREST, GL_DEPTH_COMPONENT, GL_RED, 256, 256, 1, 0, 255,
127         0, 255, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE);
128 
129     addChild(new TextureBorderClampSamplingTexture<glw::GLushort, glw::GLubyte>(m_context, m_extParams, "Texture2DDC16",
130                                                                                 "Test 7", configurationTexture2DDC16));
131 
132     /* GL_COMPRESSED_RGBA8_ETC2_EAC */
133     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DCompressed(
134         4, 4, GL_TEXTURE_2D, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 64, 64, 1, 0, 1, 0,
135         255, GL_FLOAT, GL_UNSIGNED_BYTE);
136 
137     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
138         m_context, m_extParams, "Texture2DCompressed", "Test 7", configurationTexture2DCompressed));
139 
140     /* Target GL_TEXTURE_2D_ARRAY */
141 
142     /* GL_RGBA32F */
143     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DArrayRGBA32F(
144         4, 4, GL_TEXTURE_2D_ARRAY, GL_RGBA32F, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 256, 256, 6, 0.0f, 1.0f, 0, 255,
145         GL_FLOAT, GL_UNSIGNED_BYTE);
146 
147     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
148         m_context, m_extParams, "Texture2DArrayRGBA32F", "Test 7", configurationTexture2DArrayRGBA32F));
149 
150     /* GL_R32I */
151     TestConfiguration<glw::GLint, glw::GLint> configurationTexture2DArrayR32I(
152         1, 4, GL_TEXTURE_2D_ARRAY, GL_R32I, GL_R32I, GL_NEAREST, GL_RED_INTEGER, GL_RGBA_INTEGER, 256, 256, 6, 0, 255,
153         0, 255, GL_INT, GL_INT);
154 
155     addChild(new TextureBorderClampSamplingTexture<glw::GLint, glw::GLint>(m_context, m_extParams, "Texture2DArrayR32I",
156                                                                            "Test 7", configurationTexture2DArrayR32I));
157 
158     /* GL_R32UI */
159     TestConfiguration<glw::GLuint, glw::GLuint> configurationTexture2DArrayR32UI(
160         1, 4, GL_TEXTURE_2D_ARRAY, GL_R32UI, GL_R32UI, GL_NEAREST, GL_RED_INTEGER, GL_RGBA_INTEGER, 256, 256, 6, 0, 255,
161         0, 255, GL_UNSIGNED_INT, GL_UNSIGNED_INT);
162 
163     addChild(new TextureBorderClampSamplingTexture<glw::GLuint, glw::GLuint>(
164         m_context, m_extParams, "Texture2DArrayR32UI", "Test 7", configurationTexture2DArrayR32UI));
165 
166     /* GL_RGBA8 */
167     TestConfiguration<glw::GLubyte, glw::GLubyte> configurationTexture2DArrayRGBA8(
168         4, 4, GL_TEXTURE_2D_ARRAY, GL_RGBA8, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 256, 256, 6, 0, 255, 0, 255,
169         GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE);
170 
171     addChild(new TextureBorderClampSamplingTexture<glw::GLubyte, glw::GLubyte>(
172         m_context, m_extParams, "Texture2DArrayRGBA8", "Test 7", configurationTexture2DArrayRGBA8));
173 
174     /* GL_COMPRESSED_RGBA8_ETC2_EAC */
175     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DArrayCompressed(
176         4, 4, GL_TEXTURE_2D_ARRAY, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 64, 64, 6, 0,
177         1, 0, 255, GL_FLOAT, GL_UNSIGNED_BYTE);
178 
179     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
180         m_context, m_extParams, "Texture2DArrayCompressed", "Test 7", configurationTexture2DArrayCompressed));
181 
182     /* Target GL_TEXTURE_3D */
183 
184     /* GL_RGBA32F */
185     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture3DRGBA32F(
186         4, 4, GL_TEXTURE_3D, GL_RGBA32F, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 256, 256, 6, 0.0f, 1.0f, 0, 255,
187         GL_FLOAT, GL_UNSIGNED_BYTE);
188     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
189         m_context, m_extParams, "Texture3DRGBA32F", "Test 7", configurationTexture3DRGBA32F));
190 
191     /* GL_R32I */
192     TestConfiguration<glw::GLint, glw::GLint> configurationTexture3DR32I(1, 4, GL_TEXTURE_3D, GL_R32I, GL_R32I,
193                                                                          GL_NEAREST, GL_RED_INTEGER, GL_RGBA_INTEGER,
194                                                                          256, 256, 6, 0, 255, 0, 255, GL_INT, GL_INT);
195 
196     addChild(new TextureBorderClampSamplingTexture<glw::GLint, glw::GLint>(m_context, m_extParams, "Texture3DR32I",
197                                                                            "Test 7", configurationTexture3DR32I));
198 
199     /* GL_R32UI */
200     TestConfiguration<glw::GLuint, glw::GLuint> configurationTexture3DR32UI(
201         1, 4, GL_TEXTURE_3D, GL_R32UI, GL_R32UI, GL_NEAREST, GL_RED_INTEGER, GL_RGBA_INTEGER, 256, 256, 6, 0, 255, 0,
202         255, GL_UNSIGNED_INT, GL_UNSIGNED_INT);
203 
204     addChild(new TextureBorderClampSamplingTexture<glw::GLuint, glw::GLuint>(m_context, m_extParams, "Texture3DR32UI",
205                                                                              "Test 7", configurationTexture3DR32UI));
206 
207     /* GL_RGBA8 */
208     TestConfiguration<glw::GLubyte, glw::GLubyte> configurationTexture3DRGBA8(
209         4, 4, GL_TEXTURE_3D, GL_RGBA8, GL_RGBA8, GL_NEAREST, GL_RGBA, GL_RGBA, 256, 256, 6, 0, 255, 0, 255,
210         GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE);
211 
212     addChild(new TextureBorderClampSamplingTexture<glw::GLubyte, glw::GLubyte>(m_context, m_extParams, "Texture3DRGBA8",
213                                                                                "Test 7", configurationTexture3DRGBA8));
214 
215     /* Filtering GL_LINEAR */
216 
217     /* Target GL_TEXTURE_2D */
218 
219     /* GL_RGBA32F */
220     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DRGBA32FLinear(
221         4, 4, GL_TEXTURE_2D, GL_RGBA32F, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 256, 256, 1, 0.0f, 1.0f, 0, 255,
222         GL_FLOAT, GL_UNSIGNED_BYTE);
223 
224     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
225         m_context, m_extParams, "Texture2DRGBA32FLinear", "Test 7", configurationTexture2DRGBA32FLinear));
226 
227     /* GL_RGBA8 */
228     TestConfiguration<glw::GLubyte, glw::GLubyte> configurationTexture2DRGBA8Linear(
229         4, 4, GL_TEXTURE_2D, GL_RGBA8, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 256, 256, 1, 0, 255, 0, 255,
230         GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE);
231 
232     addChild(new TextureBorderClampSamplingTexture<glw::GLubyte, glw::GLubyte>(
233         m_context, m_extParams, "Texture2DRGBA8Linear", "Test 7", configurationTexture2DRGBA8Linear));
234 
235     /* Linear filtering of non-shadow-compare depth textures is texture incomplete on GLES. */
236     if (!glu::isContextTypeES(m_context.getRenderContext().getType()))
237     {
238         /* GL_DEPTH_COMPONENT32F */
239         TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DDC32FLinear(
240             1, 1, GL_TEXTURE_2D, GL_DEPTH_COMPONENT32F, GL_R8, GL_LINEAR, GL_DEPTH_COMPONENT, GL_RED, 256, 256, 1, 0,
241             255, 0, 255, GL_FLOAT, GL_UNSIGNED_BYTE);
242 
243         addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
244             m_context, m_extParams, "Texture2DDC32FLinear", "Test 7", configurationTexture2DDC32FLinear));
245 
246         /* GL_DEPTH_COMPONENT16 */
247         TestConfiguration<glw::GLushort, glw::GLubyte> configurationTexture2DDC16Linear(
248             1, 1, GL_TEXTURE_2D, GL_DEPTH_COMPONENT16, GL_R8, GL_LINEAR, GL_DEPTH_COMPONENT, GL_RED, 256, 256, 1, 0,
249             255, 0, 255, GL_UNSIGNED_SHORT, GL_UNSIGNED_BYTE);
250 
251         addChild(new TextureBorderClampSamplingTexture<glw::GLushort, glw::GLubyte>(
252             m_context, m_extParams, "Texture2DDC16Linear", "Test 7", configurationTexture2DDC16Linear));
253     }
254 
255     /* GL_COMPRESSED_RGBA8_ETC2_EAC */
256     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DCompressedLinear(
257         4, 4, GL_TEXTURE_2D, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 64, 64, 1, 0, 1, 0,
258         255, GL_FLOAT, GL_UNSIGNED_BYTE);
259 
260     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
261         m_context, m_extParams, "Texture2DCompressedLinear", "Test 7", configurationTexture2DCompressedLinear));
262 
263     /* Target GL_TEXTURE_2D_ARRAY */
264 
265     /* GL_RGBA32F */
266     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DArrayRGBA32FLinear(
267         4, 4, GL_TEXTURE_2D_ARRAY, GL_RGBA32F, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 256, 256, 6, 0.0f, 1.0f, 0, 255,
268         GL_FLOAT, GL_UNSIGNED_BYTE);
269 
270     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
271         m_context, m_extParams, "Texture2DArrayRGBA32FLinear", "Test 7", configurationTexture2DArrayRGBA32FLinear));
272 
273     /* GL_RGBA8 */
274     TestConfiguration<glw::GLubyte, glw::GLubyte> configurationTexture2DArrayRGBA8Linear(
275         4, 4, GL_TEXTURE_2D_ARRAY, GL_RGBA8, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 256, 256, 6, 0, 255, 0, 255,
276         GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE);
277 
278     addChild(new TextureBorderClampSamplingTexture<glw::GLubyte, glw::GLubyte>(
279         m_context, m_extParams, "Texture2DArrayRGBA8Linear", "Test 7", configurationTexture2DArrayRGBA8Linear));
280 
281     /* GL_COMPRESSED_RGBA8_ETC2_EAC */
282     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture2DArrayCompressedLinear(
283         4, 4, GL_TEXTURE_2D_ARRAY, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 64, 64, 6, 0, 1,
284         0, 255, GL_FLOAT, GL_UNSIGNED_BYTE);
285 
286     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
287         m_context, m_extParams, "Texture2DArrayCompressedLinear", "Test 7",
288         configurationTexture2DArrayCompressedLinear));
289 
290     /* Target GL_TEXTURE_3D*/
291 
292     /* GL_RGBA32F */
293     TestConfiguration<glw::GLfloat, glw::GLubyte> configurationTexture3DRGBA32FLinear(
294         4, 4, GL_TEXTURE_3D, GL_RGBA32F, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 256, 256, 6, 0.0f, 1.0f, 0, 255,
295         GL_FLOAT, GL_UNSIGNED_BYTE);
296 
297     addChild(new TextureBorderClampSamplingTexture<glw::GLfloat, glw::GLubyte>(
298         m_context, m_extParams, "Texture3DRGBA32FLinear", "Test 7", configurationTexture3DRGBA32FLinear));
299 
300     /* GL_RGBA8 */
301     TestConfiguration<glw::GLubyte, glw::GLubyte> configurationTexture3DRGBA8Linear(
302         4, 4, GL_TEXTURE_3D, GL_RGBA8, GL_RGBA8, GL_LINEAR, GL_RGBA, GL_RGBA, 256, 256, 6, 0, 255, 0, 255,
303         GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE);
304 
305     addChild(new TextureBorderClampSamplingTexture<glw::GLubyte, glw::GLubyte>(
306         m_context, m_extParams, "Texture3DRGBA8Linear", "Test 7", configurationTexture3DRGBA8Linear));
307 }
308 
309 } // namespace glcts
310