mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-21 14:59:02 +00:00
Stop using optimally-tiled images in external memory tests (#2349)
Support for optimally-tiled images and tiling inference in general is implementation-defined. It should not be relied upon in the CTS. Also build the code base as C++17 for std::optional. Many Khronos projects are now using C++17 and the transition in the CTS is IMO overdue. Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
@@ -705,13 +705,17 @@ clExternalMemoryImage::clExternalMemoryImage(
|
||||
std::vector<cl_mem_properties> extMemProperties1;
|
||||
cl_device_id devList[] = { deviceId, NULL };
|
||||
|
||||
VulkanImageTiling vulkanImageTiling =
|
||||
vkClExternalMemoryHandleTilingAssumption(
|
||||
deviceId, externalMemoryHandleType, &errcode_ret);
|
||||
auto vulkanImageTiling = vkClExternalMemoryHandleTilingAssumption(
|
||||
deviceId, externalMemoryHandleType, &errcode_ret);
|
||||
if (CL_SUCCESS != errcode_ret)
|
||||
{
|
||||
throw std::runtime_error("Failed to query OpenCL tiling mode");
|
||||
}
|
||||
if (vulkanImageTiling == std::nullopt)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Could not find image tiling supported by both Vulkan and OpenCL");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!is_extension_available(devList[0], "cl_khr_external_memory_win32"))
|
||||
@@ -1206,12 +1210,11 @@ cl_external_memory_handle_type_khr vkToOpenCLExternalMemoryHandleType(
|
||||
return 0;
|
||||
}
|
||||
|
||||
VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
|
||||
std::optional<VulkanImageTiling> vkClExternalMemoryHandleTilingAssumption(
|
||||
cl_device_id deviceId,
|
||||
VulkanExternalMemoryHandleType vkExternalMemoryHandleType, int *error_ret)
|
||||
{
|
||||
size_t size = 0;
|
||||
VulkanImageTiling mode = VULKAN_IMAGE_TILING_OPTIMAL;
|
||||
|
||||
assert(error_ret
|
||||
!= nullptr); // errcode_ret is not optional, it must be checked
|
||||
@@ -1222,12 +1225,12 @@ VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
|
||||
0, nullptr, &size);
|
||||
if (*error_ret != CL_SUCCESS)
|
||||
{
|
||||
return mode;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
return mode;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::vector<cl_external_memory_handle_type_khr> assume_linear_types(
|
||||
@@ -1239,7 +1242,7 @@ VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
|
||||
size, assume_linear_types.data(), nullptr);
|
||||
if (*error_ret != CL_SUCCESS)
|
||||
{
|
||||
return mode;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (std::find(
|
||||
@@ -1247,8 +1250,8 @@ VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
|
||||
vkToOpenCLExternalMemoryHandleType(vkExternalMemoryHandleType))
|
||||
!= assume_linear_types.end())
|
||||
{
|
||||
mode = VULKAN_IMAGE_TILING_LINEAR;
|
||||
return VULKAN_IMAGE_TILING_LINEAR;
|
||||
}
|
||||
|
||||
return mode;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user