zink: track program usages for each shader
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 3 Jun 2020 13:38:57 +0000 (09:38 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 9 Jun 2020 20:30:25 +0000 (20:30 +0000)
commitad8e61621bd0b79d6bed2485e5483c7fb7690e1f
treef8797e1a87000ac56892d18bdafd3ee133263028
parent48925f6927e0623afaa43e98ee94e876a909d3db
zink: track program usages for each shader

when shaders are created and destroyed in large numbers, the same pointers
get reused for different shaders, which can lead to bad lookups in the
program_cache hash table.

now each shader tracks its program usage to automatically remove itself from
that program in order to avoid hash collisions

fixes mesa/mesa#3053

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