HLSL allows a range of types for clip and cull distances. There are three dimensions, including arrayness, vectorness, and semantic ID. SPIR-V requires clip and cull distance be a single array of floats in all cases. This code provides input side conversion between the SPIR-V form and the HLSL form. (Output conversion was added in PR #947 and #997). This PR extends HlslParseContext::assignClipCullDistance to cope with the input side conversion. Not as much changed as appears: there was also a lot of renaming to reflect the fact that the code now handles either direction. Currently, non-{frag,vert} stages are not handled, and are explicitly rejected. Fixes #1026.
20 lines
450 B
GLSL
20 lines
450 B
GLSL
struct S {
|
|
float4 pos : SV_Position;
|
|
float2 clip[2] : SV_ClipDistance0;
|
|
};
|
|
|
|
[maxvertexcount(3)]
|
|
void main(triangle in float4 pos[3] : SV_Position,
|
|
triangle in uint VertexID[3] : VertexID,
|
|
inout LineStream<S> OutputStream,
|
|
triangle in float2 clip[3][2] : SV_ClipDistance) // scalar float
|
|
{
|
|
S s;
|
|
|
|
s.pos = pos[0];
|
|
s.clip[0] = clip[0][0];
|
|
s.clip[1] = clip[0][1];
|
|
|
|
OutputStream.Append(s);
|
|
}
|