Plasma Engine  2.0
Loading...
Searching...
No Matches
plRenderContext Class Reference

Classes

class  CommandEncoderScope
 
struct  Statistics
 

Public Types

using RenderingScope = CommandEncoderScope<0>
 
using ComputeScope = CommandEncoderScope<1>
 

Public Member Functions

Statistics GetAndResetStatistics ()
 
void BeginRendering (const plGALRenderingSetup &renderingSetup, const plRectFloat &viewport, const char *szName="", bool bStereoRendering=false)
 
void EndRendering ()
 
void BeginCompute (const char *szName="")
 
void EndCompute ()
 
PL_ALWAYS_INLINE plGALCommandEncoderGetCommandEncoder ()
 
void SetShaderPermutationVariable (const char *szName, const plTempHashedString &sValue)
 
void SetShaderPermutationVariable (const plHashedString &sName, const plHashedString &sValue)
 
void BindMaterial (const plMaterialResourceHandle &hMaterial)
 
void BindTexture2D (const plTempHashedString &sSlotName, const plTexture2DResourceHandle &hTexture, plResourceAcquireMode acquireMode=plResourceAcquireMode::AllowLoadingFallback)
 
void BindTexture3D (const plTempHashedString &sSlotName, const plTexture3DResourceHandle &hTexture, plResourceAcquireMode acquireMode=plResourceAcquireMode::AllowLoadingFallback)
 
void BindTextureCube (const plTempHashedString &sSlotName, const plTextureCubeResourceHandle &hTexture, plResourceAcquireMode acquireMode=plResourceAcquireMode::AllowLoadingFallback)
 
void BindTexture2D (const plTempHashedString &sSlotName, plGALTextureResourceViewHandle hResourceView)
 
void BindTexture3D (const plTempHashedString &sSlotName, plGALTextureResourceViewHandle hResourceView)
 
void BindTextureCube (const plTempHashedString &sSlotName, plGALTextureResourceViewHandle hResourceView)
 
void BindUAV (const plTempHashedString &sSlotName, plGALTextureUnorderedAccessViewHandle hUnorderedAccessViewHandle)
 Binds a read+write texture or buffer.
 
void BindUAV (const plTempHashedString &sSlotName, plGALBufferUnorderedAccessViewHandle hUnorderedAccessViewHandle)
 
void BindSamplerState (const plTempHashedString &sSlotName, plGALSamplerStateHandle hSamplerSate)
 
void BindBuffer (const plTempHashedString &sSlotName, plGALBufferResourceViewHandle hResourceView)
 
void BindConstantBuffer (const plTempHashedString &sSlotName, plGALBufferHandle hConstantBuffer)
 
void BindConstantBuffer (const plTempHashedString &sSlotName, plConstantBufferStorageHandle hConstantBufferStorage)
 
void SetPushConstants (const plTempHashedString &sSlotName, plArrayPtr< const plUInt8 > data)
 Sets push constants to the given data block. Note that for platforms that don't support push constants, this is emulated via a constant buffer. Thus, a slot name must be provided as well which matches the name of the BEGIN_PUSH_CONSTANTS block in the shader.
 
template<typename T >
PL_ALWAYS_INLINE void SetPushConstants (const plTempHashedString &sSlotName, const T &constants)
 
void BindShader (const plShaderResourceHandle &hShader, plBitflags< plShaderBindFlags > flags=plShaderBindFlags::Default)
 Sets the currently active shader on the given render context.
 
void BindMeshBuffer (const plDynamicMeshBufferResourceHandle &hDynamicMeshBuffer)
 
void BindMeshBuffer (const plMeshBufferResourceHandle &hMeshBuffer)
 
void BindMeshBuffer (plGALBufferHandle hVertexBuffer, plGALBufferHandle hIndexBuffer, const plVertexDeclarationInfo *pVertexDeclarationInfo, plGALPrimitiveTopology::Enum topology, plUInt32 uiPrimitiveCount, plGALBufferHandle hVertexBuffer2={}, plGALBufferHandle hVertexBuffer3={}, plGALBufferHandle hVertexBuffer4={})
 
PL_ALWAYS_INLINE void BindNullMeshBuffer (plGALPrimitiveTopology::Enum topology, plUInt32 uiPrimitiveCount)
 
plResult DrawMeshBuffer (plUInt32 uiPrimitiveCount=0xFFFFFFFF, plUInt32 uiFirstPrimitive=0, plUInt32 uiInstanceCount=1)
 
plResult Dispatch (plUInt32 uiThreadGroupCountX, plUInt32 uiThreadGroupCountY=1, plUInt32 uiThreadGroupCountZ=1)
 
plResult DispatchIndirect (plGALBufferHandle hIndirectArgumentBuffer, plUInt32 uiArgumentOffsetInBytes)
 
plResult ApplyContextStates (bool bForce=false)
 
void ResetContextState ()
 
plGlobalConstants & WriteGlobalConstants ()
 
const plGlobalConstants & ReadGlobalConstants () const
 
void SetDefaultTextureFilter (plTextureFilterSetting::Enum filter)
 Sets the texture filter mode that is used by default for texture resources.
 
plTextureFilterSetting::Enum GetDefaultTextureFilter () const
 Returns the texture filter mode that is used by default for textures.
 
plTextureFilterSetting::Enum GetSpecificTextureFilter (plTextureFilterSetting::Enum configuration) const
 Returns the 'fixed' texture filter setting that the combination of default texture filter and given configuration defines.
 
void SetAllowAsyncShaderLoading (bool bAllow)
 Set async shader loading. During runtime all shaders should be preloaded so this is off by default.
 
bool GetAllowAsyncShaderLoading ()
 Returns async shader loading. During runtime all shaders should be preloaded so this is off by default.
 

Static Public Member Functions

static plRenderContextGetDefaultInstance ()
 
static plRenderContextCreateInstance (plGALCommandEncoder *pCommandEncoder)
 
static void DestroyInstance (plRenderContext *pRenderer)
 
static PL_ALWAYS_INLINE RenderingScope BeginRenderingScope (const plRenderViewContext &viewContext, const plGALRenderingSetup &renderingSetup, const char *szName="", bool bStereoRendering=false)
 
static PL_ALWAYS_INLINE RenderingScope BeginCommandsAndRenderingScope (const plRenderViewContext &viewContext, const plGALRenderingSetup &renderingSetup, const char *szName, bool bStereoRendering=false)
 
static PL_ALWAYS_INLINE ComputeScope BeginComputeScope (const plRenderViewContext &viewContext, const char *szName="")
 
static PL_ALWAYS_INLINE ComputeScope BeginCommandsAndComputeScope (const plRenderViewContext &viewContext, const char *szName)
 
template<typename T >
static PL_ALWAYS_INLINE plConstantBufferStorageHandle CreateConstantBufferStorage ()
 
template<typename T >
static PL_FORCE_INLINE plConstantBufferStorageHandle CreateConstantBufferStorage (plConstantBufferStorage< T > *&out_pStorage)
 
static PL_FORCE_INLINE plConstantBufferStorageHandle CreateConstantBufferStorage (plUInt32 uiSizeInBytes)
 
static plConstantBufferStorageHandle CreateConstantBufferStorage (plUInt32 uiSizeInBytes, plConstantBufferStorageBase *&out_pStorage)
 
static void DeleteConstantBufferStorage (plConstantBufferStorageHandle hStorage)
 
template<typename T >
static PL_FORCE_INLINE bool TryGetConstantBufferStorage (plConstantBufferStorageHandle hStorage, plConstantBufferStorage< T > *&out_pStorage)
 
static bool TryGetConstantBufferStorage (plConstantBufferStorageHandle hStorage, plConstantBufferStorageBase *&out_pStorage)
 
template<typename T >
static PL_FORCE_INLINE T * GetConstantBufferData (plConstantBufferStorageHandle hStorage)
 
static plGALSamplerStateCreationDescription GetDefaultSamplerState (plBitflags< plDefaultSamplerFlags > flags)
 

Friends

class plMemoryUtils
 

Member Function Documentation

◆ BindShader()

void plRenderContext::BindShader ( const plShaderResourceHandle & hShader,
plBitflags< plShaderBindFlags > flags = plShaderBindFlags::Default )

Sets the currently active shader on the given render context.

This function has no effect until the next draw or dispatch call on the context.

◆ GetSpecificTextureFilter()

plTextureFilterSetting::Enum plRenderContext::GetSpecificTextureFilter ( plTextureFilterSetting::Enum configuration) const

Returns the 'fixed' texture filter setting that the combination of default texture filter and given configuration defines.

If configuration is set to a fixed filter, that setting is returned. If it is one of LowestQuality to HighestQuality, the adjusted default filter is returned. When the default filter is used (with adjustments), the allowed range is Bilinear to Aniso16x, the Nearest filter is never used.

◆ SetDefaultTextureFilter()

void plRenderContext::SetDefaultTextureFilter ( plTextureFilterSetting::Enum filter)

Sets the texture filter mode that is used by default for texture resources.

The built in default is Anisotropic 4x. If the default setting is changed, already loaded textures might not adjust. Nearest filtering is not allowed as a default filter.

◆ SetPushConstants() [1/2]

template<typename T >
PL_ALWAYS_INLINE void plRenderContext::SetPushConstants ( const plTempHashedString & sSlotName,
const T & constants )
inline

Templated version of SetPushConstants.

Template Parameters
TType of the push constants struct.
Parameters
sSlotNameName of the BEGIN_PUSH_CONSTANTS block in the shader.
constantsInstance of type T that contains the push constants.

◆ SetPushConstants() [2/2]

void plRenderContext::SetPushConstants ( const plTempHashedString & sSlotName,
plArrayPtr< const plUInt8 > data )

Sets push constants to the given data block. Note that for platforms that don't support push constants, this is emulated via a constant buffer. Thus, a slot name must be provided as well which matches the name of the BEGIN_PUSH_CONSTANTS block in the shader.

Parameters
sSlotNameName of the BEGIN_PUSH_CONSTANTS block in the shader.
dataData of the push constants. If more than 128 bytes, plGALDeviceCapabilities::m_uiMaxPushConstantsSize should be checked to ensure the data block is not too big for the platform.

The documentation for this class was generated from the following files: