mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2025-01-10 17:00:10 +00:00
Improve handling of local Variables in enhanced simple functions.
This commit is contained in:
parent
1eaee05676
commit
03eb851f81
@ -901,7 +901,7 @@ void VulkanHppGenerator::appendArguments( std::string & str,
|
||||
}
|
||||
else if ( beginsWith( commandData.params[i].type.type, "Vk" ) )
|
||||
{
|
||||
appendArgumentVulkanType( str, commandData.params[i] );
|
||||
appendArgumentVulkanType( str, commandData.params[i], returnParamIndex == i );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -956,7 +956,9 @@ void VulkanHppGenerator::appendArgumentVector( std::string & str,
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::appendArgumentVulkanType( std::string & str, ParamData const & paramData ) const
|
||||
void VulkanHppGenerator::appendArgumentVulkanType( std::string & str,
|
||||
ParamData const & paramData,
|
||||
bool isLocalVariable ) const
|
||||
{
|
||||
// this parameter is a vulkan type
|
||||
if ( !paramData.type.postfix.empty() || !paramData.arraySizes.empty() )
|
||||
@ -968,15 +970,15 @@ void VulkanHppGenerator::appendArgumentVulkanType( std::string & str, ParamData
|
||||
appendReinterpretCast(
|
||||
str, paramData.type.prefix.find( "const" ) != std::string::npos, paramData.type.type, false );
|
||||
str += "( ";
|
||||
if ( paramData.optional )
|
||||
if ( isLocalVariable || !paramData.optional )
|
||||
{
|
||||
// for an optional parameter, we need also a static_cast from optional type to const-pointer to pure type
|
||||
str += "static_cast<const " + stripPrefix( paramData.type.type, "Vk" ) + "*>( " + parameterName + " )";
|
||||
// those parameters can just use the pointer
|
||||
str += ( paramData.arraySizes.empty() ? "&" : "" ) + parameterName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// other parameters can just use the pointer
|
||||
str += ( paramData.arraySizes.empty() ? "&" : "" ) + parameterName;
|
||||
// for an optional parameter, we need also a static_cast from optional type to const-pointer to pure type
|
||||
str += "static_cast<const " + stripPrefix( paramData.type.type, "Vk" ) + "*>( " + parameterName + " )";
|
||||
}
|
||||
str += " )";
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ private:
|
||||
bool twoStep,
|
||||
bool firstCall,
|
||||
bool singular ) const;
|
||||
void appendArgumentVulkanType( std::string & str, ParamData const & paramData ) const;
|
||||
void appendArgumentVulkanType( std::string & str, ParamData const & paramData, bool isLocalVariable ) const;
|
||||
void appendBitmask( std::string & os,
|
||||
std::string const & bitmaskName,
|
||||
std::string const & bitmaskType,
|
||||
|
Loading…
Reference in New Issue
Block a user