|
| 1 | +// Establish a baseline without define specified |
| 2 | +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ |
| 3 | +// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,NO-OVERRIDE |
| 4 | + |
| 5 | +// Check that we can set the entry function even if it doesn't have an attr |
| 6 | +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ |
| 7 | +// RUN: -hlsl-entry none_main -fdx-rootsignature-define=SampleCBV \ |
| 8 | +// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,SET |
| 9 | + |
| 10 | +// Check that we can set the entry function overriding an attr |
| 11 | +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ |
| 12 | +// RUN: -hlsl-entry uav_main -fdx-rootsignature-define=SampleCBV \ |
| 13 | +// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,OVERRIDE |
| 14 | + |
| 15 | +// Check that we can override with a command line root signature |
| 16 | +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ |
| 17 | +// RUN: -hlsl-entry cbv_main -fdx-rootsignature-define=CmdRS -DCmdRS='"SRV(t0)"' \ |
| 18 | +// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CMD |
| 19 | + |
| 20 | +#define SampleCBV "CBV(b0)" |
| 21 | +#define SampleUAV "UAV(u0)" |
| 22 | + |
| 23 | +// CMD: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[CMD_DECL:__hlsl_rootsig_decl_\d*]] |
| 24 | +// CMD-SAME: version: 1.1, RootElements{ |
| 25 | +// CMD-SAME: RootSRV(t0, |
| 26 | +// CMD-SAME: space = 0, visibility = All, flags = DataStaticWhileSetAtExecute |
| 27 | +// CMD-SAME: )} |
| 28 | + |
| 29 | +// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[CBV_DECL:__hlsl_rootsig_decl_\d*]] |
| 30 | +// CHECK-SAME: version: 1.1, RootElements{ |
| 31 | +// CHECK-SAME: RootCBV(b0, |
| 32 | +// CHECK-SAME: space = 0, visibility = All, flags = DataStaticWhileSetAtExecute |
| 33 | +// CHECK-SAME: )} |
| 34 | + |
| 35 | +// CHECK-LABEL: -FunctionDecl 0x{{.*}} {{.*}} cbv_main |
| 36 | +// NO-OVERRIDE: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] |
| 37 | +// SET: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] |
| 38 | +// CMD: -RootSignatureAttr 0x{{.*}} {{.*}} [[CMD_DECL]] |
| 39 | + |
| 40 | +[RootSignature(SampleCBV)] |
| 41 | +void cbv_main() {} |
| 42 | + |
| 43 | +// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[UAV_DECL:__hlsl_rootsig_decl_\d*]] |
| 44 | +// CHECK-SAME: version: 1.1, RootElements{ |
| 45 | +// CHECK-SAME: RootUAV(u0, |
| 46 | +// CHECK-SAME: space = 0, visibility = All, flags = DataVolatile |
| 47 | +// CHECK-SAME: )} |
| 48 | + |
| 49 | +// CHECK-LABEL: -FunctionDecl 0x{{.*}} {{.*}} uav_main |
| 50 | +// NO-OVERRIDE: -RootSignatureAttr 0x{{.*}} {{.*}} [[UAV_DECL]] |
| 51 | +// SET: -RootSignatureAttr 0x{{.*}} {{.*}} [[UAV_DECL]] |
| 52 | +// OVERRIDE: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] |
| 53 | + |
| 54 | +[RootSignature(SampleUAV)] |
| 55 | +void uav_main() {} |
| 56 | + |
| 57 | +// CHECK-LABEL: -FunctionDecl 0x{{.*}} {{.*}} none_main |
| 58 | +// NO-OVERRIDE-NONE: -RootSignatureAttr |
| 59 | +// SET: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] |
| 60 | +// OVERRIDE-NONE: -RootSignatureAttr |
| 61 | + |
| 62 | +void none_main() {} |
0 commit comments