Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / deqp / functional / gles3 / es3fUniformBlockTests.js
blob91a90fdc64de6a03a60ccabac3201960c19841bf
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES Utilities
3  * ------------------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
21 'use strict';
22 goog.provide('functional.gles3.es3fUniformBlockTests');
23 goog.require('framework.common.tcuTestCase');
24 goog.require('framework.delibs.debase.deMath');
25 goog.require('framework.delibs.debase.deRandom');
26 goog.require('framework.opengl.gluShaderUtil');
27 goog.require('modules.shared.glsRandomUniformBlockCase');
28 goog.require('modules.shared.glsUniformBlockCase');
30 goog.scope(function() {
32     var es3fUniformBlockTests = functional.gles3.es3fUniformBlockTests;
33     var gluShaderUtil = framework.opengl.gluShaderUtil;
34     var glsUniformBlockCase = modules.shared.glsUniformBlockCase;
35     var glsRandomUniformBlockCase = modules.shared.glsRandomUniformBlockCase;
36     var tcuTestCase = framework.common.tcuTestCase;
37     var deMath = framework.delibs.debase.deMath;
38     var deRandom = framework.delibs.debase.deRandom;
40     /**
41      * es3fUniformBlockTests.createRandomCaseGroup
42      * @param {tcuTestCase.DeqpTest} parentGroup
43      * @param {string} groupName
44      * @param {string} description
45      * @param {glsUniformBlockCase.BufferMode} bufferMode
46      * @param {number} features
47      * @param {number} numCases
48      * @param {number} baseSeed
49      */
50     es3fUniformBlockTests.createRandomCaseGroup = function(parentGroup, groupName, description, bufferMode, features, numCases, baseSeed) {
51         /** @type {tcuTestCase.DeqpTest} */
52         var group = tcuTestCase.newTest(groupName, description);
53         parentGroup.addChild(group);
55         baseSeed += deRandom.getBaseSeed();
57         for (var ndx = 0; ndx < numCases; ndx++)
58             group.addChild(new glsRandomUniformBlockCase.RandomUniformBlockCase('' + ndx, '', bufferMode, features, ndx + baseSeed));
59     };
61     /**
62      * es3fUniformBlockTests.BlockBasicTypeCase constructor
63      * @param {string} name The name of the test
64      * @param {string} description The description of the test
65      * @param {glsUniformBlockCase.VarType} type The type of the block
66      * @param {number} layoutFlags
67      * @param {number} numInstances
68      * @constructor
69      * @extends {glsUniformBlockCase.UniformBlockCase}
70      */
71     es3fUniformBlockTests.BlockBasicTypeCase = function(name, description, type, layoutFlags, numInstances) {
72         glsUniformBlockCase.UniformBlockCase.call(this, name, description, glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK);
73         /** @type {glsUniformBlockCase.UniformBlock}*/ var block = this.m_interface.allocBlock('Block');
74         block.addUniform(new glsUniformBlockCase.Uniform('var', type, 0));
75         block.setFlags(layoutFlags);
77         if (numInstances > 0) {
78             block.setArraySize(numInstances);
79             block.setInstanceName('block');
80         }
81     };
83     es3fUniformBlockTests.BlockBasicTypeCase.prototype = Object.create(glsUniformBlockCase.UniformBlockCase.prototype);
84     es3fUniformBlockTests.BlockBasicTypeCase.prototype.constructor = es3fUniformBlockTests.BlockBasicTypeCase;
86     /**
87      * es3fUniformBlockTests.createBlockBasicTypeCases
88      * @param {tcuTestCase.DeqpTest} group
89      * @param {string} name
90      * @param {glsUniformBlockCase.VarType} type
91      * @param {number} layoutFlags
92      * @param {number=} numInstances
93      */
94     es3fUniformBlockTests.createBlockBasicTypeCases = function(group, name, type, layoutFlags, numInstances) {
95         numInstances = (numInstances === undefined) ? 0 : numInstances;
96         group.addChild(new es3fUniformBlockTests.BlockBasicTypeCase(name + '_vertex', '', type, layoutFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, numInstances));
97         group.addChild(new es3fUniformBlockTests.BlockBasicTypeCase(name + '_fragment', '', type, layoutFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, numInstances));
99         //alert(group.spec[0].m_instance);
100         if (!(layoutFlags & glsUniformBlockCase.UniformFlags.LAYOUT_PACKED))
101             group.addChild(new es3fUniformBlockTests.BlockBasicTypeCase(name + '_both', '', type, layoutFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, numInstances));
102     };
104     /**
105      * es3fUniformBlockTests.BlockSingleStructCase constructor
106      * @param {string} name The name of the test
107      * @param {string} description The description of the test
108      * @param {number} layoutFlags
109      * @param {glsUniformBlockCase.BufferMode} bufferMode
110      * @param {number} numInstances
111      * @constructor
112      * @extends {glsUniformBlockCase.UniformBlockCase}
113      */
114     es3fUniformBlockTests.BlockSingleStructCase = function(name, description, layoutFlags, bufferMode, numInstances) {
115         glsUniformBlockCase.UniformBlockCase.call(this, name, description, bufferMode);
116         this.m_layoutFlags = layoutFlags;
117         this.m_numInstances = numInstances;
118     };
120     es3fUniformBlockTests.BlockSingleStructCase.prototype = Object.create(glsUniformBlockCase.UniformBlockCase.prototype);
121     es3fUniformBlockTests.BlockSingleStructCase.prototype.constructor = es3fUniformBlockTests.BlockSingleStructCase;
123     es3fUniformBlockTests.BlockSingleStructCase.prototype.init = function() {
124         /**@type {glsUniformBlockCase.StructType}*/ var typeS = this.m_interface.allocStruct('S');
125         typeS.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.INT_VEC3, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), glsUniformBlockCase.UniformFlags.UNUSED_BOTH); // First member is unused.
126         typeS.addMember('b', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT3, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM), 4));
127         typeS.addMember('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC4, glsUniformBlockCase.UniformFlags.PRECISION_HIGH));
129         /** @type {glsUniformBlockCase.UniformBlock} */ var block = this.m_interface.allocBlock('Block');
130         block.addUniform(new glsUniformBlockCase.Uniform('s', glsUniformBlockCase.newVarTypeStruct(typeS), 0));
131         block.setFlags(this.m_layoutFlags);
133         if (this.m_numInstances > 0) {
134             block.setInstanceName('block');
135             block.setArraySize(this.m_numInstances);
136         }
137     };
139     /**
140      * es3fUniformBlockTests.BlockSingleStructArrayCase constructor
141      * @param {string} name The name of the test
142      * @param {string} description The description of the test
143      * @param {number} layoutFlags
144      * @param {glsUniformBlockCase.BufferMode} bufferMode
145      * @param {number} numInstances
146      * @constructor
147      * @extends {glsUniformBlockCase.UniformBlockCase}
148      */
149     es3fUniformBlockTests.BlockSingleStructArrayCase = function(name, description, layoutFlags, bufferMode, numInstances) {
150         glsUniformBlockCase.UniformBlockCase.call(this, name, description, bufferMode);
151         this.m_layoutFlags = layoutFlags;
152         this.m_numInstances = numInstances;
153     };
155     es3fUniformBlockTests.BlockSingleStructArrayCase.prototype = Object.create(glsUniformBlockCase.UniformBlockCase.prototype);
156     es3fUniformBlockTests.BlockSingleStructArrayCase.prototype.constructor = es3fUniformBlockTests.BlockSingleStructArrayCase;
158     es3fUniformBlockTests.BlockSingleStructArrayCase.prototype.init = function() {
159         /**@type {glsUniformBlockCase.StructType}*/ var typeS = this.m_interface.allocStruct('S');
160         typeS.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.INT_VEC3, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), glsUniformBlockCase.UniformFlags.UNUSED_BOTH); // First member is unused.
161         typeS.addMember('b', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT3, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM), 4));
162         typeS.addMember('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC4, glsUniformBlockCase.UniformFlags.PRECISION_HIGH));
164         /** @type {glsUniformBlockCase.UniformBlock} */ var block = this.m_interface.allocBlock('Block');
165         block.addUniform(new glsUniformBlockCase.Uniform('u', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.UINT, glsUniformBlockCase.UniformFlags.PRECISION_LOW)));
166         block.addUniform(new glsUniformBlockCase.Uniform('s', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeStruct(typeS), 3)));
167         block.addUniform(new glsUniformBlockCase.Uniform('v', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC4, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM)));
168         block.setFlags(this.m_layoutFlags);
170         if (this.m_numInstances > 0) {
171             block.setInstanceName('block');
172             block.setArraySize(this.m_numInstances);
173         }
174     };
176     /**
177      * es3fUniformBlockTests.BlockSingleNestedStructCase constructor
178      * @param {string} name The name of the test
179      * @param {string} description The description of the test
180      * @param {number} layoutFlags
181      * @param {glsUniformBlockCase.BufferMode} bufferMode
182      * @param {number} numInstances
183      * @constructor
184      * @extends {glsUniformBlockCase.UniformBlockCase}
185      */
186     es3fUniformBlockTests.BlockSingleNestedStructCase = function(name, description, layoutFlags, bufferMode, numInstances) {
187         glsUniformBlockCase.UniformBlockCase.call(this, name, description, bufferMode);
188         this.m_layoutFlags = layoutFlags;
189         this.m_numInstances = numInstances;
190     };
192     es3fUniformBlockTests.BlockSingleNestedStructCase.prototype = Object.create(glsUniformBlockCase.UniformBlockCase.prototype);
193     es3fUniformBlockTests.BlockSingleNestedStructCase.prototype.constructor = es3fUniformBlockTests.BlockSingleNestedStructCase;
195     es3fUniformBlockTests.BlockSingleNestedStructCase.prototype.init = function() {
196         /**@type {glsUniformBlockCase.StructType}*/ var typeS = this.m_interface.allocStruct('S');
197         typeS.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.INT_VEC3, glsUniformBlockCase.UniformFlags.PRECISION_HIGH));
198         typeS.addMember('b', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT3, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM), 4));
199         typeS.addMember('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC4, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), glsUniformBlockCase.UniformFlags.UNUSED_BOTH);
201         /**@type {glsUniformBlockCase.StructType}*/ var typeT = this.m_interface.allocStruct('T');
202         typeT.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT3, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM));
203         typeT.addMember('b', glsUniformBlockCase.newVarTypeStruct(typeS));
205         /** @type {glsUniformBlockCase.UniformBlock} */ var block = this.m_interface.allocBlock('Block');
206         block.addUniform(new glsUniformBlockCase.Uniform('s', glsUniformBlockCase.newVarTypeStruct(typeS), 0));
207         block.addUniform(new glsUniformBlockCase.Uniform('v', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC2, glsUniformBlockCase.UniformFlags.PRECISION_LOW), glsUniformBlockCase.UniformFlags.UNUSED_BOTH));
208         block.addUniform(new glsUniformBlockCase.Uniform('t', glsUniformBlockCase.newVarTypeStruct(typeT), 0));
209         block.addUniform(new glsUniformBlockCase.Uniform('u', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.UINT, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), 0));
210         block.setFlags(this.m_layoutFlags);
212         if (this.m_numInstances > 0) {
213             block.setInstanceName('block');
214             block.setArraySize(this.m_numInstances);
215         }
216     };
218     /**
219      * es3fUniformBlockTests.BlockSingleNestedStructArrayCase constructor
220      * @param {string} name The name of the test
221      * @param {string} description The description of the test
222      * @param {number} layoutFlags
223      * @param {glsUniformBlockCase.BufferMode} bufferMode
224      * @param {number} numInstances
225      * @constructor
226      * @extends {glsUniformBlockCase.UniformBlockCase}
227      */
228     es3fUniformBlockTests.BlockSingleNestedStructArrayCase = function(name, description, layoutFlags, bufferMode, numInstances) {
229         glsUniformBlockCase.UniformBlockCase.call(this, name, description, bufferMode);
230         this.m_layoutFlags = layoutFlags;
231         this.m_numInstances = numInstances;
232     };
234     es3fUniformBlockTests.BlockSingleNestedStructArrayCase.prototype = Object.create(glsUniformBlockCase.UniformBlockCase.prototype);
235     es3fUniformBlockTests.BlockSingleNestedStructArrayCase.prototype.constructor = es3fUniformBlockTests.BlockSingleNestedStructArrayCase;
237     es3fUniformBlockTests.BlockSingleNestedStructArrayCase.prototype.init = function() {
238         /**@type {glsUniformBlockCase.StructType}*/ var typeS = this.m_interface.allocStruct('S');
239         typeS.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.INT_VEC3, glsUniformBlockCase.UniformFlags.PRECISION_HIGH));
240         typeS.addMember('b', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.INT_VEC2, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM), 4));
241         typeS.addMember('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC4, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), glsUniformBlockCase.UniformFlags.UNUSED_BOTH);
243         /**@type {glsUniformBlockCase.StructType}*/ var typeT = this.m_interface.allocStruct('T');
244         typeT.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT3, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM));
245         typeT.addMember('b', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeStruct(typeS), 3));
247         /** @type {glsUniformBlockCase.UniformBlock} */ var block = this.m_interface.allocBlock('Block');
248         block.addUniform(new glsUniformBlockCase.Uniform('s', glsUniformBlockCase.newVarTypeStruct(typeS), 0));
249         block.addUniform(new glsUniformBlockCase.Uniform('v', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC2, glsUniformBlockCase.UniformFlags.PRECISION_LOW), glsUniformBlockCase.UniformFlags.UNUSED_BOTH));
250         block.addUniform(new glsUniformBlockCase.Uniform('t', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeStruct(typeT), 2), 0));
251         block.addUniform(new glsUniformBlockCase.Uniform('u', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.UINT, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), 0));
252         block.setFlags(this.m_layoutFlags);
254         if (this.m_numInstances > 0) {
255             block.setInstanceName('block');
256             block.setArraySize(this.m_numInstances);
257         }
258     };
260     /**
261      * es3fUniformBlockTests.BlockMultiBasicTypesCase constructor
262      * @param {string} name The name of the test
263      * @param {string} description The description of the test
264      * @param {number} flagsA
265      * @param {number} flagsB
266      * @param {glsUniformBlockCase.BufferMode} bufferMode
267      * @param {number} numInstances
268      * @constructor
269      * @extends {glsUniformBlockCase.UniformBlockCase}
270      */
271     es3fUniformBlockTests.BlockMultiBasicTypesCase = function(name, description, flagsA, flagsB, bufferMode, numInstances) {
272         glsUniformBlockCase.UniformBlockCase.call(this, name, description, bufferMode);
273         this.m_flagsA = flagsA;
274         this.m_flagsB = flagsB;
275         this.m_numInstances = numInstances;
276     };
278     es3fUniformBlockTests.BlockMultiBasicTypesCase.prototype = Object.create(glsUniformBlockCase.UniformBlockCase.prototype);
279     es3fUniformBlockTests.BlockMultiBasicTypesCase.prototype.constructor = es3fUniformBlockTests.BlockMultiBasicTypesCase;
281     es3fUniformBlockTests.BlockMultiBasicTypesCase.prototype.init = function() {
282         /** @type {glsUniformBlockCase.UniformBlock} */ var blockA = this.m_interface.allocBlock('BlockA');
283         blockA.addUniform(new glsUniformBlockCase.Uniform('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT, glsUniformBlockCase.UniformFlags.PRECISION_HIGH)));
284         blockA.addUniform(new glsUniformBlockCase.Uniform('b', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.UINT_VEC3, glsUniformBlockCase.UniformFlags.PRECISION_LOW), glsUniformBlockCase.UniformFlags.UNUSED_BOTH));
285         blockA.addUniform(new glsUniformBlockCase.Uniform('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT2, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM)));
286         blockA.setInstanceName('blockA');
287         blockA.setFlags(this.m_flagsA);
289         /** @type {glsUniformBlockCase.UniformBlock} */ var blockB = this.m_interface.allocBlock('BlockB');
290         blockB.addUniform(new glsUniformBlockCase.Uniform('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT3, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM)));
291         blockB.addUniform(new glsUniformBlockCase.Uniform('b', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.INT_VEC2, glsUniformBlockCase.UniformFlags.PRECISION_LOW)));
292         blockB.addUniform(new glsUniformBlockCase.Uniform('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC4, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), glsUniformBlockCase.UniformFlags.UNUSED_BOTH));
293         blockB.addUniform(new glsUniformBlockCase.Uniform('d', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.BOOL, 0)));
294         blockB.setInstanceName('blockB');
295         blockB.setFlags(this.m_flagsB);
297         if (this.m_numInstances > 0) {
298             blockA.setArraySize(this.m_numInstances);
299             blockB.setArraySize(this.m_numInstances);
300         }
301     };
303     /**
304      * es3fUniformBlockTests.BlockMultiNestedStructCase constructor
305      * @param {string} name The name of the test
306      * @param {string} description The description of the test
307      * @param {number} flagsA
308      * @param {number} flagsB
309      * @param {glsUniformBlockCase.BufferMode} bufferMode
310      * @param {number} numInstances
311      * @constructor
312      * @extends {glsUniformBlockCase.UniformBlockCase}
313      */
314     es3fUniformBlockTests.BlockMultiNestedStructCase = function(name, description, flagsA, flagsB, bufferMode, numInstances) {
315         glsUniformBlockCase.UniformBlockCase.call(this, name, description, bufferMode);
316         this.m_flagsA = flagsA;
317         this.m_flagsB = flagsB;
318         this.m_numInstances = numInstances;
319     };
321     es3fUniformBlockTests.BlockMultiNestedStructCase.prototype = Object.create(glsUniformBlockCase.UniformBlockCase.prototype);
322     es3fUniformBlockTests.BlockMultiNestedStructCase.prototype.constructor = es3fUniformBlockTests.BlockMultiNestedStructCase;
324     es3fUniformBlockTests.BlockMultiNestedStructCase.prototype.init = function() {
325         /**@type {glsUniformBlockCase.StructType}*/ var typeS = this.m_interface.allocStruct('S');
326         typeS.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT3, glsUniformBlockCase.UniformFlags.PRECISION_LOW));
327         typeS.addMember('b', glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.INT_VEC2, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM), 4));
328         typeS.addMember('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_VEC4, glsUniformBlockCase.UniformFlags.PRECISION_HIGH));
330         /**@type {glsUniformBlockCase.StructType}*/ var typeT = this.m_interface.allocStruct('T');
331         typeT.addMember('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.UINT, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM), glsUniformBlockCase.UniformFlags.UNUSED_BOTH);
332         typeT.addMember('b', glsUniformBlockCase.newVarTypeStruct(typeS));
333         typeT.addMember('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.BOOL_VEC4, 0));
335         /** @type {glsUniformBlockCase.UniformBlock} */ var blockA = this.m_interface.allocBlock('BlockA');
336         blockA.addUniform(new glsUniformBlockCase.Uniform('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT, glsUniformBlockCase.UniformFlags.PRECISION_HIGH)));
337         blockA.addUniform(new glsUniformBlockCase.Uniform('b', glsUniformBlockCase.newVarTypeStruct(typeS)));
338         blockA.addUniform(new glsUniformBlockCase.Uniform('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.UINT_VEC3, glsUniformBlockCase.UniformFlags.PRECISION_LOW), glsUniformBlockCase.UniformFlags.UNUSED_BOTH));
339         blockA.setInstanceName('blockA');
340         blockA.setFlags(this.m_flagsA);
342         /** @type {glsUniformBlockCase.UniformBlock} */ var blockB = this.m_interface.allocBlock('BlockB');
343         blockB.addUniform(new glsUniformBlockCase.Uniform('a', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.FLOAT_MAT2, glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM)));
344         blockB.addUniform(new glsUniformBlockCase.Uniform('b', glsUniformBlockCase.newVarTypeStruct(typeT)));
345         blockB.addUniform(new glsUniformBlockCase.Uniform('c', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.BOOL_VEC4, 0), glsUniformBlockCase.UniformFlags.UNUSED_BOTH));
346         blockB.addUniform(new glsUniformBlockCase.Uniform('d', glsUniformBlockCase.newVarTypeBasic(gluShaderUtil.DataType.BOOL, 0)));
347         blockB.setInstanceName('blockB');
348         blockB.setFlags(this.m_flagsB);
350         if (this.m_numInstances > 0) {
351             blockA.setArraySize(this.m_numInstances);
352             blockB.setArraySize(this.m_numInstances);
353         }
354     };
356     /**
357      * Creates the test hierarchy to be executed.
358      **/
359     es3fUniformBlockTests.init = function() {
360         /** @const @type {tcuTestCase.DeqpTest} */ var testGroup = tcuTestCase.runner.testCases;
362         /** @type {Array<gluShaderUtil.DataType>} */
363         var basicTypes = [
364             gluShaderUtil.DataType.FLOAT,
365             gluShaderUtil.DataType.FLOAT_VEC2,
366             gluShaderUtil.DataType.FLOAT_VEC3,
367             gluShaderUtil.DataType.FLOAT_VEC4,
368             gluShaderUtil.DataType.INT,
369             gluShaderUtil.DataType.INT_VEC2,
370             gluShaderUtil.DataType.INT_VEC3,
371             gluShaderUtil.DataType.INT_VEC4,
372             gluShaderUtil.DataType.UINT,
373             gluShaderUtil.DataType.UINT_VEC2,
374             gluShaderUtil.DataType.UINT_VEC3,
375             gluShaderUtil.DataType.UINT_VEC4,
376             gluShaderUtil.DataType.BOOL,
377             gluShaderUtil.DataType.BOOL_VEC2,
378             gluShaderUtil.DataType.BOOL_VEC3,
379             gluShaderUtil.DataType.BOOL_VEC4,
380             gluShaderUtil.DataType.FLOAT_MAT2,
381             gluShaderUtil.DataType.FLOAT_MAT3,
382             gluShaderUtil.DataType.FLOAT_MAT4,
383             gluShaderUtil.DataType.FLOAT_MAT2X3,
384             gluShaderUtil.DataType.FLOAT_MAT2X4,
385             gluShaderUtil.DataType.FLOAT_MAT3X2,
386             gluShaderUtil.DataType.FLOAT_MAT3X4,
387             gluShaderUtil.DataType.FLOAT_MAT4X2,
388             gluShaderUtil.DataType.FLOAT_MAT4X3
389         ];
391         /** @type {Array<Object.<string, glsUniformBlockCase.UniformFlags>>} */
392         var precisionFlags = [{ name: 'lowp', flags: glsUniformBlockCase.UniformFlags.PRECISION_LOW }, { name: 'mediump', flags: glsUniformBlockCase.UniformFlags.PRECISION_MEDIUM }, { name: 'highp', flags: glsUniformBlockCase.UniformFlags.PRECISION_HIGH }
393         ];
395         /** @type {Array<Object.<string, glsUniformBlockCase.UniformFlags>>} */
396         var layoutFlags = [ /* { name: 'shared', flags: glsUniformBlockCase.UniformFlags.LAYOUT_SHARED }, */
397             /* { name: 'packed', flags: glsUniformBlockCase.UniformFlags.LAYOUT_PACKED }, */ { name: 'std140', flags: glsUniformBlockCase.UniformFlags.LAYOUT_STD140 }
398         ];
400         /** @type {Array<Object.<string, glsUniformBlockCase.UniformFlags>>} */
401         var matrixFlags = [{ name: 'row_major', flags: glsUniformBlockCase.UniformFlags.LAYOUT_ROW_MAJOR }, { name: 'column_major', flags: glsUniformBlockCase.UniformFlags.LAYOUT_COLUMN_MAJOR }
402         ];
404         /** @type {Array<Object.<string, glsUniformBlockCase.UniformFlags>>} */
405         var bufferModes = [{ name: 'per_block_buffer', mode: glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK }, { name: 'single_buffer', mode: glsUniformBlockCase.BufferMode.BUFFERMODE_SINGLE }
406         ];
408         // ubo.single_basic_type
409         /** @type {tcuTestCase.DeqpTest} */
410         var singleBasicTypeGroup = tcuTestCase.newTest('single_basic_type', 'Single basic variable in single buffer');
412         testGroup.addChild(singleBasicTypeGroup);
414         /** @type {tcuTestCase.DeqpTest} */
415         var layoutGroup;
416         /** @type {gluShaderUtil.DataType} */
417         var type;
418         /** @type {string} */
419         var typeName;
420         /** @type {tcuTestCase.DeqpTest} */
421         var modeGroup;
422         /** @type {string} */
423         var baseName;
424         /** @type {number} */
425         var baseFlags;
427         for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
429             layoutGroup = tcuTestCase.newTest(layoutFlags[layoutFlagNdx].name, '', null);
430             singleBasicTypeGroup.addChild(layoutGroup);
432             for (var basicTypeNdx = 0; basicTypeNdx < basicTypes.length; basicTypeNdx++) {
433                 type = basicTypes[basicTypeNdx];
434                 typeName = gluShaderUtil.getDataTypeName(type);
436                 if (gluShaderUtil.isDataTypeBoolOrBVec(type))
437                     es3fUniformBlockTests.createBlockBasicTypeCases(layoutGroup, typeName, glsUniformBlockCase.newVarTypeBasic(type, 0), layoutFlags[layoutFlagNdx].flags);
438                 else {
439                     for (var precNdx = 0; precNdx < precisionFlags.length; precNdx++)
440                         es3fUniformBlockTests.createBlockBasicTypeCases(layoutGroup, precisionFlags[precNdx].name + '_' + typeName,
441                         glsUniformBlockCase.newVarTypeBasic(type, precisionFlags[precNdx].flags), layoutFlags[layoutFlagNdx].flags);
442                 }
444                 if (gluShaderUtil.isDataTypeMatrix(type)) {
445                     for (var matFlagNdx = 0; matFlagNdx < matrixFlags.length; matFlagNdx++) {
446                         for (var precNdx = 0; precNdx < precisionFlags.length; precNdx++)
447                             es3fUniformBlockTests.createBlockBasicTypeCases(layoutGroup, matrixFlags[matFlagNdx].name + '_' + precisionFlags[precNdx].name + '_' + typeName,
448                             glsUniformBlockCase.newVarTypeBasic(type, precisionFlags[precNdx].flags), layoutFlags[layoutFlagNdx].flags | matrixFlags[matFlagNdx].flags);
449                     }
450                 }
451             }
452         }
453         bufferedLogToConsole('ubo.single_basic_type: Tests created');
455         // ubo.single_basic_array
456         /** @type {tcuTestCase.DeqpTest} */
457         var singleBasicArrayGroup = tcuTestCase.newTest('single_basic_array', 'Single basic array variable in single buffer');
458         testGroup.addChild(singleBasicArrayGroup);
460         for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
461             layoutGroup = tcuTestCase.newTest(layoutFlags[layoutFlagNdx].name, '', null);
462             singleBasicArrayGroup.addChild(layoutGroup);
464             for (var basicTypeNdx = 0; basicTypeNdx < basicTypes.length; basicTypeNdx++) {
465                 type = basicTypes[basicTypeNdx];
466                 typeName = gluShaderUtil.getDataTypeName(type);
467                 /** @type {number} */ var arraySize = 3;
469                 es3fUniformBlockTests.createBlockBasicTypeCases(layoutGroup, typeName,
470                     glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeBasic(type, gluShaderUtil.isDataTypeBoolOrBVec(type) ? 0 : glsUniformBlockCase.UniformFlags.PRECISION_HIGH), arraySize),
471                     layoutFlags[layoutFlagNdx].flags);
473                 if (gluShaderUtil.isDataTypeMatrix(type)) {
474                     for (var matFlagNdx = 0; matFlagNdx < matrixFlags.length; matFlagNdx++)
475                         es3fUniformBlockTests.createBlockBasicTypeCases(layoutGroup, matrixFlags[matFlagNdx].name + '_' + typeName,
476                         glsUniformBlockCase.newVarTypeArray(glsUniformBlockCase.newVarTypeBasic(type, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), arraySize),
477                             layoutFlags[layoutFlagNdx].flags | matrixFlags[matFlagNdx].flags);
478                 }
479             }
480         }
481         bufferedLogToConsole('ubo.single_basic_array: Tests created');
483         // ubo.single_struct
484         /** @type {tcuTestCase.DeqpTest} */
485         var singleStructGroup = tcuTestCase.newTest('single_struct', 'Single struct in uniform block');
486         testGroup.addChild(singleStructGroup);
488         for (var modeNdx = 0; modeNdx < bufferModes.length; modeNdx++) {
489             modeGroup = tcuTestCase.newTest(bufferModes[modeNdx].name, '');
490             singleStructGroup.addChild(modeGroup);
492             for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
493                 for (var isArray = 0; isArray < 2; isArray++) {
494                     baseName = layoutFlags[layoutFlagNdx].name;
495                     baseFlags = layoutFlags[layoutFlagNdx].flags;
497                     if (bufferModes[modeNdx].mode == glsUniformBlockCase.BufferMode.BUFFERMODE_SINGLE && isArray == 0)
498                         continue; // Doesn't make sense to add this variant.
500                     if (isArray)
501                         baseName += '_instance_array';
503                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleStructCase(baseName + '_vertex', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, bufferModes[modeNdx].mode, isArray ? 3 : 0));
504                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleStructCase(baseName + '_fragment', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
506                     if (!(baseFlags & glsUniformBlockCase.UniformFlags.LAYOUT_PACKED))
507                         modeGroup.addChild(new es3fUniformBlockTests.BlockSingleStructCase(baseName + '_both', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
508                 }
509             }
510         }
511         bufferedLogToConsole('ubo.single_struct: Tests created');
513         // ubo.single_struct_array
514         /** @type {tcuTestCase.DeqpTest} */
515         var singleStructArrayGroup = tcuTestCase.newTest('single_struct_array', 'Struct array in one uniform block');
516         testGroup.addChild(singleStructArrayGroup);
518         for (var modeNdx = 0; modeNdx < bufferModes.length; modeNdx++) {
519             modeGroup = tcuTestCase.newTest(bufferModes[modeNdx].name, '');
520             singleStructArrayGroup.addChild(modeGroup);
522             for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
523                 for (var isArray = 0; isArray < 2; isArray++) {
524                     baseName = layoutFlags[layoutFlagNdx].name;
525                     baseFlags = layoutFlags[layoutFlagNdx].flags;
527                     if (bufferModes[modeNdx].mode == glsUniformBlockCase.BufferMode.BUFFERMODE_SINGLE && isArray == 0)
528                         continue; // Doesn't make sense to add this variant.
530                     if (isArray)
531                         baseName += '_instance_array';
533                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleStructArrayCase(baseName + '_vertex', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, bufferModes[modeNdx].mode, isArray ? 3 : 0));
534                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleStructArrayCase(baseName + '_fragment', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
536                     if (!(baseFlags & glsUniformBlockCase.UniformFlags.LAYOUT_PACKED))
537                         modeGroup.addChild(new es3fUniformBlockTests.BlockSingleStructArrayCase(baseName + '_both', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
538                 }
539             }
540         }
541         bufferedLogToConsole('ubo.single_struct_array: Tests created');
543         // ubo.single_nested_struct
544         /** @type {tcuTestCase.DeqpTest} */
545         var singleNestedStructGroup = tcuTestCase.newTest('single_nested_struct', 'Nested struct in one uniform block');
546         testGroup.addChild(singleNestedStructGroup);
548         for (var modeNdx = 0; modeNdx < bufferModes.length; modeNdx++) {
549             modeGroup = tcuTestCase.newTest(bufferModes[modeNdx].name, '');
550             singleNestedStructGroup.addChild(modeGroup);
552             for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
553                 for (var isArray = 0; isArray < 2; isArray++) {
554                     baseName = layoutFlags[layoutFlagNdx].name;
555                     baseFlags = layoutFlags[layoutFlagNdx].flags;
557                     if (bufferModes[modeNdx].mode == glsUniformBlockCase.BufferMode.BUFFERMODE_SINGLE && isArray == 0)
558                         continue; // Doesn't make sense to add this variant.
560                     if (isArray)
561                         baseName += '_instance_array';
563                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleNestedStructCase(baseName + '_vertex', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, bufferModes[modeNdx].mode, isArray ? 3 : 0));
564                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleNestedStructCase(baseName + '_fragment', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
566                     if (!(baseFlags & glsUniformBlockCase.UniformFlags.LAYOUT_PACKED))
567                         modeGroup.addChild(new es3fUniformBlockTests.BlockSingleNestedStructCase(baseName + '_both', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
568                 }
569             }
570         }
571         bufferedLogToConsole('ubo.single_nested_struct: Tests created');
573         // ubo.single_nested_struct_array
574         /** @type {tcuTestCase.DeqpTest} */
575         var singleNestedStructArrayGroup = tcuTestCase.newTest('single_nested_struct_array', 'Nested struct array in one uniform block');
576         testGroup.addChild(singleNestedStructArrayGroup);
578         for (var modeNdx = 0; modeNdx < bufferModes.length; modeNdx++) {
579             modeGroup = tcuTestCase.newTest(bufferModes[modeNdx].name, '');
580             singleNestedStructArrayGroup.addChild(modeGroup);
582             for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
583                 for (var isArray = 0; isArray < 2; isArray++) {
584                     baseName = layoutFlags[layoutFlagNdx].name;
585                     baseFlags = layoutFlags[layoutFlagNdx].flags;
587                     if (bufferModes[modeNdx].mode == glsUniformBlockCase.BufferMode.BUFFERMODE_SINGLE && isArray == 0)
588                         continue; // Doesn't make sense to add this variant.
590                     if (isArray)
591                         baseName += '_instance_array';
593                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleNestedStructArrayCase(baseName + '_vertex', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, bufferModes[modeNdx].mode, isArray ? 3 : 0));
594                     modeGroup.addChild(new es3fUniformBlockTests.BlockSingleNestedStructArrayCase(baseName + '_fragment', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
596                     if (!(baseFlags & glsUniformBlockCase.UniformFlags.LAYOUT_PACKED))
597                         modeGroup.addChild(new es3fUniformBlockTests.BlockSingleNestedStructArrayCase(baseName + '_both', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
598                 }
599             }
600         }
601         bufferedLogToConsole('ubo.single_nested_struct_array: Tests created');
603         // ubo.instance_array_basic_type
604         /** @type {tcuTestCase.DeqpTest} */
605         var instanceArrayBasicTypeGroup = tcuTestCase.newTest('instance_array_basic_type', 'Single basic variable in instance array');
606         testGroup.addChild(instanceArrayBasicTypeGroup);
608         for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
609             layoutGroup = tcuTestCase.newTest(layoutFlags[layoutFlagNdx].name, '');
610             instanceArrayBasicTypeGroup.addChild(layoutGroup);
612             for (var basicTypeNdx = 0; basicTypeNdx < basicTypes.length; basicTypeNdx++) {
613                 type = basicTypes[basicTypeNdx];
614                 typeName = gluShaderUtil.getDataTypeName(type);
615                 /** @type {number} */ var numInstances = 3;
617                 es3fUniformBlockTests.createBlockBasicTypeCases(layoutGroup, typeName,
618                     glsUniformBlockCase.newVarTypeBasic(type, gluShaderUtil.isDataTypeBoolOrBVec(type) ? 0 : glsUniformBlockCase.UniformFlags.PRECISION_HIGH),
619                     layoutFlags[layoutFlagNdx].flags, numInstances);
621                 if (gluShaderUtil.isDataTypeMatrix(type)) {
622                     for (var matFlagNdx = 0; matFlagNdx < matrixFlags.length; matFlagNdx++)
623                         es3fUniformBlockTests.createBlockBasicTypeCases(layoutGroup, matrixFlags[matFlagNdx].name + '_' + typeName,
624                         glsUniformBlockCase.newVarTypeBasic(type, glsUniformBlockCase.UniformFlags.PRECISION_HIGH), layoutFlags[layoutFlagNdx].flags | matrixFlags[matFlagNdx].flags,
625                             numInstances);
626                 }
627             }
628         }
629         bufferedLogToConsole('ubo.instance_array_basic_type: Tests created');
631         // ubo.multi_basic_types
632         /** @type {tcuTestCase.DeqpTest} */
633         var multiBasicTypesGroup = tcuTestCase.newTest('multi_basic_types', 'Multiple buffers with basic types');
634         testGroup.addChild(multiBasicTypesGroup);
636         for (var modeNdx = 0; modeNdx < bufferModes.length; modeNdx++) {
637             modeGroup = tcuTestCase.newTest(bufferModes[modeNdx].name, '');
638             multiBasicTypesGroup.addChild(modeGroup);
640             for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
641                 for (var isArray = 0; isArray < 2; isArray++) {
642                     baseName = layoutFlags[layoutFlagNdx].name;
643                     baseFlags = layoutFlags[layoutFlagNdx].flags;
645                     if (isArray)
646                         baseName += '_instance_array';
648                     modeGroup.addChild(new es3fUniformBlockTests.BlockMultiBasicTypesCase(baseName + '_vertex', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, bufferModes[modeNdx].mode, isArray ? 3 : 0));
649                     modeGroup.addChild(new es3fUniformBlockTests.BlockMultiBasicTypesCase(baseName + '_fragment', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
651                     if (!(baseFlags & glsUniformBlockCase.UniformFlags.LAYOUT_PACKED))
652                         modeGroup.addChild(new es3fUniformBlockTests.BlockMultiBasicTypesCase(baseName + '_both', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
654                     modeGroup.addChild(new es3fUniformBlockTests.BlockMultiBasicTypesCase(baseName + '_mixed', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
655                 }
656             }
657         }
658         bufferedLogToConsole('ubo.multi_basic_types: Tests created');
660         // ubo.multi_nested_struct
661         /** @type {tcuTestCase.DeqpTest} */
662         var multiNestedStructGroup = tcuTestCase.newTest('multi_nested_struct', 'Multiple buffers with basic types');
663         testGroup.addChild(multiNestedStructGroup);
665         for (var modeNdx = 0; modeNdx < bufferModes.length; modeNdx++) {
666             modeGroup = tcuTestCase.newTest(bufferModes[modeNdx].name, '');
667             multiNestedStructGroup.addChild(modeGroup);
669             for (var layoutFlagNdx = 0; layoutFlagNdx < layoutFlags.length; layoutFlagNdx++) {
670                 for (var isArray = 0; isArray < 2; isArray++) {
671                     baseName = layoutFlags[layoutFlagNdx].name;
672                     baseFlags = layoutFlags[layoutFlagNdx].flags;
674                     if (isArray)
675                         baseName += '_instance_array';
677                     modeGroup.addChild(new es3fUniformBlockTests.BlockMultiNestedStructCase(baseName + '_vertex', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, bufferModes[modeNdx].mode, isArray ? 3 : 0));
678                     modeGroup.addChild(new es3fUniformBlockTests.BlockMultiNestedStructCase(baseName + '_fragment', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
680                     if (!(baseFlags & glsUniformBlockCase.UniformFlags.LAYOUT_PACKED))
681                         modeGroup.addChild(new es3fUniformBlockTests.BlockMultiNestedStructCase(baseName + '_both', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
683                     modeGroup.addChild(new es3fUniformBlockTests.BlockMultiNestedStructCase(baseName + '_mixed', '', baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_VERTEX, baseFlags | glsUniformBlockCase.UniformFlags.DECLARE_FRAGMENT, bufferModes[modeNdx].mode, isArray ? 3 : 0));
684                 }
685             }
686         }
687         bufferedLogToConsole('ubo.multi_nested_struct: Tests created');
689         /* ubo.random */
690          /** @type {number} */ var allShaders = glsRandomUniformBlockCase.FeatureBits.FEATURE_VERTEX_BLOCKS | glsRandomUniformBlockCase.FeatureBits.FEATURE_FRAGMENT_BLOCKS | glsRandomUniformBlockCase.FeatureBits.FEATURE_SHARED_BLOCKS;
691          /** @type {number} */ var allLayouts = glsRandomUniformBlockCase.FeatureBits.FEATURE_STD140_LAYOUT;
692          /** @type {number} */ var allBasicTypes = glsRandomUniformBlockCase.FeatureBits.FEATURE_VECTORS | glsRandomUniformBlockCase.FeatureBits.FEATURE_MATRICES;
693          /** @type {number} */ var unused = glsRandomUniformBlockCase.FeatureBits.FEATURE_UNUSED_MEMBERS | glsRandomUniformBlockCase.FeatureBits.FEATURE_UNUSED_UNIFORMS;
694          /** @type {number} */ var matFlags = glsRandomUniformBlockCase.FeatureBits.FEATURE_MATRIX_LAYOUT;
695          /** @type {number} */ var allFeatures = (~glsRandomUniformBlockCase.FeatureBits.FEATURE_ARRAYS_OF_ARRAYS & 0xFFFF);
697          /** @type {tcuTestCase.DeqpTest} */
698          var randomGroup = tcuTestCase.newTest('random', 'Random Uniform Block cases');
699          testGroup.addChild(randomGroup);
701          // Basic types.
702          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'scalar_types', 'Scalar types only, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused, 25, 0);
703          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'vector_types', 'Scalar and vector types only, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | glsRandomUniformBlockCase.FeatureBits.FEATURE_VECTORS, 25, 25);
704          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'basic_types', 'All basic types, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | allBasicTypes | matFlags, 25, 50);
705          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'basic_arrays', 'Arrays, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | allBasicTypes | matFlags | glsRandomUniformBlockCase.FeatureBits.FEATURE_ARRAYS, 25, 50);
707          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'basic_instance_arrays', 'Basic instance arrays, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | allBasicTypes | matFlags | glsRandomUniformBlockCase.FeatureBits.FEATURE_INSTANCE_ARRAYS, 25, 75);
708          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'nested_structs', 'Nested structs, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | allBasicTypes | matFlags | glsRandomUniformBlockCase.FeatureBits.FEATURE_STRUCTS, 25, 100);
709          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'nested_structs_arrays', 'Nested structs, arrays, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | allBasicTypes | matFlags | glsRandomUniformBlockCase.FeatureBits.FEATURE_STRUCTS | glsRandomUniformBlockCase.FeatureBits.FEATURE_ARRAYS, 25, 150);
710          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'nested_structs_instance_arrays', 'Nested structs, instance arrays, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | allBasicTypes | matFlags | glsRandomUniformBlockCase.FeatureBits.FEATURE_STRUCTS | glsRandomUniformBlockCase.FeatureBits.FEATURE_INSTANCE_ARRAYS, 25, 125);
711          es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'nested_structs_arrays_instance_arrays', 'Nested structs, instance arrays, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allShaders | allLayouts | unused | allBasicTypes | matFlags | glsRandomUniformBlockCase.FeatureBits.FEATURE_STRUCTS | glsRandomUniformBlockCase.FeatureBits.FEATURE_ARRAYS | glsRandomUniformBlockCase.FeatureBits.FEATURE_INSTANCE_ARRAYS, 25, 175);
713          // Disabled: WebGL does not support shared or packed uniform buffers.
714          //es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'all_per_block_buffers', 'All random features, per-block buffers', glsUniformBlockCase.BufferMode.BUFFERMODE_PER_BLOCK, allFeatures, 50, 200);
715          //es3fUniformBlockTests.createRandomCaseGroup(randomGroup, 'all_shared_buffer', 'All random features, shared buffer', glsUniformBlockCase.BufferMode.BUFFERMODE_SINGLE, allFeatures, 50, 250);
716          bufferedLogToConsole('ubo.random: Tests created');
717     };
719     /**
720      * Create and execute the test cases
721      */
722     es3fUniformBlockTests.run = function(range) {
723         //Set up Test Root parameters
724         var testName = 'ubo';
725         var testDescription = 'Uniform Block Tests';
726         var state = tcuTestCase.runner;
728         state.setRoot(tcuTestCase.newTest(testName, testDescription, null));
730         //Set up name and description of this test series.
731         setCurrentTestName(testName);
732         description(testDescription);
734         try {
735             //Create test cases
736             es3fUniformBlockTests.init();
737             if (range)
738                 state.setRange(range);
739             //Run test cases
740             tcuTestCase.runTestCases();
741         }
742         catch (err) {
743             testFailedOptions('Failed to es3fUniformBlockTests.run tests', false);
744             tcuTestCase.runner.terminate();
745         }
746     };