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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 this->fsCodeAppend(";\n\n"); | 158 this->fsCodeAppend(";\n\n"); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 bool GrGLShaderBuilder::enableFeature(GLSLFeature feature) { | 162 bool GrGLShaderBuilder::enableFeature(GLSLFeature feature) { |
163 switch (feature) { | 163 switch (feature) { |
164 case kStandardDerivatives_GLSLFeature: | 164 case kStandardDerivatives_GLSLFeature: |
165 if (!fCtxInfo.caps()->shaderDerivativeSupport()) { | 165 if (!fCtxInfo.caps()->shaderDerivativeSupport()) { |
166 return false; | 166 return false; |
167 } | 167 } |
168 if (kES2_GrGLBinding == fCtxInfo.binding()) { | 168 if (kES_GrGLBinding == fCtxInfo.binding()) { |
169 this->addFSFeature(1 << kStandardDerivatives_GLSLFeature, | 169 this->addFSFeature(1 << kStandardDerivatives_GLSLFeature, |
170 "GL_OES_standard_derivatives"); | 170 "GL_OES_standard_derivatives"); |
171 } | 171 } |
172 return true; | 172 return true; |
173 default: | 173 default: |
174 GrCrash("Unexpected GLSLFeature requested."); | 174 GrCrash("Unexpected GLSLFeature requested."); |
175 return false; | 175 return false; |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 fFSFunctions.append(body); | 545 fFSFunctions.append(body); |
546 fFSFunctions.append("}\n\n"); | 546 fFSFunctions.append("}\n\n"); |
547 } | 547 } |
548 | 548 |
549 namespace { | 549 namespace { |
550 | 550 |
551 inline void append_default_precision_qualifier(GrGLShaderVar::Precision p, | 551 inline void append_default_precision_qualifier(GrGLShaderVar::Precision p, |
552 GrGLBinding binding, | 552 GrGLBinding binding, |
553 SkString* str) { | 553 SkString* str) { |
554 // Desktop GLSL has added precision qualifiers but they don't do anything. | 554 // Desktop GLSL has added precision qualifiers but they don't do anything. |
555 if (kES2_GrGLBinding == binding) { | 555 if (kES_GrGLBinding == binding) { |
556 switch (p) { | 556 switch (p) { |
557 case GrGLShaderVar::kHigh_Precision: | 557 case GrGLShaderVar::kHigh_Precision: |
558 str->append("precision highp float;\n"); | 558 str->append("precision highp float;\n"); |
559 break; | 559 break; |
560 case GrGLShaderVar::kMedium_Precision: | 560 case GrGLShaderVar::kMedium_Precision: |
561 str->append("precision mediump float;\n"); | 561 str->append("precision mediump float;\n"); |
562 break; | 562 break; |
563 case GrGLShaderVar::kLow_Precision: | 563 case GrGLShaderVar::kLow_Precision: |
564 str->append("precision lowp float;\n"); | 564 str->append("precision lowp float;\n"); |
565 break; | 565 break; |
(...skipping 154 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 |