DirectXEffect
Description
- Derived from
-
RenderEffectGeneric<TParameters> abstract
- Extended by
-
DirectX11Effect abstract
DirectX12Effect abstract
Abstract base class for IRenderEffect implementations for DirectX 11 or higher.
An implementing class must perform the following steps in its constructor:
-
Create render effect passes with RenderEffect.PassCreate.
-
Create shader objects with RenderEffect.ShaderCreate and assign them to render effect passes with RenderEffect.ShaderAssign.
-
Create render state objects with BlendStateCreate2, DepthStencilStateCreate2, RasterizerStateCreate2 and assign them to render effect passes with BlendStateAssign3, DepthStencilStateAssign3, RasterizerStateAssign3.
-
Create sampler state objects with SamplerStateCreate2 and assign them to shader slots with SamplerStateAssign1.
-
Create constant buffer objects with ConstantBufferCreate and assign them to shader slots with ConstantBufferAssign.
-
Assign shader resources to shader slots with ShaderResourceCreate and ShaderResourceAssign.
-
Assign unordered access resources to shader slots with UnorderedAccessResourceCreate and UnorderedAccessResourceAssign.
If an implementation wants to use low-level parameter slots, the following steps must be performed in the constructor:
-
Declare automatic use of constant buffers with ConstantBufferDeclare.
-
Declare automatic use of sampler states with SamplerStateAssign4.
-
Declare automatic use of shader resources with ShaderResourceDeclare.
-
Declare automatic use of unordered access resources with UnorderedAccessResourceDeclare.
-
Declare low-level parameter slots with IRenderEffectParameters.ParameterDeclare, for example by calling RenderEffectParameters.Declare.
When using low-level parameter slots, the following methods are called automatically:
Public / Methods
BlendStateAssign
3 overloads
Assigns a blend state to a render effect pass.
- RenderException
-
If a graphics subsystem error has occurred.
Assigns a blend state to a render effect pass.
- RenderException
-
If a graphics subsystem error has occurred.
Assigns a blend state to a render effect pass.
BlendStateCreate
2 overloads
Creates a blend state.
- RenderException
-
If a graphics subsystem error has occurred.
Creates a blend state.
- RenderException
-
If a graphics subsystem error has occurred.
ConstantBufferCreate
Creates a constant buffer.
- RenderException
-
If a graphics subsystem error has occurred.
ConstantBufferDeclare
Declares automatic use of the given constant buffer.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a constant buffer may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
DepthStencilStateAssign
3 overloads
Assigns a depth/stencil state to a render effect pass.
- RenderException
-
If a graphics subsystem error has occurred.
Assigns a depth/stencil state to a render effect pass.
- RenderException
-
If a graphics subsystem error has occurred.
Assigns a depth/stencil state to a render effect pass.
DepthStencilStateCreate
2 overloads
Creates a depth/stencil state.
- RenderException
-
If a graphics subsystem error has occurred.
Creates a depth/stencil state.
- RenderException
-
If a graphics subsystem error has occurred.
RasterizerStateAssign
3 overloads
Assigns a rasterizer state to a render effect pass.
- RenderException
-
If a graphics subsystem error has occurred.
Assigns a rasterizer state to a render effect pass.
- RenderException
-
If a graphics subsystem error has occurred.
Assigns a rasterizer state to a render effect pass.
RasterizerStateCreate
2 overloads
Creates a rasterizer state.
- RenderException
-
If a graphics subsystem error has occurred.
Creates a rasterizer state.
- RenderException
-
If a graphics subsystem error has occurred.
RenderStateAssign
2 overloads
Assigns the given common render state preset to the given pass.
This method simply delegates to BlendStateAssign1, DepthStencilStateAssign1 and RasterizerStateAssign1, passing the render state preset obtained from RenderEffectParameters.EffectRenderState.
- RenderException
-
If a graphics subsystem error has occurred.
Assigns the given render state preset to the given pass.
This method simply delegates to BlendStateAssign1, DepthStencilStateAssign1 and RasterizerStateAssign1.
- RenderException
-
If a graphics subsystem error has occurred.
SamplerStateAssign
4 overloads
Assigns the given sampler state to a shader slot.
Declares automatic use of the given sampler state.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a sampler state may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
Declares automatic use of the given sampler state.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a sampler state may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
Declares automatic use of the given sampler state.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a sampler state may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
SamplerStateCreate
2 overloads
Creates a sampler state.
- RenderException
-
If a graphics subsystem error has occurred.
Creates a sampler state.
- RenderException
-
If a graphics subsystem error has occurred.
ShaderResourceAssign
Assigns the given shader resource to a slot of the given shader.
- RenderException
-
If a graphics subsystem error has occurred.
ShaderResourceDeclare
Declares automatic use of the given shader resource.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a shader resource may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
ShaderResourceDeclareWithState
2 overloads
Declares automatic use of the given shader resource and assigns the common sampler state preset, by delegating to RenderEffectParameters.EffectSamplerState and ShaderResourceDeclareWithState2.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a shader resource may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
Declares automatic use of the given shader resource and assigns the given sampler state preset, by delegating to ShaderResourceDeclare and SamplerStateAssign2.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a shader resource may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
UnorderedAccessResourceAssign
Assigns the given unordered access resource to a slot of the given shader.
UnorderedAccessResourceDeclare
Declares automatic use of the given unordered access resource.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before an unordered access resource may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
Protected / Methods
ClearResourceBindings
Clears the given binding slots for shader resources and unordered access resources.
The default implementation clears all resource bindings by calling SetShaderResourceBinding and SetUnorderedAccessResourceBinding passing null
as the current resource object.
DoBlendStateCreate
Creates a blend state.
- RenderException
-
If a graphics subsystem error has occurred.
DoConstantBufferCreate
Creates a constant buffer.
- RenderException
-
If a graphics subsystem error has occurred.
DoConstantBufferUpdate
Updates the given constant buffer.
This method will only be called between paired calls to DoConstantBufferUpdateBegin and DoConstantBufferUpdateEnd.
DoDepthStencilStateCreate
Creates a depth/stencil state.
- RenderException
-
If a graphics subsystem error has occurred.
DoRasterizerStateCreate
Creates a rasterizer state.
- RenderException
-
If a graphics subsystem error has occurred.
DoSamplerStateCreate
Creates a sampler state.
- RenderException
-
If a graphics subsystem error has occurred.
DoShaderCreate_ByteCode
Consumes the shader bytecode.
- RenderException
-
If a graphics subsystem error has occurred.
DoShaderCreate_Info
Reads shader information for the given shader binary.
- IOException
-
If an I/O error has occurred.
- ValidatingException
-
If the shader metadata has an invalid format.
PassCreateWithState
Creates a render effect pass and applies its common render state preset.
This method simply delegates to RenderEffect.PassCreate and RenderStateAssign1.
- RenderException
-
If a graphics subsystem error has occurred.
SetParameters
Applies the current values of all changed effect parameters (see RenderEffectParameters.Changed2).
SetShaderResource
3 overloads
Sets a shader resource.
- See also
Sets a shader resource.
- See also
Sets a shader resource.
- See also
SetUnorderedAccessResource
2 overloads
Sets the given buffer as an unordered access resource.
- See also
Sets the given texture as an unordered access resource.
- See also
SetUnorderedAccessResourceBinding
Derived classes may call this method generate IResource.Binding2 calls.
Protected / Attributes
constantBufferMapping
Shader slot mapping for constant buffers:
firstX := shader-object firstY := shader-slot second := constant-buffer
passBlendFactors
Mapping from pass index to blend factors:
first := parameter-slot second.X := blend-factor for red channel second.Y := blend-factor for green channel second.Z := blend-factor for blue channel second.W := blend-factor for alpha channel
passStencilRef
Mapping from pass index to stencil reference value:
first := pass second := depth-stencil reference value
rasterizerStateMapping
Pass mapping for rasterizer states:
first := pass second := rasterizer-state
samplerStateMapping
Shader slot mapping for sampler states:
firstX := shader-object firstY := shader-slot second := sampler-state
shaderResourceMapping
Shader slot mapping for shader resources:
firstX := shader-object firstY := shader-resource second := shader-slot
shaderResourceType
Mapping from shader resource to resource type:
first := shader-resource second := resource type: 0 : unknown 1 : texture 2D 2 : texture-array 2D 3 : texture CUBE 4 : texture-array CUBE 5 : buffer