From 0b7d48cbad86eaac21fce3793da41b46db8be3b4 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 24 Apr 2012 22:53:05 +0200 Subject: gallium: add void *user_buffer to pipe_constant_buffer This reduces CPU overhead when updating constants. --- src/gallium/drivers/nvc0/nvc0_state.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gallium/drivers/nvc0/nvc0_state.c') diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index 9b1ae550fff..40161252a3d 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -621,6 +621,12 @@ nvc0_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, struct nvc0_context *nvc0 = nvc0_context(pipe); struct pipe_resource *res = cb ? cb->buffer : NULL; + if (cb && cb->user_buffer) { + res = nouveau_user_buffer_create(pipe->screen, cb->user_buffer, + cb->buffer_size, + PIPE_BIND_CONSTANT_BUFFER); + } + switch (shader) { case PIPE_SHADER_VERTEX: shader = 0; break; /* @@ -642,6 +648,10 @@ nvc0_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, nvc0->constbuf_dirty[shader] |= 1 << index; nvc0->dirty |= NVC0_NEW_CONSTBUF; + + if (cb->user_buffer) { + pipe_resource_reference(&res, NULL); + } } /* ============================================================================= -- cgit v1.2.3