diff --git a/test_conformance/api/test_api_min_max.cpp b/test_conformance/api/test_api_min_max.cpp index fd8c3ee50e..ad4ee6f333 100644 --- a/test_conformance/api/test_api_min_max.cpp +++ b/test_conformance/api/test_api_min_max.cpp @@ -786,19 +786,31 @@ REGISTER_TEST(min_max_image_3d_width) { int error; size_t maxDimension; - clMemWrapper streams[1]; - cl_image_format image_format_desc; + clMemWrapper streams; + cl_image_format imageFormatDesc; cl_ulong maxAllocSize; + if (checkFor3DImageSupport(device)) + { + /* Get the max 3d image width */ + error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_WIDTH, + sizeof(maxDimension), &maxDimension, NULL); + test_error(error, "Unable to get max image 3d width from device"); - PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(device) + test_failure_error_ret(maxDimension, 0, + "Missing 3d image support but " + "CL_DEVICE_IMAGE3D_MAX_WIDTH query did " + "not return 0", + TEST_FAIL); + return TEST_SKIPPED_ITSELF; + } /* Just get any ol format to test with */ error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, - CL_MEM_READ_ONLY, 0, &image_format_desc); + CL_MEM_READ_ONLY, 0, &imageFormatDesc); test_error(error, "Unable to obtain suitable image format to test with!"); - /* Get the max 2d image width */ + /* Get the max 3d image width */ error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof(maxDimension), &maxDimension, NULL); test_error(error, "Unable to get max image 3d width from device"); @@ -808,18 +820,18 @@ REGISTER_TEST(min_max_image_3d_width) log_error( "ERROR: Reported max image 3d width is less than required! (%d)\n", (int)maxDimension); - return -1; + return TEST_FAIL; } log_info("Max reported width is %zu.\n", maxDimension); /* Verify we can use the format */ - image_format_desc.image_channel_data_type = CL_UNORM_INT8; - image_format_desc.image_channel_order = CL_RGBA; + imageFormatDesc.image_channel_data_type = CL_UNORM_INT8; + imageFormatDesc.image_channel_order = CL_RGBA; if (!is_image_format_supported(context, CL_MEM_READ_ONLY, - CL_MEM_OBJECT_IMAGE3D, &image_format_desc)) + CL_MEM_OBJECT_IMAGE3D, &imageFormatDesc)) { log_error("CL_UNORM_INT8 CL_RGBA not supported. Can not test."); - return -1; + return TEST_FAIL; } /* Verify that we can actually allocate an image that large */ @@ -830,7 +842,7 @@ REGISTER_TEST(min_max_image_3d_width) log_error("Can not allocate a large enough image (min size: %" PRIu64 " bytes, max allowed: %" PRIu64 " bytes) to test.\n", (cl_ulong)maxDimension * 2 * 4, maxAllocSize); - return -1; + return TEST_FAIL; } log_info("Attempting to create an image of size %d x 1 x 2 = %gMB.\n", @@ -838,34 +850,46 @@ REGISTER_TEST(min_max_image_3d_width) (2 * (float)maxDimension * 4 / 1024.0 / 1024.0)); /* Try to allocate a very big image */ - streams[0] = create_image_3d(context, CL_MEM_READ_ONLY, &image_format_desc, - maxDimension, 1, 2, 0, 0, NULL, &error); - if ((streams[0] == NULL) || (error != CL_SUCCESS)) + streams = create_image_3d(context, CL_MEM_READ_ONLY, &imageFormatDesc, + maxDimension, 1, 2, 0, 0, NULL, &error); + if ((streams == nullptr) || (error != CL_SUCCESS)) { print_error(error, "Image 3D creation failed for maximum width"); - return -1; + return TEST_FAIL; } - return 0; + return TEST_PASS; } REGISTER_TEST(min_max_image_3d_height) { int error; size_t maxDimension; - clMemWrapper streams[1]; - cl_image_format image_format_desc; + clMemWrapper streams; + cl_image_format imageFormatDesc; cl_ulong maxAllocSize; + if (checkFor3DImageSupport(device)) + { + /* Get the max 3d image height */ + error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, + sizeof(maxDimension), &maxDimension, NULL); + test_error(error, "Unable to get max image 3d height from device"); - PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(device) + test_failure_error_ret(maxDimension, 0, + "Missing 3d image support but " + "CL_DEVICE_IMAGE3D_MAX_HEIGHT query did " + "not return 0", + TEST_FAIL); + return TEST_SKIPPED_ITSELF; + } /* Just get any ol format to test with */ error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, - CL_MEM_READ_ONLY, 0, &image_format_desc); + CL_MEM_READ_ONLY, 0, &imageFormatDesc); test_error(error, "Unable to obtain suitable image format to test with!"); - /* Get the max 2d image width */ + /* Get the max 3d image height */ error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof(maxDimension), &maxDimension, NULL); test_error(error, "Unable to get max image 3d height from device"); @@ -875,18 +899,18 @@ REGISTER_TEST(min_max_image_3d_height) log_error( "ERROR: Reported max image 3d height is less than required! (%d)\n", (int)maxDimension); - return -1; + return TEST_FAIL; } log_info("Max reported height is %zu.\n", maxDimension); /* Verify we can use the format */ - image_format_desc.image_channel_data_type = CL_UNORM_INT8; - image_format_desc.image_channel_order = CL_RGBA; + imageFormatDesc.image_channel_data_type = CL_UNORM_INT8; + imageFormatDesc.image_channel_order = CL_RGBA; if (!is_image_format_supported(context, CL_MEM_READ_ONLY, - CL_MEM_OBJECT_IMAGE3D, &image_format_desc)) + CL_MEM_OBJECT_IMAGE3D, &imageFormatDesc)) { log_error("CL_UNORM_INT8 CL_RGBA not supported. Can not test."); - return -1; + return TEST_FAIL; } /* Verify that we can actually allocate an image that large */ @@ -897,7 +921,7 @@ REGISTER_TEST(min_max_image_3d_height) log_error("Can not allocate a large enough image (min size: %" PRIu64 " bytes, max allowed: %" PRIu64 " bytes) to test.\n", (cl_ulong)maxDimension * 2 * 4, maxAllocSize); - return -1; + return TEST_FAIL; } log_info("Attempting to create an image of size 1 x %d x 2 = %gMB.\n", @@ -905,15 +929,15 @@ REGISTER_TEST(min_max_image_3d_height) (2 * (float)maxDimension * 4 / 1024.0 / 1024.0)); /* Try to allocate a very big image */ - streams[0] = create_image_3d(context, CL_MEM_READ_ONLY, &image_format_desc, - 1, maxDimension, 2, 0, 0, NULL, &error); - if ((streams[0] == NULL) || (error != CL_SUCCESS)) + streams = create_image_3d(context, CL_MEM_READ_ONLY, &imageFormatDesc, 1, + maxDimension, 2, 0, 0, NULL, &error); + if ((streams == NULL) || (error != CL_SUCCESS)) { print_error(error, "Image 3D creation failed for maximum height"); - return -1; + return TEST_FAIL; } - return 0; + return TEST_PASS; } @@ -921,40 +945,52 @@ REGISTER_TEST(min_max_image_3d_depth) { int error; size_t maxDimension; - clMemWrapper streams[1]; - cl_image_format image_format_desc; + clMemWrapper streams; + cl_image_format imageFormatDesc; cl_ulong maxAllocSize; + if (checkFor3DImageSupport(device)) + { + /* Get the max 3d image depth */ + error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_DEPTH, + sizeof(maxDimension), &maxDimension, NULL); + test_error(error, "Unable to get max image 3d depth from device"); - PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(device) + test_failure_error_ret(maxDimension, 0, + "Missing 3d image support but " + "CL_DEVICE_IMAGE3D_MAX_DEPTH query did " + "not return 0", + TEST_FAIL); + return TEST_SKIPPED_ITSELF; + } /* Just get any ol format to test with */ error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, - CL_MEM_READ_ONLY, 0, &image_format_desc); + CL_MEM_READ_ONLY, 0, &imageFormatDesc); test_error(error, "Unable to obtain suitable image format to test with!"); - /* Get the max 2d image width */ + /* Get the max 3d image depth */ error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof(maxDimension), &maxDimension, NULL); test_error(error, "Unable to get max image 3d depth from device"); if (maxDimension < 2048) { - log_error( - "ERROR: Reported max image 3d depth is less than required! (%d)\n", - (int)maxDimension); - return -1; + log_error("ERROR: Reported max image 3d depth is less than " + "required! (%d)\n", + (int)maxDimension); + return TEST_FAIL; } log_info("Max reported depth is %zu.\n", maxDimension); /* Verify we can use the format */ - image_format_desc.image_channel_data_type = CL_UNORM_INT8; - image_format_desc.image_channel_order = CL_RGBA; + imageFormatDesc.image_channel_data_type = CL_UNORM_INT8; + imageFormatDesc.image_channel_order = CL_RGBA; if (!is_image_format_supported(context, CL_MEM_READ_ONLY, - CL_MEM_OBJECT_IMAGE3D, &image_format_desc)) + CL_MEM_OBJECT_IMAGE3D, &imageFormatDesc)) { log_error("CL_UNORM_INT8 CL_RGBA not supported. Can not test."); - return -1; + return TEST_FAIL; } /* Verify that we can actually allocate an image that large */ @@ -965,22 +1001,22 @@ REGISTER_TEST(min_max_image_3d_depth) log_error("Can not allocate a large enough image (min size: %" PRIu64 " bytes, max allowed: %" PRIu64 " bytes) to test.\n", (cl_ulong)maxDimension * 1 * 4, maxAllocSize); - return -1; + return TEST_FAIL; } log_info("Attempting to create an image of size 1 x 1 x %d = %gMB.\n", (int)maxDimension, ((float)maxDimension * 4 / 1024.0 / 1024.0)); /* Try to allocate a very big image */ - streams[0] = create_image_3d(context, CL_MEM_READ_ONLY, &image_format_desc, - 1, 1, maxDimension, 0, 0, NULL, &error); - if ((streams[0] == NULL) || (error != CL_SUCCESS)) + streams = create_image_3d(context, CL_MEM_READ_ONLY, &imageFormatDesc, 1, 1, + maxDimension, 0, 0, NULL, &error); + if ((streams == nullptr) || (error != CL_SUCCESS)) { print_error(error, "Image 3D creation failed for maximum depth"); - return -1; + return TEST_FAIL; } - return 0; + return TEST_PASS; } REGISTER_TEST(min_max_image_array_size)