<div class="gmail_quote">On Wed, Aug 11, 2010 at 10:07 PM, Luca Barbieri <span dir="ltr">&lt;<a href="mailto:luca@luca-barbieri.com">luca@luca-barbieri.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im">&gt; Because all nvidia hardware seems to have the normalized bit as a property<br>
&gt; of a resource (PIPE_TEXTURE_RECT or a flag would be okay here), and all ATI<br>
&gt; hardware has the normalized bit as part of the texture instruction (it&#39;s a<br>
&gt; shader state, so a driver looks for TGSI_TEXTURE_RECT), I believe it would<br>
&gt; really be best for everyone to have this RECT texture target type and<br>
&gt; removing normalized_coords from pipe_sampler_state. Luca, you&#39;ve already<br>
&gt; done some work for this change. If you don&#39;t have time to finish<br>
&gt; PIPE_TEXTURE_RECT, I&#39;ll do that.<br>
<br>
</div>So no hardware at all supports specifying the normalization as part of<br>
the sampler state?<br>
<br>
One has to keep in mind OpenCL though, which has the following API:<br>
cl_sampler clCreateSampler (cl_context context,<br>
    cl_bool normalized_coords,<br>
    cl_addressing_mode addressing_mode,<br>
    cl_filter_mode filter_mode, cl_int *errcode_ret)<br>
<br>
If you put the bit in the resource itself, then it becomes impossible<br>
to change the normalization without copying the whole resource, which<br>
would seem to be a major problem for implementing OpenCL.<br>
<br>
A possible solution could be removing the bit from the sampler state<br>
and adding the bit to both TEX instructions and sampler views.<br>
This would seem to suit nv50, which has it in the hardware sampler<br>
view, and r300-r700 which has it in the hardware shader instruction<br>
(according to you).<br>
I&#39;m not sure if it is good enough for OpenCL (i.e. whether the OpenCL<br>
state tracker can statically determine the sampler&lt;-&gt;texture mapping),<br>
but I suppose it is, since it matches the hardware and the proprietary<br>
drivers manage to support OpenCL.<br>
<br>
A flag would need to be passed on resource creation anyway though,<br>
since nv30 needs to use different memory layouts.<br>
<br>
Also in this option, adding the resource hint and moving the bit out<br>
from the sampler state would be independent.<br>
</blockquote></div><br>ACK for your patch series from me. Getting rid of that normalized_coords bit in pipe_sampler_state would make implementing OpenCL really hard. I&#39;ll try to come up with a sane way to rewrite shaders for all ATI hardware. Masking out PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT in r600_texture_create should be enough to keep r600g in a working state.<br>

<br>-Marek<br>