*/
typedef struct {
+ nir_shader *shader;
+
int (*type_size)(const struct glsl_type *, bool);
/* Tables of UBOs and SSBOs mapping driver_location/base whether
if (!nir_src_is_const(src))
return state->has_large_ubo;
unsigned idx = nir_src_as_uint(src);
- assert(idx < state->max_slot);
+ assert(idx < state->shader->info.num_ubos);
return state->large_ubos[idx];
}
if (!nir_src_is_const(src))
return state->has_large_ssbo;
unsigned idx = nir_src_as_uint(src);
- assert(idx < state->max_slot);
+ assert(idx < state->shader->info.num_ssbos);
return state->large_ssbos[idx];
}
assert(shader->options->has_imul24);
assert(type_size);
- /* uniforms list actually includes ubo's and ssbo's: */
- int max_slot = 0;
-
- nir_foreach_variable_with_modes (var, shader,
- nir_var_mem_ubo | nir_var_mem_ssbo) {
- int base = var->data.binding;
- int size = MAX2(1, glsl_array_size(var->type));
-
- max_slot = MAX2(max_slot, base + size);
- }
-
- NIR_VLA_FILL(bool, large_ubos, max_slot, 0);
- NIR_VLA_FILL(bool, large_ssbos, max_slot, 0);
+ NIR_VLA_FILL(bool, large_ubos, shader->info.num_ubos, 0);
+ NIR_VLA_FILL(bool, large_ssbos, shader->info.num_ssbos, 0);
lower_state state = {
- .type_size = type_size,
- .large_ubos = large_ubos,
- .large_ssbos = large_ssbos,
- .max_slot = max_slot,
+ .shader = shader,
+ .type_size = type_size,
+ .large_ubos = large_ubos,
+ .large_ssbos = large_ssbos,
};
/* Figure out which UBOs or SSBOs are large enough to be