From 4a344de276d6eb90fc0e2be494fb4d4afda67eb9 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 9 May 2024 10:36:13 -0400 Subject: [PATCH] asahi: rm redundant input_vertices Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/agx_nir_lower_gs.c | 2 +- src/asahi/lib/shaders/geometry.cl | 1 - src/asahi/lib/shaders/geometry.h | 7 ++----- src/gallium/drivers/asahi/agx_state.c | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/asahi/lib/agx_nir_lower_gs.c b/src/asahi/lib/agx_nir_lower_gs.c index 1a68807dde9..be10faa0497 100644 --- a/src/asahi/lib/agx_nir_lower_gs.c +++ b/src/asahi/lib/agx_nir_lower_gs.c @@ -231,7 +231,7 @@ lower_gs_inputs(nir_builder *b, nir_intrinsic_instr *intr, void *_) nir_def *vertex = vertex_id_for_topology_class( b, vert_in_prim, b->shader->info.gs.input_primitive); - nir_def *verts = load_geometry_param(b, input_vertices); + nir_def *verts = load_geometry_param(b, vs_grid[0]); nir_def *unrolled = nir_iadd(b, nir_imul(b, nir_load_instance_id(b), verts), vertex); diff --git a/src/asahi/lib/shaders/geometry.cl b/src/asahi/lib/shaders/geometry.cl index c66708b04e1..e6f5198e52b 100644 --- a/src/asahi/lib/shaders/geometry.cl +++ b/src/asahi/lib/shaders/geometry.cl @@ -469,7 +469,6 @@ libagx_gs_setup_indirect(global struct agx_geometry_params *p, /* Calculate number of primitives input into the GS */ uint prim_per_instance = u_decomposed_prims_for_vertices(mode, vertex_count); p->input_primitives = prim_per_instance * instance_count; - p->input_vertices = vertex_count; /* Invoke VS as (vertices, instances, 1); GS as (primitives, instances, 1) */ p->vs_grid[0] = vertex_count; diff --git a/src/asahi/lib/shaders/geometry.h b/src/asahi/lib/shaders/geometry.h index 16716692686..d4d3f11bd2a 100644 --- a/src/asahi/lib/shaders/geometry.h +++ b/src/asahi/lib/shaders/geometry.h @@ -121,14 +121,11 @@ struct agx_geometry_params { uint32_t xfb_prims[MAX_VERTEX_STREAMS]; /* Within an indirect GS draw, the grids used to dispatch the VS/GS written - * out by the GS indirect setup kernel. Unused for direct GS draws. + * out by the GS indirect setup kernel or the CPU for a direct draw. */ uint32_t vs_grid[3]; uint32_t gs_grid[3]; - /* Number of input vertices, part of the stride for the vertex buffer */ - uint32_t input_vertices; - /* Number of input primitives across all instances, calculated by the CPU for * a direct draw or the GS indirect setup kernel for an indirect draw. */ @@ -151,7 +148,7 @@ struct agx_geometry_params { */ uint32_t input_topology; } PACKED; -AGX_STATIC_ASSERT(sizeof(struct agx_geometry_params) == 79 * 4); +AGX_STATIC_ASSERT(sizeof(struct agx_geometry_params) == 78 * 4); struct agx_tess_params { /* Persistent (cross-draw) geometry state */ diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 8b085d273d5..3ee0d707a76 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -3934,13 +3934,13 @@ agx_batch_geometry_params(struct agx_batch *batch, uint64_t input_index_buffer, batch->uniforms.vertex_output_buffer_ptr = agx_pool_alloc_aligned(&batch->pool, 8, 8).gpu; } else { + params.vs_grid[0] = draw->count; params.gs_grid[0] = u_decomposed_prims_for_vertices(info->mode, draw->count); params.primitives_log2 = util_logbase2_ceil(params.gs_grid[0]); params.input_primitives = params.gs_grid[0] * info->instance_count; - params.input_vertices = draw->count; unsigned vb_size = libagx_tcs_in_size(draw->count * info->instance_count, batch->uniforms.vertex_outputs);