Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Core::ApplicationContext Class Reference

The application context is the core class which stores the basic openxr and vulkan objects. More...

#include <ApplicationContext.h>

Collaboration diagram for Engine::Core::ApplicationContext:

Classes

struct  QueueFamily

Public Member Functions

 ApplicationContext ()=default
 ~ApplicationContext ()=default
void createDevice (VkSurfaceKHR mirrorSurface)
 Creates the vulkan device and all necessary components for it.
XrInstance getXrInstance () const
 Gets xr instance.
XrSystemId getXrSystemId () const
 Gets xr system identifier.
VkInstance getVkInstance () const
 Gets vulkan instance.
const VkDevice getVkDevice () const
 Gets the vulkan device.
const VkQueue & getPresentQueue () const
 Gets the present queue.
const VkQueue & getGraphicsQueue () const
 Gets draw queue.
const VkQueue & getTransferQueue () const
 Gets the transfer queue.
VkSampleCountFlagBits getMultisampleCount () const
 Gets multisample count.
const VkPhysicalDevice & getVkPhysicalDevice () const
 Gets vulkan physical device.
uint32_t getVkGraphicsQueueFamilyIndex () const
 Gets the zero-based index of the vulkan draw queue family.
uint32_t getVkTransferQueueFamilyIndex () const
 gets the transfer queue family index
VkDeviceSize getUniformBufferOffsetAlignment () const
 Gets uniform buffer offset alignment.
uint32_t getMaxPushConstantsSize () const
 Gets max push constants size in bytes.
const XrViewConfigurationType getXrViewType () const
 Gets xr view type which should be stereo for any typical VR application.
void createResources ()
 creates all openxr and vulkan resources
void cleanup ()
 performs the cleanup by removing all vulkan and openxr pointers
bool usesDedicatedTransferQueue () const
 Check if the transfer queue index is its own, dedicated queue.
VmaAllocator getVmaAllocator () const
 Gets the VMA allocator for memory management.
SamplerCachegetSamplerCache ()
bool isMeshShaderSupported () const
bool isFbColorSpaceSupported () const

Private Member Functions

void pickQueueFamilies (VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t &outGraphicsIndex, uint32_t &outPresentIndex, uint32_t &outTransferIndex)
 gets the device queues needed
void createOpenXrInstance (std::optional< std::filesystem::path > customOpenXrRuntimePath=std::optional< std::filesystem::path >())
 Queries supported openxr instance extensions, openxr api layers and creates the XrInstance.
void LoadOpenXrExtensionFunctions ()
 Loads all dynamically loaded xr functions.
void retrieveXrSystemId ()
 Gets the XrSystemId.
void checkRequiredEnvironmentBlendModeAvailability ()
 Gets the environment blend mode.
void getVulkanInstanceExtensions ()
 Gets vulkan instance extensions.
void logVulkanRequirements ()
 Logs vulkan requirements.
void createVulkanInstance ()
 Creates a vulkan instance.

Static Private Member Functions

static void validateFeature (VkBool32 feature, const std::string &errorMessage)

Private Attributes

bool fbColorSpaceSupported_ = false
PFN_xrGetVulkanInstanceExtensionsKHR xrGetVulkanInstanceExtensionsKHR = nullptr
PFN_xrGetVulkanGraphicsDevice2KHR xrGetVulkanGraphicsDevice2KHR = nullptr
PFN_xrGetVulkanGraphicsRequirements2KHR xrGetVulkanGraphicsRequirements2KHR = nullptr
PFN_xrCreateVulkanInstanceKHR xrCreateVulkanInstanceKHR = nullptr
PFN_xrCreateVulkanDeviceKHR xrCreateVulkanDeviceKHR = nullptr
std::vector< XrExtensionProperties > supportedOpenXRInstanceExtensions
 The supported open xr instance extensions.
std::vector< XrApiLayerProperties > supportedOpenXRApiLayers
 The supported open xr API layers.
XrInstance xrInstance = XR_NULL_HANDLE
 The xr instance.
XrSystemId xrSystemId = XR_NULL_SYSTEM_ID
 Identifier for the xr device. So the identifier for the headset.
std::vector< VkExtensionProperties > supportedVulkanInstanceExtensions
 The supported vulkan instance extensions.
std::vector< const char * > vulkanInstanceExtensions
 (Immutable) the vulkan instance extensions which should get enabled
VkInstance vkInstance = VK_NULL_HANDLE
 The vulkan instance.
VkPhysicalDevice vkPhysicalDevice = VK_NULL_HANDLE
 The vulkan physical device.
std::vector< VkExtensionProperties > supportedVulkanDeviceExtensions
 The supported vulkan device extensions.
std::vector< const char * > vulkanDeviceExtensions
 (Immutable) the vulkan device extensions
VkDeviceSize uniformBufferOffsetAlignment = 0u
 The uniform buffer offset alignment.
VkSampleCountFlagBits multisampleCount = VK_SAMPLE_COUNT_1_BIT
 Number of multisamples.
uint32_t maxPushConstantsSize = 128u
 Maximum push constants size in bytes.
struct Engine::Core::ApplicationContext::QueueFamily queueFamily
VkDevice vkDevice = VK_NULL_HANDLE
VmaAllocator vmaAllocator_ = VK_NULL_HANDLE
 VMA allocator for efficient GPU memory management.
bool meshShaderSupported_ = false
SamplerCache samplerCache_

Detailed Description

The application context is the core class which stores the basic openxr and vulkan objects.

Definition at line 56 of file ApplicationContext.h.

Constructor & Destructor Documentation

◆ ApplicationContext()

Engine::Core::ApplicationContext::ApplicationContext ( )
default

◆ ~ApplicationContext()

Engine::Core::ApplicationContext::~ApplicationContext ( )
default

Member Function Documentation

◆ checkRequiredEnvironmentBlendModeAvailability()

void Engine::Core::ApplicationContext::checkRequiredEnvironmentBlendModeAvailability ( )
private

Gets the environment blend mode.

Date
2025-02-12
Author
Konstantin Passig

◆ cleanup()

void Engine::Core::ApplicationContext::cleanup ( )

performs the cleanup by removing all vulkan and openxr pointers

◆ createDevice()

void Engine::Core::ApplicationContext::createDevice ( VkSurfaceKHR mirrorSurface)

Creates the vulkan device and all necessary components for it.

Parameters
mirrorSurfaceThe mirror surface.

◆ createOpenXrInstance()

void Engine::Core::ApplicationContext::createOpenXrInstance ( std::optional< std::filesystem::path > customOpenXrRuntimePath = std::optional< std::filesystem::path >())
private

Queries supported openxr instance extensions, openxr api layers and creates the XrInstance.

Date
2025-02-12
Author
Konstantin Passig
Exceptions
std::runtime_errorWhen something which should have been executed failed.
EnvironmentExceptionWhen for example SteamVR has not been started before launching the application.

◆ createResources()

void Engine::Core::ApplicationContext::createResources ( )

creates all openxr and vulkan resources

◆ createVulkanInstance()

void Engine::Core::ApplicationContext::createVulkanInstance ( )
private

Creates a vulkan instance.

Date
2025-02-08
Author
Konstantin Passig

◆ getGraphicsQueue()

const VkQueue & Engine::Core::ApplicationContext::getGraphicsQueue ( ) const
nodiscard

Gets draw queue.

Returns
The draw queue.
Date
2025-02-15
Author
Konstantin Passig

◆ getMaxPushConstantsSize()

uint32_t Engine::Core::ApplicationContext::getMaxPushConstantsSize ( ) const
nodiscard

Gets max push constants size in bytes.

Returns
The maximum push constants size supported by the GPU.
Date
2025-10-15
Author
Konstantin Passig

◆ getMultisampleCount()

VkSampleCountFlagBits Engine::Core::ApplicationContext::getMultisampleCount ( ) const
nodiscard

Gets multisample count.

Returns
The multisample count.
Date
2025-02-14
Author
Konstantin Passig

◆ getPresentQueue()

const VkQueue & Engine::Core::ApplicationContext::getPresentQueue ( ) const
nodiscard

Gets the present queue.

Returns
The present queue.
Date
2025-02-15
Author
Konstantin Passig

◆ getSamplerCache()

SamplerCache & Engine::Core::ApplicationContext::getSamplerCache ( )
inlinenodiscard

Definition at line 230 of file ApplicationContext.h.

References samplerCache_.

◆ getTransferQueue()

const VkQueue & Engine::Core::ApplicationContext::getTransferQueue ( ) const
nodiscard

Gets the transfer queue.

Returns
The transfer queue.
Date
2025-04-02
Author
Konstantin Passig

◆ getUniformBufferOffsetAlignment()

VkDeviceSize Engine::Core::ApplicationContext::getUniformBufferOffsetAlignment ( ) const
nodiscard

Gets uniform buffer offset alignment.

Returns
The uniform buffer offset alignment.
Date
2025-02-15
Author
Konstantin Passig

◆ getVkDevice()

const VkDevice Engine::Core::ApplicationContext::getVkDevice ( ) const
nodiscard

Gets the vulkan device.

Returns
The vulkan device.
Date
2025-02-14
Author
Konstantin Passig

◆ getVkGraphicsQueueFamilyIndex()

uint32_t Engine::Core::ApplicationContext::getVkGraphicsQueueFamilyIndex ( ) const
nodiscard

Gets the zero-based index of the vulkan draw queue family.

Returns
The vulkan draw queue family index.
Date
2025-02-14
Author
Konstantin Passig

◆ getVkInstance()

VkInstance Engine::Core::ApplicationContext::getVkInstance ( ) const
nodiscard

Gets vulkan instance.

Returns
The vulkan instance.

◆ getVkPhysicalDevice()

const VkPhysicalDevice & Engine::Core::ApplicationContext::getVkPhysicalDevice ( ) const
nodiscard

Gets vulkan physical device.

Returns
The vulkan physical device.
Date
2025-02-14
Author
Konstantin Passig

◆ getVkTransferQueueFamilyIndex()

uint32_t Engine::Core::ApplicationContext::getVkTransferQueueFamilyIndex ( ) const
nodiscard

gets the transfer queue family index

Returns
zero indexed transfer queue index
Date
2025-04-02
Author
Konstantin Passig

◆ getVmaAllocator()

VmaAllocator Engine::Core::ApplicationContext::getVmaAllocator ( ) const
nodiscard

Gets the VMA allocator for memory management.

Returns
The VMA allocator instance
Date
2026-01-24
Author
Konstantin Passig

◆ getVulkanInstanceExtensions()

void Engine::Core::ApplicationContext::getVulkanInstanceExtensions ( )
private

Gets vulkan instance extensions.

Date
2025-02-08
Author
Konstantin Passig

◆ getXrInstance()

XrInstance Engine::Core::ApplicationContext::getXrInstance ( ) const
nodiscard

Gets xr instance.

Returns
The xr instance.

◆ getXrSystemId()

XrSystemId Engine::Core::ApplicationContext::getXrSystemId ( ) const
nodiscard

Gets xr system identifier.

Returns
The xr system identifier.

◆ getXrViewType()

const XrViewConfigurationType Engine::Core::ApplicationContext::getXrViewType ( ) const
nodiscard

Gets xr view type which should be stereo for any typical VR application.

Returns
The xr view type.
Date
2025-02-15
Author
Konstantin Passig

◆ isFbColorSpaceSupported()

bool Engine::Core::ApplicationContext::isFbColorSpaceSupported ( ) const
inlinenodiscard

Definition at line 233 of file ApplicationContext.h.

References fbColorSpaceSupported_.

◆ isMeshShaderSupported()

bool Engine::Core::ApplicationContext::isMeshShaderSupported ( ) const
nodiscard

◆ LoadOpenXrExtensionFunctions()

void Engine::Core::ApplicationContext::LoadOpenXrExtensionFunctions ( )
private

Loads all dynamically loaded xr functions.

◆ logVulkanRequirements()

void Engine::Core::ApplicationContext::logVulkanRequirements ( )
private

Logs vulkan requirements.

Date
2025-02-08
Author
Konstantin Passig

◆ pickQueueFamilies()

void Engine::Core::ApplicationContext::pickQueueFamilies ( VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t & outGraphicsIndex,
uint32_t & outPresentIndex,
uint32_t & outTransferIndex )
private

gets the device queues needed

Parameters
physicalDevicethe vulkan physical device
surfacethe mirror surface
outGraphicsIndex
outPresentIndex
outTransferIndex
Date
2025-04-02
Author
Konstantin Passig

◆ retrieveXrSystemId()

void Engine::Core::ApplicationContext::retrieveXrSystemId ( )
private

Gets the XrSystemId.

Date
2025-02-12
Author
Konstantin Passig

◆ usesDedicatedTransferQueue()

bool Engine::Core::ApplicationContext::usesDedicatedTransferQueue ( ) const
nodiscard

Check if the transfer queue index is its own, dedicated queue.

Returns
if the transfer queue index != graphics queue index
Date
2025-06-18
Author
Konstantin Passig

◆ validateFeature()

void Engine::Core::ApplicationContext::validateFeature ( VkBool32 feature,
const std::string & errorMessage )
staticprivate

Member Data Documentation

◆ fbColorSpaceSupported_

bool Engine::Core::ApplicationContext::fbColorSpaceSupported_ = false
private

Definition at line 238 of file ApplicationContext.h.

Referenced by isFbColorSpaceSupported().

◆ maxPushConstantsSize

uint32_t Engine::Core::ApplicationContext::maxPushConstantsSize = 128u
private

Maximum push constants size in bytes.

Definition at line 399 of file ApplicationContext.h.

◆ meshShaderSupported_

bool Engine::Core::ApplicationContext::meshShaderSupported_ = false
private

Definition at line 421 of file ApplicationContext.h.

◆ multisampleCount

VkSampleCountFlagBits Engine::Core::ApplicationContext::multisampleCount = VK_SAMPLE_COUNT_1_BIT
private

Number of multisamples.

Definition at line 395 of file ApplicationContext.h.

◆ queueFamily

struct Engine::Core::ApplicationContext::QueueFamily Engine::Core::ApplicationContext::queueFamily
private

◆ samplerCache_

SamplerCache Engine::Core::ApplicationContext::samplerCache_
private

Definition at line 423 of file ApplicationContext.h.

Referenced by getSamplerCache().

◆ supportedOpenXRApiLayers

std::vector<XrApiLayerProperties> Engine::Core::ApplicationContext::supportedOpenXRApiLayers
private

The supported open xr API layers.

Definition at line 341 of file ApplicationContext.h.

◆ supportedOpenXRInstanceExtensions

std::vector<XrExtensionProperties> Engine::Core::ApplicationContext::supportedOpenXRInstanceExtensions
private

The supported open xr instance extensions.

Definition at line 336 of file ApplicationContext.h.

◆ supportedVulkanDeviceExtensions

std::vector<VkExtensionProperties> Engine::Core::ApplicationContext::supportedVulkanDeviceExtensions
private

The supported vulkan device extensions.

Definition at line 383 of file ApplicationContext.h.

◆ supportedVulkanInstanceExtensions

std::vector<VkExtensionProperties> Engine::Core::ApplicationContext::supportedVulkanInstanceExtensions
private

The supported vulkan instance extensions.

Definition at line 363 of file ApplicationContext.h.

◆ uniformBufferOffsetAlignment

VkDeviceSize Engine::Core::ApplicationContext::uniformBufferOffsetAlignment = 0u
private

The uniform buffer offset alignment.

Definition at line 391 of file ApplicationContext.h.

◆ vkDevice

VkDevice Engine::Core::ApplicationContext::vkDevice = VK_NULL_HANDLE
private

Definition at line 414 of file ApplicationContext.h.

◆ vkInstance

VkInstance Engine::Core::ApplicationContext::vkInstance = VK_NULL_HANDLE
private

The vulkan instance.

Definition at line 373 of file ApplicationContext.h.

◆ vkPhysicalDevice

VkPhysicalDevice Engine::Core::ApplicationContext::vkPhysicalDevice = VK_NULL_HANDLE
private

The vulkan physical device.

Definition at line 378 of file ApplicationContext.h.

◆ vmaAllocator_

VmaAllocator Engine::Core::ApplicationContext::vmaAllocator_ = VK_NULL_HANDLE
private

VMA allocator for efficient GPU memory management.

Definition at line 419 of file ApplicationContext.h.

◆ vulkanDeviceExtensions

std::vector<const char *> Engine::Core::ApplicationContext::vulkanDeviceExtensions
private

(Immutable) the vulkan device extensions

Definition at line 387 of file ApplicationContext.h.

◆ vulkanInstanceExtensions

std::vector<const char *> Engine::Core::ApplicationContext::vulkanInstanceExtensions
private

(Immutable) the vulkan instance extensions which should get enabled

Definition at line 368 of file ApplicationContext.h.

◆ xrCreateVulkanDeviceKHR

PFN_xrCreateVulkanDeviceKHR Engine::Core::ApplicationContext::xrCreateVulkanDeviceKHR = nullptr
private

Definition at line 284 of file ApplicationContext.h.

◆ xrCreateVulkanInstanceKHR

PFN_xrCreateVulkanInstanceKHR Engine::Core::ApplicationContext::xrCreateVulkanInstanceKHR = nullptr
private

Definition at line 283 of file ApplicationContext.h.

◆ xrGetVulkanGraphicsDevice2KHR

PFN_xrGetVulkanGraphicsDevice2KHR Engine::Core::ApplicationContext::xrGetVulkanGraphicsDevice2KHR = nullptr
private

Definition at line 280 of file ApplicationContext.h.

◆ xrGetVulkanGraphicsRequirements2KHR

PFN_xrGetVulkanGraphicsRequirements2KHR Engine::Core::ApplicationContext::xrGetVulkanGraphicsRequirements2KHR = nullptr
private

Definition at line 281 of file ApplicationContext.h.

◆ xrGetVulkanInstanceExtensionsKHR

PFN_xrGetVulkanInstanceExtensionsKHR Engine::Core::ApplicationContext::xrGetVulkanInstanceExtensionsKHR = nullptr
private

Definition at line 279 of file ApplicationContext.h.

◆ xrInstance

XrInstance Engine::Core::ApplicationContext::xrInstance = XR_NULL_HANDLE
private

The xr instance.

Definition at line 346 of file ApplicationContext.h.

◆ xrSystemId

XrSystemId Engine::Core::ApplicationContext::xrSystemId = XR_NULL_SYSTEM_ID
private

Identifier for the xr device. So the identifier for the headset.

Definition at line 358 of file ApplicationContext.h.


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