r600: Delete vertex buffer only if there is actually a shader state
authorGert Wollny <gert.wollny@collabora.com>
Sat, 28 Dec 2019 16:17:02 +0000 (17:17 +0100)
committerGert Wollny <gw.fossdev@gmail.com>
Sat, 4 Jan 2020 16:22:40 +0000 (16:22 +0000)
Fixes: gl-2.0-vertexattribpointer
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Konstantin Kharlamov <hi-angel@yandex.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3286>

src/gallium/drivers/r600/r600_state_common.c

index fe17d10c201bfa55d3a96324a72329e69e37f93c..4718286bd2b81d8bcb55d21e781dad7a2b9ddf0d 100644 (file)
@@ -546,7 +546,8 @@ static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
 static void r600_delete_vertex_elements(struct pipe_context *ctx, void *state)
 {
        struct r600_fetch_shader *shader = (struct r600_fetch_shader*)state;
-       r600_resource_reference(&shader->buffer, NULL);
+       if (shader)
+               r600_resource_reference(&shader->buffer, NULL);
        FREE(shader);
 }