freedreno/a6xx: Move num_driver_params to program state

No need to re-calculate this at draw time.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21202>
This commit is contained in:
Rob Clark 2023-02-05 11:15:14 -08:00 committed by Marge Bot
parent 0a17c3afc5
commit b15aaea1d5
4 changed files with 19 additions and 20 deletions

View file

@ -287,19 +287,7 @@ fd6_build_driver_params(struct fd6_emit *emit)
{
struct fd_context *ctx = emit->ctx;
struct fd6_context *fd6_ctx = fd6_context(ctx);
unsigned num_dp = 0;
if (emit->vs->need_driver_params)
num_dp++;
if (emit->gs && emit->gs->need_driver_params)
num_dp++;
if (emit->hs && emit->hs->need_driver_params)
num_dp++;
if (emit->ds && emit->ds->need_driver_params)
num_dp++;
unsigned num_dp = emit->prog->num_driver_params;
if (!num_dp) {
fd6_ctx->has_dp_state = false;

View file

@ -239,13 +239,7 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
emit.gs = fd6_emit_get_prog(&emit)->gs;
emit.fs = fd6_emit_get_prog(&emit)->fs;
if (emit.vs->need_driver_params || fd6_ctx->has_dp_state)
emit.dirty_groups |= BIT(FD6_GROUP_DRIVER_PARAMS);
else if (emit.hs && emit.hs->need_driver_params)
emit.dirty_groups |= BIT(FD6_GROUP_DRIVER_PARAMS);
else if (emit.ds && emit.ds->need_driver_params)
emit.dirty_groups |= BIT(FD6_GROUP_DRIVER_PARAMS);
else if (emit.gs && emit.gs->need_driver_params)
if (emit.prog->num_driver_params || fd6_ctx->has_dp_state)
emit.dirty_groups |= BIT(FD6_GROUP_DRIVER_PARAMS);
/* If we are doing xfb, we need to emit the xfb state on every draw: */

View file

@ -1354,6 +1354,18 @@ fd6_program_create(void *data, struct ir3_shader_variant *bs,
fd6_user_consts_cmdstream_size(state->gs) +
fd6_user_consts_cmdstream_size(state->fs);
unsigned num_dp = 0;
if (vs->need_driver_params)
num_dp++;
if (gs && gs->need_driver_params)
num_dp++;
if (hs && hs->need_driver_params)
num_dp++;
if (ds && ds->need_driver_params)
num_dp++;
state->num_driver_params = num_dp;
return &state->base;
}

View file

@ -58,6 +58,11 @@ struct fd6_program_state {
*/
uint16_t num_viewports;
/**
* The # of shader stages that need driver params.
*/
uint8_t num_driver_params;
/**
* Output components from frag shader. It is possible to have
* a fragment shader that only writes a subset of the bound