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(call, ...) new in Git master
Assert that a Vulkan function call succeeds or returns any of the specified results.

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(call, ...) new in Git master

Assert that a Vulkan function call succeeds or returns any of the specified results.

A variant of MAGNUM_VK_INTERNAL_ASSERT_SUCCESS() that allows the call to return any of the specified results in addition to Result::Success. The variadic argument accepts any number of Result values, the macro then returns the actual result value. Example usage:

const Vk::Result result = MAGNUM_VK_INTERNAL_ASSERT_SUCCESS_OR(
    vkGetFenceStatus(device, fence),
    Vk::Result::NotReady);
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.