struct ShaderInformationBase

Inherits: IReflectable

Structure used for initializing a shader.

Public

Constructors

ShaderInformationBase

ShaderInformationBase()

Methods

AddParameter

void AddParameter(ShaderDataParameterInformation parameterInformation, u8 *defaultValue = nullptr)

Registers a new data (int, Vector2, etc.) parameter you that you may then use via Material by providing the parameter name.

All parameters internally map to variables defined in GPU programs.

parameterInformation
Structure describing the parameter to add.
defaultValue
(optional) Pointer to the buffer containing the default value for this parameter (initial value that will be set when a material is initialized with this shader). The provided buffer must be of the correct size (depending on the element type and array size).

AddParameter

void AddParameter(ShaderObjectParameterInformation parameterInformation)

Registers a new object (texture, sampler state, etc.) parameter you that you may then use via Material by providing the parameter name.

All parameters internally map to variables defined in GPU programs. Multiple GPU variables may be mapped to a single parameter in which case the first variable actually found in the program will be used while others will be ignored.

parameterInformation
Structure describing the parameter to add.

AddParameter

void AddParameter(ShaderObjectParameterInformation parameterInformation, const SamplerStateCreateInformation &defaultValue)

AddParameter

void AddParameter(ShaderObjectParameterInformation parameterInformation, ShaderDefaultTextureType defaultValue)

SetParameterAttribute

void SetParameterAttribute(const String &name, const ShaderParameterAttribute &attribute)

Applies an attribute to the parameter with the specified name.

name
Name of an object or data parameter to apply the attribute to.
attribute
Structure describing the attribute to apply.

SetUniformBufferAttributes

void SetUniformBufferAttributes(const String &name, bool shared, GpuBufferFlags flags, StringID rendererSemantic = StringID::kNone)

Changes parameters of a uniform buffer with the specified name.

name
Name of the uniform buffer. This should correspond with the name specified in the GPU program code.
shared
If uniform buffer is marked as shared it will not be automatically created by the Material. You will need to create it elsewhere and then assign it manually.
flags
Flags that control the behaviour of the uniform buffer.
rendererSemantic
(optional) Semantic that allows you to specify the use of this uniform buffer in the renderer. The actual value of the semantic depends on the current Renderer and its supported list of semantics. Elements with a renderer semantic will not have their uniform buffer automatically created (similar to "shared" argument), but instead a Renderer will create an assign it instead. Be aware that renderers have strict policies on what and how are parameters stored in the buffer and you will need to respect them. If you don't respect them your shader will be deemed incompatible and won't be used. Value of 0 signifies the uniform buffer is not used by the renderer.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

Fields

QueueSortType

Sorting type to use when performing sort in the render queue.

Default value is sort front to back which causes least overdraw and is preferable. Transparent objects need to be sorted back to front. You may also specify no sorting and the elements will be rendered in the order they were added to the render queue.

QueuePriority

Priority that allows you to control in what order are your shaders rendered.

See QueuePriority for a list of initial values. Shaders with higher priority will be rendered before shaders with lower priority, and additionally render queue will only sort elements within the same priority group.

SeparablePasses

bool SeparablePasses

Enables or disables separable passes.

When separable passes are disabled all shader passes will be executed in a sequence one after another. If it is disabled the renderer is free to mix and match passes from different objects to achieve best performance. (They will still be executed in sequence, but some other object may be rendered in-between passes)

Flags

ShaderFlags Flags

Flags that let the renderer know how should it interpret the shader.

VariationParameters

Vector<ShaderVariationParameterInformation> VariationParameters

Information about all variation parameters and their possible values.

Each permutation of variation parameters represents a separate shader variation.

CompilerMetaData

SPtr<ShaderCompilerMetaData> CompilerMetaData

Meta-data required by the shader compiler when compiling shader variations on demand.

Can be null if the shader is being initialized with precompiled variations.

DataParameters

Map<String, ShaderDataParameterInformation> DataParameters

TextureParameters

Map<String, ShaderObjectParameterInformation> TextureParameters

BufferParameters

Map<String, ShaderObjectParameterInformation> BufferParameters

SamplerParameters

Map<String, ShaderObjectParameterInformation> SamplerParameters

UniformBuffers

Map<String, ShaderUniformBufferInformation> UniformBuffers

DataDefaultValues

Vector<u8> DataDefaultValues

SamplerDefaultValues

Vector<SamplerStateInformation> SamplerDefaultValues

TextureDefaultValues

Vector<ShaderDefaultTextureType> TextureDefaultValues

ParameterAttributes

Vector<ShaderParameterAttribute> ParameterAttributes

Private

Methods

AddParameterInternal

void AddParameterInternal(ShaderObjectParameterInformation parameterInformation, u32 defaultValueIndex)