instancing shaders is excessivly expensive
Brought to you by:
ltatkinson,
pgregory
Instancing shaders many times is much more expensive than it needs to be, both in memory and time.
The attached test case comes from the forum and contains about 80000 instances of the same shader with slightly different parameters. aqsis uses at least several hundred megabytes to read in the RIB (I killed it after that, though the original author claims that it causes aqsis to crash).
Looking at the code, the most obvious thing we're doing wrong is Clone()ing the entire shader program for each instance of the shader (see renderer.cpp:1188). At the least, we need a way to separate loaded shader programs from shader instances.
The attachment failed, but the original can be found here: http://www.scottkulp.com/ribtest.zip
Also see capsules.rib in the performance test suite; it suffers from much the same problem.