MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / TEST_F

Function TEST_F

tests/unit/external_memory_sync.cpp:23–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21class NegativeExternalMemorySync : public ExternalMemorySyncTest {};
22
23TEST_F(NegativeExternalMemorySync, CreateBufferIncompatibleHandleTypes) {
24 TEST_DESCRIPTION("Creating buffer with incompatible external memory handle types");
25
26 SetTargetApiVersion(VK_API_VERSION_1_1);
27 // Required to pass in various memory flags without querying for corresponding extensions.
28 AddRequiredExtensions(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
29 RETURN_IF_SKIP(Init());
30 IgnoreHandleTypeError(m_errorMonitor);
31
32 // Try all flags first. It's unlikely all of them are compatible.
33 VkExternalMemoryBufferCreateInfo external_memory_info = vku::InitStructHelper();
34 external_memory_info.handleTypes = AllVkExternalMemoryHandleTypeFlagBits;
35 VkBufferCreateInfo buffer_create_info = vku::InitStructHelper(&external_memory_info);
36 buffer_create_info.size = 1024;
37 buffer_create_info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
38 CreateBufferTest(buffer_create_info, "VUID-VkBufferCreateInfo-pNext-00920");
39
40 IgnoreHandleTypeError(m_errorMonitor);
41 // Get all exportable handle types supported by the platform.
42 VkExternalMemoryHandleTypeFlags supported_handle_types = 0;
43 VkExternalMemoryHandleTypeFlags any_compatible_group = 0;
44 IterateFlags<VkExternalMemoryHandleTypeFlagBits>(
45 AllVkExternalMemoryHandleTypeFlagBits, [&](VkExternalMemoryHandleTypeFlagBits flag) {
46 VkPhysicalDeviceExternalBufferInfo external_buffer_info = vku::InitStructHelper();
47 external_buffer_info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
48 external_buffer_info.handleType = flag;
49 VkExternalBufferProperties external_buffer_properties = vku::InitStructHelper();
50 vk::GetPhysicalDeviceExternalBufferProperties(Gpu(), &external_buffer_info, &external_buffer_properties);
51 const auto external_features = external_buffer_properties.externalMemoryProperties.externalMemoryFeatures;
52 if (external_features & VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT) {
53 supported_handle_types |= external_buffer_info.handleType;
54 any_compatible_group = external_buffer_properties.externalMemoryProperties.compatibleHandleTypes;
55 }
56 });
57
58 // Main test case. Handle types are supported but not compatible with each other
59 if ((supported_handle_types & any_compatible_group) != supported_handle_types) {
60 external_memory_info.handleTypes = supported_handle_types;
61 CreateBufferTest(buffer_create_info, "VUID-VkBufferCreateInfo-pNext-00920");
62 }
63}
64
65TEST_F(NegativeExternalMemorySync, CreateImageIncompatibleHandleTypes) {
66 TEST_DESCRIPTION("Creating image with incompatible external memory handle types");

Callers

nothing calls this directly

Tested by

no test coverage detected