[Mesa-dev] [PATCH 15/25] i965: Add visitor support for handling image uniforms.

Paul Berry stereotype441 at gmail.com
Tue Dec 31 11:24:41 PST 2013


On 2 December 2013 11:39, Francisco Jerez <currojerez at riseup.net> wrote:

> +
> +void
> +backend_visitor::setup_image_uniform_values(const gl_uniform_storage
> *storage)
> +{
> +   const unsigned stage = _mesa_program_target_to_index(prog->Target);
> +
> +   for (unsigned i = 0; i < MAX2(storage->array_elements, 1); i++) {
> +      const unsigned image_idx = storage->image[stage].index + i;
> +      brw_image_param *param = &stage_prog_data->image_param[image_idx];
> +
> +      param->surface_idx =
> +         stage_prog_data->binding_table.image_start + image_idx;
> +
> +      setup_vector_uniform_values(&param->surface_idx, sizeof(uint32_t),
> 1);
> +      setup_vector_uniform_values(param->offset, sizeof(uint32_t), 2);
> +      setup_vector_uniform_values(param->size, sizeof(uint32_t), 3);
> +      setup_vector_uniform_values(param->stride, sizeof(uint32_t), 4);
> +      setup_vector_uniform_values(param->tiling, sizeof(uint32_t), 3);
> +      setup_vector_uniform_values(param->swizzling, sizeof(uint32_t), 2);
> +
> +      brw_mark_surface_used(stage_prog_data, param->surface_idx);
> +   }
> +}
>

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131231/3eaea63c/attachment.html>


More information about the mesa-dev mailing list