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

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

Issue 23185004: Rename kES2_GrGLBinding to kES_GrGLBinding. Step 0 for supporting ES3. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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
« no previous file with comments | « src/gpu/gl/GrGLInterface.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "GrGLSL.h" 8 #include "GrGLSL.h"
9 #include "GrGLShaderVar.h" 9 #include "GrGLShaderVar.h"
10 #include "SkString.h" 10 #include "SkString.h"
11 11
12 GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding, const GrGLInterface* g l) { 12 GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding, const GrGLInterface* g l) {
13 GrGLSLVersion ver = GrGLGetGLSLVersion(gl); 13 GrGLSLVersion ver = GrGLGetGLSLVersion(gl);
14 switch (binding) { 14 switch (binding) {
15 case kDesktop_GrGLBinding: 15 case kDesktop_GrGLBinding:
16 GrAssert(ver >= GR_GLSL_VER(1,10)); 16 GrAssert(ver >= GR_GLSL_VER(1,10));
17 if (ver >= GR_GLSL_VER(1,50)) { 17 if (ver >= GR_GLSL_VER(1,50)) {
18 return k150_GrGLSLGeneration; 18 return k150_GrGLSLGeneration;
19 } else if (ver >= GR_GLSL_VER(1,40)) { 19 } else if (ver >= GR_GLSL_VER(1,40)) {
20 return k140_GrGLSLGeneration; 20 return k140_GrGLSLGeneration;
21 } else if (ver >= GR_GLSL_VER(1,30)) { 21 } else if (ver >= GR_GLSL_VER(1,30)) {
22 return k130_GrGLSLGeneration; 22 return k130_GrGLSLGeneration;
23 } else { 23 } else {
24 return k110_GrGLSLGeneration; 24 return k110_GrGLSLGeneration;
25 } 25 }
26 case kES2_GrGLBinding: 26 case kES_GrGLBinding:
27 // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL 27 // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL
28 GrAssert(ver >= GR_GL_VER(1,00)); 28 GrAssert(ver >= GR_GL_VER(1,00));
29 return k110_GrGLSLGeneration; 29 return k110_GrGLSLGeneration;
30 default: 30 default:
31 GrCrash("Unknown GL Binding"); 31 GrCrash("Unknown GL Binding");
32 return k110_GrGLSLGeneration; // suppress warning 32 return k110_GrGLSLGeneration; // suppress warning
33 } 33 }
34 } 34 }
35 35
36 const char* GrGetGLSLVersionDecl(GrGLBinding binding, GrGLSLGeneration gen) { 36 const char* GrGetGLSLVersionDecl(GrGLBinding binding, GrGLSLGeneration gen) {
37 switch (gen) { 37 switch (gen) {
38 case k110_GrGLSLGeneration: 38 case k110_GrGLSLGeneration:
39 if (kES2_GrGLBinding == binding) { 39 if (kES_GrGLBinding == binding) {
40 // ES2s shader language is based on version 1.20 but is version 40 // ES2s shader language is based on version 1.20 but is version
41 // 1.00 of the ES language. 41 // 1.00 of the ES language.
42 return "#version 100\n"; 42 return "#version 100\n";
43 } else { 43 } else {
44 GrAssert(kDesktop_GrGLBinding == binding); 44 GrAssert(kDesktop_GrGLBinding == binding);
45 return "#version 110\n"; 45 return "#version 110\n";
46 } 46 }
47 case k130_GrGLSLGeneration: 47 case k130_GrGLSLGeneration:
48 GrAssert(kDesktop_GrGLBinding == binding); 48 GrAssert(kDesktop_GrGLBinding == binding);
49 return "#version 130\n"; 49 return "#version 130\n";
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 GrAssert(kZeros_GrSLConstantVec == defaultExpr); 138 GrAssert(kZeros_GrSLConstantVec == defaultExpr);
139 outAppend->append("0.0"); 139 outAppend->append("0.0");
140 } 140 }
141 } 141 }
142 return defaultExpr; 142 return defaultExpr;
143 } else { 143 } else {
144 outAppend->appendf("(%s).%c", expr, GrColorComponentFlagToChar(component )); 144 outAppend->appendf("(%s).%c", expr, GrColorComponentFlagToChar(component ));
145 return kNone_GrSLConstantVec; 145 return kNone_GrSLConstantVec;
146 } 146 }
147 } 147 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLInterface.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698