@@ -1241,6 +1241,43 @@ CXXRecordDecl *hlsl::DeclareNodeOrRecordType(
12411241 return Builder.getRecordDecl ();
12421242}
12431243
1244+ #ifdef ENABLE_SPIRV_CODEGEN
1245+ CXXRecordDecl *hlsl::DeclareInlineSpirvType (clang::ASTContext &context,
1246+ clang::DeclContext *declContext,
1247+ llvm::StringRef typeName,
1248+ bool opaque) {
1249+ // template<uint opcode, int size, int alignment> vk::SpirvType { ... }
1250+ // template<uint opcode> vk::SpirvOpaqueType { ... }
1251+ BuiltinTypeDeclBuilder typeDeclBuilder (declContext, typeName,
1252+ clang::TagTypeKind::TTK_Class);
1253+ typeDeclBuilder.addIntegerTemplateParam (" opcode" , context.UnsignedIntTy );
1254+ if (!opaque) {
1255+ typeDeclBuilder.addIntegerTemplateParam (" size" , context.UnsignedIntTy );
1256+ typeDeclBuilder.addIntegerTemplateParam (" alignment" , context.UnsignedIntTy );
1257+ }
1258+ typeDeclBuilder.addTypeTemplateParam (" operands" , nullptr , true );
1259+ typeDeclBuilder.startDefinition ();
1260+ typeDeclBuilder.addField (
1261+ " h" , context.UnsignedIntTy ); // Add an 'h' field to hold the handle.
1262+ return typeDeclBuilder.getRecordDecl ();
1263+ }
1264+
1265+ CXXRecordDecl *hlsl::DeclareVkIntegralConstant (
1266+ clang::ASTContext &context, clang::DeclContext *declContext,
1267+ llvm::StringRef typeName, ClassTemplateDecl **templateDecl) {
1268+ // template<typename T, T v> vk::integral_constant { ... }
1269+ BuiltinTypeDeclBuilder typeDeclBuilder (declContext, typeName,
1270+ clang::TagTypeKind::TTK_Class);
1271+ typeDeclBuilder.addTypeTemplateParam (" T" );
1272+ typeDeclBuilder.addIntegerTemplateParam (" v" , context.UnsignedIntTy );
1273+ typeDeclBuilder.startDefinition ();
1274+ typeDeclBuilder.addField (
1275+ " h" , context.UnsignedIntTy ); // Add an 'h' field to hold the handle.
1276+ *templateDecl = typeDeclBuilder.getTemplateDecl ();
1277+ return typeDeclBuilder.getRecordDecl ();
1278+ }
1279+ #endif
1280+
12441281CXXRecordDecl *hlsl::DeclareNodeOutputArray (clang::ASTContext &Ctx,
12451282 DXIL::NodeIOKind Type,
12461283 CXXRecordDecl *OutputType,
0 commit comments