Vulkan2D
2D renderer written in C using Vulkan and SDL2
VulkanInterface.h File Reference

Tools to allow the user to mess with vulkan themselves. More...

#include "VK2D/Structs.h"
#include <VulkanMemoryAllocator/src/VmaUsage.h>
Include dependency graph for VulkanInterface.h:

Go to the source code of this file.

Macros

#define VMA_VULKAN_VERSION   1002000
 

Functions

VkCommandBuffer vk2dVulkanGetSingleUseBuffer ()
 Returns a command buffer intended to be used once. More...
 
void vk2dVulkanSubmitSingleUseBuffer (VkCommandBuffer buffer)
 Submits a command buffer previously acquired with vk2dVulkanGetSingleUseBuffer and waits for the queue to finish. More...
 
VkCommandBuffer vk2dVulkanGetDrawBuffer ()
 Returns the command buffer being used to draw the active frame. More...
 
void vk2dVulkanCopyDataIntoBuffer (void *data, VkDeviceSize size, VkBuffer *outBuffer, VkDeviceSize *bufferOffset)
 Copies arbitrary data into a device-local buffer that can then be accessed from command buffers. More...
 
int vk2dVulkanGetFrame ()
 Returns the current frame being rendered. More...
 
int vk2dVulkanGetSwapchainImageIndex ()
 Returns the current swapchain image being used this frame. More...
 
VkDevice vk2dVulkanGetDevice ()
 Returns the logical device. More...
 
VkPhysicalDevice vk2dVulkanGetPhysicalDevice ()
 Returns the renderer-selected physical device. More...
 
VkQueue vk2dVulkanGetQueue ()
 Returns the queue being used for everything. More...
 
uint32_t vk2dVulkanGetQueueFamily ()
 Returns the queue family in use. More...
 
uint32_t vk2dVulkanGetSwapchainImageCount ()
 Returns the swapchain image count. More...
 
uint32_t vk2dVulkanGetMaxFramesInFlight ()
 Returns the maximum number of frames in flight allowed at once. More...
 
VmaAllocator vk2dVulkanGetVMA ()
 Returns the VMA instance. More...
 

Detailed Description

Tools to allow the user to mess with vulkan themselves.

Author
Paolo Mazzon

Function Documentation

◆ vk2dVulkanCopyDataIntoBuffer()

void vk2dVulkanCopyDataIntoBuffer ( void *  data,
VkDeviceSize  size,
VkBuffer *  outBuffer,
VkDeviceSize *  bufferOffset 
)

Copies arbitrary data into a device-local buffer that can then be accessed from command buffers.

Parameters
dataData to copy to the gpu
sizeSize of the data in bytes
outBufferDevice-local Vulkan buffer that the data will be available on
bufferOffsetOffset in outBuffer data can be accessed from, will follow uniform buffer alignment rules
Warning
You may not pass data of size larger than the vramPageSize specified when you initialized the renderer
The buffer the data is copied into is only intended for uniform buffers and vertex buffers
Data copied into a buffer like this is only valid for a single frame; you must use this every frame

◆ vk2dVulkanGetDevice()

VkDevice vk2dVulkanGetDevice ( )

Returns the logical device.

Returns
Returns the logical device

◆ vk2dVulkanGetDrawBuffer()

VkCommandBuffer vk2dVulkanGetDrawBuffer ( )

Returns the command buffer being used to draw the active frame.

Returns
Returns a command buffer in the recording state
Warning
This is only valid until the next time another VK2D function is called
The draw buffer is guaranteed to be in a render pass but there is no guarantee on which one

◆ vk2dVulkanGetFrame()

int vk2dVulkanGetFrame ( )

Returns the current frame being rendered.

Returns
Returns the current frame being rendered

◆ vk2dVulkanGetMaxFramesInFlight()

uint32_t vk2dVulkanGetMaxFramesInFlight ( )

Returns the maximum number of frames in flight allowed at once.

Returns
Returns the maximum number of frames in flight allowed at once

◆ vk2dVulkanGetPhysicalDevice()

VkPhysicalDevice vk2dVulkanGetPhysicalDevice ( )

Returns the renderer-selected physical device.

Returns
Returns the renderer-selected physical device

◆ vk2dVulkanGetQueue()

VkQueue vk2dVulkanGetQueue ( )

Returns the queue being used for everything.

Returns
Returns the queue being used for everything

◆ vk2dVulkanGetQueueFamily()

uint32_t vk2dVulkanGetQueueFamily ( )

Returns the queue family in use.

Returns
Returns the queue family in use

◆ vk2dVulkanGetSingleUseBuffer()

VkCommandBuffer vk2dVulkanGetSingleUseBuffer ( )

Returns a command buffer intended to be used once.

Returns
Returns a new command buffer in the recording state

◆ vk2dVulkanGetSwapchainImageCount()

uint32_t vk2dVulkanGetSwapchainImageCount ( )

Returns the swapchain image count.

Returns
Returns the swapchain image count

◆ vk2dVulkanGetSwapchainImageIndex()

int vk2dVulkanGetSwapchainImageIndex ( )

Returns the current swapchain image being used this frame.

Returns
Returns the current swapchain image being used this frame

◆ vk2dVulkanGetVMA()

VmaAllocator vk2dVulkanGetVMA ( )

Returns the VMA instance.

Returns
Returns the VMA instance

◆ vk2dVulkanSubmitSingleUseBuffer()

void vk2dVulkanSubmitSingleUseBuffer ( VkCommandBuffer  buffer)

Submits a command buffer previously acquired with vk2dVulkanGetSingleUseBuffer and waits for the queue to finish.

Parameters
bufferCommand buffer previously acquired with vk2dVulkanGetSingleUseBuffer