1 #ifndef _VKTRANDOMUNIFORMBLOCKCASE_HPP 2 #define _VKTRANDOMUNIFORMBLOCKCASE_HPP 3 /*------------------------------------------------------------------------ 4 * Vulkan Conformance Tests 5 * ------------------------ 6 * 7 * Copyright (c) 2015 The Khronos Group Inc. 8 * Copyright (c) 2015 Samsung Electronics Co., Ltd. 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 * 22 *//*! 23 * \file 24 * \brief Random uniform block layout case. 25 *//*--------------------------------------------------------------------*/ 26 27 #include "vktUniformBlockCase.hpp" 28 29 namespace de 30 { 31 class Random; 32 } // de 33 34 namespace vkt 35 { 36 namespace ubo 37 { 38 39 enum FeatureBits 40 { 41 FEATURE_VECTORS = (1<<0), 42 FEATURE_MATRICES = (1<<1), 43 FEATURE_ARRAYS = (1<<2), 44 FEATURE_STRUCTS = (1<<3), 45 FEATURE_NESTED_STRUCTS = (1<<4), 46 FEATURE_INSTANCE_ARRAYS = (1<<5), 47 FEATURE_VERTEX_BLOCKS = (1<<6), 48 FEATURE_FRAGMENT_BLOCKS = (1<<7), 49 FEATURE_SHARED_BLOCKS = (1<<8), 50 FEATURE_UNUSED_UNIFORMS = (1<<9), 51 FEATURE_UNUSED_MEMBERS = (1<<10), 52 FEATURE_PACKED_LAYOUT = (1<<12), 53 FEATURE_SHARED_LAYOUT = (1<<13), 54 FEATURE_STD140_LAYOUT = (1<<14), 55 FEATURE_MATRIX_LAYOUT = (1<<15), //!< Matrix layout flags. 56 FEATURE_ARRAYS_OF_ARRAYS = (1<<16), 57 FEATURE_OUT_OF_ORDER_OFFSETS = (1<<17), 58 FEATURE_16BIT_STORAGE = (1<<18), 59 FEATURE_8BIT_STORAGE = (1<<19), 60 FEATURE_STD430_LAYOUT = (1<<20), 61 FEATURE_SCALAR_LAYOUT = (1<<21), 62 }; 63 64 class RandomUniformBlockCase : public UniformBlockCase 65 { 66 public: 67 RandomUniformBlockCase (tcu::TestContext& testCtx, 68 const std::string& name, 69 const std::string& description, 70 BufferMode bufferMode, 71 deUint32 features, 72 deUint32 seed); 73 74 private: 75 void generateBlock (de::Random& rnd, deUint32 layoutFlags); 76 void generateUniform (de::Random& rnd, UniformBlock& block); 77 VarType generateType (de::Random& rnd, int typeDepth, bool arrayOk); 78 79 const deUint32 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 deUint32 m_seed; 89 90 int m_blockNdx; 91 int m_uniformNdx; 92 int m_structNdx; 93 }; 94 95 } // ubo 96 } // vkt 97 98 #endif // _VKTRANDOMUNIFORMBLOCKCASE_HPP 99