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

74 lines
1.6 KiB
C++

#pragma once
#include <vulkan/vulkan.h>
#include <cstdint>
uint32_t findMemoryType(
VkPhysicalDevice physicalDevice,
uint32_t typeFilter,
VkMemoryPropertyFlags properties);
void createBuffer(
VkDevice device,
VkPhysicalDevice physicalDevice,
VkDeviceSize size,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags properties,
VkBuffer& buffer,
VkDeviceMemory& bufferMemory);
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);