Gorgon
Show / Hide Table of Contents

Class Gorgon2DShaderState<T>

A shader state for use with a Gorgon2DBatchState.

Inheritance
object
Gorgon2DShaderState<T>
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: Gorgon.Renderers
Assembly: Gorgon.Renderers.Gorgon2D.dll
Syntax
public sealed class Gorgon2DShaderState<T> where T : GorgonShader
Type Parameters
Name Description
T

The type of shader. Must inherit from GorgonShader.

Remarks

This provides state information wrapped around shaders based on GorgonShader. These states are used for passing shader programs and related states to the Gorgon2DBatchState when setting up a batch render via Begin(Gorgon2DBatchState, GorgonCameraCommon).

If a custom pixel or vertex shader is assigned to the state, then developers should note which resource slots, and constant buffer slots are used by the 2D renderer itself. Gorgon will allow overriding of these slots, but in those cases, some information may no longer available and things may not work as expected. The following slots are use by the 2D renderer:

Shader TypeResource typeSlot #Purpose
PixelTexture/Sampler0Primary sprite texture/sampler.
PixelTexture1Additional texture for effects.
PixelConstants0Data for alpha testing.
Pixel and VertexConstants12Timing data.
Pixel and VertexConstants13Miscellaneous data (e.g. target width and height)
VertexConstants0View/Projection matrix for the CurrentCamera (or the default camera if null).
VertexConstants1Data for a polygon sprite.
Following this list, a developer can use any texture slot from 2 and up, and any constant buffer slots between 2 (or 1 for pixel shaders) and 11 for their own data.

Properties

| Edit this page View Source

ConstantBuffers

Property to return the constant buffers for the shader.

Declaration
public IGorgonReadOnlyArray<GorgonConstantBufferView> ConstantBuffers { get; }
Property Value
Type Description
IGorgonReadOnlyArray<GorgonConstantBufferView>
See Also
GorgonPipelineState
GorgonDrawCall
Gorgon2DBatchState
GorgonShader
| Edit this page View Source

Samplers

Property to return the samplers for the shader.

Declaration
public IGorgonReadOnlyArray<GorgonSamplerState> Samplers { get; }
Property Value
Type Description
IGorgonReadOnlyArray<GorgonSamplerState>
See Also
GorgonPipelineState
GorgonDrawCall
Gorgon2DBatchState
GorgonShader
| Edit this page View Source

Shader

Property to return the shader.

Declaration
public T Shader { get; }
Property Value
Type Description
T
See Also
GorgonPipelineState
GorgonDrawCall
Gorgon2DBatchState
GorgonShader
| Edit this page View Source

ShaderResources

Property to return the list of shader resources for the shader.

Declaration
public IGorgonReadOnlyArray<GorgonShaderResourceView> ShaderResources { get; }
Property Value
Type Description
IGorgonReadOnlyArray<GorgonShaderResourceView>
See Also
GorgonPipelineState
GorgonDrawCall
Gorgon2DBatchState
GorgonShader

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)

See Also

GorgonPipelineState
GorgonDrawCall
Gorgon2DBatchState
GorgonShader
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author