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/mesa/state_tracker/st_atom_constbuf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mesa/state_tracker/st_atom_constbuf.c') diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 6f9d71e845..8d1dc792bc 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -90,8 +90,11 @@ void st_upload_constants( struct st_context *st, st->pipe->set_constant_buffer(st->pipe, shader_type, 0, *cbuf); } - else { + else if (*cbuf) { st->constants.tracked_state[shader_type].dirty.mesa = 0x0; + + pipe_resource_reference(cbuf, NULL); + st->pipe->set_constant_buffer(st->pipe, shader_type, 0, NULL); } } -- cgit v1.2.3