glsl/nir: skip adding hidden uniforms to the remap tables

The remap tables are used with the GL API so there is no need to
add hidden uniforms to them. Also when we switch to lowering some
constant arrays to uniforms in NIR in a following patch there
will no longer be enough room in the tables as we assign their
size in the GLSL IR linker not the NIR linker currently.

Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>
This commit is contained in:
Timothy Arceri
2021-10-12 13:38:46 +11:00
committed by Marge Bot
parent 44d6068c5b
commit 4488b577a1

View File

@@ -211,6 +211,9 @@ nir_setup_uniform_remap_tables(const struct gl_constants *consts,
for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
struct gl_uniform_storage *uniform = &prog->data->UniformStorage[i];
if (uniform->hidden)
continue;
if (uniform->is_shader_storage ||
glsl_get_base_type(uniform->type) == GLSL_TYPE_SUBROUTINE)
continue;
@@ -240,6 +243,9 @@ nir_setup_uniform_remap_tables(const struct gl_constants *consts,
for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
struct gl_uniform_storage *uniform = &prog->data->UniformStorage[i];
if (uniform->hidden)
continue;
if (uniform->is_shader_storage ||
glsl_get_base_type(uniform->type) == GLSL_TYPE_SUBROUTINE)
continue;
@@ -383,6 +389,24 @@ nir_setup_uniform_remap_tables(const struct gl_constants *consts,
p->sh.NumSubroutineUniformRemapTable += entries;
}
}
/* assign storage to hidden uniforms */
for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
struct gl_uniform_storage *uniform = &prog->data->UniformStorage[i];
if (!uniform->hidden ||
glsl_get_base_type(uniform->type) == GLSL_TYPE_SUBROUTINE)
continue;
const unsigned entries =
MAX2(1, prog->data->UniformStorage[i].array_elements);
uniform->storage = &data[data_pos];
unsigned num_slots = glsl_get_component_slots(uniform->type);
for (unsigned k = 0; k < entries; k++)
data_pos += num_slots;
}
}
static void