mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-27 06:10:08 +00:00
Refactor command that returns a vector of data and potentially gets vector(s) of data as input.
This commit is contained in:
parent
ede635596c
commit
5168ba6a11
@ -631,7 +631,14 @@ std::string stripPluralS( std::string const & name )
|
||||
size_t pos = strippedName.rfind( 's' );
|
||||
if ( pos != std::string::npos )
|
||||
{
|
||||
strippedName.erase( pos, 1 );
|
||||
if ( ( 2 <= pos ) && ( strippedName.substr( pos - 2, 3 ) == "ies" ) )
|
||||
{
|
||||
strippedName.replace( pos - 2, 3, "y" );
|
||||
}
|
||||
else
|
||||
{
|
||||
strippedName.erase( pos, 1 );
|
||||
}
|
||||
}
|
||||
return strippedName;
|
||||
}
|
||||
@ -1229,13 +1236,12 @@ void VulkanHppGenerator::appendCommand( std::string & str,
|
||||
appendedFunction = true;
|
||||
}
|
||||
}
|
||||
else if ( ( vectorParamIndices.size() == 1 ) &&
|
||||
( commandData.params[returnVectorParamIt->first].type.type == "void" ) &&
|
||||
else if ( ( commandData.params[returnVectorParamIt->first].type.type == "void" ) &&
|
||||
( commandData.params[returnVectorParamIt->second].type.isValue() ) )
|
||||
{
|
||||
// provide standard, enhanced, and singular calls
|
||||
appendCommandSingular(
|
||||
str, name, commandData, vectorParamIndices, nonConstPointerParamIndices[0], definition );
|
||||
str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices[0] );
|
||||
appendedFunction = true;
|
||||
}
|
||||
}
|
||||
@ -1262,7 +1268,7 @@ void VulkanHppGenerator::appendCommand( std::string & str,
|
||||
if ( ( commandData.returnType == "VkResult" ) || ( commandData.returnType == "void" ) )
|
||||
{
|
||||
// provide standard, enhanced, and vector calls
|
||||
appendCommandVector( str, name, commandData, *vectorParamIndexIt, definition );
|
||||
appendCommandVector( str, name, commandData, definition, *vectorParamIndexIt );
|
||||
appendedFunction = true;
|
||||
}
|
||||
}
|
||||
@ -1516,9 +1522,9 @@ ${leave})";
|
||||
void VulkanHppGenerator::appendCommandSingular( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
bool definition,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
size_t returnParamIndex,
|
||||
bool definition ) const
|
||||
size_t returnParamIndex ) const
|
||||
{
|
||||
assert( commandData.returnType == "VkResult" );
|
||||
|
||||
@ -1738,8 +1744,8 @@ ${leave})";
|
||||
void VulkanHppGenerator::appendCommandVector( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
std::pair<size_t, size_t> const & vectorParamIndex,
|
||||
bool definition ) const
|
||||
bool definition,
|
||||
std::pair<size_t, size_t> const & vectorParamIndex ) const
|
||||
{
|
||||
assert( ( commandData.returnType == "VkResult" ) || ( commandData.returnType == "void" ) );
|
||||
|
||||
@ -3878,6 +3884,10 @@ std::string VulkanHppGenerator::constructCallArgumentsGetVector( std::string con
|
||||
else if ( params[lenIt->second].type.isValue() )
|
||||
{
|
||||
arguments += startLowerCase( stripPrefix( params[lenIt->first].name, "p" ) ) + ".size()";
|
||||
if ( params[lenIt->first].type.type == "void" )
|
||||
{
|
||||
arguments += " * sizeof( T )";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4047,7 +4057,7 @@ std::string VulkanHppGenerator::constructCommandResultEnumerate( std::string con
|
||||
std::set<size_t> skippedParams = determineSkippedParams( commandData.handle,
|
||||
commandData.params,
|
||||
{ vectorParamIndices },
|
||||
{ vectorParamIndices.second, vectorParamIndices.first } );
|
||||
{ vectorParamIndices.second, vectorParamIndices.first }, false );
|
||||
|
||||
std::string argumentList =
|
||||
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, withAllocator );
|
||||
@ -4712,8 +4722,11 @@ std::string VulkanHppGenerator::constructCommandResultGetVector( std::string con
|
||||
|
||||
std::string str;
|
||||
|
||||
std::set<size_t> skippedParams =
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex }, false );
|
||||
|
||||
std::string argumentList =
|
||||
constructArgumentListEnhanced( commandData.params, { 0, returnParamIndex }, INVALID_INDEX, definition, false );
|
||||
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, false );
|
||||
std::string commandName = determineCommandName( name, commandData.params[0].type.type );
|
||||
std::string nodiscard = constructNoDiscardEnhanced( commandData );
|
||||
std::string returnType = constructReturnType( commandData, "std::vector<T,Allocator>" );
|
||||
@ -4931,7 +4944,7 @@ std::string
|
||||
std::string str;
|
||||
|
||||
std::set<size_t> skippedParams =
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex } );
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex }, false );
|
||||
|
||||
std::string argumentList =
|
||||
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, withAllocator );
|
||||
@ -5015,7 +5028,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesSingular
|
||||
std::string str;
|
||||
|
||||
std::set<size_t> skippedParams =
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex } );
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex }, true );
|
||||
size_t singularParam = ( returnParamIndex == vectorParamIndices.begin()->first )
|
||||
? std::next( vectorParamIndices.begin() )->first
|
||||
: vectorParamIndices.begin()->first;
|
||||
@ -5086,7 +5099,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUnique(
|
||||
std::string str;
|
||||
|
||||
std::set<size_t> skippedParams =
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex } );
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex }, false );
|
||||
|
||||
std::string argumentList =
|
||||
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, withAllocator );
|
||||
@ -5210,7 +5223,7 @@ std::string VulkanHppGenerator::constructCommandResultGetVectorOfHandlesUniqueSi
|
||||
std::string str;
|
||||
|
||||
std::set<size_t> skippedParams =
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex } );
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex }, true );
|
||||
size_t singularParam = ( returnParamIndex == vectorParamIndices.begin()->first )
|
||||
? std::next( vectorParamIndices.begin() )->first
|
||||
: vectorParamIndices.begin()->first;
|
||||
@ -5282,12 +5295,11 @@ std::string
|
||||
|
||||
std::string str;
|
||||
|
||||
std::string argumentList = constructArgumentListEnhanced(
|
||||
commandData.params,
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex } ),
|
||||
INVALID_INDEX,
|
||||
definition,
|
||||
false );
|
||||
std::set<size_t> skippedParams =
|
||||
determineSkippedParams( commandData.handle, commandData.params, vectorParamIndices, { returnParamIndex }, true );
|
||||
|
||||
std::string argumentList =
|
||||
constructArgumentListEnhanced( commandData.params, skippedParams, INVALID_INDEX, definition, false );
|
||||
std::string commandName = stripPluralS( determineCommandName( name, commandData.params[0].type.type ) );
|
||||
std::string nodiscard = constructNoDiscardEnhanced( commandData );
|
||||
std::string returnType = constructReturnType( commandData, "T" );
|
||||
@ -7312,7 +7324,7 @@ size_t VulkanHppGenerator::determineReturnParamIndex( CommandData const &
|
||||
std::set<size_t> VulkanHppGenerator::determineSkippedParams( std::string const & handleType,
|
||||
std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
std::vector<size_t> const & returnParamIndices ) const
|
||||
std::vector<size_t> const & returnParamIndices, bool singular ) const
|
||||
{
|
||||
std::set<size_t> skippedParams = { returnParamIndices.begin(), returnParamIndices.end() };
|
||||
|
||||
@ -7326,7 +7338,7 @@ std::set<size_t> VulkanHppGenerator::determineSkippedParams( std::string const &
|
||||
if ( ( std::find_if( returnParamIndices.begin(),
|
||||
returnParamIndices.end(),
|
||||
[&vpi]( size_t rpi ) { return vpi.first == rpi; } ) == returnParamIndices.end() ) ||
|
||||
params[vpi.second].type.isValue() )
|
||||
( singular && params[vpi.second].type.isValue() ) )
|
||||
{
|
||||
skippedParams.insert( vpi.second );
|
||||
}
|
||||
|
@ -320,9 +320,9 @@ private:
|
||||
void appendCommandSingular( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
bool definition,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
size_t returnParamIndex,
|
||||
bool definition ) const;
|
||||
size_t returnParamIndex ) const;
|
||||
void appendCommandStandard( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
@ -352,8 +352,8 @@ private:
|
||||
void appendCommandVector( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
std::pair<size_t, size_t> const & vectorParamIndex,
|
||||
bool definition ) const;
|
||||
bool definition,
|
||||
std::pair<size_t, size_t> const & vectorParamIndex ) const;
|
||||
void appendCommandVectorDeprecated( std::string & str,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
@ -679,16 +679,17 @@ private:
|
||||
bool containsUnion( std::string const & type ) const;
|
||||
size_t determineDefaultStartIndex( std::vector<ParamData> const & params,
|
||||
std::set<size_t> const & skippedParams ) const;
|
||||
std::string determineEnhancedReturnType( CommandData const & commandData,
|
||||
size_t returnParamIndex,
|
||||
bool isStructureChain ) const;
|
||||
std::string determineEnhancedReturnType( CommandData const & commandData,
|
||||
size_t returnParamIndex,
|
||||
bool isStructureChain ) const;
|
||||
size_t determineReturnParamIndex( CommandData const & commandData,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
bool twoStep ) const;
|
||||
std::set<size_t> determineSkippedParams( std::string const & handleType,
|
||||
std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
std::vector<size_t> const & returnParamIndex ) const;
|
||||
std::vector<size_t> const & returnParamIndex,
|
||||
bool singular ) const;
|
||||
std::string determineSubStruct( std::pair<std::string, StructureData> const & structure ) const;
|
||||
size_t determineTemplateParamIndex( std::vector<ParamData> const & params,
|
||||
std::map<size_t, size_t> const & vectorParamIndices ) const;
|
||||
|
@ -543,7 +543,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
return std::array<T, N>::operator[]( index );
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR T & operator[]( int index ) VULKAN_HPP_NOEXCEPT
|
||||
T & operator[]( int index ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return std::array<T, N>::operator[]( index );
|
||||
}
|
||||
@ -55995,6 +55995,22 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
ArrayProxy<T> const & data,
|
||||
size_t stride,
|
||||
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
|
||||
template <typename T,
|
||||
typename Allocator = std::allocator<T>,
|
||||
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<std::vector<T, Allocator>>::type
|
||||
writeAccelerationStructuresPropertiesKHR(
|
||||
ArrayProxy<const VULKAN_HPP_NAMESPACE::AccelerationStructureKHR> const & accelerationStructures,
|
||||
VULKAN_HPP_NAMESPACE::QueryType queryType,
|
||||
size_t dataSize,
|
||||
size_t stride,
|
||||
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
|
||||
template <typename T, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<T>::type writeAccelerationStructuresPropertyKHR(
|
||||
ArrayProxy<const VULKAN_HPP_NAMESPACE::AccelerationStructureKHR> const & accelerationStructures,
|
||||
VULKAN_HPP_NAMESPACE::QueryType queryType,
|
||||
size_t stride,
|
||||
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
|
||||
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
#endif /*VK_ENABLE_BETA_EXTENSIONS*/
|
||||
|
||||
@ -98139,7 +98155,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
Result result = static_cast<Result>(
|
||||
d.vkGetAccelerationStructureHandleNV( m_device,
|
||||
static_cast<VkAccelerationStructureKHR>( accelerationStructure ),
|
||||
data.size(),
|
||||
data.size() * sizeof( T ),
|
||||
reinterpret_cast<void *>( data.data() ) ) );
|
||||
return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getAccelerationStructureHandleNV" );
|
||||
}
|
||||
@ -100245,7 +100261,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
static_cast<VkQueryPool>( queryPool ),
|
||||
firstQuery,
|
||||
queryCount,
|
||||
data.size(),
|
||||
data.size() * sizeof( T ),
|
||||
reinterpret_cast<void *>( data.data() ),
|
||||
static_cast<VkDeviceSize>( stride ),
|
||||
static_cast<VkQueryResultFlags>( flags ) ) );
|
||||
@ -100331,7 +100347,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
static_cast<VkPipeline>( pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
data.size(),
|
||||
data.size() * sizeof( T ),
|
||||
reinterpret_cast<void *>( data.data() ) ) );
|
||||
return createResultValue(
|
||||
result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getRayTracingCaptureReplayShaderGroupHandlesKHR" );
|
||||
@ -100408,7 +100424,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
static_cast<VkPipeline>( pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
data.size(),
|
||||
data.size() * sizeof( T ),
|
||||
reinterpret_cast<void *>( data.data() ) ) );
|
||||
return createResultValue(
|
||||
result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getRayTracingShaderGroupHandlesKHR" );
|
||||
@ -100482,7 +100498,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
static_cast<VkPipeline>( pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
data.size(),
|
||||
data.size() * sizeof( T ),
|
||||
reinterpret_cast<void *>( data.data() ) ) );
|
||||
return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getRayTracingShaderGroupHandlesNV" );
|
||||
}
|
||||
@ -101800,10 +101816,12 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
pData,
|
||||
stride ) );
|
||||
}
|
||||
|
||||
# ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template <typename T, typename Dispatch>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type
|
||||
Device::writeAccelerationStructuresPropertiesKHR(
|
||||
VULKAN_HPP_DEPRECATED( "This function is deprecated. Use one of the other flavours of it." )
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
|
||||
typename ResultValueType<void>::type Device::writeAccelerationStructuresPropertiesKHR(
|
||||
ArrayProxy<const VULKAN_HPP_NAMESPACE::AccelerationStructureKHR> const & accelerationStructures,
|
||||
VULKAN_HPP_NAMESPACE::QueryType queryType,
|
||||
ArrayProxy<T> const & data,
|
||||
@ -101821,6 +101839,50 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
return createResultValue( result,
|
||||
VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertiesKHR" );
|
||||
}
|
||||
|
||||
template <typename T, typename Allocator, typename Dispatch>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<std::vector<T, Allocator>>::type
|
||||
Device::writeAccelerationStructuresPropertiesKHR(
|
||||
ArrayProxy<const VULKAN_HPP_NAMESPACE::AccelerationStructureKHR> const & accelerationStructures,
|
||||
VULKAN_HPP_NAMESPACE::QueryType queryType,
|
||||
size_t dataSize,
|
||||
size_t stride,
|
||||
Dispatch const & d ) const
|
||||
{
|
||||
VULKAN_HPP_ASSERT( dataSize % sizeof( T ) == 0 );
|
||||
std::vector<T, Allocator> data( dataSize / sizeof( T ) );
|
||||
Result result = static_cast<Result>( d.vkWriteAccelerationStructuresPropertiesKHR(
|
||||
m_device,
|
||||
accelerationStructures.size(),
|
||||
reinterpret_cast<const VkAccelerationStructureKHR *>( accelerationStructures.data() ),
|
||||
static_cast<VkQueryType>( queryType ),
|
||||
data.size() * sizeof( T ),
|
||||
reinterpret_cast<void *>( data.data() ),
|
||||
stride ) );
|
||||
return createResultValue(
|
||||
result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertiesKHR" );
|
||||
}
|
||||
|
||||
template <typename T, typename Dispatch>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<T>::type
|
||||
Device::writeAccelerationStructuresPropertyKHR(
|
||||
ArrayProxy<const VULKAN_HPP_NAMESPACE::AccelerationStructureKHR> const & accelerationStructures,
|
||||
VULKAN_HPP_NAMESPACE::QueryType queryType,
|
||||
size_t stride,
|
||||
Dispatch const & d ) const
|
||||
{
|
||||
T data;
|
||||
Result result = static_cast<Result>( d.vkWriteAccelerationStructuresPropertiesKHR(
|
||||
m_device,
|
||||
1,
|
||||
reinterpret_cast<const VkAccelerationStructureKHR *>( &accelerationStructure ),
|
||||
static_cast<VkQueryType>( queryType ),
|
||||
sizeof( T ),
|
||||
reinterpret_cast<void *>( &data ),
|
||||
stride ) );
|
||||
return createResultValue(
|
||||
result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertyKHR" );
|
||||
}
|
||||
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
#endif /*VK_ENABLE_BETA_EXTENSIONS*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user