Index: src/gpu/gl/GrGLVaryingHandler.cpp |
diff --git a/src/gpu/gl/GrGLVaryingHandler.cpp b/src/gpu/gl/GrGLVaryingHandler.cpp |
index b27a9960ec08ef54c414756be9f5b1fd6830d774..a2d4e9d1b953b4867120a9327a4f944cb728d003 100644 |
--- a/src/gpu/gl/GrGLVaryingHandler.cpp |
+++ b/src/gpu/gl/GrGLVaryingHandler.cpp |
@@ -24,8 +24,14 @@ GrGLSLVaryingHandler::VaryingHandle GrGLVaryingHandler::addPathProcessingVarying |
glPB->fArgs.fPrimitiveProcessor->numAttribs() == 0); |
#endif |
this->addVarying(name, v, fsPrecision); |
- VaryingInfo& varyingInfo = fPathProcVaryingInfos.push_back(); |
- varyingInfo.fVariable = fFragInputs.back(); |
+ auto varyingInfo = fPathProcVaryingInfos.push_back(); |
varyingInfo.fLocation = fPathProcVaryingInfos.count() - 1; |
return VaryingHandle(varyingInfo.fLocation); |
} |
+ |
+void GrGLVaryingHandler::onFinalize() { |
+ SkASSERT(fPathProcVaryingInfos.empty() || fPathProcVaryingInfos.count() == fFragInputs.count()); |
+ for (int i = 0; i < fPathProcVaryingInfos.count(); ++i) { |
+ fPathProcVaryingInfos[i].fVariable = fFragInputs[i]; |
+ } |
+} |