RenderEffect
Description
- Derived from
-
Disposable abstract
IRenderEffect<TParameters>
IRenderEffectParameters - Extended by
-
DirectX9Effect abstract
DirectXEffect abstract
GLEffect abstract
Abstract base class for IRenderEffect implementations.
From a high-level perspective, a render effect object provides an abstraction that makes it possible to use the effect in a uniform way, regardless of the actual GPU/API-specific implementation underneath:
-
Demarcation methods for activating any of the render effect passes:
IBeginEnd.Begin, IRenderEffectBase.Pass, IBeginEnd.End. -
Accessor methods for setting the render effect parameters and updating them during rendering:
IRenderEffect.Parameters, IRenderEffectBase.Apply.
Seen from a low-level perspective, a render effect object encapsulates the following GPU entities:
-
One or more shader programs of different types (e.g. pixel shader, vertex shader). Usually written in a shading language (e.g. HLSL, GLSL), shader programs are compiled into shader binaries at build-time using an external tool (e.g.
fxc
,dxc
,glslc
) or at run-time using some compiler service of the API (e.g. OpenGL). The shader binaries are loaded by the render effect object. -
Management of logical parameter slots, based on the parameters that are defined in the shader programs. For example, the same parameter definition in a Direct3D9 shader program may be mapped to different shader types (VS, PS) and passes.
-
GPU render states for each render effect pass (e.g. state block management for Direct3D 9).
-
Handling of render effect parameter values (e.g. constant buffer management for Direct3D 11).
-
Handling of input resources, such as textures and samplers.
The default implementation of IRenderEffectBase.PassAvailable always returns true
.
Protected / Methods
DoParameterDeclare
Declares a render effect parameter.
- RenderException
-
If a graphics subsystem error has occurred.
DoShaderCreate
Creates a shader object.
- IOException
-
If an error has occurred while loading the shader binary and/or metadata.
- ValidatingException
-
If the shader metadata has an unsupported format and cannot be decoded.
- RenderException
-
If a graphics subsystem error has occurred.
ShaderAssign
Assigns a shader object to an effect pass.
Render effect passes are created implicitly by assigning shader objects to them.
ShaderCreate
Creates a shader object.
- IOException
-
If an error has occurred while loading the shader binary and/or metadata.
- ValidatingException
-
If the shader metadata has an unsupported format and cannot be decoded.
- RenderException
-
If a graphics subsystem error has occurred.