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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 void GrGLShaderBuilder::appendUniformDecls(ShaderType stype, SkString* out) cons
t { | 582 void GrGLShaderBuilder::appendUniformDecls(ShaderType stype, SkString* out) cons
t { |
583 for (int i = 0; i < fUniforms.count(); ++i) { | 583 for (int i = 0; i < fUniforms.count(); ++i) { |
584 if (fUniforms[i].fVisibility & stype) { | 584 if (fUniforms[i].fVisibility & stype) { |
585 fUniforms[i].fVariable.appendDecl(fCtxInfo, out); | 585 fUniforms[i].fVariable.appendDecl(fCtxInfo, out); |
586 out->append(";\n"); | 586 out->append(";\n"); |
587 } | 587 } |
588 } | 588 } |
589 } | 589 } |
590 | 590 |
591 void GrGLShaderBuilder::getShader(ShaderType type, SkString* shaderStr) const { | 591 void GrGLShaderBuilder::getShader(ShaderType type, SkString* shaderStr) const { |
592 const char* version = GrGetGLSLVersionDecl(fCtxInfo.binding(), fCtxInfo.glsl
Generation()); | 592 const char* version = GrGetGLSLVersionDecl(fCtxInfo); |
593 | 593 |
594 switch (type) { | 594 switch (type) { |
595 case kVertex_ShaderType: | 595 case kVertex_ShaderType: |
596 *shaderStr = version; | 596 *shaderStr = version; |
597 this->appendUniformDecls(kVertex_ShaderType, shaderStr); | 597 this->appendUniformDecls(kVertex_ShaderType, shaderStr); |
598 this->appendDecls(fVSAttrs, shaderStr); | 598 this->appendDecls(fVSAttrs, shaderStr); |
599 this->appendDecls(fVSOutputs, shaderStr); | 599 this->appendDecls(fVSOutputs, shaderStr); |
600 shaderStr->append("void main() {\n"); | 600 shaderStr->append("void main() {\n"); |
601 shaderStr->append(fVSCode); | 601 shaderStr->append(fVSCode); |
602 shaderStr->append("}\n"); | 602 shaderStr->append("}\n"); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 for (const AttributePair* attrib = this->getEffectAttributes().begin(); | 720 for (const AttributePair* attrib = this->getEffectAttributes().begin(); |
721 attrib != attribEnd; | 721 attrib != attribEnd; |
722 ++attrib) { | 722 ++attrib) { |
723 if (attrib->fIndex == attributeIndex) { | 723 if (attrib->fIndex == attributeIndex) { |
724 return &attrib->fName; | 724 return &attrib->fName; |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 return NULL; | 728 return NULL; |
729 } | 729 } |
OLD | NEW |