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

Dag Lem dag at nimrod.no
Wed May 29 14:49:40 PDT 2013


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



More information about the Beignet mailing list