KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::KarmaGuiVulkanHandler Class Reference

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.
 

Detailed Description

A class for required Vulkan routines for KarmaGui Vulkan backend.

Member Function Documentation

◆ ClearVulkanWindowData()

void Karma::KarmaGuiVulkanHandler::ClearVulkanWindowData ( KarmaGui_ImplVulkanH_Window * vulkanWindowData,
bool bDestroySyncronicity = false )
static

Clears appropriate buffers which are used for KarmaGui's rendering. They include:

Parameters
vulkanWindowDataThe datastructure containing the buffers to be cleared
bDestroySyncronicityFramesOnFlight 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.
Since
Karma 1.0.0

◆ CreateOrResizeBuffer()

void Karma::KarmaGuiVulkanHandler::CreateOrResizeBuffer ( VkBuffer & buffer,
VkDeviceMemory & bufferMemory,
VkDeviceSize & pBufferSize,
size_t newSize,
VkBufferUsageFlagBits usage )
static

Creates new vulkan buffer and allocates appropriate memory based upon the supplied newSize (appropriately aligned) and usage.

Parameters
bufferThe vulkan buffer to be resized
bufferMemoryThe device memory to be used for buffer
pBufferSizeThe size, in bytes, of the memory resource alloted to the buffer
newSizeThe (could be unaligned?) size, in bytes, of the buffer to be created
usageThis is a bitmask of VkBufferUsageFlagBits specifying allowed usages of the buffer.
Note
If supplied buffer and bufferMemory are not null, then they are destroyed.
Since
Karma 1.0.0

◆ DestroyFramesOnFlightData()

void Karma::KarmaGuiVulkanHandler::DestroyFramesOnFlightData ( KarmaGui_Vulkan_Frame_On_Flight * frameSyncronicityData)
static

Clears all the synchronization primitives (semaphores and fences) associated with the rendering.

Parameters
frameSyncronicityDataThe pointer to datastructure object holding rendering relevant syncronicity data
Since
Karma 1.0.0

◆ DestroyWindowDataFrame()

void Karma::KarmaGuiVulkanHandler::DestroyWindowDataFrame ( KarmaGui_ImplVulkanH_ImageFrame * frame)
static

Clears KarmaGui_ImplVulkanH_ImageFrame::BackBuffer and KarmaGui_ImplVulkanH_ImageFrame::Framebuffer and called by KarmaGuiVulkanHandler::ClearVulkanWindowData.

Parameters
frameThe ImageFrame data to be cleared
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_AddTexture()

VkDescriptorSet Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_AddTexture ( VkSampler sampler,
VkImageView imageView,
VkImageLayout imageLayout )
static

Register a texture by creation of descriptor set from preallocated descriptor pool.

Parameters
samplerThe sampler handle used in descriptor updates for type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER if the binding being updated does not use immutable samplers.
imageViewAn 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.
imageLayoutThe layout that the image subresources accessible from imageView will be in at the time this descriptor is accessed
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreateDescriptorSetLayout()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDescriptorSetLayout ( VkDevice device,
const VkAllocationCallbacks * allocator )
static

Creates KarmaGui_ImplVulkan_Data.DescriptorSetLayout if not already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects()

Parameters
deviceA logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device
allocatorThe controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreateDeviceObjects()

bool Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects ( )
static

◆ KarmaGui_ImplVulkan_CreateFontSampler()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateFontSampler ( VkDevice device,
const VkAllocationCallbacks * allocator )
static

Bilinear sampling object is created for font and stored in KarmaGui_ImplVulkan_Data.FontSampler if not done already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects().

Parameters
deviceA logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device
allocatorThe controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreateFontsTexture()

bool Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateFontsTexture ( VkCommandBuffer commandBuffer)
static

Creates fonts' texture for KarmaGui.

Parameters
commandBufferThe buffer of commands to be filled with primitive drawing and relevant commands
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreateOrResizeWindow()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateOrResizeWindow ( KarmaGui_ImplVulkanH_Window * windowData,
bool bCreateSyncronicity,
bool bRecreateSwapChainAndCommandBuffers )
static

KarmaGui_ImplVulkan_CreateOrResizeWindow.

Parameters
windowDataThe datastructure object containing the buffers to be manipulated
bCreateSyncronicity
bRecreateSwapChainAndCommandBuffers
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreatePipeline()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreatePipeline ( VkDevice device,
const VkAllocationCallbacks * allocator,
VkPipelineCache pipelineCache,
VkRenderPass renderPass,
VkSampleCountFlagBits MSAASamples,
VkPipeline * pipeline,
uint32_t subpass )
static

Creates KarmaGui_ImplVulkan_Data.Pipeline.

Parameters
deviceA logical device handle. See KarmaGui_ImplVulkan_InitInfo.Device
allocatorThe controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator
pipelineCacheUsually 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.
renderPassA 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.
MSAASamplesKarmaGui_ImplVulkan_InitInfo::MSAASamples
pipelineKarmaGui_ImplVulkan_Data::Pipeline
subpassKarmaGui_ImplVulkan_Data::subpass
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreatePipelineLayout()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreatePipelineLayout ( VkDevice device,
const VkAllocationCallbacks * allocator )
static

Creates KarmaGui_ImplVulkan_Data.PipelineLayout (if not already in KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateDeviceObjects()).

Parameters
deviceA logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device
allocatorThe controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreateShaderModules()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateShaderModules ( VkDevice device,
const VkAllocationCallbacks * 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).

Parameters
deviceA logical device handle. See KarmaGui_ImplVulkan_InitInfo::Device
allocatorThe controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreateTexture()

bool Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateTexture ( VkCommandBuffer commandBuffer,
char const * fileName,
const std::string & lable = "" )
static

Routine to create Image vulkan texture.

Parameters
commandBufferThe buffer of commands to be filled with primitive drawing and relevant commands
fileNameThe relative path to the file containing Image (for instance "../Resources/Textures/The_Source_Wall.jpg")
labelThe texture lable for internal use or identification (KarmaGui_ImplVulkan_Image_TextureData::TextureLable)
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_CreateWindow()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateWindow ( KarmaGuiViewport * viewport)
static

This is an advanced and optional feature, allowing the backend to create and handle multiple viewports simultaneously. NOT SUPPORTED.

Note
Something to strive for? :)
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_DestroyAllViewportsRenderBuffers()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyAllViewportsRenderBuffers ( VkDevice device,
const VkAllocationCallbacks * allocator )
static

Clears the KarmaGui_ImplVulkan_ViewportData::RenderBuffers associated with the single KarmaGui viewport.

Note
Engine is not supporting multiviewports in the current state.
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_DestroyDeviceObjects()

◆ KarmaGui_ImplVulkan_DestroyFontUploadObjects()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyFontUploadObjects ( )
static

Function to destroy the fonts (created by KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateFontsTexture) by clearing the following buffers.

  1. KarmaGui_ImplVulkan_Data::UploadBuffer
  2. KarmaGui_ImplVulkan_Data::UploadBufferMemory
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_DestroyWindow() [1/2]

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyWindow ( KarmaGui_ImplVulkanH_Window * windowData)
static

Destroys the KarmaGui window relevant data (KarmaGui_ImplVulkan_ViewportData) and buffers. Called by KarmaGuiRenderer::CleanUpVulkanAndWindowData()

See also
KarmaGuiVulkanHandler::ClearVulkanWindowData
Parameters
windowDataThe vulkan context containing relevant data to be deallocated
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_DestroyWindow() [2/2]

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyWindow ( KarmaGuiViewport * viewport)
static

Destroys the KarmaGui window relevant data (KarmaGui_ImplVulkan_ViewportData) and buffers. Basically set to KarmaGuiPlatformIO::Renderer_DestroyWindow pointer.

Parameters
viewportThe current platform window to be destroyed
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_InitPlatformInterface()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_InitPlatformInterface ( )
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).

Note
Setting up KarmaGui's window operations (create, resize, and all that)
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_MemoryType()

uint32_t Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_MemoryType ( VkMemoryPropertyFlags properties,
uint32_t type_bits )
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).

Note
Device memory is memory that is visible to the device for example the contents of the image or buffer objects, which can be natively used by the device.
Parameters
propertiesThe memory properties to be queried. This is a bitmask type for setting a mask of zero or more VkMemoryPropertyFlagBits.
type_bitsThis 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.
Returns
the appropriate device memory type, else uint32_t(0xFFFFFFFF)
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_NewFrame()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_NewFrame ( )
static

No clue what this does. Legacy?

Todo
Ponder over
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_RenderDrawData()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_RenderDrawData ( KGDrawData * drawData,
VkCommandBuffer commandBuffer,
VkPipeline pipeline,
uint32_t imageFrameIndex )
static

Record KarmaGui primitives into command buffer. Frame rendering relevant buffers and resources are set. They include:

  1. drawData->OwnerViewport->RendererUserData->RenderBuffers (KarmaGui_ImplVulkan_ViewportData::RenderBuffers)
  2. drawData->OwnerViewport->RendererUserData->RenderBuffers->FrameRenderBuffers (KarmaGui_ImplVulkanH_WindowRenderBuffers::FrameRenderBuffers)
  3. FrameRenderBuffers::VertexBuffer and FrameRenderBuffers::IndexBuffer and corresponding sizes
  4. Commandbuffer is filled with scissor, KarmaGui_ImplVulkan_SetupRenderState, and drawing primitives commands

Also any callback routines, usually related to rendering in KarmaGui's window (3D scene data atm), are processed here.

Parameters
drawDataAll draw data to render a KarmaGui frame
commandBufferThe buffer of commands to be filled with primitive drawing and relevant commands
pipelineKarmaGui_ImplVulkan_Data::Pipeline
imageFrameIndexThe frame counter (KarmaGui_ImplVulkanH_Window::SemaphoreIndex)
Note
Called by KarmaGuiRenderer::FrameRender between vkCmdBeginRenderPass and vkCmdEndRenderPass like so
vkCmdBeginRenderPass(frameOnFlightData->CommandBuffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
{
// Record KarmaGui primitives into command buffer
KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_RenderDrawData(drawData, frameOnFlightData->CommandBuffer, VK_NULL_HANDLE, windowData->SemaphoreIndex);
}
vkCmdEndRenderPass(frameOnFlightData->CommandBuffer);
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 se...
Definition KarmaGuiVulkanHandler.cpp:239
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_RenderWindow()

static void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_RenderWindow ( KarmaGuiViewport * viewport,
void *  )
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.

Parameters
viewportThe viewport to be rendered
Note
Engine is not supporting multiviewports in the current state.
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_SetupRenderState()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_SetupRenderState ( KGDrawData * drawData,
VkPipeline pipeline,
VkCommandBuffer commandBuffer,
KarmaGui_ImplVulkanH_ImageFrameRenderBuffers * remderingBufferData,
int width,
int height )
static

A routine to bind index/vertex buffers, setup a external viewport, and bind pipeline. Usually for rendering of KarmaGui windows and all that.

Parameters
drawDataAll draw data to render a KarmaGui frame
pipelineThe vulkan pipeline (created in KarmaGui_ImplVulkan_CreatePipeline) being used by the backend
commandBufferThe vulkan commandbuffer (taken from VulkanRendererAPI.m_CommandBuffer) being used by the backend, see todo list.
remderingBufferDataThe set of buffers relevant to current frame (in flight?)
widthThe viewport width size
heightThe viewport height size
Todo
Ponder over the commandBuffer usage (should backend have seperate commandbuffer?)
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_SetupRenderStateFor3DRendering()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_SetupRenderStateFor3DRendering ( Scene * sceneToDraw,
VkCommandBuffer commandBuffer,
KGDrawData * drawData )
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.

Parameters
drawDataAll draw data to render a KarmaGui frame
pipelineThe vulkan pipeline (created in KarmaGui_ImplVulkan_CreatePipeline) being used by the backend
commandBufferThe vulkan commandbuffer (taken from VulkanRendererAPI.m_CommandBuffer) being used by the backend, see todo list.
remderingBufferDataThe set of buffers relevant to current frame (in flight?)
widthThe viewport width size
heightThe viewport height size
Todo
Ponder over the commandBuffer usage (should backend have seperate commandbuffer?)
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_SetWindowSize()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_SetWindowSize ( KarmaGuiViewport * viewport,
KGVec2 size )
static

Set the size of window rendering relevant resources (swapchain, framebuffers, and all that). Basically implementation of KarmaGuiPlatformIO::Renderer_SetWindowSize.

Parameters
viewportThe current platform window to be resized
sizeThe 2D vector containing width and height of the window
Note
Can't find any use in the current state of Engine.
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_ShivaFrameRenderBuffers()

◆ KarmaGui_ImplVulkan_ShivaWindowRenderBuffers()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_ShivaWindowRenderBuffers ( VkDevice device,
KarmaGui_ImplVulkanH_WindowRenderBuffers * buffers,
const VkAllocationCallbacks * allocator )
static

Destroys and clears the frame buffers, KarmaGui_ImplVulkanH_WindowRenderBuffers::FrameRenderBuffers, using KarmaGui_ImplVulkan_ShivaFrameRenderBuffers.

Parameters
deviceA logical device handle. See KarmaGui_ImplVulkan_InitInfo.Device
buffersThe rendering buffers allocated for a in-flight ImageFrame (KarmaGui_ImplVulkanH_ImageFrameRenderBuffers)
allocatorThe controller of host memory allocation as described in the Memory Allocation chapter. See KarmaGui_ImplVulkan_InitInfo.Allocator
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_Shutdown()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_Shutdown ( )
static

Called in the KarmaGuiRenderer::GracefulVulkanShutDown(). Basically does the following.

  1. KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_DestroyDeviceObjects // (destroy object in viewport(s))
  2. KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_ShutdownPlatformInterface()
  3. Delete KarmaGuiBackendRendererUserData
Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_ShutdownPlatformInterface()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_ShutdownPlatformInterface ( )
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.

Since
Karma 1.0.0

◆ KarmaGui_ImplVulkan_SwapBuffers()

void Karma::KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_SwapBuffers ( KarmaGuiViewport * viewport,
void *  )
static

Called in KarmaGui_ImplVulkan_InitPlatformInterface for setting the field KarmaGuiPlatformIO::Renderer_SwapBuffers. Based upon the present conditions, does the following.

  1. Calls the routine KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_CreateOrResizeWindow if vkQueuePresentKHR returns VK_ERROR_OUT_OF_DATE_KHR or VK_SUBOPTIMAL_KHR.
  2. Update the KarmaGui_ImplVulkanH_Window::SemaphoreIndex for graceful asynchronous (https://www.geeksforgeeks.org/semaphores-in-process-synchronization/) type of work. A semaphore is used to add order between queue operations. Queue operations refer to the work we submit to a queue, either in a command buffer or from within a function. Examples of queues are the graphics queue and the presentation queue. Semaphores are used both to order work inside the same queue and between different queues.
Parameters
viewportThe viewport to be rendered
Note
Not used in the current state of single viewport only condition of Engine.
Needs reconsideration because of the same decoupling (see KarmaGui_Vulkan_Frame_On_Flight notes). Seems like we have taken those considerations and resoved the decoupling issue.
A core design philosophy in Vulkan is that synchronization of execution on the GPU is explicit. The order of operations is up to us to define using various synchronization primitives which tell the driver the order we want things to run in. This means that many Vulkan API calls which start executing work on the GPU are asynchronous, the functions will return before the operation has finished. Retrieved from https://vulkan-tutorial.com/Drawing_a_triangle/Drawing/Rendering_and_presentation#page_Synchronization
See also
KarmaGui_Vulkan_Frame_On_Flight
Since
Karma 1.0.0

◆ ShareVulkanContextResourcesOfMainWindow()

void Karma::KarmaGuiVulkanHandler::ShareVulkanContextResourcesOfMainWindow ( KarmaGui_ImplVulkanH_Window * windowData,
bool bCreateSyncronicity = false )
static

The purpose of the routine is two-fold.

  • Share the Vulkan resources, including Swapchain, Renderpass, CommandPool, Framebuffer, and all that, of MainWindow (stored in VulkanContext of VulkanHolder, initialized during VulkanContext::Init() which gets called on Platform(Windows, Mac, and Linux)Window during their specific creation implementation, for instance LinuxWindow::Init) to KarmaGui's backend, after appropriate clearence.
  • Ground work for establishing syncronicity, in GPU side functions' execution, by creating semaphores for (https://vulkan-tutorial.com/Drawing_a_triangle/Drawing/Rendering_and_presentation#page_Synchronization)
    1. to signal that image has been acquired from the swapchain and ready for rendering
    2. to signal that rendering has finished and presentation (the last step of drawing a frame is submitting the result back to the swap chain to have it eventually show up on the screen) can happen The set number of semaphores (we are using two types of them) are for number of "frames in flight" which represent the number of frames which can be processed on CPU whilst rendering is done on GPU
Parameters
windowDataThe datastructure to hold all the data needed by one rendering Vulkan context.
bCreateSyncronicityShould we allocate semaphores and fences. For instance true during KarmaGuiRenderer::SetUpKarmaGuiRenderer and false during KarmaGuiRenderer::GiveLoopBeginControlToVulkan
Since
Karma 1.0.0

The documentation for this class was generated from the following files: