[Mesa-dev] [PATCH 3/7] glsl: Add initial functions to implement an on-disk cache

Eero Tamminen eero.t.tamminen at intel.com
Thu Feb 5 01:02:19 PST 2015


On 02/05/2015 01:31 AM, Kenneth Graunke wrote:
> On Wednesday, February 04, 2015 01:52:57 PM Carl Worth wrote:
>> From: Kristian Høgsberg <krh at bitplanet.net>
>> This code provides for an on-disk cache of objects. Objects are stored
>> and retrieved (in ~/.cache/mesa) via names that are arbitrary 20-byte
>> sequences, (intended to be SHA-1 hashes of something identifying for
>> the content).
>> The cache is limited to a maximum number of entries (1024 in this
>> patch), and uses random replacement. These attributes are managed via
> The cache will need to be much larger than 1024 entries - perhaps by an
> order of magnitude.

Order of magnitude isn't enough, even for single application.  DOTA2 
alone can create >10000 shaders [1].

Games that do not use separate shader objects extension can have 
combinatorial explosion of concatenated shader code pieces...

> For example, "Shadowrun Returns" uses 1299 shaders,
> "Left 4 Dead 2" uses 1849 shaders, and "Natural Selection 2" uses 2719
> shaders.  A single application could overflow the cache :)
> For what it's worth, the total number of shaders in my game collection
> is around 17,000.

	- Eero

[1] At least 2013 version of DOTA2 did, depending on what options were 

Carl, my Apitrace trace "library" has such trace if you're interested.

More information about the mesa-dev mailing list