- if (type == remap_type_inactive_explicit_location) {
- *entry = INACTIVE_UNIFORM_EXPLICIT_LOCATION;
- } else if (type == remap_type_null_ptr) {
- *entry = NULL;
- } else {
- uint32_t uni_offset = blob_read_uint32(metadata);
- *entry = uniform_storage + uni_offset;
+ unsigned num = blob_read_uint32(metadata);
+ *num_entries = num;
+
+ struct gl_uniform_storage **remap_table =
+ rzalloc_array(prog, struct gl_uniform_storage *, num);
+
+ for (unsigned i = 0; i < num; i++) {
+ enum uniform_remap_type type =
+ (enum uniform_remap_type) blob_read_uint32(metadata);
+
+ if (type == remap_type_inactive_explicit_location) {
+ remap_table[i] = INACTIVE_UNIFORM_EXPLICIT_LOCATION;
+ } else if (type == remap_type_null_ptr) {
+ remap_table[i] = NULL;
+ } else if (type == remap_type_uniform_offsets_equal) {
+ uint32_t uni_offset = blob_read_uint32(metadata);
+ uint32_t count = blob_read_uint32(metadata);
+ struct gl_uniform_storage *entry = uniform_storage + uni_offset;
+
+ for (unsigned j = 0; j < count; j++)
+ remap_table[i+j] = entry;
+ i += count - 1;
+ } else {
+ uint32_t uni_offset = blob_read_uint32(metadata);
+ remap_table[i] = uniform_storage + uni_offset;
+ }