Skip to content

"Signatures between stages are incompatible" when compiling with shadercross vs dxc #169

Description

@paulpage

Hello, I'm running into an issue where hlsl shaders compiled to DXIL with shadercross will cause pipeline creation to fail, but compiled directly with dxc (no SPIR-V intermediate) will work fine. It only happens when I have unused input parameters in my fragment shader. Based on that, and taking a cursory glance at the binary text of the compiled shaders, my guess is that those unused parameters are getting stripped. I ran across issue #127 which sounds like the same problem, but this is also happening with the latest nightly build.

Here's the error:

D3D12 ERROR: ID3D12Device::CreateGraphicsPipelineState: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'TEXCOORD' is defined for mismatched hardware registers between the output stage and input stage. [ STATE_CREATION ERROR #660: CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERINDEX]
ERROR: Could not create graphics pipeline state! Error Code: The parameter is incorrect. (0x80070057)
Error: pipeline is null

I've put a complete code example in this gist, I tried to make it as minimal as possible: https://gist.github.com/paulpage/5dc77cd868eb789eeed63ac5c05e718c

To summarize what's in the gist, here's the fragment shader:

struct Input {
    float4 rect : TEXCOORD0;
    float4 color : TEXCOORD1;
    float4 position : SV_Position;
};

cbuffer UniformBlock : register(b0, space3) {
    float2 screen_size : packoffset(c0);
};

float4 main(Input input) : SV_Target0 {

    // This works with shadercross and dxc:
    // float4 color = input.color;
    // color.r += (input.rect.x * input.rect.y * input.rect.z * input.rect.w * input.position.x * input.position.y * input.position.z * input.position.w * 0.000001);
    // return color;

    // This does not work with shadercross:
    return input.color;
}

And the compilation commands:

shadercross.exe shader.frag.hlsl -o shader.frag.dxil
dxc -T ps_6_0 shader.frag.hlsl -Fo shader.frag.dxil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions