vkQuake2 doxygen  1.0 dev
qvk.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 Copyright (C) 2018-2019 Krzysztof Kondrak
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14 See the GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 */
21 /*
22 ** QVK.H
23 */
24 
25 #ifndef __QVK_H__
26 #define __QVK_H__
27 
28 #ifdef _WIN32
29 # include <windows.h>
30 #endif
31 
32 #include <vulkan/vulkan.h>
33 #include "vk_mem_alloc.h"
34 #include "vk_shaders.h"
35 
36 // Vulkan device
37 typedef struct
38 {
39  VkPhysicalDevice physical;
40  VkDevice logical;
41  VkPhysicalDeviceProperties properties;
42  VkPhysicalDeviceFeatures features;
43  VkQueue gfxQueue;
44  VkQueue presentQueue;
45  VkQueue transferQueue;
49 } qvkdevice_t;
50 
51 // Vulkan swapchain
52 typedef struct
53 {
54  VkSwapchainKHR sc;
55  VkFormat format;
56  VkPresentModeKHR presentMode;
57  VkExtent2D extent;
58  VkImage *images;
61 
62 // available sampler types
63 typedef enum
64 {
65  S_NEAREST = 0,
66  S_LINEAR = 1,
74 } qvksampler_t;
75 
76 // texture object
77 typedef struct
78 {
79  VkImage image;
83  VkImageView imageView;
84  VkSharingMode sharingMode;
85  VkSampleCountFlagBits sampleCount;
86  VkFormat format;
87  VkDescriptorSet descriptorSet;
88  uint32_t mipLevels;
89 } qvktexture_t;
90 
91 #define QVVKTEXTURE_INIT { \
92  .image = VK_NULL_HANDLE, \
93  .allocation = VK_NULL_HANDLE, \
94  .allocInfo = VK_NULL_HANDLE, \
95  .vmaFlags = 0, \
96  .imageView = VK_NULL_HANDLE, \
97  .sharingMode = VK_SHARING_MODE_MAX_ENUM, \
98  .sampleCount = VK_SAMPLE_COUNT_1_BIT, \
99  .format = VK_FORMAT_R8G8B8A8_UNORM, \
100  .descriptorSet = VK_NULL_HANDLE, \
101  .mipLevels = 1, \
102 }
103 
104 #define QVVKTEXTURE_CLEAR(i) { \
105  (i).image = VK_NULL_HANDLE; \
106  (i).allocation = VK_NULL_HANDLE; \
107  (i).vmaFlags = 0; \
108  (i).imageView = VK_NULL_HANDLE; \
109  (i).sharingMode = VK_SHARING_MODE_MAX_ENUM; \
110  (i).sampleCount = VK_SAMPLE_COUNT_1_BIT; \
111  (i).format = VK_FORMAT_R8G8B8A8_UNORM; \
112  (i).mipLevels = 1; \
113 }
114 
115 // Vulkan renderpass
116 typedef struct
117 {
118  VkRenderPass rp;
119  VkAttachmentLoadOp colorLoadOp;
120  VkSampleCountFlagBits sampleCount;
122 
123 // Vulkan buffer
124 typedef struct
125 {
126  VkBuffer buffer;
129  VkDeviceSize currentOffset;
130 } qvkbuffer_t;
131 
132 // Vulkan staging buffer
133 typedef struct
134 {
136  VkCommandBuffer cmdBuffer;
137  VkFence fence;
140 
141 // Vulkan buffer options
142 typedef struct
143 {
144  VkBufferUsageFlags usage;
145  VkMemoryPropertyFlags reqMemFlags;
146  VkMemoryPropertyFlags prefMemFlags;
150 
151 // Vulkan pipeline
152 typedef struct
153 {
154  VkPipelineLayout layout;
155  VkPipeline pl;
156  VkPipelineCreateFlags flags;
157  VkPolygonMode mode;
158  VkCullModeFlags cullMode;
159  VkPrimitiveTopology topology;
160  VkPipelineColorBlendAttachmentState blendOpts;
161  VkBool32 depthTestEnable;
163 } qvkpipeline_t;
164 
165 // Vulkan shader
166 typedef struct
167 {
168  VkPipelineShaderStageCreateInfo createInfo;
169  VkShaderModule module;
170 } qvkshader_t;
171 
172 #define QVKPIPELINE_INIT { \
173  .layout = VK_NULL_HANDLE, \
174  .pl = VK_NULL_HANDLE, \
175  .flags = 0, \
176  .mode = VK_POLYGON_MODE_FILL, \
177  .cullMode = VK_CULL_MODE_BACK_BIT, \
178  .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, \
179  .blendOpts = { \
180  .blendEnable = VK_FALSE, \
181  .srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA, \
182  .dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, \
183  .colorBlendOp = VK_BLEND_OP_ADD, \
184  .srcAlphaBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA, \
185  .dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, \
186  .alphaBlendOp = VK_BLEND_OP_ADD, \
187  .colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT \
188  }, \
189  .depthTestEnable = VK_TRUE, \
190  .depthWriteEnable = VK_TRUE \
191 }
192 
193 // renderpass type
194 typedef enum
195 {
196  RP_WORLD = 0, // renders game world to offscreen buffer
197  RP_UI = 1, // render UI elements and game console
198  RP_WORLD_WARP = 2, // perform postprocessing on RP_WORLD (underwater screen warp)
201 
202 // Vulkan instance
203 extern VkInstance vk_instance;
204 // Vulkan surface
205 extern VkSurfaceKHR vk_surface;
206 // Vulkan device
207 extern qvkdevice_t vk_device;
208 // Vulkan memory allocator
209 extern VmaAllocator vk_malloc;
210 // Vulkan swapchain
212 // Vulkan command buffer currently in use
213 extern VkCommandBuffer vk_activeCmdbuffer;
214 // Vulkan command pools
215 extern VkCommandPool vk_commandPool;
216 extern VkCommandPool vk_transferCommandPool;
217 // Vulkan descriptor pool
218 extern VkDescriptorPool vk_descriptorPool;
219 
220 // Vulkan descriptor sets
221 extern VkDescriptorSetLayout vk_uboDescSetLayout;
222 extern VkDescriptorSetLayout vk_samplerDescSetLayout;
223 
224 // *** pipelines ***
248 
249 // color buffer containing main game/world view
251 // color buffer with postprocessed game view
253 // indicator if the frame is currently being rendered
255 
256 // function pointers
257 extern PFN_vkCreateDebugUtilsMessengerEXT qvkCreateDebugUtilsMessengerEXT;
258 extern PFN_vkDestroyDebugUtilsMessengerEXT qvkDestroyDebugUtilsMessengerEXT;
259 extern PFN_vkSetDebugUtilsObjectNameEXT qvkSetDebugUtilsObjectNameEXT;
260 extern PFN_vkSetDebugUtilsObjectTagEXT qvkSetDebugUtilsObjectTagEXT;
261 extern PFN_vkCmdBeginDebugUtilsLabelEXT qvkCmdBeginDebugUtilsLabelEXT;
262 extern PFN_vkCmdEndDebugUtilsLabelEXT qvkCmdEndDebugUtilsLabelEXT;
263 extern PFN_vkCmdInsertDebugUtilsLabelEXT qvkInsertDebugUtilsLabelEXT;
264 
265 // The Interface Functions (tm)
266 qboolean QVk_Init(void);
267 void QVk_Shutdown(void);
268 void QVk_CreateValidationLayers(void);
269 void QVk_DestroyValidationLayers(void);
270 qboolean QVk_CreateDevice(int preferredDeviceIdx);
271 VkResult QVk_CreateSwapchain(void);
272 VkFormat QVk_FindDepthFormat(void);
273 VkResult QVk_CreateCommandPool(VkCommandPool *commandPool, uint32_t queueFamilyIndex);
274 VkResult QVk_CreateImageView(const VkImage *image, VkImageAspectFlags aspectFlags, VkImageView *imageView, VkFormat format, uint32_t mipLevels);
275 VkResult QVk_CreateImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VmaMemoryUsage memUsage, qvktexture_t *texture);
276 void QVk_CreateDepthBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *depthBuffer);
277 void QVk_CreateColorBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *colorBuffer, int extraFlags);
278 void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType);
279 void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height);
282 void QVk_ReadPixels(uint8_t *dstBuffer, uint32_t width, uint32_t height);
283 VkResult QVk_BeginCommand(const VkCommandBuffer *commandBuffer);
284 void QVk_SubmitCommand(const VkCommandBuffer *commandBuffer, const VkQueue *queue);
285 VkCommandBuffer QVk_CreateCommandBuffer(const VkCommandPool *commandPool, VkCommandBufferLevel level);
286 const char* QVk_GetError(VkResult errorCode);
287 VkResult QVk_BeginFrame(void);
288 VkResult QVk_EndFrame(qboolean force);
290 void QVk_RecreateSwapchain(void);
291 VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbufferopts_t options);
293 VkResult QVk_CreateStagingBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
294 VkResult QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
295 void QVk_CreateVertexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, qvkbuffer_t *stagingBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
296 void QVk_CreateIndexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, qvkbuffer_t *stagingBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
297 qvkshader_t QVk_CreateShader(const uint32_t *shaderSrc, size_t shaderCodeSize, VkShaderStageFlagBits shaderStage);
298 void QVk_CreatePipeline(const VkDescriptorSetLayout *descriptorLayout, const uint32_t desLayoutCount, const VkPipelineVertexInputStateCreateInfo *vertexInputInfo, qvkpipeline_t *pipeline, const qvkrenderpass_t *renderpass, const qvkshader_t *shaders, uint32_t shaderCount, VkPushConstantRange *pcRange);
299 void QVk_DestroyPipeline(qvkpipeline_t *pipeline);
300 uint8_t* QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset);
301 uint8_t* QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset);
302 uint8_t* QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet);
303 uint8_t* QVk_GetStagingBuffer(VkDeviceSize size, int alignment, VkCommandBuffer *cmdBuffer, VkBuffer *buffer, uint32_t *dstOffset);
304 VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount);
305 void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rpType);
306 void QVk_DrawTexRect(float *ubo, VkDeviceSize uboSize, qvktexture_t *texture);
307 void QVk_BindPipeline(qvkpipeline_t *pipeline);
308 void QVk_SubmitStagingBuffers(void);
309 // debug label related functions
310 #if defined(_DEBUG) || defined(ENABLE_DEBUG_LABELS)
311 void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objName);
312 void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName, size_t tagSize, const void *tagData);
313 void QVk_DebugLabelBegin(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b);
314 void QVk_DebugLabelEnd(const VkCommandBuffer *cmdBuffer);
315 void QVk_DebugLabelInsert(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b);
316 #else
317 #define QVk_DebugSetObjectName(a, b, c)
318 #define QVk_DebugSetObjectTag(a, b, c, d, e)
319 #define QVk_DebugLabelBegin(a, b, c, d, e)
320 #define QVk_DebugLabelEnd(a)
321 #define QVk_DebugLabelInsert(a, b, c, d, e)
322 #endif
323 #endif
QVk_GetIndexBuffer
uint8_t * QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset)
Definition: vk_common.c:2058
QVk_DebugSetObjectName
#define QVk_DebugSetObjectName(a, b, c)
Definition: qvk.h:317
qvkshader_t
Definition: qvk.h:166
qvkdevice_t::gfxQueue
VkQueue gfxQueue
Definition: qvk.h:43
qvkpipeline_t::mode
VkPolygonMode mode
Definition: qvk.h:157
height
GLsizei height
Definition: qgl_win.c:69
qvkInsertDebugUtilsLabelEXT
PFN_vkCmdInsertDebugUtilsLabelEXT qvkInsertDebugUtilsLabelEXT
Definition: vk_common.c:172
QVk_Shutdown
void QVk_Shutdown(void)
Definition: vk_common.c:1376
qvkstagingbuffer_t::cmdBuffer
VkCommandBuffer cmdBuffer
Definition: qvk.h:136
qvkstagingbuffer_t::fence
VkFence fence
Definition: qvk.h:137
qvkdevice_t::logical
VkDevice logical
Definition: qvk.h:40
qvkbuffer_t::buffer
VkBuffer buffer
Definition: qvk.h:126
qvkpipeline_t::flags
VkPipelineCreateFlags flags
Definition: qvk.h:156
QVk_DebugLabelBegin
#define QVk_DebugLabelBegin(a, b, c, d, e)
Definition: qvk.h:319
vk_drawSkyboxPipeline
qvkpipeline_t vk_drawSkyboxPipeline
Definition: vk_common.c:154
vk_drawSpritePipeline
qvkpipeline_t vk_drawSpritePipeline
Definition: vk_common.c:149
QVk_FindDepthFormat
VkFormat QVk_FindDepthFormat(void)
Definition: vk_common.c:267
QVk_DrawColorRect
void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rpType)
Definition: vk_common.c:2253
qvkrenderpass_t::rp
VkRenderPass rp
Definition: qvk.h:118
QVk_BeginFrame
VkResult QVk_BeginFrame(void)
Definition: vk_common.c:1824
qvktexture_t::format
VkFormat format
Definition: qvk.h:86
vk_colorbuffer
qvktexture_t vk_colorbuffer
Definition: vk_common.c:104
qvkstagingbuffer_t::submitted
qboolean submitted
Definition: qvk.h:138
QVk_GetStagingBuffer
uint8_t * QVk_GetStagingBuffer(VkDeviceSize size, int alignment, VkCommandBuffer *cmdBuffer, VkBuffer *buffer, uint32_t *dstOffset)
Definition: vk_common.c:2153
vk_instance
VkInstance vk_instance
Definition: vk_common.c:46
qvkshader_t::createInfo
VkPipelineShaderStageCreateInfo createInfo
Definition: qvk.h:168
qvkpipeline_t
Definition: qvk.h:152
qvkCmdEndDebugUtilsLabelEXT
PFN_vkCmdEndDebugUtilsLabelEXT qvkCmdEndDebugUtilsLabelEXT
Definition: vk_common.c:171
vk_drawLefthandModelPipelineFan
qvkpipeline_t vk_drawLefthandModelPipelineFan
Definition: vk_common.c:145
QVk_CreateVertexBuffer
void QVk_CreateVertexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, qvkbuffer_t *stagingBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
Definition: vk_buffer.c:145
qvkSetDebugUtilsObjectTagEXT
PFN_vkSetDebugUtilsObjectTagEXT qvkSetDebugUtilsObjectTagEXT
Definition: vk_common.c:169
S_MIPMAP_NEAREST
@ S_MIPMAP_NEAREST
Definition: qvk.h:67
QVk_CreateColorBuffer
void QVk_CreateColorBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *colorBuffer, int extraFlags)
Definition: vk_image.c:367
qvkdevice_t
Definition: qvk.h:37
qvkdevice_t::properties
VkPhysicalDeviceProperties properties
Definition: qvk.h:41
QVk_UpdateTextureSampler
VkSampler QVk_UpdateTextureSampler(qvktexture_t *texture, qvksampler_t samplerType)
Definition: vk_common.c:2225
qboolean
qboolean
Definition: q_shared.h:63
QVk_CreateValidationLayers
void QVk_CreateValidationLayers(void)
Definition: vk_validation.c:74
QVk_GetTriangleFanIbo
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount)
Definition: vk_common.c:2198
qvktexture_t::vmaFlags
VmaAllocationCreateFlags vmaFlags
Definition: qvk.h:82
QVk_CreateSwapchain
VkResult QVk_CreateSwapchain(void)
Definition: vk_swapchain.c:117
VmaAllocator
Represents main object of this library initialized.
qvkstagingbuffer_t
Definition: qvk.h:133
RP_WORLD_WARP
@ RP_WORLD_WARP
Definition: qvk.h:198
buffer
GLenum GLfloat * buffer
Definition: qgl_win.c:151
vk_drawParticlesPipeline
qvkpipeline_t vk_drawParticlesPipeline
Definition: vk_common.c:147
qvkdevice_t::gfxFamilyIndex
int gfxFamilyIndex
Definition: qvk.h:46
QVk_CreateUniformBuffer
VkResult QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
Definition: vk_buffer.c:127
qvkrenderpass_t
Definition: qvk.h:116
width
GLint GLsizei width
Definition: qgl_win.c:115
qvkpipeline_t::pl
VkPipeline pl
Definition: qvk.h:155
VmaMemoryUsage
VmaMemoryUsage
Definition: vk_mem_alloc.h:2054
vk_drawModelPipelineFan
qvkpipeline_t vk_drawModelPipelineFan[2]
Definition: vk_common.c:141
qvkshader_t::module
VkShaderModule module
Definition: qvk.h:169
qvkSetDebugUtilsObjectNameEXT
PFN_vkSetDebugUtilsObjectNameEXT qvkSetDebugUtilsObjectNameEXT
Definition: vk_common.c:168
vk_samplerDescSetLayout
VkDescriptorSetLayout vk_samplerDescSetLayout
Definition: vk_common.c:261
vk_drawNoDepthModelPipelineFan
qvkpipeline_t vk_drawNoDepthModelPipelineFan
Definition: vk_common.c:143
qvktexture_t::sharingMode
VkSharingMode sharingMode
Definition: qvk.h:84
QVk_RecreateSwapchain
void QVk_RecreateSwapchain(void)
Definition: vk_common.c:2004
vk_drawLefthandModelPipelineStrip
qvkpipeline_t vk_drawLefthandModelPipelineStrip
Definition: vk_common.c:144
vk_colorbufferWarp
qvktexture_t vk_colorbufferWarp
Definition: vk_common.c:106
vk_drawTexQuadPipeline
qvkpipeline_t vk_drawTexQuadPipeline
Definition: vk_common.c:138
vk_device
qvkdevice_t vk_device
Definition: vk_common.c:51
QVk_CreatePipeline
void QVk_CreatePipeline(const VkDescriptorSetLayout *descriptorLayout, const uint32_t desLayoutCount, const VkPipelineVertexInputStateCreateInfo *vertexInputInfo, qvkpipeline_t *pipeline, const qvkrenderpass_t *renderpass, const qvkshader_t *shaders, uint32_t shaderCount, VkPushConstantRange *pcRange)
Definition: vk_pipeline.c:51
qvkbufferopts_t::prefMemFlags
VkMemoryPropertyFlags prefMemFlags
Definition: qvk.h:146
vk_drawNoDepthModelPipelineStrip
qvkpipeline_t vk_drawNoDepthModelPipelineStrip
Definition: vk_common.c:142
qvkpipeline_t::topology
VkPrimitiveTopology topology
Definition: qvk.h:159
QVk_GetVertexBuffer
uint8_t * QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
Definition: vk_common.c:2019
qvkdevice_t::presentFamilyIndex
int presentFamilyIndex
Definition: qvk.h:47
QVk_CreateShader
qvkshader_t QVk_CreateShader(const uint32_t *shaderSrc, size_t shaderCodeSize, VkShaderStageFlagBits shaderStage)
Definition: vk_pipeline.c:23
vk_postprocessPipeline
qvkpipeline_t vk_postprocessPipeline
Definition: vk_common.c:160
QVk_BeginRenderpass
void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
Definition: vk_common.c:1946
qvktexture_t::descriptorSet
VkDescriptorSet descriptorSet
Definition: qvk.h:87
vk_shaders.h
vk_transferCommandPool
VkCommandPool vk_transferCommandPool
Definition: vk_common.c:96
RP_COUNT
@ RP_COUNT
Definition: qvk.h:199
qvkrenderpass_t::colorLoadOp
VkAttachmentLoadOp colorLoadOp
Definition: qvk.h:119
vk_drawPolyWarpPipeline
qvkpipeline_t vk_drawPolyWarpPipeline
Definition: vk_common.c:152
vk_commandPool
VkCommandPool vk_commandPool
Definition: vk_common.c:95
QVk_ReleaseTexture
void QVk_ReleaseTexture(qvktexture_t *texture)
Definition: vk_image.c:448
QVk_CreateDevice
qboolean QVk_CreateDevice(int preferredDeviceIdx)
Definition: vk_device.c:264
QVk_CreateImageView
VkResult QVk_CreateImageView(const VkImage *image, VkImageAspectFlags aspectFlags, VkImageView *imageView, VkFormat format, uint32_t mipLevels)
Definition: vk_image.c:293
qvktexture_t::image
VkImage image
Definition: qvk.h:79
qvkswapchain_t::format
VkFormat format
Definition: qvk.h:55
qvkswapchain_t::extent
VkExtent2D extent
Definition: qvk.h:57
qvktexture_t::allocInfo
VmaAllocationInfo allocInfo
Definition: qvk.h:81
qvkrenderpasstype_t
qvkrenderpasstype_t
Definition: qvk.h:194
r
GLdouble GLdouble r
Definition: qgl_win.c:336
S_ANISO_MIPMAP_NEAREST
@ S_ANISO_MIPMAP_NEAREST
Definition: qvk.h:71
qvkbufferopts_t
Definition: qvk.h:142
qvktexture_t::sampleCount
VkSampleCountFlagBits sampleCount
Definition: qvk.h:85
VmaAllocation
Represents single memory allocation.
qvksampler_t
qvksampler_t
Definition: qvk.h:63
qvkpipeline_t::depthTestEnable
VkBool32 depthTestEnable
Definition: qvk.h:161
S_ANISO_NEAREST
@ S_ANISO_NEAREST
Definition: qvk.h:69
qvkbuffer_t
Definition: qvk.h:124
qvkpipeline_t::cullMode
VkCullModeFlags cullMode
Definition: qvk.h:158
QVk_GetUniformBuffer
uint8_t * QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet)
Definition: vk_common.c:2100
QVk_DebugLabelInsert
#define QVk_DebugLabelInsert(a, b, c, d, e)
Definition: qvk.h:321
vk_drawPointParticlesPipeline
qvkpipeline_t vk_drawPointParticlesPipeline
Definition: vk_common.c:148
qvkpipeline_t::blendOpts
VkPipelineColorBlendAttachmentState blendOpts
Definition: qvk.h:160
vk_swapchain
qvkswapchain_t vk_swapchain
Definition: vk_common.c:63
vk_drawNullModelPipeline
qvkpipeline_t vk_drawNullModelPipeline
Definition: vk_common.c:146
vk_activeCmdbuffer
VkCommandBuffer vk_activeCmdbuffer
Definition: vk_common.c:127
QVk_CreateTexture
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType)
Definition: vk_image.c:382
vk_drawPolyPipeline
qvkpipeline_t vk_drawPolyPipeline
Definition: vk_common.c:150
QVk_CreateImage
VkResult QVk_CreateImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VmaMemoryUsage memUsage, qvktexture_t *texture)
Definition: vk_image.c:316
QVk_DebugLabelEnd
#define QVk_DebugLabelEnd(a)
Definition: qvk.h:320
qvkswapchain_t::imageCount
int imageCount
Definition: qvk.h:59
qvkbuffer_t::currentOffset
VkDeviceSize currentOffset
Definition: qvk.h:129
qvkdevice_t::features
VkPhysicalDeviceFeatures features
Definition: qvk.h:42
qvkCreateDebugUtilsMessengerEXT
PFN_vkCreateDebugUtilsMessengerEXT qvkCreateDebugUtilsMessengerEXT
Definition: vk_common.c:166
QVk_SubmitCommand
void QVk_SubmitCommand(const VkCommandBuffer *commandBuffer, const VkQueue *queue)
Definition: vk_cmd.c:35
S_MIPMAP_LINEAR
@ S_MIPMAP_LINEAR
Definition: qvk.h:68
vk_worldWarpPipeline
qvkpipeline_t vk_worldWarpPipeline
Definition: vk_common.c:159
QVk_DebugSetObjectTag
#define QVk_DebugSetObjectTag(a, b, c, d, e)
Definition: qvk.h:318
vk_uboDescSetLayout
VkDescriptorSetLayout vk_uboDescSetLayout
Definition: vk_common.c:260
qvkCmdBeginDebugUtilsLabelEXT
PFN_vkCmdBeginDebugUtilsLabelEXT qvkCmdBeginDebugUtilsLabelEXT
Definition: vk_common.c:170
QVk_UpdateTextureData
void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height)
Definition: vk_image.c:402
qvktexture_t::imageView
VkImageView imageView
Definition: qvk.h:83
vk_drawColorQuadPipeline
qvkpipeline_t vk_drawColorQuadPipeline[2]
Definition: vk_common.c:139
qvkstagingbuffer_t::buffer
qvkbuffer_t buffer
Definition: qvk.h:135
qvkpipeline_t::depthWriteEnable
VkBool32 depthWriteEnable
Definition: qvk.h:162
qvkbuffer_t::allocation
VmaAllocation allocation
Definition: qvk.h:127
QVk_BeginCommand
VkResult QVk_BeginCommand(const VkCommandBuffer *commandBuffer)
Definition: vk_cmd.c:23
qvkbuffer_t::allocInfo
VmaAllocationInfo allocInfo
Definition: qvk.h:128
QVk_FreeBuffer
void QVk_FreeBuffer(qvkbuffer_t *buffer)
Definition: vk_buffer.c:106
vk_drawBeamPipeline
qvkpipeline_t vk_drawBeamPipeline
Definition: vk_common.c:153
QVk_CreateCommandBuffer
VkCommandBuffer QVk_CreateCommandBuffer(const VkCommandPool *commandPool, VkCommandBufferLevel level)
Definition: vk_cmd.c:78
qvkpipeline_t::layout
VkPipelineLayout layout
Definition: qvk.h:154
S_ANISO_MIPMAP_LINEAR
@ S_ANISO_MIPMAP_LINEAR
Definition: qvk.h:72
qvkswapchain_t::presentMode
VkPresentModeKHR presentMode
Definition: qvk.h:56
vk_showTrisPipeline
qvkpipeline_t vk_showTrisPipeline
Definition: vk_common.c:156
qvktexture_t::mipLevels
uint32_t mipLevels
Definition: qvk.h:88
qvkdevice_t::presentQueue
VkQueue presentQueue
Definition: qvk.h:44
QVk_CreateStagingBuffer
VkResult QVk_CreateStagingBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
Definition: vk_buffer.c:114
qvkswapchain_t::sc
VkSwapchainKHR sc
Definition: qvk.h:54
vk_mem_alloc.h
S_NEAREST
@ S_NEAREST
Definition: qvk.h:65
vk_shadowsPipelineStrip
qvkpipeline_t vk_shadowsPipelineStrip
Definition: vk_common.c:157
vk_drawPolyLmapPipeline
qvkpipeline_t vk_drawPolyLmapPipeline
Definition: vk_common.c:151
QVk_EndFrame
VkResult QVk_EndFrame(qboolean force)
Definition: vk_common.c:1880
qvkrenderpass_t::sampleCount
VkSampleCountFlagBits sampleCount
Definition: qvk.h:120
qvkswapchain_t::images
VkImage * images
Definition: qvk.h:58
vk_drawModelPipelineStrip
qvkpipeline_t vk_drawModelPipelineStrip[2]
Definition: vk_common.c:140
vk_frameStarted
qboolean vk_frameStarted
Definition: vk_common.c:135
S_ANISO_LINEAR
@ S_ANISO_LINEAR
Definition: qvk.h:70
RP_UI
@ RP_UI
Definition: qvk.h:197
QVk_CreateDepthBuffer
void QVk_CreateDepthBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *depthBuffer)
Definition: vk_image.c:352
QVk_ReadPixels
void QVk_ReadPixels(uint8_t *dstBuffer, uint32_t width, uint32_t height)
Definition: vk_image.c:465
QVk_BindPipeline
void QVk_BindPipeline(qvkpipeline_t *pipeline)
Definition: vk_common.c:2284
QVk_DestroyPipeline
void QVk_DestroyPipeline(qvkpipeline_t *pipeline)
Definition: vk_pipeline.c:198
vk_malloc
VmaAllocator vk_malloc
Definition: vk_common.c:48
S_SAMPLER_CNT
@ S_SAMPLER_CNT
Definition: qvk.h:73
level
GLint level
Definition: qgl_win.c:116
QVk_DrawTexRect
void QVk_DrawTexRect(float *ubo, VkDeviceSize uboSize, qvktexture_t *texture)
Definition: vk_common.c:2268
qvkbufferopts_t::usage
VkBufferUsageFlags usage
Definition: qvk.h:144
QVk_CreateCommandPool
VkResult QVk_CreateCommandPool(VkCommandPool *commandPool, uint32_t queueFamilyIndex)
Definition: vk_cmd.c:65
qvkswapchain_t
Definition: qvk.h:52
VmaAllocationCreateFlags
VkFlags VmaAllocationCreateFlags
Definition: vk_mem_alloc.h:2212
S_LINEAR
@ S_LINEAR
Definition: qvk.h:66
QVk_Init
qboolean QVk_Init(void)
Definition: vk_common.c:1510
vk_shadowsPipelineFan
qvkpipeline_t vk_shadowsPipelineFan
Definition: vk_common.c:158
vk_descriptorPool
VkDescriptorPool vk_descriptorPool
Definition: vk_common.c:97
format
GLsizei GLenum format
Definition: qgl_win.c:131
qvkbufferopts_t::vmaUsage
VmaMemoryUsage vmaUsage
Definition: qvk.h:147
qvkdevice_t::transferQueue
VkQueue transferQueue
Definition: qvk.h:45
vk_surface
VkSurfaceKHR vk_surface
Definition: vk_common.c:47
texture
GLuint texture
Definition: qgl_win.c:68
QVk_CreateBuffer
VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbufferopts_t options)
Definition: vk_buffer.c:70
qvkdevice_t::transferFamilyIndex
int transferFamilyIndex
Definition: qvk.h:48
qvkbufferopts_t::vmaFlags
VmaAllocationCreateFlags vmaFlags
Definition: qvk.h:148
qvktexture_t::allocation
VmaAllocation allocation
Definition: qvk.h:80
qvkbufferopts_t::reqMemFlags
VkMemoryPropertyFlags reqMemFlags
Definition: qvk.h:145
qvktexture_t
Definition: qvk.h:77
qvkDestroyDebugUtilsMessengerEXT
PFN_vkDestroyDebugUtilsMessengerEXT qvkDestroyDebugUtilsMessengerEXT
Definition: vk_common.c:167
RP_WORLD
@ RP_WORLD
Definition: qvk.h:196
vk_drawDLightPipeline
qvkpipeline_t vk_drawDLightPipeline
Definition: vk_common.c:155
QVk_CreateIndexBuffer
void QVk_CreateIndexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, qvkbuffer_t *stagingBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
Definition: vk_buffer.c:158
QVk_SubmitStagingBuffers
void QVk_SubmitStagingBuffers(void)
Definition: vk_common.c:2216
QVk_DestroyValidationLayers
void QVk_DestroyValidationLayers(void)
Definition: vk_validation.c:99
VmaAllocationInfo
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:2531
qvkdevice_t::physical
VkPhysicalDevice physical
Definition: qvk.h:39
QVk_GetError
const char * QVk_GetError(VkResult errorCode)
Definition: vk_common.c:2293