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

Function TEST_F

tests/unit/external_memory_metal.cpp:74–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72class NegativeExternalMemoryMetal : public VkLayerTest {};
73
74TEST_F(NegativeExternalMemoryMetal, AllocateExportableImageWithoutDedicatedAllocationInPNext) {
75 TEST_DESCRIPTION("Allocate exportable metal texture without dedicated allocation in pNext chain");
76
77 AddRequiredExtensions(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME);
78 AddRequiredExtensions(VK_EXT_EXTERNAL_MEMORY_METAL_EXTENSION_NAME);
79 RETURN_IF_SKIP(Init());
80
81 // Create export image
82 VkExternalMemoryImageCreateInfo external_image_info = vku::InitStructHelper();
83 VkImageCreateInfo image_info = vku::InitStructHelper(&external_image_info);
84 image_info.imageType = VK_IMAGE_TYPE_2D;
85 image_info.arrayLayers = 1;
86 image_info.extent = {64, 64, 1};
87 image_info.format = VK_FORMAT_R8G8B8A8_UNORM;
88 image_info.mipLevels = 1;
89 image_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
90 image_info.samples = VK_SAMPLE_COUNT_1_BIT;
91 image_info.tiling = VK_IMAGE_TILING_OPTIMAL;
92 image_info.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
93
94 auto exportable_types =
95 FindSupportedExternalMemoryHandleTypesMetal(Gpu(), image_info, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT);
96
97 VkExternalMemoryHandleTypeFlagBits metal_texture_type = VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLTEXTURE_BIT_EXT;
98 if ((exportable_types & metal_texture_type) == 0u) {
99 GTEST_SKIP() << "Unable to find exportable metal texture handle type";
100 }
101 external_image_info.handleTypes = metal_texture_type;
102 vkt::Image image(*m_device, image_info, vkt::no_mem);
103
104 VkExportMemoryAllocateInfo export_memory_info = vku::InitStructHelper(nullptr);
105 export_memory_info.handleTypes = metal_texture_type;
106
107 auto alloc_info = vkt::DeviceMemory::GetResourceAllocInfo(*m_device, image.MemoryRequirements(),
108 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &export_memory_info);
109 m_errorMonitor->SetDesiredError("VUID-VkMemoryAllocateInfo-pNext-00639");
110 image.Memory().TryInit(*m_device, alloc_info);
111 m_errorMonitor->VerifyFound();
112}
113
114TEST_F(NegativeExternalMemoryMetal, AllocateImportableImageWithoutDedicatedAllocationInPNext) {
115 TEST_DESCRIPTION("Import metal texture at allocation without dedicated allocation in pNext chain");

Callers

nothing calls this directly

Calls 11

GetMemoryMetalHandleEXTFunction · 0.85
AllocateMemoryFunction · 0.85
MemoryRequirementsMethod · 0.80
SetDesiredErrorMethod · 0.80
TryInitMethod · 0.80
AllocateAndBindMemoryMethod · 0.80
SetAllowedFailureMsgMethod · 0.80
VerifyFoundMethod · 0.45
handleMethod · 0.45

Tested by

no test coverage detected