Mesa (master): i915g: Improve constant handling
Jakob Bornecrantz
wallbraker at kemper.freedesktop.org
Mon Jan 24 02:30:21 UTC 2011
Module: Mesa
Branch: master
Commit: 9a9630dcf0666af5a29d529db2ccb832b592e191
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a9630dcf0666af5a29d529db2ccb832b592e191
Author: Jakob Bornecrantz <wallbraker at gmail.com>
Date: Mon Jan 24 00:35:53 2011 +0100
i915g: Improve constant handling
---
src/gallium/drivers/i915/i915_state.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 4a1a4a0..e386a3f 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -535,21 +535,31 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
/* if we have a new buffer compare it with the old one */
if (buf) {
- struct i915_buffer *ir = i915_buffer(buf);
+ struct i915_buffer *ibuf = i915_buffer(buf);
struct pipe_resource *old_buf = i915->constants[shader];
struct i915_buffer *old = old_buf ? i915_buffer(old_buf) : NULL;
-
- new_num = ir->b.b.width0 / 4 * sizeof(float);
-
- if (old && new_num != i915->current.num_user_constants[shader])
- diff = memcmp(old->data, ir->data, ir->b.b.width0);
+ unsigned old_num = i915->current.num_user_constants[shader];
+
+ new_num = ibuf->b.b.width0 / 4 * sizeof(float);
+
+ if (old_num == new_num) {
+ if (old_num == 0)
+ diff = FALSE;
+#if 0
+ /* XXX no point in running this code since st/mesa only uses user buffers */
+ /* Can't compare the buffer data since they are userbuffers */
+ else if (old && old->free_on_destroy)
+ diff = memcmp(old->data, ibuf->data, ibuf->b.b.width0);
+#else
+ (void)old;
+#endif
+ }
} else {
diff = i915->current.num_user_constants[shader] != 0;
}
/*
* flush before updateing the state.
- * XXX: looks like its okay to skip the flush for vertex cbufs
*/
if (diff && shader == PIPE_SHADER_FRAGMENT)
draw_flush(i915->draw);
More information about the mesa-commit
mailing list