add_var_use_shader(nir, state.referenced_uniforms[stage]);
}
+ /* Resize uniform arrays based on the maximum array index */
+ for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
+ struct gl_linked_shader *sh = prog->_LinkedShaders[stage];
+ if (!sh)
+ continue;
+
+ nir_shader *nir = sh->Program->nir;
+ nir_foreach_variable(var, &nir->uniforms)
+ update_array_sizes(prog, var, state.referenced_uniforms);
+ }
+
/* Count total number of uniforms and allocate storage */
unsigned storage_size = 0;
if (!prog->data->spirv) {
link_and_validate_uniforms(struct gl_context *ctx,
struct gl_shader_program *prog)
{
- update_array_sizes(prog);
+ assert(!ctx->Const.UseNIRGLSLLinker);
- if (!ctx->Const.UseNIRGLSLLinker) {
- link_assign_uniform_locations(prog, ctx);
+ update_array_sizes(prog);
+ link_assign_uniform_locations(prog, ctx);
- if (prog->data->LinkStatus == LINKING_FAILURE)
- return;
+ if (prog->data->LinkStatus == LINKING_FAILURE)
+ return;
- link_util_calculate_subroutine_compat(prog);
- link_util_check_uniform_resources(ctx, prog);
- link_util_check_subroutine_resources(prog);
- check_image_resources(ctx, prog);
- link_assign_atomic_counter_resources(ctx, prog);
- link_check_atomic_counter_resources(ctx, prog);
- }
+ link_util_calculate_subroutine_compat(prog);
+ link_util_check_uniform_resources(ctx, prog);
+ link_util_check_subroutine_resources(prog);
+ check_image_resources(ctx, prog);
+ link_assign_atomic_counter_resources(ctx, prog);
+ link_check_atomic_counter_resources(ctx, prog);
}
static bool
if (!link_varyings(prog, first, last, ctx, mem_ctx))
return false;
- link_and_validate_uniforms(ctx, prog);
+ if (!ctx->Const.UseNIRGLSLLinker)
+ link_and_validate_uniforms(ctx, prog);
if (!prog->data->LinkStatus)
return false;