Skip to content

Commit d396181

Browse files
committed
* SPIRVWriter: added handling for new floor.exit function call -> this translates to either an OpKill (discard) for fragment shaders or OpReturn for vertex shaders and compute kernels
1 parent 6e5c36b commit d396181

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4476,6 +4476,21 @@ SPIRVValue *LLVMToSPIRVBase::transDirectCallInst(CallInst *CI,
44764476
spv::MemorySemanticsImageMemoryMask,
44774477
true);
44784478
return BM->addControlBarrierInst(wg_scope, wg_scope, wg_sema, BB);
4479+
} else if (MangledName == "floor.exit") {
4480+
// NOTE: we assume everything has been inlined at this point, so that we
4481+
// can just return/exit
4482+
4483+
// similar to what we already do for fragment discard, we need to ignore
4484+
// the next unreachable here
4485+
ignore_next_unreachable = true;
4486+
if (CI->getParent()->getParent()->getCallingConv() ==
4487+
llvm::CallingConv::FLOOR_FRAGMENT) {
4488+
// fragment shader can just exit directly
4489+
return BM->addKillInst(BB);
4490+
} else {
4491+
// kernel or vertex shader can only use a return op
4492+
return BM->addReturnInst(BB);
4493+
}
44794494
}
44804495
errs() << "unhandled floor func: " << MangledName << "\n";
44814496
}

0 commit comments

Comments
 (0)