Skip to content

Commit d947598

Browse files
NielsbishereAltNielsbishere
authored andcommitted
Now only inverting Y on SV_POSITION if supported by current entrypoint; avoids pixel shader from inverting SV_POSITION.y in a lib file
1 parent c78ae35 commit d947598

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tools/clang/lib/SPIRV/SpirvEmitter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14881,8 +14881,12 @@ SpirvEmitter::createSpirvIntrInstExt(llvm::ArrayRef<const Attr *> attrs,
1488114881
SpirvInstruction *SpirvEmitter::invertYIfRequested(SpirvInstruction *position,
1488214882
SourceLocation loc,
1488314883
SourceRange range) {
14884-
// Negate SV_Position.y if requested
14885-
if (spirvOptions.invertY) {
14884+
// Negate SV_Position.y if requested and supported
14885+
14886+
bool supportsInvertY = spvContext.isVS() || spvContext.isGS() ||
14887+
spvContext.isGS() || spvContext.isMS();
14888+
14889+
if (spirvOptions.invertY && supportsInvertY) {
1488614890
const auto oldY = spvBuilder.createCompositeExtract(
1488714891
astContext.FloatTy, position, {1}, loc, range);
1488814892
const auto newY = spvBuilder.createUnaryOp(

0 commit comments

Comments
 (0)