[Mesa-stable] [Mesa-dev] [PATCH] st/mesa: copy sampler_array_size field when copying instructions

Ilia Mirkin imirkin at alum.mit.edu
Mon Nov 17 13:58:03 PST 2014


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

Ooops, I thought I had caught all of that :(

On Mon, Nov 17, 2014 at 4:42 PM, Brian Paul <brianp at vmware.com> wrote:
> The sampler_array_size field was added by "mesa/st: add support for
> dynamic sampler offsets".  But the field wasn't getting copied in
> the get_pixel_transfer_visitor() or get_bitmap_visitor() functions.
>
> The count_resources() function then didn't properly compute the
> glsl_to_tgsi_visitor::samplers_used bitmask.  Then, we didn't declare
> all the sampler registers in st_translate_program().  Finally, we
> asserted when we tried to emit a tgsi ureg src register with File =
> TGSI_FILE_UNDEFINED.
>
> Add the missing assignments and some new assertions to catch the
> invalid register sooner.
>
> Cc: "10.3, 10.4" <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index c10ad75..8e91c4b 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -4022,6 +4022,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
>
>        newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]);
>        newinst->tex_target = inst->tex_target;
> +      newinst->sampler_array_size = inst->sampler_array_size;
>     }
>
>     /* Make modifications to fragment program info. */
> @@ -4101,6 +4102,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
>
>        newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]);
>        newinst->tex_target = inst->tex_target;
> +      newinst->sampler_array_size = inst->sampler_array_size;
>     }
>
>     /* Make modifications to fragment program info. */
> @@ -4524,8 +4526,10 @@ compile_tgsi_instruction(struct st_translate *t,
>                               inst->saturate,
>                               clamp_dst_color_output);
>
> -   for (i = 0; i < num_src; i++)
> +   for (i = 0; i < num_src; i++) {
> +      assert(inst->src[i].file != PROGRAM_UNDEFINED);
>        src[i] = translate_src(t, &inst->src[i]);
> +   }
>
>     switch(inst->op) {
>     case TGSI_OPCODE_BGNLOOP:
> @@ -4555,6 +4559,7 @@ compile_tgsi_instruction(struct st_translate *t,
>     case TGSI_OPCODE_TG4:
>     case TGSI_OPCODE_LODQ:
>        src[num_src] = t->samplers[inst->sampler.index];
> +      assert(src[num_src].File != TGSI_FILE_NULL);
>        if (inst->sampler.reladdr)
>           src[num_src] =
>              ureg_src_indirect(src[num_src], ureg_src(t->address[2]));
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list