Remove VULKAN_HPP_NOEXCEPT from functions that throw a LogicError. (#416)

This commit is contained in:
Andreas Süßenbach 2019-10-30 10:10:32 +01:00 committed by Markus Tavenrath
parent 68b11f1e90
commit 9f7b06cbd1
2 changed files with 32 additions and 14 deletions

View File

@ -1403,6 +1403,24 @@ void VulkanHppGenerator::appendForwardDeclarations(std::string & str) const
} }
} }
bool needsMultiVectorSizeCheck(size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices)
{
for (std::map<size_t, size_t>::const_iterator it0 = vectorParamIndices.begin(); it0 != vectorParamIndices.end(); ++it0)
{
if (it0->first != returnParamIndex)
{
for (std::map<size_t, size_t>::const_iterator it1 = std::next(it0); it1 != vectorParamIndices.end(); ++it1)
{
if ((it1->first != returnParamIndex) && (it0->second == it1->second))
{
return true;
}
}
}
}
return false;
}
void VulkanHppGenerator::appendFunction(std::string & str, std::string const& indentation, std::string const& name, std::pair<std::string, CommandData> const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, std::string const& enhancedReturnType, bool definition, bool enhanced, bool singular, bool unique, bool isStructureChain, bool withAllocator) const void VulkanHppGenerator::appendFunction(std::string & str, std::string const& indentation, std::string const& name, std::pair<std::string, CommandData> const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, std::string const& enhancedReturnType, bool definition, bool enhanced, bool singular, bool unique, bool isStructureChain, bool withAllocator) const
{ {
appendFunctionHeaderTemplate(str, indentation, returnParamIndex, templateParamIndex, enhancedReturnType, enhanced, singular, unique, !definition, isStructureChain); appendFunctionHeaderTemplate(str, indentation, returnParamIndex, templateParamIndex, enhancedReturnType, enhanced, singular, unique, !definition, isStructureChain);
@ -1428,9 +1446,9 @@ void VulkanHppGenerator::appendFunction(std::string & str, std::string const& in
appendFunctionHeaderArguments(str, commandData, returnParamIndex, templateParamIndex, vectorParamIndices, enhanced, singular, !definition, withAllocator); appendFunctionHeaderArguments(str, commandData, returnParamIndex, templateParamIndex, vectorParamIndices, enhanced, singular, !definition, withAllocator);
// Any function that originally does not return VkResult can be marked noexcept, // Any function that originally does not return VkResult can be marked noexcept,
// if it is enhanced it musnt't include anything with an Allocator // if it is enhanced it musnt't include anything with an Allocator or needs size checks on multiple vectors
bool hasAllocator = enhancedReturnType.find("Allocator") != std::string::npos; bool hasAllocator = enhancedReturnType.find("Allocator") != std::string::npos;
if (commandData.second.returnType != "VkResult" && (!enhanced || !hasAllocator)) if (commandData.second.returnType != "VkResult" && !(enhanced && (hasAllocator || needsMultiVectorSizeCheck(returnParamIndex, vectorParamIndices))))
{ {
str += " VULKAN_HPP_NOEXCEPT"; str += " VULKAN_HPP_NOEXCEPT";
} }

View File

@ -14787,7 +14787,7 @@ namespace VULKAN_HPP_NAMESPACE
void beginTransformFeedbackEXT( uint32_t firstCounterBuffer, uint32_t counterBufferCount, const vk::Buffer* pCounterBuffers, const vk::DeviceSize* pCounterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void beginTransformFeedbackEXT( uint32_t firstCounterBuffer, uint32_t counterBufferCount, const vk::Buffer* pCounterBuffers, const vk::DeviceSize* pCounterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void beginTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void beginTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
@ -14810,14 +14810,14 @@ namespace VULKAN_HPP_NAMESPACE
void bindTransformFeedbackBuffersEXT( uint32_t firstBinding, uint32_t bindingCount, const vk::Buffer* pBuffers, const vk::DeviceSize* pOffsets, const vk::DeviceSize* pSizes, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void bindTransformFeedbackBuffersEXT( uint32_t firstBinding, uint32_t bindingCount, const vk::Buffer* pBuffers, const vk::DeviceSize* pOffsets, const vk::DeviceSize* pSizes, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void bindTransformFeedbackBuffersEXT( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, ArrayProxy<const vk::DeviceSize> sizes, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void bindTransformFeedbackBuffersEXT( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, ArrayProxy<const vk::DeviceSize> sizes, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void bindVertexBuffers( uint32_t firstBinding, uint32_t bindingCount, const vk::Buffer* pBuffers, const vk::DeviceSize* pOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void bindVertexBuffers( uint32_t firstBinding, uint32_t bindingCount, const vk::Buffer* pBuffers, const vk::DeviceSize* pOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void bindVertexBuffers( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void bindVertexBuffers( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
@ -14980,7 +14980,7 @@ namespace VULKAN_HPP_NAMESPACE
void endTransformFeedbackEXT( uint32_t firstCounterBuffer, uint32_t counterBufferCount, const vk::Buffer* pCounterBuffers, const vk::DeviceSize* pCounterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void endTransformFeedbackEXT( uint32_t firstCounterBuffer, uint32_t counterBufferCount, const vk::Buffer* pCounterBuffers, const vk::DeviceSize* pCounterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void endTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void endTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
@ -18104,7 +18104,7 @@ namespace VULKAN_HPP_NAMESPACE
void setHdrMetadataEXT( uint32_t swapchainCount, const vk::SwapchainKHR* pSwapchains, const vk::HdrMetadataEXT* pMetadata, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void setHdrMetadataEXT( uint32_t swapchainCount, const vk::SwapchainKHR* pSwapchains, const vk::HdrMetadataEXT* pMetadata, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void setHdrMetadataEXT( ArrayProxy<const vk::SwapchainKHR> swapchains, ArrayProxy<const vk::HdrMetadataEXT> metadata, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void setHdrMetadataEXT( ArrayProxy<const vk::SwapchainKHR> swapchains, ArrayProxy<const vk::HdrMetadataEXT> metadata, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
@ -19119,7 +19119,7 @@ namespace VULKAN_HPP_NAMESPACE
void debugReportMessageEXT( vk::DebugReportFlagsEXT flags, vk::DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void debugReportMessageEXT( vk::DebugReportFlagsEXT flags, vk::DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void debugReportMessageEXT( vk::DebugReportFlagsEXT flags, vk::DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const std::string & layerPrefix, const std::string & message, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const VULKAN_HPP_NOEXCEPT; void debugReportMessageEXT( vk::DebugReportFlagsEXT flags, vk::DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const std::string & layerPrefix, const std::string & message, Dispatch const &d = VULKAN_HPP_DEFAULT_DISPATCHER ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template<typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
@ -65629,7 +65629,7 @@ namespace VULKAN_HPP_NAMESPACE
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch> template<typename Dispatch>
VULKAN_HPP_INLINE void CommandBuffer::beginTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_INLINE void CommandBuffer::beginTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d ) const
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
VULKAN_HPP_ASSERT( counterBuffers.size() == counterBufferOffsets.size() ); VULKAN_HPP_ASSERT( counterBuffers.size() == counterBufferOffsets.size() );
@ -65705,7 +65705,7 @@ namespace VULKAN_HPP_NAMESPACE
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch> template<typename Dispatch>
VULKAN_HPP_INLINE void CommandBuffer::bindTransformFeedbackBuffersEXT( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, ArrayProxy<const vk::DeviceSize> sizes, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_INLINE void CommandBuffer::bindTransformFeedbackBuffersEXT( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, ArrayProxy<const vk::DeviceSize> sizes, Dispatch const &d ) const
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
VULKAN_HPP_ASSERT( buffers.size() == offsets.size() ); VULKAN_HPP_ASSERT( buffers.size() == offsets.size() );
@ -65742,7 +65742,7 @@ namespace VULKAN_HPP_NAMESPACE
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch> template<typename Dispatch>
VULKAN_HPP_INLINE void CommandBuffer::bindVertexBuffers( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_INLINE void CommandBuffer::bindVertexBuffers( uint32_t firstBinding, ArrayProxy<const vk::Buffer> buffers, ArrayProxy<const vk::DeviceSize> offsets, Dispatch const &d ) const
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
VULKAN_HPP_ASSERT( buffers.size() == offsets.size() ); VULKAN_HPP_ASSERT( buffers.size() == offsets.size() );
@ -66255,7 +66255,7 @@ namespace VULKAN_HPP_NAMESPACE
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch> template<typename Dispatch>
VULKAN_HPP_INLINE void CommandBuffer::endTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_INLINE void CommandBuffer::endTransformFeedbackEXT( uint32_t firstCounterBuffer, ArrayProxy<const vk::Buffer> counterBuffers, ArrayProxy<const vk::DeviceSize> counterBufferOffsets, Dispatch const &d ) const
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
VULKAN_HPP_ASSERT( counterBuffers.size() == counterBufferOffsets.size() ); VULKAN_HPP_ASSERT( counterBuffers.size() == counterBufferOffsets.size() );
@ -70669,7 +70669,7 @@ namespace VULKAN_HPP_NAMESPACE
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch> template<typename Dispatch>
VULKAN_HPP_INLINE void Device::setHdrMetadataEXT( ArrayProxy<const vk::SwapchainKHR> swapchains, ArrayProxy<const vk::HdrMetadataEXT> metadata, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_INLINE void Device::setHdrMetadataEXT( ArrayProxy<const vk::SwapchainKHR> swapchains, ArrayProxy<const vk::HdrMetadataEXT> metadata, Dispatch const &d ) const
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
VULKAN_HPP_ASSERT( swapchains.size() == metadata.size() ); VULKAN_HPP_ASSERT( swapchains.size() == metadata.size() );
@ -71277,7 +71277,7 @@ namespace VULKAN_HPP_NAMESPACE
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template<typename Dispatch> template<typename Dispatch>
VULKAN_HPP_INLINE void Instance::debugReportMessageEXT( vk::DebugReportFlagsEXT flags, vk::DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const std::string & layerPrefix, const std::string & message, Dispatch const &d ) const VULKAN_HPP_NOEXCEPT VULKAN_HPP_INLINE void Instance::debugReportMessageEXT( vk::DebugReportFlagsEXT flags, vk::DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const std::string & layerPrefix, const std::string & message, Dispatch const &d ) const
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
VULKAN_HPP_ASSERT( layerPrefix.size() == message.size() ); VULKAN_HPP_ASSERT( layerPrefix.size() == message.size() );