Table of Contents

Class MatrixInterpolantDeclaration

Namespace
ShadowDusk.HLSL.Ast
Assembly
ShadowDusk.HLSL.dll

One MATRIX-typed declaration with a semantic in an entry point's signature (a parameter, the return value, or a member of a struct either of those uses, at any depth), read off the preprocessed source by CollectGlSamplerSlots(string, string, FxParseResult).

The OpenGL target needs it because DXC emits byte-identical SPIR-V, and so GLSL, for a row_major and a column_major matrix interpolant, while fxc (and so mgfxc) packs them differently: one HLSL COLUMN per register for column_major (the default; a #pragma pack_matrix does not change it for interpolants), one ROW per register for an explicit row_major. The rewriter must reproduce that layout, or a stage that declares the interpolant as separate vectors reads the wrong data. A float1xN (column_major) or row_major floatNx1 spreads over N registers in fxc but reaches the rewriter as a plain vector, so it is recorded too: the rewrite splits it over N one-component registers as fxc does (and refuses it as a vertex input).

public sealed record MatrixInterpolantDeclaration : IEquatable<MatrixInterpolantDeclaration>
Inheritance
MatrixInterpolantDeclaration
Implements
Inherited Members

Constructors

MatrixInterpolantDeclaration(string, string, int, int, bool)

One MATRIX-typed declaration with a semantic in an entry point's signature (a parameter, the return value, or a member of a struct either of those uses, at any depth), read off the preprocessed source by CollectGlSamplerSlots(string, string, FxParseResult).

The OpenGL target needs it because DXC emits byte-identical SPIR-V, and so GLSL, for a row_major and a column_major matrix interpolant, while fxc (and so mgfxc) packs them differently: one HLSL COLUMN per register for column_major (the default; a #pragma pack_matrix does not change it for interpolants), one ROW per register for an explicit row_major. The rewriter must reproduce that layout, or a stage that declares the interpolant as separate vectors reads the wrong data. A float1xN (column_major) or row_major floatNx1 spreads over N registers in fxc but reaches the rewriter as a plain vector, so it is recorded too: the rewrite splits it over N one-component registers as fxc does (and refuses it as a vertex input).

public MatrixInterpolantDeclaration(string Semantic, string Name, int Rows, int Columns, bool RowMajor)

Parameters

Semantic string

The semantic, normalized (uppercased, index by value: TEXCOORD00 is TEXCOORD0).

Name string

The declared member, parameter or function name.

Rows int

HLSL rows (float4x3 is 4 rows of 3 columns).

Columns int

HLSL columns.

RowMajor bool

The declaration (or the typedef it uses) says row_major.

Properties

Columns

HLSL columns.

public int Columns { get; init; }

Property Value

int

IsDegenerate

The shapes fxc spreads over more registers than the vector the rewriter is handed: a column_major float1xN (N registers of one component) and a row_major floatNx1.

public bool IsDegenerate { get; }

Property Value

bool

Name

The declared member, parameter or function name.

public string Name { get; init; }

Property Value

string

RowMajor

The declaration (or the typedef it uses) says row_major.

public bool RowMajor { get; init; }

Property Value

bool

Rows

HLSL rows (float4x3 is 4 rows of 3 columns).

public int Rows { get; init; }

Property Value

int

Semantic

The semantic, normalized (uppercased, index by value: TEXCOORD00 is TEXCOORD0).

public string Semantic { get; init; }

Property Value

string