summaryrefslogtreecommitdiff
path: root/utests/compare_image_2d_and_1d_array.cpp
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2014-10-27 15:34:11 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-10-28 10:14:46 +0800
commit6e451c195917b807988ef8f521b23594eef3e898 (patch)
treee3b96073ed24c394f7dc7c05d90e04c7fe6ae7b8 /utests/compare_image_2d_and_1d_array.cpp
parent70f4cd18f52d6b7ecd1e9bae3085d1ecd57bf113 (diff)
downloadbeignet-6e451c195917b807988ef8f521b23594eef3e898.tar.gz
Fix the compare_image_2d_and_1d_array test case bug
The test case use OCL_MAP_BUFFER_GTT to map the image buffers and then do the result comparison, which may cause problems. On IVB and HSW, the slice pitch is equal but on BDW, because we change the slice pitch of image array, it cause this bug. Modify it by using the standard clEnqueueReadImage API. Signed-off-by: Junyan He <junyan.he@linux.intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/compare_image_2d_and_1d_array.cpp')
-rw-r--r--utests/compare_image_2d_and_1d_array.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/utests/compare_image_2d_and_1d_array.cpp b/utests/compare_image_2d_and_1d_array.cpp
index f2c828ea..a2de5074 100644
--- a/utests/compare_image_2d_and_1d_array.cpp
+++ b/utests/compare_image_2d_and_1d_array.cpp
@@ -8,6 +8,10 @@ static void compare_image_2d_and_1d_array(void)
cl_image_format format;
cl_image_desc desc;
cl_sampler sampler;
+ uint32_t* dst0;
+ uint32_t* dst1;
+ size_t origin[3] = { };
+ size_t region[3];
// Create the 1D array buffer.
memset(&desc, 0x0, sizeof(cl_image_desc));
@@ -60,19 +64,26 @@ static void compare_image_2d_and_1d_array(void)
locals[1] = 16;
OCL_NDRANGE(2);
- OCL_MAP_BUFFER_GTT(0);
- OCL_MAP_BUFFER_GTT(1);
+ // Check result
+ region[0] = w;
+ region[1] = h;
+ region[2] = 1;
+ dst0 = (uint32_t*)malloc(w*h*sizeof(uint32_t));
+ dst1 = (uint32_t*)malloc(w*h*sizeof(uint32_t));
+ OCL_READ_IMAGE(buf[0], origin, region, dst0);
+ OCL_READ_IMAGE(buf[1], origin, region, dst1);
+
for (int j = 0; j < h; ++j) {
for (int i = 0; i < w; i++) {
// Because the array index will not join the sample caculation, the result should
// be different between the 2D and 1D_array.
if (j % 2 == 0)
- OCL_ASSERT(((uint32_t*)buf_data[0])[j * w + i] == ((uint32_t*)buf_data[1])[j * w + i]);
+ OCL_ASSERT(dst0[j * w + i] == dst1[j * w + i]);
}
}
- OCL_UNMAP_BUFFER_GTT(0);
- OCL_UNMAP_BUFFER_GTT(1);
+ free(dst0);
+ free(dst1);
OCL_CALL(clReleaseSampler, sampler);
}