HLSL: add geometry stage support for clip/cull distance
Changes:
(1) Allow clip/cull builtins as both input and output in the same shader stage. Previously,
not enough data was tracked to handle this.
(2) Handle the extra array dimension in GS inputs. The synthesized external variable can
now be created with the extra array dimension if needed, and the form conversion code is
able to handle it as well.
For example, both of these GS inputs would result in the same synthesized external type:
triangle in float4 clip[3] : SV_ClipDistance
triangle in float2 clip[3][2] : SV_ClipDistance
In the second case, the inner array dimension packs with the 2-vector of floats into an array[4],
which there is an array[3] of due to the triangle geometry.
This commit is contained in:
@@ -435,12 +435,16 @@ protected:
|
||||
|
||||
TVariable* gsStreamOutput; // geometry shader stream outputs, for emit (Append method)
|
||||
|
||||
TVariable* clipDistanceVariable; // synthesized clip distance variable (shader might have >1)
|
||||
TVariable* cullDistanceVariable; // synthesized cull distance variable (shader might have >1)
|
||||
TVariable* clipDistanceOutput; // synthesized clip distance out variable (shader might have >1)
|
||||
TVariable* cullDistanceOutput; // synthesized cull distance out variable (shader might have >1)
|
||||
TVariable* clipDistanceInput; // synthesized clip distance in variable (shader might have >1)
|
||||
TVariable* cullDistanceInput; // synthesized cull distance in variable (shader might have >1)
|
||||
|
||||
static const int maxClipCullRegs = 2;
|
||||
std::array<int, maxClipCullRegs> clipSemanticNSize; // vector, indexed by clip semantic ID
|
||||
std::array<int, maxClipCullRegs> cullSemanticNSize; // vector, indexed by cull semantic ID
|
||||
std::array<int, maxClipCullRegs> clipSemanticNSizeIn; // vector, indexed by clip semantic ID
|
||||
std::array<int, maxClipCullRegs> cullSemanticNSizeIn; // vector, indexed by cull semantic ID
|
||||
std::array<int, maxClipCullRegs> clipSemanticNSizeOut; // vector, indexed by clip semantic ID
|
||||
std::array<int, maxClipCullRegs> cullSemanticNSizeOut; // vector, indexed by cull semantic ID
|
||||
|
||||
// This tracks the first (mip level) argument to the .mips[][] operator. Since this can be nested as
|
||||
// in tx.mips[tx.mips[0][1].x][2], we need a stack. We also track the TSourceLoc for error reporting
|
||||
|
||||
Reference in New Issue
Block a user