radeonsi: add a simple version of si_pm4_emit_state for non-shader states
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24732>
This commit is contained in:
@@ -340,19 +340,23 @@ void si_pm4_emit_state(struct si_context *sctx, unsigned index)
|
||||
/* All places should unset dirty_states if this doesn't pass. */
|
||||
assert(state && state != sctx->emitted.array[index]);
|
||||
|
||||
if (state->is_shader) {
|
||||
radeon_add_to_buffer_list(sctx, cs, ((struct si_shader*)state)->bo,
|
||||
RADEON_USAGE_READ | RADEON_PRIO_SHADER_BINARY);
|
||||
}
|
||||
|
||||
radeon_begin(cs);
|
||||
radeon_emit_array(state->pm4, state->ndw);
|
||||
radeon_end();
|
||||
|
||||
sctx->emitted.array[index] = state;
|
||||
}
|
||||
|
||||
void si_pm4_emit_shader(struct si_context *sctx, unsigned index)
|
||||
{
|
||||
struct si_pm4_state *state = sctx->queued.array[index];
|
||||
|
||||
si_pm4_emit_state(sctx, index);
|
||||
|
||||
radeon_add_to_buffer_list(sctx, &sctx->gfx_cs, ((struct si_shader*)state)->bo,
|
||||
RADEON_USAGE_READ | RADEON_PRIO_SHADER_BINARY);
|
||||
if (state->atom.emit)
|
||||
state->atom.emit(sctx, -1);
|
||||
|
||||
sctx->emitted.array[index] = state;
|
||||
}
|
||||
|
||||
void si_pm4_reset_emitted(struct si_context *sctx)
|
||||
|
@@ -39,7 +39,6 @@ struct si_pm4_state {
|
||||
bool packed_is_padded; /* whether SET_*_REG_PAIRS_PACKED is padded to an even number of regs */
|
||||
|
||||
/* For shader states only */
|
||||
bool is_shader;
|
||||
struct si_atom atom;
|
||||
|
||||
/* commands for the DE */
|
||||
@@ -63,6 +62,7 @@ void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsi
|
||||
|
||||
void si_pm4_emit_commands(struct si_context *sctx, struct si_pm4_state *state);
|
||||
void si_pm4_emit_state(struct si_context *sctx, unsigned index);
|
||||
void si_pm4_emit_shader(struct si_context *sctx, unsigned index);
|
||||
void si_pm4_reset_emitted(struct si_context *sctx);
|
||||
struct si_pm4_state *si_pm4_create_sized(struct si_screen *sscreen, unsigned max_dw,
|
||||
bool is_compute_queue);
|
||||
|
@@ -5413,8 +5413,16 @@ void si_init_state_compute_functions(struct si_context *sctx)
|
||||
|
||||
void si_init_state_functions(struct si_context *sctx)
|
||||
{
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(sctx->atoms.s.pm4_states); i++)
|
||||
sctx->atoms.s.pm4_states[i].emit = si_pm4_emit_state;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(blend)].emit = si_pm4_emit_state;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(rasterizer)].emit = si_pm4_emit_state;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(dsa)].emit = si_pm4_emit_state;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(poly_offset)].emit = si_pm4_emit_state;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(ls)].emit = si_pm4_emit_shader;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(hs)].emit = si_pm4_emit_shader;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(es)].emit = si_pm4_emit_shader;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(gs)].emit = si_pm4_emit_shader;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(vs)].emit = si_pm4_emit_shader;
|
||||
sctx->atoms.s.pm4_states[SI_STATE_IDX(ps)].emit = si_pm4_emit_shader;
|
||||
|
||||
sctx->atoms.s.framebuffer.emit = si_emit_framebuffer_state;
|
||||
sctx->atoms.s.db_render_state.emit = si_emit_db_render_state;
|
||||
|
@@ -612,7 +612,6 @@ si_get_shader_pm4_state(struct si_shader *shader,
|
||||
void (*emit_func)(struct si_context *ctx, unsigned index))
|
||||
{
|
||||
si_pm4_clear_state(&shader->pm4, shader->selector->screen, false);
|
||||
shader->pm4.is_shader = true;
|
||||
shader->pm4.atom.emit = emit_func;
|
||||
return &shader->pm4;
|
||||
}
|
||||
|
Reference in New Issue
Block a user