summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStéphane Marchesin <[email protected]>2011-07-06 19:17:15 -0700
committerStéphane Marchesin <[email protected]>2011-07-07 16:57:37 -0700
commit3c0c6248795806bb9e66bb89a7adc8fc0cf266d7 (patch)
treedda88e0aec9b83509ff9dcd6656e9b0a4dbd8528 /src
parent61efad6865978b641cdacc4c087c2e623b1eab11 (diff)
Revert "i915: Eliminate redundant CONSTANTS updates"
This reverts commit 87641cffd97f328e846604d314c21582f426a19a.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/i915_program.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c
index 507adf1d3dc..ca1949b223e 100644
--- a/src/mesa/drivers/dri/i915/i915_program.c
+++ b/src/mesa/drivers/dri/i915/i915_program.c
@@ -538,7 +538,6 @@ i915_upload_program(struct i915_context *i915,
{
GLuint program_size = p->csr - p->program;
GLuint decl_size = p->decl - p->declarations;
- GLuint nr;
if (p->error)
return;
@@ -555,33 +554,33 @@ i915_upload_program(struct i915_context *i915,
i915->state.ProgramSize = decl_size + program_size;
}
- nr = p->nr_constants;
- if (i915->state.ConstantSize != 2 + nr*4 ||
- memcmp(i915->state.Constant + 2,
- p->constant, 4*sizeof(int)*nr)) {
- if (nr) {
- I915_ACTIVESTATE(i915, I915_UPLOAD_CONSTANTS, 1);
- I915_STATECHANGE(i915, I915_UPLOAD_CONSTANTS);
-
- i915->state.Constant[0] = _3DSTATE_PIXEL_SHADER_CONSTANTS | (nr * 4);
- i915->state.Constant[1] = (1 << nr) -1;
-
- memcpy(&i915->state.Constant[2], p->constant, 4 * sizeof(int) * nr);
- i915->state.ConstantSize = 2 + nr * 4;
-
- if (0) {
- GLuint i;
- for (i = 0; i < nr; i++) {
- fprintf(stderr, "const[%d]: %f %f %f %f\n", i,
- p->constant[i][0],
- p->constant[i][1], p->constant[i][2], p->constant[i][3]);
- }
- }
- }
- else {
- I915_ACTIVESTATE(i915, I915_UPLOAD_CONSTANTS, 0);
+ /* Always seemed to get a failure if I used memcmp() to
+ * shortcircuit this state upload. Needs further investigation?
+ */
+ if (p->nr_constants) {
+ GLuint nr = p->nr_constants;
+
+ I915_ACTIVESTATE(i915, I915_UPLOAD_CONSTANTS, 1);
+ I915_STATECHANGE(i915, I915_UPLOAD_CONSTANTS);
+
+ i915->state.Constant[0] = _3DSTATE_PIXEL_SHADER_CONSTANTS | ((nr) * 4);
+ i915->state.Constant[1] = (1 << (nr - 1)) | ((1 << (nr - 1)) - 1);
+
+ memcpy(&i915->state.Constant[2], p->constant, 4 * sizeof(int) * (nr));
+ i915->state.ConstantSize = 2 + (nr) * 4;
+
+ if (0) {
+ GLuint i;
+ for (i = 0; i < nr; i++) {
+ fprintf(stderr, "const[%d]: %f %f %f %f\n", i,
+ p->constant[i][0],
+ p->constant[i][1], p->constant[i][2], p->constant[i][3]);
+ }
}
}
+ else {
+ I915_ACTIVESTATE(i915, I915_UPLOAD_CONSTANTS, 0);
+ }
p->on_hardware = 1;
}