Class CtabConstant
- Namespace
- ShadowDusk.Core.Reflection
- Assembly
- ShadowDusk.Core.dll
One constant from a D3D9 shader's CTAB constant table: the bridge between an HLSL
global and the register(s) the SM1–3 bytecode reads it from. Class,
Type carry the raw D3DXPARAMETER_CLASS/D3DXPARAMETER_TYPE
values — numerically identical to MojoShader's symbol class/type and to the fx_2_0
typedef encoding (see docs/fx2-binary-format.md §6.1).
public sealed record CtabConstant : IEquatable<CtabConstant>
- Inheritance
-
CtabConstant
- Implements
- Inherited Members
Constructors
CtabConstant(string, CtabRegisterSet, int, int, int, int, int, int, int, IReadOnlyList<float>?)
One constant from a D3D9 shader's CTAB constant table: the bridge between an HLSL
global and the register(s) the SM1–3 bytecode reads it from. Class,
Type carry the raw D3DXPARAMETER_CLASS/D3DXPARAMETER_TYPE
values — numerically identical to MojoShader's symbol class/type and to the fx_2_0
typedef encoding (see docs/fx2-binary-format.md §6.1).
public CtabConstant(string Name, CtabRegisterSet RegisterSet, int RegisterIndex, int RegisterCount, int Class, int Type, int Rows, int Columns, int Elements, IReadOnlyList<float>? DefaultValue)
Parameters
NamestringThe constant's name — in fx_2_0 effects this MUST match the effect parameter name exactly (MojoShader binds by
strcmp).RegisterSetCtabRegisterSetWhich register file the constant occupies.
RegisterIndexintFirst register.
RegisterCountintNumber of registers occupied.
ClassintRaw
D3DXPARAMETER_CLASS(0=scalar, 1=vector, 2=matrix-rows, 3=matrix-cols, 4=object, 5=struct).TypeintRaw
D3DXPARAMETER_TYPE(1=bool, 2=int, 3=float, 10–14=sampler…).RowsintLogical row count (CTAB stores rows-then-columns, the documented D3D order — unlike the fx_2_0 typedef quirk).
ColumnsintLogical column count.
ElementsintArray element count (0 or 1 for non-arrays as written by the compiler; normalized to ≥ 1 here).
DefaultValueIReadOnlyList<float>The constant's default value when the CTAB carries one and it is a scalar/vector (single register row); null otherwise. Matrix defaults are intentionally not read — their majority in CTAB is unverified (see
docs/fx2-binary-format.md§15 F2) and a wrong-major default would silently corrupt rendering.
Properties
Class
Raw D3DXPARAMETER_CLASS (0=scalar, 1=vector, 2=matrix-rows,
3=matrix-cols, 4=object, 5=struct).
public int Class { get; init; }
Property Value
Columns
Logical column count.
public int Columns { get; init; }
Property Value
DefaultValue
The constant's default value when the CTAB carries one and
it is a scalar/vector (single register row); null otherwise. Matrix
defaults are intentionally not read — their majority in CTAB is unverified (see
docs/fx2-binary-format.md §15 F2) and a wrong-major default would silently
corrupt rendering.
public IReadOnlyList<float>? DefaultValue { get; init; }
Property Value
Elements
Array element count (0 or 1 for non-arrays as written by the compiler; normalized to ≥ 1 here).
public int Elements { get; init; }
Property Value
Name
The constant's name — in fx_2_0 effects this MUST match the effect
parameter name exactly (MojoShader binds by strcmp).
public string Name { get; init; }
Property Value
RegisterCount
Number of registers occupied.
public int RegisterCount { get; init; }
Property Value
RegisterIndex
First register.
public int RegisterIndex { get; init; }
Property Value
RegisterSet
Which register file the constant occupies.
public CtabRegisterSet RegisterSet { get; init; }
Property Value
Rows
Logical row count (CTAB stores rows-then-columns, the documented D3D order — unlike the fx_2_0 typedef quirk).
public int Rows { get; init; }
Property Value
Type
Raw D3DXPARAMETER_TYPE (1=bool, 2=int, 3=float, 10–14=sampler…).
public int Type { get; init; }