IRenderEffectComponents

Description

interface Tinman.Engine.Rendering.Effects.IRenderEffectComponents

Extended by

RenderEffectComponents abstract

Base interface for classes that can build components of a IRenderEffect through a common interface which does not depend on a specific render API.

An implementation of IRenderEffect for a specific render API provide an object of this interface to its RenderEffectParameters object, which then build common render effect components. The purpose of this is to extract all common code into a single location, instead of having similar code spread over multiple classes which are distributed over (usually non-related) projects.

Public / Methods

Buffer


public method Buffer → (1)

name in : string

[not-empty]
The constant buffer name.

The render effect is using a constant buffer of the given name in.

If a render effect implementation does not require declaration of used constant buffers, calls to this method will be ignored silently. Constant buffer declaration is required for:

  • Direct3D 9 : no

  • Direct3D 11 : yes

  • Direct3D 12 : yes

  • OpenGL : no

  • OpenGLES : no

RenderException

If a graphics subsystem error has occurred.

Finish


public method Finish → ()

Finished building of common render effect components.

RenderException

If a graphics subsystem error has occurred.

Manual


public method Manual → (1)

pass in : int32

[>=0]
The pass index.

Specifies that render state will be set up manually for the given render pass in.

Pass


public method Pass → (6)

pass in : int32

[>=0]
The pass index.

s1 opt : string = null

A shader specification or null.

s2 opt : string = null

A shader specification or null.

s3 opt : string = null

A shader specification or null.

s4 opt : string = null

A shader specification or null.

s5 opt : string = null

A shader specification or null.

Creates shader objects and render passes and associated them with another.

The shader specifications are simple strings, using the following Grammar:

shader := type '|' name '|' id ;

name   := id .. '.' ;
type   := 'VS' | 'TP' | 'TV' | 'GS' | 'PS' | 'CS' ;

id     := char+ ;

char   := 'a'..'z' | 'A'..'Z' | '0'..'9' | '_' | '-' ;

Each call to this method causes a call to RenderEffect.ShaderCreate for each new shader specification, followed by zero or more calls RenderEffect.ShaderAssign.
For example, the shader specification…​

"VS | My-Shader | Folder"

will use the following shader binary resp. source:

"$(ShaderRepository)/glsl.gl41/Folder/My-Shader.glsl"   (OpenGL 4.1+)
"$(ShaderRepository)/glsl.gles30/Folder/My-Shader.glsl" (OpenGLES 3.0+)
"$(ShaderRepository)/hlsl.dx9/Folder/My-Shader.cso"     (Direct3D 9)
"$(ShaderRepository)/hlsl.dx11/Folder/My-Shader.cso"    (Direct3D 11)
"$(ShaderRepository)/hlsl.dx12/Folder/My-Shader.cso"    (Direct3D 12)
RenderException

If a graphics subsystem error has occurred.

Resource


public method Resource → (2)

name in : string

[not-empty]
The shader resource name.

buffer opt : bool = false

Declare a buffer resource (true) with direct read/write access by the GPU, or a regular texture resource (false)?

Declares a shader resource.

If a render effect implementation does not require declaration of shader resources, calls to this method will be ignored silently. Shader resource declaration is required for:

  • Direct3D 9 : no

  • Direct3D 11 : yes

  • Direct3D 12 : yes

  • OpenGL : no

  • OpenGLES : no

Any additional state setup for the shader resource must be performed manually by the IRenderEffect implementation, such as sampler state.

RenderException

If a graphics subsystem error has occurred.

Texture


public method Texture → (2)

name in : string

[not-empty]
The shader resource name.

sampler opt : string = null

The sampler name. If null, name in will be used after adding the "Sampler" suffix.

Declares a texture resource with a sampler state preset.

The sampler state of the given texture resource will be created automatically, based on RenderEffectParameters.EffectSamplerState.

RenderException

If a graphics subsystem error has occurred.

Vertex


public method Vertex → (5)

name in : string

[not-empty]
The name of the vertex attribute, as given in the shader code, without any array size specifier suffixes (e.g. [n]).

data in : int32

[0..1]
Specifies which vertex buffer to map as input:
0 : per-vertex data (see IGeometryBuffer.Vertices)
1 : per-instance data (see IGeometryBuffer.Instances).

usage in : VertexElementUsage

The vertex element usage to use for mapping.

first opt : int32 = 0

[>=0]
The zero-based vertex element usage index to use for mapping the first array element of the vertex attribute. Subsequent array elements will use subsequent usage indices.

count opt : int32 = 1

[>=1]
The number of array elements in the vertex attribute.

Declares an input vertex attribute.

If a render effect implementation does not require declaration of vertex attributes, calls to this method will be ignored silently. Vertex attribute declaration is required for:

  • Direct3D 9 : no

  • Direct3D 11 : no

  • Direct3D 12 : no

  • OpenGL : yes

  • OpenGLES : yes

RenderException

If a graphics subsystem error has occurred.