use VULKAN_HPP_ASSERT instead of raw assert in generated code (#498)

* use VULKAN_HPP_ASSERT instead of raw assert in generated code

* update generated vulkan.hpp to match generator changes
This commit is contained in:
Anatoliy V. Tomilov 2020-01-30 13:57:51 +05:00 committed by GitHub
parent bca5adc12d
commit 7efe3d096b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 22 deletions

View File

@ -1123,7 +1123,7 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic(std::string & str)
#elif defined(_WIN32) #elif defined(_WIN32)
m_library = LoadLibrary( TEXT( "vulkan-1.dll" ) ); m_library = LoadLibrary( TEXT( "vulkan-1.dll" ) );
#else #else
assert( false && "unsupported platform" ); VULKAN_HPP_ASSERT( false && "unsupported platform" );
#endif #endif
m_success = m_library != 0; m_success = m_library != 0;
@ -4848,7 +4848,7 @@ int main(int argc, char **argv)
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch ); VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.destroy( t, m_allocationCallbacks, *m_dispatch ); m_owner.destroy( t, m_allocationCallbacks, *m_dispatch );
} }
@ -4880,7 +4880,7 @@ int main(int argc, char **argv)
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_dispatch ); VULKAN_HPP_ASSERT( m_dispatch );
t.destroy( m_allocationCallbacks, *m_dispatch ); t.destroy( m_allocationCallbacks, *m_dispatch );
} }
@ -4914,7 +4914,7 @@ int main(int argc, char **argv)
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch ); VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.free( t, m_allocationCallbacks, *m_dispatch ); m_owner.free( t, m_allocationCallbacks, *m_dispatch );
} }
@ -5060,15 +5060,15 @@ int main(int argc, char **argv)
static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!"); static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!");
static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to unlink the first element!"); static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to unlink the first element!");
VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>()); VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>());
assert(ptr != nullptr); VULKAN_HPP_ASSERT(ptr != nullptr);
VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext); VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext);
assert(*ppNext != nullptr); VULKAN_HPP_ASSERT(*ppNext != nullptr);
while (*ppNext != ptr) while (*ppNext != ptr)
{ {
ppNext = &(*ppNext)->pNext; ppNext = &(*ppNext)->pNext;
assert(*ppNext != nullptr); // fires, if the ClassType member has already been unlinked ! VULKAN_HPP_ASSERT(*ppNext != nullptr); // fires, if the ClassType member has already been unlinked !
} }
assert(*ppNext == ptr); VULKAN_HPP_ASSERT(*ppNext == ptr);
*ppNext = (*ppNext)->pNext; *ppNext = (*ppNext)->pNext;
} }
@ -5078,13 +5078,13 @@ int main(int argc, char **argv)
static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't relink Structure that's not part of this StructureChain!"); static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't relink Structure that's not part of this StructureChain!");
static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to have the first element unlinked!"); static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to have the first element unlinked!");
VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>()); VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>());
assert(ptr != nullptr); VULKAN_HPP_ASSERT(ptr != nullptr);
VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext); VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext);
assert(*ppNext != nullptr); VULKAN_HPP_ASSERT(*ppNext != nullptr);
#if !defined(NDEBUG) #if !defined(NDEBUG)
while (*ppNext) while (*ppNext)
{ {
assert(*ppNext != ptr); // fires, if the ClassType member has not been unlinked before VULKAN_HPP_ASSERT(*ppNext != ptr); // fires, if the ClassType member has not been unlinked before
ppNext = &(*ppNext)->pNext; ppNext = &(*ppNext)->pNext;
} }
ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext); ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext);

View File

@ -544,15 +544,15 @@ namespace VULKAN_HPP_NAMESPACE
static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!"); static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!");
static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to unlink the first element!"); static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to unlink the first element!");
VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>()); VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>());
assert(ptr != nullptr); VULKAN_HPP_ASSERT(ptr != nullptr);
VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext); VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext);
assert(*ppNext != nullptr); VULKAN_HPP_ASSERT(*ppNext != nullptr);
while (*ppNext != ptr) while (*ppNext != ptr)
{ {
ppNext = &(*ppNext)->pNext; ppNext = &(*ppNext)->pNext;
assert(*ppNext != nullptr); // fires, if the ClassType member has already been unlinked ! VULKAN_HPP_ASSERT(*ppNext != nullptr); // fires, if the ClassType member has already been unlinked !
} }
assert(*ppNext == ptr); VULKAN_HPP_ASSERT(*ppNext == ptr);
*ppNext = (*ppNext)->pNext; *ppNext = (*ppNext)->pNext;
} }
@ -562,13 +562,13 @@ namespace VULKAN_HPP_NAMESPACE
static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't relink Structure that's not part of this StructureChain!"); static_assert(isPartOfStructureChain<ClassType, StructureElements...>::valid, "Can't relink Structure that's not part of this StructureChain!");
static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to have the first element unlinked!"); static_assert(!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<StructureElements...>>::type>::value, "It's not allowed to have the first element unlinked!");
VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>()); VkBaseOutStructure * ptr = reinterpret_cast<VkBaseOutStructure*>(&get<ClassType>());
assert(ptr != nullptr); VULKAN_HPP_ASSERT(ptr != nullptr);
VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext); VkBaseOutStructure ** ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext);
assert(*ppNext != nullptr); VULKAN_HPP_ASSERT(*ppNext != nullptr);
#if !defined(NDEBUG) #if !defined(NDEBUG)
while (*ppNext) while (*ppNext)
{ {
assert(*ppNext != ptr); // fires, if the ClassType member has not been unlinked before VULKAN_HPP_ASSERT(*ppNext != ptr); // fires, if the ClassType member has not been unlinked before
ppNext = &(*ppNext)->pNext; ppNext = &(*ppNext)->pNext;
} }
ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext); ppNext = &(reinterpret_cast<VkBaseOutStructure*>(this)->pNext);
@ -2759,7 +2759,7 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch ); VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.destroy( t, m_allocationCallbacks, *m_dispatch ); m_owner.destroy( t, m_allocationCallbacks, *m_dispatch );
} }
@ -2791,7 +2791,7 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_dispatch ); VULKAN_HPP_ASSERT( m_dispatch );
t.destroy( m_allocationCallbacks, *m_dispatch ); t.destroy( m_allocationCallbacks, *m_dispatch );
} }
@ -2823,7 +2823,7 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch ); VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.free( t, m_allocationCallbacks, *m_dispatch ); m_owner.free( t, m_allocationCallbacks, *m_dispatch );
} }
@ -68062,7 +68062,7 @@ namespace VULKAN_HPP_NAMESPACE
#elif defined(_WIN32) #elif defined(_WIN32)
m_library = LoadLibrary( TEXT( "vulkan-1.dll" ) ); m_library = LoadLibrary( TEXT( "vulkan-1.dll" ) );
#else #else
assert( false && "unsupported platform" ); VULKAN_HPP_ASSERT( false && "unsupported platform" );
#endif #endif
m_success = m_library != 0; m_success = m_library != 0;