2 * Copyright © 2011 Intel Corporation
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:
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
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.
24 #include "main/core.h"
27 #include "ir_uniform.h"
28 #include "glsl_symbol_table.h"
29 #include "program/hash_table.h"
33 * \file link_uniforms.cpp
34 * Assign locations for GLSL uniforms.
36 * \author Ian Romanick <ian.d.romanick@intel.com>
40 * Count the backing storage requirements for a type
43 values_for_type(const glsl_type
*type
)
45 if (type
->is_sampler()) {
47 } else if (type
->is_array() && type
->fields
.array
->is_sampler()) {
48 return type
->array_size();
50 return type
->component_slots();
55 program_resource_visitor::process(const glsl_type
*type
, const char *name
)
57 assert(type
->is_record()
58 || (type
->is_array() && type
->fields
.array
->is_record())
59 || type
->is_interface()
60 || (type
->is_array() && type
->fields
.array
->is_interface()));
62 char *name_copy
= ralloc_strdup(NULL
, name
);
63 recursion(type
, &name_copy
, strlen(name
), false, NULL
);
64 ralloc_free(name_copy
);
68 program_resource_visitor::process(ir_variable
*var
)
70 const glsl_type
*t
= var
->type
;
72 /* false is always passed for the row_major parameter to the other
73 * processing functions because no information is available to do
74 * otherwise. See the warning in linker.h.
77 /* Only strdup the name if we actually will need to modify it. */
78 if (t
->is_record() || (t
->is_array() && t
->fields
.array
->is_record())) {
79 char *name
= ralloc_strdup(NULL
, var
->name
);
80 recursion(var
->type
, &name
, strlen(name
), false, NULL
);
82 } else if (t
->is_interface()) {
83 char *name
= ralloc_strdup(NULL
, var
->type
->name
);
84 recursion(var
->type
, &name
, strlen(name
), false, NULL
);
86 } else if (t
->is_array() && t
->fields
.array
->is_interface()) {
87 char *name
= ralloc_strdup(NULL
, var
->type
->fields
.array
->name
);
88 recursion(var
->type
, &name
, strlen(name
), false, NULL
);
91 this->visit_field(t
, var
->name
, false, NULL
);
96 program_resource_visitor::recursion(const glsl_type
*t
, char **name
,
97 size_t name_length
, bool row_major
,
98 const glsl_type
*record_type
)
100 /* Records need to have each field processed individually.
102 * Arrays of records need to have each array element processed
103 * individually, then each field of the resulting array elements processed
106 if (t
->is_record() || t
->is_interface()) {
107 if (record_type
== NULL
&& t
->is_record())
110 for (unsigned i
= 0; i
< t
->length
; i
++) {
111 const char *field
= t
->fields
.structure
[i
].name
;
112 size_t new_length
= name_length
;
114 if (t
->fields
.structure
[i
].type
->is_record())
115 this->visit_field(&t
->fields
.structure
[i
]);
117 /* Append '.field' to the current variable name. */
118 if (name_length
== 0) {
119 ralloc_asprintf_rewrite_tail(name
, &new_length
, "%s", field
);
121 ralloc_asprintf_rewrite_tail(name
, &new_length
, ".%s", field
);
124 recursion(t
->fields
.structure
[i
].type
, name
, new_length
,
125 t
->fields
.structure
[i
].row_major
, record_type
);
127 /* Only the first leaf-field of the record gets called with the
128 * record type pointer.
132 } else if (t
->is_array() && (t
->fields
.array
->is_record()
133 || t
->fields
.array
->is_interface())) {
134 if (record_type
== NULL
&& t
->fields
.array
->is_record())
135 record_type
= t
->fields
.array
;
137 for (unsigned i
= 0; i
< t
->length
; i
++) {
138 size_t new_length
= name_length
;
140 /* Append the subscript to the current variable name */
141 ralloc_asprintf_rewrite_tail(name
, &new_length
, "[%u]", i
);
143 recursion(t
->fields
.array
, name
, new_length
,
144 t
->fields
.structure
[i
].row_major
, record_type
);
146 /* Only the first leaf-field of the record gets called with the
147 * record type pointer.
152 this->visit_field(t
, *name
, row_major
, record_type
);
157 program_resource_visitor::visit_field(const glsl_type
*type
, const char *name
,
159 const glsl_type
*record_type
)
161 visit_field(type
, name
, row_major
);
165 program_resource_visitor::visit_field(const glsl_struct_field
*field
)
174 * Class to help calculate the storage requirements for a set of uniforms
176 * As uniforms are added to the active set the number of active uniforms and
177 * the storage requirements for those uniforms are accumulated. The active
178 * uniforms are added the the hash table supplied to the constructor.
180 * If the same uniform is added multiple times (i.e., once for each shader
181 * target), it will only be accounted once.
183 class count_uniform_size
: public program_resource_visitor
{
185 count_uniform_size(struct string_to_uint_map
*map
)
186 : num_active_uniforms(0), num_values(0), num_shader_samplers(0),
187 num_shader_uniform_components(0), is_ubo_var(false), map(map
)
194 this->num_shader_samplers
= 0;
195 this->num_shader_uniform_components
= 0;
198 void process(ir_variable
*var
)
200 this->is_ubo_var
= var
->is_in_uniform_block();
201 if (var
->is_interface_instance())
202 program_resource_visitor::process(var
->interface_type
,
203 var
->interface_type
->name
);
205 program_resource_visitor::process(var
);
209 * Total number of active uniforms counted
211 unsigned num_active_uniforms
;
214 * Number of data values required to back the storage for the active uniforms
219 * Number of samplers used
221 unsigned num_shader_samplers
;
224 * Number of uniforms used in the current shader
226 unsigned num_shader_uniform_components
;
231 virtual void visit_field(const glsl_type
*type
, const char *name
,
234 assert(!type
->is_record());
235 assert(!(type
->is_array() && type
->fields
.array
->is_record()));
236 assert(!type
->is_interface());
237 assert(!(type
->is_array() && type
->fields
.array
->is_interface()));
241 /* Count the number of samplers regardless of whether the uniform is
242 * already in the hash table. The hash table prevents adding the same
243 * uniform for multiple shader targets, but in this case we want to
244 * count it for each shader target.
246 const unsigned values
= values_for_type(type
);
247 if (type
->contains_sampler()) {
248 this->num_shader_samplers
+=
249 type
->is_array() ? type
->array_size() : 1;
251 /* Accumulate the total number of uniform slots used by this shader.
252 * Note that samplers do not count against this limit because they
253 * don't use any storage on current hardware.
256 this->num_shader_uniform_components
+= values
;
259 /* If the uniform is already in the map, there's nothing more to do.
262 if (this->map
->get(id
, name
))
265 this->map
->put(this->num_active_uniforms
, name
);
267 /* Each leaf uniform occupies one entry in the list of active
270 this->num_active_uniforms
++;
271 this->num_values
+= values
;
274 struct string_to_uint_map
*map
;
277 } /* anonymous namespace */
280 * Class to help parcel out pieces of backing storage to uniforms
282 * Each uniform processed has some range of the \c gl_constant_value
283 * structures associated with it. The association is done by finding
284 * the uniform in the \c string_to_uint_map and using the value from
285 * the map to connect that slot in the \c gl_uniform_storage table
286 * with the next available slot in the \c gl_constant_value array.
289 * This class assumes that every uniform that will be processed is
290 * already in the \c string_to_uint_map. In addition, it assumes that
291 * the \c gl_uniform_storage and \c gl_constant_value arrays are "big
294 class parcel_out_uniform_storage
: public program_resource_visitor
{
296 parcel_out_uniform_storage(struct string_to_uint_map
*map
,
297 struct gl_uniform_storage
*uniforms
,
298 union gl_constant_value
*values
)
299 : map(map
), uniforms(uniforms
), values(values
)
303 void start_shader(gl_shader_type shader_type
)
305 assert(shader_type
< MESA_SHADER_TYPES
);
306 this->shader_type
= shader_type
;
308 this->shader_samplers_used
= 0;
309 this->shader_shadow_samplers
= 0;
310 this->next_sampler
= 0;
311 memset(this->targets
, 0, sizeof(this->targets
));
314 void set_and_process(struct gl_shader_program
*prog
,
317 ubo_block_index
= -1;
318 if (var
->is_in_uniform_block()) {
319 if (var
->is_interface_instance() && var
->type
->is_array()) {
320 unsigned l
= strlen(var
->interface_type
->name
);
322 for (unsigned i
= 0; i
< prog
->NumUniformBlocks
; i
++) {
323 if (strncmp(var
->interface_type
->name
,
324 prog
->UniformBlocks
[i
].Name
,
326 && prog
->UniformBlocks
[i
].Name
[l
] == '[') {
332 for (unsigned i
= 0; i
< prog
->NumUniformBlocks
; i
++) {
333 if (strcmp(var
->interface_type
->name
,
334 prog
->UniformBlocks
[i
].Name
) == 0) {
340 assert(ubo_block_index
!= -1);
342 /* Uniform blocks that were specified with an instance name must be
343 * handled a little bit differently. The name of the variable is the
344 * name used to reference the uniform block instead of being the name
345 * of a variable within the block. Therefore, searching for the name
346 * within the block will fail.
348 if (var
->is_interface_instance()) {
350 ubo_row_major
= false;
352 const struct gl_uniform_block
*const block
=
353 &prog
->UniformBlocks
[ubo_block_index
];
355 assert(var
->location
!= -1);
357 const struct gl_uniform_buffer_variable
*const ubo_var
=
358 &block
->Uniforms
[var
->location
];
360 ubo_row_major
= ubo_var
->RowMajor
;
361 ubo_byte_offset
= ubo_var
->Offset
;
364 if (var
->is_interface_instance())
365 process(var
->interface_type
, var
->interface_type
->name
);
375 gl_shader_type shader_type
;
378 void handle_samplers(const glsl_type
*base_type
,
379 struct gl_uniform_storage
*uniform
)
381 if (base_type
->is_sampler()) {
382 uniform
->sampler
[shader_type
].index
= this->next_sampler
;
383 uniform
->sampler
[shader_type
].active
= true;
385 /* Increment the sampler by 1 for non-arrays and by the number of
386 * array elements for arrays.
388 this->next_sampler
+=
389 MAX2(1, uniform
->array_elements
);
391 const gl_texture_index target
= base_type
->sampler_index();
392 const unsigned shadow
= base_type
->sampler_shadow
;
393 for (unsigned i
= uniform
->sampler
[shader_type
].index
;
394 i
< MIN2(this->next_sampler
, MAX_SAMPLERS
);
396 this->targets
[i
] = target
;
397 this->shader_samplers_used
|= 1U << i
;
398 this->shader_shadow_samplers
|= shadow
<< i
;
401 uniform
->sampler
[shader_type
].index
= ~0;
402 uniform
->sampler
[shader_type
].active
= false;
406 virtual void visit_field(const glsl_type
*type
, const char *name
,
412 assert(!"Should not get here.");
415 virtual void visit_field(const glsl_type
*type
, const char *name
,
416 bool row_major
, const glsl_type
*record_type
)
418 assert(!type
->is_record());
419 assert(!(type
->is_array() && type
->fields
.array
->is_record()));
420 assert(!type
->is_interface());
421 assert(!(type
->is_array() && type
->fields
.array
->is_interface()));
426 bool found
= this->map
->get(id
, name
);
432 const glsl_type
*base_type
;
433 if (type
->is_array()) {
434 this->uniforms
[id
].array_elements
= type
->length
;
435 base_type
= type
->fields
.array
;
437 this->uniforms
[id
].array_elements
= 0;
441 /* This assigns sampler uniforms to sampler units. */
442 handle_samplers(base_type
, &this->uniforms
[id
]);
444 /* If there is already storage associated with this uniform, it means
445 * that it was set while processing an earlier shader stage. For
446 * example, we may be processing the uniform in the fragment shader, but
447 * the uniform was already processed in the vertex shader.
449 if (this->uniforms
[id
].storage
!= NULL
) {
453 this->uniforms
[id
].name
= ralloc_strdup(this->uniforms
, name
);
454 this->uniforms
[id
].type
= base_type
;
455 this->uniforms
[id
].initialized
= 0;
456 this->uniforms
[id
].num_driver_storage
= 0;
457 this->uniforms
[id
].driver_storage
= NULL
;
458 this->uniforms
[id
].storage
= this->values
;
459 if (this->ubo_block_index
!= -1) {
460 this->uniforms
[id
].block_index
= this->ubo_block_index
;
462 const unsigned alignment
= record_type
463 ? record_type
->std140_base_alignment(ubo_row_major
)
464 : type
->std140_base_alignment(ubo_row_major
);
465 this->ubo_byte_offset
= glsl_align(this->ubo_byte_offset
, alignment
);
466 this->uniforms
[id
].offset
= this->ubo_byte_offset
;
467 this->ubo_byte_offset
+= type
->std140_size(ubo_row_major
);
469 if (type
->is_array()) {
470 this->uniforms
[id
].array_stride
=
471 glsl_align(type
->fields
.array
->std140_size(ubo_row_major
), 16);
473 this->uniforms
[id
].array_stride
= 0;
476 if (type
->is_matrix() ||
477 (type
->is_array() && type
->fields
.array
->is_matrix())) {
478 this->uniforms
[id
].matrix_stride
= 16;
479 this->uniforms
[id
].row_major
= ubo_row_major
;
481 this->uniforms
[id
].matrix_stride
= 0;
482 this->uniforms
[id
].row_major
= false;
485 this->uniforms
[id
].block_index
= -1;
486 this->uniforms
[id
].offset
= -1;
487 this->uniforms
[id
].array_stride
= -1;
488 this->uniforms
[id
].matrix_stride
= -1;
489 this->uniforms
[id
].row_major
= false;
492 this->values
+= values_for_type(type
);
495 struct string_to_uint_map
*map
;
497 struct gl_uniform_storage
*uniforms
;
498 unsigned next_sampler
;
501 union gl_constant_value
*values
;
503 gl_texture_index targets
[MAX_SAMPLERS
];
506 * Mask of samplers used by the current shader stage.
508 unsigned shader_samplers_used
;
511 * Mask of samplers used by the current shader stage for shadows.
513 unsigned shader_shadow_samplers
;
517 * Merges a uniform block into an array of uniform blocks that may or
518 * may not already contain a copy of it.
520 * Returns the index of the new block in the array.
523 link_cross_validate_uniform_block(void *mem_ctx
,
524 struct gl_uniform_block
**linked_blocks
,
525 unsigned int *num_linked_blocks
,
526 struct gl_uniform_block
*new_block
)
528 for (unsigned int i
= 0; i
< *num_linked_blocks
; i
++) {
529 struct gl_uniform_block
*old_block
= &(*linked_blocks
)[i
];
531 if (strcmp(old_block
->Name
, new_block
->Name
) == 0)
532 return link_uniform_blocks_are_compatible(old_block
, new_block
)
536 *linked_blocks
= reralloc(mem_ctx
, *linked_blocks
,
537 struct gl_uniform_block
,
538 *num_linked_blocks
+ 1);
539 int linked_block_index
= (*num_linked_blocks
)++;
540 struct gl_uniform_block
*linked_block
= &(*linked_blocks
)[linked_block_index
];
542 memcpy(linked_block
, new_block
, sizeof(*new_block
));
543 linked_block
->Uniforms
= ralloc_array(*linked_blocks
,
544 struct gl_uniform_buffer_variable
,
545 linked_block
->NumUniforms
);
547 memcpy(linked_block
->Uniforms
,
549 sizeof(*linked_block
->Uniforms
) * linked_block
->NumUniforms
);
551 for (unsigned int i
= 0; i
< linked_block
->NumUniforms
; i
++) {
552 struct gl_uniform_buffer_variable
*ubo_var
=
553 &linked_block
->Uniforms
[i
];
555 if (ubo_var
->Name
== ubo_var
->IndexName
) {
556 ubo_var
->Name
= ralloc_strdup(*linked_blocks
, ubo_var
->Name
);
557 ubo_var
->IndexName
= ubo_var
->Name
;
559 ubo_var
->Name
= ralloc_strdup(*linked_blocks
, ubo_var
->Name
);
560 ubo_var
->IndexName
= ralloc_strdup(*linked_blocks
, ubo_var
->IndexName
);
564 return linked_block_index
;
568 * Walks the IR and update the references to uniform blocks in the
569 * ir_variables to point at linked shader's list (previously, they
570 * would point at the uniform block list in one of the pre-linked
574 link_update_uniform_buffer_variables(struct gl_shader
*shader
)
576 foreach_list(node
, shader
->ir
) {
577 ir_variable
*const var
= ((ir_instruction
*) node
)->as_variable();
579 if ((var
== NULL
) || !var
->is_in_uniform_block())
582 assert(var
->mode
== ir_var_uniform
);
584 if (var
->is_interface_instance()) {
590 char sentinel
= '\0';
592 if (var
->type
->is_record()) {
594 } else if (var
->type
->is_array()
595 && var
->type
->fields
.array
->is_record()) {
599 const unsigned l
= strlen(var
->name
);
600 for (unsigned i
= 0; i
< shader
->NumUniformBlocks
; i
++) {
601 for (unsigned j
= 0; j
< shader
->UniformBlocks
[i
].NumUniforms
; j
++) {
603 const char *begin
= shader
->UniformBlocks
[i
].Uniforms
[j
].Name
;
604 const char *end
= strchr(begin
, sentinel
);
609 if (l
!= (end
- begin
))
612 if (strncmp(var
->name
, begin
, l
) == 0) {
617 } else if (!strcmp(var
->name
,
618 shader
->UniformBlocks
[i
].Uniforms
[j
].Name
)) {
632 link_assign_uniform_block_offsets(struct gl_shader
*shader
)
634 for (unsigned b
= 0; b
< shader
->NumUniformBlocks
; b
++) {
635 struct gl_uniform_block
*block
= &shader
->UniformBlocks
[b
];
638 for (unsigned int i
= 0; i
< block
->NumUniforms
; i
++) {
639 struct gl_uniform_buffer_variable
*ubo_var
= &block
->Uniforms
[i
];
640 const struct glsl_type
*type
= ubo_var
->Type
;
642 unsigned alignment
= type
->std140_base_alignment(ubo_var
->RowMajor
);
643 unsigned size
= type
->std140_size(ubo_var
->RowMajor
);
645 offset
= glsl_align(offset
, alignment
);
646 ubo_var
->Offset
= offset
;
650 /* From the GL_ARB_uniform_buffer_object spec:
652 * "For uniform blocks laid out according to [std140] rules,
653 * the minimum buffer object size returned by the
654 * UNIFORM_BLOCK_DATA_SIZE query is derived by taking the
655 * offset of the last basic machine unit consumed by the
656 * last uniform of the uniform block (including any
657 * end-of-array or end-of-structure padding), adding one,
658 * and rounding up to the next multiple of the base
659 * alignment required for a vec4."
661 block
->UniformBufferSize
= glsl_align(offset
, 16);
666 link_assign_uniform_locations(struct gl_shader_program
*prog
)
668 ralloc_free(prog
->UniformStorage
);
669 prog
->UniformStorage
= NULL
;
670 prog
->NumUserUniformStorage
= 0;
672 if (prog
->UniformHash
!= NULL
) {
673 prog
->UniformHash
->clear();
675 prog
->UniformHash
= new string_to_uint_map
;
678 /* First pass: Count the uniform resources used by the user-defined
679 * uniforms. While this happens, each active uniform will have an index
682 * Note: this is *NOT* the index that is returned to the application by
683 * glGetUniformLocation.
685 count_uniform_size
uniform_size(prog
->UniformHash
);
686 for (unsigned i
= 0; i
< MESA_SHADER_TYPES
; i
++) {
687 struct gl_shader
*sh
= prog
->_LinkedShaders
[i
];
692 /* Uniforms that lack an initializer in the shader code have an initial
693 * value of zero. This includes sampler uniforms.
695 * Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says:
697 * "The link time initial value is either the value of the variable's
698 * initializer, if present, or 0 if no initializer is present. Sampler
699 * types cannot have initializers."
701 memset(sh
->SamplerUnits
, 0, sizeof(sh
->SamplerUnits
));
703 link_update_uniform_buffer_variables(sh
);
705 /* Reset various per-shader target counts.
707 uniform_size
.start_shader();
709 foreach_list(node
, sh
->ir
) {
710 ir_variable
*const var
= ((ir_instruction
*) node
)->as_variable();
712 if ((var
== NULL
) || (var
->mode
!= ir_var_uniform
))
715 /* FINISHME: Update code to process built-in uniforms!
717 if (strncmp("gl_", var
->name
, 3) == 0) {
718 uniform_size
.num_shader_uniform_components
+=
719 var
->type
->component_slots();
723 uniform_size
.process(var
);
726 sh
->num_samplers
= uniform_size
.num_shader_samplers
;
727 sh
->num_uniform_components
= uniform_size
.num_shader_uniform_components
;
729 sh
->num_combined_uniform_components
= sh
->num_uniform_components
;
730 for (unsigned i
= 0; i
< sh
->NumUniformBlocks
; i
++) {
731 sh
->num_combined_uniform_components
+=
732 sh
->UniformBlocks
[i
].UniformBufferSize
/ 4;
736 const unsigned num_user_uniforms
= uniform_size
.num_active_uniforms
;
737 const unsigned num_data_slots
= uniform_size
.num_values
;
739 /* On the outside chance that there were no uniforms, bail out.
741 if (num_user_uniforms
== 0)
744 struct gl_uniform_storage
*uniforms
=
745 rzalloc_array(prog
, struct gl_uniform_storage
, num_user_uniforms
);
746 union gl_constant_value
*data
=
747 rzalloc_array(uniforms
, union gl_constant_value
, num_data_slots
);
749 union gl_constant_value
*data_end
= &data
[num_data_slots
];
752 parcel_out_uniform_storage
parcel(prog
->UniformHash
, uniforms
, data
);
754 for (unsigned i
= 0; i
< MESA_SHADER_TYPES
; i
++) {
755 if (prog
->_LinkedShaders
[i
] == NULL
)
758 parcel
.start_shader((gl_shader_type
)i
);
760 foreach_list(node
, prog
->_LinkedShaders
[i
]->ir
) {
761 ir_variable
*const var
= ((ir_instruction
*) node
)->as_variable();
763 if ((var
== NULL
) || (var
->mode
!= ir_var_uniform
))
766 /* FINISHME: Update code to process built-in uniforms!
768 if (strncmp("gl_", var
->name
, 3) == 0)
771 parcel
.set_and_process(prog
, var
);
774 prog
->_LinkedShaders
[i
]->active_samplers
= parcel
.shader_samplers_used
;
775 prog
->_LinkedShaders
[i
]->shadow_samplers
= parcel
.shader_shadow_samplers
;
777 STATIC_ASSERT(sizeof(prog
->_LinkedShaders
[i
]->SamplerTargets
) == sizeof(parcel
.targets
));
778 memcpy(prog
->_LinkedShaders
[i
]->SamplerTargets
, parcel
.targets
,
779 sizeof(prog
->_LinkedShaders
[i
]->SamplerTargets
));
782 /* Determine the size of the largest uniform array queryable via
783 * glGetUniformLocation. Using this as the location scale guarantees that
784 * there is enough "room" for the array index to be stored in the low order
785 * part of the uniform location. It also makes the locations be more
788 unsigned max_array_size
= 1;
789 for (unsigned i
= 0; i
< num_user_uniforms
; i
++) {
790 if (uniforms
[i
].array_elements
> max_array_size
)
791 max_array_size
= uniforms
[i
].array_elements
;
794 prog
->UniformLocationBaseScale
= max_array_size
;
797 for (unsigned i
= 0; i
< num_user_uniforms
; i
++) {
798 assert(uniforms
[i
].storage
!= NULL
);
801 assert(parcel
.values
== data_end
);
804 prog
->NumUserUniformStorage
= num_user_uniforms
;
805 prog
->UniformStorage
= uniforms
;
807 link_set_uniform_initializers(prog
);