Class CombinedSamplerPair
- Namespace
- ShadowDusk.Core.Reflection
- Assembly
- ShadowDusk.Core.dll
One (texture, sampler) pair that SPIRV-Cross's build_combined_image_samplers pass
collapses into a single GLSL combined-sampler uniform. Both names are the HLSL identifiers
(the SPIR-V OpName of the backing variables), which is the key BOTH reflection paths
agree on — the native DXIL oracle and the pure-managed SpirvReflector assign
different raw binding numbers, so a binding-keyed join would not be host-independent.
public sealed record CombinedSamplerPair : IEquatable<CombinedSamplerPair>
- Inheritance
-
CombinedSamplerPair
- Implements
- Inherited Members
Constructors
CombinedSamplerPair(string, string, int)
One (texture, sampler) pair that SPIRV-Cross's build_combined_image_samplers pass
collapses into a single GLSL combined-sampler uniform. Both names are the HLSL identifiers
(the SPIR-V OpName of the backing variables), which is the key BOTH reflection paths
agree on — the native DXIL oracle and the pure-managed SpirvReflector assign
different raw binding numbers, so a binding-keyed join would not be host-independent.
public CombinedSamplerPair(string TextureName, string SamplerName, int TextureDeclarationIndex)
Parameters
TextureNamestringThe HLSL name of the sampled texture (the image half of the pair).
SamplerNamestringThe HLSL name of the
SamplerState(the sampler half).TextureDeclarationIndexintThe 0-based rank of this pair's texture among the stage's sampled images, in module order — the order
OpVariableappears in the SPIR-V, which is HLSL declaration order. This is the GL texture unit the pair binds to, because fxc (and therefore mgfxc) allocates OpenGL sampler slots in declaration order, NOT in the first-use order SPIRV-Cross numbers its combined samplers by (GitHub issue #189).Deliberately NOT ranked by the
Bindingdecoration. The two coincide whenever DXC auto-allocates, but diverge as soon as the source carries explicit registers — and there declaration order is the one that matches mgfxc: forTexture2D TexA : register(t3); Texture2D TexB : register(t2);mgfxc's OpenGL build puts TexA (declared first) on slot 0, where a binding-ordered rank would put TexB. Deriving it from the SPIR-V rather than from reflection keeps it host-independent, so the desktop and WASM hosts still agree byte-for-byte.
Properties
SamplerName
The HLSL name of the SamplerState (the sampler half).
public string SamplerName { get; init; }
Property Value
TextureDeclarationIndex
The 0-based rank of this pair's texture among the stage's sampled images, in module
order — the order OpVariable appears in the SPIR-V, which is HLSL declaration
order. This is the GL texture unit the pair binds to, because fxc (and therefore mgfxc)
allocates OpenGL sampler slots in declaration order, NOT in the first-use order SPIRV-Cross
numbers its combined samplers by (GitHub issue #189).
Deliberately NOT ranked by the Binding decoration. The two coincide whenever DXC
auto-allocates, but diverge as soon as the source carries explicit registers — and there
declaration order is the one that matches mgfxc: for
Texture2D TexA : register(t3); Texture2D TexB : register(t2); mgfxc's OpenGL build puts
TexA (declared first) on slot 0, where a binding-ordered rank would put TexB. Deriving it from
the SPIR-V rather than from reflection keeps it host-independent, so the desktop and WASM
hosts still agree byte-for-byte.
public int TextureDeclarationIndex { get; init; }
Property Value
TextureName
The HLSL name of the sampled texture (the image half of the pair).
public string TextureName { get; init; }