[Beignet] [PATCH] Correct sampler address clamping for read image functions.

Zhigang Gong zhigang.gong at linux.intel.com
Wed May 29 20:56:57 PDT 2013


Nice catch. pushed with the image blur test case. Thanks.

On Wed, May 29, 2013 at 11:49:40PM +0200, Dag Lem wrote:
> Integer coordinates were converted to unsigned integers, yielding
> incorrect clamping of negative coordinates.
> 
> Signed-off-by: Dag Lem <dag at nimrod.no>
> ---
>  backend/src/llvm/llvm_gen_backend.cpp | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
> index 0037af2..db7d714 100644
> --- a/backend/src/llvm/llvm_gen_backend.cpp
> +++ b/backend/src/llvm/llvm_gen_backend.cpp
> @@ -1907,14 +1907,15 @@ namespace gbe
>              const ir::Tuple dstTuple = ctx.arrayTuple(&dstTupleData[0], elemNum);
>              const ir::Tuple srcTuple = ctx.arrayTuple(&srcTupleData[0], 5);
>  
> -            ir::Type srcType = ir::TYPE_U32, dstType = ir::TYPE_U32;
> +            ir::Type srcType = ir::TYPE_S32, dstType = ir::TYPE_U32;
>  
>              switch(it->second) {
>                case GEN_OCL_READ_IMAGE0:
>                case GEN_OCL_READ_IMAGE2:
>                case GEN_OCL_READ_IMAGE10:
>                case GEN_OCL_READ_IMAGE12:
> -                srcType = dstType = ir::TYPE_U32;
> +                dstType = ir::TYPE_U32;
> +                srcType = ir::TYPE_S32;
>                  break;
>                case GEN_OCL_READ_IMAGE1:
>                case GEN_OCL_READ_IMAGE3:
> @@ -1926,7 +1927,7 @@ namespace gbe
>                case GEN_OCL_READ_IMAGE4:
>                case GEN_OCL_READ_IMAGE14:
>                  dstType = ir::TYPE_FLOAT;
> -                srcType = ir::TYPE_U32;
> +                srcType = ir::TYPE_S32;
>                  break;
>                case GEN_OCL_READ_IMAGE5:
>                case GEN_OCL_READ_IMAGE15:
> -- 
> 1.8.1.4
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list