Skip to content

Commit 969168d

Browse files
authored
merge main into staging-sm6.9 (microsoft#7352)
This merges main into staging-sm6.9. There were no conflicts.
2 parents bf961d9 + a3af055 commit 969168d

12 files changed

Lines changed: 707 additions & 354 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,7 @@ if (LLVM_INCLUDE_DOCS)
762762
add_subdirectory(docs)
763763
endif()
764764

765-
if (LLVM_BUILD_DOCS)
766-
add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change
767-
endif()
765+
add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change
768766

769767
add_subdirectory(cmake/modules)
770768

docs/DXIL.rst

Lines changed: 379 additions & 319 deletions
Large diffs are not rendered by default.

include/dxc/HlslIntrinsicOp.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,34 @@ enum class IntrinsicOp {
336336
MOP_TraceRayInline = 325,
337337
MOP_WorldRayDirection = 326,
338338
MOP_WorldRayOrigin = 327,
339+
MOP_DxHitObject_FromRayQuery = 363,
340+
MOP_DxHitObject_GetAttributes = 364,
341+
MOP_DxHitObject_GetGeometryIndex = 365,
342+
MOP_DxHitObject_GetHitKind = 366,
343+
MOP_DxHitObject_GetInstanceID = 367,
344+
MOP_DxHitObject_GetInstanceIndex = 368,
345+
MOP_DxHitObject_GetObjectRayDirection = 369,
346+
MOP_DxHitObject_GetObjectRayOrigin = 370,
347+
MOP_DxHitObject_GetObjectToWorld3x4 = 371,
348+
MOP_DxHitObject_GetObjectToWorld4x3 = 372,
349+
MOP_DxHitObject_GetPrimitiveIndex = 373,
350+
MOP_DxHitObject_GetRayFlags = 374,
351+
MOP_DxHitObject_GetRayTCurrent = 375,
352+
MOP_DxHitObject_GetRayTMin = 376,
353+
MOP_DxHitObject_GetShaderTableIndex = 377,
354+
MOP_DxHitObject_GetWorldRayDirection = 378,
355+
MOP_DxHitObject_GetWorldRayOrigin = 379,
356+
MOP_DxHitObject_GetWorldToObject3x4 = 380,
357+
MOP_DxHitObject_GetWorldToObject4x3 = 381,
358+
MOP_DxHitObject_Invoke = 382,
359+
MOP_DxHitObject_IsHit = 383,
360+
MOP_DxHitObject_IsMiss = 384,
361+
MOP_DxHitObject_IsNop = 385,
362+
MOP_DxHitObject_LoadLocalRootTableConstant = 386,
363+
MOP_DxHitObject_MakeMiss = 387,
339364
MOP_DxHitObject_MakeNop = 358,
365+
MOP_DxHitObject_SetShaderTableIndex = 388,
366+
MOP_DxHitObject_TraceRay = 389,
340367
IOP_DxMaybeReorderThread = 359,
341368
MOP_Count = 328,
342369
MOP_FinishedCrossGroupSharing = 329,
@@ -369,7 +396,7 @@ enum class IntrinsicOp {
369396
IOP_usign = 355,
370397
MOP_InterlockedUMax = 356,
371398
MOP_InterlockedUMin = 357,
372-
Num_Intrinsics = 363,
399+
Num_Intrinsics = 390,
373400
};
374401
inline bool HasUnsignedIntrinsicOpcode(IntrinsicOp opcode) {
375402
switch (opcode) {

include/dxc/dxcapi.internal.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,13 @@ enum LEGAL_INTRINSIC_COMPTYPES {
131131
LICOMPTYPE_THREAD_NODE_OUTPUT_RECORDS = 50,
132132

133133
LICOMPTYPE_HIT_OBJECT = 51,
134+
LICOMPTYPE_RAY_QUERY = 52,
134135

135136
#ifdef ENABLE_SPIRV_CODEGEN
136-
LICOMPTYPE_VK_BUFFER_POINTER = 52,
137-
LICOMPTYPE_COUNT = 53
137+
LICOMPTYPE_VK_BUFFER_POINTER = 53,
138+
LICOMPTYPE_COUNT = 54
138139
#else
139-
LICOMPTYPE_COUNT = 52
140+
LICOMPTYPE_COUNT = 53
140141
#endif
141142
};
142143

lib/HLSL/HLOperationLower.cpp

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6197,6 +6197,77 @@ Value *TranslateMaybeReorderThread(CallInst *CI, IntrinsicOp IOP,
61976197
bool &Translated) {
61986198
return nullptr; // TODO: Merge SER DXIL patches
61996199
}
6200+
6201+
Value *TranslateHitObjectFromRayQuery(CallInst *CI, IntrinsicOp IOP,
6202+
OP::OpCode OpCode,
6203+
HLOperationLowerHelper &Helper,
6204+
HLObjectOperationLowerHelper *pObjHelper,
6205+
bool &Translated) {
6206+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6207+
}
6208+
6209+
Value *TranslateHitObjectTraceRay(CallInst *CI, IntrinsicOp IOP,
6210+
OP::OpCode OpCode,
6211+
HLOperationLowerHelper &Helper,
6212+
HLObjectOperationLowerHelper *pObjHelper,
6213+
bool &Translated) {
6214+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6215+
}
6216+
6217+
Value *TranslateHitObjectInvoke(CallInst *CI, IntrinsicOp IOP,
6218+
OP::OpCode OpCode,
6219+
HLOperationLowerHelper &Helper,
6220+
HLObjectOperationLowerHelper *pObjHelper,
6221+
bool &Translated) {
6222+
return nullptr; // TODO: Merge SER DXIL patches
6223+
}
6224+
6225+
Value *TranslateHitObjectGetAttributes(CallInst *CI, IntrinsicOp IOP,
6226+
OP::OpCode OpCode,
6227+
HLOperationLowerHelper &Helper,
6228+
HLObjectOperationLowerHelper *pObjHelper,
6229+
bool &Translated) {
6230+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6231+
}
6232+
6233+
Value *TranslateHitObjectScalarGetter(CallInst *CI, IntrinsicOp IOP,
6234+
OP::OpCode OpCode,
6235+
HLOperationLowerHelper &Helper,
6236+
HLObjectOperationLowerHelper *pObjHelper,
6237+
bool &Translated) {
6238+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6239+
}
6240+
6241+
Value *TranslateHitObjectVectorGetter(CallInst *CI, IntrinsicOp IOP,
6242+
OP::OpCode OpCode,
6243+
HLOperationLowerHelper &Helper,
6244+
HLObjectOperationLowerHelper *pObjHelper,
6245+
bool &Translated) {
6246+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6247+
}
6248+
6249+
Value *TranslateHitObjectMatrixGetter(CallInst *CI, IntrinsicOp IOP,
6250+
OP::OpCode OpCode,
6251+
HLOperationLowerHelper &Helper,
6252+
HLObjectOperationLowerHelper *pObjHelper,
6253+
bool &Translated) {
6254+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6255+
}
6256+
6257+
Value *TranslateHitObjectLoadLocalRootTableConstant(
6258+
CallInst *CI, IntrinsicOp IOP, OP::OpCode OpCode,
6259+
HLOperationLowerHelper &Helper, HLObjectOperationLowerHelper *pObjHelper,
6260+
bool &Translated) {
6261+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6262+
}
6263+
6264+
Value *TranslateHitObjectSetShaderTableIndex(
6265+
CallInst *CI, IntrinsicOp IOP, OP::OpCode OpCode,
6266+
HLOperationLowerHelper &Helper, HLObjectOperationLowerHelper *pObjHelper,
6267+
bool &Translated) {
6268+
return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches
6269+
}
6270+
62006271
} // namespace
62016272

62026273
// Resource Handle.
@@ -6908,6 +6979,63 @@ IntrinsicLower gLowerTable[] = {
69086979
DXIL::OpCode::NumOpCodes},
69096980
{IntrinsicOp::MOP_GetBufferContents, UnsupportedVulkanIntrinsic,
69106981
DXIL::OpCode::NumOpCodes},
6982+
{IntrinsicOp::MOP_DxHitObject_FromRayQuery, TranslateHitObjectFromRayQuery,
6983+
DXIL::OpCode::HitObject_FromRayQuery},
6984+
{IntrinsicOp::MOP_DxHitObject_GetAttributes,
6985+
TranslateHitObjectGetAttributes, DXIL::OpCode::HitObject_Attributes},
6986+
{IntrinsicOp::MOP_DxHitObject_GetGeometryIndex,
6987+
TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_GeometryIndex},
6988+
{IntrinsicOp::MOP_DxHitObject_GetHitKind, TranslateHitObjectScalarGetter,
6989+
DXIL::OpCode::HitObject_HitKind},
6990+
{IntrinsicOp::MOP_DxHitObject_GetInstanceID, TranslateHitObjectScalarGetter,
6991+
DXIL::OpCode::HitObject_InstanceID},
6992+
{IntrinsicOp::MOP_DxHitObject_GetInstanceIndex,
6993+
TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_InstanceIndex},
6994+
{IntrinsicOp::MOP_DxHitObject_GetObjectRayDirection,
6995+
TranslateHitObjectVectorGetter,
6996+
DXIL::OpCode::HitObject_ObjectRayDirection},
6997+
{IntrinsicOp::MOP_DxHitObject_GetObjectRayOrigin,
6998+
TranslateHitObjectVectorGetter, DXIL::OpCode::HitObject_ObjectRayOrigin},
6999+
{IntrinsicOp::MOP_DxHitObject_GetObjectToWorld3x4,
7000+
TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_ObjectToWorld3x4},
7001+
{IntrinsicOp::MOP_DxHitObject_GetObjectToWorld4x3,
7002+
TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_ObjectToWorld3x4},
7003+
{IntrinsicOp::MOP_DxHitObject_GetPrimitiveIndex,
7004+
TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_PrimitiveIndex},
7005+
{IntrinsicOp::MOP_DxHitObject_GetRayFlags, TranslateHitObjectScalarGetter,
7006+
DXIL::OpCode::HitObject_RayFlags},
7007+
{IntrinsicOp::MOP_DxHitObject_GetRayTCurrent,
7008+
TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_RayTCurrent},
7009+
{IntrinsicOp::MOP_DxHitObject_GetRayTMin, TranslateHitObjectScalarGetter,
7010+
DXIL::OpCode::HitObject_RayTMin},
7011+
{IntrinsicOp::MOP_DxHitObject_GetShaderTableIndex,
7012+
TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_ShaderTableIndex},
7013+
{IntrinsicOp::MOP_DxHitObject_GetWorldRayDirection,
7014+
TranslateHitObjectVectorGetter, DXIL::OpCode::HitObject_WorldRayDirection},
7015+
{IntrinsicOp::MOP_DxHitObject_GetWorldRayOrigin,
7016+
TranslateHitObjectVectorGetter, DXIL::OpCode::HitObject_WorldRayOrigin},
7017+
{IntrinsicOp::MOP_DxHitObject_GetWorldToObject3x4,
7018+
TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_WorldToObject3x4},
7019+
{IntrinsicOp::MOP_DxHitObject_GetWorldToObject4x3,
7020+
TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_WorldToObject3x4},
7021+
{IntrinsicOp::MOP_DxHitObject_Invoke, TranslateHitObjectInvoke,
7022+
DXIL::OpCode::HitObject_Invoke},
7023+
{IntrinsicOp::MOP_DxHitObject_IsHit, TranslateHitObjectScalarGetter,
7024+
DXIL::OpCode::HitObject_IsHit},
7025+
{IntrinsicOp::MOP_DxHitObject_IsMiss, TranslateHitObjectScalarGetter,
7026+
DXIL::OpCode::HitObject_IsMiss},
7027+
{IntrinsicOp::MOP_DxHitObject_IsNop, TranslateHitObjectScalarGetter,
7028+
DXIL::OpCode::HitObject_IsNop},
7029+
{IntrinsicOp::MOP_DxHitObject_LoadLocalRootTableConstant,
7030+
TranslateHitObjectLoadLocalRootTableConstant,
7031+
DXIL::OpCode::HitObject_LoadLocalRootTableConstant},
7032+
{IntrinsicOp::MOP_DxHitObject_MakeMiss, TranslateHitObjectMake,
7033+
DXIL::OpCode::HitObject_MakeMiss},
7034+
{IntrinsicOp::MOP_DxHitObject_SetShaderTableIndex,
7035+
TranslateHitObjectSetShaderTableIndex,
7036+
DXIL::OpCode::HitObject_SetShaderTableIndex},
7037+
{IntrinsicOp::MOP_DxHitObject_TraceRay, TranslateHitObjectTraceRay,
7038+
DXIL::OpCode::HitObject_TraceRay},
69117039
};
69127040
} // namespace
69137041
static_assert(

tools/clang/lib/AST/ASTContextHLSL.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,19 +1390,27 @@ CXXRecordDecl *hlsl::DeclareVkBufferPointerType(ASTContext &context,
13901390
DeclarationName(&context.Idents.get("Get")), true);
13911391
CanQualType canQualType =
13921392
recordDecl->getTypeForDecl()->getCanonicalTypeUnqualified();
1393-
CreateConstructorDeclarationWithParams(
1393+
auto *copyConstructorDecl = CreateConstructorDeclarationWithParams(
13941394
context, recordDecl, context.VoidTy,
13951395
{context.getRValueReferenceType(canQualType)}, {"bufferPointer"},
1396-
context.DeclarationNames.getCXXConstructorName(canQualType), false);
1397-
CreateConstructorDeclarationWithParams(
1396+
context.DeclarationNames.getCXXConstructorName(canQualType), false, true);
1397+
auto *addressConstructorDecl = CreateConstructorDeclarationWithParams(
13981398
context, recordDecl, context.VoidTy, {context.UnsignedIntTy}, {"address"},
1399-
context.DeclarationNames.getCXXConstructorName(canQualType), false);
1399+
context.DeclarationNames.getCXXConstructorName(canQualType), false, true);
1400+
hlsl::CreateFunctionTemplateDecl(
1401+
context, recordDecl, copyConstructorDecl,
1402+
Builder.getTemplateDecl()->getTemplateParameters()->begin(), 2);
1403+
hlsl::CreateFunctionTemplateDecl(
1404+
context, recordDecl, addressConstructorDecl,
1405+
Builder.getTemplateDecl()->getTemplateParameters()->begin(), 2);
14001406

14011407
StringRef OpcodeGroup = GetHLOpcodeGroupName(HLOpcodeGroup::HLIntrinsic);
14021408
unsigned Opcode = static_cast<unsigned>(IntrinsicOp::MOP_GetBufferContents);
14031409
methodDecl->addAttr(
14041410
HLSLIntrinsicAttr::CreateImplicit(context, OpcodeGroup, "", Opcode));
14051411
methodDecl->addAttr(HLSLCXXOverloadAttr::CreateImplicit(context));
1412+
copyConstructorDecl->addAttr(HLSLCXXOverloadAttr::CreateImplicit(context));
1413+
addressConstructorDecl->addAttr(HLSLCXXOverloadAttr::CreateImplicit(context));
14061414

14071415
return Builder.completeDefinition();
14081416
}

tools/clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,26 +1057,51 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
10571057
Expr *Arg = Exprs[0];
10581058
#ifdef ENABLE_SPIRV_CODEGEN
10591059
if (hlsl::IsVKBufferPointerType(Ty) && Arg->getType()->isIntegerType()) {
1060-
for (auto *ctor : Ty->getAsCXXRecordDecl()->ctors()) {
1061-
if (auto *functionType = ctor->getType()->getAs<FunctionProtoType>()) {
1062-
if (functionType->getNumParams() != 1 ||
1063-
!functionType->getParamType(0)->isIntegerType())
1064-
continue;
1065-
1066-
CanQualType argType = Arg->getType()->getCanonicalTypeUnqualified();
1067-
if (!Arg->isRValue()) {
1068-
Arg = ImpCastExprToType(Arg, argType, CK_LValueToRValue).get();
1069-
}
1070-
if (argType != Context.UnsignedLongLongTy) {
1071-
Arg = ImpCastExprToType(Arg, Context.UnsignedLongLongTy,
1072-
CK_IntegralCast)
1073-
.get();
1074-
}
1075-
return CXXConstructExpr::Create(
1076-
Context, Ty, TyBeginLoc, ctor, false, {Arg}, false, false, false,
1077-
false, CXXConstructExpr::ConstructionKind::CK_Complete,
1078-
SourceRange(LParenLoc, RParenLoc));
1060+
typedef DeclContext::specific_decl_iterator<FunctionTemplateDecl> ft_iter;
1061+
auto *recordDecl = Ty->getAsCXXRecordDecl();
1062+
auto *specDecl = cast<ClassTemplateSpecializationDecl>(recordDecl);
1063+
auto *templatedDecl =
1064+
specDecl->getSpecializedTemplate()->getTemplatedDecl();
1065+
auto functionTemplateDecls =
1066+
llvm::iterator_range<ft_iter>(ft_iter(templatedDecl->decls_begin()),
1067+
ft_iter(templatedDecl->decls_end()));
1068+
for (auto *ftd : functionTemplateDecls) {
1069+
auto *fd = ftd->getTemplatedDecl();
1070+
if (fd->getNumParams() != 1 ||
1071+
!fd->getParamDecl(0)->getType()->isIntegerType())
1072+
continue;
1073+
1074+
void *insertPos;
1075+
auto templateArgs = ftd->getInjectedTemplateArgs();
1076+
auto *functionDecl = ftd->findSpecialization(templateArgs, insertPos);
1077+
if (!functionDecl) {
1078+
DeclarationNameInfo DInfo(ftd->getDeclName(),
1079+
recordDecl->getLocation());
1080+
auto *templateArgList = TemplateArgumentList::CreateCopy(
1081+
Context, templateArgs.data(), templateArgs.size());
1082+
functionDecl = CXXConstructorDecl::Create(
1083+
Context, recordDecl, Arg->getLocStart(), DInfo, Ty, TInfo, false,
1084+
false, false, false);
1085+
functionDecl->setFunctionTemplateSpecialization(ftd, templateArgList,
1086+
insertPos);
1087+
} else if (functionDecl->getDeclKind() != Decl::Kind::CXXConstructor) {
1088+
continue;
1089+
}
1090+
1091+
CanQualType argType = Arg->getType()->getCanonicalTypeUnqualified();
1092+
if (!Arg->isRValue()) {
1093+
Arg = ImpCastExprToType(Arg, argType, CK_LValueToRValue).get();
1094+
}
1095+
if (argType != Context.UnsignedLongLongTy) {
1096+
Arg = ImpCastExprToType(Arg, Context.UnsignedLongLongTy,
1097+
CK_IntegralCast)
1098+
.get();
10791099
}
1100+
return CXXConstructExpr::Create(
1101+
Context, Ty, TyBeginLoc, cast<CXXConstructorDecl>(functionDecl),
1102+
false, {Arg}, false, false, false, false,
1103+
CXXConstructExpr::ConstructionKind::CK_Complete,
1104+
SourceRange(LParenLoc, RParenLoc));
10801105
}
10811106
}
10821107
#endif

tools/clang/lib/Sema/SemaHLSL.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,9 @@ const UINT g_uBasicKindProps[] = {
580580
0, // AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP,
581581
0, // AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1,
582582

583-
BPROP_OBJECT, // AR_OBJECT_RAY_QUERY,
584-
BPROP_OBJECT, // AR_OBJECT_HEAP_RESOURCE,
585-
BPROP_OBJECT, // AR_OBJECT_HEAP_SAMPLER,
583+
LICOMPTYPE_RAY_QUERY, // AR_OBJECT_RAY_QUERY,
584+
BPROP_OBJECT, // AR_OBJECT_HEAP_RESOURCE,
585+
BPROP_OBJECT, // AR_OBJECT_HEAP_SAMPLER,
586586

587587
BPROP_OBJECT | BPROP_RWBUFFER | BPROP_TEXTURE, // AR_OBJECT_RWTEXTURE2DMS
588588
BPROP_OBJECT | BPROP_RWBUFFER |
@@ -1135,6 +1135,9 @@ static const ArBasicKind g_ResourceCT[] = {AR_OBJECT_HEAP_RESOURCE,
11351135

11361136
static const ArBasicKind g_RayDescCT[] = {AR_OBJECT_RAY_DESC, AR_BASIC_UNKNOWN};
11371137

1138+
static const ArBasicKind g_RayQueryCT[] = {AR_OBJECT_RAY_QUERY,
1139+
AR_BASIC_UNKNOWN};
1140+
11381141
static const ArBasicKind g_AccelerationStructCT[] = {
11391142
AR_OBJECT_ACCELERATION_STRUCT, AR_BASIC_UNKNOWN};
11401143

@@ -1297,6 +1300,7 @@ const ArBasicKind *g_LegalIntrinsicCompTypes[] = {
12971300
g_GroupNodeOutputRecordsCT, // LICOMPTYPE_GROUP_NODE_OUTPUT_RECORDS
12981301
g_ThreadNodeOutputRecordsCT, // LICOMPTYPE_THREAD_NODE_OUTPUT_RECORDS
12991302
g_DxHitObjectCT, // LICOMPTYPE_HIT_OBJECT
1303+
g_RayQueryCT, // LICOMPTYPE_RAY_QUERY
13001304
#ifdef ENABLE_SPIRV_CODEGEN
13011305
g_VKBufferPointerCT, // LICOMPTYPE_VK_BUFFER_POINTER
13021306
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// RUN: %dxc -spirv -Od -T cs_6_7 %s | FileCheck %s
2+
// RUN: %dxc -spirv -Od -T cs_6_7 -DALIGN_16 %s | FileCheck %s
3+
// RUN: %dxc -spirv -Od -T cs_6_7 -DNO_PC %s | FileCheck %s
4+
5+
// Was getting bogus type errors with the defined changes
6+
7+
#ifdef ALIGN_16
8+
typedef vk::BufferPointer<uint, 16> BufferType;
9+
#else
10+
typedef vk::BufferPointer<uint, 32> BufferType;
11+
#endif
12+
#ifndef NO_PC
13+
struct PushConstantStruct {
14+
BufferType push_buffer;
15+
};
16+
[[vk::push_constant]] PushConstantStruct push_constant;
17+
#endif
18+
19+
RWStructuredBuffer<uint> output;
20+
21+
// CHECK: [[INT:%[_0-9A-Za-z]*]] = OpTypeInt 32 1
22+
// CHECK: [[I0:%[_0-9A-Za-z]*]] = OpConstant [[INT]] 0
23+
// CHECK: [[UINT:%[_0-9A-Za-z]*]] = OpTypeInt 32 0
24+
// CHECK: [[U0:%[_0-9A-Za-z]*]] = OpConstant [[UINT]] 0
25+
// CHECK: [[PPUINT:%[_0-9A-Za-z]*]] = OpTypePointer PhysicalStorageBuffer [[UINT]]
26+
// CHECK: [[PFPPUINT:%[_0-9A-Za-z]*]] = OpTypePointer Function [[PPUINT]]
27+
// CHECK: [[PUUINT:%[_0-9A-Za-z]*]] = OpTypePointer Uniform [[UINT]]
28+
// CHECK: [[OUTPUT:%[_0-9A-Za-z]*]] = OpVariable %{{[_0-9A-Za-z]*}} Uniform
29+
30+
[numthreads(1, 1, 1)]
31+
void main() {
32+
uint64_t addr = 123;
33+
vk::BufferPointer<uint, 32> test = vk::BufferPointer<uint, 32>(addr);
34+
output[0] = test.Get();
35+
}
36+
37+
// CHECK: [[TEST:%[_0-9A-Za-z]*]] = OpVariable [[PFPPUINT]] Function
38+
// CHECK: [[X1:%[_0-9A-Za-z]*]] = OpConvertUToPtr [[PPUINT]]
39+
// CHECK: OpStore [[TEST]] [[X1]]
40+
// CHECK: [[X2:%[_0-9A-Za-z]*]] = OpLoad [[PPUINT]] [[TEST]] Aligned 32
41+
// CHECK: [[X3:%[_0-9A-Za-z]*]] = OpLoad [[UINT]] [[X2]] Aligned 4
42+
// CHECK: [[X4:%[_0-9A-Za-z]*]] = OpAccessChain [[PUUINT]] [[OUTPUT]] [[I0]] [[U0]]
43+
// CHECK: OpStore [[X4]] [[X3]]
44+
// CHECK: OpReturn
45+
// CHECK: OpFunctionEnd
46+

0 commit comments

Comments
 (0)