Open CryZe opened 3 years ago
I think we should globally cache solid color shaders because there's likely to be a lot of them that are mostly identical. The other shaders all depend on width and height so tbey should probably belong to a local cache, but for the color shaders I see no harm in just having a lazy_static
lru cache somewhere with a reasonable size.
although checking again it appears the solid color shaders are also by far the least computationally expensive, to the point where caching it is probably not even worth it.
As it turns out, creating brushes is actually quite expensive with a lot of rendering backends. So we definitely want to only create them once and then just attach them to the individual entities.