| 199 | { CL_RGBA, CL_FLOAT } }; |
| 200 | |
| 201 | REGISTER_TEST(imagereadwrite3d) |
| 202 | { |
| 203 | constexpr size_t image_formats_count = ARRAY_SIZE(image_formats); |
| 204 | std::unique_ptr<unsigned char[]> rgba8_inptr, rgba8_outptr; |
| 205 | std::unique_ptr<unsigned short[]> rgba16_inptr, rgba16_outptr; |
| 206 | std::unique_ptr<float[]> rgbafp_inptr, rgbafp_outptr; |
| 207 | clMemWrapper streams[3]; |
| 208 | size_t img_width = 64; |
| 209 | size_t img_height = 64; |
| 210 | size_t img_depth = 32; |
| 211 | size_t img_slice = img_width * img_height; |
| 212 | int num_tries = 30; |
| 213 | int i, j, err; |
| 214 | MTdataHolder mtData(gRandomSeed); |
| 215 | |
| 216 | PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( device ) |
| 217 | |
| 218 | rgba8_inptr = |
| 219 | generate_rgba8_image(img_width, img_height, img_depth, mtData); |
| 220 | rgba16_inptr = |
| 221 | generate_rgba16_image(img_width, img_height, img_depth, mtData); |
| 222 | rgbafp_inptr = |
| 223 | generate_rgbafp_image(img_width, img_height, img_depth, mtData); |
| 224 | |
| 225 | rgba8_outptr.reset( |
| 226 | new unsigned char[4 * img_width * img_height * img_depth]); |
| 227 | rgba16_outptr.reset( |
| 228 | new unsigned short[4 * img_width * img_height * img_depth]); |
| 229 | rgbafp_outptr.reset(new float[4 * img_width * img_height * img_depth]); |
| 230 | |
| 231 | for (size_t index = 0; index < image_formats_count; ++index) |
| 232 | { |
| 233 | streams[index] = create_image_3d( |
| 234 | context, CL_MEM_READ_ONLY, &image_formats[index], img_width, |
| 235 | img_height, img_depth, 0, 0, nullptr, &err); |
| 236 | test_error(err, "create_image_3d failed"); |
| 237 | } |
| 238 | |
| 239 | for (i = 0; i < image_formats_count; i++) |
| 240 | { |
| 241 | void *p; |
| 242 | |
| 243 | if (i == 0) |
| 244 | p = rgba8_inptr.get(); |
| 245 | else if (i == 1) |
| 246 | p = rgba16_inptr.get(); |
| 247 | else |
| 248 | p = rgbafp_inptr.get(); |
| 249 | |
| 250 | size_t origin[3] = {0,0,0}, region[3] = {img_width, img_height, img_depth}; |
| 251 | err = clEnqueueWriteImage(queue, streams[i], CL_TRUE, |
| 252 | origin, region, 0, 0, |
| 253 | p, |
| 254 | 0, NULL, NULL); |
| 255 | test_error(err, "clEnqueueWriteImage failed"); |
| 256 | } |
| 257 | |
| 258 | for (i = 0, j = 0; i < num_tries * image_formats_count; i++, j++) |
nothing calls this directly
no test coverage detected