XII Release 0.1.0
Loading...
Searching...
No Matches
xiiMaterialInstance Class Referencefinal

#include <MaterialInstance.h>

Inheritance diagram for xiiMaterialInstance:
[legend]

Public Member Functions

xiiResult Initialize (xiiSharedPtr< const xiiMaterialSchema > pSchema, const xiiMaterialRuntimeState &runtimeState={})
xiiResult SetParameter (xiiMaterialParameterId id, const xiiVariant &value)
xiiResult SetParameter (xiiStringView sName, const xiiVariant &value)
xiiVariant GetParameter (xiiMaterialParameterId id) const
xiiResult SetTexture2D (xiiMaterialParameterId id, const xiiTexture2DResourceHandle &hTexture)
xiiResult SetTextureCube (xiiMaterialParameterId id, const xiiTextureCubeResourceHandle &hTexture)
xiiResult SetBindlessIndex (xiiMaterialParameterId id, xiiUInt32 uiBindlessIndex)
void SetRuntimeState (const xiiMaterialRuntimeState &runtimeState)
xiiMaterialRuntimeState GetRuntimeState () const
xiiSharedPtr< const xiiMaterialSchema > GetSchema () const
xiiUInt32 GetRevision () const
void CreateSnapshot (xiiMaterialInstanceSnapshot &out_snapshot) const
 Copies a coherent view without consuming dirty state.
void ConsumeSnapshot (xiiMaterialInstanceSnapshot &out_snapshot)
Public Member Functions inherited from xiiRefCounted
virtual ~xiiRefCounted ()=default
 Adds a virtual destructor.
Public Member Functions inherited from xiiRefCountingImpl
 xiiRefCountingImpl ()=default
 Constructor.
 xiiRefCountingImpl (const xiiRefCountingImpl &rhs)
void operator= (const xiiRefCountingImpl &rhs)
xiiUInt32 AddRef () const
 Increments the reference counter. Returns the new reference count.
bool TryAddRef () const
xiiUInt32 ReleaseRef () const
 Decrements the reference counter. Returns the new reference count.ywat.
bool IsReferenced () const
 Returns true if the reference count is greater than 0, false otherwise.
xiiUInt32 GetRefCount () const
 Returns the current reference count.

Detailed Description

Mutable, thread-safe runtime material instance.

Instances share an immutable schema, but own their parameter bytes and resource bindings. This makes one authored material usable as a template for thousands of inexpensive simulation or rendering instances without modifying the resource-manager object.

Member Function Documentation

◆ ConsumeSnapshot()

void xiiMaterialInstance::ConsumeSnapshot ( xiiMaterialInstanceSnapshot & out_snapshot)

Copies a coherent view and consumes the aggregate dirty flags. GPU storage uses per-frame revisions as the final authority, so consuming these flags never loses an upload.


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