@@ -282,6 +282,8 @@ getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
282
282
return SPIRV::ExecutionModel::GLCompute;
283
283
if (value == " vertex" )
284
284
return SPIRV::ExecutionModel::Vertex;
285
+ if (value == " pixel" )
286
+ return SPIRV::ExecutionModel::Fragment;
285
287
286
288
report_fatal_error (
287
289
" This HLSL entry point is not supported by this backend." );
@@ -306,6 +308,8 @@ getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
306
308
return SPIRV::ExecutionModel::GLCompute;
307
309
if (value == " vertex" )
308
310
return SPIRV::ExecutionModel::Vertex;
311
+ if (value == " pixel" )
312
+ return SPIRV::ExecutionModel::Fragment;
309
313
310
314
report_fatal_error (" This HLSL entry point is not supported by this backend." );
311
315
}
@@ -471,10 +475,21 @@ bool SPIRVCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
471
475
// environment if we need to.
472
476
const SPIRVSubtarget *ST =
473
477
static_cast <const SPIRVSubtarget *>(&MIRBuilder.getMF ().getSubtarget ());
478
+ SPIRV::ExecutionModel::ExecutionModel ExecutionModel =
479
+ getExecutionModel (*ST, F);
474
480
auto MIB = MIRBuilder.buildInstr (SPIRV::OpEntryPoint)
475
- .addImm (static_cast <uint32_t >(getExecutionModel (*ST, F) ))
481
+ .addImm (static_cast <uint32_t >(ExecutionModel ))
476
482
.addUse (FuncVReg);
477
483
addStringImm (F.getName (), MIB);
484
+
485
+ if (ExecutionModel == SPIRV::ExecutionModel::Fragment) {
486
+ // SPIR-V common validation: Fragment requires OriginUpperLeft or
487
+ // OriginLowerLeft VUID-StandaloneSpirv-OriginLowerLeft-04653: Fragment
488
+ // must declare OriginUpperLeft.
489
+ MIRBuilder.buildInstr (SPIRV::OpExecutionMode)
490
+ .addUse (FuncVReg)
491
+ .addImm (static_cast <uint32_t >(SPIRV::ExecutionMode::OriginUpperLeft));
492
+ }
478
493
} else if (F.getLinkage () != GlobalValue::InternalLinkage &&
479
494
F.getLinkage () != GlobalValue::PrivateLinkage) {
480
495
SPIRV::LinkageType::LinkageType LnkTy =
0 commit comments