<div class="gmail_quote">On Mon, Aug 16, 2010 at 6:01 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; It seems like there is an alternate fix possible -- modify the mesa<br>
&gt; fixed-function vertex program generator to put these constant values in<br>
&gt; the constant buffer, rather than passing them as vertex data.  That<br>
&gt; would remove the need for us to have this unique capability at the<br>
&gt; gallium level that none of the other graphics abstractions seem to<br>
&gt; consider necessary.<br>
&gt;<br>
&gt; I think we&#39;re putting more effort into accommodating the behaviour of<br>
&gt; that code than really makes sense...<br>
<br>
</div>I&#39;m not totally sure about this.<br>
Right now drivers are supposed to support stride == 0, so this already<br>
works, but is not optimal for hardware where this causes repeated<br>
memory access.<br>
<br>
The change I&#39;m proposing makes it easier to implement this optimally<br>
on hardware that has some &quot;set constant vertex attribute&quot; command<br>
(e.g. all nVidia cards), since the path taken by each element becomes<br>
known at CSO creation time.<br>
<br>
A shader/constant-based solution would be necessary for optimal<br>
performance on hardware that does repeated fetches on stride == 0 and<br>
has no such command, but might be detrimental on hardware that either<br>
has a &quot;set constant&quot; command, or internally optimizes for stride == 0.<br>
<br>
Note that it is possible to have both solutions: if a cap bit is set,<br>
then constant elements would be used, and otherwise the state tracker<br>
will modify the shader.<br>
<br>
It would be interesting to know what would be optimal for r300 and r600.<br>
</blockquote></div><br>In r300g, we currently set the index clamping range to [0,1] if there is a vertex buffer with stride == 0, which is wrong but it silences the in-kernel CS checker. I haven&#39;t looked into this yet and have no info about it for r300.<br>

<br>Marek<br>