1 #ifndef _GLSRANDOMUNIFORMBLOCKCASE_HPP 2 #define _GLSRANDOMUNIFORMBLOCKCASE_HPP 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program OpenGL (ES) Module 5 * ----------------------------------------------- 6 * 7 * Copyright 2014 The Android Open Source Project 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 *//*! 22 * \file 23 * \brief Random uniform block layout case. 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "tcuTestCase.hpp" 28 #include "glsUniformBlockCase.hpp" 29 30 namespace de 31 { 32 class Random; 33 } // namespace de 34 35 namespace deqp 36 { 37 namespace gls 38 { 39 40 namespace ub 41 { 42 43 enum FeatureBits 44 { 45 FEATURE_VECTORS = (1 << 0), 46 FEATURE_MATRICES = (1 << 1), 47 FEATURE_ARRAYS = (1 << 2), 48 FEATURE_STRUCTS = (1 << 3), 49 FEATURE_NESTED_STRUCTS = (1 << 4), 50 FEATURE_INSTANCE_ARRAYS = (1 << 5), 51 FEATURE_VERTEX_BLOCKS = (1 << 6), 52 FEATURE_FRAGMENT_BLOCKS = (1 << 7), 53 FEATURE_SHARED_BLOCKS = (1 << 8), 54 FEATURE_UNUSED_UNIFORMS = (1 << 9), 55 FEATURE_UNUSED_MEMBERS = (1 << 10), 56 FEATURE_PACKED_LAYOUT = (1 << 11), 57 FEATURE_SHARED_LAYOUT = (1 << 12), 58 FEATURE_STD140_LAYOUT = (1 << 13), 59 FEATURE_MATRIX_LAYOUT = (1 << 14), //!< Matrix layout flags. 60 FEATURE_ARRAYS_OF_ARRAYS = (1 << 15) 61 }; 62 63 } // namespace ub 64 65 class RandomUniformBlockCase : public UniformBlockCase 66 { 67 public: 68 RandomUniformBlockCase(tcu::TestContext &testCtx, glu::RenderContext &renderCtx, glu::GLSLVersion glslVersion, 69 const char *name, const char *description, BufferMode bufferMode, uint32_t features, 70 uint32_t seed); 71 72 void init(void); 73 74 private: 75 void generateBlock(de::Random &rnd, uint32_t layoutFlags); 76 void generateUniform(de::Random &rnd, ub::UniformBlock &block); 77 ub::VarType generateType(de::Random &rnd, int typeDepth, bool arrayOk); 78 79 const uint32_t m_features; 80 const int m_maxVertexBlocks; 81 const int m_maxFragmentBlocks; 82 const int m_maxSharedBlocks; 83 const int m_maxInstances; 84 const int m_maxArrayLength; 85 const int m_maxStructDepth; 86 const int m_maxBlockMembers; 87 const int m_maxStructMembers; 88 const uint32_t m_seed; 89 90 int m_blockNdx; 91 int m_uniformNdx; 92 int m_structNdx; 93 }; 94 95 } // namespace gls 96 } // namespace deqp 97 98 #endif // _GLSRANDOMUNIFORMBLOCKCASE_HPP 99