Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPIR-V] Using SV_Target and SV_Target0 in the same PS fails validation instead of printing an error #3178

Closed
Dredhog opened this issue Oct 2, 2020 · 0 comments · Fixed by #3881
Labels
spirv Work related to SPIR-V

Comments

@Dredhog
Copy link

Dredhog commented Oct 2, 2020

Title

Using SV_Target and SV_Target0 in the same PS fails validation instead of printing an error

Minimal repro steps

  1. Compile the following pixel shader with dxc.exe -T ps_6_0 -E PSMain -spirv repro_shader.hlsl
struct PSInput
{
	float4 color : COLOR;
};

void PSMain(PSInput input,
            out float4 out_ : SV_Target,
            out float4 out_0 : SV_Target0,
            out float4 out_1 : SV_Target1)
{
    out_ = input.color;
    out_0 = input.color;
    out_1 = input.color;
}

Expected result

An error is printed e.g. like the one with the DXIL backend: "Function: PSMain: error: Parameter with semantic SV_Target has overlapping semantic index at 0. Use /Zi for source location." or similar.

Actual result

a validation error is printed, which asks to report a bug:

fatal error: generated SPIR-V is invalid: Entry-point has conflicting output location assignment at location 0, component 0
    OpEntryPoint Fragment %PSMain "PSMain" %in_var_COLOR %out_var_SV_Target %out_var_SV_Target0 %out_var_SV_Target1

note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible
@ehsannas ehsannas added the spirv Work related to SPIR-V label Oct 7, 2020
jaebaek added a commit to jaebaek/DirectXShaderCompiler that referenced this issue Jul 15, 2021
```
void main(PSInput input,
        out float4 x : SV_Target,
        out float4 y : SV_Target0,
        out float4 z : SV_Target1)
```

x and y are both output stage variables with the same location.
This commit reports the duplication.

Fixes microsoft#3178
jaebaek added a commit that referenced this issue Jul 20, 2021
```
void main(PSInput input,
        out float4 x : SV_Target,
        out float4 y : SV_Target0,
        out float4 z : SV_Target1)
```

x and y are both output stage variables with the same location.
This commit reports the duplication.

Fixes #3178
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spirv Work related to SPIR-V
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants