mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-25 00:30:37 +02:00
panfrost: Analyze sysval dirty flags
We want dirty tracking for constant buffer uploads, but which dirty flags are needed depend on what the sysvals are. So for each sysval, record a corresponding dirty flag at compile time, so at draw-time the check is easy. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11074>
This commit is contained in:
parent
8e9c043d5e
commit
6e61c54d30
3 changed files with 63 additions and 0 deletions
|
|
@ -101,6 +101,8 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
|
|||
&cfg);
|
||||
}
|
||||
|
||||
panfrost_analyze_sysvals(state);
|
||||
|
||||
util_dynarray_fini(&binary);
|
||||
|
||||
/* In both clone and tgsi_to_nir paths, the shader is ralloc'd against
|
||||
|
|
|
|||
|
|
@ -1021,6 +1021,61 @@ panfrost_upload_rt_conversion_sysval(struct panfrost_batch *batch,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
panfrost_analyze_sysvals(struct panfrost_shader_state *ss)
|
||||
{
|
||||
unsigned dirty = 0;
|
||||
unsigned dirty_shader =
|
||||
PAN_DIRTY_STAGE_RENDERER | PAN_DIRTY_STAGE_CONST;
|
||||
|
||||
for (unsigned i = 0; i < ss->info.sysvals.sysval_count; ++i) {
|
||||
switch (PAN_SYSVAL_TYPE(ss->info.sysvals.sysvals[i])) {
|
||||
case PAN_SYSVAL_VIEWPORT_SCALE:
|
||||
case PAN_SYSVAL_VIEWPORT_OFFSET:
|
||||
dirty |= PAN_DIRTY_VIEWPORT;
|
||||
break;
|
||||
|
||||
case PAN_SYSVAL_TEXTURE_SIZE:
|
||||
dirty_shader |= PAN_DIRTY_STAGE_TEXTURE;
|
||||
break;
|
||||
|
||||
case PAN_SYSVAL_SSBO:
|
||||
dirty_shader |= PAN_DIRTY_STAGE_SSBO;
|
||||
break;
|
||||
|
||||
case PAN_SYSVAL_SAMPLER:
|
||||
dirty_shader |= PAN_DIRTY_STAGE_SAMPLER;
|
||||
break;
|
||||
|
||||
case PAN_SYSVAL_IMAGE_SIZE:
|
||||
dirty_shader |= PAN_DIRTY_STAGE_IMAGE;
|
||||
break;
|
||||
|
||||
case PAN_SYSVAL_NUM_WORK_GROUPS:
|
||||
case PAN_SYSVAL_LOCAL_GROUP_SIZE:
|
||||
case PAN_SYSVAL_WORK_DIM:
|
||||
case PAN_SYSVAL_VERTEX_INSTANCE_OFFSETS:
|
||||
dirty |= PAN_DIRTY_PARAMS;
|
||||
break;
|
||||
|
||||
case PAN_SYSVAL_DRAWID:
|
||||
dirty |= PAN_DIRTY_DRAWID;
|
||||
break;
|
||||
|
||||
case PAN_SYSVAL_SAMPLE_POSITIONS:
|
||||
case PAN_SYSVAL_MULTISAMPLED:
|
||||
case PAN_SYSVAL_RT_CONVERSION:
|
||||
/* Nothing beyond the batch itself */
|
||||
break;
|
||||
default:
|
||||
unreachable("Invalid sysval");
|
||||
}
|
||||
}
|
||||
|
||||
ss->dirty_3d = dirty;
|
||||
ss->dirty_shader = dirty_shader;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_upload_sysvals(struct panfrost_batch *batch,
|
||||
const struct panfrost_ptr *ptr,
|
||||
|
|
|
|||
|
|
@ -279,6 +279,9 @@ struct panfrost_shader_state {
|
|||
/* Variants */
|
||||
enum pipe_format rt_formats[8];
|
||||
unsigned nr_cbufs;
|
||||
|
||||
/* Mask of state that dirties the sysvals */
|
||||
unsigned dirty_3d, dirty_shader;
|
||||
};
|
||||
|
||||
/* A collection of varyings (the CSO) */
|
||||
|
|
@ -390,6 +393,9 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
|
|||
gl_shader_stage stage,
|
||||
struct panfrost_shader_state *state);
|
||||
|
||||
void
|
||||
panfrost_analyze_sysvals(struct panfrost_shader_state *ss);
|
||||
|
||||
void
|
||||
panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
|
||||
struct pipe_context *pctx,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue