Ian Romanick <i...@freedesktop.org> writes: > On 05/28/2014 01:57 PM, Eric Anholt wrote: >> If the shader compiled once, then we can compile it again. Compiled >> shaders almost always get used in just one program, so holding that >> compiled IR until the program is freed is just a waste of memory. > > Would this work with some madness like: > > glAttachShader(prog, sh1); > glAttachShader(prog, sh2); > glLinkProgram(prog); > > GLchar *empty = ""; > glShaderSource(sh1, 1, &empty, NULL);
When we get the shadersource call here on a previously linked-and-freed shader, the lazy recompile call present in shadersource ensures that we have the right IR. > glBindAttribLocation(prog, 0, "foo"); > glLinkProgram(prog); > There are some things like this that I think would work very nicely with > glCreateShaderProgramv, but it may be difficult to get all the corner > cases right otherwise. > >> On the other hand, if they are either reusing shader objects to compile >> multiple times, or linking the same shader into multiple programs, we turn >> off this memory savings hack to avoid spending CPU on recompiling. >> >> Reduces peak memory allocation of glretrace of a trace of dolphin-emu by >> 5.5MB. It seems like this should be a big deal to DOTA2, but it was >> triggering RecompiledAnyShader, and I failed to see a benefit even if I >> removed the RecompiledAnyShader check (which confuses me). > > I think they use the same vertex shader with multiple fragment > shaders... but it does seem weird that disabling the check didn't change > the memory usage. Did it change anything (bad rendering)? Not that I noticed, not that I was paying close attention when it took so long to run.
pgppc9J_JznQI.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev