Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
foray_vulkan.hpp
Go to the documentation of this file.
1#pragma once
3#include "foray_basics.hpp"
4#include "foray_exception.hpp"
5#include <vulkan/vulkan.h>
6#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
7#define WIN32_LEAN_AND_MEAN
8#include <Windows.h>
9#include <vulkan/vulkan_win32.h>
10#undef max // Windows headers included hide std::max
11#undef min // Windows headers included hide std::max
12#undef CreateWindow //
13#endif
14
15namespace foray {
17 std::string PrintVkResult(VkResult result);
18
20 inline void AssertVkResult(VkResult result, const source_location location = source_location::current())
21 {
22 if(result != VK_SUCCESS)
23 {
24 Exception::Throw(location, "VkResult Assertion Failed: VkResult::{}", PrintVkResult(result));
25 }
26 }
27
33 void SetVulkanObjectName(core::Context* context, VkObjectType objectType, const void* objectHandle, std::string_view name);
34
35} // namespace foray
static void Throw(std::string_view reason, const source_location location=source_location::current())
Throws an exception.
std::source_location source_location
Definition foray_exception.hpp:8
Definition foray_api.hpp:19
std::string PrintVkResult(VkResult result)
Prints a VkResult. If outside of NAMEF_ENUM_RANGE_MAX, will only print number.
void SetVulkanObjectName(core::Context *context, VkObjectType objectType, const void *objectHandle, std::string_view name)
Set a vulkan object name (Will show up in validation errors, NSight, RenderDoc, .....
void AssertVkResult(VkResult result, const source_location location=source_location::current())
Asserts a VkResult (Fails if not VK_SUCCESS)
Definition foray_vulkan.hpp:20
Non owning context object.
Definition foray_context.hpp:16