/* 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)
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 */
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);
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;
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;
}