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

Vulkan API has the following concepts. More...

#include <VulkanContext.h>

Inheritance diagram for Karma::VulkanContext:
Karma::GraphicsContext

Public Member Functions

 VulkanContext (GLFWwindow *windowHandle)
 A constructor to set the m_vulkanRendererAPI (using static_cast, or compilet time cast). Also checks the validity of windowHandle.
virtual ~VulkanContext () override
 Destructor of vulkan context. Does the following.
virtual void Init () override
 Initializes VulkanContext by creating appropriate Vulkan and glslang specific instruments and allocating resources accordingly.
virtual void SwapBuffers () override
 In Vulkan there is no default framebuffer, hence we need to explicitly swap the buffers in the swapchain.
virtual bool OnWindowResize (WindowResizeEvent &event) override
 Calls glViewport function which specifies the affine transformation of x and y from normalized device coordinates to window coordinates.
void CreateInstance ()
 Creates Vulkan Instance which is the connection between application, which is a Game Engine, and Vulkan library.
void PrintAvailableExtensions ()
 Prints all the available extensions supported by the system's Vulkan implementation.
void PrintAvailablePhysicalDevices (const std::vector< VkPhysicalDevice > &physicalDevices)
 Prints all the available physical devices (graphics cards) supported by the system's Vulkan implementation.
bool CheckValidationLayerSupport ()
std::vector< const char * > GetRequiredExtensions (VkInstanceCreateFlags &flagsToBeSet)
void SetupDebugMessenger ()
void PopulateDebugMessengerCreateInfo (VkDebugUtilsMessengerCreateInfoEXT &createInfo)
VkResult CreateDebugUtilsMessengerEXT (VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pDebugMessenger)
void DestroyDebugUtilsMessengerEXT (VkInstance instance, VkDebugUtilsMessengerEXT debugMessenger, const VkAllocationCallbacks *pAllocator)
void CreateSurface ()
 Platform agnostic creation of surface to present rendered images to. Typically they are backed by the category of glfw windows (on Linux, MacOS, and Windows).
void PickPhysicalDevice ()
 Picks the appropriate physical device (graphics card) for the Engine to use based on suitability.
bool IsDeviceSuitable (VkPhysicalDevice device)
 Checks if the physical device (graphics card) is suitable for the Engine to use based on.
QueueFamilyIndices FindQueueFamilies (VkPhysicalDevice device)
 Queries the graphics card for available queue families and compares against the availability of graphics and presentation queues.
void CreateLogicalDevice ()
 The so called logical device for interfacing with the physical device. All the machinery (swapchain, graphicspipeline, and all that) are created from logical device. Following is done:
void CreateSwapChain ()
 Vulkan does not have the concept of a "default framebuffer", hence it requires an infrastructure that will own the buffers we will render to before we visualize them on the screen. This infrastructure is known as the swap chain and must be created explicitly in Vulkan. The swap chain is essentially a queue of images that are waiting to be presented to the screen. Our backend will acquire such an image to draw to it, and then return it to the queue. Then swapchain will have to sync the presentation of image with refresh rate of the monitor.
bool CheckDeviceExtensionSupport (VkPhysicalDevice device)
 Looks for extension properties supported by the GPU.
SwapChainSupportDetails QuerySwapChainSupport (VkPhysicalDevice device)
 Uses Two-Pass Query to gather surface formats (physical device and surface paired color space or pixel format data) and present modes data.
VkSurfaceFormatKHR ChooseSwapSurfaceFormat (const std::vector< VkSurfaceFormatKHR > &availableFormats)
 Chooses the best surface format (pixel format and color space) for the swapchain from the available formats.
VkPresentModeKHR ChooseSwapPresentMode (const std::vector< VkPresentModeKHR > &availablePresentModes)
 Chooses the best presentation mode for the swapchain from the available present modes.
VkExtent2D ChooseSwapExtent (const VkSurfaceCapabilitiesKHR &capabilities)
 Chooses the swap extent (resolution of the swapchain images) based on the capabilities of the surface and the actual window size.
uint32_t FindMemoryType (uint32_t typeFilter, VkMemoryPropertyFlags properties)
 Finds a suitable memory type on the physical device (graphics card) based on the type filter and desired properties.
void CreateImageViews ()
 An image view is quite literally a view into an image. It describes how to access the image and which part of the image to access, for example if it should be treated as a 2D texture depth texture without any mipmapping levels. ImageView is a wrapper around render target.
void CreateRenderPass ()
 A VkRenderPass is a Vulkan object that encapsulates the state needed to setup the “target” for rendering, and the state of the images we will be rendering to. The "targets" are also known as render targets and include the attachments like colorattachment and depthattachment that describe where the rendering output will go to.
void CreateFrameBuffers ()
 Framebuffers are collections of specific memory attachments that a render pass instance uses. They represent the actual memory that the rendering operations will write to.
void CreateCommandPool ()
 Command pools are opaque objects that command buffer memory is allocated from, and which allow the implementation to amortize the cost of resource creation.
void CreateDepthResources ()
 Creates the depth resources (image, imageview, and memory) for depth buffering in 3D rendering.
VkFormat FindSupportedFormat (const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features)
 Finds a supported format from the list of candidate formats based on the desired tiling and features. Used in depth resource creation.
VkFormat FindDepthFormat ()
 Finds a suitable depth format for depth buffering.
bool HasStencilComponent (VkFormat format)
 Checks if the given format has a stencil component.
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 an image.
void RecreateSwapChain ()
 Recreates the swapchain, typically in response to window resizing or other events that invalidate the current swapchain.
void CleanupSwapChain ()
 Cleans up the swapchain and its associated resources.
void SetVSync (bool bEnable)
 Enables or disables vertical synchronization (VSync) for the swapchain.
void Initializeglslang ()
 Initializes the glslang library for shader compilation and processing.
void RegisterUBO (const std::shared_ptr< VulkanUniformBuffer > &ubo)
 Registers a VulkanUniformBuffer for management by the VulkanContext.
void ClearUBO ()
 Clears all registered VulkanUniformBuffers, freeing their resources.
void RecreateUBO ()
 Recreates all registered VulkanUniformBuffers, typically in response to swapchain recreation.
void UploadUBO (size_t frameIndex)
 Uploads data to the registered VulkanUniformBuffers for the specified frame index.
VkDevice GetLogicalDevice () const
VkPhysicalDevice GetPhysicalDevice () const
VkExtent2D GetSwapChainExtent () const
VkRenderPass GetRenderPass () const
const std::vector< VkFramebuffer > & GetSwapChainFrameBuffer () const
VkSwapchainKHR GetSwapChain () const
const std::vector< VkImage > & GetSwapChainImages () const
VkFormat GetSwapChainImageFormat () const
const std::vector< VkImageView > & GetSwapChainImageViews () const
VkSurfaceFormatKHR GetSurfaceFormat () const
VkQueue GetGraphicsQueue () const
VkQueue GetPresentQueue () const
VkCommandPool GetCommandPool () const
VkImageView GetDepthImageView () const
const VkPhysicalDeviceFeatures & GetSupportedDeviceFeatures () const
VkInstance GetInstance () const
uint32_t GetImageCount () const
uint32_t GetMinImageCount () const
VkSurfaceKHR GetSurface () const
VkPresentModeKHR GetPresentMode () const
Public Member Functions inherited from Karma::GraphicsContext
virtual ~GraphicsContext ()
 A destructor.

Static Public Member Functions

static VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback (VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *pUserData)

Detailed Description

Vulkan API has the following concepts.

  1. Physical Device (https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Physical_devices_and_queue_families): The software counterpart (VkPhysicalDevice) of a graphics card (GPU). Logical device is created from physical device.
  2. Device (https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Logical_device_and_queues): The so called logical device for interfacing with the physical device. All the machinery (swapchain, graphicspipeline, and all that) are created from logical device.

Host : is CPU the host?

Constructor & Destructor Documentation

◆ VulkanContext()

Karma::VulkanContext::VulkanContext ( GLFWwindow * windowHandle)

A constructor to set the m_vulkanRendererAPI (using static_cast, or compilet time cast). Also checks the validity of windowHandle.

Parameters
windowHandleThe glfw window handle
Since
Karma 1.0.0

◆ ~VulkanContext()

Karma::VulkanContext::~VulkanContext ( )
overridevirtual

Destructor of vulkan context. Does the following.

  1. Free the commandbuffers (VulkanRendererAPI::AllocateCommandBuffers()) and removes synchronicity
  2. Destroy the framebuffers (CreateFrameBuffers())
  3. Destroy depth imageview (CreateDepthResources())
  4. Destroy image (CreateDepthResources())
  5. Free up depthimagememory (CreateDepthResources())
  6. Destroy command pool (CreateCommandPool())
  7. Destroy render pass (CreateRenderPass())
  8. Destroy swapchain imageview (CreateImageViews())
  9. Destroy swapchain (CreateSwapChain())
  10. Destroy the vulkan m_device (CreateLogicalDevice())
  11. Destroy validation layers for debug messages (SetupDebugMessenger())
  12. Destroy surface (CreateSurface())
  13. Destroy instance (CreateInstance())
  14. Destroy glslang memory resources for cleanup
See also
Init()
Since
Karma 1.0.0

Member Function Documentation

◆ CheckDeviceExtensionSupport()

bool Karma::VulkanContext::CheckDeviceExtensionSupport ( VkPhysicalDevice device)

Looks for extension properties supported by the GPU.

Calls vkEnumerateDeviceExtensionProperties for list of supported extensions for instance VK_KHR_swapchain which is required for, well, swapchain

@

◆ ChooseSwapExtent()

VkExtent2D Karma::VulkanContext::ChooseSwapExtent ( const VkSurfaceCapabilitiesKHR & capabilities)

Chooses the swap extent (resolution of the swapchain images) based on the capabilities of the surface and the actual window size.

Parameters
capabilitiesThe surface capabilities (from QuerySwapChainSupport())
See also
VulkanContext::CreateSwapChain()
Since
Karma 1.0.0

◆ ChooseSwapPresentMode()

VkPresentModeKHR Karma::VulkanContext::ChooseSwapPresentMode ( const std::vector< VkPresentModeKHR > & availablePresentModes)

Chooses the best presentation mode for the swapchain from the available present modes.

Basically looks for VK_PRESENT_MODE_MAILBOX_KHR (triple buffering) first, then VK_PRESENT_MODE_IMMEDIATE_KHR (tearing possible), and finally defaults to VK_PRESENT_MODE_FIFO_KHR (always available, v-sync)

Parameters
availablePresentModesThe available presentation modes (from QuerySwapChainSupport())
See also
VulkanContext::CreateSwapChain()
Since
Karma 1.0.0

◆ ChooseSwapSurfaceFormat()

VkSurfaceFormatKHR Karma::VulkanContext::ChooseSwapSurfaceFormat ( const std::vector< VkSurfaceFormatKHR > & availableFormats)

Chooses the best surface format (pixel format and color space) for the swapchain from the available formats.

Basically looks for VK_FORMAT_B8G8R8A8_SRGB and VK_COLOR_SPACE_SRGB_NONLINEAR_KHR combination.

VK_FORMAT_B8G8R8A8_SRGB : represents a 32-bit format with 8 bits for each of the blue, green, red, and alpha channels in sRGB color space. This format is widely used for swapchain images and color attachments.

VK_COLOR_SPACE_SRGB_NONLINEAR_KHR : represents the sRGB color space with a nonlinear gamma curve. This color space is commonly used for displaying images on standard monitors.

Parameters
availableFormatsThe available surface formats (from QuerySwapChainSupport())
See also
VulkanContext::CreateSwapChain()
Since
Karma 1.0.0

◆ CleanupSwapChain()

void Karma::VulkanContext::CleanupSwapChain ( )

Cleans up the swapchain and its associated resources.

This involves destroying the framebuffers, image views, and the swapchain itself.

See also
VulkanContext::RecreateSwapChain()
Since
Karma 1.0.0

◆ ClearUBO()

void Karma::VulkanContext::ClearUBO ( )

Clears all registered VulkanUniformBuffers, freeing their resources.

See also
VulkanContext::m_VulkanUBO
Since
Karma 1.0.0

◆ CopyBufferToImage()

void Karma::VulkanContext::CopyBufferToImage ( VkBuffer buffer,
VkImage image,
uint32_t width,
uint32_t height )

Copies data from a buffer to an image.

This is typically used for uploading texture data from a staging buffer to a Vulkan image.

Parameters
bufferThe source buffer containing the data
imageThe destination image
widthThe width of the image
heightThe height of the image
See also
VulkanTexture::CreateTextureImage()
Since
Karma 1.0.0

◆ CreateCommandPool()

void Karma::VulkanContext::CreateCommandPool ( )

Command pools are opaque objects that command buffer memory is allocated from, and which allow the implementation to amortize the cost of resource creation.

Since
Karma 1.0.0

◆ CreateDepthResources()

void Karma::VulkanContext::CreateDepthResources ( )

Creates the depth resources (image, imageview, and memory) for depth buffering in 3D rendering.

Note
Depth buffering is a technique used in 3D computer graphics to determine the visibility of objects in a scene based on their distance from the viewer. It helps in rendering scenes with proper occlusion, ensuring that closer objects obscure those that are farther away.
Since
Karma 1.0.0

◆ CreateFrameBuffers()

void Karma::VulkanContext::CreateFrameBuffers ( )

Framebuffers are collections of specific memory attachments that a render pass instance uses. They represent the actual memory that the rendering operations will write to.

Since
Karma 1.0.0

◆ CreateImageViews()

void Karma::VulkanContext::CreateImageViews ( )

An image view is quite literally a view into an image. It describes how to access the image and which part of the image to access, for example if it should be treated as a 2D texture depth texture without any mipmapping levels. ImageView is a wrapper around render target.

Note
Here we are creating depth images ? Basically depth is taken care of by depth attachment render target (created in VulkanContext::CreateRenderPass())
Since
Karma 1.0.0

◆ CreateInstance()

void Karma::VulkanContext::CreateInstance ( )

Creates Vulkan Instance which is the connection between application, which is a Game Engine, and Vulkan library.

Since
Karma 1.0.0

◆ CreateLogicalDevice()

void Karma::VulkanContext::CreateLogicalDevice ( )

The so called logical device for interfacing with the physical device. All the machinery (swapchain, graphicspipeline, and all that) are created from logical device. Following is done:

  1. Inquires the graphics card for available queue families (FindQueueFamilies)
  2. Create queues from both graphics and presentation families The logical device (VkDevice) m_device is created with the above features
Note
Various Vulkan operations from graphics to compute are asynchronously executed by submitting them to the queues having different cababilities depending on the queue family they are derived from.
See also
VulkanContext::FindQueueFamilies()
Since
Karma 1.0.0

◆ CreateRenderPass()

void Karma::VulkanContext::CreateRenderPass ( )

A VkRenderPass is a Vulkan object that encapsulates the state needed to setup the “target” for rendering, and the state of the images we will be rendering to. The "targets" are also known as render targets and include the attachments like colorattachment and depthattachment that describe where the rendering output will go to.

Since
Karma 1.0.0

◆ CreateSurface()

void Karma::VulkanContext::CreateSurface ( )

Platform agnostic creation of surface to present rendered images to. Typically they are backed by the category of glfw windows (on Linux, MacOS, and Windows).

Since
Karma 1.0.0

◆ CreateSwapChain()

void Karma::VulkanContext::CreateSwapChain ( )

Vulkan does not have the concept of a "default framebuffer", hence it requires an infrastructure that will own the buffers we will render to before we visualize them on the screen. This infrastructure is known as the swap chain and must be created explicitly in Vulkan. The swap chain is essentially a queue of images that are waiting to be presented to the screen. Our backend will acquire such an image to draw to it, and then return it to the queue. Then swapchain will have to sync the presentation of image with refresh rate of the monitor.

  1. Sets the size of m_swapChainImages based on supported number of images by the graphics card
  2. Sets m_surfaceFormat and m_presentMode
Note
Requires the availability of Requires VK_KHR_swapchain extension which is queried in IsDeviceSuitable() (which calls CheckDeviceExtensionSupport()).
See also
VulkanContext::ChooseSwapExtent(), VulkanContext::QuerySwapChainSupport()
Since
Karma 1.0.0

◆ FindDepthFormat()

VkFormat Karma::VulkanContext::FindDepthFormat ( )

Finds a suitable depth format for depth buffering.

See also
VulkanContext::CreateDepthResources()
Since
Karma 1.0.0

◆ FindMemoryType()

uint32_t Karma::VulkanContext::FindMemoryType ( uint32_t typeFilter,
VkMemoryPropertyFlags properties )

Finds a suitable memory type on the physical device (graphics card) based on the type filter and desired properties.

Parameters
typeFilterBitmask specifying the acceptable memory types
propertiesDesired memory properties (like VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT for CPU access)
See also
VulkanBuffer::VulkanBuffer()
Since
Karma 1.0.0

◆ FindQueueFamilies()

QueueFamilyIndices Karma::VulkanContext::FindQueueFamilies ( VkPhysicalDevice device)

Queries the graphics card for available queue families and compares against the availability of graphics and presentation queues.

Parameters
deviceThe graphics card to be queired for queue family
Since
Karma 1.0.0

◆ FindSupportedFormat()

VkFormat Karma::VulkanContext::FindSupportedFormat ( const std::vector< VkFormat > & candidates,
VkImageTiling tiling,
VkFormatFeatureFlags features )

Finds a supported format from the list of candidate formats based on the desired tiling and features. Used in depth resource creation.

See also
VulkanContext::FindDepthFormat()
Since
Karma 1.0.0

◆ HasStencilComponent()

bool Karma::VulkanContext::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

Parameters
formatThe format to be checked
See also
VulkanContext::TransitionImageLayout()
Since
Karma 1.0.0

◆ Init()

void Karma::VulkanContext::Init ( )
overridevirtual

Initializes VulkanContext by creating appropriate Vulkan and glslang specific instruments and allocating resources accordingly.

  1. Create Instance;
  2. Setup Debug Messenger
  3. Create Surface
  4. Pick PhysicalDevice
  5. Create Logical Device
  6. Create Swap Chain
  7. Create ImageViews
  8. Create RenderPass
  9. Create CommandPool
  10. Create DepthResources
  11. Create FrameBuffers
  12. VulkanHolder::SetVulkanContext(this) (VulkanHolder::m_VulkanContext)
  13. m_vulkanRendererAPI->CreateSynchronicity()
  14. Initialize glslang()
See also
~VulkanContext()
Since
Karma 1.0.0

Implements Karma::GraphicsContext.

◆ Initializeglslang()

void Karma::VulkanContext::Initializeglslang ( )

Initializes the glslang library for shader compilation and processing.

Since
Karma 1.0.0

◆ IsDeviceSuitable()

bool Karma::VulkanContext::IsDeviceSuitable ( VkPhysicalDevice device)

Checks if the physical device (graphics card) is suitable for the Engine to use based on.

avaibality of required queue families (graphics and presentation), required device extensions (like VK_KHR_swapchain), sampler anisotropy support (which is anisotropic filtering support in samplers, allowing higher-quality texture sampling at oblique angles to reduce blurring and aliasing artifacts seen in standard bilinear filtering.)

Parameters
deviceThe graphics card to be checked for suitability
Since
Karma 1.0.0

◆ OnWindowResize()

virtual bool Karma::VulkanContext::OnWindowResize ( WindowResizeEvent & event)
inlineoverridevirtual

Calls glViewport function which specifies the affine transformation of x and y from normalized device coordinates to window coordinates.

Todo
Seems OpenGL specific. Either think about usage in Vulkan or re design
Since
Karma 1.0.0

Implements Karma::GraphicsContext.

◆ PickPhysicalDevice()

void Karma::VulkanContext::PickPhysicalDevice ( )

Picks the appropriate physical device (graphics card) for the Engine to use based on suitability.

See also
VulkanContext::IsDeviceSuitable()
Since
Karma 1.0.0

◆ PrintAvailableExtensions()

void Karma::VulkanContext::PrintAvailableExtensions ( )

Prints all the available extensions supported by the system's Vulkan implementation.

For instance VK_KHR_Surface or VK_KHR_get_physical_device_properties2.

See also
VulkanContext::CreateInstance()
Since
Karma 1.0.0

◆ PrintAvailablePhysicalDevices()

void Karma::VulkanContext::PrintAvailablePhysicalDevices ( const std::vector< VkPhysicalDevice > & physicalDevices)

Prints all the available physical devices (graphics cards) supported by the system's Vulkan implementation.

See also
VulkanContext::CreateInstance()
Since
Karma 1.0.0

◆ QuerySwapChainSupport()

SwapChainSupportDetails Karma::VulkanContext::QuerySwapChainSupport ( VkPhysicalDevice device)

Uses Two-Pass Query to gather surface formats (physical device and surface paired color space or pixel format data) and present modes data.

See also
VulkanContext::IsDeviceSuitable(), and VulkanContext::CreateSwapChain()
Since
Karma 1.0.0

◆ RecreateSwapChain()

void Karma::VulkanContext::RecreateSwapChain ( )

Recreates the swapchain, typically in response to window resizing or other events that invalidate the current swapchain.

This involves cleaning up the existing swapchain and its associated resources, and then creating a new swapchain with updated parameters.

See also
VulkanRendererAPI::RecreateCommandBuffersAndSwapChain(), KarmaGuiRenderer::GiveLoopBeginControlToVulkan()
Since
Karma 1.0.0

◆ RecreateUBO()

void Karma::VulkanContext::RecreateUBO ( )

Recreates all registered VulkanUniformBuffers, typically in response to swapchain recreation.

See also
VulkanRendererAPI::RecreateCommandBuffersPipelineSwapchain()
Since
Karma 1.0.0

◆ RegisterUBO()

void Karma::VulkanContext::RegisterUBO ( const std::shared_ptr< VulkanUniformBuffer > & ubo)

Registers a VulkanUniformBuffer for management by the VulkanContext.

See also
VulkanContext::m_VulkanUBO
Since
Karma 1.0.0

◆ SetVSync()

void Karma::VulkanContext::SetVSync ( bool bEnable)

Enables or disables vertical synchronization (VSync) for the swapchain.

VSync synchronizes the frame rate of the application with the refresh rate of the monitor to prevent screen tearing.

Parameters
bEnableTrue to enable VSync, false to disable
See also
WindowsWindow::SetVSync, VulkanContext::ChooseSwapPresentMode()
Since
Karma 1.0.0

◆ SwapBuffers()

void Karma::VulkanContext::SwapBuffers ( )
overridevirtual

In Vulkan there is no default framebuffer, hence we need to explicitly swap the buffers in the swapchain.

For instance, acquire an image from the swapchain, execute the command buffer with that image as attachment in the framebuffer, and return the image to the swapchain for presentation. All these are done in VulkanRendererAPI::SubmitCommandBuffers(). So no need to do anything here.

See also
VulkanRendererAPI::SubmitCommandBuffers()
Since
Karma 1.0.0

Implements Karma::GraphicsContext.

◆ TransitionImageLayout()

void Karma::VulkanContext::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.

Parameters
imageThe image to be transitioned
formatThe format of the image
oldLayoutThe current layout of the image
newLayoutThe desired layout of the image
See also
VulkanTexture::CreateTextureImage()
Since
Karma 1.0.0

◆ UploadUBO()

void Karma::VulkanContext::UploadUBO ( size_t frameIndex)

Uploads data to the registered VulkanUniformBuffers for the specified frame index.

Typically called during rendering to update uniform buffer data for the current frame like so

vkCmdBeginRenderPass
vkCmdBindPipeline
vkCmdBindVertexBuffers
vkCmdBindIndexBuffer
vkCmdBindDescriptorSets // Descriptor sets include UBOs
vkCmdDrawIndexed
vkCmdEndRenderPass
void UploadUBO(size_t frameIndex)
Uploads data to the registered VulkanUniformBuffers for the specified frame index.
Definition VulkanContext.cpp:68
Parameters
frameIndexThe index of the frame for which to upload UBO data
See also
KarmaGuiRenderer::FrameRender, VulkanBuffer::UploadUniformBuffer
Since
Karma 1.0.0

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