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" |
11 #include "GrCoordTransform.h" | 11 #include "GrCoordTransform.h" |
12 #include "GrGLProgramBuilder.h" | 12 #include "GrGLProgramBuilder.h" |
13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
14 #include "SkRTConf.h" | 14 #include "SkRTConf.h" |
15 #include "SkTraceEvent.h" | 15 #include "SkTraceEvent.h" |
16 #include "gl/GrGLGeometryProcessor.h" | 16 #include "gl/GrGLGeometryProcessor.h" |
17 #include "gl/GrGLGpu.h" | 17 #include "gl/GrGLGpu.h" |
18 #include "gl/GrGLProgram.h" | 18 #include "gl/GrGLProgram.h" |
19 #include "gl/GrGLSLPrettyPrint.h" | 19 #include "gl/GrGLSLPrettyPrint.h" |
20 #include "gl/GrGLXferProcessor.h" | |
21 #include "gl/builders/GrGLShaderStringBuilder.h" | 20 #include "gl/builders/GrGLShaderStringBuilder.h" |
22 #include "glsl/GrGLSLCaps.h" | 21 #include "glsl/GrGLSLCaps.h" |
23 #include "glsl/GrGLSLFragmentProcessor.h" | 22 #include "glsl/GrGLSLFragmentProcessor.h" |
24 #include "glsl/GrGLSLProgramDataManager.h" | 23 #include "glsl/GrGLSLProgramDataManager.h" |
25 #include "glsl/GrGLSLTextureSampler.h" | 24 #include "glsl/GrGLSLTextureSampler.h" |
| 25 #include "glsl/GrGLSLXferProcessor.h" |
26 | 26 |
27 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) | 27 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) |
28 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) | 28 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) |
29 | 29 |
30 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
u) { | 30 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
u) { |
31 GrAutoLocaleSetter als("C"); | 31 GrAutoLocaleSetter als("C"); |
32 | 32 |
33 // 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 |
34 // uniforms, varyings, textures, etc | 34 // uniforms, varyings, textures, etc |
35 SkAutoTDelete<GrGLProgramBuilder> builder(new GrGLProgramBuilder(gpu, args))
; | 35 SkAutoTDelete<GrGLProgramBuilder> builder(new GrGLProgramBuilder(gpu, args))
; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 fFS.enableCustomOutput(); | 313 fFS.enableCustomOutput(); |
314 } | 314 } |
315 | 315 |
316 SkString openBrace; | 316 SkString openBrace; |
317 openBrace.printf("{ // Xfer Processor: %s\n", xp.name()); | 317 openBrace.printf("{ // Xfer Processor: %s\n", xp.name()); |
318 fFS.codeAppend(openBrace.c_str()); | 318 fFS.codeAppend(openBrace.c_str()); |
319 | 319 |
320 SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures()); | 320 SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures()); |
321 this->emitSamplers(xp, &samplers, fXferProcessor); | 321 this->emitSamplers(xp, &samplers, fXferProcessor); |
322 | 322 |
323 GrGLXferProcessor::EmitArgs args(this, xp, colorIn.c_str(), coverageIn.c_str
(), | 323 GrGLSLXferProcessor::EmitArgs args(this, xp, colorIn.c_str(), coverageIn.c_s
tr(), |
324 fFS.getPrimaryColorOutputName(), | 324 fFS.getPrimaryColorOutputName(), |
325 fFS.getSecondaryColorOutputName(), samplers
); | 325 fFS.getSecondaryColorOutputName(), samplers
); |
326 fXferProcessor->fGLProc->emitCode(args); | 326 fXferProcessor->fGLProc->emitCode(args); |
327 | 327 |
328 // We have to check that effects and the code they emit are consistent, ie i
f an effect | 328 // We have to check that effects and the code they emit are consistent, ie i
f an effect |
329 // asks for dst color, then the emit code needs to follow suit | 329 // asks for dst color, then the emit code needs to follow suit |
330 verify(xp); | 330 verify(xp); |
331 fFS.codeAppend("}"); | 331 fFS.codeAppend("}"); |
332 } | 332 } |
333 | 333 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 536 } |
537 | 537 |
538 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 538 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
539 | 539 |
540 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 540 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
541 int numProcs = fProcs.count(); | 541 int numProcs = fProcs.count(); |
542 for (int i = 0; i < numProcs; ++i) { | 542 for (int i = 0; i < numProcs; ++i) { |
543 delete fProcs[i]; | 543 delete fProcs[i]; |
544 } | 544 } |
545 } | 545 } |
OLD | NEW |