On 18 October 2011 17:33, Eric Anholt <span dir="ltr">&lt;<a href="mailto:eric@anholt.net">eric@anholt.net</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
A driver trying to set up builtin uniforms is faced with a problem:<br>
How do I walk the ir_variable structure (representing an array of<br>
structs, or array of matrices, or struct, or whatever), and set up<br>
driver structures so that dereference of that uniform gets the<br>
corresponding ParameterValues[] entry.  The rule in general is that<br>
each corresponding vector-sized field of an array of structs is one<br>
builtin uniform state slot.  i965 relied on another invariant: each<br>
state slot has a number of unique channel swizzles corresponding to<br>
the number of elements in the field&#39;s vector, to avoid needing to walk<br>
the glsl_type in parallel to get at vector_elements.<br></blockquote><div><br>Since only the i965 driver relies on this invariant, it would be easy for a mesa core developer to mess this up in the future and not notice.  Can we add an assertion to ir_variable.cpp&#39;s add_uniform() function to verify the invariant?  That would also serve as a nice place to document why the invariant is necessary.<br>
<br>Either way, the patch is:<br><br>Reviewed-by: Paul Berry &lt;<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>&gt;<br></div></div>