summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-10-22 11:21:51 -0700
committerEric Anholt <[email protected]>2011-10-29 12:16:59 -0700
commit47c4d950cbc62f004ecdfe2eb197eb8a440cf1ae (patch)
tree7dc661815cfd2a1e029e20320e3c06112b18629c
parent752cad8f33ad1adc8950e5c0b5c9c4aa2ad046ec (diff)
i965/gen4: Fold push constant prepare()/emit() together.
While other units need to know about our constant buffer offsets, nothing else cared about which particular BO other than the emit() half. Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Paul Berry <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 5845fa8ee22..86a39d982ff 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -179,9 +179,11 @@ static GLfloat fixed_plane[6][4] = {
* cache mechanism, but maybe would benefit from a comparison against
* the current uploaded set of constants.
*/
-static void prepare_constant_buffer(struct brw_context *brw)
+static void
+brw_upload_constant_buffer(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->intel.ctx;
+ struct intel_context *intel = &brw->intel;
+ struct gl_context *ctx = &intel->ctx;
const struct brw_vertex_program *vp =
brw_vertex_program_const(brw->vertex_program);
const GLuint sz = brw->curbe.total_size;
@@ -192,7 +194,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
if (sz == 0) {
brw->curbe.last_bufsz = 0;
- return;
+ goto emit;
}
buf = brw->curbe.next_buf;
@@ -335,22 +337,17 @@ static void prepare_constant_buffer(struct brw_context *brw)
* flushes as necessary when doublebuffering of CURBEs isn't
* possible.
*/
-}
-
-static void emit_constant_buffer(struct brw_context *brw)
-{
- struct intel_context *intel = &brw->intel;
- GLuint sz = brw->curbe.total_size;
+emit:
BEGIN_BATCH(2);
- if (sz == 0) {
+ if (brw->curbe.total_size == 0) {
OUT_BATCH((CMD_CONST_BUFFER << 16) | (2 - 2));
OUT_BATCH(0);
} else {
OUT_BATCH((CMD_CONST_BUFFER << 16) | (1 << 8) | (2 - 2));
OUT_RELOC(brw->curbe.curbe_bo,
I915_GEM_DOMAIN_INSTRUCTION, 0,
- (sz - 1) + brw->curbe.curbe_offset);
+ (brw->curbe.total_size - 1) + brw->curbe.curbe_offset);
}
ADVANCE_BATCH();
}
@@ -372,7 +369,6 @@ const struct brw_tracked_state brw_constant_buffer = {
BRW_NEW_BATCH),
.cache = (CACHE_NEW_WM_PROG)
},
- .prepare = prepare_constant_buffer,
- .emit = emit_constant_buffer,
+ .emit = brw_upload_constant_buffer,
};