@@ -1659,8 +1659,11 @@ void SpirvEmitter::doVarDecl(const VarDecl *decl) {
16591659 needsLegalization = true;
16601660 }
16611661
1662- if (var != nullptr) {
1662+ if (var != nullptr && decl->hasAttrs() ) {
16631663 declIdMapper.decorateVariableWithIntrinsicAttrs(decl, var);
1664+ if (auto attr = decl->getAttr<VKStorageClassExtAttr>()) {
1665+ var->setStorageClass(static_cast<spv::StorageClass>(attr->getStclass()));
1666+ }
16641667 }
16651668
16661669 // All variables that are of opaque struct types should request legalization.
@@ -7637,6 +7640,9 @@ SpirvEmitter::processIntrinsicCallExpr(const CallExpr *callExpr) {
76377640 case hlsl::IntrinsicOp::IOP_VkRawBufferLoad:
76387641 retVal = processRawBufferLoad(callExpr);
76397642 break;
7643+ case hlsl::IntrinsicOp::IOP_Vkext_execution_mode:
7644+ retVal = processIntrinsicExecutionMode(callExpr);
7645+ break;
76407646 case hlsl::IntrinsicOp::IOP_saturate:
76417647 retVal = processIntrinsicSaturate(callExpr);
76427648 break;
@@ -12569,6 +12575,32 @@ SpirvInstruction *SpirvEmitter::processRawBufferLoad(const CallExpr *callExpr) {
1256912575 return loadInst;
1257012576}
1257112577
12578+ SpirvInstruction *
12579+ SpirvEmitter::processIntrinsicExecutionMode(const CallExpr *expr) {
12580+ llvm::SmallVector<uint32_t, 2> execModesParams;
12581+ uint32_t exeMode = 0;
12582+ const auto args = expr->getArgs();
12583+ for (uint32_t i = 0; i < expr->getNumArgs(); ++i) {
12584+ SpirvConstantInteger *argInst =
12585+ dyn_cast<SpirvConstantInteger>(doExpr(args[i]));
12586+ if (argInst == nullptr) {
12587+ emitError("argument should be constant interger", expr->getExprLoc());
12588+ return nullptr;
12589+ }
12590+ unsigned argInteger = argInst->getValue().getZExtValue();
12591+ if (i > 0)
12592+ execModesParams.push_back(argInteger);
12593+ else
12594+ exeMode = argInteger;
12595+ }
12596+ assert(entryFunction != nullptr);
12597+ assert(exeMode != 0);
12598+
12599+ return spvBuilder.addExecutionMode(entryFunction,
12600+ static_cast<spv::ExecutionMode>(exeMode),
12601+ execModesParams, expr->getExprLoc());
12602+ }
12603+
1257212604bool SpirvEmitter::spirvToolsValidate(std::vector<uint32_t> *mod,
1257312605 std::string *messages) {
1257412606 spvtools::SpirvTools tools(featureManager.getTargetEnv());
0 commit comments