[Mesa-dev] [PATCH 2/2] glsl: Eliminate unused built-in variables after compilation

Matt Turner mattst88 at gmail.com
Thu May 29 14:20:55 PDT 2014


On Wed, May 28, 2014 at 6:35 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> After compilation (and before linking) we can eliminate quite a few
> built-in variables.  Basically, any uniform or constant (e.g.,
> gl_MaxVertexTextureImageUnits) that isn't used (with one exception) can
> be eliminated.  System values, vertex shader inputs (with one
> exception), and fragment shader outputs that are not used and not
> re-declared in the shader text can also be removed.
>
> gl_ModelViewProjectMatrix and gl_Vertex are used by the built-in
> function ftransform.  There are some complications with eliminating
> these variables (see the comment in the patch), so they are not
> eliminated.
>
> Reduces the peak ir_variable memory usage in a trimmed apitrace of dota2
> by 3.5MB on 64-bit.

What was the total memory usage of ir_variable? It's been hard for me
to make sense of reductions without percentages.


More information about the mesa-dev mailing list