radv,aco: compact vertex buffer descriptors
It seems common for there to be holes. fossil-db (GFX10.3, robustBufferAccess enabled): Totals from 33791 (23.10% of 146267) affected shaders: (no statistics changed) Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7871>
This commit is contained in:
parent
20a0744e22
commit
a54f111831
|
@ -4687,6 +4687,8 @@ void visit_load_input(isel_context *ctx, nir_intrinsic_instr *instr)
|
|||
|
||||
unsigned desc_index = ctx->program->info->vs.use_per_attribute_vb_descs ?
|
||||
location : attrib_binding;
|
||||
desc_index = util_bitcount(ctx->program->info->vs.vb_desc_usage_mask &
|
||||
u_bit_consecutive(0, desc_index));
|
||||
Operand off = bld.copy(bld.def(s1), Operand(desc_index * 16u));
|
||||
Temp list = bld.smem(aco_opcode::s_load_dwordx4, bld.def(s4), vertex_buffers, off);
|
||||
|
||||
|
|
|
@ -2840,8 +2840,9 @@ radv_flush_vertex_descriptors(struct radv_cmd_buffer *cmd_buffer, bool pipeline_
|
|||
struct radv_pipeline *pipeline = cmd_buffer->state.pipeline;
|
||||
unsigned vb_offset;
|
||||
void *vb_ptr;
|
||||
unsigned desc_index = 0;
|
||||
uint32_t mask = pipeline->vb_desc_usage_mask;
|
||||
uint32_t count = util_last_bit(mask);
|
||||
uint32_t count = util_bitcount(mask);
|
||||
uint64_t va;
|
||||
|
||||
/* allocate some descriptor state for vertex buffers */
|
||||
|
@ -2850,7 +2851,7 @@ radv_flush_vertex_descriptors(struct radv_cmd_buffer *cmd_buffer, bool pipeline_
|
|||
|
||||
while (mask) {
|
||||
unsigned i = u_bit_scan(&mask);
|
||||
uint32_t *desc = &((uint32_t *)vb_ptr)[i * 4];
|
||||
uint32_t *desc = &((uint32_t *)vb_ptr)[desc_index++ * 4];
|
||||
uint32_t offset;
|
||||
unsigned binding = pipeline->use_per_attribute_vb_descs ? pipeline->attrib_bindings[i] : i;
|
||||
struct radv_buffer *buffer = cmd_buffer->vertex_bindings[binding].buffer;
|
||||
|
|
|
@ -447,7 +447,7 @@ static void
|
|||
radv_dump_vertex_descriptors(struct radv_pipeline *pipeline, FILE *f)
|
||||
{
|
||||
void *ptr = (uint64_t *)pipeline->device->trace_id_ptr;
|
||||
uint32_t count = util_last_bit(pipeline->vb_desc_usage_mask);
|
||||
uint32_t count = util_bitcount(pipeline->vb_desc_usage_mask);
|
||||
uint32_t *vb_ptr = &((uint32_t *)ptr)[3];
|
||||
|
||||
if (!count)
|
||||
|
|
|
@ -758,6 +758,8 @@ handle_vs_input_decl(struct radv_shader_context *ctx, struct nir_variable *varia
|
|||
|
||||
unsigned desc_index =
|
||||
ctx->args->shader_info->vs.use_per_attribute_vb_descs ? attrib_index : attrib_binding;
|
||||
desc_index = util_bitcount(ctx->args->shader_info->vs.vb_desc_usage_mask &
|
||||
u_bit_consecutive(0, desc_index));
|
||||
t_offset = LLVMConstInt(ctx->ac.i32, desc_index, false);
|
||||
t_list = ac_build_load_to_sgpr(&ctx->ac, t_list_ptr, t_offset);
|
||||
|
||||
|
|
Loading…
Reference in New Issue