diff options
author | Marek Olšák <[email protected]> | 2012-04-24 19:52:26 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-30 01:09:57 +0200 |
commit | 507337864fa80caf9f26602324d2c28dd0a75d61 (patch) | |
tree | 94ec3c69d93f5dc70f0f042c1dbc11fe01a8550c /src/gallium/auxiliary | |
parent | 1b749dc34f8d83cf3dfa863279b1fe2b356d34b2 (diff) |
gallium: change set_constant_buffer to be UBO-friendly
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/postprocess/pp_mlaa.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 15 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.c | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c index 51bc02edacc..b61cbaafb5e 100644 --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c @@ -99,8 +99,8 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, dimensions[1] = p->framebuffer.height; } - p->pipe->set_constant_buffer(p->pipe, PIPE_SHADER_VERTEX, 0, constbuf); - p->pipe->set_constant_buffer(p->pipe, PIPE_SHADER_FRAGMENT, 0, constbuf); + pipe_set_constant_buffer(p->pipe, PIPE_SHADER_VERTEX, 0, constbuf); + pipe_set_constant_buffer(p->pipe, PIPE_SHADER_FRAGMENT, 0, constbuf); mstencil.stencil[0].enabled = 1; mstencil.stencil[0].valuemask = mstencil.stencil[0].writemask = ~0; diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 49b4531dbac..651f7c2d727 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -437,6 +437,21 @@ pipe_transfer_destroy( struct pipe_context *context, context->transfer_destroy(context, transfer); } +static INLINE void +pipe_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, + struct pipe_resource *buf) +{ + if (buf) { + struct pipe_constant_buffer cb; + cb.buffer = buf; + cb.buffer_offset = 0; + cb.buffer_size = buf->width0; + pipe->set_constant_buffer(pipe, shader, index, &cb); + } else { + pipe->set_constant_buffer(pipe, shader, index, NULL); + } +} + static INLINE boolean util_get_offset( const struct pipe_rasterizer_state *templ, diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index cc213b748a5..0cb1a9f38ad 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -1015,7 +1015,7 @@ vl_compositor_render(struct vl_compositor_state *s, c->pipe->bind_vs_state(c->pipe, c->vs); c->pipe->set_vertex_buffers(c->pipe, 1, &c->vertex_buf); c->pipe->bind_vertex_elements_state(c->pipe, c->vertex_elems_state); - c->pipe->set_constant_buffer(c->pipe, PIPE_SHADER_FRAGMENT, 0, s->csc_matrix); + pipe_set_constant_buffer(c->pipe, PIPE_SHADER_FRAGMENT, 0, s->csc_matrix); c->pipe->bind_rasterizer_state(c->pipe, c->rast); draw_layers(c, s, dirty_area); |