| 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 "gl/GrGLGeometryProcessor.h" | |
| 11 #include "gl/GrGLGpu.h" | |
| 12 #include "gl/GrGLPathProcessor.h" | |
| 13 #include "gl/GrGLProgram.h" | |
| 14 #include "gl/GrGLSLPrettyPrint.h" | |
| 15 #include "gl/GrGLUniformHandle.h" | |
| 16 #include "gl/GrGLXferProcessor.h" | |
| 17 #include "glsl/GrGLSLCaps.h" | |
| 18 #include "GrAutoLocaleSetter.h" | 10 #include "GrAutoLocaleSetter.h" |
| 19 #include "GrCoordTransform.h" | 11 #include "GrCoordTransform.h" |
| 20 #include "GrGLPathProgramBuilder.h" | 12 #include "GrGLPathProgramBuilder.h" |
| 21 #include "GrGLProgramBuilder.h" | 13 #include "GrGLProgramBuilder.h" |
| 22 #include "GrTexture.h" | 14 #include "GrTexture.h" |
| 23 #include "SkRTConf.h" | 15 #include "SkRTConf.h" |
| 24 #include "SkTraceEvent.h" | 16 #include "SkTraceEvent.h" |
| 17 #include "gl/GrGLGeometryProcessor.h" |
| 18 #include "gl/GrGLGpu.h" |
| 19 #include "gl/GrGLPathProcessor.h" |
| 20 #include "gl/GrGLProgram.h" |
| 21 #include "gl/GrGLSLPrettyPrint.h" |
| 22 #include "gl/GrGLXferProcessor.h" |
| 23 #include "glsl/GrGLSLCaps.h" |
| 25 | 24 |
| 26 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) | 25 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) |
| 27 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) | 26 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) |
| 28 | 27 |
| 29 const int GrGLProgramBuilder::kVarsPerBlock = 8; | 28 const int GrGLProgramBuilder::kVarsPerBlock = 8; |
| 30 | 29 |
| 31 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
u) { | 30 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
u) { |
| 32 GrAutoLocaleSetter als("C"); | 31 GrAutoLocaleSetter als("C"); |
| 33 | 32 |
| 34 // create a builder. This will be handed off to effects so they can use it
to add | 33 // create a builder. This will be handed off to effects so they can use it
to add |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 prefix = '\0'; | 154 prefix = '\0'; |
| 156 } | 155 } |
| 157 this->nameVariable(uni.fVariable.accessName(), prefix, name); | 156 this->nameVariable(uni.fVariable.accessName(), prefix, name); |
| 158 uni.fVariable.setArrayCount(count); | 157 uni.fVariable.setArrayCount(count); |
| 159 uni.fVisibility = visibility; | 158 uni.fVisibility = visibility; |
| 160 uni.fVariable.setPrecision(precision); | 159 uni.fVariable.setPrecision(precision); |
| 161 | 160 |
| 162 if (outName) { | 161 if (outName) { |
| 163 *outName = uni.fVariable.c_str(); | 162 *outName = uni.fVariable.c_str(); |
| 164 } | 163 } |
| 165 return GrGLProgramDataManager::UniformHandle::CreateFromUniformIndex(fUnifor
ms.count() - 1); | 164 return GrGLProgramDataManager::UniformHandle(fUniforms.count() - 1); |
| 166 } | 165 } |
| 167 | 166 |
| 168 void GrGLProgramBuilder::appendUniformDecls(ShaderVisibility visibility, | 167 void GrGLProgramBuilder::appendUniformDecls(ShaderVisibility visibility, |
| 169 SkString* out) const { | 168 SkString* out) const { |
| 170 for (int i = 0; i < fUniforms.count(); ++i) { | 169 for (int i = 0; i < fUniforms.count(); ++i) { |
| 171 if (fUniforms[i].fVisibility & visibility) { | 170 if (fUniforms[i].fVisibility & visibility) { |
| 172 fUniforms[i].fVariable.appendDecl(this->ctxInfo(), out); | 171 fUniforms[i].fVariable.appendDecl(this->ctxInfo(), out); |
| 173 out->append(";\n"); | 172 out->append(";\n"); |
| 174 } | 173 } |
| 175 } | 174 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 495 } |
| 497 | 496 |
| 498 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 497 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 499 | 498 |
| 500 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 499 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
| 501 int numProcs = fProcs.count(); | 500 int numProcs = fProcs.count(); |
| 502 for (int i = 0; i < numProcs; ++i) { | 501 for (int i = 0; i < numProcs; ++i) { |
| 503 delete fProcs[i]; | 502 delete fProcs[i]; |
| 504 } | 503 } |
| 505 } | 504 } |
| OLD | NEW |