|
1 | | -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -ast-dump -o - %s | FileCheck %s |
| 1 | +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -ast-dump -o - %s | FileCheck %s -check-prefixes=CHECK,DXIL |
| 2 | +// RUN: %clang_cc1 -triple spirv-unknown-vulkan-library -finclude-default-header -ast-dump -o - %s | FileCheck %s -check-prefixes=CHECK,SPV |
2 | 3 |
|
3 | 4 | // CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 4]]:9 cbuffer CB |
4 | 5 | // CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer |
@@ -64,15 +65,40 @@ S s : register(c10); |
64 | 65 | // |
65 | 66 | // Implicit binding |
66 | 67 |
|
67 | | -// Constant buffers should have implicit binding attribute added by SemaHLSL |
| 68 | +// Constant buffers should have implicit binding attribute added by SemaHLSL, |
| 69 | +// unless the target is SPIR-V and there is [[vk::binding]] attribute. |
68 | 70 | // CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB2 |
69 | 71 | // CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer |
70 | 72 | // CHECK-NEXT: HLSLResourceBindingAttr {{.*}} Implicit "" "0" |
71 | 73 | cbuffer CB2 { |
72 | 74 | float4 c; |
73 | 75 | } |
74 | 76 |
|
75 | | -// Resource arrays should have implicit binding attribute added by SemaHLSL |
| 77 | +// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 7]]:9 cbuffer CB3 |
| 78 | +// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer |
| 79 | +// DXIL: HLSLResourceBindingAttr {{.*}} Implicit |
| 80 | +// DXIL-NOT: HLSLVkBindingAttr |
| 81 | +// SPV: HLSLVkBindingAttr {{.*}} 1 0 |
| 82 | +// SPV-NOT: HLSLResourceBindingAttr {{.*}} Implicit |
| 83 | +[[vk::binding(1)]] |
| 84 | +cbuffer CB3 { |
| 85 | + float2 d; |
| 86 | +} |
| 87 | + |
| 88 | +// Resource arrays should have implicit binding attribute added by SemaHLSL, |
| 89 | +// unless the target is SPIR-V and there is [[vk::binding]] attribute. |
76 | 90 | // CHECK: VarDecl {{.*}} SB 'StructuredBuffer<float>[10]' |
77 | 91 | // CHECK: HLSLResourceBindingAttr {{.*}} Implicit "" "0" |
78 | 92 | StructuredBuffer<float> SB[10]; |
| 93 | + |
| 94 | +// CHECK: VarDecl {{.*}} SB2 'StructuredBuffer<float>[10]' |
| 95 | +// DXIL: HLSLResourceBindingAttr {{.*}} Implicit |
| 96 | +// DXIL-NOT: HLSLVkBindingAttr |
| 97 | +// SPV: HLSLVkBindingAttr {{.*}} 2 0 |
| 98 | +// SPV-NOT: HLSLResourceBindingAttr {{.*}} Implicit |
| 99 | +[[vk::binding(2)]] |
| 100 | +StructuredBuffer<float> SB2[10]; |
| 101 | + |
| 102 | +// $Globals should have implicit binding attribute added by SemaHLSL |
| 103 | +// CHECK: HLSLBufferDecl {{.*}} implicit cbuffer $Globals |
| 104 | +// CHECK: HLSLResourceBindingAttr {{.*}} Implicit "" "0" |
0 commit comments