Skip to content

KDGpuExample::XrExampleEngineLayer

Module: KDGpuExample API

XrExampleEngineLayer provides a base for OpenXR examples.

#include <KDGpuExample/xr_example_engine_layer.h>

Inherits from KDGpuExample::EngineLayer, KDFoundation::Object

Inherited by HelloXr, HelloXrMultiview

Public Functions

Name
XrExampleEngineLayer()
~XrExampleEngineLayer() override
template <typename T >
XrCompositorLayer *
addCompositorLayer(std::unique_ptr< T > && layer)
template <typename T ,typename... Ts>
T *
createCompositorLayer(Ts... args)
template <typename T >
std::unique_ptr< XrCompositorLayer >
takeCompositorLayer(T * layer)
std::span< const std::unique_ptr< XrCompositorLayer > > compositorLayers() const
void clearCompositorLayers()
std::span< const KDXr::ViewConfigurationView > viewConfigurationViews() const

Protected Functions

Name
virtual void onSessionStateChanged(KDXr::SessionState oldState, KDXr::SessionState newState)
virtual void onInstanceLost()
virtual void onInteractionProfileChanged()
virtual void onAttached() override
virtual void onDetached() override
virtual void update() override
virtual void pollActions(KDXr::Time predictedDisplayTime)
void event(KDFoundation::EventReceiver * target, KDFoundation::Event * ev) override
std::shared_ptr< spdlog::logger > logger() const
void uploadBufferData(const BufferUploadOptions & options)
void uploadTextureData(const TextureUploadOptions & options)
void releaseStagingBuffers()

Protected Attributes

Name
std::shared_ptr< spdlog::logger > m_logger
std::unique_ptr< GraphicsApi > m_api
bool m_isInitialized
KDBindings::Property< SampleCountFlagBits > m_samples
std::vector< SampleCountFlagBits > m_supportedSampleCounts
Instance m_instance
Surface m_surface
Device m_device
Queue m_queue
std::vector< UploadStagingBuffer > m_stagingBuffers
std::unique_ptr< KDXr::XrApi > m_xrApi
KDXr::Instance m_xrInstance
KDXr::System * m_system
KDXr::Session m_session
KDXr::ReferenceSpaceOptions m_referenceSpaceOptions
KDXr::ReferenceSpace m_referenceSpace
const std::vector< KDXr::ViewConfigurationType > m_applicationViewConfigurations
KDXr::ViewConfigurationType m_selectedViewConfiguration
KDXr::EnvironmentBlendMode m_selectedEnvironmentBlendMode
std::vector< KDXr::ViewConfigurationView > m_viewConfigurationViews
Format m_colorSwapchainFormat
Format m_depthSwapchainFormat
const std::vector< Format > m_applicationColorSwapchainFormats
const std::vector< Format > m_applicationDepthSwapchainFormats
std::vector< KDXr::CompositionLayer * > m_compositorLayers
std::vector< std::unique_ptr< XrCompositorLayer > > m_compositorLayerObjects

Friends

Name
class XrCompositorLayer

Additional inherited members

Public Functions inherited from KDGpuExample::EngineLayer

Name
~EngineLayer() override
const Engine * engine() const
Engine * engine()

Friends inherited from KDGpuExample::EngineLayer

Name
class Engine

Public Functions Documentation

function XrExampleEngineLayer

1
XrExampleEngineLayer()

function ~XrExampleEngineLayer

1
~XrExampleEngineLayer() override

function addCompositorLayer

1
2
3
4
template <typename T >
inline XrCompositorLayer * addCompositorLayer(
    std::unique_ptr< T > && layer
)

function createCompositorLayer

1
2
3
4
5
template <typename T ,
typename... Ts>
inline T * createCompositorLayer(
    Ts... args
)

function takeCompositorLayer

1
2
3
4
template <typename T >
inline std::unique_ptr< XrCompositorLayer > takeCompositorLayer(
    T * layer
)

function compositorLayers

1
inline std::span< const std::unique_ptr< XrCompositorLayer > > compositorLayers() const

function clearCompositorLayers

1
inline void clearCompositorLayers()

function viewConfigurationViews

1
inline std::span< const KDXr::ViewConfigurationView > viewConfigurationViews() const

Protected Functions Documentation

function onSessionStateChanged

1
2
3
4
virtual void onSessionStateChanged(
    KDXr::SessionState oldState,
    KDXr::SessionState newState
)

function onInstanceLost

1
virtual void onInstanceLost()

function onInteractionProfileChanged

1
virtual void onInteractionProfileChanged()

Reimplemented by: HelloXr::onInteractionProfileChanged, HelloXrMultiview::onInteractionProfileChanged

function onAttached

1
virtual void onAttached() override

Reimplements: KDGpuExample::EngineLayer::onAttached

function onDetached

1
virtual void onDetached() override

Reimplements: KDGpuExample::EngineLayer::onDetached

function update

1
virtual void update() override

Reimplements: KDGpuExample::EngineLayer::update

function pollActions

1
2
3
virtual void pollActions(
    KDXr::Time predictedDisplayTime
)

Reimplemented by: HelloXr::pollActions, HelloXrMultiview::pollActions

function event

1
2
3
4
void event(
    KDFoundation::EventReceiver * target,
    KDFoundation::Event * ev
) override

function logger

1
inline std::shared_ptr< spdlog::logger > logger() const

function uploadBufferData

1
2
3
void uploadBufferData(
    const BufferUploadOptions & options
)

function uploadTextureData

1
2
3
void uploadTextureData(
    const TextureUploadOptions & options
)

function releaseStagingBuffers

1
void releaseStagingBuffers()

Protected Attributes Documentation

variable m_logger

1
std::shared_ptr< spdlog::logger > m_logger;

variable m_api

1
std::unique_ptr< GraphicsApi > m_api;

variable m_isInitialized

1
bool m_isInitialized { false };

variable m_samples

1
KDBindings::Property< SampleCountFlagBits > m_samples { SampleCountFlagBits::Samples1Bit };

variable m_supportedSampleCounts

1
std::vector< SampleCountFlagBits > m_supportedSampleCounts;

variable m_instance

1
Instance m_instance;

variable m_surface

1
Surface m_surface;

variable m_device

1
Device m_device;

variable m_queue

1
Queue m_queue;

variable m_stagingBuffers

1
std::vector< UploadStagingBuffer > m_stagingBuffers;

variable m_xrApi

1
std::unique_ptr< KDXr::XrApi > m_xrApi;

variable m_xrInstance

1
KDXr::Instance m_xrInstance;

variable m_system

1
KDXr::System * m_system { nullptr };

variable m_session

1
KDXr::Session m_session;

variable m_referenceSpaceOptions

1
2
3
KDXr::ReferenceSpaceOptions m_referenceSpaceOptions = {
        .type = KDXr::ReferenceSpaceType::Local
    };

variable m_referenceSpace

1
KDXr::ReferenceSpace m_referenceSpace;

variable m_applicationViewConfigurations

1
2
3
4
const std::vector< KDXr::ViewConfigurationType > m_applicationViewConfigurations {
        KDXr::ViewConfigurationType::PrimaryStereo,
        KDXr::ViewConfigurationType::PrimaryMono
    };

variable m_selectedViewConfiguration

1
KDXr::ViewConfigurationType m_selectedViewConfiguration { KDXr::ViewConfigurationType::MaxEnum };

variable m_selectedEnvironmentBlendMode

1
KDXr::EnvironmentBlendMode m_selectedEnvironmentBlendMode { KDXr::EnvironmentBlendMode::MaxEnum };

variable m_viewConfigurationViews

1
std::vector< KDXr::ViewConfigurationView > m_viewConfigurationViews;

variable m_colorSwapchainFormat

1
Format m_colorSwapchainFormat { Format::UNDEFINED };

variable m_depthSwapchainFormat

1
Format m_depthSwapchainFormat { Format::UNDEFINED };

variable m_applicationColorSwapchainFormats

1
2
3
4
5
6
const std::vector< Format > m_applicationColorSwapchainFormats {
        Format::B8G8R8A8_SRGB,
        Format::R8G8B8A8_SRGB,
        Format::B8G8R8A8_UNORM,
        Format::R8G8B8A8_UNORM
    };

variable m_applicationDepthSwapchainFormats

1
2
3
4
const std::vector< Format > m_applicationDepthSwapchainFormats {
        Format::D32_SFLOAT,
        Format::D16_UNORM
    };

variable m_compositorLayers

1
std::vector< KDXr::CompositionLayer * > m_compositorLayers;

variable m_compositorLayerObjects

1
std::vector< std::unique_ptr< XrCompositorLayer > > m_compositorLayerObjects;

Friends

friend XrCompositorLayer

1
2
3
friend class XrCompositorLayer(
    XrCompositorLayer 
);

Updated on 2024-07-23 at 00:07:38 +0000