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 } // namespace 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 FEATURE_DESCRIPTOR_INDEXING = (1 << 22), 63 }; 64 65 class RandomUniformBlockCase : public UniformBlockCase 66 { 67 public: 68 RandomUniformBlockCase(tcu::TestContext &testCtx, const std::string &name, BufferMode bufferMode, uint32_t features, 69 uint32_t seed); 70 71 private: 72 void generateBlock(de::Random &rnd, uint32_t layoutFlags); 73 void generateUniform(de::Random &rnd, UniformBlock &block, uint32_t complexity); 74 VarType generateType(de::Random &rnd, int typeDepth, bool arrayOk, uint32_t complexity); 75 76 const uint32_t m_features; 77 const int m_maxVertexBlocks; 78 const int m_maxFragmentBlocks; 79 const int m_maxSharedBlocks; 80 const int m_maxInstances; 81 const int m_maxArrayLength; 82 const int m_maxStructDepth; 83 const int m_maxBlockMembers; 84 const int m_maxStructMembers; 85 const uint32_t m_seed; 86 87 int m_blockNdx; 88 int m_uniformNdx; 89 int m_structNdx; 90 int m_availableDescriptorUniformBuffers; 91 }; 92 93 } // namespace ubo 94 } // namespace vkt 95 96 #endif // _VKTRANDOMUNIFORMBLOCKCASE_HPP 97