[Mesa-dev] [PATCH 09/10] glsl/linker: Pack within compound varyings.
Eric Anholt
eric at anholt.net
Wed Dec 12 14:08:23 PST 2012
Paul Berry <stereotype441 at gmail.com> writes:
> This patch implements varying packing within varyings that are
> composed of multiple vectors of size less than 4 (e.g. arrays of
> vec2's, or matrices with height less than 4).
>
> Previously, such varyings used up a full 4-wide varying slot for each
> constituent vector, meaning that some of the components of each
> varying slot went unused. For example, a mat4x3 would be stored as
> follows:
> + unsigned location = this->location;
> + unsigned location_frac = this->location_frac;
> + unsigned num_components = this->num_components();
> + while (num_components > 0) {
> + unsigned next_output_size = MIN2(num_components, 4 - location_frac);
I took a moment to confirm that next_output_size was the size for this
iteration of the loop, not the next one. Perhaps just output_size?
> + assert(info->NumOutputs < max_outputs);
> + info->Outputs[info->NumOutputs].ComponentOffset = location_frac;
> + info->Outputs[info->NumOutputs].OutputRegister = location;
> + info->Outputs[info->NumOutputs].NumComponents = next_output_size;
> + info->Outputs[info->NumOutputs].OutputBuffer = buffer;
> + info->Outputs[info->NumOutputs].DstOffset = info->BufferStride[buffer];
> + ++info->NumOutputs;
> + info->BufferStride[buffer] += next_output_size;
> + num_components -= next_output_size;
> + location++;
> + location_frac = 0;
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121212/3e48053a/attachment.pgp>
More information about the mesa-dev
mailing list