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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 GrGLSLExpr4 inputColor; | 67 GrGLSLExpr4 inputColor; |
68 GrGLSLExpr4 inputCoverage; | 68 GrGLSLExpr4 inputCoverage; |
69 | 69 |
70 pb->emitAndInstallProcs(&inputColor, &inputCoverage); | 70 pb->emitAndInstallProcs(&inputColor, &inputCoverage); |
71 | 71 |
72 return pb->finalize(); | 72 return pb->finalize(); |
73 } | 73 } |
74 | 74 |
75 GrGLProgramBuilder* GrGLProgramBuilder::CreateProgramBuilder(const DrawArgs& arg
s, | 75 GrGLProgramBuilder* GrGLProgramBuilder::CreateProgramBuilder(const DrawArgs& arg
s, |
76 GrGLGpu* gpu) { | 76 GrGLGpu* gpu) { |
77 if (GrGpu::IsPathRenderingDrawType(args.fOptState->drawType())) { | 77 if (GrGpu::IsPathRenderingDrawType(args.fDrawType)) { |
78 SkASSERT(gpu->glCaps().pathRenderingSupport() && | 78 SkASSERT(gpu->glCaps().pathRenderingSupport() && |
79 !args.fPrimitiveProcessor->willUseGeoShader() && | 79 !args.fPrimitiveProcessor->willUseGeoShader() && |
80 args.fPrimitiveProcessor->numAttribs() == 0); | 80 args.fPrimitiveProcessor->numAttribs() == 0); |
81 return SkNEW_ARGS(GrGLNvprProgramBuilder, (gpu, args)); | 81 return SkNEW_ARGS(GrGLNvprProgramBuilder, (gpu, args)); |
82 } else { | 82 } else { |
83 return SkNEW_ARGS(GrGLProgramBuilder, (gpu, args)); | 83 return SkNEW_ARGS(GrGLProgramBuilder, (gpu, args)); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 ///////////////////////////////////////////////////////////////////////////// | 87 ///////////////////////////////////////////////////////////////////////////// |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 GL_CALL_RET(programID, CreateProgram()); | 389 GL_CALL_RET(programID, CreateProgram()); |
390 if (0 == programID) { | 390 if (0 == programID) { |
391 return NULL; | 391 return NULL; |
392 } | 392 } |
393 | 393 |
394 // compile shaders and bind attributes / uniforms | 394 // compile shaders and bind attributes / uniforms |
395 SkTDArray<GrGLuint> shadersToDelete; | 395 SkTDArray<GrGLuint> shadersToDelete; |
396 | 396 |
397 // Legacy nvpr will not compile with a vertex shader, but newer nvpr require
s a dummy vertex | 397 // Legacy nvpr will not compile with a vertex shader, but newer nvpr require
s a dummy vertex |
398 // shader | 398 // shader |
399 bool useNvpr = GrGpu::IsPathRenderingDrawType(this->optState().drawType()); | 399 bool useNvpr = GrGpu::IsPathRenderingDrawType(this->drawType()); |
400 if (!(useNvpr && fGpu->glCaps().nvprSupport() == GrGLCaps::kLegacy_NvprSuppo
rt)) { | 400 if (!(useNvpr && fGpu->glCaps().nvprSupport() == GrGLCaps::kLegacy_NvprSuppo
rt)) { |
401 if (!fVS.compileAndAttachShaders(programID, &shadersToDelete)) { | 401 if (!fVS.compileAndAttachShaders(programID, &shadersToDelete)) { |
402 this->cleanupProgram(programID, shadersToDelete); | 402 this->cleanupProgram(programID, shadersToDelete); |
403 return NULL; | 403 return NULL; |
404 } | 404 } |
405 | 405 |
406 // Non fixed function NVPR actually requires a vertex shader to compile | 406 // Non fixed function NVPR actually requires a vertex shader to compile |
407 if (!useNvpr) { | 407 if (!useNvpr) { |
408 fVS.bindVertexAttributes(programID); | 408 fVS.bindVertexAttributes(programID); |
409 } | 409 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 } | 495 } |
496 | 496 |
497 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 497 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
498 | 498 |
499 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 499 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
500 int numProcs = fProcs.count(); | 500 int numProcs = fProcs.count(); |
501 for (int e = 0; e < numProcs; ++e) { | 501 for (int e = 0; e < numProcs; ++e) { |
502 SkDELETE(fProcs[e]); | 502 SkDELETE(fProcs[e]); |
503 } | 503 } |
504 } | 504 } |
OLD | NEW |