[llvm] [SPIR-V] Add Fragment execution model (PR #141787)
Steven Perron via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 08:21:38 PDT 2025
================
@@ -439,10 +441,21 @@ bool SPIRVCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
// Handle entry points and function linkage.
if (isEntryPoint(F)) {
+ SPIRV::ExecutionModel::ExecutionModel ExecutionModel =
+ getExecutionModel(*ST, F);
auto MIB = MIRBuilder.buildInstr(SPIRV::OpEntryPoint)
- .addImm(static_cast<uint32_t>(getExecutionModel(*ST, F)))
+ .addImm(static_cast<uint32_t>(ExecutionModel))
.addUse(FuncVReg);
addStringImm(F.getName(), MIB);
+
+ if (ExecutionModel == SPIRV::ExecutionModel::Fragment) {
+ // SPIR-V common validation: Fragment requires OriginUpperLeft or
+ // OriginLowerLeft VUID-StandaloneSpirv-OriginLowerLeft-04653: Fragment
+ // must declare OriginUpperLeft.
+ MIRBuilder.buildInstr(SPIRV::OpExecutionMode)
+ .addUse(FuncVReg)
+ .addImm(static_cast<uint32_t>(SPIRV::ExecutionMode::OriginUpperLeft));
+ }
----------------
s-perron wrote:
This is fine for now because the only "Shader" environment is Vulkan. We might want to keep in mind what to do if other environments are added that may be different.
https://github.com/llvm/llvm-project/pull/141787
More information about the llvm-commits
mailing list