Diligent Engine
Loading...
Searching...
No Matches
Diligent::IRadientMaterialWriter Struct Referenceabstract

#include <RadientMaterials.h>

Inheritance diagram for Diligent::IRadientMaterialWriter:
Diligent.IObject Diligent::IRadientSurfaceMaterialWriter

Public Member Functions

virtual RADIENT_STATUS DILIGENT_CALL_TYPE SetParameter (const RadientMaterialParameterHandle &Handle, const void *pData, Uint32 DataSize)=0
template<typename ValueType>
RADIENT_STATUS SetParameter (const RadientMaterialParameterHandle &Handle, const ValueType &Value)
virtual RADIENT_STATUS DILIGENT_CALL_TYPE SetTexture (const RadientMaterialParameterHandle &Handle, Uint32 ArrayIndex, IRadientTextureAsset *pTexture)=0
virtual RADIENT_STATUS DILIGENT_CALL_TYPE Commit ()=0
Public Member Functions inherited from Diligent.IObject
virtual void DILIGENT_CALL_TYPE QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0
 Queries the specific interface.
template<typename DerivedType, typename = typename std::enable_if<std::is_base_of<IObject, DerivedType>::value>::type>
void QueryInterface (const INTERFACE_ID &IID, DerivedType **ppInterface)
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE AddRef ()=0
 Increments the number of strong references by 1.
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE Release ()=0
virtual IReferenceCounters *DILIGENT_CALL_TYPE GetReferenceCounters () const =0

Detailed Description

Reusable material parameter writer.

A writer records every value explicitly assigned through its setter methods. Commit() publishes complete non-texture parameters, individual texture array elements, and any specialized material properties exposed by a derived writer. If multiple writers modify the same value, the last commit replaces that complete value. After initialization, non-texture parameters and surface properties may change. Runtime commits are performed on the render thread before rendering a frame. Client access to the writer and its material asset must not overlap Commit().

Member Function Documentation

◆ Commit()

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientMaterialWriter::Commit ( )
pure virtual

Applies the writer's pending changes to its material asset as one logical update. This is the authoritative check for whether the assignments change the material state. The writer remains valid after the call. On success or RADIENT_STATUS_NO_CHANGE, pending changes are cleared. On failure, pending changes are retained so the operation can be retried. A runtime commit that would change a texture returns RADIENT_STATUS_INVALID_OPERATION without modifying the material. Runtime parameter and surface-state edits are used by the next frame preparation without restarting material loading.

◆ SetParameter() [1/2]

template<typename ValueType>
RADIENT_STATUS Diligent::IRadientMaterialWriter::SetParameter ( const RadientMaterialParameterHandle & Handle,
const ValueType & Value )
inline

Replaces the complete value or value array identified by Handle, inferring the native data size from Value.

◆ SetParameter() [2/2]

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientMaterialWriter::SetParameter ( const RadientMaterialParameterHandle & Handle,
const void * pData,
Uint32 DataSize )
pure virtual

Replaces the complete value or value array identified by Handle. pData is copied immediately and DataSize must exactly match the parameter's native data size. Texture parameters are not accepted. The first assignment is always recorded, even if the material currently contains the supplied value. Returns RADIENT_STATUS_NO_CHANGE only if this writer already has an identical pending assignment.

◆ SetTexture()

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientMaterialWriter::SetTexture ( const RadientMaterialParameterHandle & Handle,
Uint32 ArrayIndex,
IRadientTextureAsset * pTexture )
pure virtual

Replaces one texture array element identified by Handle and ArrayIndex. Commit() publishes only modified texture elements, so independent element updates from different writers are preserved. The writer retains pTexture; null is a valid texture value. Non-texture parameters are not accepted. The first assignment is always recorded, even if the material currently contains pTexture. Returns RADIENT_STATUS_NO_CHANGE only if this writer already has an identical pending assignment. Changing the texture after material initialization is rejected by Commit(); assigning the existing texture is accepted as a no-op.