crocus: fix crash on index buffer rebinding.
authorDave Airlie <airlied@redhat.com>
Mon, 5 Jul 2021 01:43:52 +0000 (11:43 +1000)
committerMarge Bot <eric+marge@anholt.net>
Mon, 5 Jul 2021 01:47:32 +0000 (01:47 +0000)
This was crashing in plasmashell.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11704>

src/gallium/drivers/crocus/crocus_state.c

index de5e60e..df858c8 100644 (file)
@@ -8273,7 +8273,8 @@ crocus_rebind_buffer(struct crocus_context *ice,
       }
    }
 
-   if (res->bind_history & PIPE_BIND_INDEX_BUFFER) {
+   if ((res->bind_history & PIPE_BIND_INDEX_BUFFER) &&
+       ice->state.index_buffer.res) {
       if (res->bo == crocus_resource_bo(ice->state.index_buffer.res))
          pipe_resource_reference(&ice->state.index_buffer.res, NULL);
    }