Class GlobalsLayout
Namespace: ValveResourceFormat.Renderer.Shaders
Assembly: Renderer.dll
The std140 layout of a shader's loose global uniforms after they have been packed into a single uniform block. Built once per shader file from its parsed source, and therefore shared by every static combo variant of that shader.
public sealed class GlobalsLayoutInheritance
Fields
BlockName
The name of the generated GLSL uniform block.
public const string BlockName = "Globals"Field Value
Properties
BlockSource
Gets the GLSL declaration of the uniform block, prepended to every stage of the shader.
public string BlockSource { get; }Property Value
DefaultBytes
Gets the buffer contents a material starts from, with every member set to its shader source default.
public ReadOnlySpan<byte> DefaultBytes { get; }Property Value
Empty
Gets the layout used by shaders that declare no packable uniforms.
public static GlobalsLayout Empty { get; }Property Value
FloatDefaults
Gets the source defaults of the scalar float members.
public IReadOnlyDictionary<string, float> FloatDefaults { get; }Property Value
IReadOnlyDictionary<string, float>
IntDefaults
Gets the source defaults of the scalar integer and boolean members.
public IReadOnlyDictionary<string, long> IntDefaults { get; }Property Value
IReadOnlyDictionary<string, long>
MatrixDefaults
Gets the source defaults of the matrix members.
public IReadOnlyDictionary<string, Matrix4x4> MatrixDefaults { get; }Property Value
IReadOnlyDictionary<string, Matrix4x4>
Members
Gets the packed members by uniform name.
public IReadOnlyDictionary<string, GlobalsMember> Members { get; }Property Value
IReadOnlyDictionary<string, GlobalsMember>
Size
Gets the size of the constant buffer in bytes, zero when there is nothing to pack.
public int Size { get; }Property Value
VectorDefaults
Gets the source defaults of the vector members.
public IReadOnlyDictionary<string, Vector4> VectorDefaults { get; }Property Value
IReadOnlyDictionary<string, Vector4>
Methods
Build(IEnumerable<GlobalsDeclaration>)
Merges the declarations collected from every stage of one shader and computes the packed layout.
public static GlobalsLayout Build(IEnumerable<GlobalsDeclaration> declarations)Parameters
declarations IEnumerable<GlobalsDeclaration>
Declarations in source order; duplicates across stages are merged.
Returns
Exceptions
ShaderLoader.ShaderCompilerException
A uniform is declared with conflicting types or defaults.

