Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 133413003: Rename GrGLBinding->GrGLStandard, no longer a bitfield (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: actually fix enum names? Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 fHasCustomColorOutput = true; 174 fHasCustomColorOutput = true;
175 } 175 }
176 } 176 }
177 177
178 bool GrGLShaderBuilder::enableFeature(GLSLFeature feature) { 178 bool GrGLShaderBuilder::enableFeature(GLSLFeature feature) {
179 switch (feature) { 179 switch (feature) {
180 case kStandardDerivatives_GLSLFeature: 180 case kStandardDerivatives_GLSLFeature:
181 if (!fGpu->glCaps().shaderDerivativeSupport()) { 181 if (!fGpu->glCaps().shaderDerivativeSupport()) {
182 return false; 182 return false;
183 } 183 }
184 if (kES_GrGLBinding == fGpu->glBinding()) { 184 if (kGLES_GrGLStandard == fGpu->glStandard()) {
185 this->addFSFeature(1 << kStandardDerivatives_GLSLFeature, 185 this->addFSFeature(1 << kStandardDerivatives_GLSLFeature,
186 "GL_OES_standard_derivatives"); 186 "GL_OES_standard_derivatives");
187 } 187 }
188 return true; 188 return true;
189 default: 189 default:
190 GrCrash("Unexpected GLSLFeature requested."); 190 GrCrash("Unexpected GLSLFeature requested.");
191 return false; 191 return false;
192 } 192 }
193 } 193 }
194 194
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 464 }
465 } 465 }
466 fFSFunctions.append(") {\n"); 466 fFSFunctions.append(") {\n");
467 fFSFunctions.append(body); 467 fFSFunctions.append(body);
468 fFSFunctions.append("}\n\n"); 468 fFSFunctions.append("}\n\n");
469 } 469 }
470 470
471 namespace { 471 namespace {
472 472
473 inline void append_default_precision_qualifier(GrGLShaderVar::Precision p, 473 inline void append_default_precision_qualifier(GrGLShaderVar::Precision p,
474 GrGLBinding binding, 474 GrGLStandard standard,
475 SkString* str) { 475 SkString* str) {
476 // Desktop GLSL has added precision qualifiers but they don't do anything. 476 // Desktop GLSL has added precision qualifiers but they don't do anything.
477 if (kES_GrGLBinding == binding) { 477 if (kGLES_GrGLStandard == standard) {
478 switch (p) { 478 switch (p) {
479 case GrGLShaderVar::kHigh_Precision: 479 case GrGLShaderVar::kHigh_Precision:
480 str->append("precision highp float;\n"); 480 str->append("precision highp float;\n");
481 break; 481 break;
482 case GrGLShaderVar::kMedium_Precision: 482 case GrGLShaderVar::kMedium_Precision:
483 str->append("precision mediump float;\n"); 483 str->append("precision mediump float;\n");
484 break; 484 break;
485 case GrGLShaderVar::kLow_Precision: 485 case GrGLShaderVar::kLow_Precision:
486 str->append("precision lowp float;\n"); 486 str->append("precision lowp float;\n");
487 break; 487 break;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 682
683 GR_GL_CALL(gli, AttachShader(programId, shaderId)); 683 GR_GL_CALL(gli, AttachShader(programId, shaderId));
684 GR_GL_CALL(gli, DeleteShader(shaderId)); 684 GR_GL_CALL(gli, DeleteShader(shaderId));
685 return true; 685 return true;
686 } 686 }
687 687
688 bool GrGLShaderBuilder::compileAndAttachShaders(GrGLuint programId) const { 688 bool GrGLShaderBuilder::compileAndAttachShaders(GrGLuint programId) const {
689 SkString fragShaderSrc(GrGetGLSLVersionDecl(this->ctxInfo())); 689 SkString fragShaderSrc(GrGetGLSLVersionDecl(this->ctxInfo()));
690 fragShaderSrc.append(fFSExtensions); 690 fragShaderSrc.append(fFSExtensions);
691 append_default_precision_qualifier(kDefaultFragmentPrecision, 691 append_default_precision_qualifier(kDefaultFragmentPrecision,
692 fGpu->glBinding(), 692 fGpu->glStandard(),
693 &fragShaderSrc); 693 &fragShaderSrc);
694 this->appendUniformDecls(kFragment_Visibility, &fragShaderSrc); 694 this->appendUniformDecls(kFragment_Visibility, &fragShaderSrc);
695 this->appendDecls(fFSInputs, &fragShaderSrc); 695 this->appendDecls(fFSInputs, &fragShaderSrc);
696 // We shouldn't have declared outputs on 1.10 696 // We shouldn't have declared outputs on 1.10
697 SkASSERT(k110_GrGLSLGeneration != fGpu->glslGeneration() || fFSOutputs.empty ()); 697 SkASSERT(k110_GrGLSLGeneration != fGpu->glslGeneration() || fFSOutputs.empty ());
698 this->appendDecls(fFSOutputs, &fragShaderSrc); 698 this->appendDecls(fFSOutputs, &fragShaderSrc);
699 fragShaderSrc.append(fFSFunctions); 699 fragShaderSrc.append(fFSFunctions);
700 fragShaderSrc.append("void main() {\n"); 700 fragShaderSrc.append("void main() {\n");
701 fragShaderSrc.append(fFSCode); 701 fragShaderSrc.append(fFSCode);
702 fragShaderSrc.append("}\n"); 702 fragShaderSrc.append("}\n");
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 GrGLSLExpr4* inOutFSColor) { 977 GrGLSLExpr4* inOutFSColor) {
978 978
979 GrGLTexGenProgramEffectsBuilder texGenEffectsBuilder(this, effectCnt); 979 GrGLTexGenProgramEffectsBuilder texGenEffectsBuilder(this, effectCnt);
980 this->INHERITED::createAndEmitEffects(&texGenEffectsBuilder, 980 this->INHERITED::createAndEmitEffects(&texGenEffectsBuilder,
981 effectStages, 981 effectStages,
982 effectKeys, 982 effectKeys,
983 effectCnt, 983 effectCnt,
984 inOutFSColor); 984 inOutFSColor);
985 return texGenEffectsBuilder.finish(); 985 return texGenEffectsBuilder.finish();
986 } 986 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698