1 /* 2 * Copyright 2015 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/gpu/gl/GrGLVaryingHandler.h" 9 10 #include "src/gpu/gl/GrGLGpu.h" 11 #include "src/gpu/gl/builders/GrGLProgramBuilder.h" 12 13 addPathProcessingVarying(const char * name,GrGLSLVarying * v)14GrGLSLVaryingHandler::VaryingHandle GrGLVaryingHandler::addPathProcessingVarying( 15 const char* name, 16 GrGLSLVarying* v) { 17 #ifdef SK_DEBUG 18 GrGLProgramBuilder* glPB = (GrGLProgramBuilder*) fProgramBuilder; 19 // This call is not used for non-NVPR backends. 20 SkASSERT(glPB->gpu()->glCaps().shaderCaps()->pathRenderingSupport() && 21 fProgramBuilder->fProgramInfo.isNVPR()); 22 #endif 23 this->addVarying(name, v); 24 auto varyingInfo = fPathProcVaryingInfos.push_back(); 25 varyingInfo.fLocation = fPathProcVaryingInfos.count() - 1; 26 return VaryingHandle(varyingInfo.fLocation); 27 } 28 onFinalize()29void GrGLVaryingHandler::onFinalize() { 30 SkASSERT(fPathProcVaryingInfos.empty() || fPathProcVaryingInfos.count() == fFragInputs.count()); 31 for (int i = 0; i < fPathProcVaryingInfos.count(); ++i) { 32 fPathProcVaryingInfos[i].fVariable = fFragInputs[i]; 33 } 34 } 35