Back to class index

Class ShaderConstantBuffer

Summary

Stores a CPU and GPU side array of shader program constant variables.

Description

Prior to rendering, a ShaderConstantBuffer must be bound to the material this constant buffer is to supply constants to. After binding, this constant buffer may be used only with any other materials that are compatible with the binding to the original material (has same shader constants present in the same indices).

A ShaderConstantBuffer object does not only provide values for constant registers for shaders, but is also used to specify all other uniform inputs to a shader, i.e. textures and texture samplers.

Member Reference

ShaderConstantBufferStores a CPU and GPU side array of shader program constant variables.
engineConstantIndicesThe engine specifies a list of precomputed constant indices, like world/worldview/worldviewproj, and so on.
constantDataCpu-side copy of the constant data buffer.
constantDataSizeBytesThe size of the above array in bytes.
constantDescriptionsLists the descriptions of the constants in this constant buffer.
boundShaderProgramHandleStores the shader program this constant buffer has been bound to.
ctor (+1 overload)Creates an empty uninitialized constant buffer.
~dtor
Create(...) (+4 overloads)Recreates this shader constant buffer with the given set of constants.
CreateFromXml(e)Loads this shader constant buffer from the given XML file.
ApplyValuesFromXml(e)Loads the currently set values for the variables in this shader constant buffer from the given XML file.
Deinit()Frees up all resources used by this ShaderConstantBuffer and makes this a null object.
Apply()[const]Applies this constant buffer to the shader program (Material) that is currently activated on the device.
ConstantByName(constantName)Returns the description object of the shader constant with the given name.
ConstantIndex(constantName)Returns the index (ordinal) of the given shader constant in this constant buffer.
BindToMaterial(...)
IsParameterIndexPresent(parameterIndex)[const]Returns true if the parameter specified at the given index is actually present in the constant buffer.
IsConstantActive(constantName)[const] (+1 overload)Returns true if the given constant is actually being used by the Shader this constant buffer is bound to.
SetFloat(...) (+2 overloads)Sets the value of a single float shader constant.
SetFloat2(...) (+2 overloads)Sets the value of a float2 (x,y) shader constant.
SetFloat3(...) (+2 overloads)Sets the value of a float3 (x,y,z) shader constant.
SetFloat4(...) (+2 overloads)Sets the value of a float4 (x,y,z,w) shader constant.
SetFloat4x4(...) (+2 overloads)Sets the value of a 4x4 matrix shader constant.
SetTexture(...) (+2 overloads)Sets a texture to be used with a shader.
SetTextureSampler(...) (+2 overloads)Sets the sampling options of a texture used with a shader.
Back to class index