From: Luo Xionghu <[email protected]> use clCreateSamplerWithProperties introduced by opencl-2.0. the CL_SAMPLER_NORMALIZED_COORDS should be CL_FALSE for these cases.
Signed-off-by: Luo Xionghu <[email protected]> --- utests/compare_image_2d_and_1d_array.cpp | 7 ++++++- utests/compiler_copy_image.cpp | 8 +++++++- utests/compiler_copy_image1.cpp | 8 +++++++- utests/compiler_copy_image_1d.cpp | 8 +++++++- utests/compiler_copy_image_3d.cpp | 7 ++++++- utests/compiler_movforphi_undef.cpp | 7 ++++++- utests/image_1D_buffer.cpp | 7 ++++++- utests/utest_helper.hpp | 4 ++-- 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/utests/compare_image_2d_and_1d_array.cpp b/utests/compare_image_2d_and_1d_array.cpp index dfa4273..b66aa5e 100644 --- a/utests/compare_image_2d_and_1d_array.cpp +++ b/utests/compare_image_2d_and_1d_array.cpp @@ -49,7 +49,12 @@ static void compare_image_2d_and_1d_array(void) desc.image_row_pitch = w * sizeof(uint32_t); OCL_CREATE_IMAGE(buf[1], CL_MEM_COPY_HOST_PTR, &format, &desc, image_data2); - OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_LINEAR); + cl_sampler_properties properties[] = { + CL_SAMPLER_NORMALIZED_COORDS, CL_FALSE, + CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_REPEAT, + CL_SAMPLER_FILTER_MODE, CL_FILTER_LINEAR, + 0 }; + OCL_CREATE_SAMPLER_WITH_PROPERTIES(sampler, properties); // Setup kernel and images OCL_CREATE_KERNEL("compare_image_2d_and_1d_array"); diff --git a/utests/compiler_copy_image.cpp b/utests/compiler_copy_image.cpp index 150fd8a..2c58729 100644 --- a/utests/compiler_copy_image.cpp +++ b/utests/compiler_copy_image.cpp @@ -29,7 +29,13 @@ static void compiler_copy_image(void) desc.image_row_pitch = 0; OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); - OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); + + cl_sampler_properties properties[] = { + CL_SAMPLER_NORMALIZED_COORDS, false, + CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_REPEAT, + CL_SAMPLER_FILTER_MODE, CL_FILTER_NEAREST, + 0 }; + OCL_CREATE_SAMPLER_WITH_PROPERTIES(sampler, properties); free(buf_data[0]); buf_data[0] = NULL; diff --git a/utests/compiler_copy_image1.cpp b/utests/compiler_copy_image1.cpp index 659dddc..0b92d81 100644 --- a/utests/compiler_copy_image1.cpp +++ b/utests/compiler_copy_image1.cpp @@ -26,7 +26,13 @@ static void compiler_copy_image1(void) desc.image_height = h; desc.image_row_pitch = w * sizeof(uint32_t); OCL_CREATE_IMAGE(buf[0], CL_MEM_COPY_HOST_PTR, &format, &desc, buf_data[0]); - OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); + + cl_sampler_properties properties[] = { + CL_SAMPLER_NORMALIZED_COORDS, CL_FALSE, + CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_REPEAT, + CL_SAMPLER_FILTER_MODE, CL_FILTER_NEAREST, + 0 }; + OCL_CREATE_SAMPLER_WITH_PROPERTIES(sampler, properties); desc.image_row_pitch = 0; OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); diff --git a/utests/compiler_copy_image_1d.cpp b/utests/compiler_copy_image_1d.cpp index 5af6a77..2b81f87 100644 --- a/utests/compiler_copy_image_1d.cpp +++ b/utests/compiler_copy_image_1d.cpp @@ -26,7 +26,13 @@ static void compiler_copy_image_1d(void) desc.image_row_pitch = 0; OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); - OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); + + cl_sampler_properties properties[] = { + CL_SAMPLER_NORMALIZED_COORDS, CL_FALSE, + CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_REPEAT, + CL_SAMPLER_FILTER_MODE, CL_FILTER_NEAREST, + 0 }; + OCL_CREATE_SAMPLER_WITH_PROPERTIES(sampler, properties); free(buf_data[0]); buf_data[0] = NULL; diff --git a/utests/compiler_copy_image_3d.cpp b/utests/compiler_copy_image_3d.cpp index de7cd45..81bc6c6 100644 --- a/utests/compiler_copy_image_3d.cpp +++ b/utests/compiler_copy_image_3d.cpp @@ -40,7 +40,12 @@ static void compiler_copy_image_3d(void) for(uint32_t i = 0; i < depth; i++) OCL_CREATE_IMAGE(buf[2 + i], 0, &format, &desc, NULL); - OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); + cl_sampler_properties properties[] = { + CL_SAMPLER_NORMALIZED_COORDS, CL_FALSE, + CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_REPEAT, + CL_SAMPLER_FILTER_MODE, CL_FILTER_NEAREST, + 0 }; + OCL_CREATE_SAMPLER_WITH_PROPERTIES(sampler, properties); free(buf_data[0]); buf_data[0] = NULL; diff --git a/utests/compiler_movforphi_undef.cpp b/utests/compiler_movforphi_undef.cpp index 8f1e66e..5f4b9fc 100644 --- a/utests/compiler_movforphi_undef.cpp +++ b/utests/compiler_movforphi_undef.cpp @@ -27,7 +27,12 @@ static void compiler_movforphi_undef(void) desc.image_row_pitch = 0; OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); - OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); + cl_sampler_properties properties[] = { + CL_SAMPLER_NORMALIZED_COORDS, CL_FALSE, + CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_REPEAT, + CL_SAMPLER_FILTER_MODE, CL_FILTER_NEAREST, + 0 }; + OCL_CREATE_SAMPLER_WITH_PROPERTIES(sampler, properties); free(buf_data[0]); buf_data[0] = NULL; diff --git a/utests/image_1D_buffer.cpp b/utests/image_1D_buffer.cpp index d8d761f..1bcd2ef 100644 --- a/utests/image_1D_buffer.cpp +++ b/utests/image_1D_buffer.cpp @@ -49,7 +49,12 @@ void image_1D_buffer(void) OCL_ASSERT(error == CL_SUCCESS); // Create sampler to use - sampler = clCreateSampler(ctx, false, CL_ADDRESS_NONE, CL_FILTER_NEAREST, &error ); + cl_sampler_properties properties[] = { + CL_SAMPLER_NORMALIZED_COORDS, CL_FALSE, + CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_NONE, + CL_SAMPLER_FILTER_MODE, CL_FILTER_NEAREST, + 0 }; + OCL_CREATE_SAMPLER_WITH_PROPERTIES(sampler, properties); OCL_ASSERT(error == CL_SUCCESS); cl_mem result_buf = buf[0] = clCreateBuffer(ctx, 0, buffer_sz, NULL, &error); diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp index 6d09766..b7115e0 100644 --- a/utests/utest_helper.hpp +++ b/utests/utest_helper.hpp @@ -119,8 +119,8 @@ extern EGLSurface eglSurface; #define OCL_SWAP_EGL_BUFFERS() \ eglSwapBuffers(eglDisplay, eglSurface); -#define OCL_CREATE_SAMPLER(SAMPLER, ADDRESS_MODE, FILTER_MODE) \ - OCL_CALL2(clCreateSampler, SAMPLER, ctx, 0, ADDRESS_MODE, FILTER_MODE) +#define OCL_CREATE_SAMPLER_WITH_PROPERTIES(SAMPLER, PROPERTIES) \ + OCL_CALL2(clCreateSamplerWithProperties, SAMPLER, ctx, PROPERTIES) #define OCL_MAP_BUFFER(ID) \ OCL_CALL2(clMapBufferIntel, buf_data[ID], buf[ID]) -- 1.9.1 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
