From 6e451c195917b807988ef8f521b23594eef3e898 Mon Sep 17 00:00:00 2001 From: Junyan He Date: Mon, 27 Oct 2014 15:34:11 +0800 Subject: 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 Reviewed-by: Zhigang Gong --- utests/compare_image_2d_and_1d_array.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'utests/compare_image_2d_and_1d_array.cpp') 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); } -- cgit v1.2.1