From Section 7.9 (SUBROUTINE UNIFORM VARIABLES) of the OpenGL
4.5 Core spec:
"The command
void UniformSubroutinesuiv(enum shadertype, sizei count,
const uint *indices);
will load all active subroutine uniforms for shader stage
shadertype with subroutine indices from indices, storing
indices[i] into the uniform at location i. The indices for
any locations between zero and the value of
ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS minus one which are not
used will be ignored."
V2: simplify NULL check suggested by Jason.
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "11.0 11.1" mesa-stable@lists.freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93731
i = 0;
do {
struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[i];
+ if (uni == NULL) {
+ i++;
+ continue;
+ }
+
int uni_count = uni->array_elements ? uni->array_elements : 1;
int j, k;
i = 0;
do {
struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[i];
+ if (uni == NULL) {
+ i++;
+ continue;
+ }
+
int uni_count = uni->array_elements ? uni->array_elements : 1;
memcpy(&uni->storage[0], &indices[i],