summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv30/nv30_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv30/nv30_state.c')
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
index 64a8f33d466..f65c8b71fdd 100644
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ b/src/gallium/drivers/nv30/nv30_state.c
@@ -317,11 +317,18 @@ nv30_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask)
static void
nv30_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
- struct pipe_resource *buf)
+ struct pipe_constant_buffer *cb)
{
struct nv30_context *nv30 = nv30_context(pipe);
+ struct pipe_resource *buf = cb ? cb->buffer : NULL;
unsigned size;
+ if (cb && cb->user_buffer) {
+ buf = nouveau_user_buffer_create(pipe->screen, cb->user_buffer,
+ cb->buffer_size,
+ PIPE_BIND_CONSTANT_BUFFER);
+ }
+
size = 0;
if (buf)
size = buf->width0 / (4 * sizeof(float));
@@ -336,6 +343,10 @@ nv30_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
nv30->fragprog.constbuf_nr = size;
nv30->dirty |= NV30_NEW_FRAGCONST;
}
+
+ if (cb && cb->user_buffer) {
+ pipe_resource_reference(&buf, NULL);
+ }
}
static void
@@ -442,6 +453,4 @@ nv30_state_init(struct pipe_context *pipe)
pipe->set_vertex_buffers = nv30_set_vertex_buffers;
pipe->set_index_buffer = nv30_set_index_buffer;
-
- pipe->redefine_user_buffer = u_default_redefine_user_buffer;
}