summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915/i915_state.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-04-24 22:53:05 +0200
committerMarek Olšák <maraeo@gmail.com>2012-04-30 01:18:48 +0200
commit0b7d48cbad86eaac21fce3793da41b46db8be3b4 (patch)
tree437f5cfeb3a77278d29e384b47dfaef9b96faa75 /src/gallium/drivers/i915/i915_state.c
parent01bf5569c44389c1127bbb9e873c8a234ac92ff7 (diff)
downloadexternal_mesa3d-0b7d48cbad86eaac21fce3793da41b46db8be3b4.zip
external_mesa3d-0b7d48cbad86eaac21fce3793da41b46db8be3b4.tar.gz
external_mesa3d-0b7d48cbad86eaac21fce3793da41b46db8be3b4.tar.bz2
gallium: add void *user_buffer to pipe_constant_buffer
This reduces CPU overhead when updating constants.
Diffstat (limited to 'src/gallium/drivers/i915/i915_state.c')
-rw-r--r--src/gallium/drivers/i915/i915_state.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 772e229..bd9e8ba 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -672,6 +672,11 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
unsigned new_num = 0;
boolean diff = TRUE;
+ if (cb && cb->user_buffer) {
+ buf = i915_user_buffer_create(pipe->screen, cb->user_buffer,
+ cb->buffer_size,
+ PIPE_BIND_CONSTANT_BUFFER);
+ }
/* XXX don't support geom shaders now */
if (shader == PIPE_SHADER_GEOMETRY)
@@ -707,6 +712,10 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
if (diff)
i915->dirty |= shader == PIPE_SHADER_VERTEX ? I915_NEW_VS_CONSTANTS : I915_NEW_FS_CONSTANTS;
+
+ if (cb && cb->user_buffer) {
+ pipe_resource_reference(&buf, NULL);
+ }
}