VulkanRenderer: implement metal view
The metal view backing the MoltenVK compatibility wrapper is written in Obj-C. It would have been possible to use the Objective-C runtime in C++ but the code is less performant (the symbol binding is done at first use instead of the beginning of the program) and actually harder to get right. Note that MoltenVK is not linked to the loader, so the libMoltenVK.dylib object must be available for loading.
This commit is contained in:
committed by
Jérôme Leclercq
parent
162456c5b6
commit
f146661a76
@@ -140,6 +140,27 @@ namespace Nz
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
inline bool Surface::Create(const VkMetalSurfaceCreateInfoEXT& createInfo, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
m_lastErrorCode = m_instance.vkCreateMetalSurfaceEXT(m_instance, &createInfo, allocator, &m_surface);
|
||||
return Create(allocator);
|
||||
}
|
||||
|
||||
inline bool Surface::Create(id layer, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkMetalSurfaceCreateInfoEXT createInfo =
|
||||
{
|
||||
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT,
|
||||
nullptr,
|
||||
0,
|
||||
layer
|
||||
};
|
||||
|
||||
return Create(createInfo, allocator);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void Surface::Destroy()
|
||||
{
|
||||
if (m_surface != VK_NULL_HANDLE)
|
||||
@@ -262,6 +283,10 @@ namespace Nz
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
if (instance.IsExtensionLoaded(VK_EXT_METAL_SURFACE_EXTENSION_NAME))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user