*/
#define UNMAPPED_UNIFORM_LOC ~0u
-/**
- * Count the backing storage requirements for a type
- */
-unsigned
-values_for_type(const glsl_type *type)
-{
- if (type->is_sampler()) {
- return 1;
- } else if (type->is_array() && type->fields.array->is_sampler()) {
- return type->array_size();
- } else {
- return type->component_slots();
- }
-}
-
void
program_resource_visitor::process(const glsl_type *type, const char *name)
{
* uniform for multiple shader targets, but in this case we want to
* count it for each shader target.
*/
- const unsigned values = values_for_type(type);
+ const unsigned values = type->component_slots();
if (type->contains_subroutine()) {
this->num_shader_subroutines += values;
} else if (type->contains_sampler()) {
if (!this->uniforms[id].builtin &&
!this->uniforms[id].is_shader_storage &&
this->buffer_block_index == -1)
- this->values += values_for_type(type);
+ this->values += type->component_slots();
}
/**
validate_interstage_uniform_blocks(struct gl_shader_program *prog,
gl_linked_shader **stages);
-unsigned
-values_for_type(const glsl_type *type);
-
extern void
link_assign_atomic_counter_resources(struct gl_context *ctx,
struct gl_shader_program *prog);
!prog->data->UniformStorage[i].is_shader_storage &&
prog->data->UniformStorage[i].block_index == -1) {
unsigned vec_size =
- values_for_type(prog->data->UniformStorage[i].type) *
+ prog->data->UniformStorage[i].type->component_slots() *
MAX2(prog->data->UniformStorage[i].array_elements, 1);
blob_write_bytes(metadata, prog->data->UniformStorage[i].storage,
sizeof(union gl_constant_value) * vec_size);
!prog->data->UniformStorage[i].is_shader_storage &&
prog->data->UniformStorage[i].block_index == -1) {
unsigned vec_size =
- values_for_type(prog->data->UniformStorage[i].type) *
+ prog->data->UniformStorage[i].type->component_slots() *
MAX2(prog->data->UniformStorage[i].array_elements, 1);
blob_copy_bytes(metadata,
(uint8_t *) prog->data->UniformStorage[i].storage,