1 /*
2 * Copyright © 2012 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23 #include <gtest/gtest.h>
24 #include "util/compiler.h"
25 #include "main/mtypes.h"
26 #include "main/macros.h"
27 #include "util/ralloc.h"
28 #include "string_to_uint_map.h"
29 #include "uniform_initializer_utils.h"
30
31 namespace linker {
32 extern void
33 set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
34 const char *name, const glsl_type *type,
35 ir_constant *val, unsigned int boolean_true);
36 }
37
38 class set_uniform_initializer : public ::testing::Test {
39 public:
40 virtual void SetUp();
41 virtual void TearDown();
42
43 /**
44 * Index of the uniform to be tested.
45 *
46 * All of the \c set_uniform_initializer tests create several slots for
47 * unifroms. All but one of the slots is fake. This field holds the index
48 * of the slot for the uniform being tested.
49 */
50 unsigned actual_index;
51
52 /**
53 * Name of the uniform to be tested.
54 */
55 const char *name;
56
57 /**
58 * Shader program used in the test.
59 */
60 struct gl_shader_program *prog;
61
62 /**
63 * Ralloc memory context used for all temporary allocations.
64 */
65 void *mem_ctx;
66 };
67
68 void
SetUp()69 set_uniform_initializer::SetUp()
70 {
71 glsl_type_singleton_init_or_ref();
72
73 this->mem_ctx = ralloc_context(NULL);
74 this->prog = rzalloc(NULL, struct gl_shader_program);
75 this->prog->data = rzalloc(this->prog, struct gl_shader_program_data);
76
77 /* Set default values used by the test cases.
78 */
79 this->actual_index = 1;
80 this->name = "i";
81 }
82
83 void
TearDown()84 set_uniform_initializer::TearDown()
85 {
86 ralloc_free(this->mem_ctx);
87 this->mem_ctx = NULL;
88
89 if (this->prog->UniformHash)
90 string_to_uint_map_dtor(this->prog->UniformHash);
91
92 ralloc_free(this->prog);
93 this->prog = NULL;
94
95 glsl_type_singleton_decref();
96 }
97
98 /**
99 * Create some uniform storage for a program.
100 *
101 * \param prog Program to get some storage
102 * \param num_storage Total number of storage slots
103 * \param index_to_set Storage slot that will actually get a value
104 * \param name Name for the actual storage slot
105 * \param type Type for the elements of the actual storage slot
106 * \param array_size Size for the array of the actual storage slot. This
107 * should be zero for non-arrays.
108 */
109 static unsigned
establish_uniform_storage(struct gl_shader_program * prog,unsigned num_storage,unsigned index_to_set,const char * name,const glsl_type * type,unsigned array_size)110 establish_uniform_storage(struct gl_shader_program *prog, unsigned num_storage,
111 unsigned index_to_set, const char *name,
112 const glsl_type *type, unsigned array_size)
113 {
114 const unsigned elements = MAX2(1, array_size);
115 const unsigned data_components = elements * type->components();
116 const unsigned total_components = MAX2(17, (data_components
117 + type->components()));
118 const unsigned red_zone_components = total_components - data_components;
119
120 prog->UniformHash = new string_to_uint_map;
121 prog->data->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
122 num_storage);
123 prog->data->NumUniformStorage = num_storage;
124
125 prog->data->UniformStorage[index_to_set].name = (char *) name;
126 prog->data->UniformStorage[index_to_set].type = type;
127 prog->data->UniformStorage[index_to_set].array_elements = array_size;
128 for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
129 prog->data->UniformStorage[index_to_set].opaque[sh].index = ~0;
130 prog->data->UniformStorage[index_to_set].opaque[sh].active = false;
131 }
132 prog->data->UniformStorage[index_to_set].num_driver_storage = 0;
133 prog->data->UniformStorage[index_to_set].driver_storage = NULL;
134 prog->data->UniformStorage[index_to_set].storage =
135 rzalloc_array(prog, union gl_constant_value, total_components);
136
137 fill_storage_array_with_sentinels(prog->data->UniformStorage[index_to_set].storage,
138 data_components,
139 red_zone_components);
140
141 prog->UniformHash->put(index_to_set,
142 prog->data->UniformStorage[index_to_set].name);
143
144 for (unsigned i = 0; i < num_storage; i++) {
145 if (i == index_to_set)
146 continue;
147
148 prog->data->UniformStorage[i].name = (char *) "invalid slot";
149 prog->data->UniformStorage[i].type = glsl_type::void_type;
150 prog->data->UniformStorage[i].array_elements = 0;
151 for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
152 prog->data->UniformStorage[i].opaque[sh].index = ~0;
153 prog->data->UniformStorage[i].opaque[sh].active = false;
154 }
155 prog->data->UniformStorage[i].num_driver_storage = 0;
156 prog->data->UniformStorage[i].driver_storage = NULL;
157 prog->data->UniformStorage[i].storage = NULL;
158 }
159
160 return red_zone_components;
161 }
162
163 static void
non_array_test(void * mem_ctx,struct gl_shader_program * prog,unsigned actual_index,const char * name,enum glsl_base_type base_type,unsigned columns,unsigned rows)164 non_array_test(void *mem_ctx, struct gl_shader_program *prog,
165 unsigned actual_index, const char *name,
166 enum glsl_base_type base_type,
167 unsigned columns, unsigned rows)
168 {
169 const glsl_type *const type =
170 glsl_type::get_instance(base_type, rows, columns);
171
172 unsigned red_zone_components =
173 establish_uniform_storage(prog, 3, actual_index, name, type, 0);
174
175 ir_constant *val;
176 generate_data(mem_ctx, base_type, columns, rows, val);
177
178 linker::set_uniform_initializer(mem_ctx, prog, name, type, val, 0xF00F);
179
180 verify_data(prog->data->UniformStorage[actual_index].storage, 0, val,
181 red_zone_components, 0xF00F);
182 }
183
TEST_F(set_uniform_initializer,int_uniform)184 TEST_F(set_uniform_initializer, int_uniform)
185 {
186 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 1);
187 }
188
TEST_F(set_uniform_initializer,ivec2_uniform)189 TEST_F(set_uniform_initializer, ivec2_uniform)
190 {
191 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 2);
192 }
193
TEST_F(set_uniform_initializer,ivec3_uniform)194 TEST_F(set_uniform_initializer, ivec3_uniform)
195 {
196 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 3);
197 }
198
TEST_F(set_uniform_initializer,ivec4_uniform)199 TEST_F(set_uniform_initializer, ivec4_uniform)
200 {
201 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 4);
202 }
203
TEST_F(set_uniform_initializer,uint_uniform)204 TEST_F(set_uniform_initializer, uint_uniform)
205 {
206 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 1);
207 }
208
TEST_F(set_uniform_initializer,uvec2_uniform)209 TEST_F(set_uniform_initializer, uvec2_uniform)
210 {
211 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 2);
212 }
213
TEST_F(set_uniform_initializer,uvec3_uniform)214 TEST_F(set_uniform_initializer, uvec3_uniform)
215 {
216 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 3);
217 }
218
TEST_F(set_uniform_initializer,uvec4_uniform)219 TEST_F(set_uniform_initializer, uvec4_uniform)
220 {
221 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 4);
222 }
223
TEST_F(set_uniform_initializer,bool_uniform)224 TEST_F(set_uniform_initializer, bool_uniform)
225 {
226 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 1);
227 }
228
TEST_F(set_uniform_initializer,bvec2_uniform)229 TEST_F(set_uniform_initializer, bvec2_uniform)
230 {
231 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 2);
232 }
233
TEST_F(set_uniform_initializer,bvec3_uniform)234 TEST_F(set_uniform_initializer, bvec3_uniform)
235 {
236 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 3);
237 }
238
TEST_F(set_uniform_initializer,bvec4_uniform)239 TEST_F(set_uniform_initializer, bvec4_uniform)
240 {
241 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 4);
242 }
243
TEST_F(set_uniform_initializer,float_uniform)244 TEST_F(set_uniform_initializer, float_uniform)
245 {
246 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 2);
247 }
248
TEST_F(set_uniform_initializer,vec2_uniform)249 TEST_F(set_uniform_initializer, vec2_uniform)
250 {
251 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 2);
252 }
253
TEST_F(set_uniform_initializer,vec3_uniform)254 TEST_F(set_uniform_initializer, vec3_uniform)
255 {
256 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 3);
257 }
258
TEST_F(set_uniform_initializer,vec4_uniform)259 TEST_F(set_uniform_initializer, vec4_uniform)
260 {
261 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 4);
262 }
263
TEST_F(set_uniform_initializer,mat2x2_uniform)264 TEST_F(set_uniform_initializer, mat2x2_uniform)
265 {
266 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 2);
267 }
268
TEST_F(set_uniform_initializer,mat2x3_uniform)269 TEST_F(set_uniform_initializer, mat2x3_uniform)
270 {
271 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 3);
272 }
273
TEST_F(set_uniform_initializer,mat2x4_uniform)274 TEST_F(set_uniform_initializer, mat2x4_uniform)
275 {
276 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 4);
277 }
278
TEST_F(set_uniform_initializer,mat3x2_uniform)279 TEST_F(set_uniform_initializer, mat3x2_uniform)
280 {
281 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 2);
282 }
283
TEST_F(set_uniform_initializer,mat3x3_uniform)284 TEST_F(set_uniform_initializer, mat3x3_uniform)
285 {
286 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 3);
287 }
288
TEST_F(set_uniform_initializer,mat3x4_uniform)289 TEST_F(set_uniform_initializer, mat3x4_uniform)
290 {
291 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 4);
292 }
293
TEST_F(set_uniform_initializer,mat4x2_uniform)294 TEST_F(set_uniform_initializer, mat4x2_uniform)
295 {
296 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 2);
297 }
298
TEST_F(set_uniform_initializer,mat4x3_uniform)299 TEST_F(set_uniform_initializer, mat4x3_uniform)
300 {
301 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 3);
302 }
303
TEST_F(set_uniform_initializer,mat4x4_uniform)304 TEST_F(set_uniform_initializer, mat4x4_uniform)
305 {
306 non_array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 4);
307 }
308
309 static void
array_test(void * mem_ctx,struct gl_shader_program * prog,unsigned actual_index,const char * name,enum glsl_base_type base_type,unsigned columns,unsigned rows,unsigned array_size,unsigned excess_data_size)310 array_test(void *mem_ctx, struct gl_shader_program *prog,
311 unsigned actual_index, const char *name,
312 enum glsl_base_type base_type,
313 unsigned columns, unsigned rows, unsigned array_size,
314 unsigned excess_data_size)
315 {
316 const glsl_type *const element_type =
317 glsl_type::get_instance(base_type, rows, columns);
318
319 const unsigned red_zone_components =
320 establish_uniform_storage(prog, 3, actual_index, name, element_type,
321 array_size);
322
323 /* The constant value generated may have more array elements than the
324 * uniform that it initializes. In the real compiler and linker this can
325 * happen when a uniform array is compacted because some of the tail
326 * elements are not used. In this case, the type of the uniform will be
327 * modified, but the initializer will not.
328 */
329 ir_constant *val;
330 generate_array_data(mem_ctx, base_type, columns, rows,
331 array_size + excess_data_size, val);
332
333 linker::set_uniform_initializer(mem_ctx, prog, name, element_type, val,
334 0xF00F);
335
336 verify_data(prog->data->UniformStorage[actual_index].storage, array_size,
337 val, red_zone_components, 0xF00F);
338 }
339
TEST_F(set_uniform_initializer,int_array_uniform)340 TEST_F(set_uniform_initializer, int_array_uniform)
341 {
342 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 1, 4, 0);
343 }
344
TEST_F(set_uniform_initializer,ivec2_array_uniform)345 TEST_F(set_uniform_initializer, ivec2_array_uniform)
346 {
347 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 2, 4, 0);
348 }
349
TEST_F(set_uniform_initializer,ivec3_array_uniform)350 TEST_F(set_uniform_initializer, ivec3_array_uniform)
351 {
352 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 3, 4, 0);
353 }
354
TEST_F(set_uniform_initializer,ivec4_array_uniform)355 TEST_F(set_uniform_initializer, ivec4_array_uniform)
356 {
357 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 4, 4, 0);
358 }
359
TEST_F(set_uniform_initializer,uint_array_uniform)360 TEST_F(set_uniform_initializer, uint_array_uniform)
361 {
362 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 1, 4, 0);
363 }
364
TEST_F(set_uniform_initializer,uvec2_array_uniform)365 TEST_F(set_uniform_initializer, uvec2_array_uniform)
366 {
367 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 2, 4, 0);
368 }
369
TEST_F(set_uniform_initializer,uvec3_array_uniform)370 TEST_F(set_uniform_initializer, uvec3_array_uniform)
371 {
372 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 3, 4, 0);
373 }
374
TEST_F(set_uniform_initializer,uvec4_array_uniform)375 TEST_F(set_uniform_initializer, uvec4_array_uniform)
376 {
377 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 4, 4, 0);
378 }
379
TEST_F(set_uniform_initializer,bool_array_uniform)380 TEST_F(set_uniform_initializer, bool_array_uniform)
381 {
382 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 1, 4, 0);
383 }
384
TEST_F(set_uniform_initializer,bvec2_array_uniform)385 TEST_F(set_uniform_initializer, bvec2_array_uniform)
386 {
387 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 2, 4, 0);
388 }
389
TEST_F(set_uniform_initializer,bvec3_array_uniform)390 TEST_F(set_uniform_initializer, bvec3_array_uniform)
391 {
392 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 3, 4, 0);
393 }
394
TEST_F(set_uniform_initializer,bvec4_array_uniform)395 TEST_F(set_uniform_initializer, bvec4_array_uniform)
396 {
397 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 4, 4, 0);
398 }
399
TEST_F(set_uniform_initializer,float_array_uniform)400 TEST_F(set_uniform_initializer, float_array_uniform)
401 {
402 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 1, 4, 0);
403 }
404
TEST_F(set_uniform_initializer,vec2_array_uniform)405 TEST_F(set_uniform_initializer, vec2_array_uniform)
406 {
407 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 2, 4, 0);
408 }
409
TEST_F(set_uniform_initializer,vec3_array_uniform)410 TEST_F(set_uniform_initializer, vec3_array_uniform)
411 {
412 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 3, 4, 0);
413 }
414
TEST_F(set_uniform_initializer,vec4_array_uniform)415 TEST_F(set_uniform_initializer, vec4_array_uniform)
416 {
417 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 4, 4, 0);
418 }
419
TEST_F(set_uniform_initializer,mat2x2_array_uniform)420 TEST_F(set_uniform_initializer, mat2x2_array_uniform)
421 {
422 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 2, 4, 0);
423 }
424
TEST_F(set_uniform_initializer,mat2x3_array_uniform)425 TEST_F(set_uniform_initializer, mat2x3_array_uniform)
426 {
427 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 3, 4, 0);
428 }
429
TEST_F(set_uniform_initializer,mat2x4_array_uniform)430 TEST_F(set_uniform_initializer, mat2x4_array_uniform)
431 {
432 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 4, 4, 0);
433 }
434
TEST_F(set_uniform_initializer,mat3x2_array_uniform)435 TEST_F(set_uniform_initializer, mat3x2_array_uniform)
436 {
437 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 2, 4, 0);
438 }
439
TEST_F(set_uniform_initializer,mat3x3_array_uniform)440 TEST_F(set_uniform_initializer, mat3x3_array_uniform)
441 {
442 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 3, 4, 0);
443 }
444
TEST_F(set_uniform_initializer,mat3x4_array_uniform)445 TEST_F(set_uniform_initializer, mat3x4_array_uniform)
446 {
447 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 4, 4, 0);
448 }
449
TEST_F(set_uniform_initializer,mat4x2_array_uniform)450 TEST_F(set_uniform_initializer, mat4x2_array_uniform)
451 {
452 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 2, 4, 0);
453 }
454
TEST_F(set_uniform_initializer,mat4x3_array_uniform)455 TEST_F(set_uniform_initializer, mat4x3_array_uniform)
456 {
457 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 3, 4, 0);
458 }
459
TEST_F(set_uniform_initializer,mat4x4_array_uniform)460 TEST_F(set_uniform_initializer, mat4x4_array_uniform)
461 {
462 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 4, 4, 0);
463 }
464
TEST_F(set_uniform_initializer,int_array_uniform_excess_initializer)465 TEST_F(set_uniform_initializer, int_array_uniform_excess_initializer)
466 {
467 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 1, 4, 5);
468 }
469
TEST_F(set_uniform_initializer,ivec2_array_uniform_excess_initializer)470 TEST_F(set_uniform_initializer, ivec2_array_uniform_excess_initializer)
471 {
472 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 2, 4, 5);
473 }
474
TEST_F(set_uniform_initializer,ivec3_array_uniform_excess_initializer)475 TEST_F(set_uniform_initializer, ivec3_array_uniform_excess_initializer)
476 {
477 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 3, 4, 5);
478 }
479
TEST_F(set_uniform_initializer,ivec4_array_uniform_excess_initializer)480 TEST_F(set_uniform_initializer, ivec4_array_uniform_excess_initializer)
481 {
482 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_INT, 1, 4, 4, 5);
483 }
484
TEST_F(set_uniform_initializer,uint_array_uniform_excess_initializer)485 TEST_F(set_uniform_initializer, uint_array_uniform_excess_initializer)
486 {
487 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 1, 4, 5);
488 }
489
TEST_F(set_uniform_initializer,uvec2_array_uniform_excess_initializer)490 TEST_F(set_uniform_initializer, uvec2_array_uniform_excess_initializer)
491 {
492 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 2, 4, 5);
493 }
494
TEST_F(set_uniform_initializer,uvec3_array_uniform_excess_initializer)495 TEST_F(set_uniform_initializer, uvec3_array_uniform_excess_initializer)
496 {
497 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 3, 4, 5);
498 }
499
TEST_F(set_uniform_initializer,uvec4_array_uniform_excess_initializer)500 TEST_F(set_uniform_initializer, uvec4_array_uniform_excess_initializer)
501 {
502 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_UINT, 1, 4, 4, 5);
503 }
504
TEST_F(set_uniform_initializer,bool_array_uniform_excess_initializer)505 TEST_F(set_uniform_initializer, bool_array_uniform_excess_initializer)
506 {
507 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 1, 4, 5);
508 }
509
TEST_F(set_uniform_initializer,bvec2_array_uniform_excess_initializer)510 TEST_F(set_uniform_initializer, bvec2_array_uniform_excess_initializer)
511 {
512 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 2, 4, 5);
513 }
514
TEST_F(set_uniform_initializer,bvec3_array_uniform_excess_initializer)515 TEST_F(set_uniform_initializer, bvec3_array_uniform_excess_initializer)
516 {
517 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 3, 4, 5);
518 }
519
TEST_F(set_uniform_initializer,bvec4_array_uniform_excess_initializer)520 TEST_F(set_uniform_initializer, bvec4_array_uniform_excess_initializer)
521 {
522 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_BOOL, 1, 4, 4, 5);
523 }
524
TEST_F(set_uniform_initializer,float_array_uniform_excess_initializer)525 TEST_F(set_uniform_initializer, float_array_uniform_excess_initializer)
526 {
527 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 1, 4, 5);
528 }
529
TEST_F(set_uniform_initializer,vec2_array_uniform_excess_initializer)530 TEST_F(set_uniform_initializer, vec2_array_uniform_excess_initializer)
531 {
532 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 2, 4, 5);
533 }
534
TEST_F(set_uniform_initializer,vec3_array_uniform_excess_initializer)535 TEST_F(set_uniform_initializer, vec3_array_uniform_excess_initializer)
536 {
537 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 3, 4, 5);
538 }
539
TEST_F(set_uniform_initializer,vec4_array_uniform_excess_initializer)540 TEST_F(set_uniform_initializer, vec4_array_uniform_excess_initializer)
541 {
542 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 1, 4, 4, 5);
543 }
544
TEST_F(set_uniform_initializer,mat2x2_array_uniform_excess_initializer)545 TEST_F(set_uniform_initializer, mat2x2_array_uniform_excess_initializer)
546 {
547 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 2, 4, 5);
548 }
549
TEST_F(set_uniform_initializer,mat2x3_array_uniform_excess_initializer)550 TEST_F(set_uniform_initializer, mat2x3_array_uniform_excess_initializer)
551 {
552 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 3, 4, 5);
553 }
554
TEST_F(set_uniform_initializer,mat2x4_array_uniform_excess_initializer)555 TEST_F(set_uniform_initializer, mat2x4_array_uniform_excess_initializer)
556 {
557 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 2, 4, 4, 5);
558 }
559
TEST_F(set_uniform_initializer,mat3x2_array_uniform_excess_initializer)560 TEST_F(set_uniform_initializer, mat3x2_array_uniform_excess_initializer)
561 {
562 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 2, 4, 5);
563 }
564
TEST_F(set_uniform_initializer,mat3x3_array_uniform_excess_initializer)565 TEST_F(set_uniform_initializer, mat3x3_array_uniform_excess_initializer)
566 {
567 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 3, 4, 5);
568 }
569
TEST_F(set_uniform_initializer,mat3x4_array_uniform_excess_initializer)570 TEST_F(set_uniform_initializer, mat3x4_array_uniform_excess_initializer)
571 {
572 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 3, 4, 4, 5);
573 }
574
TEST_F(set_uniform_initializer,mat4x2_array_uniform_excess_initializer)575 TEST_F(set_uniform_initializer, mat4x2_array_uniform_excess_initializer)
576 {
577 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 2, 4, 5);
578 }
579
TEST_F(set_uniform_initializer,mat4x3_array_uniform_excess_initializer)580 TEST_F(set_uniform_initializer, mat4x3_array_uniform_excess_initializer)
581 {
582 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 3, 4, 5);
583 }
584
TEST_F(set_uniform_initializer,mat4x4_array_uniform_excess_initializer)585 TEST_F(set_uniform_initializer, mat4x4_array_uniform_excess_initializer)
586 {
587 array_test(mem_ctx, prog, actual_index, name, GLSL_TYPE_FLOAT, 4, 4, 4, 5);
588 }
589