From 8dfafbf0861fe3d2542332658dd5493851053c78 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 2 Nov 2010 16:29:10 +0000 Subject: st/mesa: unbind constant buffer when not in use Important as more constant buffers per shader start to get used. Fix up r600 (tested) and nv50 (untested) to cope with this. Drivers previously didn't see unbinds of constant buffers often or ever, so this isn't always dealt with cleanly. For r600 just return and keep the reference. Will try to do better in a followup change. --- src/gallium/drivers/r600/r600_state.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/gallium/drivers/r600/r600_state.c') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index b3e0d49321..ccd74210b7 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1018,6 +1018,13 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_resource *rbuffer = (struct r600_resource*)buffer; + /* Note that the state tracker can unbind constant buffers by + * passing NULL here. + */ + if (buffer == NULL) { + return; + } + switch (shader) { case PIPE_SHADER_VERTEX: rctx->vs_const_buffer.nregs = 0; -- cgit v1.2.3