Hymn to Beauty
C++ 3D Engine
Video::Utility Namespace Reference

Utility functions. More...

Functions

uint32_t FindMemoryType (VkPhysicalDevice physicalDevice, uint32_t typeFilter, VkMemoryPropertyFlags properties)
 Find the memory type to use for a certain allocation. More...
 
void CreateBuffer (VkDevice device, VkPhysicalDevice physicalDevice, unsigned int size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memoryProperties, VkBuffer *buffer, VkDeviceMemory *deviceMemory)
 Create a buffer. More...
 
void CreateImage2D (VkDevice device, VkPhysicalDevice physicalDevice, const glm::uvec2 &size, uint32_t mipLevels, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags memoryProperties, VkImage *image, VkDeviceMemory *deviceMemory)
 Create a 2D image, allocate and bind device memory to it. More...
 
void TransitionImage (VkCommandBuffer commandBuffer, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout)
 Record transitioning an image into a command buffer. More...
 

Detailed Description

Utility functions.

Function Documentation

◆ CreateBuffer()

void Video::Utility::CreateBuffer ( VkDevice  device,
VkPhysicalDevice  physicalDevice,
unsigned int  size,
VkBufferUsageFlags  usage,
VkMemoryPropertyFlags  memoryProperties,
VkBuffer *  buffer,
VkDeviceMemory *  deviceMemory 
)

Create a buffer.

Parameters
deviceThe Vulkan device.
physicalDeviceThe physical device from which to allocate memory.
sizeThe size of the buffer.
usageHow the buffer will be used.
memoryPropertiesMemory properties.
bufferThe output buffer.
deviceMemoryThe output device memory.

◆ CreateImage2D()

void Video::Utility::CreateImage2D ( VkDevice  device,
VkPhysicalDevice  physicalDevice,
const glm::uvec2 &  size,
uint32_t  mipLevels,
VkFormat  format,
VkImageTiling  tiling,
VkImageUsageFlags  usage,
VkMemoryPropertyFlags  memoryProperties,
VkImage *  image,
VkDeviceMemory *  deviceMemory 
)

Create a 2D image, allocate and bind device memory to it.

Parameters
deviceThe Vulkan device.
physicalDeviceThe physical device from which to allocate memory.
sizeThe image dimensions.
mipLevelsThe number of mip levels in the image.
formatThe format of the image.
tilingImage tiling.
usageHow the image will be used.
memoryPropertiesMemory properties.
imageThe output image.
deviceMemoryThe output device memory.

◆ FindMemoryType()

uint32_t Video::Utility::FindMemoryType ( VkPhysicalDevice  physicalDevice,
uint32_t  typeFilter,
VkMemoryPropertyFlags  properties 
)

Find the memory type to use for a certain allocation.

Parameters
physicalDeviceThe physical device.
typeFilterFilter of suitable memory types.
propertiesMemory properties.
Returns
The memory type to use.

◆ TransitionImage()

void Video::Utility::TransitionImage ( VkCommandBuffer  commandBuffer,
VkImage  image,
VkImageLayout  oldLayout,
VkImageLayout  newLayout 
)

Record transitioning an image into a command buffer.

Parameters
commandBufferThe command buffer to record the transition into.
imageThe image to transition.
oldLayoutThe old layout of the image.
newLayoutThe new layout of the image.