radeonsi: don't create an infinite number of variants
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 30 Jul 2021 09:48:28 +0000 (11:48 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 9 Aug 2021 10:26:54 +0000 (10:26 +0000)
commit9fe8ae3fcde8d7608d5b03ace51a4a3cebf18fee
tree59b1b0fc59e7b54a7e83f0b8beaaa59aebe07966
parent20055a307df5aa579e4213c76f394ec77293ff31
radeonsi: don't create an infinite number of variants

If a shader has code like this:

   uniform float timestamp;
   ...
   if (timestamp > 0.0)
      do_something()

And timestamp is modified each frame, we'll end up generating a new
variant per frame.

This commit introduces a hard limit on the number of variants we generate
for a single shader.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5121
Fixes: b7501184b90 ("radeonsi: implement inlinable uniforms")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12138>
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state_shaders.c