Skip to content

Commit

Permalink
Address review points
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaolu committed Nov 18, 2021
1 parent a4da69b commit 039dd8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions tools/clang/lib/SPIRV/SpirvEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7637,13 +7637,11 @@ SpirvEmitter::processIntrinsicCallExpr(const CallExpr *callExpr) {
case hlsl::IntrinsicOp::IOP_VkReadClock:
retVal = processIntrinsicReadClock(callExpr);
break;
<<<<<<< HEAD
case hlsl::IntrinsicOp::IOP_VkRawBufferLoad:
retVal = processRawBufferLoad(callExpr);
=======
break;
case hlsl::IntrinsicOp::IOP_Vkext_execution_mode:
retVal = processIntrinsicExecutionMode(callExpr);
>>>>>>> daae8b9c0 ([SPIRV] Add support vk::ext_execution_mode)
break;
case hlsl::IntrinsicOp::IOP_saturate:
retVal = processIntrinsicSaturate(callExpr);
Expand Down Expand Up @@ -12575,6 +12573,8 @@ SpirvInstruction *SpirvEmitter::processRawBufferLoad(const CallExpr *callExpr) {
loadInst->setAlignment(4);

return loadInst;
}

SpirvInstruction *
SpirvEmitter::processIntrinsicExecutionMode(const CallExpr *expr) {
llvm::SmallVector<uint32_t, 2> execModesParams;
Expand All @@ -12583,7 +12583,10 @@ SpirvEmitter::processIntrinsicExecutionMode(const CallExpr *expr) {
for (uint32_t i = 0; i < expr->getNumArgs(); ++i) {
SpirvConstantInteger *argInst =
dyn_cast<SpirvConstantInteger>(doExpr(args[i]));
assert(argInst != nullptr);
if (argInst == nullptr) {
emitError("argument should be constant interger", expr->getExprLoc());
return nullptr;
}
unsigned argInteger = argInst->getValue().getZExtValue();
if (i > 0)
execModesParams.push_back(argInteger);
Expand Down
8 changes: 5 additions & 3 deletions tools/clang/test/CodeGenSPIRV/spv.intrinsicStorageClass.hlsl
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// RUN: %dxc -T ps_6_0 -E main -spirv -Vd

//CHECK: {{%\w+}} = OpVariable {{%\w+}} RayPayloadNV
//CHECK: {{%\w+}} = OpVariable {{%\w+}} CrossWorkgroup
//CHECK: [[payloadTy:%\w+]] = OpTypeStruct %v4float
//CHECK-NEXT: [[payloadTyPtr:%\w+]] = OpTypePointer RayPayloadNV [[payloadTy]]
//CHECK: [[crossTy:%\w+]] = OpTypePointer CrossWorkgroup %int
//CHECK: {{%\w+}} = OpVariable [[payloadTyPtr]] RayPayloadNV
//CHECK: {{%\w+}} = OpVariable [[crossTy]] CrossWorkgroup

[[vk::ext_storage_class(/*RayPayloadNV*/5338)]]
float4 payload;

int main() : SV_Target0 {

[[vk::ext_storage_class(/* CrossWorkgroup */ 5)]] int foo = 3;
return foo;
}

0 comments on commit 039dd8c

Please sign in to comment.