-/**
- * Search UniformRemapTable for empty block big enough to hold given uniform.
- * TODO Optimize this algorithm later if it turns out to be a major bottleneck.
- */
-static int
-find_empty_block(struct gl_shader_program *prog,
- struct gl_uniform_storage *uniform)
-{
- const unsigned entries = MAX2(1, uniform->array_elements);
- for (unsigned i = 0, j; i < prog->NumUniformRemapTable; i++) {
- /* We found empty space in UniformRemapTable. */
- if (prog->UniformRemapTable[i] == NULL) {
- for (j = i; j < entries && j < prog->NumUniformRemapTable; j++) {
- if (prog->UniformRemapTable[j] != NULL) {
- /* Entries do not fit in this space, continue searching
- * after this location.
- */
- i = j + 1;
- break;
- }
- }
- /* Entries fit, we can return this location. */
- if (i != j + 1) {
- return i;
- }
- }
- }
- return -1;
-}
-