asahi: Reorder state uploads in agx_draw_patches()

The important bit here is that we move agx_update_vs() to before we
build up the poly_*_params so we have access to the final linked vertex
shader.

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38404>
This commit is contained in:
Faith Ekstrand
2025-11-24 11:13:41 -05:00
committed by Marge Bot
parent 5f5054a195
commit 9ccac4e047

View File

@@ -4547,6 +4547,18 @@ agx_draw_patches(struct agx_context *ctx, const struct pipe_draw_info *info,
batch->cdm = agx_encoder_allocate(batch, dev);
}
agx_upload_draw_params(batch, indirect, draws, info);
agx_upload_vbos(batch);
agx_update_vs(batch, info->index_size);
agx_update_tcs(ctx, info);
/* XXX */
ctx->stage[MESA_SHADER_TESS_CTRL].dirty = ~0;
ctx->stage[MESA_SHADER_TESS_EVAL].dirty = ~0;
agx_update_descriptors(batch, ctx->vs);
agx_update_descriptors(batch, ctx->tcs);
batch->uniforms.vertex_outputs = ctx->vs->b.info.outputs;
uint64_t ib = 0;
size_t ib_extent = 0;
@@ -4560,8 +4572,6 @@ agx_draw_patches(struct agx_context *ctx, const struct pipe_draw_info *info,
.outputs = ctx->vs->b.info.outputs,
};
agx_upload_draw_params(batch, indirect, draws, info);
/* Setup parameters */
uint64_t heap = agx_batch_heap(batch);
assert((tcs->tess.output_stride & 3) == 0 && "must be aligned");
@@ -4592,17 +4602,6 @@ agx_draw_patches(struct agx_context *ctx, const struct pipe_draw_info *info,
struct agx_grid vs_grid, tcs_grid, tess_grid;
agx_upload_vbos(batch);
agx_update_vs(batch, info->index_size);
agx_update_tcs(ctx, info);
/* XXX */
ctx->stage[MESA_SHADER_TESS_CTRL].dirty = ~0;
ctx->stage[MESA_SHADER_TESS_EVAL].dirty = ~0;
agx_update_descriptors(batch, ctx->vs);
agx_update_descriptors(batch, ctx->tcs);
batch->uniforms.vertex_outputs = ctx->vs->b.info.outputs;
if (indirect == NULL) {
unsigned in_patches = draws->count / patch_vertices;
if (in_patches == 0)