OLD | NEW |
---|---|
(Empty) | |
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 "GrGLPathProgramBuilder.h" | |
9 #include "gl/GrGLGpu.h" | |
10 #include "gl/GrGLPathProgram.h" | |
11 | |
12 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) | |
13 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) | |
14 | |
15 GrGLPathProgramBuilder::GrGLPathProgramBuilder(GrGLGpu* gpu, const DrawArgs& arg s) | |
16 : INHERITED(gpu, args) | |
17 , fSeparableVaryingInfos(kVarsPerBlock) { | |
18 } | |
19 | |
20 GrGLProgram* GrGLPathProgramBuilder::createProgram(GrGLuint programID) { | |
21 return SkNEW_ARGS(GrGLPathProgram, (fGpu, this->desc(), fUniformHandles, pro gramID, | |
22 fUniforms, | |
23 fSeparableVaryingInfos, | |
24 fGeometryProcessor, | |
25 fXferProcessor, fFragmentProcessors.get( ))); | |
26 } | |
27 | |
28 GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableV arying( | |
29 const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) { | |
30 this->addVarying(name, v, fsPrecision); | |
31 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back(); | |
32 varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back(); | |
33 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; | |
34 return GrGLPathProgramDataManager::SeparableVaryingHandle::CreateFromSeparab leVaryingIndex(varyingInfo.fLocation); | |
joshualitt
2015/06/23 14:07:24
linewrap using typedefs
Kimmo Kinnunen
2015/06/25 12:38:11
Done.
| |
35 } | |
36 | |
37 void GrGLPathProgramBuilder::resolveProgramResourceLocations(GrGLuint programID) { | |
38 this->INHERITED::resolveProgramResourceLocations(programID); | |
39 | |
40 int count = fSeparableVaryingInfos.count(); | |
41 for (int i = 0; i < count; ++i) { | |
42 GrGLint location; | |
43 GL_CALL_RET(location, | |
44 GetProgramResourceLocation(programID, | |
45 GR_GL_FRAGMENT_INPUT, | |
46 fSeparableVaryingInfos[i].fVariab le.c_str())); | |
47 fSeparableVaryingInfos[i].fLocation = location; | |
48 } | |
49 } | |
OLD | NEW |