From 2b66910037b0c0e545eae3d8305cf955bd907742 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Dec 2020 16:09:13 -0800 Subject: [PATCH] gallium/draw: Fix intermittent failure to bind new geometry shaders. If you deleted your old GS and created a new one, then it would occasionally skip binding the new GS because the token pointers were equal. Clear the current token pointer in the machine when we're deleting its token. Cc: mesa-stable Reviewed-by: Dave Airlie Part-of: (cherry picked from commit 969f50ddcfcf88f641779942210f33519761a08f) --- .pick_status.json | 2 +- src/gallium/auxiliary/draw/draw_gs.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 118f51cb0f1..5a72c7d76ba 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1120,7 +1120,7 @@ "description": "gallium/draw: Fix intermittent failure to bind new geometry shaders.", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index 9f9983d8350..3e087b9c923 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -964,6 +964,9 @@ void draw_delete_geometry_shader(struct draw_context *draw, } #endif + if (draw->gs.tgsi.machine && draw->gs.tgsi.machine->Tokens == dgs->state.tokens) + draw->gs.tgsi.machine->Tokens = NULL; + for (i = 0; i < TGSI_MAX_VERTEX_STREAMS; i++) FREE(dgs->stream[i].primitive_lengths);