diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 21 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_draw.c | 2 |
4 files changed, 15 insertions, 28 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 37ff05082cf..41f88b9688e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1339,11 +1339,16 @@ si_invalidate_draw_sh_constants(struct si_context *sctx) sctx->last_base_vertex = SI_BASE_VERTEX_UNKNOWN; } +static inline unsigned +si_get_atom_bit(struct si_context *sctx, struct si_atom *atom) +{ + return 1 << (atom - sctx->atoms.array); +} + static inline void -si_set_atom_dirty(struct si_context *sctx, - struct si_atom *atom, bool dirty) +si_set_atom_dirty(struct si_context *sctx, struct si_atom *atom, bool dirty) { - unsigned bit = 1 << atom->id; + unsigned bit = si_get_atom_bit(sctx, atom); if (dirty) sctx->dirty_atoms |= bit; @@ -1352,17 +1357,13 @@ si_set_atom_dirty(struct si_context *sctx, } static inline bool -si_is_atom_dirty(struct si_context *sctx, - struct si_atom *atom) +si_is_atom_dirty(struct si_context *sctx, struct si_atom *atom) { - unsigned bit = 1 << atom->id; - - return sctx->dirty_atoms & bit; + return (sctx->dirty_atoms & si_get_atom_bit(sctx, atom)) != 0; } static inline void -si_mark_atom_dirty(struct si_context *sctx, - struct si_atom *atom) +si_mark_atom_dirty(struct si_context *sctx, struct si_atom *atom) { si_set_atom_dirty(sctx, atom, true); } diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 13c8fa30d6c..90416b32b71 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -33,19 +33,11 @@ #include "util/u_resource.h" #include "util/u_upload_mgr.h" -/* Initialize an external atom (owned by ../radeon). */ -static void -si_init_external_atom(struct si_context *sctx, struct si_atom *atom) -{ - atom->id = atom - sctx->atoms.array; -} - /* Initialize an atom owned by radeonsi. */ void si_init_atom(struct si_context *sctx, struct si_atom *atom, void (*emit_func)(struct si_context *ctx, struct si_atom *state)) { atom->emit = emit_func; - atom->id = atom - sctx->atoms.array; } static unsigned si_map_swizzle(unsigned swizzle) @@ -4526,12 +4518,6 @@ static void si_init_config(struct si_context *sctx); void si_init_state_functions(struct si_context *sctx) { - si_init_external_atom(sctx, &sctx->atoms.s.render_cond); - si_init_external_atom(sctx, &sctx->atoms.s.streamout_begin); - si_init_external_atom(sctx, &sctx->atoms.s.streamout_enable); - si_init_external_atom(sctx, &sctx->atoms.s.scissors); - si_init_external_atom(sctx, &sctx->atoms.s.viewports); - si_init_atom(sctx, &sctx->atoms.s.framebuffer, si_emit_framebuffer_state); si_init_atom(sctx, &sctx->atoms.s.msaa_sample_locs, si_emit_msaa_sample_locs); si_init_atom(sctx, &sctx->atoms.s.db_render_state, si_emit_db_render_state); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 6c9899d9468..4ee69b95bd3 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -45,11 +45,11 @@ struct si_shader_selector; struct r600_texture; struct si_qbo_state; -/* This encapsulates a state or an operation which can emitted into the GPU - * command stream. */ +/* State atoms are callbacks which write a sequence of packets into a GPU + * command buffer (AKA indirect buffer, AKA IB, AKA command stream, AKA CS). + */ struct si_atom { void (*emit)(struct si_context *ctx, struct si_atom *state); - unsigned short id; }; struct si_state_blend { diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 8ed87bfac54..8d41988e382 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1436,7 +1436,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) unsigned masked_atoms = 0; if (unlikely(sctx->flags & SI_CONTEXT_FLUSH_FOR_RENDER_COND)) - masked_atoms |= 1u << sctx->atoms.s.render_cond.id; + masked_atoms |= si_get_atom_bit(sctx, &sctx->atoms.s.render_cond); if (!si_upload_graphics_shader_descriptors(sctx)) return; |