On 12 December 2012 12:44, Aras Pranckevicius <span dir="ltr"><<a href="mailto:aras@unity3d.com" target="_blank">aras@unity3d.com</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">
<br><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="gmail_quote"><div>Not sure if relevant for Mesa, but e.g. on PowerVR SGX it's really bad to pack two vec2 texture coordinates into a single vec4. That's because var.xy texture read can be "prefetched", whereas <a href="http://var.zw" target="_blank">var.zw</a> texture read is not prefetched (essentially treated as a dependent texture read), and often causes stalls in the shader execution.</div>


</div></blockquote><div><br></div></div><div>Interesting--I had not thought of that possibility.  On i965 all texture reads have to be done explicitly by the fragment shader (there is no prefetching IIRC), so this penalty doesn't apply.  Does anyone know if a penalty like this exists in any of Mesa's other back-ends?</div>

</div></div></blockquote><div><br></div></div><div>From what I know, it's only PowerVR SGX that is really <i>seriously </i>affected by this. On some other GPUs swizzled texture instructions cost an extra MOV and possibly count against dependent read limit - both not ideal, but not a big deal. On SGX, however, the swizzled texture loads cause texture prefetch to not happen at all, which usually stalls the shader for quite some time (SGX prefetches "regular" texture loads, but doesn't have good latency hiding for dependent or swizzled texture loads).</div>

</div><div><br></div>Anyway, if Mesa does not have (or is not planning to) have a backend for SGX, then probably not a big deal.</blockquote><div><br></div><div>Ok, thanks for the info.  Currently Mesa doesn't have an SGX backend, and I'm not aware of any plans to make one.  We can certainly make modifications to the varying packing algorithm if/when plans change.</div>
</div></div>