[Mesa-dev] [PATCH 3/4] r600g: fix crash while binding a NULL constant buffer

Marek Olšák maraeo at gmail.com
Thu Mar 21 12:27:49 PDT 2013


---
 src/gallium/drivers/r600/r600_state_common.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index b0e66ac..34c70ed 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -926,7 +926,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
 	/* Note that the state tracker can unbind constant buffers by
 	 * passing NULL here.
 	 */
-	if (unlikely(!input)) {
+	if (unlikely(!input || (!input->buffer && !input->user_buffer))) {
 		state->enabled_mask &= ~(1 << index);
 		state->dirty_mask &= ~(1 << index);
 		pipe_resource_reference(&state->cb[index].buffer, NULL);
-- 
1.7.10.4



More information about the mesa-dev mailing list