Files
mxl-multiviewer/VulkanUtils.hpp
T
2026-05-18 01:26:21 +03:00

92 lines
2.2 KiB
C++

#pragma once
#include <vulkan/vulkan.h>
#include <cstdint>
uint32_t findMemoryType(
VkPhysicalDevice physicalDevice,
uint32_t typeFilter,
VkMemoryPropertyFlags properties);
uint32_t findMemoryTypeWithPreferred(
VkPhysicalDevice physicalDevice,
uint32_t typeFilter,
VkMemoryPropertyFlags requiredProperties,
VkMemoryPropertyFlags preferredProperties,
VkMemoryPropertyFlags& selectedProperties);
void createBuffer(
VkDevice device,
VkPhysicalDevice physicalDevice,
VkDeviceSize size,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags properties,
VkBuffer& buffer,
VkDeviceMemory& bufferMemory);
void createBufferWithPreferredMemory(
VkDevice device,
VkPhysicalDevice physicalDevice,
VkDeviceSize size,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags requiredProperties,
VkMemoryPropertyFlags preferredProperties,
VkBuffer& buffer,
VkDeviceMemory& bufferMemory,
VkMemoryPropertyFlags& selectedProperties);
VkCommandBuffer beginSingleTimeCommands(
VkDevice device,
VkCommandPool commandPool);
void endSingleTimeCommands(
VkDevice device,
VkCommandPool commandPool,
VkQueue graphicsQueue,
VkCommandBuffer commandBuffer);
void createImage(
VkDevice device,
VkPhysicalDevice physicalDevice,
uint32_t width,
uint32_t height,
VkFormat format,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkMemoryPropertyFlags properties,
VkImage& image,
VkDeviceMemory& imageMemory);
void recordImageLayoutTransition(
VkCommandBuffer commandBuffer,
VkImage image,
VkFormat format,
VkImageLayout oldLayout,
VkImageLayout newLayout);
void transitionImageLayout(
VkDevice device,
VkCommandPool commandPool,
VkQueue graphicsQueue,
VkImage image,
VkFormat format,
VkImageLayout oldLayout,
VkImageLayout newLayout);
void recordCopyBufferToImage(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkImage image,
uint32_t width,
uint32_t height);
void copyBufferToImage(
VkDevice device,
VkCommandPool commandPool,
VkQueue graphicsQueue,
VkBuffer buffer,
VkImage image,
uint32_t width,
uint32_t height);