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);
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
#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:
{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},
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.
*/
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));
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;
}
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
};