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 |
PreRun ()
Framework pre-runtime callback. Called before entering main loop after framework/sample has been initialized. Override to modify/override framework pre-run.
|
void |
PostRun ()
Framework post-runtime callback. Called after exiting main loop prior to framework/sample termination. Override to modify/override framework post run.
|
void |
Shutdown ()
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 |
MainLoop ()
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 ()
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 * |
GetTaskManager () const
Retrieves the “TaskManager“ instance.
|
GetTaskManager ()
|
|
const Scene * |
GetScene () const
Retrieves the “Scene“ instance.
|
Scene * |
GetScene ()
|
const InputManager * |
GetInputMgr () const
Retrieves the “InputManager“ instance.
|
GetInputMgr ()
|
|
const ContentManager * |
GetContentManager () const
Retrieves the “ContentManager“ instance.
|
GetContentManager ()
|
|
const Profiler * |
GetProfiler () const
Retrieves the “Profiler“ instance.
|
Profiler * |
GetProfiler ()
|
const Device * |
GetDevice () const
Retrieves the “Device“ instance.
|
Device * |
GetDevice ()
|
const ResourceViewAllocator * |
GetResourceViewAllocator () const
Retrieves the “ResourceViewAllocator“ instance.
|
GetResourceViewAllocator ()
|
|
const RasterViewAllocator * |
GetRasterViewAllocator () const
Retrieves the “RasterViewAllocator“ instance.
|
GetRasterViewAllocator ()
|
|
const SwapChain * |
GetSwapChain () const
Retrieves the “SwapChain“ instance.
|
GetSwapChain ()
|
|
const UIManager * |
GetUIManager () const
Retrieves the “UIManager“ instance.
|
GetUIManager ()
|
|
const UploadHeap * |
GetUploadHeap () const
Retrieves the “UploadHeap“ instance.
|
GetUploadHeap ()
|
|
const DynamicBufferPool * |
GetDynamicBufferPool () const
Retrieves the “DynamicBufferPool“ instance.
|
GetDynamicBufferPool ()
|
|
const DynamicResourcePool * |
GetDynamicResourcePool () const
Retrieves the “DynamicResourcePool“ instance.
|
GetDynamicResourcePool ()
|
|
const ShadowMapResourcePool * |
GetShadowMapResourcePool () const
Retrieves the “ShadowMapResourcePool“ instance.
|
GetShadowMapResourcePool ()
|
|
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.
|
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 |
InitConfig ()
Initializes the application configuration.
|
const ResolutionInfo & |
GetResolutionInfo () const
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 |
ResizeEvent ()
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 |
GetUpscalingState () const
Gets the current internal upsample state.
|
bool |
UpscalerEnabled () const
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 |
GetAspectRatio () const
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 |
AddResizableResourceDependence (ResourceResizedListener * pListener)
Used to register for resource load callbacks.
|
void |
RemoveResizableResourceDependence (ResourceResizedListener * pListener)
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 |
AddContentCreationTask (Task & task)
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
Framework initialization. Override to modify/override framework initialization.
PreRun
Framework pre-runtime callback. Called before entering main loop after framework/sample has been initialized. Override to modify/override framework pre-run.
PostRun
Framework post-runtime callback. Called after exiting main loop prior to framework/sample termination. Override to modify/override framework post run.
Shutdown
Framework shutdown. Called to clean everything up when we are done. Override to modify/override framework shutdown.
Run
Framework run callback. Calls implementation’s run cycle (which calls MainLoop()
.
MainLoop
Framework main loop callback. Executes a frame’s worth of work.
GetImpl
Internal implementation accessor.
ParseSampleConfig
ParseSampleConfig(). Override in sample to modify application configuration.
ParseSampleCmdLine
ParseSampleCmdLine(). Override in sample to modify application configuration.
RegisterSampleModules
RegisterSampleModules(). Override in sample to register additional render modules and components.
DoSampleInit
DoSampleInit(). Override in sample to modify application initialization.
DoSampleUpdates
DoSampleUpdates(). Override in sample to perform additional sample updates.
DoSampleResize
virtual void DoSampleResize (const ResolutionInfo & resInfo)
DoSampleResize(). Override in sample to handle application resize changes.
DoSampleShutdown
DoSampleShutdown(). Override in sample to modify application shutdown.
ParseConfigData
Utility function to parse all known options from config data.
GetTaskManager
const TaskManager * GetTaskManager () const
Retrieves the TaskManager
instance.
GetScene
const Scene * GetScene () const
Retrieves the Scene
instance.
GetInputMgr
const InputManager * GetInputMgr () const
Retrieves the InputManager
instance.
GetContentManager
const ContentManager * GetContentManager () const
Retrieves the ContentManager
instance.
GetProfiler
const Profiler * GetProfiler () const
Retrieves the Profiler
instance.
GetDevice
const Device * GetDevice () const
Retrieves the Device
instance.
GetResourceViewAllocator
const ResourceViewAllocator * GetResourceViewAllocator () const
Retrieves the ResourceViewAllocator
instance.
GetRasterViewAllocator
const RasterViewAllocator * GetRasterViewAllocator () const
Retrieves the RasterViewAllocator
instance.
GetSwapChain
const SwapChain * GetSwapChain () const
Retrieves the SwapChain
instance.
GetUIManager
const UIManager * GetUIManager () const
Retrieves the UIManager
instance.
GetUploadHeap
const UploadHeap * GetUploadHeap () const
Retrieves the UploadHeap
instance.
GetDynamicBufferPool
const DynamicBufferPool * GetDynamicBufferPool () const
Retrieves the DynamicBufferPool
instance.
GetDynamicResourcePool
const DynamicResourcePool * GetDynamicResourcePool () const
Retrieves the DynamicResourcePool
instance.
GetShadowMapResourcePool
const ShadowMapResourcePool * GetShadowMapResourcePool () const
Retrieves the ShadowMapResourcePool
instance.
GetActiveCommandList
CommandList * GetActiveCommandList ()
Gets the active CommandList
for the frame.
GetRenderTexture
const Texture * GetRenderTexture (const wchar_t* name) const
Retrieves the requested Texture
instance. Note: This should not be called after application initialization.
GetRenderModule
RenderModule * GetRenderModule (const char* name)
Retrieves the requested RenderModule
instance. Note: This should not be called after application initialization.
GetConfig
const CauldronConfig * GetConfig () const
Retrieves the CauldronConfig
used to setup the current run.
GetName
Retrieves the application’s name.
GetCmdLine
Retrieves the command line arguments passed to the application.
GetCPUName
Retrieves name of the CPU the application is running on.
InitConfig
Initializes the application configuration.
GetResolutionInfo
const ResolutionInfo & GetResolutionInfo () const
Retrieves current ResolutionInfo
data.
EnableUpscaling
Enables or disabled upscaling in the application.
ResizeEvent
Processes application resize. Will initiate resource recreation and binding processes.
FocusLostEvent
Processes application focus lost event.
FocusGainedEvent
Processes application focus gained event.
SetUpscalingState
Used to set the current internal upsample state.
GetUpscalingState
Gets the current internal upsample state.
UpscalerEnabled
Query if upsampling has been enabled.
SetTonemapper
void SetTonemapper (const RenderModule * pToneMapper)
Overrides the default tonemapper.
GetColorTargetForCallback
const Texture * GetColorTargetForCallback (const wchar_t* callbackOrModuleName)
Fetches the proper resource to use as a color target given the callback’s ordering.
RegisterExecutionCallback
Inserts a new execution callback for the runtime.
GetAspectRatio
Gets the current aspect ratio for the application display.
GetUpscaledRenderInfo
Gets parameters needed by upscalers.
GetDeltaTime
Gets the current frame time slice.
GetFrameID
Gets the current frame ID.
IsRunning
Query whether the sample is currently running.
MainThreadID
Fetches the main thread’s ID. Used to enforce performance warnings on select functionality.
RegisterComponentManager
Registers a component manager for the defined Comp type with the framework.
UnRegisterComponentsAndRenderModules
Unregisters all Components and RenderModules. Called at application shutdown.
AddResizableResourceDependence
void AddResizableResourceDependence (ResourceResizedListener * pListener)
Used to register for resource load callbacks.
RemoveResizableResourceDependence
void RemoveResizableResourceDependence (ResourceResizedListener * pListener)
Used to unregister from resource load callbacks.
TakeRenderDocCapture
Takes a RenderDoc capture if option is enabled. Will open the capture in a new/running instance of RenderDoc.
TakePixCapture
Takes a PIX capture if option is enabled. Will open the capture in a new/running instance of PIX.
AddContentCreationTask
void AddContentCreationTask (Task & task)
Enqueues a content creation task to be executed once the framework is done initializing.
ConfigureRuntimeShaderRecompiler
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.