Gemoetry

Type

[maxvertexcount(NumVerts)]
void ShaderName ( PrimitiveType DataType Name [ NumElements ], inout StreamOutputObject )
{
}
PrimitiveTypeNum
point1Point list
line2Line list or line strip
triangle3Triangle list or triangle strip
lineadj4Line list with adjacency or line strip with adjacency
triangleadj6Triangle list with adjacency or triangle strip with adjacency
StreamOutputObject
PointStream<T>A sequence of point primitives
LineStream<T>A sequence of line primitives
TriangleStream<T>A sequence of triangle primitives

Barebone

#pragma vertex vert
#pragma fragment frag
#pragma geometry geom

struct FromVS
{
    float4 positionOS : POSITION
}

struct VStoGS
{
    float4 positionOS : SV_POSITION
}

struct GStoFS
{
    float4 positionCS : SV_POSITION
}

VStoGS vert(FromVS IN)
{
}


[maxvertexcount(3)] // 최대 얼마나 많이 vertex를 추가할 것인가.
void geom(triangle float4 IN[3] : SV_POSITION, uint pid : SV_PrimitiveID, inout TriangleStream<GStoFS> STREAM)
void geom(triangle VStoGS IN[3], uint pid : SV_PrimitiveID, inout TriangleStream<GStoFS> STREAM)
{
    GStoFS OUT1;
    GStoFS OUT2;
    GStoFS OUT3;

    STREAM.Append(OUT1);
    STREAM.Append(OUT2);
    STREAM.Append(OUT3);

    // https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-so-restartstrip
    // Ends the current primitive strip and starts a new strip
    STREAM.RestartStrip();
}

half4 frag(GStoFS IN) : SV_Target
{
}

Etc