summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-08-28 21:59:22 +0200
committerMarek Olšák <[email protected]>2015-09-01 21:51:13 +0200
commitba7a6cf6264dbb747f5b897d09bf1b98b232c1d0 (patch)
tree2c60ab78a599eaccf289bc3de849e9476dd1a1a8 /src/gallium/drivers/radeonsi
parent8a97528b3a97a430a887e9044b938b349585f4ab (diff)
radeonsi: define the state atom array separately
Reviewed-by: Alex Deucher <[email protected]> Acked-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_hw_context.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h20
-rw-r--r--src/gallium/drivers/radeonsi/si_state.h20
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c2
4 files changed, 23 insertions, 21 deletions
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index 8284306f30a..5ef5db73aeb 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -59,7 +59,7 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
num_dw += cs->cdw;
if (count_draw_in) {
- for (i = 0; i < SI_NUM_ATOMS(ctx); i++) {
+ for (i = 0; i < SI_NUM_ATOMS; i++) {
if (ctx->atoms.array[i]->dirty) {
num_dw += ctx->atoms.array[i]->num_dw;
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index a1845ba893d..5ca83e7a2d2 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -141,8 +141,6 @@ struct si_viewports {
struct pipe_viewport_state states[SI_MAX_VIEWPORTS];
};
-#define SI_NUM_ATOMS(sctx) (sizeof((sctx)->atoms)/sizeof((sctx)->atoms.array[0]))
-
struct si_context {
struct r600_common_context b;
struct blitter_context *blitter;
@@ -156,23 +154,7 @@ struct si_context {
struct pipe_fence_handle *last_gfx_fence;
struct si_shader_selector *fixed_func_tcs_shader;
- union {
- struct {
- /* The order matters. */
- struct r600_atom *cache_flush;
- struct r600_atom *streamout_begin;
- struct r600_atom *streamout_enable; /* must be after streamout_begin */
- struct r600_atom *framebuffer;
- struct r600_atom *msaa_sample_locs;
- struct r600_atom *db_render_state;
- struct r600_atom *msaa_config;
- struct r600_atom *clip_regs;
- struct r600_atom *shader_userdata;
- struct r600_atom *scissors;
- struct r600_atom *viewports;
- } s;
- struct r600_atom *array[0];
- } atoms;
+ union si_state_atoms atoms;
struct si_framebuffer framebuffer;
struct si_vertex_element *vertex_elements;
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 32147831699..881f6a55251 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -106,6 +106,26 @@ union si_state {
struct si_pm4_state *array[0];
};
+union si_state_atoms {
+ struct {
+ /* The order matters. */
+ struct r600_atom *cache_flush;
+ struct r600_atom *streamout_begin;
+ struct r600_atom *streamout_enable; /* must be after streamout_begin */
+ struct r600_atom *framebuffer;
+ struct r600_atom *msaa_sample_locs;
+ struct r600_atom *db_render_state;
+ struct r600_atom *msaa_config;
+ struct r600_atom *clip_regs;
+ struct r600_atom *shader_userdata;
+ struct r600_atom *scissors;
+ struct r600_atom *viewports;
+ } s;
+ struct r600_atom *array[0];
+};
+
+#define SI_NUM_ATOMS (sizeof(union si_state_atoms)/sizeof(struct r600_atom*))
+
struct si_shader_data {
struct r600_atom atom;
uint32_t sh_base[SI_NUM_SHADERS];
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index fd2fecaa741..87ee746ce6f 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -822,7 +822,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
si_need_cs_space(sctx, 0, TRUE);
/* Emit states. */
- for (i = 0; i < SI_NUM_ATOMS(sctx); i++) {
+ for (i = 0; i < SI_NUM_ATOMS; i++) {
if (sctx->atoms.array[i]->dirty) {
sctx->atoms.array[i]->emit(&sctx->b, sctx->atoms.array[i]);
sctx->atoms.array[i]->dirty = false;