1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 3.1 Module
3*35238bceSAndroid Build Coastguard Worker * -------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief Uniform block tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es31fUniformBlockTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "glsUniformBlockCase.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "glsRandomUniformBlockCase.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "tcuCommandLine.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "deRandom.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "deStringUtil.hpp"
30*35238bceSAndroid Build Coastguard Worker
31*35238bceSAndroid Build Coastguard Worker using std::string;
32*35238bceSAndroid Build Coastguard Worker using std::vector;
33*35238bceSAndroid Build Coastguard Worker
34*35238bceSAndroid Build Coastguard Worker namespace deqp
35*35238bceSAndroid Build Coastguard Worker {
36*35238bceSAndroid Build Coastguard Worker namespace gles31
37*35238bceSAndroid Build Coastguard Worker {
38*35238bceSAndroid Build Coastguard Worker namespace Functional
39*35238bceSAndroid Build Coastguard Worker {
40*35238bceSAndroid Build Coastguard Worker namespace
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker
43*35238bceSAndroid Build Coastguard Worker using gls::RandomUniformBlockCase;
44*35238bceSAndroid Build Coastguard Worker using gls::UniformBlockCase;
45*35238bceSAndroid Build Coastguard Worker using namespace gls::ub;
46*35238bceSAndroid Build Coastguard Worker
createRandomCaseGroup(tcu::TestCaseGroup * parentGroup,Context & context,const char * groupName,const char * description,UniformBlockCase::BufferMode bufferMode,uint32_t features,int numCases,uint32_t baseSeed)47*35238bceSAndroid Build Coastguard Worker void createRandomCaseGroup(tcu::TestCaseGroup *parentGroup, Context &context, const char *groupName,
48*35238bceSAndroid Build Coastguard Worker const char *description, UniformBlockCase::BufferMode bufferMode, uint32_t features,
49*35238bceSAndroid Build Coastguard Worker int numCases, uint32_t baseSeed)
50*35238bceSAndroid Build Coastguard Worker {
51*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *group = new tcu::TestCaseGroup(context.getTestContext(), groupName, description);
52*35238bceSAndroid Build Coastguard Worker parentGroup->addChild(group);
53*35238bceSAndroid Build Coastguard Worker
54*35238bceSAndroid Build Coastguard Worker baseSeed += (uint32_t)context.getTestContext().getCommandLine().getBaseSeed();
55*35238bceSAndroid Build Coastguard Worker
56*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < numCases; ndx++)
57*35238bceSAndroid Build Coastguard Worker group->addChild(new RandomUniformBlockCase(context.getTestContext(), context.getRenderContext(),
58*35238bceSAndroid Build Coastguard Worker glu::GLSL_VERSION_310_ES, de::toString(ndx).c_str(), "", bufferMode,
59*35238bceSAndroid Build Coastguard Worker features, (uint32_t)ndx + baseSeed));
60*35238bceSAndroid Build Coastguard Worker }
61*35238bceSAndroid Build Coastguard Worker
62*35238bceSAndroid Build Coastguard Worker class BlockBasicTypeCase : public UniformBlockCase
63*35238bceSAndroid Build Coastguard Worker {
64*35238bceSAndroid Build Coastguard Worker public:
BlockBasicTypeCase(Context & context,const char * name,const char * description,const VarType & type,uint32_t layoutFlags,int numInstances)65*35238bceSAndroid Build Coastguard Worker BlockBasicTypeCase(Context &context, const char *name, const char *description, const VarType &type,
66*35238bceSAndroid Build Coastguard Worker uint32_t layoutFlags, int numInstances)
67*35238bceSAndroid Build Coastguard Worker : UniformBlockCase(context.getTestContext(), context.getRenderContext(), name, description,
68*35238bceSAndroid Build Coastguard Worker glu::GLSL_VERSION_310_ES, BUFFERMODE_PER_BLOCK)
69*35238bceSAndroid Build Coastguard Worker {
70*35238bceSAndroid Build Coastguard Worker UniformBlock &block = m_interface.allocBlock("Block");
71*35238bceSAndroid Build Coastguard Worker block.addUniform(Uniform("var", type, 0));
72*35238bceSAndroid Build Coastguard Worker block.setFlags(layoutFlags);
73*35238bceSAndroid Build Coastguard Worker
74*35238bceSAndroid Build Coastguard Worker if (numInstances > 0)
75*35238bceSAndroid Build Coastguard Worker {
76*35238bceSAndroid Build Coastguard Worker block.setArraySize(numInstances);
77*35238bceSAndroid Build Coastguard Worker block.setInstanceName("block");
78*35238bceSAndroid Build Coastguard Worker }
79*35238bceSAndroid Build Coastguard Worker }
80*35238bceSAndroid Build Coastguard Worker };
81*35238bceSAndroid Build Coastguard Worker
createBlockBasicTypeCases(tcu::TestCaseGroup * group,Context & context,const char * name,const VarType & type,uint32_t layoutFlags,int numInstances=0)82*35238bceSAndroid Build Coastguard Worker static void createBlockBasicTypeCases(tcu::TestCaseGroup *group, Context &context, const char *name,
83*35238bceSAndroid Build Coastguard Worker const VarType &type, uint32_t layoutFlags, int numInstances = 0)
84*35238bceSAndroid Build Coastguard Worker {
85*35238bceSAndroid Build Coastguard Worker group->addChild(new BlockBasicTypeCase(context, (string(name) + "_vertex").c_str(), "", type,
86*35238bceSAndroid Build Coastguard Worker layoutFlags | DECLARE_VERTEX, numInstances));
87*35238bceSAndroid Build Coastguard Worker group->addChild(new BlockBasicTypeCase(context, (string(name) + "_fragment").c_str(), "", type,
88*35238bceSAndroid Build Coastguard Worker layoutFlags | DECLARE_FRAGMENT, numInstances));
89*35238bceSAndroid Build Coastguard Worker
90*35238bceSAndroid Build Coastguard Worker if (!(layoutFlags & LAYOUT_PACKED))
91*35238bceSAndroid Build Coastguard Worker group->addChild(new BlockBasicTypeCase(context, (string(name) + "_both").c_str(), "", type,
92*35238bceSAndroid Build Coastguard Worker layoutFlags | DECLARE_VERTEX | DECLARE_FRAGMENT, numInstances));
93*35238bceSAndroid Build Coastguard Worker }
94*35238bceSAndroid Build Coastguard Worker
95*35238bceSAndroid Build Coastguard Worker class Block2LevelStructArrayCase : public UniformBlockCase
96*35238bceSAndroid Build Coastguard Worker {
97*35238bceSAndroid Build Coastguard Worker public:
Block2LevelStructArrayCase(Context & context,const char * name,const char * description,uint32_t layoutFlags,BufferMode bufferMode,int numInstances)98*35238bceSAndroid Build Coastguard Worker Block2LevelStructArrayCase(Context &context, const char *name, const char *description, uint32_t layoutFlags,
99*35238bceSAndroid Build Coastguard Worker BufferMode bufferMode, int numInstances)
100*35238bceSAndroid Build Coastguard Worker : UniformBlockCase(context.getTestContext(), context.getRenderContext(), name, description,
101*35238bceSAndroid Build Coastguard Worker glu::GLSL_VERSION_310_ES, bufferMode)
102*35238bceSAndroid Build Coastguard Worker , m_layoutFlags(layoutFlags)
103*35238bceSAndroid Build Coastguard Worker , m_numInstances(numInstances)
104*35238bceSAndroid Build Coastguard Worker {
105*35238bceSAndroid Build Coastguard Worker }
106*35238bceSAndroid Build Coastguard Worker
init(void)107*35238bceSAndroid Build Coastguard Worker void init(void)
108*35238bceSAndroid Build Coastguard Worker {
109*35238bceSAndroid Build Coastguard Worker StructType &typeS = m_interface.allocStruct("S");
110*35238bceSAndroid Build Coastguard Worker typeS.addMember("a", VarType(glu::TYPE_UINT_VEC3, PRECISION_HIGH), UNUSED_BOTH);
111*35238bceSAndroid Build Coastguard Worker typeS.addMember("b", VarType(VarType(glu::TYPE_FLOAT_MAT2, PRECISION_MEDIUM), 4));
112*35238bceSAndroid Build Coastguard Worker typeS.addMember("c", VarType(glu::TYPE_UINT, PRECISION_LOW));
113*35238bceSAndroid Build Coastguard Worker
114*35238bceSAndroid Build Coastguard Worker UniformBlock &block = m_interface.allocBlock("Block");
115*35238bceSAndroid Build Coastguard Worker block.addUniform(Uniform("u", VarType(glu::TYPE_INT, PRECISION_MEDIUM)));
116*35238bceSAndroid Build Coastguard Worker block.addUniform(Uniform("s", VarType(VarType(VarType(&typeS), 3), 2)));
117*35238bceSAndroid Build Coastguard Worker block.addUniform(Uniform("v", VarType(glu::TYPE_FLOAT_VEC2, PRECISION_MEDIUM)));
118*35238bceSAndroid Build Coastguard Worker block.setFlags(m_layoutFlags);
119*35238bceSAndroid Build Coastguard Worker
120*35238bceSAndroid Build Coastguard Worker if (m_numInstances > 0)
121*35238bceSAndroid Build Coastguard Worker {
122*35238bceSAndroid Build Coastguard Worker block.setInstanceName("block");
123*35238bceSAndroid Build Coastguard Worker block.setArraySize(m_numInstances);
124*35238bceSAndroid Build Coastguard Worker }
125*35238bceSAndroid Build Coastguard Worker }
126*35238bceSAndroid Build Coastguard Worker
127*35238bceSAndroid Build Coastguard Worker private:
128*35238bceSAndroid Build Coastguard Worker uint32_t m_layoutFlags;
129*35238bceSAndroid Build Coastguard Worker int m_numInstances;
130*35238bceSAndroid Build Coastguard Worker };
131*35238bceSAndroid Build Coastguard Worker
132*35238bceSAndroid Build Coastguard Worker } // namespace
133*35238bceSAndroid Build Coastguard Worker
UniformBlockTests(Context & context)134*35238bceSAndroid Build Coastguard Worker UniformBlockTests::UniformBlockTests(Context &context) : TestCaseGroup(context, "ubo", "Uniform Block tests")
135*35238bceSAndroid Build Coastguard Worker {
136*35238bceSAndroid Build Coastguard Worker }
137*35238bceSAndroid Build Coastguard Worker
~UniformBlockTests(void)138*35238bceSAndroid Build Coastguard Worker UniformBlockTests::~UniformBlockTests(void)
139*35238bceSAndroid Build Coastguard Worker {
140*35238bceSAndroid Build Coastguard Worker }
141*35238bceSAndroid Build Coastguard Worker
init(void)142*35238bceSAndroid Build Coastguard Worker void UniformBlockTests::init(void)
143*35238bceSAndroid Build Coastguard Worker {
144*35238bceSAndroid Build Coastguard Worker static const glu::DataType basicTypes[] = {
145*35238bceSAndroid Build Coastguard Worker glu::TYPE_FLOAT, glu::TYPE_FLOAT_VEC2, glu::TYPE_FLOAT_VEC3, glu::TYPE_FLOAT_VEC4,
146*35238bceSAndroid Build Coastguard Worker glu::TYPE_INT, glu::TYPE_INT_VEC2, glu::TYPE_INT_VEC3, glu::TYPE_INT_VEC4,
147*35238bceSAndroid Build Coastguard Worker glu::TYPE_UINT, glu::TYPE_UINT_VEC2, glu::TYPE_UINT_VEC3, glu::TYPE_UINT_VEC4,
148*35238bceSAndroid Build Coastguard Worker glu::TYPE_BOOL, glu::TYPE_BOOL_VEC2, glu::TYPE_BOOL_VEC3, glu::TYPE_BOOL_VEC4,
149*35238bceSAndroid Build Coastguard Worker glu::TYPE_FLOAT_MAT2, glu::TYPE_FLOAT_MAT3, glu::TYPE_FLOAT_MAT4, glu::TYPE_FLOAT_MAT2X3,
150*35238bceSAndroid Build Coastguard Worker glu::TYPE_FLOAT_MAT2X4, glu::TYPE_FLOAT_MAT3X2, glu::TYPE_FLOAT_MAT3X4, glu::TYPE_FLOAT_MAT4X2,
151*35238bceSAndroid Build Coastguard Worker glu::TYPE_FLOAT_MAT4X3};
152*35238bceSAndroid Build Coastguard Worker
153*35238bceSAndroid Build Coastguard Worker static const struct
154*35238bceSAndroid Build Coastguard Worker {
155*35238bceSAndroid Build Coastguard Worker const char *name;
156*35238bceSAndroid Build Coastguard Worker uint32_t flags;
157*35238bceSAndroid Build Coastguard Worker } layoutFlags[] = {{"shared", LAYOUT_SHARED}, {"packed", LAYOUT_PACKED}, {"std140", LAYOUT_STD140}};
158*35238bceSAndroid Build Coastguard Worker
159*35238bceSAndroid Build Coastguard Worker static const struct
160*35238bceSAndroid Build Coastguard Worker {
161*35238bceSAndroid Build Coastguard Worker const char *name;
162*35238bceSAndroid Build Coastguard Worker uint32_t flags;
163*35238bceSAndroid Build Coastguard Worker } matrixFlags[] = {{"row_major", LAYOUT_ROW_MAJOR}, {"column_major", LAYOUT_COLUMN_MAJOR}};
164*35238bceSAndroid Build Coastguard Worker
165*35238bceSAndroid Build Coastguard Worker static const struct
166*35238bceSAndroid Build Coastguard Worker {
167*35238bceSAndroid Build Coastguard Worker const char *name;
168*35238bceSAndroid Build Coastguard Worker UniformBlockCase::BufferMode mode;
169*35238bceSAndroid Build Coastguard Worker } bufferModes[] = {{"per_block_buffer", UniformBlockCase::BUFFERMODE_PER_BLOCK},
170*35238bceSAndroid Build Coastguard Worker {"single_buffer", UniformBlockCase::BUFFERMODE_SINGLE}};
171*35238bceSAndroid Build Coastguard Worker
172*35238bceSAndroid Build Coastguard Worker // ubo.2_level_array
173*35238bceSAndroid Build Coastguard Worker {
174*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *nestedArrayGroup =
175*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "2_level_array", "2-level basic array variable in single buffer");
176*35238bceSAndroid Build Coastguard Worker addChild(nestedArrayGroup);
177*35238bceSAndroid Build Coastguard Worker
178*35238bceSAndroid Build Coastguard Worker for (int layoutFlagNdx = 0; layoutFlagNdx < DE_LENGTH_OF_ARRAY(layoutFlags); layoutFlagNdx++)
179*35238bceSAndroid Build Coastguard Worker {
180*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *layoutGroup = new tcu::TestCaseGroup(m_testCtx, layoutFlags[layoutFlagNdx].name, "");
181*35238bceSAndroid Build Coastguard Worker nestedArrayGroup->addChild(layoutGroup);
182*35238bceSAndroid Build Coastguard Worker
183*35238bceSAndroid Build Coastguard Worker for (int basicTypeNdx = 0; basicTypeNdx < DE_LENGTH_OF_ARRAY(basicTypes); basicTypeNdx++)
184*35238bceSAndroid Build Coastguard Worker {
185*35238bceSAndroid Build Coastguard Worker const glu::DataType type = basicTypes[basicTypeNdx];
186*35238bceSAndroid Build Coastguard Worker const char *typeName = glu::getDataTypeName(type);
187*35238bceSAndroid Build Coastguard Worker const int childSize = 4;
188*35238bceSAndroid Build Coastguard Worker const int parentSize = 3;
189*35238bceSAndroid Build Coastguard Worker const VarType childType(VarType(type, glu::isDataTypeBoolOrBVec(type) ? 0 : PRECISION_HIGH), childSize);
190*35238bceSAndroid Build Coastguard Worker const VarType parentType(childType, parentSize);
191*35238bceSAndroid Build Coastguard Worker
192*35238bceSAndroid Build Coastguard Worker createBlockBasicTypeCases(layoutGroup, m_context, typeName, parentType,
193*35238bceSAndroid Build Coastguard Worker layoutFlags[layoutFlagNdx].flags);
194*35238bceSAndroid Build Coastguard Worker
195*35238bceSAndroid Build Coastguard Worker if (glu::isDataTypeMatrix(type))
196*35238bceSAndroid Build Coastguard Worker {
197*35238bceSAndroid Build Coastguard Worker for (int matFlagNdx = 0; matFlagNdx < DE_LENGTH_OF_ARRAY(matrixFlags); matFlagNdx++)
198*35238bceSAndroid Build Coastguard Worker createBlockBasicTypeCases(
199*35238bceSAndroid Build Coastguard Worker layoutGroup, m_context, (string(matrixFlags[matFlagNdx].name) + "_" + typeName).c_str(),
200*35238bceSAndroid Build Coastguard Worker parentType, layoutFlags[layoutFlagNdx].flags | matrixFlags[matFlagNdx].flags);
201*35238bceSAndroid Build Coastguard Worker }
202*35238bceSAndroid Build Coastguard Worker }
203*35238bceSAndroid Build Coastguard Worker }
204*35238bceSAndroid Build Coastguard Worker }
205*35238bceSAndroid Build Coastguard Worker
206*35238bceSAndroid Build Coastguard Worker // ubo.3_level_array
207*35238bceSAndroid Build Coastguard Worker {
208*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *nestedArrayGroup =
209*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "3_level_array", "3-level basic array variable in single buffer");
210*35238bceSAndroid Build Coastguard Worker addChild(nestedArrayGroup);
211*35238bceSAndroid Build Coastguard Worker
212*35238bceSAndroid Build Coastguard Worker for (int layoutFlagNdx = 0; layoutFlagNdx < DE_LENGTH_OF_ARRAY(layoutFlags); layoutFlagNdx++)
213*35238bceSAndroid Build Coastguard Worker {
214*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *layoutGroup = new tcu::TestCaseGroup(m_testCtx, layoutFlags[layoutFlagNdx].name, "");
215*35238bceSAndroid Build Coastguard Worker nestedArrayGroup->addChild(layoutGroup);
216*35238bceSAndroid Build Coastguard Worker
217*35238bceSAndroid Build Coastguard Worker for (int basicTypeNdx = 0; basicTypeNdx < DE_LENGTH_OF_ARRAY(basicTypes); basicTypeNdx++)
218*35238bceSAndroid Build Coastguard Worker {
219*35238bceSAndroid Build Coastguard Worker const glu::DataType type = basicTypes[basicTypeNdx];
220*35238bceSAndroid Build Coastguard Worker const char *typeName = glu::getDataTypeName(type);
221*35238bceSAndroid Build Coastguard Worker const int childSize0 = 2;
222*35238bceSAndroid Build Coastguard Worker const int childSize1 = 4;
223*35238bceSAndroid Build Coastguard Worker const int parentSize = 3;
224*35238bceSAndroid Build Coastguard Worker const VarType childType0(VarType(type, glu::isDataTypeBoolOrBVec(type) ? 0 : PRECISION_HIGH),
225*35238bceSAndroid Build Coastguard Worker childSize0);
226*35238bceSAndroid Build Coastguard Worker const VarType childType1(childType0, childSize1);
227*35238bceSAndroid Build Coastguard Worker const VarType parentType(childType1, parentSize);
228*35238bceSAndroid Build Coastguard Worker
229*35238bceSAndroid Build Coastguard Worker createBlockBasicTypeCases(layoutGroup, m_context, typeName, parentType,
230*35238bceSAndroid Build Coastguard Worker layoutFlags[layoutFlagNdx].flags);
231*35238bceSAndroid Build Coastguard Worker
232*35238bceSAndroid Build Coastguard Worker if (glu::isDataTypeMatrix(type))
233*35238bceSAndroid Build Coastguard Worker {
234*35238bceSAndroid Build Coastguard Worker for (int matFlagNdx = 0; matFlagNdx < DE_LENGTH_OF_ARRAY(matrixFlags); matFlagNdx++)
235*35238bceSAndroid Build Coastguard Worker createBlockBasicTypeCases(
236*35238bceSAndroid Build Coastguard Worker layoutGroup, m_context, (string(matrixFlags[matFlagNdx].name) + "_" + typeName).c_str(),
237*35238bceSAndroid Build Coastguard Worker parentType, layoutFlags[layoutFlagNdx].flags | matrixFlags[matFlagNdx].flags);
238*35238bceSAndroid Build Coastguard Worker }
239*35238bceSAndroid Build Coastguard Worker }
240*35238bceSAndroid Build Coastguard Worker }
241*35238bceSAndroid Build Coastguard Worker }
242*35238bceSAndroid Build Coastguard Worker
243*35238bceSAndroid Build Coastguard Worker // ubo.2_level_struct_array
244*35238bceSAndroid Build Coastguard Worker {
245*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *structArrayArrayGroup =
246*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "2_level_struct_array", "Struct array in one uniform block");
247*35238bceSAndroid Build Coastguard Worker addChild(structArrayArrayGroup);
248*35238bceSAndroid Build Coastguard Worker
249*35238bceSAndroid Build Coastguard Worker for (int modeNdx = 0; modeNdx < DE_LENGTH_OF_ARRAY(bufferModes); modeNdx++)
250*35238bceSAndroid Build Coastguard Worker {
251*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *modeGroup = new tcu::TestCaseGroup(m_testCtx, bufferModes[modeNdx].name, "");
252*35238bceSAndroid Build Coastguard Worker structArrayArrayGroup->addChild(modeGroup);
253*35238bceSAndroid Build Coastguard Worker
254*35238bceSAndroid Build Coastguard Worker for (int layoutFlagNdx = 0; layoutFlagNdx < DE_LENGTH_OF_ARRAY(layoutFlags); layoutFlagNdx++)
255*35238bceSAndroid Build Coastguard Worker {
256*35238bceSAndroid Build Coastguard Worker for (int isArray = 0; isArray < 2; isArray++)
257*35238bceSAndroid Build Coastguard Worker {
258*35238bceSAndroid Build Coastguard Worker std::string baseName = layoutFlags[layoutFlagNdx].name;
259*35238bceSAndroid Build Coastguard Worker uint32_t baseFlags = layoutFlags[layoutFlagNdx].flags;
260*35238bceSAndroid Build Coastguard Worker
261*35238bceSAndroid Build Coastguard Worker if (bufferModes[modeNdx].mode == UniformBlockCase::BUFFERMODE_SINGLE && isArray == 0)
262*35238bceSAndroid Build Coastguard Worker continue; // Doesn't make sense to add this variant.
263*35238bceSAndroid Build Coastguard Worker
264*35238bceSAndroid Build Coastguard Worker if (isArray)
265*35238bceSAndroid Build Coastguard Worker baseName += "_instance_array";
266*35238bceSAndroid Build Coastguard Worker
267*35238bceSAndroid Build Coastguard Worker modeGroup->addChild(new Block2LevelStructArrayCase(m_context, (baseName + "_vertex").c_str(), "",
268*35238bceSAndroid Build Coastguard Worker baseFlags | DECLARE_VERTEX,
269*35238bceSAndroid Build Coastguard Worker bufferModes[modeNdx].mode, isArray ? 3 : 0));
270*35238bceSAndroid Build Coastguard Worker modeGroup->addChild(new Block2LevelStructArrayCase(m_context, (baseName + "_fragment").c_str(), "",
271*35238bceSAndroid Build Coastguard Worker baseFlags | DECLARE_FRAGMENT,
272*35238bceSAndroid Build Coastguard Worker bufferModes[modeNdx].mode, isArray ? 3 : 0));
273*35238bceSAndroid Build Coastguard Worker
274*35238bceSAndroid Build Coastguard Worker if (!(baseFlags & LAYOUT_PACKED))
275*35238bceSAndroid Build Coastguard Worker modeGroup->addChild(new Block2LevelStructArrayCase(
276*35238bceSAndroid Build Coastguard Worker m_context, (baseName + "_both").c_str(), "", baseFlags | DECLARE_VERTEX | DECLARE_FRAGMENT,
277*35238bceSAndroid Build Coastguard Worker bufferModes[modeNdx].mode, isArray ? 3 : 0));
278*35238bceSAndroid Build Coastguard Worker }
279*35238bceSAndroid Build Coastguard Worker }
280*35238bceSAndroid Build Coastguard Worker }
281*35238bceSAndroid Build Coastguard Worker }
282*35238bceSAndroid Build Coastguard Worker
283*35238bceSAndroid Build Coastguard Worker // ubo.random
284*35238bceSAndroid Build Coastguard Worker {
285*35238bceSAndroid Build Coastguard Worker const uint32_t allShaders = FEATURE_VERTEX_BLOCKS | FEATURE_FRAGMENT_BLOCKS | FEATURE_SHARED_BLOCKS;
286*35238bceSAndroid Build Coastguard Worker const uint32_t allLayouts = FEATURE_PACKED_LAYOUT | FEATURE_SHARED_LAYOUT | FEATURE_STD140_LAYOUT;
287*35238bceSAndroid Build Coastguard Worker const uint32_t allBasicTypes = FEATURE_VECTORS | FEATURE_MATRICES;
288*35238bceSAndroid Build Coastguard Worker const uint32_t unused = FEATURE_UNUSED_MEMBERS | FEATURE_UNUSED_UNIFORMS;
289*35238bceSAndroid Build Coastguard Worker const uint32_t matFlags = FEATURE_MATRIX_LAYOUT;
290*35238bceSAndroid Build Coastguard Worker const uint32_t basicTypeArrays =
291*35238bceSAndroid Build Coastguard Worker allShaders | allLayouts | unused | allBasicTypes | matFlags | FEATURE_ARRAYS | FEATURE_ARRAYS_OF_ARRAYS;
292*35238bceSAndroid Build Coastguard Worker const uint32_t allFeatures = ~0u;
293*35238bceSAndroid Build Coastguard Worker
294*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *randomGroup = new tcu::TestCaseGroup(m_testCtx, "random", "Random Uniform Block cases");
295*35238bceSAndroid Build Coastguard Worker addChild(randomGroup);
296*35238bceSAndroid Build Coastguard Worker
297*35238bceSAndroid Build Coastguard Worker createRandomCaseGroup(randomGroup, m_context, "basic_type_arrays", "Arrays, per-block buffers",
298*35238bceSAndroid Build Coastguard Worker UniformBlockCase::BUFFERMODE_PER_BLOCK, basicTypeArrays, 25, 1150);
299*35238bceSAndroid Build Coastguard Worker createRandomCaseGroup(randomGroup, m_context, "all_per_block_buffers", "All random features, per-block buffers",
300*35238bceSAndroid Build Coastguard Worker UniformBlockCase::BUFFERMODE_PER_BLOCK, allFeatures, 50, 11200);
301*35238bceSAndroid Build Coastguard Worker createRandomCaseGroup(randomGroup, m_context, "all_shared_buffer", "All random features, shared buffer",
302*35238bceSAndroid Build Coastguard Worker UniformBlockCase::BUFFERMODE_SINGLE, allFeatures, 50, 11250);
303*35238bceSAndroid Build Coastguard Worker }
304*35238bceSAndroid Build Coastguard Worker }
305*35238bceSAndroid Build Coastguard Worker
306*35238bceSAndroid Build Coastguard Worker } // namespace Functional
307*35238bceSAndroid Build Coastguard Worker } // namespace gles31
308*35238bceSAndroid Build Coastguard Worker } // namespace deqp
309