V3DV_FROM_HANDLE(v3dv_descriptor_set, set, pDescriptorSets[i]);
uint32_t index = firstSet + i;
- cmd_buffer->state.descriptor_state.descriptors[index] = set;
+ cmd_buffer->state.descriptor_state.descriptor_sets[index] = set;
cmd_buffer->state.descriptor_state.valid |= (1u << index);
}
.viewportSubPixelBits = 0,
.minMemoryMapAlignment = page_size,
.minTexelBufferOffsetAlignment = 16,
- .minUniformBufferOffsetAlignment = 256,
- .minStorageBufferOffsetAlignment = 256,
+ .minUniformBufferOffsetAlignment = 32,
+ .minStorageBufferOffsetAlignment = 32,
.minTexelOffset = -8,
.maxTexelOffset = 7,
.minTexelGatherOffset = -8,
descriptor_map_add(struct v3dv_descriptor_map *map,
int set,
int binding,
- int value,
+ int array_index,
int array_size)
{
+ assert(array_index < array_size);
+
unsigned index = 0;
- for (unsigned i = 0; i < map->num; i++) {
- if (set == map->set[i] && binding == map->binding[i]) {
- assert(value == map->value[i]);
+ for (unsigned i = 0; i < map->num_desc; i++) {
+ if (set == map->set[i] &&
+ binding == map->binding[i] &&
+ array_index == map->array_index[i]) {
assert(array_size == map->array_size[i]);
return index;
}
- index += map->array_size[i];
+ index++;
}
assert(index == map->num_desc);
- map->set[map->num] = set;
- map->binding[map->num] = binding;
- map->value[map->num] = value;
- map->array_size[map->num] = array_size;
- map->num++;
- map->num_desc += array_size;
+ map->set[map->num_desc] = set;
+ map->binding[map->num_desc] = binding;
+ map->array_index[map->num_desc] = array_index;
+ map->array_size[map->num_desc] = array_size;
+ map->num_desc++;
return index;
}
* constants, that is already took into account when loading the ubo at
* nir_to_vir, so we don't need to do it here again.
*/
- index = descriptor_map_add(descriptor_map, set, binding, 0,
+ index = descriptor_map_add(descriptor_map, set, binding,
+ const_val->u32,
binding_layout->array_size);
- index += const_val->u32;
break;
}
};
struct v3dv_descriptor_state {
- struct v3dv_descriptor_set *descriptors[MAX_SETS];
+ struct v3dv_descriptor_set *descriptor_sets[MAX_SETS];
uint32_t valid;
};
struct v3dv_descriptor_map {
/* TODO: avoid fixed size array/justify the size */
- unsigned num; /* number of array entries */
- unsigned num_desc; /* Number of descriptors (sum of array_size[]) */
+ unsigned num_desc; /* Number of descriptors */
int set[64];
int binding[64];
- int value[64];
+ int array_index[64];
int array_size[64];
};
struct v3dv_descriptor_map *map,
uint32_t index)
{
- assert(index >= 0 && index < map->num );
+ assert(index >= 0 && index < map->num_desc);
uint32_t set_number = map->set[index];
assert(descriptor_state->valid & 1 << set_number);
struct v3dv_descriptor_set *set =
- descriptor_state->descriptors[set_number];
+ descriptor_state->descriptor_sets[set_number];
assert(set);
uint32_t binding_number = map->binding[index];
const struct v3dv_descriptor_set_binding_layout *binding_layout =
&set->layout->binding[binding_number];
- return &set->descriptors[binding_layout->descriptor_index];
+ uint32_t array_index = map->array_index[index];
+ assert(array_index < binding_layout->array_size);
+
+ return &set->descriptors[binding_layout->descriptor_index + array_index];
}
struct v3dv_cl_reloc