Chromium Code Reviews| Index: src/gpu/gl/builders/GrGLPathProgramBuilder.cpp |
| diff --git a/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp b/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..33bd3d3c9ceefdf5bf5621ebfa20c164fcbee0e1 |
| --- /dev/null |
| +++ b/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp |
| @@ -0,0 +1,49 @@ |
| +/* |
| + * Copyright 2015 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#include "GrGLPathProgramBuilder.h" |
| +#include "gl/GrGLGpu.h" |
| +#include "gl/GrGLPathProgram.h" |
| + |
| +#define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) |
| +#define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) |
| + |
| +GrGLPathProgramBuilder::GrGLPathProgramBuilder(GrGLGpu* gpu, const DrawArgs& args) |
| + : INHERITED(gpu, args) |
| + , fSeparableVaryingInfos(kVarsPerBlock) { |
| +} |
| + |
| +GrGLProgram* GrGLPathProgramBuilder::createProgram(GrGLuint programID) { |
| + return SkNEW_ARGS(GrGLPathProgram, (fGpu, this->desc(), fUniformHandles, programID, |
| + fUniforms, |
| + fSeparableVaryingInfos, |
| + fGeometryProcessor, |
| + fXferProcessor, fFragmentProcessors.get())); |
| +} |
| + |
| +GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableVarying( |
| + const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) { |
| + this->addVarying(name, v, fsPrecision); |
| + SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back(); |
| + varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back(); |
| + varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; |
| + return GrGLPathProgramDataManager::SeparableVaryingHandle::CreateFromSeparableVaryingIndex(varyingInfo.fLocation); |
|
joshualitt
2015/06/23 14:07:24
linewrap using typedefs
Kimmo Kinnunen
2015/06/25 12:38:11
Done.
|
| +} |
| + |
| +void GrGLPathProgramBuilder::resolveProgramResourceLocations(GrGLuint programID) { |
| + this->INHERITED::resolveProgramResourceLocations(programID); |
| + |
| + int count = fSeparableVaryingInfos.count(); |
| + for (int i = 0; i < count; ++i) { |
| + GrGLint location; |
| + GL_CALL_RET(location, |
| + GetProgramResourceLocation(programID, |
| + GR_GL_FRAGMENT_INPUT, |
| + fSeparableVaryingInfos[i].fVariable.c_str())); |
| + fSeparableVaryingInfos[i].fLocation = location; |
| + } |
| +} |