[Mesa-dev] [PATCH 6/9] gallivm: enable stores of integer types. (v2)

Brian Paul brianp at vmware.com
Wed Feb 8 07:27:12 PST 2012


On 02/08/2012 05:17 AM, Dave Airlie wrote:
> From: Dave Airlie<airlied at redhat.com>
>
> Infer from the operand the type of value to store.
> MOV is untyped but we use the float store path.
>
> v2: make MOV use float store path.
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
> ---
>   src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   47 +++++++++++++++++++++--
>   1 files changed, 43 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 920fed2..e3f9463 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -855,7 +855,6 @@ emit_fetch_predicate(
>      }
>   }
>
> -
>   /**
>    * Register store.
>    */
> @@ -875,8 +874,26 @@ emit_store_chan(
>      struct lp_build_context *uint_bld =&bld_base->uint_bld;
>      LLVMValueRef indirect_index = NULL;
>      struct lp_build_context *bld_store;
> +   enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode);
>
> -   bld_store =&bld->bld_base.base;
> +   switch (dtype) {
> +   default:
> +   case TGSI_TYPE_FLOAT:
> +   case TGSI_TYPE_UNTYPED:
> +      bld_store =&bld_base->base;
> +      break;
> +   case TGSI_TYPE_UNSIGNED:
> +      bld_store =&bld_base->uint_bld;
> +      break;
> +   case TGSI_TYPE_SIGNED:
> +      bld_store =&bld_base->int_bld;
> +      break;
> +   case TGSI_TYPE_DOUBLE:
> +   case TGSI_TYPE_VOID:
> +      assert(0);

Minor nit: let's try to avoid generic assert(0) macros.  Use something 
like assert(!"unexpected TGSI_TYPE in emit_store_chan()") at least.

BTW, theses patches look OK to me on the surface but you might want to 
wait for Jose's review too.

-Brian


More information about the mesa-dev mailing list