|
KarmaEngine
Game Engine for practical learning and research purposes
|
Manages Vulkan device resources and operations. More...
#include <VulkanDevice.h>
Public Member Functions | |
| FVulkanDevice (FVulkanDynamicRHI *InRHI, VkPhysicalDevice InGpu) | |
| Constructor for FVulkanDevice. | |
| ~FVulkanDevice () | |
| Destructor for FVulkanDevice. | |
| void | InitGPU () |
| Creates the Vulkan logical device and default vulkan resources. | |
| void | Destroy () |
| Destroys the logical vkdevice by making Vulkan API call. | |
| void | WaitUntilIdle () |
| Waits on the host by blocking the calling CPU thread until the Vulkan logical device completes all pending GPU operations across all queues. | |
| VkDevice | GetLogicalDevice () const |
| Retrieves the Vulkan logical device handle. | |
| VkPhysicalDevice | GetGPU () const |
| Retrieves the Vulkan physical device handle. | |
| VkCommandPool | GetCommandPool () const |
| Retrives the Vulkan command pool for the commandbuffers. | |
| void | TransitionImageLayout (VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout) |
| Transitions the layout of an image from oldLayout to newLayout. | |
| void | CopyBufferToImage (VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) |
| Copies data from a buffer to a Vulkan image. | |
| bool | HasStencilComponent (VkFormat format) |
| Checks if the given format has a stencil component. | |
| void | InitializeDefaultDescriptorSets (uint32_t MaxFramesInFlight) |
| VkQueue | GetGraphicsQueue () const |
| Getter for the graphics queue created in FVulkanDevice::InitGPU(). | |
| FVulkanDynamicRHI * | GetVulkanDynamicRHI () const |
| Getter for the present queue created in FVulkanDevice::InitGPU(). | |
| FVulkanFenceManager & | GetFenceManager () |
| Getter for the default texture (unreal grid). | |
| KarmaVector< FVulkanDescriptorSets * > & | GetDefaultDescriptorSets () |
| FVulkanDescriptorSetsLayout * | GetDefaultDescriptorSetLayout () const |
| VulkanTexture * | GetDefaultTexture () const |
| VulkanShader * | GetDefaultShader () const |
Manages Vulkan device resources and operations.
This class encapsulates the functionality related to a Vulkan logical device, including initialization, resource management, and cleanup.
| Karma::FVulkanDevice::FVulkanDevice | ( | FVulkanDynamicRHI * | InRHI, |
| VkPhysicalDevice | InGpu ) |
Constructor for FVulkanDevice.
Initializes the Vulkan device with the given physical device (GPU) and dynamic RHI instance.
| InRHI | Pointer to the FVulkanDynamicRHI instance |
| InGpu | The Vulkan physical device (GPU) handle |
| Karma::FVulkanDevice::~FVulkanDevice | ( | ) |
Destructor for FVulkanDevice.
Cleans up resources associated with the Vulkan device.
| void Karma::FVulkanDevice::CopyBufferToImage | ( | VkBuffer | buffer, |
| VkImage | image, | ||
| uint32_t | width, | ||
| uint32_t | height ) |
Copies data from a buffer to a Vulkan image.
This is typically used for uploading texture data from a staging buffer to a Vulkan image.
| buffer | The source buffer containing the data |
| image | The destination image |
| width | The width of the image |
| height | The height of the image |
| void Karma::FVulkanDevice::Destroy | ( | ) |
Destroys the logical vkdevice by making Vulkan API call.
|
inline |
Retrives the Vulkan command pool for the commandbuffers.
|
inline |
Getter for the default texture (unreal grid).
|
inline |
Retrieves the Vulkan physical device handle.
|
inline |
Getter for the graphics queue created in FVulkanDevice::InitGPU().
|
inline |
Retrieves the Vulkan logical device handle.
|
inline |
Getter for the present queue created in FVulkanDevice::InitGPU().
| bool Karma::FVulkanDevice::HasStencilComponent | ( | VkFormat | format | ) |
Checks if the given format has a stencil component.
Sees if the format is VK_FORMAT_D32_SFLOAT_S8_UINT or VK_FORMAT_D24_UNORM_S8_UINT
| format | The format to be checked |
| void Karma::FVulkanDevice::InitGPU | ( | ) |
Creates the Vulkan logical device and default vulkan resources.
| void Karma::FVulkanDevice::TransitionImageLayout | ( | VkImage | image, |
| VkFormat | format, | ||
| VkImageLayout | oldLayout, | ||
| VkImageLayout | newLayout ) |
Transitions the layout of an image from oldLayout to newLayout.
Image layout transitions are crucial in Vulkan to ensure that images are in the correct state for different operations, such as rendering, sampling, or transferring data.
| image | The image to be transitioned |
| format | The format of the image |
| oldLayout | The current layout of the image |
| newLayout | The desired layout of the image |
| void Karma::FVulkanDevice::WaitUntilIdle | ( | ) |
Waits on the host by blocking the calling CPU thread until the Vulkan logical device completes all pending GPU operations across all queues.