zink: refcount zink_gfx_program objects
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Sat, 13 Jun 2020 19:53:29 +0000 (15:53 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 7 Aug 2020 12:36:58 +0000 (12:36 +0000)
commita03d17ede778610f2c66099d0d5342cf09ef12a2
tree6caf32e46fa694c86022634a71e42b0cba9da02c
parent8772c693c5a0b94be7fd891c278e504dabc0ee54
zink: refcount zink_gfx_program objects

now that we're tracking these by shader, we want to ensure that they live through
each render pass successfully if there's no flush regardless of the timing when the
shader objects are destroyed. this becomes useful when we split up shader create and compile
functionality in future patches, at which point program refcounts can be changed
during successive draw calls, potentially resulting in a program being destroyed at that
point when it shouldn't be

with this patch, each shader used by the program gets a reference, with the renderpass
batch itself becoming the owner of the program such that it will be deleted
when the draw state gets invalidated and a new program is created

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970>
src/gallium/drivers/zink/zink_batch.c
src/gallium/drivers/zink/zink_batch.h
src/gallium/drivers/zink/zink_compiler.c
src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_draw.c
src/gallium/drivers/zink/zink_program.c
src/gallium/drivers/zink/zink_program.h