r600g: fix crash while binding a NULL constant buffer
authorMarek Olšák <maraeo@gmail.com>
Thu, 21 Mar 2013 18:29:29 +0000 (19:29 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 26 Mar 2013 00:28:18 +0000 (01:28 +0100)
src/gallium/drivers/r600/r600_state_common.c

index b0e66ac3f9ab1468d76c727875bd01d9365e9635..34c70edf575cdd9195aa0a7edf3ac802e63b6a54 100644 (file)
@@ -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);