| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // verify we can get a program id | 388 // verify we can get a program id |
| 389 GrGLuint programID; | 389 GrGLuint programID; |
| 390 GL_CALL_RET(programID, CreateProgram()); | 390 GL_CALL_RET(programID, CreateProgram()); |
| 391 if (0 == programID) { | 391 if (0 == programID) { |
| 392 return NULL; | 392 return NULL; |
| 393 } | 393 } |
| 394 | 394 |
| 395 // compile shaders and bind attributes / uniforms | 395 // compile shaders and bind attributes / uniforms |
| 396 SkTDArray<GrGLuint> shadersToDelete; | 396 SkTDArray<GrGLuint> shadersToDelete; |
| 397 | 397 |
| 398 // Legacy nvpr will not compile with a vertex shader, but newer nvpr require
s a dummy vertex | 398 if (!fVS.compileAndAttachShaders(programID, &shadersToDelete)) { |
| 399 // shader | 399 this->cleanupProgram(programID, shadersToDelete); |
| 400 return NULL; |
| 401 } |
| 402 |
| 403 // NVPR actually requires a vertex shader to compile |
| 400 bool useNvpr = primitiveProcessor().isPathRendering(); | 404 bool useNvpr = primitiveProcessor().isPathRendering(); |
| 401 if (!(useNvpr && fGpu->glCaps().nvprSupport() == GrGLCaps::kLegacy_NvprSuppo
rt)) { | 405 if (!useNvpr) { |
| 402 if (!fVS.compileAndAttachShaders(programID, &shadersToDelete)) { | 406 fVS.bindVertexAttributes(programID); |
| 403 this->cleanupProgram(programID, shadersToDelete); | |
| 404 return NULL; | |
| 405 } | |
| 406 | |
| 407 // Non fixed function NVPR actually requires a vertex shader to compile | |
| 408 if (!useNvpr) { | |
| 409 fVS.bindVertexAttributes(programID); | |
| 410 } | |
| 411 } | 407 } |
| 412 | 408 |
| 413 if (!fFS.compileAndAttachShaders(programID, &shadersToDelete)) { | 409 if (!fFS.compileAndAttachShaders(programID, &shadersToDelete)) { |
| 414 this->cleanupProgram(programID, shadersToDelete); | 410 this->cleanupProgram(programID, shadersToDelete); |
| 415 return NULL; | 411 return NULL; |
| 416 } | 412 } |
| 417 | 413 |
| 418 bool usingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation
!= NULL; | 414 bool usingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation
!= NULL; |
| 419 if (usingBindUniform) { | 415 if (usingBindUniform) { |
| 420 this->bindUniformLocations(programID); | 416 this->bindUniformLocations(programID); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 492 } |
| 497 | 493 |
| 498 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 494 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 499 | 495 |
| 500 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 496 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
| 501 int numProcs = fProcs.count(); | 497 int numProcs = fProcs.count(); |
| 502 for (int e = 0; e < numProcs; ++e) { | 498 for (int e = 0; e < numProcs; ++e) { |
| 503 SkDELETE(fProcs[e]); | 499 SkDELETE(fProcs[e]); |
| 504 } | 500 } |
| 505 } | 501 } |
| OLD | NEW |