blob: b27a9960ec08ef54c414756be9f5b1fd6830d774 [file] [log] [blame]
egdaniel0eafe792015-11-20 14:01:22 -08001/*
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 "gl/GrGLVaryingHandler.h"
9
10#include "gl/GrGLGpu.h"
11#include "gl/builders/GrGLProgramBuilder.h"
12
13
14GrGLSLVaryingHandler::VaryingHandle GrGLVaryingHandler::addPathProcessingVarying(
15 const char* name,
16 GrGLSLVertToFrag* v,
17 GrSLPrecision fsPrecision) {
18#ifdef SK_DEBUG
19 GrGLProgramBuilder* glPB = (GrGLProgramBuilder*) fProgramBuilder;
20 // This call is not used for non-NVPR backends.
21 SkASSERT(glPB->gpu()->glCaps().shaderCaps()->pathRenderingSupport() &&
22 glPB->fArgs.fPrimitiveProcessor->isPathRendering() &&
23 !glPB->fArgs.fPrimitiveProcessor->willUseGeoShader() &&
24 glPB->fArgs.fPrimitiveProcessor->numAttribs() == 0);
25#endif
26 this->addVarying(name, v, fsPrecision);
27 VaryingInfo& varyingInfo = fPathProcVaryingInfos.push_back();
28 varyingInfo.fVariable = fFragInputs.back();
29 varyingInfo.fLocation = fPathProcVaryingInfos.count() - 1;
30 return VaryingHandle(varyingInfo.fLocation);
31}