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" | 10 #include "gl/GrGLGeometryProcessor.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 bool GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr
4* inputCoverage) { | 194 bool GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr
4* inputCoverage) { |
195 // First we loop over all of the installed processors and collect coord tran
sforms. These will | 195 // First we loop over all of the installed processors and collect coord tran
sforms. These will |
196 // be sent to the GrGLPrimitiveProcessor in its emitCode function | 196 // be sent to the GrGLPrimitiveProcessor in its emitCode function |
197 const GrPrimitiveProcessor& primProc = this->primitiveProcessor(); | 197 const GrPrimitiveProcessor& primProc = this->primitiveProcessor(); |
198 int totalTextures = primProc.numTextures(); | 198 int totalTextures = primProc.numTextures(); |
199 const int maxTextureUnits = fGpu->glCaps().maxFragmentTextureUnits(); | 199 const int maxTextureUnits = fGpu->glCaps().maxFragmentTextureUnits(); |
200 | 200 |
201 for (int i = 0; i < this->pipeline().numFragmentStages(); i++) { | 201 for (int i = 0; i < this->pipeline().numFragmentStages(); i++) { |
202 const GrFragmentProcessor* processor = this->pipeline().getFragmentStage
(i).processor(); | 202 const GrFragmentProcessor* processor = this->pipeline().getFragmentStage
(i).processor(); |
203 | 203 |
204 if (!primProc.hasTransformedLocalCoords()) { | 204 SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTransfor
ms.push_back(); |
205 SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTran
sforms.push_back(); | 205 append_gr_fp_coord_transforms(processor, &procCoords); |
206 | |
207 append_gr_fp_coord_transforms(processor, &procCoords); | |
208 } | |
209 | 206 |
210 totalTextures += processor->numTexturesIncludeChildProcs(); | 207 totalTextures += processor->numTexturesIncludeChildProcs(); |
211 if (totalTextures >= maxTextureUnits) { | 208 if (totalTextures >= maxTextureUnits) { |
212 GrCapsDebugf(fGpu->caps(), "Program would use too many texture units
\n"); | 209 GrCapsDebugf(fGpu->caps(), "Program would use too many texture units
\n"); |
213 return false; | 210 return false; |
214 } | 211 } |
215 } | 212 } |
216 | 213 |
217 this->emitAndInstallProc(primProc, inputColor, inputCoverage); | 214 this->emitAndInstallProc(primProc, inputColor, inputCoverage); |
218 | 215 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 508 } |
512 | 509 |
513 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 510 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
514 | 511 |
515 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 512 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
516 int numProcs = fProcs.count(); | 513 int numProcs = fProcs.count(); |
517 for (int e = 0; e < numProcs; ++e) { | 514 for (int e = 0; e < numProcs; ++e) { |
518 SkDELETE(fProcs[e]); | 515 SkDELETE(fProcs[e]); |
519 } | 516 } |
520 } | 517 } |
OLD | NEW |