Paul Berry <stereotype...@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;
>     }

Attachment: pgpE6q0jehb0z.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to