summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/i915/i915_context.c18
-rw-r--r--src/gallium/drivers/i915/i915_context.h8
-rw-r--r--src/gallium/drivers/i915/i915_debug.c3
-rw-r--r--src/gallium/drivers/i915/i915_state.c11
-rw-r--r--src/gallium/drivers/i915/i915_state_fpc.c2
5 files changed, 31 insertions, 11 deletions
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 9d43381f7b3..15454d02cfb 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -51,6 +51,14 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
struct draw_context *draw = i915->draw;
void *mapped_indices = NULL;
unsigned i;
+ unsigned cbuf_dirty;
+
+
+ /*
+ * Ack vs contants here, helps ipers a lot.
+ */
+ cbuf_dirty = i915->dirty & I915_NEW_VS_CONSTANTS;
+ i915->dirty &= ~I915_NEW_VS_CONSTANTS;
if (i915->dirty)
i915_update_derived(i915);
@@ -70,10 +78,12 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
mapped_indices = i915_buffer(i915->index_buffer.buffer)->data;
draw_set_mapped_index_buffer(draw, mapped_indices);
- draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
- i915->current.constants[PIPE_SHADER_VERTEX],
- (i915->current.num_user_constants[PIPE_SHADER_VERTEX] *
- 4 * sizeof(float)));
+ if (cbuf_dirty) {
+ draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
+ i915->current.constants[PIPE_SHADER_VERTEX],
+ (i915->current.num_user_constants[PIPE_SHADER_VERTEX] *
+ 4 * sizeof(float)));
+ }
/*
* Do the drawing
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 1bf9cde4d4d..6dab3a14a58 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -257,9 +257,11 @@ struct i915_context {
#define I915_NEW_DEPTH_STENCIL 0x200
#define I915_NEW_SAMPLER 0x400
#define I915_NEW_SAMPLER_VIEW 0x800
-#define I915_NEW_CONSTANTS 0x1000
-#define I915_NEW_VBO 0x2000
-#define I915_NEW_VS 0x4000
+#define I915_NEW_VS_CONSTANTS 0x1000
+#define I915_NEW_FS_CONSTANTS 0x2000
+#define I915_NEW_GS_CONSTANTS 0x4000
+#define I915_NEW_VBO 0x8000
+#define I915_NEW_VS 0x10000
/* Driver's internally generated state flags:
diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c
index 87c435a2f36..845e92cf5c6 100644
--- a/src/gallium/drivers/i915/i915_debug.c
+++ b/src/gallium/drivers/i915/i915_debug.c
@@ -948,7 +948,8 @@ i915_dump_dirty(struct i915_context *i915, const char *func)
{I915_NEW_DEPTH_STENCIL, "depth_stencil"},
{I915_NEW_SAMPLER, "sampler"},
{I915_NEW_SAMPLER_VIEW, "sampler_view"},
- {I915_NEW_CONSTANTS, "constants"},
+ {I915_NEW_VS_CONSTANTS, "vs_const"},
+ {I915_NEW_FS_CONSTANTS, "fs_const"},
{I915_NEW_VBO, "vbo"},
{I915_NEW_VS, "vs"},
{0, NULL},
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index f5b60ed5942..cc8bd3b0c39 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -527,6 +527,10 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
struct i915_context *i915 = i915_context(pipe);
draw_flush(i915->draw);
+ /* XXX don't support geom shaders now */
+ if (shader == PIPE_SHADER_GEOMETRY)
+ return;
+
/* Make a copy of shader constants.
* During fragment program translation we may add additional
* constants to the array.
@@ -538,6 +542,10 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
*/
if (buf) {
struct i915_buffer *ir = i915_buffer(buf);
+
+ if (!memcmp(i915->current.constants[shader], ir->data, ir->b.b.width0))
+ return;
+
memcpy(i915->current.constants[shader], ir->data, ir->b.b.width0);
i915->current.num_user_constants[shader] = (ir->b.b.width0 /
4 * sizeof(float));
@@ -546,8 +554,7 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
i915->current.num_user_constants[shader] = 0;
}
-
- i915->dirty |= I915_NEW_CONSTANTS;
+ i915->dirty |= shader == PIPE_SHADER_VERTEX ? I915_NEW_VS_CONSTANTS : I915_NEW_FS_CONSTANTS;
}
diff --git a/src/gallium/drivers/i915/i915_state_fpc.c b/src/gallium/drivers/i915/i915_state_fpc.c
index ec7cec0e471..1959a24691d 100644
--- a/src/gallium/drivers/i915/i915_state_fpc.c
+++ b/src/gallium/drivers/i915/i915_state_fpc.c
@@ -40,7 +40,7 @@ static void update_hw_constants(struct i915_context *i915)
struct i915_tracked_state i915_hw_constants = {
"hw_constants",
update_hw_constants,
- I915_NEW_CONSTANTS | I915_NEW_FS
+ I915_NEW_FS_CONSTANTS | I915_NEW_FS
};