Mesa (master): r600g: fix crash while binding a NULL constant buffer

Marek Olšák mareko at kemper.freedesktop.org
Tue Mar 26 02:19:40 UTC 2013


Module: Mesa
Branch: master
Commit: a2378daf8351d3330520edfe09c40928a8984a9b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2378daf8351d3330520edfe09c40928a8984a9b

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Mar 21 19:29:29 2013 +0100

r600g: fix crash while binding a NULL constant buffer

---

 src/gallium/drivers/r600/r600_state_common.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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);




More information about the mesa-commit mailing list