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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 append_gr_fp_coord_transforms(processor->childProcessor(i), procCoords); | 190 append_gr_fp_coord_transforms(processor->childProcessor(i), procCoords); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
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 SkSTArray<8, GrGLProcessor::TransformedCoordsArray> outCoords; | 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 SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTransfor
ms.push_back(); | |
204 | 203 |
205 append_gr_fp_coord_transforms(processor, &procCoords); | 204 if (!primProc.hasTransformedLocalCoords()) { |
| 205 SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTran
sforms.push_back(); |
| 206 |
| 207 append_gr_fp_coord_transforms(processor, &procCoords); |
| 208 } |
206 | 209 |
207 totalTextures += processor->numTexturesIncludeChildProcs(); | 210 totalTextures += processor->numTexturesIncludeChildProcs(); |
208 if (totalTextures >= maxTextureUnits) { | 211 if (totalTextures >= maxTextureUnits) { |
209 GrCapsDebugf(fGpu->caps(), "Program would use too many texture units
\n"); | 212 GrCapsDebugf(fGpu->caps(), "Program would use too many texture units
\n"); |
210 return false; | 213 return false; |
211 } | 214 } |
212 } | 215 } |
213 | 216 |
214 this->emitAndInstallProc(primProc, inputColor, inputCoverage); | 217 this->emitAndInstallProc(primProc, inputColor, inputCoverage); |
215 | 218 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } | 511 } |
509 | 512 |
510 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 513 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
511 | 514 |
512 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 515 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
513 int numProcs = fProcs.count(); | 516 int numProcs = fProcs.count(); |
514 for (int e = 0; e < numProcs; ++e) { | 517 for (int e = 0; e < numProcs; ++e) { |
515 SkDELETE(fProcs[e]); | 518 SkDELETE(fProcs[e]); |
516 } | 519 } |
517 } | 520 } |
OLD | NEW |