summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-24 22:53:05 +0200
committerMarek Olšák <[email protected]>2012-04-30 01:18:48 +0200
commit0b7d48cbad86eaac21fce3793da41b46db8be3b4 (patch)
tree437f5cfeb3a77278d29e384b47dfaef9b96faa75 /src/gallium/drivers/svga
parent01bf5569c44389c1127bbb9e873c8a234ac92ff7 (diff)
gallium: add void *user_buffer to pipe_constant_buffer
This reduces CPU overhead when updating constants.
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_constants.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_constants.c b/src/gallium/drivers/svga/svga_pipe_constants.c
index 5de547bc08a..46dc45b9ed0 100644
--- a/src/gallium/drivers/svga/svga_pipe_constants.c
+++ b/src/gallium/drivers/svga/svga_pipe_constants.c
@@ -29,6 +29,7 @@
#include "tgsi/tgsi_parse.h"
#include "svga_context.h"
+#include "svga_resource_buffer.h"
/***********************************************************************
* Constant buffers
@@ -50,6 +51,12 @@ static void svga_set_constant_buffer(struct pipe_context *pipe,
struct svga_context *svga = svga_context(pipe);
struct pipe_resource *buf = cb ? cb->buffer : NULL;
+ if (cb && cb->user_buffer) {
+ buf = svga_user_buffer_create(pipe->screen, cb->user_buffer,
+ cb->buffer_size,
+ PIPE_BIND_CONSTANT_BUFFER);
+ }
+
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
@@ -60,6 +67,10 @@ static void svga_set_constant_buffer(struct pipe_context *pipe,
svga->dirty |= SVGA_NEW_FS_CONST_BUFFER;
else
svga->dirty |= SVGA_NEW_VS_CONST_BUFFER;
+
+ if (cb && cb->user_buffer) {
+ pipe_resource_reference(&buf, NULL);
+ }
}