st/mesa: unbind constant buffer when not in use
[mesa.git] / src / gallium / drivers / r600 / r600_state.c
index b3e0d4932178341e0c479f3225c33a03f75205a6..ccd74210b785a8f399c3c5cbd487e37be8dc28ee 100644 (file)
@@ -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;