-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[HLSL] Add HLSLResourceBindingAttr to default constant buffer numeric declarations ($Globals) #128981
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
Merged
[HLSL] Add HLSLResourceBindingAttr to default constant buffer numeric declarations ($Globals) #128981
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,56 @@ | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -ast-dump -o - %s | FileCheck %s | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -ast-dump -o - %s | FileCheck %s | ||
|
||
// CHECK:HLSLBufferDecl 0x[[CB:[0-9a-f]+]] {{.*}} line:8:9 cbuffer CB | ||
// CHECK-NEXT:HLSLResourceClassAttr 0x[[CB:[0-9a-f]+]] {{.*}} Implicit CBuffer | ||
// CHECK-NEXT:HLSLResourceAttr 0x[[CB:[0-9a-f]+]] {{.*}} Implicit CBuffer | ||
// CHECK-NEXT:HLSLResourceBindingAttr 0x{{[0-9a-f]+}} <col:14> "b3" "space2" | ||
// CHECK-NEXT:VarDecl 0x[[A:[0-9a-f]+]] {{.*}} col:9 used a 'hlsl_constant float' | ||
// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 5]]:9 cbuffer CB | ||
// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer | ||
// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit CBuffer | ||
// CHECK-NEXT: HLSLResourceBindingAttr {{.*}} "b3" "space2" | ||
// CHECK-NEXT: VarDecl {{.*}} used a 'hlsl_constant float' | ||
cbuffer CB : register(b3, space2) { | ||
float a; | ||
} | ||
|
||
// CHECK:HLSLBufferDecl 0x[[TB:[0-9a-f]+]] {{.*}} line:17:9 tbuffer TB | ||
// CHECK-NEXT:HLSLResourceClassAttr 0x[[CB:[0-9a-f]+]] {{.*}} Implicit SRV | ||
// CHECK-NEXT:HLSLResourceAttr 0x[[CB:[0-9a-f]+]] {{.*}} Implicit TBuffer | ||
// CHECK-NEXT:HLSLResourceBindingAttr 0x{{[0-9a-f]+}} <col:14> "t2" "space1" | ||
// CHECK-NEXT:VarDecl 0x[[B:[0-9a-f]+]] {{.*}} col:9 used b 'hlsl_constant float' | ||
// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 5]]:9 tbuffer TB | ||
// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit SRV | ||
// CHECK-NEXT: HLSLResourceAttr {{.*}} Implicit TBuffer | ||
// CHECK-NEXT: HLSLResourceBindingAttr {{.*}} "t2" "space1" | ||
// CHECK-NEXT: VarDecl {{.*}} used b 'hlsl_constant float' | ||
tbuffer TB : register(t2, space1) { | ||
float b; | ||
} | ||
|
||
float foo() { | ||
// CHECK: BinaryOperator 0x{{[0-9a-f]+}} <col:10, col:14> 'float' '+' | ||
// CHECK-NEXT: ImplicitCastExpr 0x{{[0-9a-f]+}} <col:10> 'float' <LValueToRValue> | ||
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <col:10> 'hlsl_constant float' lvalue Var 0x[[A]] 'a' 'hlsl_constant float' | ||
// CHECK-NEXT: ImplicitCastExpr 0x{{[0-9a-f]+}} <col:14> 'float' <LValueToRValue> | ||
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <col:14> 'hlsl_constant float' lvalue Var 0x[[B]] 'b' 'hlsl_constant float' | ||
export float foo() { | ||
hekota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return a + b; | ||
} | ||
|
||
// CHECK: VarDecl 0x{{[0-9a-f]+}} <{{.*}}> col:17 UAV 'RWBuffer<float>':'hlsl::RWBuffer<float>' callinit | ||
// CHECK-NEXT:-CXXConstructExpr 0x{{[0-9a-f]+}} <col:17> 'RWBuffer<float>':'hlsl::RWBuffer<float>' 'void ()' | ||
// CHECK-NEXT:-HLSLResourceBindingAttr 0x{{[0-9a-f]+}} <col:23> "u3" "space0" | ||
// CHECK: VarDecl {{.*}} UAV 'RWBuffer<float>':'hlsl::RWBuffer<float>' | ||
// CHECK: HLSLResourceBindingAttr {{.*}} "u3" "space0" | ||
RWBuffer<float> UAV : register(u3); | ||
|
||
// CHECK: -VarDecl 0x{{[0-9a-f]+}} <{{.*}}> col:17 UAV1 'RWBuffer<float>':'hlsl::RWBuffer<float>' callinit | ||
// CHECK-NEXT:-CXXConstructExpr 0x{{[0-9a-f]+}} <col:17> 'RWBuffer<float>':'hlsl::RWBuffer<float>' 'void ()' | ||
// CHECK-NEXT:-HLSLResourceBindingAttr 0x{{[0-9a-f]+}} <col:24> "u2" "space0" | ||
// CHECK-NEXT:-VarDecl 0x{{[0-9a-f]+}} <col:1, col:38> col:38 UAV2 'RWBuffer<float>':'hlsl::RWBuffer<float>' callinit | ||
// CHECK-NEXT:-CXXConstructExpr 0x{{[0-9a-f]+}} <col:38> 'RWBuffer<float>':'hlsl::RWBuffer<float>' 'void ()' | ||
// CHECK-NEXT:-HLSLResourceBindingAttr 0x{{[0-9a-f]+}} <col:45> "u4" "space0" | ||
// CHECK: VarDecl {{.*}} UAV1 'RWBuffer<float>':'hlsl::RWBuffer<float>' | ||
// CHECK: HLSLResourceBindingAttr {{.*}} "u2" "space0" | ||
// CHECK: VarDecl {{.*}} UAV2 'RWBuffer<float>':'hlsl::RWBuffer<float>' | ||
hekota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// CHECK: HLSLResourceBindingAttr {{.*}} "u4" "space0" | ||
RWBuffer<float> UAV1 : register(u2), UAV2 : register(u4); | ||
|
||
// | ||
// Default constants ($Globals) layout annotations | ||
|
||
// CHECK: VarDecl {{.*}} f 'hlsl_constant float' | ||
// CHECK: HLSLResourceBindingAttr {{.*}} "c5" "space0" | ||
float f : register(c5); | ||
|
||
// CHECK: VarDecl {{.*}} intv 'hlsl_constant int4':'vector<int hlsl_constant, 4>' | ||
// CHECK: HLSLResourceBindingAttr {{.*}} "c2" "space0" | ||
int4 intv : register(c2); | ||
|
||
// CHECK: VarDecl {{.*}} dar 'hlsl_constant double[5]' | ||
// CHECK: HLSLResourceBindingAttr {{.*}} "c3" "space0" | ||
double dar[5] : register(c3); | ||
|
||
struct S { | ||
int a; | ||
}; | ||
|
||
// CHECK: VarDecl {{.*}} s 'hlsl_constant S' | ||
// CHECK: HLSLResourceBindingAttr {{.*}} "c10" "space0 | ||
S s : register(c10); | ||
hekota marked this conversation as resolved.
Show resolved
Hide resolved
|
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.