1 #ifndef _GLSATTRIBUTELOCATIONTESTS_HPP
2 #define _GLSATTRIBUTELOCATIONTESTS_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL (ES) Module
5 * -----------------------------------------------
7 * Copyright 2014 The Android Open Source Project
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.
23 * \brief Attribute location tests
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
42 namespace AttributeLocationTestUtil
48 AttribType (const std::string& name, deUint32 locationSize, deUint32 typeEnum);
50 const std::string& getName (void) const { return m_name; }
51 deUint32 getLocationSize (void) const { return m_locationSize; }
52 deUint32 getGLTypeEnum (void) const { return m_glTypeEnum; }
56 deUint32 m_locationSize;
57 deUint32 m_glTypeEnum;
69 Cond (ConstCond cond);
70 explicit Cond (const std::string& name, bool negate = true);
71 bool operator== (const Cond& other) const { return m_negate == other.m_negate && m_name == other.m_name; }
72 bool operator!= (const Cond& other) const { return !(*this == other); }
73 const std::string getName (void) const { return m_name; }
74 bool getNegate (void) const { return m_negate; }
86 // Location is not defined
96 Attribute (const AttribType& type,
97 const std::string& name,
98 deInt32 layoutLocation = LOC_UNDEF,
99 const Cond& cond = Cond::COND_ALWAYS,
100 int arraySize = NOT_ARRAY);
102 const AttribType getType (void) const { return m_type; }
103 const std::string& getName (void) const { return m_name; }
104 deInt32 getLayoutLocation (void) const { return m_layoutLocation; }
105 const Cond& getCondition (void) const { return m_cond; }
106 int getArraySize (void) const { return m_arraySize; }
111 deInt32 m_layoutLocation;
119 Bind (const std::string& attribute, deUint32 location);
121 const std::string& getAttributeName (void) const { return m_attribute; }
122 deUint32 getLocation (void) const { return m_location; }
125 std::string m_attribute;
129 } // AttributeLocationTestUtil
131 // Simple bind attribute test
132 class BindAttributeTest : public tcu::TestCase
135 typedef AttributeLocationTestUtil::AttribType AttribType;
137 BindAttributeTest (tcu::TestContext& testCtx,
138 glu::RenderContext& renderCtx,
139 const AttribType& type,
140 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
142 virtual IterateResult iterate (void);
145 glu::RenderContext& m_renderCtx;
146 const AttribType m_type;
147 const int m_arraySize;
150 // Bind maximum number of attributes
151 class BindMaxAttributesTest : public tcu::TestCase
154 typedef AttributeLocationTestUtil::AttribType AttribType;
156 BindMaxAttributesTest (tcu::TestContext& testCtx,
157 glu::RenderContext& renderCtx,
158 const AttribType& type,
159 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
161 virtual IterateResult iterate (void);
164 glu::RenderContext& m_renderCtx;
165 const AttribType m_type;
166 const int m_arraySize;
169 class BindAliasingAttributeTest : public tcu::TestCase
172 typedef AttributeLocationTestUtil::AttribType AttribType;
174 BindAliasingAttributeTest (tcu::TestContext& testCtx,
175 glu::RenderContext& renderCtx,
176 const AttribType& type,
178 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
180 virtual IterateResult iterate (void);
183 glu::RenderContext& m_renderCtx;
184 const AttribType m_type;
186 const int m_arraySize;
189 class BindMaxAliasingAttributeTest : public tcu::TestCase
192 typedef AttributeLocationTestUtil::AttribType AttribType;
194 BindMaxAliasingAttributeTest (tcu::TestContext& testCtx,
195 glu::RenderContext& renderCtx,
196 const AttribType& type,
197 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
199 virtual IterateResult iterate (void);
202 glu::RenderContext& m_renderCtx;
203 const AttribType m_type;
204 const int m_arraySize;
207 class BindInactiveAliasingAttributeTest : public tcu::TestCase
210 typedef AttributeLocationTestUtil::AttribType AttribType;
212 BindInactiveAliasingAttributeTest (tcu::TestContext& testCtx,
213 glu::RenderContext& renderCtx,
214 const AttribType& type,
215 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
217 virtual IterateResult iterate (void);
220 glu::RenderContext& m_renderCtx;
221 const AttribType m_type;
222 const int m_arraySize;
225 class BindHoleAttributeTest : public tcu::TestCase
228 typedef AttributeLocationTestUtil::AttribType AttribType;
230 BindHoleAttributeTest (tcu::TestContext& testCtx,
231 glu::RenderContext& renderCtx,
232 const AttribType& type,
233 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
235 virtual IterateResult iterate (void);
238 glu::RenderContext& m_renderCtx;
239 const AttribType m_type;
240 const int m_arraySize;
243 class PreAttachBindAttributeTest : public tcu::TestCase
246 PreAttachBindAttributeTest (tcu::TestContext& testCtx,
247 glu::RenderContext& renderCtx);
249 virtual IterateResult iterate (void);
252 glu::RenderContext& m_renderCtx;
255 class PreLinkBindAttributeTest : public tcu::TestCase
258 typedef AttributeLocationTestUtil::AttribType AttribType;
260 PreLinkBindAttributeTest (tcu::TestContext& testCtx,
261 glu::RenderContext& renderCtx);
263 virtual IterateResult iterate (void);
266 glu::RenderContext& m_renderCtx;
269 class PostLinkBindAttributeTest : public tcu::TestCase
272 typedef AttributeLocationTestUtil::AttribType AttribType;
274 PostLinkBindAttributeTest (tcu::TestContext& testCtx,
275 glu::RenderContext& renderCtx);
277 virtual IterateResult iterate (void);
280 glu::RenderContext& m_renderCtx;
283 class BindReattachAttributeTest : public tcu::TestCase
286 typedef AttributeLocationTestUtil::AttribType AttribType;
288 BindReattachAttributeTest (tcu::TestContext& testCtx,
289 glu::RenderContext& renderCtx);
291 virtual IterateResult iterate (void);
294 glu::RenderContext& m_renderCtx;
297 class LocationAttributeTest : public tcu::TestCase
300 typedef AttributeLocationTestUtil::AttribType AttribType;
302 LocationAttributeTest (tcu::TestContext& testCtx,
303 glu::RenderContext& renderCtx,
304 const AttribType& type,
305 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
307 virtual IterateResult iterate (void);
310 glu::RenderContext& m_renderCtx;
311 const AttribType m_type;
312 const int m_arraySize;
315 class LocationMaxAttributesTest : public tcu::TestCase
318 typedef AttributeLocationTestUtil::AttribType AttribType;
320 LocationMaxAttributesTest (tcu::TestContext& testCtx,
321 glu::RenderContext& renderCtx,
322 const AttribType& type,
323 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
325 virtual IterateResult iterate (void);
328 glu::RenderContext& m_renderCtx;
329 const AttribType m_type;
330 const int m_arraySize;
333 class LocationHoleAttributeTest : public tcu::TestCase
336 typedef AttributeLocationTestUtil::AttribType AttribType;
338 LocationHoleAttributeTest (tcu::TestContext& testCtx,
339 glu::RenderContext& renderCtx,
340 const AttribType& type,
341 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
343 virtual IterateResult iterate (void);
346 glu::RenderContext& m_renderCtx;
347 const AttribType m_type;
348 const int m_arraySize;
351 class MixedAttributeTest : public tcu::TestCase
354 typedef AttributeLocationTestUtil::AttribType AttribType;
356 MixedAttributeTest (tcu::TestContext& testCtx,
357 glu::RenderContext& renderCtx,
358 const AttribType& type,
359 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
361 virtual IterateResult iterate (void);
364 glu::RenderContext& m_renderCtx;
365 const AttribType m_type;
366 const int m_arraySize;
369 class MixedMaxAttributesTest : public tcu::TestCase
372 typedef AttributeLocationTestUtil::AttribType AttribType;
374 MixedMaxAttributesTest (tcu::TestContext& testCtx,
375 glu::RenderContext& renderCtx,
376 const AttribType& type,
377 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
379 virtual IterateResult iterate (void);
382 glu::RenderContext& m_renderCtx;
383 const AttribType m_type;
384 const int m_arraySize;
387 class MixedHoleAttributeTest : public tcu::TestCase
390 typedef AttributeLocationTestUtil::AttribType AttribType;
392 MixedHoleAttributeTest (tcu::TestContext& testCtx,
393 glu::RenderContext& renderCtx,
394 const AttribType& type,
395 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
397 virtual IterateResult iterate (void);
400 glu::RenderContext& m_renderCtx;
401 const AttribType m_type;
402 const int m_arraySize;
405 class BindRelinkAttributeTest : public tcu::TestCase
408 typedef AttributeLocationTestUtil::AttribType AttribType;
410 BindRelinkAttributeTest (tcu::TestContext& testCtx,
411 glu::RenderContext& renderCtx);
413 virtual IterateResult iterate (void);
416 glu::RenderContext& m_renderCtx;
419 class BindRelinkHoleAttributeTest : public tcu::TestCase
422 typedef AttributeLocationTestUtil::AttribType AttribType;
424 BindRelinkHoleAttributeTest (tcu::TestContext& testCtx,
425 glu::RenderContext& renderCtx,
426 const AttribType& type,
427 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
429 virtual IterateResult iterate (void);
432 glu::RenderContext& m_renderCtx;
433 const AttribType m_type;
434 const int m_arraySize;
437 class MixedRelinkHoleAttributeTest : public tcu::TestCase
440 typedef AttributeLocationTestUtil::AttribType AttribType;
442 MixedRelinkHoleAttributeTest (tcu::TestContext& testCtx,
443 glu::RenderContext& renderCtx,
444 const AttribType& type,
445 int arraySize = AttributeLocationTestUtil::Attribute::NOT_ARRAY);
447 virtual IterateResult iterate (void);
450 glu::RenderContext& m_renderCtx;
451 const AttribType m_type;
452 const int m_arraySize;
455 class PreAttachMixedAttributeTest : public tcu::TestCase
458 typedef AttributeLocationTestUtil::AttribType AttribType;
460 PreAttachMixedAttributeTest (tcu::TestContext& testCtx,
461 glu::RenderContext& renderCtx);
463 virtual IterateResult iterate (void);
466 glu::RenderContext& m_renderCtx;
469 class PreLinkMixedAttributeTest : public tcu::TestCase
472 typedef AttributeLocationTestUtil::AttribType AttribType;
474 PreLinkMixedAttributeTest (tcu::TestContext& testCtx,
475 glu::RenderContext& renderCtx);
477 virtual IterateResult iterate (void);
480 glu::RenderContext& m_renderCtx;
483 class PostLinkMixedAttributeTest : public tcu::TestCase
486 typedef AttributeLocationTestUtil::AttribType AttribType;
488 PostLinkMixedAttributeTest (tcu::TestContext& testCtx,
489 glu::RenderContext& renderCtx);
491 virtual IterateResult iterate (void);
494 glu::RenderContext& m_renderCtx;
497 class MixedReattachAttributeTest : public tcu::TestCase
500 typedef AttributeLocationTestUtil::AttribType AttribType;
502 MixedReattachAttributeTest (tcu::TestContext& testCtx,
503 glu::RenderContext& renderCtx);
505 virtual IterateResult iterate (void);
508 glu::RenderContext& m_renderCtx;
511 class MixedRelinkAttributeTest : public tcu::TestCase
514 typedef AttributeLocationTestUtil::AttribType AttribType;
516 MixedRelinkAttributeTest(tcu::TestContext& testCtx,
517 glu::RenderContext& renderCtx);
519 virtual IterateResult iterate (void);
522 glu::RenderContext& m_renderCtx;
528 #endif // _GLSATTRIBUTELOCATIONTESTS_HPP