broadcom/vc4: Fix use-after-free when deleting a program.
authorEric Anholt <eric@anholt.net>
Tue, 19 Sep 2017 00:47:44 +0000 (17:47 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 19 Sep 2017 03:17:25 +0000 (20:17 -0700)
commit3752ad28f23fc8136f75104b6ac4572341a05467
tree62595f8d3290cc587a336adc7dcd0f79a4a3e3c8
parentb339d63f0d0337df918c7aed471b90c02401bdb7
broadcom/vc4: Fix use-after-free when deleting a program.

By leaving the compiled shader in the context's stage state, the next
compile of a new FS would look in the old compiled FS for figuring out
whether to set various dirty flags for the VS compile.  Clear out the
pointer when deleting the program, and make sure that we always mark the
state as dirty if the previous program had been lost.  Fixes valgrind
warnings on glsl-max-varyings.

Fixes: 2350569a78c6 ("vc4: Avoid VS shader recompiles by keeping a set of FS inputs seen so far.")
src/gallium/drivers/vc4/vc4_program.c