mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Refactor commands returning a StructureChain and a Result.
This commit is contained in:
parent
5ecb57bdc5
commit
74498b2b9e
@ -57,9 +57,8 @@ std::string createEnumValueName( std::string const & name,
|
|||||||
std::string createSuccessCode( std::string const & code, std::set<std::string> const & tags );
|
std::string createSuccessCode( std::string const & code, std::set<std::string> const & tags );
|
||||||
std::string determineCommandName( std::string const & vulkanCommandName, std::string const & firstArgumentType );
|
std::string determineCommandName( std::string const & vulkanCommandName, std::string const & firstArgumentType );
|
||||||
std::set<size_t> determineSkippedParams( size_t returnParamIndex, std::map<size_t, size_t> const & vectorParamIndices );
|
std::set<size_t> determineSkippedParams( size_t returnParamIndex, std::map<size_t, size_t> const & vectorParamIndices );
|
||||||
bool determineStructureChaining( std::string const & structType,
|
bool determineStructureChaining( std::string const & structType, std::set<std::string> const & extendedStructs );
|
||||||
std::set<std::string> const & extendedStructs );
|
std::string extractTag( int line, std::string const & name, std::set<std::string> const & tags );
|
||||||
std::string extractTag( int line, std::string const & name, std::set<std::string> const & tags );
|
|
||||||
std::string findTag( std::set<std::string> const & tags, std::string const & name, std::string const & postfix = "" );
|
std::string findTag( std::set<std::string> const & tags, std::string const & name, std::string const & postfix = "" );
|
||||||
std::pair<bool, std::string> generateFunctionBodyStandardReturn( std::string const & returnType );
|
std::pair<bool, std::string> generateFunctionBodyStandardReturn( std::string const & returnType );
|
||||||
std::map<std::string, std::string> getAttributes( tinyxml2::XMLElement const * element );
|
std::map<std::string, std::string> getAttributes( tinyxml2::XMLElement const * element );
|
||||||
@ -392,8 +391,7 @@ std::set<size_t> determineSkippedParams( size_t returnParamIndex, std::map<size_
|
|||||||
return skippedParams;
|
return skippedParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool determineStructureChaining( std::string const & structType,
|
bool determineStructureChaining( std::string const & structType, std::set<std::string> const & extendedStructs )
|
||||||
std::set<std::string> const & extendedStructs )
|
|
||||||
{
|
{
|
||||||
return ( extendedStructs.find( structType ) != extendedStructs.end() );
|
return ( extendedStructs.find( structType ) != extendedStructs.end() );
|
||||||
}
|
}
|
||||||
@ -806,19 +804,9 @@ void VulkanHppGenerator::appendArgumentPlainType( std::string & str, ParamData c
|
|||||||
assert( paramData.type.postfix.back() == '*' );
|
assert( paramData.type.postfix.back() == '*' );
|
||||||
// it's a pointer
|
// it's a pointer
|
||||||
std::string parameterName = startLowerCase( stripPrefix( paramData.name, "p" ) );
|
std::string parameterName = startLowerCase( stripPrefix( paramData.name, "p" ) );
|
||||||
if ( paramData.type.prefix.find( "const" ) != std::string::npos )
|
// it's a non-const pointer, and char is the only type that occurs -> use the address of the parameter
|
||||||
{
|
assert( paramData.type.type.find( "char" ) == std::string::npos );
|
||||||
assert( paramData.type.type != "char" );
|
str += "&" + parameterName;
|
||||||
// it's const pointer -> just use the name
|
|
||||||
assert( !paramData.optional );
|
|
||||||
str += paramData.name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// it's a non-const pointer, and char is the only type that occurs -> use the address of the parameter
|
|
||||||
assert( paramData.type.type.find( "char" ) == std::string::npos );
|
|
||||||
str += "&" + parameterName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1241,11 +1229,16 @@ void VulkanHppGenerator::appendCommand( std::string & str,
|
|||||||
// the return parameter is not a vector
|
// the return parameter is not a vector
|
||||||
if ( isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[0]].type.type ) )
|
if ( isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[0]].type.type ) )
|
||||||
{
|
{
|
||||||
if ( commandData.returnType == "void" )
|
if ( commandData.returnType == "VkResult" )
|
||||||
{
|
{
|
||||||
appendCommandGetChain( str, name, commandData, nonConstPointerParamIndices[0], definition );
|
appendCommandGetChainResult( str, name, commandData, nonConstPointerParamIndices[0], definition );
|
||||||
appendedFunction = true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert( commandData.returnType == "void" );
|
||||||
|
appendCommandGetChainVoid( str, name, commandData, nonConstPointerParamIndices[0], definition );
|
||||||
|
}
|
||||||
|
appendedFunction = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1307,8 +1300,8 @@ void VulkanHppGenerator::appendCommand( std::string & str,
|
|||||||
assert( ( vectorParamIndexIt->second == *nonConstPointerParamIndices.begin() ) &&
|
assert( ( vectorParamIndexIt->second == *nonConstPointerParamIndices.begin() ) &&
|
||||||
( vectorParamIndexIt->first == *std::next( nonConstPointerParamIndices.begin() ) ) );
|
( vectorParamIndexIt->first == *std::next( nonConstPointerParamIndices.begin() ) ) );
|
||||||
if ( ( commandData.returnType == "void" ) &&
|
if ( ( commandData.returnType == "void" ) &&
|
||||||
!determineStructureChaining(
|
!determineStructureChaining( commandData.params[vectorParamIndexIt->first].type.type,
|
||||||
commandData.params[vectorParamIndexIt->first].type.type, m_extendedStructs ) )
|
m_extendedStructs ) )
|
||||||
{
|
{
|
||||||
assert( commandData.params[vectorParamIndexIt->first].type.type != "void" );
|
assert( commandData.params[vectorParamIndexIt->first].type.type != "void" );
|
||||||
appendCommandEnumerateVoid( str, name, commandData, *vectorParamIndexIt, definition );
|
appendCommandEnumerateVoid( str, name, commandData, *vectorParamIndexIt, definition );
|
||||||
@ -1585,11 +1578,40 @@ ${commandEnhancedWithAllocators}
|
|||||||
{ "newlineOnDefinition", definition ? "\n" : "" } } ) );
|
{ "newlineOnDefinition", definition ? "\n" : "" } } ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanHppGenerator::appendCommandGetChain( std::string & str,
|
void VulkanHppGenerator::appendCommandGetChainResult( std::string & str,
|
||||||
std::string const & name,
|
std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
size_t nonConstPointerIndex,
|
size_t nonConstPointerIndex,
|
||||||
bool definition ) const
|
bool definition ) const
|
||||||
|
{
|
||||||
|
std::string const functionTemplate = R"(
|
||||||
|
${enter}${commandStandard}${newlineOnDefinition}
|
||||||
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
|
${commandEnhanced}${newlineOnDefinition}
|
||||||
|
${commandEnhancedChained}
|
||||||
|
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||||
|
${leave})";
|
||||||
|
|
||||||
|
std::string enter, leave;
|
||||||
|
std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions );
|
||||||
|
|
||||||
|
str += replaceWithMap(
|
||||||
|
functionTemplate,
|
||||||
|
std::map<std::string, std::string>(
|
||||||
|
{ { "commandEnhanced", constructCommandResultGetValue( name, commandData, nonConstPointerIndex, definition ) },
|
||||||
|
{ "commandEnhancedChained",
|
||||||
|
constructCommandResultGetChain( name, commandData, nonConstPointerIndex, definition ) },
|
||||||
|
{ "commandStandard", constructCommandStandard( name, commandData, definition ) },
|
||||||
|
{ "enter", enter },
|
||||||
|
{ "leave", leave },
|
||||||
|
{ "newlineOnDefinition", definition ? "\n" : "" } } ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void VulkanHppGenerator::appendCommandGetChainVoid( std::string & str,
|
||||||
|
std::string const & name,
|
||||||
|
CommandData const & commandData,
|
||||||
|
size_t nonConstPointerIndex,
|
||||||
|
bool definition ) const
|
||||||
{
|
{
|
||||||
std::string const functionTemplate = R"(
|
std::string const functionTemplate = R"(
|
||||||
${enter}${commandStandard}${newlineOnDefinition}
|
${enter}${commandStandard}${newlineOnDefinition}
|
||||||
@ -2597,9 +2619,7 @@ std::string VulkanHppGenerator::appendFunctionBodyEnhancedLocalReturnVariable(
|
|||||||
std::string const & indentation,
|
std::string const & indentation,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
size_t returnParamIndex,
|
size_t returnParamIndex,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
|
||||||
std::string const & enhancedReturnType,
|
std::string const & enhancedReturnType,
|
||||||
bool isStructureChain,
|
|
||||||
bool withAllocator ) const
|
bool withAllocator ) const
|
||||||
{
|
{
|
||||||
std::string pureReturnType = stripPrefix( commandData.params[returnParamIndex].type.type, "Vk" );
|
std::string pureReturnType = stripPrefix( commandData.params[returnParamIndex].type.type, "Vk" );
|
||||||
@ -2610,17 +2630,7 @@ std::string VulkanHppGenerator::appendFunctionBodyEnhancedLocalReturnVariable(
|
|||||||
// the returned parameter is somehow enhanced by us
|
// the returned parameter is somehow enhanced by us
|
||||||
str += indentation + " ";
|
str += indentation + " ";
|
||||||
// in non-singular case, use the enhanced type for the return variable (like vector<...>)
|
// in non-singular case, use the enhanced type for the return variable (like vector<...>)
|
||||||
if ( isStructureChain && vectorParamIndices.empty() )
|
str += enhancedReturnType + " " + returnName;
|
||||||
{
|
|
||||||
// For StructureChains use the template parameters
|
|
||||||
str += "StructureChain<X, Y, Z...> structureChain;\n" + indentation + " " + enhancedReturnType + "& " +
|
|
||||||
returnName + " = structureChain.template get<" + enhancedReturnType + ">()";
|
|
||||||
returnName = "structureChain";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str += enhancedReturnType + " " + returnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( withAllocator )
|
if ( withAllocator )
|
||||||
{
|
{
|
||||||
@ -2916,7 +2926,7 @@ void VulkanHppGenerator::appendFunctionHeaderArgumentEnhancedPointer( std::strin
|
|||||||
// for non-char-pointer, change to reference
|
// for non-char-pointer, change to reference
|
||||||
assert( param.type.postfix == "*" );
|
assert( param.type.postfix == "*" );
|
||||||
str += param.type.prefix + ( param.type.prefix.empty() ? "" : " " ) + stripPrefix( param.type.type, "Vk" ) + " & " +
|
str += param.type.prefix + ( param.type.prefix.empty() ? "" : " " ) + stripPrefix( param.type.type, "Vk" ) + " & " +
|
||||||
strippedParameterName;
|
strippedParameterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanHppGenerator::appendFunctionHeaderArgumentEnhancedVector( std::string & str,
|
void VulkanHppGenerator::appendFunctionHeaderArgumentEnhancedVector( std::string & str,
|
||||||
@ -3635,28 +3645,54 @@ std::string VulkanHppGenerator::constructArgumentListEnhanced( std::vector<Param
|
|||||||
argumentList += "const " + stripPrefix( params[i].type.type, "Vk" ) + " & " +
|
argumentList += "const " + stripPrefix( params[i].type.type, "Vk" ) + " & " +
|
||||||
stripPluralS( startLowerCase( stripPrefix( params[i].name, "p" ) ) );
|
stripPluralS( startLowerCase( stripPrefix( params[i].name, "p" ) ) );
|
||||||
}
|
}
|
||||||
else if ( params[i].type.isConstPointer() && !params[i].len.empty() )
|
else if ( params[i].type.isConstPointer() )
|
||||||
{
|
{
|
||||||
assert( params[i].arraySizes.empty() );
|
if ( params[i].len.empty() )
|
||||||
if ( params[i].len == "null-terminated" )
|
|
||||||
{
|
{
|
||||||
assert( params[i].type.type == "char" );
|
assert( !params[i].type.prefix.empty() && ( params[i].type.postfix == "*" ) );
|
||||||
argumentList += "const std::string & ";
|
assert( params[i].arraySizes.empty() );
|
||||||
|
if ( params[i].type.type == "void" )
|
||||||
|
{
|
||||||
|
argumentList += params[i].type.compose() + " " + params[i].name;
|
||||||
|
}
|
||||||
|
else if ( params[i].optional )
|
||||||
|
{
|
||||||
|
argumentList +=
|
||||||
|
"Optional<const " + stripPrefix( params[i].type.type, "Vk" ) + "> " +
|
||||||
|
startLowerCase(
|
||||||
|
stripPrefix( params[i].name, "p" ) +
|
||||||
|
( ( definition || withAllocators ) ? "" : " VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT" ) );
|
||||||
|
hasDefaultAssignment = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
argumentList += params[i].type.prefix + " " + stripPrefix( params[i].type.type, "Vk" ) + " & " +
|
||||||
|
startLowerCase( stripPrefix( params[i].name, "p" ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string type = params[i].type.compose();
|
assert( params[i].arraySizes.empty() );
|
||||||
assert( endsWith( type, "*" ) );
|
if ( params[i].len == "null-terminated" )
|
||||||
type.pop_back();
|
|
||||||
size_t pos = type.find( "void" );
|
|
||||||
if ( pos != std::string::npos )
|
|
||||||
{
|
{
|
||||||
type.replace( pos, 4, "T" );
|
assert( params[i].type.type == "char" );
|
||||||
|
argumentList += "const std::string & ";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string type = params[i].type.compose();
|
||||||
|
assert( endsWith( type, "*" ) );
|
||||||
|
type.pop_back();
|
||||||
|
size_t pos = type.find( "void" );
|
||||||
|
if ( pos != std::string::npos )
|
||||||
|
{
|
||||||
|
type.replace( pos, 4, "T" );
|
||||||
|
}
|
||||||
|
|
||||||
argumentList += "ArrayProxy<" + type + "> const & ";
|
argumentList += "ArrayProxy<" + type + "> const & ";
|
||||||
|
}
|
||||||
|
argumentList += startLowerCase( stripPrefix( params[i].name, "p" ) );
|
||||||
}
|
}
|
||||||
argumentList += startLowerCase( stripPrefix( params[i].name, "p" ) );
|
|
||||||
}
|
}
|
||||||
else if ( params[i].type.isNonConstPointer() )
|
else if ( params[i].type.isNonConstPointer() )
|
||||||
{
|
{
|
||||||
@ -3667,30 +3703,8 @@ std::string VulkanHppGenerator::constructArgumentListEnhanced( std::vector<Param
|
|||||||
}
|
}
|
||||||
else if ( beginsWith( params[i].type.type, "Vk" ) )
|
else if ( beginsWith( params[i].type.type, "Vk" ) )
|
||||||
{
|
{
|
||||||
if ( params[i].type.isConstPointer() )
|
assert( !params[i].type.isConstPointer() );
|
||||||
{
|
argumentList += params[i].type.compose() + " " + params[i].name + constructCArraySizes( params[i].arraySizes );
|
||||||
assert( params[i].arraySizes.empty() );
|
|
||||||
if ( params[i].optional )
|
|
||||||
{
|
|
||||||
assert( params[i].type.isConstPointer() );
|
|
||||||
argumentList +=
|
|
||||||
"Optional<const " + stripPrefix( params[i].type.type, "Vk" ) + "> " +
|
|
||||||
startLowerCase(
|
|
||||||
stripPrefix( params[i].name, "p" ) +
|
|
||||||
( ( definition || withAllocators ) ? "" : " VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT" ) );
|
|
||||||
hasDefaultAssignment = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
argumentList += "const " + stripPrefix( params[i].type.type, "Vk" ) + " & " +
|
|
||||||
startLowerCase( stripPrefix( params[i].name, "p" ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
argumentList +=
|
|
||||||
params[i].type.compose() + " " + params[i].name + constructCArraySizes( params[i].arraySizes );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4269,6 +4283,64 @@ std::string VulkanHppGenerator::constructCommandResultEnumerateTwoVectorsDepreca
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string VulkanHppGenerator::constructCommandResultGetChain( std::string const & name,
|
||||||
|
CommandData const & commandData,
|
||||||
|
size_t nonConstPointerIndex,
|
||||||
|
bool definition ) const
|
||||||
|
{
|
||||||
|
assert( !commandData.handle.empty() && ( commandData.returnType == "VkResult" ) &&
|
||||||
|
( commandData.successCodes.size() == 1 ) && !commandData.errorCodes.empty() );
|
||||||
|
|
||||||
|
std::string str;
|
||||||
|
|
||||||
|
std::set<size_t> skippedParams{ 0, nonConstPointerIndex };
|
||||||
|
|
||||||
|
std::string argumentList =
|
||||||
|
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, false );
|
||||||
|
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
|
||||||
|
std::string nodiscard = constructNoDiscardEnhanced( commandData );
|
||||||
|
assert( beginsWith( commandData.params[nonConstPointerIndex].type.type, "Vk" ) );
|
||||||
|
std::string returnType =
|
||||||
|
"VULKAN_HPP_NAMESPACE::" + stripPrefix( commandData.params[nonConstPointerIndex].type.type, "Vk" );
|
||||||
|
|
||||||
|
if ( definition )
|
||||||
|
{
|
||||||
|
std::string const functionTemplate =
|
||||||
|
R"( template <typename X, typename Y, typename... Z, typename Dispatch>
|
||||||
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type ${className}::${commandName}( ${argumentList} ) const
|
||||||
|
{
|
||||||
|
StructureChain<X, Y, Z...> structureChain;
|
||||||
|
${returnType} & ${returnVariable} = structureChain.template get<${returnType}>();
|
||||||
|
Result result = static_cast<Result>( d.${vkCommand}( ${callArguments} ) );
|
||||||
|
return createResultValue( result, structureChain, VULKAN_HPP_NAMESPACE_STRING"::${className}::${commandName}" );
|
||||||
|
})";
|
||||||
|
|
||||||
|
str = replaceWithMap(
|
||||||
|
functionTemplate,
|
||||||
|
std::map<std::string, std::string>(
|
||||||
|
{ { "argumentList", argumentList },
|
||||||
|
{ "callArguments",
|
||||||
|
constructCallArgumentsGetValue( commandData.handle, commandData.params, nonConstPointerIndex ) },
|
||||||
|
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||||
|
{ "commandName", commandName },
|
||||||
|
{ "returnVariable", startLowerCase( stripPrefix( commandData.params[nonConstPointerIndex].name, "p" ) ) },
|
||||||
|
{ "returnType", returnType },
|
||||||
|
{ "vkCommand", name } } ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string const functionTemplate =
|
||||||
|
R"( template <typename X, typename Y, typename... Z, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||||
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<StructureChain<X, Y, Z...>>::type ${commandName}( ${argumentList} ) const;)";
|
||||||
|
|
||||||
|
str = replaceWithMap(
|
||||||
|
functionTemplate,
|
||||||
|
std::map<std::string, std::string>( { { "argumentList", argumentList }, { "commandName", commandName } } ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
std::string VulkanHppGenerator::constructCommandResultGetHandleUnique( std::string const & name,
|
std::string VulkanHppGenerator::constructCommandResultGetHandleUnique( std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
size_t nonConstPointerIndex,
|
size_t nonConstPointerIndex,
|
||||||
@ -5119,12 +5191,7 @@ std::string VulkanHppGenerator::constructCommandVoidGetChain( std::string const
|
|||||||
|
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
std::set<size_t> skippedParams{ nonConstPointerIndex };
|
std::set<size_t> skippedParams{ 0, nonConstPointerIndex };
|
||||||
if ( !commandData.handle.empty() )
|
|
||||||
{
|
|
||||||
assert( commandData.params[0].type.type == commandData.handle );
|
|
||||||
skippedParams.insert( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, false );
|
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, false );
|
||||||
@ -5138,7 +5205,7 @@ std::string VulkanHppGenerator::constructCommandVoidGetChain( std::string const
|
|||||||
{
|
{
|
||||||
std::string const functionTemplate =
|
std::string const functionTemplate =
|
||||||
R"( template <typename X, typename Y, typename... Z, typename Dispatch>
|
R"( template <typename X, typename Y, typename... Z, typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain<X, Y, Z...> ${className}${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain<X, Y, Z...> ${className}::${commandName}( ${argumentList} ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
StructureChain<X, Y, Z...> structureChain;
|
StructureChain<X, Y, Z...> structureChain;
|
||||||
${returnType} & ${returnVariable} = structureChain.template get<${returnType}>();
|
${returnType} & ${returnVariable} = structureChain.template get<${returnType}>();
|
||||||
@ -5146,19 +5213,13 @@ std::string VulkanHppGenerator::constructCommandVoidGetChain( std::string const
|
|||||||
return structureChain;
|
return structureChain;
|
||||||
})";
|
})";
|
||||||
|
|
||||||
std::string className = stripPrefix( commandData.handle, "Vk" );
|
|
||||||
if ( !className.empty() )
|
|
||||||
{
|
|
||||||
className += "::";
|
|
||||||
}
|
|
||||||
|
|
||||||
str = replaceWithMap(
|
str = replaceWithMap(
|
||||||
functionTemplate,
|
functionTemplate,
|
||||||
std::map<std::string, std::string>(
|
std::map<std::string, std::string>(
|
||||||
{ { "argumentList", argumentList },
|
{ { "argumentList", argumentList },
|
||||||
{ "callArguments",
|
{ "callArguments",
|
||||||
constructCallArgumentsGetValue( commandData.handle, commandData.params, nonConstPointerIndex ) },
|
constructCallArgumentsGetValue( commandData.handle, commandData.params, nonConstPointerIndex ) },
|
||||||
{ "className", className },
|
{ "className", stripPrefix( commandData.handle, "Vk" ) },
|
||||||
{ "commandName", commandName },
|
{ "commandName", commandName },
|
||||||
{ "returnVariable", startLowerCase( stripPrefix( commandData.params[nonConstPointerIndex].name, "p" ) ) },
|
{ "returnVariable", startLowerCase( stripPrefix( commandData.params[nonConstPointerIndex].name, "p" ) ) },
|
||||||
{ "returnType", returnType },
|
{ "returnType", returnType },
|
||||||
@ -5263,8 +5324,8 @@ std::string VulkanHppGenerator::constructCommandVoid( std::string const &
|
|||||||
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
|
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
|
||||||
std::string typenameT = ( ( vectorParamIndices.size() == 1 ) &&
|
std::string typenameT = ( ( vectorParamIndices.size() == 1 ) &&
|
||||||
( commandData.params[vectorParamIndices.begin()->first].type.type == "void" ) )
|
( commandData.params[vectorParamIndices.begin()->first].type.type == "void" ) )
|
||||||
? "typename T, "
|
? "typename T, "
|
||||||
: "";
|
: "";
|
||||||
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
|
std::pair<bool, std::map<size_t, std::vector<size_t>>> vectorSizeCheck = needsVectorSizeCheck( vectorParamIndices );
|
||||||
std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT";
|
std::string noexceptString = vectorSizeCheck.first ? "VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS" : "VULKAN_HPP_NOEXCEPT";
|
||||||
|
|
||||||
@ -5489,9 +5550,7 @@ std::string VulkanHppGenerator::constructFunctionBodyEnhanced( std::string const
|
|||||||
indentation,
|
indentation,
|
||||||
commandData,
|
commandData,
|
||||||
returnParamIndex,
|
returnParamIndex,
|
||||||
vectorParamIndices,
|
|
||||||
enhancedReturnType,
|
enhancedReturnType,
|
||||||
isStructureChain,
|
|
||||||
withAllocator );
|
withAllocator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,11 +323,16 @@ private:
|
|||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
std::pair<size_t, size_t> const & vectorParamIndex,
|
std::pair<size_t, size_t> const & vectorParamIndex,
|
||||||
bool definition ) const;
|
bool definition ) const;
|
||||||
void appendCommandGetChain( std::string & str,
|
void appendCommandGetChainResult( std::string & str,
|
||||||
std::string const & name,
|
std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
size_t nonConstPointerIndex,
|
size_t nonConstPointerIndex,
|
||||||
bool definition ) const;
|
bool definition ) const;
|
||||||
|
void appendCommandGetChainVoid( std::string & str,
|
||||||
|
std::string const & name,
|
||||||
|
CommandData const & commandData,
|
||||||
|
size_t nonConstPointerIndex,
|
||||||
|
bool definition ) const;
|
||||||
void appendCommandGetHandle( std::string & str,
|
void appendCommandGetHandle( std::string & str,
|
||||||
std::string const & name,
|
std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
@ -414,9 +419,7 @@ private:
|
|||||||
std::string const & indentation,
|
std::string const & indentation,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
size_t returnParamIndex,
|
size_t returnParamIndex,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
|
||||||
std::string const & enhancedReturnType,
|
std::string const & enhancedReturnType,
|
||||||
bool isStructureChain,
|
|
||||||
bool withAllocator ) const;
|
bool withAllocator ) const;
|
||||||
void appendFunctionBodyEnhancedMultiVectorSizeCheck( std::string & str,
|
void appendFunctionBodyEnhancedMultiVectorSizeCheck( std::string & str,
|
||||||
std::string const & indentation,
|
std::string const & indentation,
|
||||||
@ -562,6 +565,10 @@ private:
|
|||||||
std::map<size_t, size_t> const & vectorParamIndices,
|
std::map<size_t, size_t> const & vectorParamIndices,
|
||||||
bool definition,
|
bool definition,
|
||||||
bool withAllocators ) const;
|
bool withAllocators ) const;
|
||||||
|
std::string constructCommandResultGetChain( std::string const & name,
|
||||||
|
CommandData const & commandData,
|
||||||
|
size_t nonConstPointerIndex,
|
||||||
|
bool definition ) const;
|
||||||
std::string constructCommandResultGetHandleUnique( std::string const & name,
|
std::string constructCommandResultGetHandleUnique( std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
size_t nonConstPointerIndex,
|
size_t nonConstPointerIndex,
|
||||||
@ -614,15 +621,15 @@ private:
|
|||||||
bool definition ) const;
|
bool definition ) const;
|
||||||
std::string
|
std::string
|
||||||
constructCommandStandard( std::string const & name, CommandData const & commandData, bool definition ) const;
|
constructCommandStandard( std::string const & name, CommandData const & commandData, bool definition ) const;
|
||||||
std::string constructCommandType( std::string const & name,
|
std::string constructCommandType( std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
bool definition,
|
bool definition,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices ) const;
|
std::map<size_t, size_t> const & vectorParamIndices ) const;
|
||||||
std::string constructCommandVoid( std::string const & name,
|
std::string constructCommandVoid( std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
bool definition,
|
bool definition,
|
||||||
std::map<size_t, size_t> const & vectorParamIndices ) const;
|
std::map<size_t, size_t> const & vectorParamIndices ) const;
|
||||||
std::string constructCommandVoidEnumerate( std::string const & name,
|
std::string constructCommandVoidEnumerate( std::string const & name,
|
||||||
CommandData const & commandData,
|
CommandData const & commandData,
|
||||||
std::pair<size_t, size_t> const & vectorParamIndex,
|
std::pair<size_t, size_t> const & vectorParamIndex,
|
||||||
bool definition,
|
bool definition,
|
||||||
|
@ -97422,6 +97422,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return static_cast<Result>( d.vkGetAndroidHardwareBufferPropertiesANDROID(
|
return static_cast<Result>( d.vkGetAndroidHardwareBufferPropertiesANDROID(
|
||||||
m_device, buffer, reinterpret_cast<VkAndroidHardwareBufferPropertiesANDROID *>( pProperties ) ) );
|
m_device, buffer, reinterpret_cast<VkAndroidHardwareBufferPropertiesANDROID *>( pProperties ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
# ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch>
|
template <typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
||||||
@ -97434,6 +97435,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return createResultValue(
|
return createResultValue(
|
||||||
result, properties, VULKAN_HPP_NAMESPACE_STRING "::Device::getAndroidHardwareBufferPropertiesANDROID" );
|
result, properties, VULKAN_HPP_NAMESPACE_STRING "::Device::getAndroidHardwareBufferPropertiesANDROID" );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename X, typename Y, typename... Z, typename Dispatch>
|
template <typename X, typename Y, typename... Z, typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
||||||
Device::getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer, Dispatch const & d ) const
|
Device::getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer, Dispatch const & d ) const
|
||||||
@ -103899,6 +103901,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
reinterpret_cast<const VkPhysicalDeviceImageFormatInfo2 *>( pImageFormatInfo ),
|
reinterpret_cast<const VkPhysicalDeviceImageFormatInfo2 *>( pImageFormatInfo ),
|
||||||
reinterpret_cast<VkImageFormatProperties2 *>( pImageFormatProperties ) ) );
|
reinterpret_cast<VkImageFormatProperties2 *>( pImageFormatProperties ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch>
|
template <typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
||||||
@ -103914,6 +103917,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return createResultValue(
|
return createResultValue(
|
||||||
result, imageFormatProperties, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2" );
|
result, imageFormatProperties, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2" );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename X, typename Y, typename... Z, typename Dispatch>
|
template <typename X, typename Y, typename... Z, typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
||||||
PhysicalDevice::getImageFormatProperties2( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo,
|
PhysicalDevice::getImageFormatProperties2( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo,
|
||||||
@ -103942,6 +103946,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
reinterpret_cast<const VkPhysicalDeviceImageFormatInfo2 *>( pImageFormatInfo ),
|
reinterpret_cast<const VkPhysicalDeviceImageFormatInfo2 *>( pImageFormatInfo ),
|
||||||
reinterpret_cast<VkImageFormatProperties2 *>( pImageFormatProperties ) ) );
|
reinterpret_cast<VkImageFormatProperties2 *>( pImageFormatProperties ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch>
|
template <typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
||||||
@ -103957,6 +103962,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return createResultValue(
|
return createResultValue(
|
||||||
result, imageFormatProperties, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2KHR" );
|
result, imageFormatProperties, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2KHR" );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename X, typename Y, typename... Z, typename Dispatch>
|
template <typename X, typename Y, typename... Z, typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
||||||
PhysicalDevice::getImageFormatProperties2KHR( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo,
|
PhysicalDevice::getImageFormatProperties2KHR( const PhysicalDeviceImageFormatInfo2 & imageFormatInfo,
|
||||||
@ -104858,6 +104864,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
reinterpret_cast<const VkPhysicalDeviceSurfaceInfo2KHR *>( pSurfaceInfo ),
|
reinterpret_cast<const VkPhysicalDeviceSurfaceInfo2KHR *>( pSurfaceInfo ),
|
||||||
reinterpret_cast<VkSurfaceCapabilities2KHR *>( pSurfaceCapabilities ) ) );
|
reinterpret_cast<VkSurfaceCapabilities2KHR *>( pSurfaceCapabilities ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch>
|
template <typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
||||||
@ -104873,6 +104880,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return createResultValue(
|
return createResultValue(
|
||||||
result, surfaceCapabilities, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getSurfaceCapabilities2KHR" );
|
result, surfaceCapabilities, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getSurfaceCapabilities2KHR" );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename X, typename Y, typename... Z, typename Dispatch>
|
template <typename X, typename Y, typename... Z, typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<StructureChain<X, Y, Z...>>::type
|
||||||
PhysicalDevice::getSurfaceCapabilities2KHR( const PhysicalDeviceSurfaceInfo2KHR & surfaceInfo,
|
PhysicalDevice::getSurfaceCapabilities2KHR( const PhysicalDeviceSurfaceInfo2KHR & surfaceInfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user