mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #649 from mocabe/assert-on-result
Add VULKAN_HPP_ASSERT_ON_RESULT
This commit is contained in:
commit
d4774ad6e8
@ -402,7 +402,9 @@ std::vector<LayerProperties, MyStatefulCustomAllocator> properties = physicalDev
|
||||
|
||||
### Custom assertions
|
||||
|
||||
All over vulkan.hpp, there are a couple of calls to an assert function. By defining VULKAN_HPP_ASSERT, you can specifiy your own custom assert function to be called instead.
|
||||
All over vulkan.hpp, there are a couple of calls to an assert function. By defining `VULKAN_HPP_ASSERT`, you can specifiy your own custom assert function to be called instead.
|
||||
|
||||
By default, `VULKAN_HPP_ASSERT_ON_RESULT` will be used for checking results when `VULKAN_HPP_NO_EXCEPTIONS` is defined. If you want to handle errors by yourself, you can disable/customize it just like `VULKAN_HPP_ASSERT`.
|
||||
|
||||
### Extensions / Per Device function pointers
|
||||
|
||||
|
@ -7974,6 +7974,10 @@ int main( int argc, char ** argv )
|
||||
# define VULKAN_HPP_ASSERT assert
|
||||
#endif
|
||||
|
||||
#if !defined(VULKAN_HPP_ASSERT_ON_RESULT)
|
||||
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
|
||||
#endif
|
||||
|
||||
#if !defined(VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL)
|
||||
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
|
||||
#endif
|
||||
@ -8122,7 +8126,7 @@ namespace std
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore(message);
|
||||
VULKAN_HPP_ASSERT( result == Result::eSuccess );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return result;
|
||||
#else
|
||||
if ( result != Result::eSuccess )
|
||||
@ -8137,7 +8141,7 @@ namespace std
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore(message);
|
||||
VULKAN_HPP_ASSERT( result == Result::eSuccess );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return ResultValue<T>( result, std::move( data ) );
|
||||
#else
|
||||
if ( result != Result::eSuccess )
|
||||
@ -8152,7 +8156,7 @@ namespace std
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore(message);
|
||||
VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
#else
|
||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||
{
|
||||
@ -8167,7 +8171,7 @@ namespace std
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore(message);
|
||||
VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
#else
|
||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||
{
|
||||
@ -8183,7 +8187,7 @@ namespace std
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore(message);
|
||||
VULKAN_HPP_ASSERT( result == Result::eSuccess );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return ResultValue<UniqueHandle<T,D>>( result, UniqueHandle<T,D>(data, deleter) );
|
||||
#else
|
||||
if ( result != Result::eSuccess )
|
||||
@ -8199,7 +8203,7 @@ namespace std
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore(message);
|
||||
VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
return ResultValue<UniqueHandle<T,D>>( result, UniqueHandle<T,D>(data, deleter) );
|
||||
#else
|
||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||
|
@ -57,6 +57,10 @@
|
||||
# define VULKAN_HPP_ASSERT assert
|
||||
#endif
|
||||
|
||||
#if !defined( VULKAN_HPP_ASSERT_ON_RESULT )
|
||||
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
|
||||
#endif
|
||||
|
||||
#if !defined( VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL )
|
||||
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
|
||||
#endif
|
||||
@ -16144,7 +16148,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT( result == Result::eSuccess );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return result;
|
||||
#else
|
||||
if ( result != Result::eSuccess )
|
||||
@ -16159,7 +16163,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT( result == Result::eSuccess );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return ResultValue<T>( result, std::move( data ) );
|
||||
#else
|
||||
if ( result != Result::eSuccess )
|
||||
@ -16176,7 +16180,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
#else
|
||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||
{
|
||||
@ -16192,7 +16196,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
#else
|
||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||
{
|
||||
@ -16209,7 +16213,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT( result == Result::eSuccess );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return ResultValue<UniqueHandle<T, D>>( result, UniqueHandle<T, D>( data, deleter ) );
|
||||
# else
|
||||
if ( result != Result::eSuccess )
|
||||
@ -16230,7 +16234,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
return ResultValue<UniqueHandle<T, D>>( result, UniqueHandle<T, D>( data, deleter ) );
|
||||
# else
|
||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||
|
Loading…
Reference in New Issue
Block a user