| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrGLPathProgramBuilder.h" | 8 #include "GrGLPathProgramBuilder.h" |
| 9 #include "gl/GrGLGpu.h" | 9 #include "gl/GrGLGpu.h" |
| 10 #include "gl/GrGLPathProgram.h" | 10 #include "gl/GrGLPathProgram.h" |
| 11 | 11 |
| 12 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) | 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) | 13 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) |
| 14 | 14 |
| 15 GrGLPathProgramBuilder::GrGLPathProgramBuilder(GrGLGpu* gpu, const DrawArgs& arg
s) | 15 GrGLPathProgramBuilder::GrGLPathProgramBuilder(GrGLGpu* gpu, const DrawArgs& arg
s) |
| 16 : INHERITED(gpu, args) | 16 : INHERITED(gpu, args) |
| 17 , fSeparableVaryingInfos(kVarsPerBlock) { | 17 , fSeparableVaryingInfos(kVarsPerBlock) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 GrGLProgram* GrGLPathProgramBuilder::createProgram(GrGLuint programID) { | 20 GrGLProgram* GrGLPathProgramBuilder::createProgram(GrGLuint programID) { |
| 21 return SkNEW_ARGS(GrGLPathProgram, (fGpu, this->desc(), fUniformHandles, pro
gramID, | 21 return new GrGLPathProgram(fGpu, this->desc(), fUniformHandles, programID, f
Uniforms, |
| 22 fUniforms, | 22 fSeparableVaryingInfos, fGeometryProcessor, fXfer
Processor, |
| 23 fSeparableVaryingInfos, | 23 fFragmentProcessors.get(), &fSamplerUniforms); |
| 24 fGeometryProcessor, | |
| 25 fXferProcessor, fFragmentProcessors.get(
), | |
| 26 &fSamplerUniforms)); | |
| 27 } | 24 } |
| 28 | 25 |
| 29 GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableV
arying( | 26 GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableV
arying( |
| 30 const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) { | 27 const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) { |
| 31 this->addVarying(name, v, fsPrecision); | 28 this->addVarying(name, v, fsPrecision); |
| 32 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back(); | 29 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back(); |
| 33 varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back(); | 30 varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back(); |
| 34 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; | 31 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; |
| 35 return SeparableVaryingHandle::CreateFromSeparableVaryingIndex(varyingInfo.f
Location); | 32 return SeparableVaryingHandle::CreateFromSeparableVaryingIndex(varyingInfo.f
Location); |
| 36 } | 33 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 57 int count = fSeparableVaryingInfos.count(); | 54 int count = fSeparableVaryingInfos.count(); |
| 58 for (int i = 0; i < count; ++i) { | 55 for (int i = 0; i < count; ++i) { |
| 59 GrGLint location; | 56 GrGLint location; |
| 60 GL_CALL_RET(location, | 57 GL_CALL_RET(location, |
| 61 GetProgramResourceLocation(programID, | 58 GetProgramResourceLocation(programID, |
| 62 GR_GL_FRAGMENT_INPUT, | 59 GR_GL_FRAGMENT_INPUT, |
| 63 fSeparableVaryingInfos[i].fVariab
le.c_str())); | 60 fSeparableVaryingInfos[i].fVariab
le.c_str())); |
| 64 fSeparableVaryingInfos[i].fLocation = location; | 61 fSeparableVaryingInfos[i].fLocation = location; |
| 65 } | 62 } |
| 66 } | 63 } |
| OLD | NEW |