diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 67a4ebf..c210f61 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -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 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 const & vectorParamIndex, - bool definition ) const + bool definition, + std::pair 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 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 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" ); @@ -4931,7 +4944,7 @@ std::string std::string str; std::set 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 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 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 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 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 VulkanHppGenerator::determineSkippedParams( std::string const & handleType, std::vector const & params, std::map const & vectorParamIndices, - std::vector const & returnParamIndices ) const + std::vector const & returnParamIndices, bool singular ) const { std::set skippedParams = { returnParamIndices.begin(), returnParamIndices.end() }; @@ -7326,7 +7338,7 @@ std::set 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 ); } diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 19f2767..47383a0 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -320,9 +320,9 @@ private: void appendCommandSingular( std::string & str, std::string const & name, CommandData const & commandData, + bool definition, std::map 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 const & vectorParamIndex, - bool definition ) const; + bool definition, + std::pair 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 const & params, std::set 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 const & vectorParamIndices, bool twoStep ) const; std::set determineSkippedParams( std::string const & handleType, std::vector const & params, std::map const & vectorParamIndices, - std::vector const & returnParamIndex ) const; + std::vector const & returnParamIndex, + bool singular ) const; std::string determineSubStruct( std::pair const & structure ) const; size_t determineTemplateParamIndex( std::vector const & params, std::map const & vectorParamIndices ) const; diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 21cbe86..49984fa 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -55995,6 +55995,22 @@ namespace VULKAN_HPP_NAMESPACE ArrayProxy const & data, size_t stride, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + template , + typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType>::type + writeAccelerationStructuresPropertiesKHR( + ArrayProxy const & accelerationStructures, + VULKAN_HPP_NAMESPACE::QueryType queryType, + size_t dataSize, + size_t stride, + Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + template + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType::type writeAccelerationStructuresPropertyKHR( + ArrayProxy 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( d.vkGetAccelerationStructureHandleNV( m_device, static_cast( accelerationStructure ), - data.size(), + data.size() * sizeof( T ), reinterpret_cast( data.data() ) ) ); return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getAccelerationStructureHandleNV" ); } @@ -100245,7 +100261,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( queryPool ), firstQuery, queryCount, - data.size(), + data.size() * sizeof( T ), reinterpret_cast( data.data() ), static_cast( stride ), static_cast( flags ) ) ); @@ -100331,7 +100347,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( pipeline ), firstGroup, groupCount, - data.size(), + data.size() * sizeof( T ), reinterpret_cast( data.data() ) ) ); return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getRayTracingCaptureReplayShaderGroupHandlesKHR" ); @@ -100408,7 +100424,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( pipeline ), firstGroup, groupCount, - data.size(), + data.size() * sizeof( T ), reinterpret_cast( data.data() ) ) ); return createResultValue( result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::getRayTracingShaderGroupHandlesKHR" ); @@ -100482,7 +100498,7 @@ namespace VULKAN_HPP_NAMESPACE static_cast( pipeline ), firstGroup, groupCount, - data.size(), + data.size() * sizeof( T ), reinterpret_cast( 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 - VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::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::type Device::writeAccelerationStructuresPropertiesKHR( ArrayProxy const & accelerationStructures, VULKAN_HPP_NAMESPACE::QueryType queryType, ArrayProxy const & data, @@ -101821,6 +101839,50 @@ namespace VULKAN_HPP_NAMESPACE return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertiesKHR" ); } + + template + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType>::type + Device::writeAccelerationStructuresPropertiesKHR( + ArrayProxy 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 data( dataSize / sizeof( T ) ); + Result result = static_cast( d.vkWriteAccelerationStructuresPropertiesKHR( + m_device, + accelerationStructures.size(), + reinterpret_cast( accelerationStructures.data() ), + static_cast( queryType ), + data.size() * sizeof( T ), + reinterpret_cast( data.data() ), + stride ) ); + return createResultValue( + result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertiesKHR" ); + } + + template + VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType::type + Device::writeAccelerationStructuresPropertyKHR( + ArrayProxy const & accelerationStructures, + VULKAN_HPP_NAMESPACE::QueryType queryType, + size_t stride, + Dispatch const & d ) const + { + T data; + Result result = static_cast( d.vkWriteAccelerationStructuresPropertiesKHR( + m_device, + 1, + reinterpret_cast( &accelerationStructure ), + static_cast( queryType ), + sizeof( T ), + reinterpret_cast( &data ), + stride ) ); + return createResultValue( + result, data, VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertyKHR" ); + } # endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VK_ENABLE_BETA_EXTENSIONS*/