mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2025-09-10 04:18:48 -04: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" ) )
|
else if ( beginsWith( commandData.params[i].type.type, "Vk" ) )
|
||||||
{
|
{
|
||||||
appendArgumentVulkanType( str, commandData.params[i] );
|
appendArgumentVulkanType( str, commandData.params[i], returnParamIndex == i );
|
||||||
}
|
}
|
||||||
else
|
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
|
// this parameter is a vulkan type
|
||||||
if ( !paramData.type.postfix.empty() || !paramData.arraySizes.empty() )
|
if ( !paramData.type.postfix.empty() || !paramData.arraySizes.empty() )
|
||||||
@ -968,15 +970,15 @@ void VulkanHppGenerator::appendArgumentVulkanType( std::string & str, ParamData
|
|||||||
appendReinterpretCast(
|
appendReinterpretCast(
|
||||||
str, paramData.type.prefix.find( "const" ) != std::string::npos, paramData.type.type, false );
|
str, paramData.type.prefix.find( "const" ) != std::string::npos, paramData.type.type, false );
|
||||||
str += "( ";
|
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
|
// those parameters can just use the pointer
|
||||||
str += "static_cast<const " + stripPrefix( paramData.type.type, "Vk" ) + "*>( " + parameterName + " )";
|
str += ( paramData.arraySizes.empty() ? "&" : "" ) + parameterName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// other parameters can just use the pointer
|
// for an optional parameter, we need also a static_cast from optional type to const-pointer to pure type
|
||||||
str += ( paramData.arraySizes.empty() ? "&" : "" ) + parameterName;
|
str += "static_cast<const " + stripPrefix( paramData.type.type, "Vk" ) + "*>( " + parameterName + " )";
|
||||||
}
|
}
|
||||||
str += " )";
|
str += " )";
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ private:
|
|||||||
bool twoStep,
|
bool twoStep,
|
||||||
bool firstCall,
|
bool firstCall,
|
||||||
bool singular ) const;
|
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,
|
void appendBitmask( std::string & os,
|
||||||
std::string const & bitmaskName,
|
std::string const & bitmaskName,
|
||||||
std::string const & bitmaskType,
|
std::string const & bitmaskType,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user