Go to the documentation of this file.
32 #include <vulkan/vulkan.h>
91 #define QVVKTEXTURE_INIT { \
92 .image = VK_NULL_HANDLE, \
93 .allocation = VK_NULL_HANDLE, \
94 .allocInfo = VK_NULL_HANDLE, \
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, \
104 #define QVVKTEXTURE_CLEAR(i) { \
105 (i).image = VK_NULL_HANDLE; \
106 (i).allocation = VK_NULL_HANDLE; \
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; \
172 #define QVKPIPELINE_INIT { \
173 .layout = VK_NULL_HANDLE, \
174 .pl = VK_NULL_HANDLE, \
176 .mode = VK_POLYGON_MODE_FILL, \
177 .cullMode = VK_CULL_MODE_BACK_BIT, \
178 .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, \
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 \
189 .depthTestEnable = VK_TRUE, \
190 .depthWriteEnable = VK_TRUE \
274 VkResult
QVk_CreateImageView(
const VkImage *image, VkImageAspectFlags aspectFlags, VkImageView *imageView, VkFormat
format, uint32_t mipLevels);
284 void QVk_SubmitCommand(
const VkCommandBuffer *commandBuffer,
const VkQueue *queue);
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);
300 uint8_t*
QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, 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);
310 #if defined(_DEBUG) || defined(ENABLE_DEBUG_LABELS)
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);
315 void QVk_DebugLabelInsert(
const VkCommandBuffer *cmdBuffer,
const char *labelName,
const float r,
const float g,
const float b);
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)
uint8_t * QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset)
#define QVk_DebugSetObjectName(a, b, c)
PFN_vkCmdInsertDebugUtilsLabelEXT qvkInsertDebugUtilsLabelEXT
VkCommandBuffer cmdBuffer
VkPipelineCreateFlags flags
#define QVk_DebugLabelBegin(a, b, c, d, e)
qvkpipeline_t vk_drawSkyboxPipeline
qvkpipeline_t vk_drawSpritePipeline
VkFormat QVk_FindDepthFormat(void)
void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rpType)
VkResult QVk_BeginFrame(void)
qvktexture_t vk_colorbuffer
uint8_t * QVk_GetStagingBuffer(VkDeviceSize size, int alignment, VkCommandBuffer *cmdBuffer, VkBuffer *buffer, uint32_t *dstOffset)
VkPipelineShaderStageCreateInfo createInfo
PFN_vkCmdEndDebugUtilsLabelEXT qvkCmdEndDebugUtilsLabelEXT
qvkpipeline_t vk_drawLefthandModelPipelineFan
void QVk_CreateVertexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, qvkbuffer_t *stagingBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
PFN_vkSetDebugUtilsObjectTagEXT qvkSetDebugUtilsObjectTagEXT
void QVk_CreateColorBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *colorBuffer, int extraFlags)
VkPhysicalDeviceProperties properties
VkSampler QVk_UpdateTextureSampler(qvktexture_t *texture, qvksampler_t samplerType)
void QVk_CreateValidationLayers(void)
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount)
VmaAllocationCreateFlags vmaFlags
VkResult QVk_CreateSwapchain(void)
Represents main object of this library initialized.
qvkpipeline_t vk_drawParticlesPipeline
VkResult QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
qvkpipeline_t vk_drawModelPipelineFan[2]
PFN_vkSetDebugUtilsObjectNameEXT qvkSetDebugUtilsObjectNameEXT
VkDescriptorSetLayout vk_samplerDescSetLayout
qvkpipeline_t vk_drawNoDepthModelPipelineFan
VkSharingMode sharingMode
void QVk_RecreateSwapchain(void)
qvkpipeline_t vk_drawLefthandModelPipelineStrip
qvktexture_t vk_colorbufferWarp
qvkpipeline_t vk_drawTexQuadPipeline
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)
VkMemoryPropertyFlags prefMemFlags
qvkpipeline_t vk_drawNoDepthModelPipelineStrip
VkPrimitiveTopology topology
uint8_t * QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
qvkshader_t QVk_CreateShader(const uint32_t *shaderSrc, size_t shaderCodeSize, VkShaderStageFlagBits shaderStage)
qvkpipeline_t vk_postprocessPipeline
void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
VkDescriptorSet descriptorSet
VkCommandPool vk_transferCommandPool
VkAttachmentLoadOp colorLoadOp
qvkpipeline_t vk_drawPolyWarpPipeline
VkCommandPool vk_commandPool
void QVk_ReleaseTexture(qvktexture_t *texture)
qboolean QVk_CreateDevice(int preferredDeviceIdx)
VkResult QVk_CreateImageView(const VkImage *image, VkImageAspectFlags aspectFlags, VkImageView *imageView, VkFormat format, uint32_t mipLevels)
VmaAllocationInfo allocInfo
VkSampleCountFlagBits sampleCount
Represents single memory allocation.
uint8_t * QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet)
#define QVk_DebugLabelInsert(a, b, c, d, e)
qvkpipeline_t vk_drawPointParticlesPipeline
VkPipelineColorBlendAttachmentState blendOpts
qvkswapchain_t vk_swapchain
qvkpipeline_t vk_drawNullModelPipeline
VkCommandBuffer vk_activeCmdbuffer
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType)
qvkpipeline_t vk_drawPolyPipeline
VkResult QVk_CreateImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VmaMemoryUsage memUsage, qvktexture_t *texture)
#define QVk_DebugLabelEnd(a)
VkDeviceSize currentOffset
VkPhysicalDeviceFeatures features
PFN_vkCreateDebugUtilsMessengerEXT qvkCreateDebugUtilsMessengerEXT
void QVk_SubmitCommand(const VkCommandBuffer *commandBuffer, const VkQueue *queue)
qvkpipeline_t vk_worldWarpPipeline
#define QVk_DebugSetObjectTag(a, b, c, d, e)
VkDescriptorSetLayout vk_uboDescSetLayout
PFN_vkCmdBeginDebugUtilsLabelEXT qvkCmdBeginDebugUtilsLabelEXT
void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height)
qvkpipeline_t vk_drawColorQuadPipeline[2]
VkBool32 depthWriteEnable
VkResult QVk_BeginCommand(const VkCommandBuffer *commandBuffer)
VmaAllocationInfo allocInfo
void QVk_FreeBuffer(qvkbuffer_t *buffer)
qvkpipeline_t vk_drawBeamPipeline
VkCommandBuffer QVk_CreateCommandBuffer(const VkCommandPool *commandPool, VkCommandBufferLevel level)
VkPresentModeKHR presentMode
qvkpipeline_t vk_showTrisPipeline
VkResult QVk_CreateStagingBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
qvkpipeline_t vk_shadowsPipelineStrip
qvkpipeline_t vk_drawPolyLmapPipeline
VkResult QVk_EndFrame(qboolean force)
VkSampleCountFlagBits sampleCount
qvkpipeline_t vk_drawModelPipelineStrip[2]
void QVk_CreateDepthBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *depthBuffer)
void QVk_ReadPixels(uint8_t *dstBuffer, uint32_t width, uint32_t height)
void QVk_BindPipeline(qvkpipeline_t *pipeline)
void QVk_DestroyPipeline(qvkpipeline_t *pipeline)
void QVk_DrawTexRect(float *ubo, VkDeviceSize uboSize, qvktexture_t *texture)
VkResult QVk_CreateCommandPool(VkCommandPool *commandPool, uint32_t queueFamilyIndex)
VkFlags VmaAllocationCreateFlags
qvkpipeline_t vk_shadowsPipelineFan
VkDescriptorPool vk_descriptorPool
VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbufferopts_t options)
VmaAllocationCreateFlags vmaFlags
VkMemoryPropertyFlags reqMemFlags
PFN_vkDestroyDebugUtilsMessengerEXT qvkDestroyDebugUtilsMessengerEXT
qvkpipeline_t vk_drawDLightPipeline
void QVk_CreateIndexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, qvkbuffer_t *stagingBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
void QVk_SubmitStagingBuffers(void)
void QVk_DestroyValidationLayers(void)
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
VkPhysicalDevice physical
const char * QVk_GetError(VkResult errorCode)