[Mesa-dev] [PATCH 2/2] glsl: Eliminate unused built-in variables after compilation
Matt Turner
mattst88 at gmail.com
Thu May 29 14:31:14 PDT 2014
On Thu, May 29, 2014 at 2:26 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 05/29/2014 02:20 PM, Matt Turner wrote:
>> 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.
>
> Before: IR MEM: variable usage / name / total: 4118280 644100 4762380
> After: IR MEM: variable usage / name / total: 1473408 256871 1730279
>
> Before the change, the ir_memory_usage visitor added up 4762380 bytes of
> memory allocated for ir_variable, ir_variable::name, and
> ir_variable::state_slots. After the change it added up 1730279 bytes.
> So... 63.7% reduction?
>
Oh, duh. Thanks.
More information about the mesa-dev
mailing list