Remove ternary Lvalue support in SPIR-V.

Ternaries are not assignable in GLSL/SkSL. This code should never have
been reached; no tests are affected.

Change-Id: I7d0139531062c27d7af395553e0d225247a70b48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369878
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-02-12 12:14:29 -05:00 committed by Skia Commit-Bot
parent 28698696f1
commit 381dd5721f

View File

@ -1940,28 +1940,6 @@ std::unique_ptr<SPIRVCodeGenerator::LValue> SPIRVCodeGenerator::getLValue(const
swizzle.base()->type(), type, precision);
}
}
case Expression::Kind::kTernary: {
const TernaryExpression& t = expr.as<TernaryExpression>();
SpvId test = this->writeExpression(*t.test(), out);
SpvId end = this->nextId();
SpvId ifTrueLabel = this->nextId();
SpvId ifFalseLabel = this->nextId();
this->writeInstruction(SpvOpSelectionMerge, end, SpvSelectionControlMaskNone, out);
this->writeInstruction(SpvOpBranchConditional, test, ifTrueLabel, ifFalseLabel, out);
this->writeLabel(ifTrueLabel, out);
SpvId ifTrue = this->getLValue(*t.ifTrue(), out)->getPointer();
SkASSERT(ifTrue != (SpvId) -1);
this->writeInstruction(SpvOpBranch, end, out);
ifTrueLabel = fCurrentBlock;
SpvId ifFalse = this->getLValue(*t.ifFalse(), out)->getPointer();
SkASSERT(ifFalse != (SpvId) -1);
ifFalseLabel = fCurrentBlock;
this->writeInstruction(SpvOpBranch, end, out);
SpvId result = this->nextId();
this->writeInstruction(SpvOpPhi, this->getType(*fContext.fTypes.fBool), result, ifTrue,
ifTrueLabel, ifFalse, ifFalseLabel, out);
return std::make_unique<PointerLValue>(*this, result, this->getType(type), precision);
}
default: {
// expr isn't actually an lvalue, create a dummy variable for it. This case happens due
// to the need to store values in temporary variables during function calls (see