Add placeholder dummy function pointers in DispatchLoaderDynamic for not defined platforms.

- Prevents function offset differences in case of (erroneous) different definitions of platform in different translation units.

Resolves #887
This commit is contained in:
asuessenbach
2021-03-01 12:30:23 +01:00
parent e7bec052db
commit c376dff68c
2 changed files with 84 additions and 7 deletions

View File

@@ -2058,6 +2058,8 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
class DispatchLoaderDynamic
{
public:
using PFN_dummy = void ( * )();
)";
std::string emptyFunctions;
@@ -2300,7 +2302,12 @@ void VulkanHppGenerator::appendDispatchLoaderDynamicCommand( std::string &
std::string enter, leave;
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions );
str += enter + " PFN_" + commandName + " " + commandName + " = 0;\n" + leave;
std::string command = " PFN_" + commandName + " " + commandName + " = 0;\n";
if ( !enter.empty() )
{
command = enter + command + "#else\n PFN_dummy placeholder_dont_call_" + commandName + " = 0;\n" + leave;
}
str += command;
bool isDeviceFunction = !commandData.handle.empty() && !commandData.params.empty() &&
( m_handles.find( commandData.params[0].type.type ) != m_handles.end() ) &&