Mesa (master): i965: Refactor gen7_upload_constant_state to look more like gen8.
Eric Anholt
anholt at kemper.freedesktop.org
Sat May 3 00:01:55 UTC 2014
Module: Mesa
Branch: master
Commit: 51b79a657110044838380406fbb0930aa7664f4e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=51b79a657110044838380406fbb0930aa7664f4e
Author: Eric Anholt <eric at anholt.net>
Date: Thu May 1 09:54:07 2014 -0700
i965: Refactor gen7_upload_constant_state to look more like gen8.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/gen7_vs_state.c | 40 +++++++++++------------------
1 file changed, 15 insertions(+), 25 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c
index e7fd4b5..ba4a36e 100644
--- a/src/mesa/drivers/dri/i965/gen7_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c
@@ -35,31 +35,21 @@ gen7_upload_constant_state(struct brw_context *brw,
const struct brw_stage_state *stage_state,
bool active, unsigned opcode)
{
- if (!active || stage_state->push_const_size == 0) {
- /* Disable the push constant buffers. */
- BEGIN_BATCH(7);
- OUT_BATCH(opcode << 16 | (7 - 2));
- OUT_BATCH(0);
- OUT_BATCH(0);
- OUT_BATCH(0);
- OUT_BATCH(0);
- OUT_BATCH(0);
- OUT_BATCH(0);
- ADVANCE_BATCH();
- } else {
- BEGIN_BATCH(7);
- OUT_BATCH(opcode << 16 | (7 - 2));
- OUT_BATCH(stage_state->push_const_size);
- OUT_BATCH(0);
- /* Pointer to the constant buffer. Covered by the set of state flags
- * from gen6_prepare_wm_contants
- */
- OUT_BATCH(stage_state->push_const_offset | GEN7_MOCS_L3);
- OUT_BATCH(0);
- OUT_BATCH(0);
- OUT_BATCH(0);
- ADVANCE_BATCH();
- }
+ /* Disable if the shader stage is inactive or there are no push constants. */
+ active = active && stage_state->push_const_size != 0;
+
+ BEGIN_BATCH(7);
+ OUT_BATCH(opcode << 16 | (7 - 2));
+ OUT_BATCH(active ? stage_state->push_const_size : 0);
+ OUT_BATCH(0);
+ /* Pointer to the constant buffer. Covered by the set of state flags
+ * from gen6_prepare_wm_contants
+ */
+ OUT_BATCH(active ? (stage_state->push_const_offset | GEN7_MOCS_L3) : 0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
}
More information about the mesa-commit
mailing list