[Mesa-dev] [PATCH] glsl_to_tgsi: set correct register type for dereferenced array elements

Brian Paul brianp at vmware.com
Mon Oct 15 16:47:12 PDT 2012


On 10/15/2012 04:06 PM, Bryan Cain wrote:
> ---
>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 9146f24..caa7e94 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -633,6 +633,11 @@ glsl_to_tgsi_visitor::get_opcode(ir_instruction *ir, unsigned op,
>   {
>      int type = GLSL_TYPE_FLOAT;
>
> +   assert(src0.type != GLSL_TYPE_ARRAY);
> +   assert(src0.type != GLSL_TYPE_STRUCT);
> +   assert(src1.type != GLSL_TYPE_ARRAY);
> +   assert(src1.type != GLSL_TYPE_STRUCT);
> +
>      if (src0.type == GLSL_TYPE_FLOAT || src1.type == GLSL_TYPE_FLOAT)
>         type = GLSL_TYPE_FLOAT;
>      else if (native_integers)
> @@ -2042,6 +2047,9 @@ glsl_to_tgsi_visitor::visit(ir_dereference_array *ir)
>      else
>         src.swizzle = SWIZZLE_NOOP;
>
> +   /* Change the register type to the element type of the array. */
> +   src.type = ir->array->type->element_type()->base_type;
> +
>      this->result = src;
>   }
>

Thanks, but this causes a ton of piglit regressions (many crashes or 
failures on the new assertions).

-Brian



More information about the mesa-dev mailing list