OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrGLNvprProgramBuilder.h" | 8 #include "GrGLNvprProgramBuilder.h" |
9 #include "../GrGpuGL.h" | 9 #include "../GrGpuGL.h" |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords, | 48 SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords, |
49 (SkString(fsVaryingName), varyingType)); | 49 (SkString(fsVaryingName), varyingType)); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 GrGLInstalledFragProc::ShaderVarHandle | 53 GrGLInstalledFragProc::ShaderVarHandle |
54 GrGLNvprProgramBuilder::addSeparableVarying(GrSLType type, | 54 GrGLNvprProgramBuilder::addSeparableVarying(GrSLType type, |
55 const char* name, | 55 const char* name, |
56 const char** vsOutName, | 56 const char** vsOutName, |
57 const char** fsInName) { | 57 const char** fsInName) { |
| 58 addVarying(type, name, vsOutName, fsInName); |
58 SeparableVaryingInfo& varying = fSeparableVaryingInfos.push_back(); | 59 SeparableVaryingInfo& varying = fSeparableVaryingInfos.push_back(); |
59 varying.fVariable = fFS.fInputs.back(); | 60 varying.fVariable = fFS.fInputs.back(); |
60 return GrGLInstalledFragProc::ShaderVarHandle(fSeparableVaryingInfos.count()
- 1); | 61 return GrGLInstalledFragProc::ShaderVarHandle(fSeparableVaryingInfos.count()
- 1); |
61 } | 62 } |
62 | 63 |
63 void GrGLNvprProgramBuilder::resolveSeparableVaryings(GrGLuint programId) { | 64 void GrGLNvprProgramBuilder::resolveSeparableVaryings(GrGLuint programId) { |
64 int count = fSeparableVaryingInfos.count(); | 65 int count = fSeparableVaryingInfos.count(); |
65 for (int i = 0; i < count; ++i) { | 66 for (int i = 0; i < count; ++i) { |
66 GrGLint location; | 67 GrGLint location; |
67 GL_CALL_RET(location, | 68 GL_CALL_RET(location, |
68 GetProgramResourceLocation(programId, | 69 GetProgramResourceLocation(programId, |
69 GR_GL_FRAGMENT_INPUT, | 70 GR_GL_FRAGMENT_INPUT, |
70 fSeparableVaryingInfos[i].fVariab
le.c_str())); | 71 fSeparableVaryingInfos[i].fVariab
le.c_str())); |
71 fSeparableVaryingInfos[i].fLocation = location; | 72 fSeparableVaryingInfos[i].fLocation = location; |
72 } | 73 } |
73 } | 74 } |
74 | 75 |
75 GrGLProgram* GrGLNvprProgramBuilder::createProgram(GrGLuint programID) { | 76 GrGLProgram* GrGLNvprProgramBuilder::createProgram(GrGLuint programID) { |
76 // this is just for nvpr es, which has separable varyings that are plugged i
n after | 77 // this is just for nvpr es, which has separable varyings that are plugged i
n after |
77 // building | 78 // building |
78 this->resolveSeparableVaryings(programID); | 79 this->resolveSeparableVaryings(programID); |
79 return SkNEW_ARGS(GrGLNvprProgram, (fGpu, fDesc, fUniformHandles, programID,
fUniforms, | 80 return SkNEW_ARGS(GrGLNvprProgram, (fGpu, fDesc, fUniformHandles, programID,
fUniforms, |
80 fFragmentProcessors.get(), fSeparableVar
yingInfos)); | 81 fFragmentProcessors.get(), fSeparableVar
yingInfos)); |
81 } | 82 } |
OLD | NEW |