lima: introduce fs and vs shader cache

Graphics / Mesa 3D Graphics Library / Mesa - Erico Nunes [] - 16 January 2021 22:20 UTC

Some opengl features require shader recompilation to be implemented in the mali400 and can only be detected at draw time. In some applications, this could lead to recompiling shaders on every frame which could kill performance. Introduce a shader cache to prevent this issue. lima didn't have vertex shader recompilation yet but it is needed to implement followup features, so include it here too. Code heavily borrowed from the vc4 shader cache implementation.

One notable difference between the vc4 reference implementation and lima is that lima still compiles the base shader at state creation time without deferring it to the next draw (so that it stays compatible with behaviour expected by unmodified shader-db, for example).

7c885ad6c0e lima: introduce fs and vs shader cache
src/gallium/drivers/lima/ir/gp/nir.c | 6 +
src/gallium/drivers/lima/lima_context.c | 1 +
src/gallium/drivers/lima/lima_context.h | 31 ++-
src/gallium/drivers/lima/lima_draw.c | 7 +-
src/gallium/drivers/lima/lima_program.c | 330 +++++++++++++++++++++++--------
src/gallium/drivers/lima/lima_resource.c | 4 +-
6 files changed, 286 insertions(+), 93 deletions(-)


  • Share