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;
}
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);
}
#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)
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);
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 {
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;