Magnum/Vk/Assert.h file new in Git master

Macro MAGNUM_VK_INTERNAL_ASSERT_SUCCESS(), MAGNUM_VK_INTERNAL_ASSERT_SUCCESS_OR()

Contents

Defines

#define MAGNUM_VK_INTERNAL_ASSERT_SUCCESS(call) new in Git master
Assert that a Vulkan function call succeeds.
#define MAGNUM_VK_INTERNAL_ASSERT_SUCCESS_OR(result, call) new in Git master
Assert that a Vulkan function call succeeds or returns the specified result.

Define documentation

#define MAGNUM_VK_INTERNAL_ASSERT_SUCCESS(call) new in Git master

Assert that a Vulkan function call succeeds.

Compared to using CORRADE_INTERNAL_ASSERT_OUTPUT() to verify that call == VK_SUCCESS, this macro also prints the result value. Otherwise the behavior is the same, including interactions with CORRADE_STANDARD_ASSERT and CORRADE_NO_ASSERT. Works with both plain Vulkan functions returning VkResult and APIs returning Vk::Result.

You can override this implementation by placing your own #define MAGNUM_VK_INTERNAL_ASSERT_SUCCESS before including the Magnum/Vk/Assert.h header.

#define MAGNUM_VK_INTERNAL_ASSERT_SUCCESS_OR(result, call) new in Git master

Assert that a Vulkan function call succeeds or returns the specified result.

A variant of MAGNUM_VK_INTERNAL_ASSERT_SUCCESS() that allows the call to return specified result in addition to Vk::Result::Success. The value specified in result is directly the (unscoped) enum value and the macro returns the actual result value. Example usage:

const Vk::Result result = MAGNUM_VK_INTERNAL_ASSERT_SUCCESS_OR(NotReady,
    vkGetFenceStatus(device, fence));
if(result == Vk::Result::Success) {
    // signaled
} else {
    // Vk::Result::NotReady, not signaled yet
}

Similarly to CORRADE_INTERNAL_ASSERT_EXPRESSION() this macro is usable in any expression such as if and return statements. You can override this implementation by placing your own #define MAGNUM_VK_INTERNAL_ASSERT_SUCCESS_OR before including the Magnum/Vk/Assert.h header.