Filter out to get vkGetInstanceProcAddr in vk::raii::InstanceDispatcher

Since Vulkan 1.2 this can return nullptr!
This commit is contained in:
asuessenbach 2021-11-24 08:42:52 +01:00
parent 387bc4f118
commit 8e3a52edc0
2 changed files with 12 additions and 8 deletions

View File

@ -1033,14 +1033,19 @@ void VulkanHppGenerator::appendRAIIDispatcherCommands( std::vector<RequireData>
assert( ( commandIt->second.handle == "VkInstance" ) || assert( ( commandIt->second.handle == "VkInstance" ) ||
hasParentHandle( commandIt->second.handle, "VkInstance" ) ); hasParentHandle( commandIt->second.handle, "VkInstance" ) );
ia += " " + commandIt->first + " = PFN_" + commandIt->first + "( vkGetInstanceProcAddr( instance, \"" + // filter out vkGetInstanceProcAddr, as starting with Vulkan 1.2 it can resolve itself only (!) with an
commandIt->first + "\" ) );\n"; // instance nullptr !
if ( command != "vkGetInstanceProcAddr" )
{
ia += " " + commandIt->first + " = PFN_" + commandIt->first +
"( vkGetInstanceProcAddr( instance, \"" + commandIt->first + "\" ) );\n";
// if this is an alias'ed function, use it as a fallback for the original one // if this is an alias'ed function, use it as a fallback for the original one
if ( !commandIt->second.alias.empty() ) if ( !commandIt->second.alias.empty() )
{ {
ia += " if ( !" + commandIt->second.alias + " ) " + commandIt->second.alias + " = " + ia += " if ( !" + commandIt->second.alias + " ) " + commandIt->second.alias + " = " +
commandIt->first + ";\n"; commandIt->first + ";\n";
} }
}
im += +" PFN_" + commandIt->first + " " + commandIt->first + " = 0;\n"; im += +" PFN_" + commandIt->first + " " + commandIt->first + " = 0;\n";
imp += " PFN_dummy " + commandIt->first + "_placeholder = 0;\n"; imp += " PFN_dummy " + commandIt->first + "_placeholder = 0;\n";

View File

@ -82,7 +82,6 @@ namespace VULKAN_HPP_NAMESPACE
vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceQueueFamilyProperties" ) ); vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceQueueFamilyProperties" ) );
vkGetPhysicalDeviceMemoryProperties = PFN_vkGetPhysicalDeviceMemoryProperties( vkGetPhysicalDeviceMemoryProperties = PFN_vkGetPhysicalDeviceMemoryProperties(
vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceMemoryProperties" ) ); vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceMemoryProperties" ) );
vkGetInstanceProcAddr = PFN_vkGetInstanceProcAddr( vkGetInstanceProcAddr( instance, "vkGetInstanceProcAddr" ) );
vkCreateDevice = PFN_vkCreateDevice( vkGetInstanceProcAddr( instance, "vkCreateDevice" ) ); vkCreateDevice = PFN_vkCreateDevice( vkGetInstanceProcAddr( instance, "vkCreateDevice" ) );
vkEnumerateDeviceExtensionProperties = PFN_vkEnumerateDeviceExtensionProperties( vkEnumerateDeviceExtensionProperties = PFN_vkEnumerateDeviceExtensionProperties(
vkGetInstanceProcAddr( instance, "vkEnumerateDeviceExtensionProperties" ) ); vkGetInstanceProcAddr( instance, "vkEnumerateDeviceExtensionProperties" ) );