GLEffect
Description
- Derived from
-
RenderEffect<TParameters> abstract
- Extended by
-
OpenGLEffect abstract
OpenGLESEffect abstract
Abstract base class for IRenderEffect implementations for OpenGL 4.1 Core Profile (or newer) and OpenGLES 3.0 (or newer).
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.
-
Declare vertex attributes with VertexAttributeDeclare. Based on the specified value semantics, vertex attributes will then be mapped to the vertex elements (see VertexElements) of the current geometry buffer (see IGeometryBuffer).
-
Create sampler states with SamplerStateCreate1 and assign them to texture resources with SamplerStateAssign.
Because there are no render state blocks / objects that could be created in the constructor, the render state for each pass must be setup by subclasses, using the following methods:
-
The RenderStateSet must be implemented and will be called each time the active render pass changes.
-
Use the RenderStateDefault method is establish default render state, for example when the render effect has begun.
-
Use the RenderStateApply method to set common render state values.
-
Use the GLBase subclass for setting all other render state.
If an implementation wants to use low-level parameter slots, the following steps must be performed in the constructor:
-
Declare low-level parameter slots with IRenderEffectParameters.ParameterDeclare, for example by calling RenderEffectParameters.Declare.
Public / Constants
CS
Shader type index: Compute Shader (GL_COMPUTE_SHADER
)
Compute shaders are not available in OpenGLES 3.0.
- See also
GS
Shader type index: Geometry Shader (GL_GEOMETRY_SHADER
)
Geometry shaders are provided by an extension in OpenGLES 3.0/3.1.
- See also
MS
Shader type index: Mesh Shader (GL_MESH_SHADER_NV
)
Mesh shaders are provided by a vendor-specific extension.
- See also
TCS
Shader type index: Tessellation Control Shader (GL_TESS_CONTROL_SHADER
)
Tessellation shaders are provided by an extension in OpenGLES 3.0/3.1.
TES
Shader type index: Tessellation Evaluation Shader (GL_TESS_EVALUATION_SHADER
)
Tessellation shaders are provided by an extension in OpenGLES 3.0/3.1.
Public / Methods
RenderStateApply
Applies the given render state preset.
This method assumes that default render state values are in place, as defined by the implementation of RenderStateDefault or the GL (in that order).
RenderStateDefault
Sets default render state values.
Please refer to the documentation of the concrete subclass for details on which render state is set by this method.
RenderStateSet
Sets the render state for the current render effect pass.
SamplerStateAssign
Assigns a sampler state to a texture resource.
All vertex attributes must have been declared via VertexAttributeDeclare before a sampler state may be assigned.
- RenderException
-
If a graphics subsystem error has occurred.
SamplerStateCreate
3 overloads
Creates a sampler state (step 1 of 2).
Use the returned sampler object name to configure the sampler state using the GL API. Then, call SamplerStateCreate3.
- RenderException
-
If sampler state creation has failed.
- See also
Creates a sampler state based on a SamplerStatePreset.
This method first calls SamplerStateCreate1, then SamplerStateApply, passing preset in. Finally, it calls SamplerStateCreate3 and returns the result.
- RenderException
-
If sampler state creation has failed.
Creates a sampler state (step 2 of 2).
VertexAttributeDeclare
Declares a vertex attribute.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a vertex attribute may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
- See also
Protected / Methods
BufferObjectCreate
Creates a buffer object for a uniform block.
- RenderException
-
If buffer creation has failed.
BufferObjectUpdate
Updates the content of the given buffer object.
For each sequence of buffer updates, the last call will receive a bufferObject in of 0
.
ProgramObjectBinary
2 overloads
Tries to retrieve the binary of the given program.
Builds a program from the given binary.
- RenderException
-
If program creation has failed.
ProgramObjectBuild
Creates a program object for each available render effect pass, attaches all shader objects and links the program.
- RenderException
-
If program creation has failed.
- See also
ProgramObjectReflect
Reflects the active vertex attributes, active uniforms and uniform blocks of the given program object.
An implementing method must perform the following steps, in the order given:
-
For each active vertex attribute, call the ProgramObjectReflectAttribute method once.
-
For each uniform block, call the ProgramObjectReflectUniformBlock method once.
-
For each active uniform, call the ProgramObjectReflectUniform method once.
- RenderException
-
If program reflection has failed.
ProgramObjectReflectAttribute
Declares a program vertex attribute.
- RenderException
-
If the given vertex attribute specification is invalid or unsupported.
- See also
ProgramObjectReflectShaderStorageBlock
Declares a program shader storage block.
- RenderException
-
If the given shader storage block specification is invalid.
ProgramObjectReflectUniform
Declares a program uniform variable.
- RenderException
-
If the given uniform specification is invalid or unsupported.
- See also
ProgramObjectReflectUniformBlock
Declares a program uniform block.
- RenderException
-
If the given uniform block specification is invalid.
- See also
ProgramObjectUse
Applies the given program in for subsequent use.
The following steps must be performed, in the order given:
-
Activate the given program in by calling
glUseProgram
. -
Apply the uniform block buffers for the given program in, using uniformBlockBinding and uniformBlockGpu.
-
Apply the sampler objects for the given program in, using samplerBinding.
-
Apply the texture units to the uniform variables of the given program in, using uniformTextures.
Protected / Attributes
RenderEffectIdentifier
Returns the identifier of this render effect that shall be used for naming files in the program binary cache.
samplerBinding
Mapping from program object and texture unit to sampler object:
first.X := program object name first.Y := texture unit index second := sampler object name
shaderObjects
Mapping from render effect shader to shader object:
first := render effect shader index second := shader object name
shaderStorageBlockBinding
Mapping from program and shader storage block index to binding point:
first.X := program object name first.Y := program-agnostic shader storage block index second := shader storage block binding point index
uniformBlockBinding
Mapping from program object and uniform block to uniform block binding:
first.X := program object name first.Y := program-agnostic uniform block index second := uniform block binding point index or -1 if not used