[Mesa-dev] [PATCH] i965: Allocate just enough space for user clip planes in uniform arrays.

Eric Anholt eric at anholt.net
Mon Aug 26 13:37:34 PDT 2013


Kenneth Graunke <kenneth at whitecape.org> writes:

> Previously, we allocated space in brw_vs_prog_data's params and
> pull_params arrays for MAX_CLIP_PLANES vec4s---even when it wasn't
> necessary.
>
> On a 64-bit architecture, this used 0.5 kB of space (8 clip planes *
> 4 floats per plane * 8 bytes per float pointer * 2 arrays of pointers =
> 512 bytes).  Since this cost is per-vertex shader, it added up.
>
> Conveniently, we already store the number of clip plane constants in the
> program key.  By using that, we can allocate the exact amount of space
> needed.  For the common case where user clipping is disabled, this means
> 0 bytes.
>
> While we're here, mention exactly what code requires this extra space,
> since it wasn't obvious.

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130826/f9e025b5/attachment.pgp>


More information about the mesa-dev mailing list