1 #ifndef _VKTTRANSFORMFEEDBACKRANDOMLAYOUTCASE_HPP
2 #define _VKTTRANSFORMFEEDBACKRANDOMLAYOUTCASE_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  * Copyright (c) 2018 The Khronos Group Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  *
23  *//*!
24  * \file
25  * \brief Vulkan Transform Feedback Fuzz Random Layout Tests
26  *//*--------------------------------------------------------------------*/
27 
28 #include "vktTransformFeedbackFuzzLayoutCase.hpp"
29 
30 namespace de
31 {
32 class Random;
33 } // namespace de
34 
35 namespace vkt
36 {
37 namespace TransformFeedback
38 {
39 
40 enum FeatureBits
41 {
42     FEATURE_VECTORS                  = (1 << 0),
43     FEATURE_MATRICES                 = (1 << 1),
44     FEATURE_ARRAYS                   = (1 << 2),
45     FEATURE_STRUCTS                  = (1 << 3),
46     FEATURE_NESTED_STRUCTS           = (1 << 4),
47     FEATURE_INSTANCE_ARRAYS          = (1 << 5),
48     FEATURE_ARRAYS_OF_ARRAYS         = (1 << 6),
49     FEATURE_DOUBLES                  = (1 << 7),
50     FEATURE_UNASSIGNED_FIELDS        = (1 << 8),
51     FEATURE_UNASSIGNED_BLOCK_MEMBERS = (1 << 9),
52     FEATURE_MISSING_BLOCK_MEMBERS    = (1 << 10), // Add holes into XFB buffer
53     FEATURE_OUT_OF_ORDER_OFFSETS     = (1 << 11),
54 };
55 
56 class RandomInterfaceBlockCase : public InterfaceBlockCase
57 {
58 public:
59     RandomInterfaceBlockCase(tcu::TestContext &testCtx, const std::string &name, const TestStageFlags testStageFlags,
60                              uint32_t features, uint32_t seed);
61 
62 private:
63     void generateBlock(de::Random &rnd, uint32_t layoutFlags);
64     void generateBlockMember(de::Random &rnd, InterfaceBlock &block, const int numBlockMembers, int &numMissing);
65     VarType generateType(de::Random &rnd, int typeDepth, bool arrayOk);
66     std::vector<glu::DataType> fillTypeCandidates(void);
67 
68     const uint32_t m_features;
69     const bool m_explicitXfbOffsets;
70     const int m_maxBlocks;
71     const int m_maxInstances;
72     const int m_maxArrayLength;
73     const int m_maxStructDepth;
74     const int m_maxBlockMembers;
75     const int m_maxStructMembers;
76     const uint32_t m_seed;
77 
78     int m_blockNdx;
79     int m_interfaceNdx;
80     int m_structNdx;
81     std::vector<glu::DataType> m_primitiveTypeCandidates;
82 };
83 
84 } // namespace TransformFeedback
85 } // namespace vkt
86 
87 #endif // _VKTTRANSFORMFEEDBACKRANDOMLAYOUTCASE_HPP
88