TachyonUI
0.1.0
High-performance UI for building tools.
Toggle main menu visibility
Loading...
Searching...
No Matches
vk_types.h
Go to the documentation of this file.
1
// Core GPU resource types of the Vulkan backend: Vulkan handles (images, buffers)
2
// with their VMA allocations and metadata.
3
4
#pragma once
5
6
#include <
gui_core/gui_base_types.h
>
7
#include <
gui_core/diagnostics/gui_logging.h
>
8
9
#include <vulkan/vulkan.h>
10
#define VMA_DEBUG_LOG_FORMAT
11
#include <vk_mem_alloc.h>
12
13
#include <cstdio>
14
15
namespace
tachyon::vulkan
16
{
19
20
struct
AllocatedImage
21
{
22
VkImage
image
;
23
VkImageView
imageView
;
24
VmaAllocation
allocation
;
25
VkExtent3D
imageExtent
;
26
VkFormat
imageFormat
;
27
};
28
29
struct
AllocatedBuffer
30
{
31
VkBuffer
buffer
;
32
VmaAllocation
allocation
;
33
VmaAllocationInfo
info
;
34
};
35
38
void
OnVulkanError
(VkResult result,
const
char
* call);
39
bool
IsDeviceLost
();
40
void
SetDeviceLost
(
bool
lost);
41
42
#define TACHYON_VK_CHECK(x) \
43
do \
44
{ \
45
const VkResult tachyon_vk_result = (x); \
46
if (tachyon_vk_result != VK_SUCCESS) \
47
::tachyon::vulkan::OnVulkanError(tachyon_vk_result, #x); \
48
} while (0)
49
53
inline
void
WaitForFence
(VkDevice device, VkFence fence)
54
{
55
VkResult result;
56
do
57
{
58
result = vkWaitForFences(device, 1, &fence, VK_TRUE, 1000000000);
59
}
while
(result == VK_TIMEOUT);
60
TACHYON_VK_CHECK
(result);
61
}
62
63
}
TACHYON_VK_CHECK
#define TACHYON_VK_CHECK(x)
Definition
vk_types.h:42
tachyon::vulkan::OnVulkanError
void OnVulkanError(VkResult result, const char *call)
Logs a failed Vulkan call; the frame carries on.
tachyon::vulkan::SetDeviceLost
void SetDeviceLost(bool lost)
tachyon::vulkan::IsDeviceLost
bool IsDeviceLost()
tachyon::vulkan::WaitForFence
void WaitForFence(VkDevice device, VkFence fence)
Waits for fence however long the GPU takes: VK_TIMEOUT only means the GPU is slow (a busy or stalled ...
Definition
vk_types.h:53
gui_base_types.h
gui_logging.h
tachyon::vulkan
Definition
vk_defaults.h:4
tachyon::vulkan::AllocatedBuffer
Definition
vk_types.h:30
tachyon::vulkan::AllocatedBuffer::allocation
VmaAllocation allocation
Definition
vk_types.h:32
tachyon::vulkan::AllocatedBuffer::buffer
VkBuffer buffer
Definition
vk_types.h:31
tachyon::vulkan::AllocatedBuffer::info
VmaAllocationInfo info
Definition
vk_types.h:33
tachyon::vulkan::AllocatedImage
Definition
vk_types.h:21
tachyon::vulkan::AllocatedImage::image
VkImage image
Definition
vk_types.h:22
tachyon::vulkan::AllocatedImage::imageView
VkImageView imageView
Definition
vk_types.h:23
tachyon::vulkan::AllocatedImage::imageFormat
VkFormat imageFormat
Definition
vk_types.h:26
tachyon::vulkan::AllocatedImage::allocation
VmaAllocation allocation
Definition
vk_types.h:24
tachyon::vulkan::AllocatedImage::imageExtent
VkExtent3D imageExtent
Definition
vk_types.h:25
gui_core
graphics
vulkan
vk_types.h
Generated by
1.18.0