RavEngine
Loading...
Searching...
No Matches
RGLVk.hpp
1# pragma once
2
3//#define RECONSTRUCT // uncomment to enable gfxreconstruct
4//#define APIDUMP // uncomment to enable command logging
5
6#include <RGL/Types.hpp>
7#include "RGLCommon.hpp"
8#include <RGL/TextureFormat.hpp>
9#include <RGL/Pipeline.hpp>
10#include <volk.h>
11
12#if __has_include(<vulkan/vk_enum_string_helper.h>)
13#include <vulkan/vk_enum_string_helper.h>
14#endif
15#include <cassert>
16
17struct VmaAllocation_T;
18
19#define VK_CHECK(a) {auto VK_CHECK_RESULT = a; Assert(VK_CHECK_RESULT == VK_SUCCESS, std::string("Vulkan assertion failed: ") + # a + " -> " + string_VkResult(VK_CHECK_RESULT));}
20#define VK_VALID(a) {assert(a != VK_NULL_HANDLE);}
21
22constexpr static const char* const validationLayers[] = {
23 "VK_LAYER_KHRONOS_validation",
24#ifdef RECONSTRUCT
25 "VK_LAYER_LUNARG_gfxreconstruct"
26#endif
27#ifdef APIDUMP
28 "VK_LAYER_LUNARG_api_dump",
29#endif
30};
31
32
33namespace RGL {
34 void InitVk(const InitOptions&);
35 void DeinitVk();
36
37 bool IsValidationEnabled();
38
39 struct DeviceVk;
40
41 extern VkInstance instance;
42
44 VkSurfaceCapabilitiesKHR capabilities;
45 std::vector<VkSurfaceFormatKHR> formats;
46 std::vector<VkPresentModeKHR> presentModes;
47 };
48 SwapChainSupportDetails querySwapChainSupport(const VkPhysicalDevice device, const VkSurfaceKHR surface);
49
50 enum class MSASampleCount : uint8_t;
51 VkSampleCountFlagBits RGLMSA2VK(const RGL::MSASampleCount& samplecount);
52
53 VkFormat RGL2VkTextureFormat(TextureFormat);
54
55 uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties, VkPhysicalDevice physicalDevice);
56
57 VmaAllocation_T* createBuffer(DeviceVk*, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer& buffer);
58
59 VkCommandBuffer beginSingleTimeCommands(VkDevice device, VkCommandPool commandPool);
60 void endSingleTimeCommands(VkCommandBuffer commandBuffer, VkQueue graphicsQueue, VkDevice device, VkCommandPool commandPool);
61
62 RGLRenderPassPtr CreateRenderPassVk(const RenderPassConfig& config);
63
64 VkImageLayout rgl2vkImageLayout(RGL::ResourceLayout layout);
65
66 VkShaderStageFlagBits RGL2VKshader(RGL::ShaderStageDesc::Type type);
67}
Definition VkDevice.hpp:23
Definition RenderPass.hpp:11
Definition RGLVk.hpp:43