On 12 December 2012 14:08, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>> writes:<br>
<br>
> This patch implements varying packing within varyings that are<br>
> composed of multiple vectors of size less than 4 (e.g. arrays of<br>
> vec2's, or matrices with height less than 4).<br>
><br>
> Previously, such varyings used up a full 4-wide varying slot for each<br>
> constituent vector, meaning that some of the components of each<br>
> varying slot went unused.  For example, a mat4x3 would be stored as<br>
> follows:<br>
<br>
</div><div class="im">> +   unsigned location = this->location;<br>
> +   unsigned location_frac = this->location_frac;<br>
> +   unsigned num_components = this->num_components();<br>
> +   while (num_components > 0) {<br>
> +      unsigned next_output_size = MIN2(num_components, 4 - location_frac);<br>
<br>
</div>I took a moment to confirm that next_output_size was the size for this<br>
iteration of the loop, not the next one.  Perhaps just output_size?<br></blockquote><div><br>Yeah, that makes sense.  Will do.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5"><br>
> +      assert(info->NumOutputs < max_outputs);<br>
> +      info->Outputs[info->NumOutputs].ComponentOffset = location_frac;<br>
> +      info->Outputs[info->NumOutputs].OutputRegister = location;<br>
> +      info->Outputs[info->NumOutputs].NumComponents = next_output_size;<br>
> +      info->Outputs[info->NumOutputs].OutputBuffer = buffer;<br>
> +      info->Outputs[info->NumOutputs].DstOffset = info->BufferStride[buffer];<br>
> +      ++info->NumOutputs;<br>
> +      info->BufferStride[buffer] += next_output_size;<br>
> +      num_components -= next_output_size;<br>
> +      location++;<br>
> +      location_frac = 0;<br>
>     }<br>
</div></div></blockquote></div><br></div>