| 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" |
| 11 #include "GrCoordTransform.h" | 11 #include "GrCoordTransform.h" |
| 12 #include "GrDrawEffect.h" | 12 #include "GrDrawEffect.h" |
| 13 #include "GrGpuGL.h" | 13 #include "GrGpuGL.h" |
| 14 #include "GrTexture.h" | 14 #include "GrTexture.h" |
| 15 #include "SkRTConf.h" | 15 #include "SkRTConf.h" |
| 16 #include "SkTrace.h" | 16 #include "SkTraceEvent.h" |
| 17 | 17 |
| 18 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) | 18 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) |
| 19 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) | 19 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) |
| 20 | 20 |
| 21 // number of each input/output type in a single allocation block | 21 // number of each input/output type in a single allocation block |
| 22 static const int kVarsPerBlock = 8; | 22 static const int kVarsPerBlock = 8; |
| 23 | 23 |
| 24 // except FS outputs where we expect 2 at most. | 24 // except FS outputs where we expect 2 at most. |
| 25 static const int kMaxFSOutputs = 2; | 25 static const int kMaxFSOutputs = 2; |
| 26 | 26 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 if (!fHasSecondaryOutput) { | 563 if (!fHasSecondaryOutput) { |
| 564 fFSOutputs.push_back().set(kVec4f_GrSLType, | 564 fFSOutputs.push_back().set(kVec4f_GrSLType, |
| 565 GrGLShaderVar::kOut_TypeModifier, | 565 GrGLShaderVar::kOut_TypeModifier, |
| 566 dual_source_output_name()); | 566 dual_source_output_name()); |
| 567 fHasSecondaryOutput = true; | 567 fHasSecondaryOutput = true; |
| 568 } | 568 } |
| 569 return dual_source_output_name(); | 569 return dual_source_output_name(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 bool GrGLShaderBuilder::finish(GrGLuint* outProgramId) { | 572 bool GrGLShaderBuilder::finish(GrGLuint* outProgramId) { |
| 573 SK_TRACE_EVENT0("GrGLShaderBuilder::finish"); | |
| 574 | |
| 575 GrGLuint programId = 0; | 573 GrGLuint programId = 0; |
| 576 GL_CALL_RET(programId, CreateProgram()); | 574 GL_CALL_RET(programId, CreateProgram()); |
| 577 if (!programId) { | 575 if (!programId) { |
| 578 return false; | 576 return false; |
| 579 } | 577 } |
| 580 | 578 |
| 581 SkTDArray<GrGLuint> shadersToDelete; | 579 SkTDArray<GrGLuint> shadersToDelete; |
| 582 | 580 |
| 583 if (!this->compileAndAttachShaders(programId, &shadersToDelete)) { | 581 if (!this->compileAndAttachShaders(programId, &shadersToDelete)) { |
| 584 GL_CALL(DeleteProgram(programId)); | 582 GL_CALL(DeleteProgram(programId)); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 GrGLSLExpr4* inOutFSColor) { | 990 GrGLSLExpr4* inOutFSColor) { |
| 993 | 991 |
| 994 GrGLTexGenProgramEffectsBuilder texGenEffectsBuilder(this, effectCnt); | 992 GrGLTexGenProgramEffectsBuilder texGenEffectsBuilder(this, effectCnt); |
| 995 this->INHERITED::createAndEmitEffects(&texGenEffectsBuilder, | 993 this->INHERITED::createAndEmitEffects(&texGenEffectsBuilder, |
| 996 effectStages, | 994 effectStages, |
| 997 effectKeys, | 995 effectKeys, |
| 998 effectCnt, | 996 effectCnt, |
| 999 inOutFSColor); | 997 inOutFSColor); |
| 1000 return texGenEffectsBuilder.finish(); | 998 return texGenEffectsBuilder.finish(); |
| 1001 } | 999 } |
| OLD | NEW |