<div dir="ltr">On 2 December 2013 11:39, Francisco Jerez <span dir="ltr"><<a href="mailto:currojerez@riseup.net" target="_blank">currojerez@riseup.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">+<br>
+void<br>
+backend_visitor::setup_image_uniform_values(const gl_uniform_storage *storage)<br>
+{<br>
+   const unsigned stage = _mesa_program_target_to_index(prog->Target);<br>
+<br>
+   for (unsigned i = 0; i < MAX2(storage->array_elements, 1); i++) {<br>
+      const unsigned image_idx = storage->image[stage].index + i;<br>
+      brw_image_param *param = &stage_prog_data->image_param[image_idx];<br>
+<br>
+      param->surface_idx =<br>
+         stage_prog_data->binding_table.image_start + image_idx;<br>
+<br>
+      setup_vector_uniform_values(&param->surface_idx, sizeof(uint32_t), 1);<br>
+      setup_vector_uniform_values(param->offset, sizeof(uint32_t), 2);<br>
+      setup_vector_uniform_values(param->size, sizeof(uint32_t), 3);<br>
+      setup_vector_uniform_values(param->stride, sizeof(uint32_t), 4);<br>
+      setup_vector_uniform_values(param->tiling, sizeof(uint32_t), 3);<br>
+      setup_vector_uniform_values(param->swizzling, sizeof(uint32_t), 2);<br>
+<br>
+      brw_mark_surface_used(stage_prog_data, param->surface_idx);<br>
+   }<br>
+}<br></blockquote><div><br></div><div>One additional thought:  I'm concerned about the fact that the correctness of the code depends on the BRW_IMAGE_PARAM_* defines matching the order in which we call setup_vector_uniform_values() here.  How difficult would it be to add some assertions to this codepath to make sure that the defines properly match the order in which the uniforms get emitted?<br>
</div></div></div></div>