| Index: src/sksl/SkSLSPIRVCodeGenerator.cpp
|
| diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
|
| index 5403ba362814057ad46e2047d96a3f730b4a54c8..a4919686742f20c006b2a39f933e2aeb0184b228 100644
|
| --- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
|
| +++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
|
| @@ -2529,8 +2529,10 @@ void SPIRVCodeGenerator::writeForStatement(const ForStatement& f, std::ostream&
|
| this->writeInstruction(SpvOpLoopMerge, end, next, SpvLoopControlMaskNone, out);
|
| this->writeInstruction(SpvOpBranch, start, out);
|
| this->writeLabel(start, out);
|
| - SpvId test = this->writeExpression(*f.fTest, out);
|
| - this->writeInstruction(SpvOpBranchConditional, test, body, end, out);
|
| + if (f.fTest) {
|
| + SpvId test = this->writeExpression(*f.fTest, out);
|
| + this->writeInstruction(SpvOpBranchConditional, test, body, end, out);
|
| + }
|
| this->writeLabel(body, out);
|
| this->writeStatement(*f.fStatement, out);
|
| if (fCurrentBlock) {
|
|
|