KarmaEngine
Game Engine for practical learning and research purposes
|
A class for required Vulkan routines for KarmaGui Vulkan backend. More...
#include <KarmaGuiVulkanHandler.h>
Static Public Member Functions | |
static uint32_t | KarmaGui_ImplVulkan_MemoryType (VkMemoryPropertyFlags properties, uint32_t type_bits) |
Reports memory relevant type information for the specified physical device (the GPU, represented by KarmaGui_ImplVulkan_InitInfo.PhysicalDevice), based on supplied properties and type_bits (not exceeding a valid limit). | |
static void | CreateOrResizeBuffer (VkBuffer &buffer, VkDeviceMemory &bufferMemory, VkDeviceSize &pBufferSize, size_t newSize, VkBufferUsageFlagBits usage) |
Creates new vulkan buffer and allocates appropriate memory based upon the supplied newSize (appropriately aligned) and usage. | |
static void | KarmaGui_ImplVulkan_SetupRenderState (KGDrawData *drawData, VkPipeline pipeline, VkCommandBuffer commandBuffer, KarmaGui_ImplVulkanH_ImageFrameRenderBuffers *remderingBufferData, int width, int height) |
A routine to bind index/vertex buffers, setup a external viewport, and bind pipeline. Usually for rendering of KarmaGui windows and all that. | |
static void | KarmaGui_ImplVulkan_SetupRenderStateFor3DRendering (Scene *sceneToDraw, VkCommandBuffer commandBuffer, KGDrawData *drawData) |
A routine to bind index/vertex buffers, setup a external viewport, and bind pipeline. Specifically for 3D rendering in KarmaGUI's window for (experimental) 3D exhibition. | |
static void | KarmaGui_ImplVulkan_CreateShaderModules (VkDevice device, const VkAllocationCallbacks *allocator) |
A routine to create the shader modules (KarmaGui_ImplVulkan_Data.ShaderModuleVert and KarmaGui_ImplVulkan_Data.ShaderModuleFrag) for the backend GraphicsPipeline (KarmaGui_ImplVulkan_Data.Pipeline). | |
static void | KarmaGui_ImplVulkan_CreateFontSampler (VkDevice device, const VkAllocationCallbacks *allocator) |
Bilinear sampling object is created for font and stored in KarmaGui_ImplVulkan_Data.FontSampler if not done already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects(). | |
static void | KarmaGui_ImplVulkan_CreateDescriptorSetLayout (VkDevice device, const VkAllocationCallbacks *allocator) |
Creates KarmaGui_ImplVulkan_Data.DescriptorSetLayout if not already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects() | |
static void | KarmaGui_ImplVulkan_CreatePipelineLayout (VkDevice device, const VkAllocationCallbacks *allocator) |
Creates KarmaGui_ImplVulkan_Data.PipelineLayout (if not already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects()). | |
static void | KarmaGui_ImplVulkan_CreatePipeline (VkDevice device, const VkAllocationCallbacks *allocator, VkPipelineCache pipelineCache, VkRenderPass renderPass, VkSampleCountFlagBits MSAASamples, VkPipeline *pipeline, uint32_t subpass) |
Creates KarmaGui_ImplVulkan_Data.Pipeline. | |
static void | KarmaGui_ImplVulkan_CreateWindow (KarmaGuiViewport *viewport) |
This is an advanced and optional feature, allowing the backend to create and handle multiple viewports simultaneously. NOT SUPPORTED. | |
static void | KarmaGui_ImplVulkan_DestroyWindow (KarmaGuiViewport *viewport) |
Destroys the KarmaGui window relevant data (KarmaGui_ImplVulkan_ViewportData) and buffers. Basically set to KarmaGuiPlatformIO::Renderer_DestroyWindow pointer. | |
static void | KarmaGui_ImplVulkan_DestroyWindow (KarmaGui_ImplVulkanH_Window *windowData) |
Destroys the KarmaGui window relevant data (KarmaGui_ImplVulkan_ViewportData) and buffers. Called by KarmaGuiRenderer::CleanUpVulkanAndWindowData() | |
static void | KarmaGui_ImplVulkan_SetWindowSize (KarmaGuiViewport *viewport, KGVec2 size) |
Set the size of window rendering relevant resources (swapchain, framebuffers, and all that). Basically implementation of KarmaGuiPlatformIO::Renderer_SetWindowSize. | |
static void | KarmaGui_ImplVulkan_RenderWindow (KarmaGuiViewport *viewport, void *) |
A set of instructions for rendering a viewport of KarmaGui window (called each loop for realtime Vulkan rendering). A bird's eye overview can be experienced in the wikipedia page https://github.com/ravimohan1991/KarmaEngine/wiki/Vulkan-Creative-Pipeline-(vCP)-II. Set to KarmaGuiPlatformIO::Renderer_RenderWindow in the function KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_InitPlatformInterface(). Called in the routine KarmaGuiRenderer::OnKarmaGuiLayerEnd(), via KarmaGui::RenderPlatformWindowsDefault()->platform_io.Renderer_RenderWindow, if multiviewports (KGGuiConfigFlags_ViewportsEnable) are supported. | |
static void | KarmaGui_ImplVulkan_RenderDrawData (KGDrawData *drawData, VkCommandBuffer commandBuffer, VkPipeline pipeline, uint32_t imageFrameIndex) |
Record KarmaGui primitives into command buffer. Frame rendering relevant buffers and resources are set. They include: | |
static void | KarmaGui_ImplVulkan_SwapBuffers (KarmaGuiViewport *viewport, void *) |
Called in KarmaGui_ImplVulkan_InitPlatformInterface for setting the field KarmaGuiPlatformIO::Renderer_SwapBuffers. Based upon the present conditions, does the following. | |
static void | ShareVulkanContextResourcesOfMainWindow (KarmaGui_ImplVulkanH_Window *windowData, bool bCreateSyncronicity=false) |
The purpose of the routine is two-fold. | |
static void | ClearVulkanWindowData (KarmaGui_ImplVulkanH_Window *vulkanWindowData, bool bDestroySyncronicity=false) |
Clears appropriate buffers which are used for KarmaGui's rendering. They include: | |
static void | DestroyWindowDataFrame (KarmaGui_ImplVulkanH_ImageFrame *frame) |
Clears KarmaGui_ImplVulkanH_ImageFrame::BackBuffer and KarmaGui_ImplVulkanH_ImageFrame::Framebuffer and called by KarmaGuiVulkanHandler::ClearVulkanWindowData. | |
static void | DestroyFramesOnFlightData (KarmaGui_Vulkan_Frame_On_Flight *frameSyncronicityData) |
Clears all the synchronization primitives (semaphores and fences) associated with the rendering. | |
static void | KarmaGui_ImplVulkan_CreateOrResizeWindow (KarmaGui_ImplVulkanH_Window *windowData, bool bCreateSyncronicity, bool bRecreateSwapChainAndCommandBuffers) |
KarmaGui_ImplVulkan_CreateOrResizeWindow. | |
static void | KarmaGui_ImplVulkan_DestroyAllViewportsRenderBuffers (VkDevice device, const VkAllocationCallbacks *allocator) |
Clears the KarmaGui_ImplVulkan_ViewportData::RenderBuffers associated with the single KarmaGui viewport. | |
static void | KarmaGui_ImplVulkan_ShivaWindowRenderBuffers (VkDevice device, KarmaGui_ImplVulkanH_WindowRenderBuffers *buffers, const VkAllocationCallbacks *allocator) |
Destroys and clears the frame buffers, KarmaGui_ImplVulkanH_WindowRenderBuffers::FrameRenderBuffers, using KarmaGui_ImplVulkan_ShivaFrameRenderBuffers. | |
static void | KarmaGui_ImplVulkan_ShivaFrameRenderBuffers (VkDevice device, KarmaGui_ImplVulkanH_ImageFrameRenderBuffers *buffers, const VkAllocationCallbacks *allocator) |
Destroys and clears the following buffers. | |
static bool | KarmaGui_ImplVulkan_CreateFontsTexture (VkCommandBuffer commandBuffer) |
Creates fonts' texture for KarmaGui. | |
static bool | KarmaGui_ImplVulkan_CreateTexture (VkCommandBuffer commandBuffer, char const *fileName, const std::string &lable="") |
Routine to create Image vulkan texture. | |
static bool | KarmaGui_ImplVulkan_CreateDeviceObjects () |
Generates or creates the following objects. | |
static void | KarmaGui_ImplVulkan_DestroyFontUploadObjects () |
Function to destroy the fonts (created by KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateFontsTexture) by clearing the following buffers. | |
static void | KarmaGui_ImplVulkan_DestroyDeviceObjects () |
The following objects are destroyed. | |
static void | KarmaGui_ImplVulkan_Shutdown () |
Called in the KarmaGuiRenderer::GracefulVulkanShutDown(). Basically does the following. | |
static void | KarmaGui_ImplVulkan_NewFrame () |
No clue what this does. Legacy? | |
static VkDescriptorSet | KarmaGui_ImplVulkan_AddTexture (VkSampler sampler, VkImageView imageView, VkImageLayout imageLayout) |
Register a texture by creation of descriptor set from preallocated descriptor pool. | |
static void | KarmaGui_ImplVulkan_InitPlatformInterface () |
Called in KarmaGuiRenderer::KarmaGui_ImplVulkan_Init, during the initialization of Vulkan backend for KarmaGui, if Vulkan is the chosen renderer (RendererAPI::GetAPI() == RendererAPI::API::Vulkan). | |
static void | KarmaGui_ImplVulkan_ShutdownPlatformInterface () |
Calls KarmaGui::DestroyPlatformWindows, which further calls KarmaGuiInternal::DestroyPlatformWindow on each viewport window (main viewport in current state). Clears the RendererUserData and calls KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyWindow. | |
A class for required Vulkan routines for KarmaGui Vulkan backend.
|
static |
Clears appropriate buffers which are used for KarmaGui's rendering. They include:
vulkanWindowData | The datastructure containing the buffers to be cleared |
bDestroySyncronicity | FramesOnFlight buffers are cleared if set to true, for instance KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyWindow. Else, when set to false, for instance swapchain is recreated and similar things in KarmaGuiRenderer::GiveLoopBeginControlToVulkan (see KarmaGuiVulkanHandler::ShareVulkanContextResourcesOfMainWindow(&m_VulkanWindowData, false)), they aren't touched. |
|
static |
Creates new vulkan buffer and allocates appropriate memory based upon the supplied newSize (appropriately aligned) and usage.
buffer | The vulkan buffer to be resized |
bufferMemory | The device memory to be used for buffer |
pBufferSize | The size, in bytes, of the memory resource alloted to the buffer |
newSize | The (could be unaligned?) size, in bytes, of the buffer to be created |
usage | This is a bitmask of VkBufferUsageFlagBits specifying allowed usages of the buffer. |
|
static |
Clears all the synchronization primitives (semaphores and fences) associated with the rendering.
frameSyncronicityData | The pointer to datastructure object holding rendering relevant syncronicity data |
|
static |
Clears KarmaGui_ImplVulkanH_ImageFrame::BackBuffer and KarmaGui_ImplVulkanH_ImageFrame::Framebuffer and called by KarmaGuiVulkanHandler::ClearVulkanWindowData.
frame | The ImageFrame data to be cleared |
|
static |
Register a texture by creation of descriptor set from preallocated descriptor pool.
sampler | The sampler handle used in descriptor updates for type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER if the binding being updated does not use immutable samplers. |
imageView | An image view handle, and is used in descriptor updates for type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER. The image view representing contiguous ranges of the image subresources and containing additional metadata which are used by pipeline shaders for reading or writing image data. |
imageLayout | The layout that the image subresources accessible from imageView will be in at the time this descriptor is accessed |
|
static |
Creates KarmaGui_ImplVulkan_Data.DescriptorSetLayout if not already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects()
device | A logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device |
allocator | The controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator |
|
static |
Generates or creates the following objects.
|
static |
Bilinear sampling object is created for font and stored in KarmaGui_ImplVulkan_Data.FontSampler if not done already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects().
device | A logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device |
allocator | The controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator |
|
static |
Creates fonts' texture for KarmaGui.
commandBuffer | The buffer of commands to be filled with primitive drawing and relevant commands |
|
static |
KarmaGui_ImplVulkan_CreateOrResizeWindow.
windowData | The datastructure object containing the buffers to be manipulated |
bCreateSyncronicity | |
bRecreateSwapChainAndCommandBuffers |
|
static |
Creates KarmaGui_ImplVulkan_Data.Pipeline.
device | A logical device handle. See KarmaGui_ImplVulkan_InitInfo.Device |
allocator | The controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator |
pipelineCache | Usually this cache (KarmaGui_ImplVulkan_InitInfo.PipelineCache) is set to VK_NULL_HANDLE, indicating that pipeline caching is disabled; or the handle of a valid pipeline cache object, in which case use of that cache is enabled for the duration of the command. |
renderPass | A render pass object (KarmaGui_ImplVulkan_Data.RenderPass) represents a collection of attachments, subpasses, and dependencies between the subpasses, and describes how the attachments are used over the course of the subpasses. |
MSAASamples | KarmaGui_ImplVulkan_InitInfo::MSAASamples |
pipeline | KarmaGui_ImplVulkan_Data::Pipeline |
subpass | KarmaGui_ImplVulkan_Data::subpass |
|
static |
Creates KarmaGui_ImplVulkan_Data.PipelineLayout (if not already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects()).
device | A logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device |
allocator | The controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator |
|
static |
A routine to create the shader modules (KarmaGui_ImplVulkan_Data.ShaderModuleVert and KarmaGui_ImplVulkan_Data.ShaderModuleFrag) for the backend GraphicsPipeline (KarmaGui_ImplVulkan_Data.Pipeline).
device | A logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device |
allocator | The controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator |
|
static |
Routine to create Image vulkan texture.
commandBuffer | The buffer of commands to be filled with primitive drawing and relevant commands |
fileName | The relative path to the file containing Image (for instance "../Resources/Textures/The_Source_Wall.jpg") |
label | The texture lable for internal use or identification (KarmaGui_ImplVulkan_Image_TextureData::TextureLable) |
|
static |
This is an advanced and optional feature, allowing the backend to create and handle multiple viewports simultaneously. NOT SUPPORTED.
|
static |
Clears the KarmaGui_ImplVulkan_ViewportData::RenderBuffers associated with the single KarmaGui viewport.
|
static |
The following objects are destroyed.
|
static |
Function to destroy the fonts (created by KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateFontsTexture) by clearing the following buffers.
|
static |
Destroys the KarmaGui window relevant data (KarmaGui_ImplVulkan_ViewportData) and buffers. Called by KarmaGuiRenderer::CleanUpVulkanAndWindowData()
windowData | The vulkan context containing relevant data to be deallocated |
|
static |
Destroys the KarmaGui window relevant data (KarmaGui_ImplVulkan_ViewportData) and buffers. Basically set to KarmaGuiPlatformIO::Renderer_DestroyWindow pointer.
viewport | The current platform window to be destroyed |
|
static |
Called in KarmaGuiRenderer::KarmaGui_ImplVulkan_Init, during the initialization of Vulkan backend for KarmaGui, if Vulkan is the chosen renderer (RendererAPI::GetAPI() == RendererAPI::API::Vulkan).
|
static |
Reports memory relevant type information for the specified physical device (the GPU, represented by KarmaGui_ImplVulkan_InitInfo.PhysicalDevice), based on supplied properties and type_bits (not exceeding a valid limit).
properties | The memory properties to be queried. This is a bitmask type for setting a mask of zero or more VkMemoryPropertyFlagBits. |
type_bits | This is a bitmask and contains one bit set for every supported memory type (obtained from vkGetBufferMemoryRequirements, for instance) for the resource. Bit i is set if and only if the memory type i in the VkPhysicalDeviceMemoryProperties structure for the physical device is supported for the resource. |
|
static |
|
static |
Record KarmaGui primitives into command buffer. Frame rendering relevant buffers and resources are set. They include:
Also any callback routines, usually related to rendering in KarmaGui's window (3D scene data atm), are processed here.
drawData | All draw data to render a KarmaGui frame |
commandBuffer | The buffer of commands to be filled with primitive drawing and relevant commands |
pipeline | KarmaGui_ImplVulkan_Data::Pipeline |
imageFrameIndex | The frame counter (KarmaGui_ImplVulkanH_Window::SemaphoreIndex) |
|
static |
A set of instructions for rendering a viewport of KarmaGui window (called each loop for realtime Vulkan rendering). A bird's eye overview can be experienced in the wikipedia page https://github.com/ravimohan1991/KarmaEngine/wiki/Vulkan-Creative-Pipeline-(vCP)-II. Set to KarmaGuiPlatformIO::Renderer_RenderWindow in the function KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_InitPlatformInterface(). Called in the routine KarmaGuiRenderer::OnKarmaGuiLayerEnd(), via KarmaGui::RenderPlatformWindowsDefault()->platform_io.Renderer_RenderWindow, if multiviewports (KGGuiConfigFlags_ViewportsEnable) are supported.
viewport | The viewport to be rendered |
|
static |
A routine to bind index/vertex buffers, setup a external viewport, and bind pipeline. Usually for rendering of KarmaGui windows and all that.
drawData | All draw data to render a KarmaGui frame |
pipeline | The vulkan pipeline (created in KarmaGui_ImplVulkan_CreatePipeline) being used by the backend |
commandBuffer | The vulkan commandbuffer (taken from VulkanRendererAPI.m_CommandBuffer) being used by the backend, see todo list. |
remderingBufferData | The set of buffers relevant to current frame (in flight?) |
width | The viewport width size |
height | The viewport height size |
|
static |
A routine to bind index/vertex buffers, setup a external viewport, and bind pipeline. Specifically for 3D rendering in KarmaGUI's window for (experimental) 3D exhibition.
drawData | All draw data to render a KarmaGui frame |
pipeline | The vulkan pipeline (created in KarmaGui_ImplVulkan_CreatePipeline) being used by the backend |
commandBuffer | The vulkan commandbuffer (taken from VulkanRendererAPI.m_CommandBuffer) being used by the backend, see todo list. |
remderingBufferData | The set of buffers relevant to current frame (in flight?) |
width | The viewport width size |
height | The viewport height size |
|
static |
Set the size of window rendering relevant resources (swapchain, framebuffers, and all that). Basically implementation of KarmaGuiPlatformIO::Renderer_SetWindowSize.
viewport | The current platform window to be resized |
size | The 2D vector containing width and height of the window |
|
static |
Destroys and clears the following buffers.
|
static |
Destroys and clears the frame buffers, KarmaGui_ImplVulkanH_WindowRenderBuffers::FrameRenderBuffers, using KarmaGui_ImplVulkan_ShivaFrameRenderBuffers.
device | A logical device handle. See KarmaGui_ImplVulkan_InitInfo.Device |
buffers | The rendering buffers allocated for a in-flight ImageFrame (KarmaGui_ImplVulkanH_ImageFrameRenderBuffers) |
allocator | The controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator |
|
static |
Called in the KarmaGuiRenderer::GracefulVulkanShutDown(). Basically does the following.
|
static |
Calls KarmaGui::DestroyPlatformWindows, which further calls KarmaGuiInternal::DestroyPlatformWindow on each viewport window (main viewport in current state). Clears the RendererUserData and calls KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyWindow.
|
static |
Called in KarmaGui_ImplVulkan_InitPlatformInterface for setting the field KarmaGuiPlatformIO::Renderer_SwapBuffers. Based upon the present conditions, does the following.
viewport | The viewport to be rendered |
|
static |
The purpose of the routine is two-fold.
windowData | The datastructure to hold all the data needed by one rendering Vulkan context. |
bCreateSyncronicity | Should we allocate semaphores and fences. For instance true during KarmaGuiRenderer::SetUpKarmaGuiRenderer and false during KarmaGuiRenderer::GiveLoopBeginControlToVulkan |