Class Globals
Namespace: ValveResourceFormat.Renderer.Buffers
Assembly: Renderer.dll
Holds the packed values of a shader's loose global uniforms, as laid out by
. Every owns one, filled once from theshader defaults plus the material's own parameters, so drawing only has to bind it.
public sealed class Globals : BufferInheritance
Inherited Members
Buffer.Target, Buffer.Handle, Buffer.BindingPoint, Buffer.Name, Buffer.Size, Buffer.BindBufferBase(), Buffer.Delete()
Constructors
Globals(string)
Initializes a new constant buffer bound to .
public Globals(string name)Parameters
name string
Debug name, normally the shader or material this buffer belongs to.
Methods
BeginFill(GlobalsLayout)
Starts filling this buffer: sets every member to its shader source default, reallocating first if the layout changed size. Writes are held back until so the fill costs one upload.
public void BeginFill(GlobalsLayout layout)Parameters
layout GlobalsLayout
The layout to apply, which differs from the current one only after a shader reload.
Bind()
Uploads any pending writes and binds this buffer to .
public void Bind()Remarks
Binds unconditionally. Which buffer occupies the slot is state of the GL context, which outlives any one thread and can be swapped for another, so there is nothing safe to cache it in.
EndFill()
Ends a fill started by and uploads it as one range.
public void EndFill()SetMatrix(in GlobalsMember, Matrix4x4)
Writes a member.
public void SetMatrix(in GlobalsMember constant, Matrix4x4 value)Parameters
constant GlobalsMember
value Matrix4x4
Remarks
Written in memory order, which puts each of its rows in a column of the GLSL matrix. That is the same transposition glProgramUniformMatrix4 applied before these were packed.
SetScalar(in GlobalsMember, float)
Writes a scalar member, converting to the declared component type.
public void SetScalar(in GlobalsMember constant, float value)Parameters
constant GlobalsMember
value float
SetScalar(in GlobalsMember, long)
Writes a scalar member, converting to the declared component type.
public void SetScalar(in GlobalsMember constant, long value)Parameters
constant GlobalsMember
value long
SetVector(in GlobalsMember, Vector4)
Writes a vector member, using as many components as the declared type has.
public void SetVector(in GlobalsMember constant, Vector4 value)Parameters
constant GlobalsMember
value Vector4

