-
Notifications
You must be signed in to change notification settings - Fork 808
[SPIR-V][Sema] Requires nointerpolation on GetAttributeAtVertex param #0 #6453
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
Merged
Keenuts
merged 6 commits into
microsoft:main
from
Keenuts:getattribute-nointerpolation-sema
Apr 3, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
76ddab0
[Sema] Requires nointerpolation on GetAttributeAtVertex param #0
Keenuts 2ecef32
change check to assert
Keenuts f6eab5b
clang-format
Keenuts 12320b1
add REQUIRES: spirv
Keenuts d1e96f3
spelling mistake + %dxc instead of dxc
Keenuts 5cc88f1
PR feedback
Keenuts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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
2 changes: 1 addition & 1 deletion
2
tools/clang/test/CodeGenSPIRV/intrinsics.get-attribute-at-vertex.cbuf.var.hlsl
This file contains hidden or 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 contains hidden or 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
11 changes: 6 additions & 5 deletions
11
tools/clang/test/CodeGenSPIRV/intrinsics.get-attribute-at-vertex.s.funcParam.neg.hlsl
This file contains hidden or 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,16 +1,17 @@ | ||
| // RUN: not %dxc -T ps_6_1 -E main %s -spirv 2>&1 | FileCheck %s | ||
| // RUN: %dxc -T ps_6_1 -E main %s -spirv -verify | ||
|
|
||
| struct S { | ||
| float4 a : COLOR; | ||
| }; | ||
|
|
||
| float compute(float4 a) { | ||
| float compute(nointerpolation float4 a) { | ||
| return GetAttributeAtVertex(a, 2)[0]; | ||
| } | ||
|
|
||
| float4 main(nointerpolation S s, float4 b : COLOR2) : SV_TARGET | ||
| { | ||
| return float4(0, 0, compute(b), compute(s.a)); | ||
| return float4(0, | ||
| compute(b), // expected-error{{parameter 0 of compute must have a 'nointerpolation' attribute}} | ||
| compute(b), // expected-error{{parameter 0 of compute must have a 'nointerpolation' attribute}} | ||
| compute(s.a)); | ||
| } | ||
|
|
||
| // CHECK: error: Function 'compute' could only use noninterpolated variable as input. |
46 changes: 46 additions & 0 deletions
46
tools/clang/test/SemaHLSL/getattribute-at-vertex.legal.hlsl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // RUN: %dxc -T ps_6_2 -E main %s -verify | ||
|
|
||
| // expected-no-diagnostics | ||
| struct S1 { | ||
| nointerpolation float3 f1; | ||
| }; | ||
|
|
||
| struct S2 { | ||
| float3 f1; | ||
| }; | ||
|
|
||
| struct S3 { | ||
| float3 f1[3]; | ||
| }; | ||
|
|
||
| struct S4 { | ||
| S1 f1; | ||
| }; | ||
|
|
||
| struct S5 { | ||
| S1 f1[2]; | ||
| }; | ||
|
|
||
| float compute(float3 value) { | ||
| return GetAttributeAtVertex(value, 0)[0]; | ||
| } | ||
|
|
||
| float4 main(nointerpolation float3 a : A, | ||
| S1 s1 : B, | ||
| nointerpolation S2 s2 : C, | ||
| nointerpolation S3 s3 : D, | ||
| S4 s4 : E, | ||
| S5 s5 : F | ||
| ) : SV_Target | ||
| { | ||
| float v1 = GetAttributeAtVertex(a, 0)[0]; | ||
| float v2 = GetAttributeAtVertex(a.x, 0); | ||
| float v3 = GetAttributeAtVertex(s1.f1, 0)[0]; | ||
| float v4 = GetAttributeAtVertex(s2.f1, 0)[0]; | ||
| float v5 = GetAttributeAtVertex(s3.f1[1], 0)[0]; | ||
| float v6 = GetAttributeAtVertex(s4.f1.f1, 0)[0]; | ||
| float v7 = GetAttributeAtVertex(s5.f1[1].f1, 0)[0]; | ||
| float v8 = compute(s1.f1); | ||
|
|
||
| return float4(v1, v2, v3, v4) + float4(v5, v6, v7, v8); | ||
| } | ||
16 changes: 16 additions & 0 deletions
16
tools/clang/test/SemaHLSL/getattribute-at-vertex.legal.nointerpolation.call.hlsl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // RUN: %dxc -T ps_6_2 -E main %s -verify | ||
|
|
||
| // expected-no-diagnostics | ||
| float compute(nointerpolation float3 value) { | ||
| return GetAttributeAtVertex(value, 0)[0]; | ||
| } | ||
|
|
||
| float middle(nointerpolation float3 value) { | ||
| return compute(value); | ||
| } | ||
|
|
||
| float4 main(nointerpolation float3 a : A) : SV_Target | ||
| { | ||
| float v1 = middle(a); | ||
| return float4(v1.xxxx); | ||
| } |
12 changes: 12 additions & 0 deletions
12
tools/clang/test/SemaHLSL/getattribute-at-vertex.missing.nointerpolation.call.dxil.hlsl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // RUN: not %dxc -T ps_6_2 -E main %s 2>&1 | FileCheck %s | ||
|
|
||
| float compute(nointerpolation float3 value) { | ||
| return GetAttributeAtVertex(value, 0)[0]; | ||
| } | ||
|
|
||
| float4 main(float3 a : A) : SV_Target | ||
| { | ||
| // CHECK: error: Attribute A must have nointerpolation mode in order to use GetAttributeAtVertex function. | ||
| float v1 = compute(a); | ||
| return float4(v1.xxxx); | ||
| } |
12 changes: 12 additions & 0 deletions
12
tools/clang/test/SemaHLSL/getattribute-at-vertex.missing.nointerpolation.call.hlsl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // REQUIRES: spirv | ||
| // RUN: %dxc -T ps_6_2 -E main %s -spirv -verify | ||
|
|
||
| float compute(nointerpolation float3 value) { | ||
| return GetAttributeAtVertex(value, 0)[0]; | ||
| } | ||
|
|
||
| float4 main(float3 a : A) : SV_Target | ||
| { | ||
| float v1 = compute(a); /* expected-error{{parameter 0 of compute must have a 'nointerpolation' attribute}} */ | ||
| return float4(v1.xxxx); | ||
| } |
19 changes: 19 additions & 0 deletions
19
tools/clang/test/SemaHLSL/getattribute-at-vertex.missing.nointerpolation.dxil.hlsl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // RUN: not %dxc -T ps_6_2 -E main %s 2>&1 | FileCheck %s | ||
|
|
||
| struct S1 { | ||
| float3 f1; | ||
| }; | ||
|
|
||
| float compute(float3 value) { | ||
| return GetAttributeAtVertex(value, 0)[0]; | ||
| } | ||
|
|
||
| float4 main(float3 a : A, S1 s1 : B) : SV_Target | ||
| { | ||
| // CHECK-DAG: error: Attribute A must have nointerpolation mode in order to use GetAttributeAtVertex function. | ||
| // CHECK-DAG: error: Attribute B must have nointerpolation mode in order to use GetAttributeAtVertex function. | ||
| float v1 = GetAttributeAtVertex(a, 0)[0]; | ||
| float v2 = GetAttributeAtVertex(s1.f1, 0)[0]; | ||
| float v3 = compute(a); | ||
| return float4(v1.xx, v2, v3); | ||
| } |
18 changes: 18 additions & 0 deletions
18
tools/clang/test/SemaHLSL/getattribute-at-vertex.missing.nointerpolation.hlsl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // REQUIRES: spirv | ||
| // RUN: %dxc -T ps_6_2 -E main %s -spirv -verify | ||
|
|
||
| struct S1 { | ||
| float3 f1; | ||
| }; | ||
|
|
||
| float compute(float3 value) { | ||
| return GetAttributeAtVertex(value, 0)[0]; /* expected-error{{parameter 0 of GetAttributeAtVertex must have a 'nointerpolation' attribute}} */ | ||
| } | ||
|
|
||
| float4 main(float3 a : A, S1 s1 : B) : SV_Target | ||
| { | ||
| float v1 = GetAttributeAtVertex(a, 0)[0]; /* expected-error{{parameter 0 of GetAttributeAtVertex must have a 'nointerpolation' attribute}} */ | ||
| float v2 = GetAttributeAtVertex(s1.f1, 0)[0]; /* expected-error{{parameter 0 of GetAttributeAtVertex must have a 'nointerpolation' attribute}} */ | ||
| float v3 = compute(a); | ||
| return float4(v1.xx, v2, v3); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.