summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2013-09-25 18:26:49 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-09-26 16:53:01 +0800
commitb835433189a3dca202e7fc7d9ff0bfbc49676281 (patch)
treed8b7e6ce5a04d392d477deeda2f396da9f431277 /CMakeLists.txt
parent7291cf314b55496f56eaddb6a4b0506bd1d6bfcb (diff)
downloadbeignet-b835433189a3dca202e7fc7d9ff0bfbc49676281.tar.gz
GBE/Runtime: implement workaround for IVB sampler bug
Per IVB spec, If the surface format of the associated surface is UINT or SINT, the Surface Type cannot be SURFTYPE_3D or SURFTYPE_CUBE and Address Control Mode cannot be CLAMP_BORDER or HALF_BORDER. Besides this bug, there is another undocumented issue. If a surface data type is IEEE float. Then when we use sampler to sample the pixel, if the value is betweeo -1p-20 to 0, the sampler will rounding it to zero. And this will also bring problem when we are using the clamp mode. This patch is to workaround the above two hardware issues. It introduces a new intrinsic get_sampler_info to get a sampler type at runtime. When calling to read_image, it will check whether it hits the above two cases. If it hit case 1, then we will force it to use clamp to edge for those pixels within the box, And for those pixel out of the box, we manually set the border color. To achieve this solution, we have to prepare two sampler slot for each CL_ADDRESS_CLAMP sampler. And the first has slot_1 which is using CL_ADDRESS_CLAMP, the second use slot_1 + 8. Thus we can only use half of 16 samplers. Fortunately, 8 samplers comply with the OpenCL's minimal requirement. If it hits case 2, then we minor a epsilon to the coordinate, and let it not rounds to zero. If possible, programer should avoid to use float coordinates and/or int/uint format image. Otherwise, it will hit the very slow path. With this workaround, the compiler_copy_image1 can pass now. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09e910cf..3d18f500 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,9 @@ ELSE (EMULATE_IVB)
ADD_DEFINITIONS(-DEMULATE_GEN=0)
ENDIF (EMULATE_HSW)
+# XXX now hard coded to enable the clamp to border workaround for IVB.
+ADD_DEFINITIONS(-DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND)
+
IF (USE_FULSIM)
ADD_DEFINITIONS(-DUSE_FULSIM=1)
ELSE (USE_FULSIM)