class Framework

Sample-backing framework.

File location: framework/cauldron/framework/inc/core/framework.h

Methods

Return type

Description

void

Init ()
Framework initialization. Override to modify/override framework initialization.

void

Framework pre-runtime callback. Called before entering main loop after framework/sample has been initialized. Override to modify/override framework pre-run.

void

Framework post-runtime callback. Called after exiting main loop prior to framework/sample termination. Override to modify/override framework post run.

void

Framework shutdown. Called to clean everything up when we are done. Override to modify/override framework shutdown.

int32_t

Run ()
Framework run callback. Calls implementation’s run cycle (which calls “MainLoop()“.

void

Framework main loop callback. Executes a frame’s worth of work.

const FrameworkInternal *

GetImpl () const
Internal implementation accessor.

void

ParseSampleConfig(). Override in sample to modify application configuration.

void

ParseSampleCmdLine (const wchar_t* cmdLine)
ParseSampleCmdLine(). Override in sample to modify application configuration.

void

RegisterSampleModules(). Override in sample to register additional render modules and components.

void

DoSampleInit(). Override in sample to modify application initialization.

void

DoSampleUpdates (double deltaTime)
DoSampleUpdates(). Override in sample to perform additional sample updates.

void

DoSampleResize (const ResolutionInfo & resInfo)
DoSampleResize(). Override in sample to handle application resize changes.

void

DoSampleShutdown(). Override in sample to modify application shutdown.

void

ParseConfigData (const json& jsonConfigData)
Utility function to parse all known options from config data.

const TaskManager *

Retrieves the “TaskManager“ instance.

TaskManager *

GetTaskManager ()

const Scene *

GetScene () const
Retrieves the “Scene“ instance.

Scene *

GetScene ()

const InputManager *

GetInputMgr () const
Retrieves the “InputManager“ instance.

InputManager *

GetInputMgr ()

const ContentManager *

Retrieves the “ContentManager“ instance.

ContentManager *

GetContentManager ()

const Profiler *

GetProfiler () const
Retrieves the “Profiler“ instance.

Profiler *

GetProfiler ()

const Device *

GetDevice () const
Retrieves the “Device“ instance.

Device *

GetDevice ()

const ResourceViewAllocator *

Retrieves the “ResourceViewAllocator“ instance.

ResourceViewAllocator *

GetResourceViewAllocator ()

const RasterViewAllocator *

Retrieves the “RasterViewAllocator“ instance.

RasterViewAllocator *

GetRasterViewAllocator ()

const SwapChain *

GetSwapChain () const
Retrieves the “SwapChain“ instance.

SwapChain *

GetSwapChain ()

const UIManager *

GetUIManager () const
Retrieves the “UIManager“ instance.

UIManager *

GetUIManager ()

const UploadHeap *

GetUploadHeap () const
Retrieves the “UploadHeap“ instance.

UploadHeap *

GetUploadHeap ()

const DynamicBufferPool *

Retrieves the “DynamicBufferPool“ instance.

DynamicBufferPool *

GetDynamicBufferPool ()

const DynamicResourcePool *

Retrieves the “DynamicResourcePool“ instance.

DynamicResourcePool *

GetDynamicResourcePool ()

const ShadowMapResourcePool *

Retrieves the “ShadowMapResourcePool“ instance.

ShadowMapResourcePool *

GetShadowMapResourcePool ()

CommandList *

Gets the active “CommandList“ for the frame.

const Texture *

GetRenderTexture (const wchar_t* name) const
Retrieves the requested “Texture“ instance. Note: This should not be called after application initialization.

RenderModule *

GetRenderModule (const char* name)
Retrieves the requested “RenderModule“ instance. Note: This should not be called after application initialization.

const CauldronConfig *

GetConfig () const
Retrieves the “CauldronConfig“ used to setup the current run.

const wchar_t*

GetName () const
Retrieves the application’s name.

const wchar_t*

GetCmdLine () const
Retrieves the command line arguments passed to the application.

const wchar_t*

GetCPUName () const
Retrieves name of the CPU the application is running on.

void

Initializes the application configuration.

const ResolutionInfo &

Retrieves current “ResolutionInfo“ data.

void

UpdateRenderResolution (uint32_t renderWidth, uint32_t renderHeight)

void

EnableUpscaling (bool enabled, ResolutionUpdateFunc func = nullptr)
Enables or disabled upscaling in the application.

void

Processes application resize. Will initiate resource recreation and binding processes.

void

Processes application focus lost event.

void

Processes application focus gained event.

void

SetUpscalingState (UpscalerState state)
Used to set the current internal upsample state.

UpscalerState

Gets the current internal upsample state.

bool

Query if upsampling has been enabled.

void

EnableFrameInterpolation (bool enabled)

bool

FrameInterpolationEnabled () const

void

SetTonemapper (const RenderModule * pToneMapper)
Overrides the default tonemapper.

const Texture *

GetColorTargetForCallback (const wchar_t* callbackOrModuleName)
Fetches the proper resource to use as a color target given the callback’s ordering.

void

RegisterExecutionCallback ( std::wstring insertionName, bool preInsertion, ExecutionTuple callbackTuple )
Inserts a new execution callback for the runtime.

float

Gets the current aspect ratio for the application display.

void

GetUpscaledRenderInfo ( uint32_t& width, uint32_t& height, float& renderWidthRatio, float& renderHeightRatio ) const
Gets parameters needed by upscalers.

double

GetDeltaTime () const
Gets the current frame time slice.

uint64_t

GetFrameID () const
Gets the current frame ID.

bool

IsRunning () const
Query whether the sample is currently running.

const std::thread::id

MainThreadID () const
Fetches the main thread’s ID. Used to enforce performance warnings on select functionality.

template <typename Comp> void

Registers a component manager for the defined Comp type with the framework.

void

Unregisters all Components and RenderModules. Called at application shutdown.

void

Used to register for resource load callbacks.

void

Used to unregister from resource load callbacks.

void

Takes a RenderDoc capture if option is enabled. Will open the capture in a new/running instance of RenderDoc.

void

Takes a PIX capture if option is enabled. Will open the capture in a new/running instance of PIX.

void

Enqueues a content creation task to be executed once the framework is done initializing.

void

ConfigureRuntimeShaderRecompiler ( std::function<void(void)> preReloadCallback, std::function<void(void)> postReloadCallback )
Configures the specified callbacks for runtime shader recompile/reload. These functions are called pre and post FFX shader reload. The preReloadCallback should destroy the FFX interface and any currently active FFX Components’ contexts. The postReloadCallback should re-initialize the FFX interface and re-create all previously active Components’ contexts.

Detailed description

Sample-backing framework. Is responsible for application setup and tear down based on runtime configuration + command line overrides.

Main framework instance holds all required constructs to handle application updates and rendering. Samples are offered override points to modify sample configuration or run-time behavior.

Methods

Init

Copied!

virtual void Init ()

Framework initialization. Override to modify/override framework initialization.


PreRun

Copied!

virtual void PreRun ()

Framework pre-runtime callback. Called before entering main loop after framework/sample has been initialized. Override to modify/override framework pre-run.


PostRun

Copied!

virtual void PostRun ()

Framework post-runtime callback. Called after exiting main loop prior to framework/sample termination. Override to modify/override framework post run.


Shutdown

Copied!

virtual void Shutdown ()

Framework shutdown. Called to clean everything up when we are done. Override to modify/override framework shutdown.


Run

Copied!

int32_t Run ()

Framework run callback. Calls implementation’s run cycle (which calls MainLoop().


MainLoop

Copied!

void MainLoop ()

Framework main loop callback. Executes a frame’s worth of work.


GetImpl

Copied!

const FrameworkInternal * GetImpl () const

Internal implementation accessor.


ParseSampleConfig

Copied!

virtual void ParseSampleConfig ()

ParseSampleConfig(). Override in sample to modify application configuration.


ParseSampleCmdLine

Copied!

virtual void ParseSampleCmdLine (const wchar_t* cmdLine)

ParseSampleCmdLine(). Override in sample to modify application configuration.


RegisterSampleModules

Copied!

virtual void RegisterSampleModules ()

RegisterSampleModules(). Override in sample to register additional render modules and components.


DoSampleInit

Copied!

virtual void DoSampleInit ()

DoSampleInit(). Override in sample to modify application initialization.


DoSampleUpdates

Copied!

virtual void DoSampleUpdates (double deltaTime)

DoSampleUpdates(). Override in sample to perform additional sample updates.


DoSampleResize

Copied!

virtual void DoSampleResize (const ResolutionInfo & resInfo)

DoSampleResize(). Override in sample to handle application resize changes.


DoSampleShutdown

Copied!

virtual void DoSampleShutdown ()

DoSampleShutdown(). Override in sample to modify application shutdown.


ParseConfigData

Copied!

void ParseConfigData (const json& jsonConfigData)

Utility function to parse all known options from config data.


GetTaskManager

Copied!

const TaskManager * GetTaskManager () const

Retrieves the TaskManager instance.


GetScene

Copied!

const Scene * GetScene () const

Retrieves the Scene instance.


GetInputMgr

Copied!

const InputManager * GetInputMgr () const

Retrieves the InputManager instance.


GetContentManager

Copied!

const ContentManager * GetContentManager () const

Retrieves the ContentManager instance.


GetProfiler

Copied!

const Profiler * GetProfiler () const

Retrieves the Profiler instance.


GetDevice

Copied!

const Device * GetDevice () const

Retrieves the Device instance.


GetResourceViewAllocator

Copied!

const ResourceViewAllocator * GetResourceViewAllocator () const

Retrieves the ResourceViewAllocator instance.


GetRasterViewAllocator

Copied!

const RasterViewAllocator * GetRasterViewAllocator () const

Retrieves the RasterViewAllocator instance.


GetSwapChain

Copied!

const SwapChain * GetSwapChain () const

Retrieves the SwapChain instance.


GetUIManager

Copied!

const UIManager * GetUIManager () const

Retrieves the UIManager instance.


GetUploadHeap

Copied!

const UploadHeap * GetUploadHeap () const

Retrieves the UploadHeap instance.


GetDynamicBufferPool

Copied!

const DynamicBufferPool * GetDynamicBufferPool () const

Retrieves the DynamicBufferPool instance.


GetDynamicResourcePool

Copied!

const DynamicResourcePool * GetDynamicResourcePool () const

Retrieves the DynamicResourcePool instance.


GetShadowMapResourcePool

Copied!

const ShadowMapResourcePool * GetShadowMapResourcePool () const

Retrieves the ShadowMapResourcePool instance.


GetActiveCommandList

Copied!

CommandList * GetActiveCommandList ()

Gets the active CommandList for the frame.


GetRenderTexture

Copied!

const Texture * GetRenderTexture (const wchar_t* name) const

Retrieves the requested Texture instance. Note: This should not be called after application initialization.


GetRenderModule

Copied!

RenderModule * GetRenderModule (const char* name)

Retrieves the requested RenderModule instance. Note: This should not be called after application initialization.


GetConfig

Copied!

const CauldronConfig * GetConfig () const

Retrieves the CauldronConfig used to setup the current run.


GetName

Copied!

const wchar_t* GetName () const

Retrieves the application’s name.


GetCmdLine

Copied!

const wchar_t* GetCmdLine () const

Retrieves the command line arguments passed to the application.


GetCPUName

Copied!

const wchar_t* GetCPUName () const

Retrieves name of the CPU the application is running on.


InitConfig

Copied!

void InitConfig ()

Initializes the application configuration.


GetResolutionInfo

Copied!

const ResolutionInfo & GetResolutionInfo () const

Retrieves current ResolutionInfo data.


EnableUpscaling

Copied!

void EnableUpscaling (bool enabled, ResolutionUpdateFunc  func = nullptr)

Enables or disabled upscaling in the application.


ResizeEvent

Copied!

void ResizeEvent ()

Processes application resize. Will initiate resource recreation and binding processes.


FocusLostEvent

Copied!

void FocusLostEvent ()

Processes application focus lost event.


FocusGainedEvent

Copied!

void FocusGainedEvent ()

Processes application focus gained event.


SetUpscalingState

Copied!

void SetUpscalingState (UpscalerState  state)

Used to set the current internal upsample state.


GetUpscalingState

Copied!

UpscalerState  GetUpscalingState () const

Gets the current internal upsample state.


UpscalerEnabled

Copied!

bool UpscalerEnabled () const

Query if upsampling has been enabled.


SetTonemapper

Copied!

void SetTonemapper (const RenderModule * pToneMapper)

Overrides the default tonemapper.


GetColorTargetForCallback

Copied!

const Texture * GetColorTargetForCallback (const wchar_t* callbackOrModuleName)

Fetches the proper resource to use as a color target given the callback’s ordering.


RegisterExecutionCallback

Copied!

void RegisterExecutionCallback (
    std::wstring insertionName,
    bool preInsertion,
    ExecutionTuple  callbackTuple
)

Inserts a new execution callback for the runtime.


GetAspectRatio

Copied!

float GetAspectRatio () const

Gets the current aspect ratio for the application display.


GetUpscaledRenderInfo

Copied!

void GetUpscaledRenderInfo (
    uint32_t& width,
    uint32_t& height,
    float& renderWidthRatio,
    float& renderHeightRatio
) const

Gets parameters needed by upscalers.


GetDeltaTime

Copied!

double GetDeltaTime () const

Gets the current frame time slice.


GetFrameID

Copied!

uint64_t GetFrameID () const

Gets the current frame ID.


IsRunning

Copied!

bool IsRunning () const

Query whether the sample is currently running.


MainThreadID

Copied!

const std::thread::id MainThreadID () const

Fetches the main thread’s ID. Used to enforce performance warnings on select functionality.


RegisterComponentManager

Copied!

template <typename Comp>    void RegisterComponentManager ()

Registers a component manager for the defined Comp type with the framework.


UnRegisterComponentsAndRenderModules

Copied!

void UnRegisterComponentsAndRenderModules ()

Unregisters all Components and RenderModules. Called at application shutdown.


AddResizableResourceDependence

Copied!

void AddResizableResourceDependence (ResourceResizedListener * pListener)

Used to register for resource load callbacks.


RemoveResizableResourceDependence

Copied!

void RemoveResizableResourceDependence (ResourceResizedListener * pListener)

Used to unregister from resource load callbacks.


TakeRenderDocCapture

Copied!

void TakeRenderDocCapture ()

Takes a RenderDoc capture if option is enabled. Will open the capture in a new/running instance of RenderDoc.


TakePixCapture

Copied!

void TakePixCapture ()

Takes a PIX capture if option is enabled. Will open the capture in a new/running instance of PIX.


AddContentCreationTask

Copied!

void AddContentCreationTask (Task & task)

Enqueues a content creation task to be executed once the framework is done initializing.


ConfigureRuntimeShaderRecompiler

Copied!

void ConfigureRuntimeShaderRecompiler (
    std::function<void(void)> preReloadCallback,
    std::function<void(void)> postReloadCallback
)

Configures the specified callbacks for runtime shader recompile/reload. These functions are called pre and post FFX shader reload. The preReloadCallback should destroy the FFX interface and any currently active FFX Components’ contexts. The postReloadCallback should re-initialize the FFX interface and re-create all previously active Components’ contexts.