Merged requested to merge mareko/mesa:gallium-dedup-shader-cso into master
Creating several shaders with the same IR will return the same CSO, reference-counted.
This happens a lot with games that convert D3D separate shaders to linked GLSL shaders, e.g. the same VS is used with many FS.
The assumed benefits are:
- fewer resident shaders (possibly fewer total shader variants on the driver side)
- fewer shader state changes in the driver if 2 GLSL programs bound back-to-back share shader CSOs
Using a Borderlands 2 apitrace, this is the efficiency with TGSI:
321 cache hit 524 cache miss
And with NIR:
291 cache hit 554 cache miss
I guess NIR is worse because the linker does more inter-shader optimizations.
radeonsi now has 3 levels of caching:
- live shader CSO deduplication
- in-memory shader cache
- disk shader cache