| 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 "GrGLProgramBuilder.h" | 8 #include "GrGLProgramBuilder.h" |
| 9 | 9 |
| 10 #include "GrAutoLocaleSetter.h" | 10 #include "GrAutoLocaleSetter.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "glsl/GrGLSLXferProcessor.h" | 26 #include "glsl/GrGLSLXferProcessor.h" |
| 27 | 27 |
| 28 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) | 28 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) |
| 29 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) | 29 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) |
| 30 | 30 |
| 31 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
u) { | 31 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
u) { |
| 32 GrAutoLocaleSetter als("C"); | 32 GrAutoLocaleSetter als("C"); |
| 33 | 33 |
| 34 // create a builder. This will be handed off to effects so they can use it
to add | 34 // create a builder. This will be handed off to effects so they can use it
to add |
| 35 // uniforms, varyings, textures, etc | 35 // uniforms, varyings, textures, etc |
| 36 SkAutoTDelete<GrGLProgramBuilder> builder(new GrGLProgramBuilder(gpu, args))
; | 36 GrGLProgramBuilder builder(gpu, args); |
| 37 | |
| 38 GrGLProgramBuilder* pb = builder.get(); | |
| 39 | 37 |
| 40 // TODO: Once all stages can handle taking a float or vec4 and correctly han
dling them we can | 38 // TODO: Once all stages can handle taking a float or vec4 and correctly han
dling them we can |
| 41 // seed correctly here | 39 // seed correctly here |
| 42 GrGLSLExpr4 inputColor; | 40 GrGLSLExpr4 inputColor; |
| 43 GrGLSLExpr4 inputCoverage; | 41 GrGLSLExpr4 inputCoverage; |
| 44 | 42 |
| 45 if (!pb->emitAndInstallProcs(&inputColor, | 43 if (!builder.emitAndInstallProcs(&inputColor, |
| 46 &inputCoverage, | 44 &inputCoverage, |
| 47 gpu->glCaps().maxFragmentTextureUnits())) { | 45 gpu->glCaps().maxFragmentTextureUnits())) { |
| 48 pb->cleanupFragmentProcessors(); | 46 builder.cleanupFragmentProcessors(); |
| 49 return nullptr; | 47 return nullptr; |
| 50 } | 48 } |
| 51 | 49 |
| 52 return pb->finalize(); | 50 return builder.finalize(); |
| 53 } | 51 } |
| 54 | 52 |
| 55 ///////////////////////////////////////////////////////////////////////////// | 53 ///////////////////////////////////////////////////////////////////////////// |
| 56 | 54 |
| 57 GrGLProgramBuilder::GrGLProgramBuilder(GrGLGpu* gpu, const DrawArgs& args) | 55 GrGLProgramBuilder::GrGLProgramBuilder(GrGLGpu* gpu, const DrawArgs& args) |
| 58 : INHERITED(args) | 56 : INHERITED(args) |
| 59 , fGpu(gpu) | 57 , fGpu(gpu) |
| 60 , fSamplerUniforms(4) | 58 , fSamplerUniforms(4) |
| 61 , fVaryingHandler(this) | 59 , fVaryingHandler(this) |
| 62 , fUniformHandler(this) { | 60 , fUniformHandler(this) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 fUniformHandles, | 265 fUniformHandles, |
| 268 programID, | 266 programID, |
| 269 fUniformHandler.fUniforms, | 267 fUniformHandler.fUniforms, |
| 270 fVaryingHandler.fPathProcVaryingInfos, | 268 fVaryingHandler.fPathProcVaryingInfos, |
| 271 fGeometryProcessor, | 269 fGeometryProcessor, |
| 272 fXferProcessor, | 270 fXferProcessor, |
| 273 fFragmentProcessors, | 271 fFragmentProcessors, |
| 274 &fSamplerUniforms); | 272 &fSamplerUniforms); |
| 275 } | 273 } |
| 276 | 274 |
| OLD | NEW |