File tree Expand file tree Collapse file tree 3 files changed +34
-8
lines changed
test/CodeGenSPIRV/inline-spirv Expand file tree Collapse file tree 3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,10 @@ bool shouldSkipInStructLayout(const Decl *decl) {
330330 return true ;
331331 }
332332
333+ if (decl->hasAttr <VKStorageClassExtAttr>()) {
334+ return true ;
335+ }
336+
333337 // External visibility
334338 if (const auto *declDecl = dyn_cast<DeclaratorDecl>(decl))
335339 if (!declDecl->hasExternalFormalLinkage ())
@@ -1183,14 +1187,15 @@ SpirvVariable *DeclResultIdMapper::createExternVar(const VarDecl *var) {
11831187SpirvVariable *DeclResultIdMapper::createExternVar (const VarDecl *var,
11841188 QualType type) {
11851189 const bool isGroupShared = var->hasAttr <HLSLGroupSharedAttr>();
1190+ const bool hasInlineSpirvSC = var->hasAttr <VKStorageClassExtAttr>();
11861191 const bool isACSBuffer =
11871192 isAppendStructuredBuffer (type) || isConsumeStructuredBuffer (type);
11881193 const bool isRWSBuffer = isRWStructuredBuffer (type);
11891194 const auto storageClass = getStorageClassForExternVar (type, isGroupShared);
11901195 const auto rule = getLayoutRuleForExternVar (type, spirvOptions);
11911196 const auto loc = var->getLocation ();
11921197
1193- if (!isGroupShared && !isResourceType (type) &&
1198+ if (!isGroupShared && !isResourceType (type) && !hasInlineSpirvSC &&
11941199 !isResourceOnlyStructure (type)) {
11951200
11961201 // We currently cannot support global structures that contain both resources
Original file line number Diff line number Diff line change 11// RUN: %dxc -T ps_6_0 -E main -spirv -Vd -fcgl %s -spirv | FileCheck %s
22
3- //CHECK: [[payloadTy:%[a-zA-Z0-9_]+]] = OpTypeStruct %v4float
4- //CHECK-NEXT: [[payloadTyPtr:%[a-zA-Z0-9_]+]] = OpTypePointer RayPayloadKHR [[payloadTy]]
5- //CHECK: [[crossTy:%[a-zA-Z0-9_]+]] = OpTypePointer CrossWorkgroup %int
6- //CHECK: {{%[a-zA-Z0-9_]+}} = OpVariable [[payloadTyPtr]] RayPayloadKHR
7- //CHECK: {{%[a-zA-Z0-9_]+}} = OpVariable [[crossTy]] CrossWorkgroup
8-
3+ [[vk::ext_extension ("SPV_KHR_ray_tracing" )]]
4+ [[vk::ext_capability (/* RayTracingKHR */ 4479 )]]
95[[vk::ext_storage_class (/*RayPayloadKHR*/ 5338 )]]
106float4 payload;
7+ // CHECK-DAG: [[ptr_payload_v4:%[a-zA-Z0-9_]+]] = OpTypePointer RayPayloadKHR %v4float
8+ // CHECK-DAG: %payload = OpVariable [[ptr_payload_v4]] RayPayloadKHR
119
1210int main () : SV_Target0 {
13- [[vk::ext_storage_class (/* CrossWorkgroup */ 5 )]] int foo = 3 ;
11+
12+ [[vk::ext_storage_class (/* CrossWorkgroup */ 5 )]]
13+ int foo = 3 ;
14+ // CHECK-DAG: [[ptr_cw_int:%[a-zA-Z0-9_]+]] = OpTypePointer CrossWorkgroup %int
15+ // CHECK-DAG: %foo = OpVariable [[ptr_cw_int]] CrossWorkgroup
16+
1417 return foo;
1518}
Original file line number Diff line number Diff line change 1+ // RUN: %dxc %s -T cs_6_8 -spirv -fspv-target-env=vulkan1.3 -E main -O0 | FileCheck %s
2+
3+ // CHECK-DAG: OpCapability RuntimeDescriptorArray
4+ // CHECK-DAG: OpCapability RayQueryKHR
5+
6+ using A = vk::SpirvOpaqueType</* OpTypeAccelerationStructureKHR */ 5341 >;
7+ // CHECK: %[[name:[^ ]+]] = OpTypeAccelerationStructureKHR
8+
9+ using RA [[vk::ext_capability (/* RuntimeDescriptorArray */ 5302 )]] = vk::SpirvOpaqueType</* OpTypeRuntimeArray */ 29 , A>;
10+ // CHECK: %[[rarr:[^ ]+]] = OpTypeRuntimeArray %[[name]]
11+
12+ // CHECK: %[[ptr:[^ ]+]] = OpTypePointer UniformConstant %[[rarr]]
13+ // CHECK: %MyScene = OpVariable %[[ptr]] UniformConstant
14+ [[vk::ext_storage_class (0 )]]
15+ RA MyScene;
16+
17+ [numthreads (1 , 1 , 1 )]
18+ void main () {}
You can’t perform that action at this time.
0 commit comments