diff options
Diffstat (limited to 'utests')
-rw-r--r-- | utests/compiler_box_blur_image.cpp | 11 | ||||
-rw-r--r-- | utests/compiler_copy_image.cpp | 10 | ||||
-rw-r--r-- | utests/compiler_copy_image1.cpp | 18 | ||||
-rw-r--r-- | utests/compiler_copy_image_3d.cpp | 11 | ||||
-rw-r--r-- | utests/compiler_fill_gl_image.cpp | 2 | ||||
-rw-r--r-- | utests/compiler_fill_image.cpp | 7 | ||||
-rw-r--r-- | utests/compiler_fill_image0.cpp | 7 | ||||
-rw-r--r-- | utests/compiler_fill_image_3d.cpp | 9 | ||||
-rw-r--r-- | utests/compiler_fill_image_3d_2.cpp | 9 | ||||
-rw-r--r-- | utests/compiler_get_image_info.cpp | 12 | ||||
-rw-r--r-- | utests/compiler_movforphi_undef.cpp | 10 | ||||
-rw-r--r-- | utests/utest_helper.hpp | 12 |
12 files changed, 32 insertions, 86 deletions
diff --git a/utests/compiler_box_blur_image.cpp b/utests/compiler_box_blur_image.cpp index d94a97c9..351f08e3 100644 --- a/utests/compiler_box_blur_image.cpp +++ b/utests/compiler_box_blur_image.cpp @@ -4,7 +4,6 @@ static void compiler_box_blur_image() { int w, h; cl_image_format format = { }; - cl_image_desc desc = { }; size_t origin[3] = { }; size_t region[3]; int *src, *dst; @@ -16,17 +15,11 @@ static void compiler_box_blur_image() format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNORM_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = w; - desc.image_height = h; - desc.image_depth = 1; - desc.image_row_pitch = w*sizeof(uint32_t); /* Run the kernel */ - OCL_CREATE_IMAGE(buf[0], CL_MEM_COPY_HOST_PTR, &format, &desc, src); + OCL_CREATE_IMAGE2D(buf[0], CL_MEM_COPY_HOST_PTR, &format, w, h, w*sizeof(uint32_t), src); free(src); - desc.image_row_pitch = 0; - OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE2D(buf[1], 0, &format, w, h, 0, NULL); OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]); globals[0] = w; diff --git a/utests/compiler_copy_image.cpp b/utests/compiler_copy_image.cpp index 04c95444..58827f29 100644 --- a/utests/compiler_copy_image.cpp +++ b/utests/compiler_copy_image.cpp @@ -5,7 +5,6 @@ static void compiler_copy_image(void) const size_t w = 512; const size_t h = 512; cl_image_format format; - cl_image_desc desc; cl_sampler sampler; // Setup kernel and images @@ -17,14 +16,9 @@ static void compiler_copy_image(void) format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = w; - 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_IMAGE2D(buf[0], CL_MEM_COPY_HOST_PTR, &format, w, h, w * sizeof(uint32_t), buf_data[0]); - desc.image_row_pitch = 0; - OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE2D(buf[1], 0, &format, w, h, 0, NULL); OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); free(buf_data[0]); buf_data[0] = NULL; diff --git a/utests/compiler_copy_image1.cpp b/utests/compiler_copy_image1.cpp index a9ef3f4b..d469fbda 100644 --- a/utests/compiler_copy_image1.cpp +++ b/utests/compiler_copy_image1.cpp @@ -5,7 +5,6 @@ static void compiler_copy_image1(void) const size_t w = 512; const size_t h = 512; cl_image_format format; - cl_image_desc desc; cl_sampler sampler; // Setup kernel and images @@ -17,19 +16,14 @@ static void compiler_copy_image1(void) format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = w; - 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_IMAGE2D(buf[0], CL_MEM_COPY_HOST_PTR, &format, w, h, w * sizeof(uint32_t), buf_data[0]); OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); - desc.image_row_pitch = 0; - OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); - OCL_CREATE_IMAGE(buf[2], 0, &format, &desc, NULL); - OCL_CREATE_IMAGE(buf[3], 0, &format, &desc, NULL); - OCL_CREATE_IMAGE(buf[4], 0, &format, &desc, NULL); - OCL_CREATE_IMAGE(buf[5], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE2D(buf[1], 0, &format, w, h, 0, NULL); + OCL_CREATE_IMAGE2D(buf[2], 0, &format, w, h, 0, NULL); + OCL_CREATE_IMAGE2D(buf[3], 0, &format, w, h, 0, NULL); + OCL_CREATE_IMAGE2D(buf[4], 0, &format, w, h, 0, NULL); + OCL_CREATE_IMAGE2D(buf[5], 0, &format, w, h, 0, NULL); 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 9816fe4a..5290090b 100644 --- a/utests/compiler_copy_image_3d.cpp +++ b/utests/compiler_copy_image_3d.cpp @@ -6,7 +6,6 @@ static void compiler_copy_image_3d(void) const size_t h = 512; const size_t depth = 1; cl_image_format format; - cl_image_desc desc; cl_sampler sampler; // Setup kernel and images @@ -19,14 +18,8 @@ static void compiler_copy_image_3d(void) format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE3D; - desc.image_width = w; - desc.image_height = h; - desc.image_depth = depth; - desc.image_row_pitch = 0; - desc.image_slice_pitch = 0; - OCL_CREATE_IMAGE(buf[0], CL_MEM_COPY_HOST_PTR, &format, &desc, buf_data[0]); - OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE3D(buf[0], CL_MEM_COPY_HOST_PTR, &format, w, h, depth, 0, 0, buf_data[0]); + OCL_CREATE_IMAGE3D(buf[1], 0, &format, w, h, depth, 0, 0, NULL); OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); free(buf_data[0]); buf_data[0] = NULL; diff --git a/utests/compiler_fill_gl_image.cpp b/utests/compiler_fill_gl_image.cpp index 166621ac..b070b8f8 100644 --- a/utests/compiler_fill_gl_image.cpp +++ b/utests/compiler_fill_gl_image.cpp @@ -42,7 +42,7 @@ static void compiler_fill_gl_image(void) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, NULL); OCL_CREATE_KERNEL("test_fill_gl_image"); - OCL_CREATE_GL_IMAGE(buf[0], 0, GL_TEXTURE_2D, 0, tex); + OCL_CREATE_GL_IMAGE2D(buf[0], 0, GL_TEXTURE_2D, 0, tex); // Run the kernel OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); diff --git a/utests/compiler_fill_image.cpp b/utests/compiler_fill_image.cpp index c9242b25..2f9fe3d9 100644 --- a/utests/compiler_fill_image.cpp +++ b/utests/compiler_fill_image.cpp @@ -6,19 +6,14 @@ static void compiler_fill_image(void) const size_t h = 512; uint32_t color = 0x12345678; cl_image_format format; - cl_image_desc desc; format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = w; - desc.image_height = h; - desc.image_row_pitch = 0; // Setup kernel and images OCL_CREATE_KERNEL("test_fill_image"); - OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE2D(buf[0], 0, &format, w, h, 0, NULL); // Run the kernel OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); diff --git a/utests/compiler_fill_image0.cpp b/utests/compiler_fill_image0.cpp index 7c8f40e8..1ab13be6 100644 --- a/utests/compiler_fill_image0.cpp +++ b/utests/compiler_fill_image0.cpp @@ -5,19 +5,14 @@ static void compiler_fill_image0(void) const size_t w = 512; const size_t h = 512; cl_image_format format; - cl_image_desc desc; format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = w; - desc.image_height = h; - desc.image_row_pitch = 0; // Setup kernel and images OCL_CREATE_KERNEL("test_fill_image0"); - OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE2D(buf[0], 0, &format, w, h, 0, NULL); // Run the kernel OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); diff --git a/utests/compiler_fill_image_3d.cpp b/utests/compiler_fill_image_3d.cpp index 5d98b0bd..4b3d4e3f 100644 --- a/utests/compiler_fill_image_3d.cpp +++ b/utests/compiler_fill_image_3d.cpp @@ -7,21 +7,14 @@ static void compiler_fill_image_3d(void) const size_t depth = 1; uint32_t color = 0x12345678; cl_image_format format; - cl_image_desc desc; format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE3D; - desc.image_width = w; - desc.image_height = h; - desc.image_depth = depth; - desc.image_row_pitch = 0; - desc.image_slice_pitch = 0; // Setup kernel and images OCL_CREATE_KERNEL("test_fill_image_3d"); - OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE3D(buf[0], 0, &format, w, h, depth, 0, 0, NULL); // Run the kernel OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); diff --git a/utests/compiler_fill_image_3d_2.cpp b/utests/compiler_fill_image_3d_2.cpp index 3b4edb98..8ecc3e31 100644 --- a/utests/compiler_fill_image_3d_2.cpp +++ b/utests/compiler_fill_image_3d_2.cpp @@ -6,21 +6,14 @@ static void compiler_fill_image_3d_2(void) const size_t h = 512; const size_t depth = 1; cl_image_format format; - cl_image_desc desc; format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE3D; - desc.image_width = w; - desc.image_height = h; - desc.image_depth = depth; - desc.image_row_pitch = 0; - desc.image_slice_pitch = 0; // Setup kernel and images OCL_CREATE_KERNEL("test_fill_image_3d_2"); - OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE3D(buf[0], 0, &format, w, h, depth, 0, 0, NULL); // Run the kernel OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); diff --git a/utests/compiler_get_image_info.cpp b/utests/compiler_get_image_info.cpp index 3b9d132e..4454d031 100644 --- a/utests/compiler_get_image_info.cpp +++ b/utests/compiler_get_image_info.cpp @@ -6,24 +6,14 @@ static void compiler_get_image_info(void) const size_t h = 512; const size_t depth = 3; cl_image_format format; - cl_image_desc desc; format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE3D; - desc.image_width = w; - desc.image_height = h; - desc.image_depth = depth; - desc.image_row_pitch = 0; - desc.image_slice_pitch = 0; - desc.num_mip_levels = 0; - desc.num_samples = 0; - desc.buffer = NULL; // Setup kernel and images OCL_CREATE_KERNEL("test_get_image_info"); - OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE3D(buf[0], 0, &format, w, h, depth, 0, 0, NULL); OCL_CREATE_BUFFER(buf[1], 0, 32 * sizeof(int), NULL); OCL_CREATE_BUFFER(buf[2], 0, 32 * sizeof(int), NULL); diff --git a/utests/compiler_movforphi_undef.cpp b/utests/compiler_movforphi_undef.cpp index 17bde8cf..50526e8e 100644 --- a/utests/compiler_movforphi_undef.cpp +++ b/utests/compiler_movforphi_undef.cpp @@ -6,7 +6,6 @@ static void compiler_movforphi_undef(void) const size_t h = 16; cl_sampler sampler; cl_image_format format; - cl_image_desc desc; // Setup kernel and images OCL_CREATE_KERNEL("test_movforphi_undef"); @@ -17,14 +16,9 @@ static void compiler_movforphi_undef(void) format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = w; - 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_IMAGE2D(buf[0], CL_MEM_COPY_HOST_PTR, &format, w, h, w * sizeof(uint32_t), buf_data[0]); - desc.image_row_pitch = 0; - OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL); + OCL_CREATE_IMAGE2D(buf[1], 0, &format, w, h, 0, NULL); OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST); free(buf_data[0]); buf_data[0] = NULL; diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp index dd98a1fd..d6423514 100644 --- a/utests/utest_helper.hpp +++ b/utests/utest_helper.hpp @@ -93,6 +93,12 @@ extern EGLSurface eglSurface; #define OCL_CREATE_IMAGE(IMAGE, FLAGS, FORMAT, DESC, DATA) \ OCL_CALL2(clCreateImage, IMAGE, ctx, FLAGS, FORMAT, DESC, DATA) +#define OCL_CREATE_IMAGE2D(IMAGE, FLAGS, FORMAT, WIDTH, HEIGHT, PITCH, DATA) \ + OCL_CALL2(clCreateImage2D, IMAGE, ctx, FLAGS, FORMAT, WIDTH, HEIGHT, PITCH, DATA) + +#define OCL_CREATE_IMAGE3D(IMAGE, FLAGS, FORMAT, WIDTH, HEIGHT, DEPTH, RPITCH, SPITCH, DATA) \ + OCL_CALL2(clCreateImage3D, IMAGE, ctx, FLAGS, FORMAT, WIDTH, HEIGHT, DEPTH, RPITCH, SPITCH, DATA) + #define OCL_READ_IMAGE(IMAGE, ORIGIN, REGION, DATA) \ OCL_CALL(clEnqueueReadImage, queue, IMAGE, CL_TRUE, ORIGIN, REGION, 0, 0, DATA, 0, NULL, NULL) @@ -102,6 +108,12 @@ extern EGLSurface eglSurface; #define OCL_CREATE_GL_IMAGE(IMAGE, FLAGS, TARGET, LEVEL, TEXTURE) \ OCL_CALL2(clCreateFromGLTexture, IMAGE, ctx, FLAGS, TARGET, LEVEL, TEXTURE) +#define OCL_CREATE_GL_IMAGE2D(IMAGE, FLAGS, TARGET, LEVEL, TEXTURE) \ + OCL_CALL2(clCreateFromGLTexture2D, IMAGE, ctx, FLAGS, TARGET, LEVEL, TEXTURE) + +#define OCL_CREATE_GL_IMAGE3D(IMAGE, FLAGS, TARGET, LEVEL, TEXTURE) \ + OCL_CALL2(clCreateFromGLTexture3D, IMAGE, ctx, FLAGS, TARGET, LEVEL, TEXTURE) + #define OCL_ENQUEUE_ACQUIRE_GL_OBJECTS(ID) \ OCL_CALL(clEnqueueAcquireGLObjects, queue, 1, &buf[ID], 0, 0, 0) |