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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (outName) { | 152 if (outName) { |
153 *outName = uni.fVariable.c_str(); | 153 *outName = uni.fVariable.c_str(); |
154 } | 154 } |
155 return GrGLProgramDataManager::UniformHandle(fUniforms.count() - 1); | 155 return GrGLProgramDataManager::UniformHandle(fUniforms.count() - 1); |
156 } | 156 } |
157 | 157 |
158 void GrGLProgramBuilder::appendUniformDecls(ShaderVisibility visibility, | 158 void GrGLProgramBuilder::appendUniformDecls(ShaderVisibility visibility, |
159 SkString* out) const { | 159 SkString* out) const { |
160 for (int i = 0; i < fUniforms.count(); ++i) { | 160 for (int i = 0; i < fUniforms.count(); ++i) { |
161 if (fUniforms[i].fVisibility & visibility) { | 161 if (fUniforms[i].fVisibility & visibility) { |
162 fUniforms[i].fVariable.appendDecl(this->ctxInfo(), out); | 162 fUniforms[i].fVariable.appendDecl(this->glslCaps(), out); |
163 out->append(";\n"); | 163 out->append(";\n"); |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 const GrGLContextInfo& GrGLProgramBuilder::ctxInfo() const { | 168 const GrGLContextInfo& GrGLProgramBuilder::ctxInfo() const { |
169 return fGpu->ctxInfo(); | 169 return fGpu->ctxInfo(); |
170 } | 170 } |
171 | 171 |
| 172 const GrGLSLCaps* GrGLProgramBuilder::glslCaps() const { |
| 173 return this->ctxInfo().caps()->glslCaps(); |
| 174 } |
| 175 |
172 bool GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr
4* inputCoverage) { | 176 bool GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr
4* inputCoverage) { |
173 // First we loop over all of the installed processors and collect coord tran
sforms. These will | 177 // First we loop over all of the installed processors and collect coord tran
sforms. These will |
174 // be sent to the GrGLPrimitiveProcessor in its emitCode function | 178 // be sent to the GrGLPrimitiveProcessor in its emitCode function |
175 const GrPrimitiveProcessor& primProc = this->primitiveProcessor(); | 179 const GrPrimitiveProcessor& primProc = this->primitiveProcessor(); |
176 int totalTextures = primProc.numTextures(); | 180 int totalTextures = primProc.numTextures(); |
177 const int maxTextureUnits = fGpu->glCaps().maxFragmentTextureUnits(); | 181 const int maxTextureUnits = fGpu->glCaps().maxFragmentTextureUnits(); |
178 | 182 |
179 for (int i = 0; i < this->pipeline().numFragmentProcessors(); i++) { | 183 for (int i = 0; i < this->pipeline().numFragmentProcessors(); i++) { |
180 const GrFragmentProcessor& processor = this->pipeline().getFragmentProce
ssor(i); | 184 const GrFragmentProcessor& processor = this->pipeline().getFragmentProce
ssor(i); |
181 | 185 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 518 } |
515 | 519 |
516 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 520 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
517 | 521 |
518 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 522 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
519 int numProcs = fProcs.count(); | 523 int numProcs = fProcs.count(); |
520 for (int i = 0; i < numProcs; ++i) { | 524 for (int i = 0; i < numProcs; ++i) { |
521 delete fProcs[i]; | 525 delete fProcs[i]; |
522 } | 526 } |
523 } | 527 } |
OLD | NEW |