- Home /
Too many shaders cost
With the release of shader graph in 2018.1 comes the threat that script kiddies could create 1 unique shader per material. In contrast they could have achieved same effect by using a separate texture. I want to ask if too many shaders carry a performance overhead.
Test case 1: Duplicate shader 1000 times (same code) but different instance in each material.
Test case 2: All materials use the same shader instance.
Assumption: Materials are not batched but use a separate material for each gameobject.
Hypothesis A: According to the docs, it carries a memory cost and a cost to initially load the shader but after that has no performance penalty.
Hypothesis B: Having 1000 different shaders is costly eg shader swtich cost and this cost depends on the #shaders used.
Question: So the question is which hypothesis holds true.
There's definitely some cost for state switching, loading shaders into GPU, and total inability of the engine to use any kind of batching or instancing. But my suggestion is that you do the benchmark and tell us the result :-P