-
Notifications
You must be signed in to change notification settings - Fork 718
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIR-V] Block semantic annotation reuse for input (#6396)
The MSDN spec is not very clear regarding input parameter aliasing, BUT DXIL & MS agrees (See #3737) using the same semantic annotation twice should be disallowed. DXIL currently disallows it for most, and due to a bug, allows some compute related semantics to be aliased. SPIR-V did allowed aliasing, but it was a implemented as a hack causing typing issues if the type changed between the 2 parameters using the same semantic annotation. To align more closely with DXIL, and the "spec", we are now disallowing all semantic attribute reuse for input parameters. Fixes #3737 Signed-off-by: Nathan Gauër <[email protected]>
- Loading branch information
Showing
3 changed files
with
9 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
13 changes: 2 additions & 11 deletions
13
tools/clang/test/CodeGenSPIRV/spirv.interface.alias-builtin.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s | ||
|
||
// CHECK: OpEntryPoint Fragment %main "main" %gl_FragCoord %out_var_SV_Target | ||
|
||
// CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input | ||
// CHECK-NOT: {{%[0-9]+}} = OpVariable %_ptr_Input_v4float Input | ||
// RUN: not %dxc -T ps_6_0 -E main %s -spirv 2>&1 | FileCheck %s | ||
|
||
struct PSInput { | ||
float4 a : SV_Position; | ||
float4 b : SV_Position; | ||
// CHECK: :5:14: error: input semantic 'SV_Position' used more than once | ||
}; | ||
|
||
// CHECK: [[a:%[0-9]+]] = OpLoad %v4float %gl_FragCoord | ||
// CHECK-NEXT: [[b:%[0-9]+]] = OpLoad %v4float %gl_FragCoord | ||
// CHECK-NEXT: {{%[0-9]+}} = OpCompositeConstruct %PSInput [[a]] [[b]] | ||
|
||
float4 main(PSInput input) : SV_Target | ||
{ | ||
return input.a + input.b; | ||
} | ||
|