|
@@ -1403,6 +1403,32 @@ uint32_t DeclResultIdMapper::createSpirvStageVar(StageVar *stageVar,
|
|
|
llvm_unreachable("invalid usage of SV_RenderTargetArrayIndex sneaked in");
|
|
llvm_unreachable("invalid usage of SV_RenderTargetArrayIndex sneaked in");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // According to DXIL spec, the ViewportArrayIndex SV can only be used by
|
|
|
|
|
+ // VSIn, VSOut, HSCPIn, HSCPOut, DSIn, DSOut, GSVIn, GSOut, PSIn.
|
|
|
|
|
+ // According to Vulkan spec, the ViewportIndex BuiltIn can only be used in
|
|
|
|
|
+ // GSOut and PSIn.
|
|
|
|
|
+ case hlsl::Semantic::Kind::ViewPortArrayIndex: {
|
|
|
|
|
+ switch (sigPointKind) {
|
|
|
|
|
+ case hlsl::SigPoint::Kind::VSIn:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::VSOut:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::HSCPIn:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::HSCPOut:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::PCOut:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::DSIn:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::DSCPIn:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::DSOut:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::GSVIn:
|
|
|
|
|
+ return theBuilder.addStageIOVar(type, sc, name.str());
|
|
|
|
|
+ case hlsl::SigPoint::Kind::GSOut:
|
|
|
|
|
+ case hlsl::SigPoint::Kind::PSIn:
|
|
|
|
|
+ theBuilder.requireCapability(spv::Capability::MultiViewport);
|
|
|
|
|
+
|
|
|
|
|
+ stageVar->setIsSpirvBuiltin();
|
|
|
|
|
+ return theBuilder.addStageBuiltinVar(type, sc, BuiltIn::ViewportIndex);
|
|
|
|
|
+ default:
|
|
|
|
|
+ llvm_unreachable("invalid usage of SV_ViewportArrayIndex sneaked in");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
default:
|
|
default:
|
|
|
emitError("semantic %0 unimplemented", srcLoc)
|
|
emitError("semantic %0 unimplemented", srcLoc)
|
|
|
<< stageVar->getSemantic()->GetName();
|
|
<< stageVar->getSemantic()->GetName();
|