MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / copy_image_size

Function copy_image_size

test_conformance/profiling/copy.cpp:429–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427
428
429static int copy_image_size( cl_device_id device, cl_context context,
430 cl_command_queue queue, size_t srcx, size_t srcy,
431 size_t dstx, size_t dsty, size_t subw, size_t subh,
432 MTdata d )
433{
434 cl_mem memobjs[3];
435 cl_program program[1];
436 cl_image_format image_format_desc = { CL_RGBA, CL_UNORM_INT8 };
437 cl_event copyEvent;
438 cl_ulong queueStart, submitStart, writeStart, writeEnd;
439 void *inptr;
440 void *dst = NULL;
441 cl_kernel kernel[1];
442 size_t threads[2];
443 int err = 0;
444 cl_mem_flags flags;
445 unsigned int num_channels = 4;
446 size_t w = 256, h = 256;
447 size_t element_nbytes;
448 size_t num_bytes;
449 size_t channel_nbytes = sizeof( cl_char );
450
451
452 PASSIVE_REQUIRE_IMAGE_SUPPORT( device )
453
454 element_nbytes = channel_nbytes * num_channels;
455 num_bytes = w * h * element_nbytes;
456
457 threads[0] = (size_t)w;
458 threads[1] = (size_t)h;
459
460 inptr = (void *)generate_image( (int)num_bytes, d );
461 if( ! inptr ){
462 log_error("unable to allocate inptr at %d x %d\n", (int)w, (int)h );
463 return -1;
464 }
465
466 dst = malloc( num_bytes );
467 if( ! dst ){
468 free( (void *)inptr );
469 log_error("unable to allocate dst at %d x %d\n", (int)w, (int)h );
470 return -1;
471 }
472
473 // allocate the input image
474 flags = CL_MEM_READ_WRITE;
475 memobjs[0] = create_image_2d(context, flags, &image_format_desc, w, h, 0, NULL, &err);
476 if( memobjs[0] == (cl_mem)0 ) {
477 free( dst );
478 free( (void *)inptr );
479 log_error("unable to create Image2D\n");
480 return -1;
481 }
482
483 memobjs[1] =
484 clCreateBuffer(context, CL_MEM_READ_WRITE, num_bytes, NULL, &err);
485 if( memobjs[1] == (cl_mem)0 ) {
486 clReleaseMemObject(memobjs[0]);

Callers 1

REGISTER_TESTFunction · 0.85

Calls 5

generate_imageFunction · 0.85
create_image_2dFunction · 0.85
verify_subimageFunction · 0.85
check_timesFunction · 0.85

Tested by

no test coverage detected