XII Release 0.1.0
Loading...
Searching...
No Matches
xiiRenderWorldModule Class Reference

#include <RenderWorldModule.h>

Inheritance diagram for xiiRenderWorldModule:
[legend]

Public Member Functions

 xiiRenderWorldModule (xiiWorld *pWorld)
xiiBitflags< xiiRenderExtractionCategory > GetExtractionRequirements () const
const xiiGpuInstanceData * GetGpuInstanceData () const
xiiResult UpdateGpuInstances (xiiArrayPtr< xiiRenderData *const > packets, xiiUInt64 frame)
xiiResult UpdateGpuInstances (const xiiExtractedRenderData &packets, xiiUInt64 frame)
xiiRayTracingResources::BuildHandles AddRayTracingBuildPass (xiiRenderGraph &graph, xiiUInt64 frame, xiiRayTracingFrameResources *viewResources=nullptr, const xiiArrayPtr< const xiiUInt32 > *selection=nullptr) const
xiiResult UpdateWorldLights (xiiArrayPtr< xiiRenderData *const > packets)
const xiiWorldLightData * GetWorldLightData () const
virtual void Initialize () override
virtual void Deinitialize () override
 This method is called before the destructor. A derived type can override this method to do deinitialization work.
virtual void OnSimulationStarted () override
xiiViewHandle CreateView (xiiStringView sName, xiiView *&out_pView)
void DestroyView (const xiiViewHandle &hView)
 Destroys a view. The view must have been created by this module.
bool TryGetView (const xiiViewHandle &hView, xiiView *&out_pView) const
 Retrieves a view by its handle. Returns false if the handle is invalid.
xiiView * GetViewByUsageHint (xiiEnum< xiiCameraUsageHint > usageHint, xiiEnum< xiiCameraUsageHint > alternativeUsageHint={}) const
 Retrieves a view by its usage hint. If multiple views share the same hint, the first one found is returned.
template<typename T>
T * CreateRenderDataForThisFrame (const xiiComponent *pComponent) const
 Creates render data that is only valid for this frame. The data is automatically deleted after the frame has been rendered.
void DeleteCachedRenderData (xiiGameObjectHandle hOwnerObject, xiiComponentHandle hComponent)
void DeleteCachedRenderDataForObjectRecursive (const xiiGameObject *pObject)
 Invalidates cached static render data for an object and all children.
void DeleteAllCachedRenderData ()
 Clears all cached static render data for every view.
void ReleaseGpuResources ()
 Called before device services shut down; worlds can be destroyed later without GPU ownership.
XII_ALWAYS_INLINE xiiEvent< xiiViewEvent, xiiMutex > & GetViewEvents ()
 Events that external code can subscribe to. The events are triggered when a view is created or deleted.
Public Member Functions inherited from xiiWorldModule
xiiWorld * GetWorld ()
 Returns the corresponding world to this module.
const xiiWorld * GetWorld () const
 Returns the corresponding world to this module.
xiiUInt32 GetWorldIndex () const
 Same as GetWorld()->GetIndex(). Needed to break circular include dependencies.
Public Member Functions inherited from xiiReflectedClass
virtual const xiiRTTI * GetDynamicRTTI () const
bool IsInstanceOf (const xiiRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
template<typename T>
XII_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.

Static Public Member Functions

static XII_ALWAYS_INLINE const xiiEvent< const xiiRenderWorldModuleExtractionEvent &, xiiMutex > & GetRenderEvents ()
 Events that external code can subscribe to. The events are triggered when a view is processed for render data extraction, before and after the extraction process.
Static Public Member Functions inherited from xiiNoBase
static const xiiRTTI * GetStaticRTTI ()

Additional Inherited Members

Protected Types inherited from xiiWorldModule
using UpdateFunction = xiiDelegate<void(const UpdateContext&)>
 Update function delegate.
Protected Member Functions inherited from xiiWorldModule
 xiiWorldModule (xiiWorld *pWorld)
void RegisterUpdateFunction (const UpdateFunctionDesc &desc)
 Registers the given update function at the world.
void DeregisterUpdateFunction (const UpdateFunctionDesc &desc)
xiiAllocator * GetAllocator ()
 Returns the allocator used by the world.
xiiInternal::WorldLargeBlockAllocator * GetBlockAllocator ()
 Returns the block allocator used by the world.
bool GetWorldSimulationEnabled () const
 Returns whether the world simulation is enabled.
virtual void WorldClear ()
 Called by xiiWorld::Clear(). Can be used to clear cached data when a world is completely cleared of objects (but not deleted).
Protected Attributes inherited from xiiWorldModule
xiiWorld *const m_pWorld

Detailed Description

Central world module that owns all render views and drives the per-frame render graph compilation and execution.

Render graph construction

Each frame, for views that do not have a custom RenderGraphBuilder set, the module delegates to the view's selected xiiRenderPipelineResource and its isolated runtime instance. External code may override this by calling xiiView::SetRenderGraphBuilder().

Render data

After world transforms and normal PostTransform derived-data updates, this module sends xiiMsgExtractRenderData. Components handling this message submit data as usual, but the extracted data cache is owned by xiiRenderWorldModule (not by xiiView) and keeps static/dynamic streams. Static-only objects are persisted per-view and reused across frames until invalidated through the cache invalidation API. Before execution, the module finalizes and sorts those streams for graph consumers.

Per-view blackboard and resource cache

Every xiiView owns its own xiiRenderGraphBlackboard and xiiRenderGraphResourceCache. The blackboard is cleared at the start of each frame and repopulated by the passes in order. Cross-frame data (TAA history, exposure, particle state, etc.) lives in persistent GPU buffers inside its pipeline runtime.

Member Function Documentation

◆ CreateRenderDataForThisFrame()

template<typename T>
T * xiiRenderWorldModule::CreateRenderDataForThisFrame ( const xiiComponent * pComponent) const

Creates render data that is only valid for this frame. The data is automatically deleted after the frame has been rendered.

Copyright (c) Theophilus Eriata. All Rights Reserved.

◆ CreateView()

xiiViewHandle xiiRenderWorldModule::CreateView ( xiiStringView sName,
xiiView *& out_pView )

Creates a new view and assumes ownership.

The view is registered for render-data extraction and render-graph execution from the next frame onward.

◆ Deinitialize()

void xiiRenderWorldModule::Deinitialize ( )
overridevirtual

This method is called before the destructor. A derived type can override this method to do deinitialization work.

Reimplemented from xiiWorldModule.

◆ DeleteCachedRenderData()

void xiiRenderWorldModule::DeleteCachedRenderData ( xiiGameObjectHandle hOwnerObject,
xiiComponentHandle hComponent )

Invalidates cached static render data for one object.

The component handle is accepted for compatibility with existing call sites. Static cache invalidation is keyed by object identity.

◆ Initialize()

void xiiRenderWorldModule::Initialize ( )
overridevirtual

This method is called after the constructor. A derived type can override this method to do initialization work. Typically this is the method where updates function are registered.

Reimplemented from xiiWorldModule.

◆ OnSimulationStarted()

void xiiRenderWorldModule::OnSimulationStarted ( )
overridevirtual

This method is called at the start of the next world update when the world is simulated. This method will be called after the initialization method.

Reimplemented from xiiWorldModule.

◆ UpdateGpuInstances()

xiiResult xiiRenderWorldModule::UpdateGpuInstances ( xiiArrayPtr< xiiRenderData *const > packets,
xiiUInt64 frame )

Publishes derived mesh draw data at the CPU extraction boundary. Tools that build graphs explicitly use this same path; inputs must carry live handles in this world.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/GraphicsCore/Pipeline/RenderWorldModule.h
  • /home/runner/work/XII/XII/Source/Engine/GraphicsCore/Pipeline/Implementation/RenderWorldModule.cpp
  • /home/runner/work/XII/XII/Source/Engine/GraphicsCore/Pipeline/Implementation/RenderWorldModule_inl.h