| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "gl/GrGLShaderBuilder.h" | 8 #include "gl/GrGLShaderBuilder.h" |
| 9 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
| 10 #include "gl/GrGLUniformHandle.h" | 10 #include "gl/GrGLUniformHandle.h" |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 if (!programId) { | 581 if (!programId) { |
| 582 return false; | 582 return false; |
| 583 } | 583 } |
| 584 | 584 |
| 585 if (!this->compileAndAttachShaders(programId)) { | 585 if (!this->compileAndAttachShaders(programId)) { |
| 586 GL_CALL(DeleteProgram(programId)); | 586 GL_CALL(DeleteProgram(programId)); |
| 587 return false; | 587 return false; |
| 588 } | 588 } |
| 589 | 589 |
| 590 this->bindProgramLocations(programId); | 590 this->bindProgramLocations(programId); |
| 591 if (fUniformManager.isUsingBindUniform()) { |
| 592 fUniformManager.getUniformLocations(programId, fUniforms); |
| 593 } |
| 591 | 594 |
| 592 GL_CALL(LinkProgram(programId)); | 595 GL_CALL(LinkProgram(programId)); |
| 593 | 596 |
| 594 // Calling GetProgramiv is expensive in Chromium. Assume success in release
builds. | 597 // Calling GetProgramiv is expensive in Chromium. Assume success in release
builds. |
| 595 bool checkLinked = !fGpu->ctxInfo().isChromium(); | 598 bool checkLinked = !fGpu->ctxInfo().isChromium(); |
| 596 #ifdef SK_DEBUG | 599 #ifdef SK_DEBUG |
| 597 checkLinked = true; | 600 checkLinked = true; |
| 598 #endif | 601 #endif |
| 599 if (checkLinked) { | 602 if (checkLinked) { |
| 600 GrGLint linked = GR_GL_INIT_ZERO; | 603 GrGLint linked = GR_GL_INIT_ZERO; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 612 &length, | 615 &length, |
| 613 (char*)log.get())); | 616 (char*)log.get())); |
| 614 GrPrintf((char*)log.get()); | 617 GrPrintf((char*)log.get()); |
| 615 } | 618 } |
| 616 SkDEBUGFAIL("Error linking program"); | 619 SkDEBUGFAIL("Error linking program"); |
| 617 GL_CALL(DeleteProgram(programId)); | 620 GL_CALL(DeleteProgram(programId)); |
| 618 return false; | 621 return false; |
| 619 } | 622 } |
| 620 } | 623 } |
| 621 | 624 |
| 622 fUniformManager.getUniformLocations(programId, fUniforms); | 625 if (!fUniformManager.isUsingBindUniform()) { |
| 626 fUniformManager.getUniformLocations(programId, fUniforms); |
| 627 } |
| 623 *outProgramId = programId; | 628 *outProgramId = programId; |
| 624 return true; | 629 return true; |
| 625 } | 630 } |
| 626 | 631 |
| 627 // Compiles a GL shader, attaches it to a program, and releases the shader's ref
erence. | 632 // Compiles a GL shader, attaches it to a program, and releases the shader's ref
erence. |
| 628 // (That way there's no need to hang on to the GL shader id and delete it later.
) | 633 // (That way there's no need to hang on to the GL shader id and delete it later.
) |
| 629 static bool attach_shader(const GrGLContext& glCtx, | 634 static bool attach_shader(const GrGLContext& glCtx, |
| 630 GrGLuint programId, | 635 GrGLuint programId, |
| 631 GrGLenum type, | 636 GrGLenum type, |
| 632 const SkString& shaderSrc) { | 637 const SkString& shaderSrc) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 GrGLSLExpr4* inOutFSColor) { | 977 GrGLSLExpr4* inOutFSColor) { |
| 973 | 978 |
| 974 GrGLTexGenProgramEffectsBuilder texGenEffectsBuilder(this, effectCnt); | 979 GrGLTexGenProgramEffectsBuilder texGenEffectsBuilder(this, effectCnt); |
| 975 this->INHERITED::createAndEmitEffects(&texGenEffectsBuilder, | 980 this->INHERITED::createAndEmitEffects(&texGenEffectsBuilder, |
| 976 effectStages, | 981 effectStages, |
| 977 effectKeys, | 982 effectKeys, |
| 978 effectCnt, | 983 effectCnt, |
| 979 inOutFSColor); | 984 inOutFSColor); |
| 980 return texGenEffectsBuilder.finish(); | 985 return texGenEffectsBuilder.finish(); |
| 981 } | 986 } |
| OLD | NEW |