• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 } // 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,
60 															 const std::string&		name,
61 															 const std::string&		description,
62 															 const TestStageFlags	testStageFlags,
63 															 deUint32				features,
64 															 deUint32				seed);
65 
66 private:
67 	void						generateBlock				(de::Random& rnd, deUint32 layoutFlags);
68 	void						generateBlockMember			(de::Random& rnd, InterfaceBlock& block, const int numBlockMembers, int& numMissing);
69 	VarType						generateType				(de::Random& rnd, int typeDepth, bool arrayOk);
70 	std::vector<glu::DataType>	fillTypeCandidates			(void);
71 
72 	const deUint32				m_features;
73 	const bool					m_explicitXfbOffsets;
74 	const int					m_maxBlocks;
75 	const int					m_maxInstances;
76 	const int					m_maxArrayLength;
77 	const int					m_maxStructDepth;
78 	const int					m_maxBlockMembers;
79 	const int					m_maxStructMembers;
80 	const deUint32				m_seed;
81 
82 	int							m_blockNdx;
83 	int							m_interfaceNdx;
84 	int							m_structNdx;
85 	std::vector<glu::DataType>	m_primitiveTypeCandidates;
86 };
87 
88 } // TransformFeedback
89 } // vkt
90 
91 #endif // _VKTTRANSFORMFEEDBACKRANDOMLAYOUTCASE_HPP
92