glsl: fix explicit locations for the glsl linker
We already reserved explicit locations in the GLSL linker. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>
This commit is contained in:

committed by
Marge Bot

parent
5442712c6d
commit
c7355c4fb9
@@ -48,9 +48,17 @@ static void
|
|||||||
nir_setup_uniform_remap_tables(struct gl_context *ctx,
|
nir_setup_uniform_remap_tables(struct gl_context *ctx,
|
||||||
struct gl_shader_program *prog)
|
struct gl_shader_program *prog)
|
||||||
{
|
{
|
||||||
prog->UniformRemapTable = rzalloc_array(prog,
|
/* For glsl this may have been allocated by reserve_explicit_locations() so
|
||||||
struct gl_uniform_storage *,
|
* that we can keep track of unused uniforms with explicit locations.
|
||||||
prog->NumUniformRemapTable);
|
*/
|
||||||
|
assert(!prog->data->spirv ||
|
||||||
|
(prog->data->spirv && !prog->UniformRemapTable));
|
||||||
|
if (!prog->UniformRemapTable) {
|
||||||
|
prog->UniformRemapTable = rzalloc_array(prog,
|
||||||
|
struct gl_uniform_storage *,
|
||||||
|
prog->NumUniformRemapTable);
|
||||||
|
}
|
||||||
|
|
||||||
union gl_constant_value *data =
|
union gl_constant_value *data =
|
||||||
rzalloc_array(prog->data,
|
rzalloc_array(prog->data,
|
||||||
union gl_constant_value, prog->data->NumUniformDataSlots);
|
union gl_constant_value, prog->data->NumUniformDataSlots);
|
||||||
@@ -93,7 +101,8 @@ nir_setup_uniform_remap_tables(struct gl_context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reserve locations for rest of the uniforms. */
|
/* Reserve locations for rest of the uniforms. */
|
||||||
link_util_update_empty_uniform_locations(prog);
|
if (prog->data->spirv)
|
||||||
|
link_util_update_empty_uniform_locations(prog);
|
||||||
|
|
||||||
for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
|
for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
|
||||||
struct gl_uniform_storage *uniform = &prog->data->UniformStorage[i];
|
struct gl_uniform_storage *uniform = &prog->data->UniformStorage[i];
|
||||||
@@ -1396,9 +1405,11 @@ gl_nir_link_uniforms(struct gl_context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
prog->data->NumHiddenUniforms = state.num_hidden_uniforms;
|
prog->data->NumHiddenUniforms = state.num_hidden_uniforms;
|
||||||
prog->NumUniformRemapTable = state.max_uniform_location;
|
|
||||||
prog->data->NumUniformDataSlots = state.num_values;
|
prog->data->NumUniformDataSlots = state.num_values;
|
||||||
|
|
||||||
|
if (prog->data->spirv)
|
||||||
|
prog->NumUniformRemapTable = state.max_uniform_location;
|
||||||
|
|
||||||
nir_setup_uniform_remap_tables(ctx, prog);
|
nir_setup_uniform_remap_tables(ctx, prog);
|
||||||
gl_nir_set_uniform_initializers(ctx, prog);
|
gl_nir_set_uniform_initializers(ctx, prog);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user