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 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
10 #include "gl/GrGLSLPrettyPrint.h" | 10 #include "gl/GrGLSLPrettyPrint.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (output->isValid()) { | 289 if (output->isValid()) { |
290 outColorName = output->c_str(); | 290 outColorName = output->c_str(); |
291 } else { | 291 } else { |
292 this->nameVariable(&outColorName, '\0', "output"); | 292 this->nameVariable(&outColorName, '\0', "output"); |
293 } | 293 } |
294 fFS.codeAppendf("vec4 %s;", outColorName.c_str()); | 294 fFS.codeAppendf("vec4 %s;", outColorName.c_str()); |
295 *output = outColorName; | 295 *output = outColorName; |
296 | 296 |
297 // Enclose custom code in a block to avoid namespace conflicts | 297 // Enclose custom code in a block to avoid namespace conflicts |
298 SkString openBrace; | 298 SkString openBrace; |
299 openBrace.printf("{ // Stage %d\n", fStageIndex); | 299 openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name()); |
300 fFS.codeAppend(openBrace.c_str()); | 300 fFS.codeAppend(openBrace.c_str()); |
301 | 301 |
302 this->emitAndInstallProc(proc, keyProvider.get(index), output->c_str(), | 302 this->emitAndInstallProc(proc, keyProvider.get(index), output->c_str(), |
303 input.isOnes() ? NULL : input.c_str()); | 303 input.isOnes() ? NULL : input.c_str()); |
304 | 304 |
305 fFS.codeAppend("}"); | 305 fFS.codeAppend("}"); |
306 } | 306 } |
307 | 307 |
308 void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentStage& fs, | 308 void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentStage& fs, |
309 const GrProcessorKey& key, | 309 const GrProcessorKey& key, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } | 522 } |
523 | 523 |
524 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 524 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
525 | 525 |
526 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 526 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
527 int numProcs = fProcs.count(); | 527 int numProcs = fProcs.count(); |
528 for (int e = 0; e < numProcs; ++e) { | 528 for (int e = 0; e < numProcs; ++e) { |
529 SkDELETE(fProcs[e]); | 529 SkDELETE(fProcs[e]); |
530 } | 530 } |
531 } | 531 } |
OLD | NEW |