summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_wm_glsl.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-04-27 10:45:41 -0600
committerBrian Paul <brianp@vmware.com>2009-04-27 10:45:41 -0600
commit777b9ff43e88e456d686208c83712f26aba2dd95 (patch)
tree086a4752a6d5e453b4e0b1f5a9f3b4a0b910eb58 /src/mesa/drivers/dri/i965/brw_wm_glsl.c
parentb58b3a786aa38dcc9d72144c2cc691151e46e3d5 (diff)
i965: only upload constant buffer data when we actually need the const buffer
Make the use_const_buffer field per-program and only call the code which updates the constant buffer's data if the flag is set. This should undo the perf regression from 20f3497e4b6756e330f7b3f54e8acaa1d6c92052 (cherry picked from master, commit dc9705d12d162ba6d087eb762e315de9f97bc456)
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm_glsl.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 3471c1946e..eca4ca2c82 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -311,12 +311,12 @@ static void prealloc_reg(struct brw_wm_compile *c)
/* use a real constant buffer, or just use a section of the GRF? */
/* XXX this heuristic may need adjustment... */
if ((nr_params + nr_temps) * 4 + reg_index > 80)
- c->use_const_buffer = GL_TRUE;
+ c->fp->use_const_buffer = GL_TRUE;
else
- c->use_const_buffer = GL_FALSE;
+ c->fp->use_const_buffer = GL_FALSE;
/*printf("WM use_const_buffer = %d\n", c->use_const_buffer);*/
- if (c->use_const_buffer) {
+ if (c->fp->use_const_buffer) {
/* We'll use a real constant buffer and fetch constants from
* it with a dataport read message.
*/
@@ -377,12 +377,16 @@ static void prealloc_reg(struct brw_wm_compile *c)
* They'll be found in these registers.
* XXX alloc these on demand!
*/
- if (c->use_const_buffer) {
+ if (c->fp->use_const_buffer) {
for (i = 0; i < 3; i++) {
c->current_const[i].index = -1;
c->current_const[i].reg = brw_vec8_grf(alloc_grf(c), 0);
}
}
+#if 0
+ printf("USE CONST BUFFER? %d\n", c->fp->use_const_buffer);
+ printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index);
+#endif
}
@@ -488,7 +492,7 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
const GLuint nr = 1;
const GLuint component = GET_SWZ(src->Swizzle, channel);
- if (c->use_const_buffer &&
+ if (c->fp->use_const_buffer &&
(src->File == PROGRAM_STATE_VAR ||
src->File == PROGRAM_CONSTANT ||
src->File == PROGRAM_UNIFORM)) {
@@ -2730,7 +2734,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
#endif
/* fetch any constants that this instruction needs */
- if (c->use_const_buffer)
+ if (c->fp->use_const_buffer)
fetch_constants(c, inst);
if (inst->CondUpdate)