Skip to content

lib_ target: SV_PrimitiveID is disallowed during GSVIn #7625

@Nielsbishere

Description

@Nielsbishere

Description
SV_PrimitiveID can't be used as input in a geometry shader when compiled with lib_ and then linked to gs_.

Steps to Reproduce

//dxc -T lib_6_3 -> IDxcLinker gs_6_3
// Per-vertex data from the vertex shader.
struct GeometryShaderInput
{
    min16float4 pos     : SV_POSITION;
    min16float3 color   : COLOR0;
    uint        instId  : TEXCOORD0;
};

// Per-vertex data passed to the rasterizer.
struct GeometryShaderOutput
{
    min16float4 pos     : SV_POSITION;
    min16float3 color   : COLOR0;
    uint        rtvId   : SV_RenderTargetArrayIndex;
};

// This geometry shader is a pass-through that leaves the geometry unmodified 
// and sets the render target array index.
[maxvertexcount(3)]
[shader("geometry")]
void GS(triangle GeometryShaderInput input[3], uint j : SV_PrimitiveID, inout TriangleStream<GeometryShaderOutput> outStream)
{
    GeometryShaderOutput output;
    [unroll(3)]
    for (int i = 0; i < 3; ++i)
    {
        output.pos   = input[i].pos;
        output.color = input[i].color;
        output.rtvId = input[i].instId & j;
        outStream.Append(output);
    }
}

The error actually comes from the linker itself, not the lib compilation.

Actual Behavior
Same behavior as when compiled with gs_ (no error and similar binary after linking).

Environment

  • DXC version: Latest
  • Host Operating System: N/A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashshader-linkingBugs related to library targets and linking

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions