[Mesa-dev] [PATCH 04/21] glsl: Use a single bit for the dual-source blend index

Tapani Pälli tapani.palli at intel.com
Fri May 30 01:27:29 PDT 2014


On 05/28/2014 05:48 AM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> The only values allowed are 0 and 1, and the value is checked before
> assigning.
>
> With the previous changes, reduces the peak ir_variable memory usage in
> a trimmed apitrace of dota2 by 204KiB on 64-bit.
>
> Before: IR MEM: variable usage / name / total: 6374280 1439077 7813357
> After:  IR MEM: variable usage / name / total: 6164976 1439077 7604053
>
> Reduces the peak ir_variable memory usage in a trimmed apitrace of dota2
> by 102KiB on 32-bit.
>
> Before: IR MEM: variable usage / name / total: 4850844 915817 5766661
> After:  IR MEM: variable usage / name / total: 4746192 915817 5662009
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/glsl/ir.h | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
> index 93d5aef..3767f2a 100644
> --- a/src/glsl/ir.h
> +++ b/src/glsl/ir.h
> @@ -651,6 +651,15 @@ public:
>        unsigned from_named_ifc_block_array:1;
>  
>        /**
> +       * Output index for dual source blending.
> +       *
> +       * \note
> +       * The GLSL spec only allows the values 0 or 1 for the index in \b dual
> +       * source blending.

Nitpick, this could reference the actual specification text. Maybe GLSL
3.30 spec ("output layout qualifiers") or GL spec
("BindFragDataLocationIndexed") or both. I did not find it first using
4.40 one but 3.30 one does have this said clearly.



> +       */
> +      unsigned index:1;
> +
> +      /**
>         * \brief Layout qualifier for gl_FragDepth.
>         *
>         * This is not equal to \c ir_depth_layout_none if and only if this
> @@ -679,11 +688,6 @@ public:
>        int location;
>  
>        /**
> -       * output index for dual source blending.
> -       */
> -      int index;
> -
> -      /**
>         * Initial binding point for a sampler, atomic, or UBO.
>         *
>         * For array types, this represents the binding point for the first element.



More information about the mesa-dev mailing list