summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2015-11-30 11:46:14 +1000
committerDave Airlie <[email protected]>2015-12-07 09:58:59 +1000
commit4f83184eff9358a72f5d48dd16771c553f914ed0 (patch)
treeec3e7d02d9fb6b90a958676a512fbb3839f1467c /src/gallium/drivers/r600
parent85131a5490e1e091dfe97e6b0a73abaa9505622a (diff)
r600: use macros for updating the various stages.
These macros will make things easier to see when tess is added to the mix. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 5d7c2102284..c6302426e5f 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1294,6 +1294,26 @@ static void r600_update_clip_state(struct r600_context *rctx,
return false; \
} while(0)
+#define UPDATE_SHADER(hw, sw) do { \
+ if (sw##_dirty || (rctx->hw_shader_stages[(hw)].shader != rctx->sw##_shader->current)) \
+ update_shader_atom(ctx, &rctx->hw_shader_stages[(hw)], rctx->sw##_shader->current); \
+ } while(0)
+
+#define UPDATE_SHADER_CLIP(hw, sw) do { \
+ if (sw##_dirty || (rctx->hw_shader_stages[(hw)].shader != rctx->sw##_shader->current)) { \
+ update_shader_atom(ctx, &rctx->hw_shader_stages[(hw)], rctx->sw##_shader->current); \
+ clip_so_current = rctx->sw##_shader->current; \
+ } \
+ } while(0)
+
+#define UPDATE_SHADER_GS(hw, hw2, sw) do { \
+ if (sw##_dirty || (rctx->hw_shader_stages[(hw)].shader != rctx->sw##_shader->current)) { \
+ update_shader_atom(ctx, &rctx->hw_shader_stages[(hw)], rctx->sw##_shader->current); \
+ update_shader_atom(ctx, &rctx->hw_shader_stages[(hw2)], rctx->sw##_shader->current->gs_copy_shader); \
+ clip_so_current = rctx->sw##_shader->current->gs_copy_shader; \
+ } \
+ } while(0)
+
#define SET_NULL_SHADER(hw) do { \
if (rctx->hw_shader_stages[(hw)].shader) \
update_shader_atom(ctx, &rctx->hw_shader_stages[(hw)], NULL); \
@@ -1338,17 +1358,11 @@ static bool r600_update_derived_state(struct r600_context *rctx)
}
/* gs_shader provides GS and VS (copy shader) */
- if (unlikely(rctx->hw_shader_stages[R600_HW_STAGE_GS].shader != rctx->gs_shader->current)) {
- update_shader_atom(ctx, &rctx->hw_shader_stages[R600_HW_STAGE_GS], rctx->gs_shader->current);
- update_shader_atom(ctx, &rctx->hw_shader_stages[R600_HW_STAGE_VS], rctx->gs_shader->current->gs_copy_shader);
-
- clip_so_current = rctx->gs_shader->current->gs_copy_shader;
- }
+ UPDATE_SHADER_GS(R600_HW_STAGE_GS, R600_HW_STAGE_VS, gs);
/* vs_shader is used as ES */
- if (unlikely(vs_dirty || rctx->hw_shader_stages[R600_HW_STAGE_ES].shader != rctx->vs_shader->current)) {
- update_shader_atom(ctx, &rctx->hw_shader_stages[R600_HW_STAGE_ES], rctx->vs_shader->current);
- }
+ UPDATE_SHADER(R600_HW_STAGE_ES, vs);
+
} else {
if (unlikely(rctx->hw_shader_stages[R600_HW_STAGE_GS].shader)) {
SET_NULL_SHADER(R600_HW_STAGE_GS);
@@ -1357,11 +1371,7 @@ static bool r600_update_derived_state(struct r600_context *rctx)
r600_mark_atom_dirty(rctx, &rctx->shader_stages.atom);
}
- if (unlikely(vs_dirty || rctx->hw_shader_stages[R600_HW_STAGE_VS].shader != rctx->vs_shader->current)) {
- update_shader_atom(ctx, &rctx->hw_shader_stages[R600_HW_STAGE_VS], rctx->vs_shader->current);
-
- clip_so_current = rctx->vs_shader->current;
- }
+ UPDATE_SHADER_CLIP(R600_HW_STAGE_VS, vs);
}
/* Update clip misc state. */
@@ -1399,8 +1409,8 @@ static bool r600_update_derived_state(struct r600_context *rctx)
}
r600_mark_atom_dirty(rctx, &rctx->shader_stages.atom);
- update_shader_atom(ctx, &rctx->hw_shader_stages[R600_HW_STAGE_PS], rctx->ps_shader->current);
}
+ UPDATE_SHADER(R600_HW_STAGE_PS, ps);
if (rctx->b.chip_class >= EVERGREEN) {
evergreen_update_db_shader_control(rctx);