[Mesa-dev] [PATCH 09/10] glsl/linker: Pack within compound varyings.

Paul Berry stereotype441 at gmail.com
Wed Dec 12 14:16:11 PST 2012


On 12 December 2012 14:08, Eric Anholt <eric at anholt.net> wrote:

> 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?
>

Yeah, that makes sense.  Will do.


>
> > +      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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121212/a3706983/attachment.html>


More information about the mesa-dev mailing list