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

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

Issue 659443007: Support GLSL es 3.00 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bug war Created 6 years, 2 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
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"
(...skipping 11 matching lines...) Expand all
22 *generation = k150_GrGLSLGeneration; 22 *generation = k150_GrGLSLGeneration;
23 } else if (ver >= GR_GLSL_VER(1,40)) { 23 } else if (ver >= GR_GLSL_VER(1,40)) {
24 *generation = k140_GrGLSLGeneration; 24 *generation = k140_GrGLSLGeneration;
25 } else if (ver >= GR_GLSL_VER(1,30)) { 25 } else if (ver >= GR_GLSL_VER(1,30)) {
26 *generation = k130_GrGLSLGeneration; 26 *generation = k130_GrGLSLGeneration;
27 } else { 27 } else {
28 *generation = k110_GrGLSLGeneration; 28 *generation = k110_GrGLSLGeneration;
29 } 29 }
30 return true; 30 return true;
31 case kGLES_GrGLStandard: 31 case kGLES_GrGLStandard:
32 // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL 32 // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL
bsalomon 2014/10/16 01:41:35 This comment should probably go
33 SkASSERT(ver >= GR_GL_VER(1,00)); 33 SkASSERT(ver >= GR_GL_VER(1,00));
34 *generation = k110_GrGLSLGeneration; 34 if (ver >= GR_GLSL_VER(3,1)) {
35 *generation = k310_GrGLSLGeneration;
36 }
37 else if (ver >= GR_GLSL_VER(3,0)) {
38 *generation = k300_GrGLSLGeneration;
39 } else {
40 *generation = k110_GrGLSLGeneration;
41 }
35 return true; 42 return true;
36 default: 43 default:
37 SkFAIL("Unknown GL Standard"); 44 SkFAIL("Unknown GL Standard");
38 return false; 45 return false;
39 } 46 }
40 } 47 }
41 48
42 const char* GrGetGLSLVersionDecl(const GrGLContextInfo& info) { 49 const char* GrGetGLSLVersionDecl(const GrGLContextInfo& info) {
43 switch (info.glslGeneration()) { 50 switch (info.glslGeneration()) {
44 case k110_GrGLSLGeneration: 51 case k110_GrGLSLGeneration:
(...skipping 11 matching lines...) Expand all
56 case k140_GrGLSLGeneration: 63 case k140_GrGLSLGeneration:
57 SkASSERT(kGL_GrGLStandard == info.standard()); 64 SkASSERT(kGL_GrGLStandard == info.standard());
58 return "#version 140\n"; 65 return "#version 140\n";
59 case k150_GrGLSLGeneration: 66 case k150_GrGLSLGeneration:
60 SkASSERT(kGL_GrGLStandard == info.standard()); 67 SkASSERT(kGL_GrGLStandard == info.standard());
61 if (info.caps()->isCoreProfile()) { 68 if (info.caps()->isCoreProfile()) {
62 return "#version 150\n"; 69 return "#version 150\n";
63 } else { 70 } else {
64 return "#version 150 compatibility\n"; 71 return "#version 150 compatibility\n";
65 } 72 }
73 case k300_GrGLSLGeneration:
bsalomon 2014/10/16 01:41:35 I think we should make this work with desktop as w
74 SkASSERT(kGLES_GrGLStandard == info.standard());
75 return "#version 300 es\n";
76 case k310_GrGLSLGeneration:
77 SkASSERT(kGLES_GrGLStandard == info.standard());
78 return "#version 310 es\n";
66 default: 79 default:
67 SkFAIL("Unknown GL version."); 80 SkFAIL("Unknown GL version.");
68 return ""; // suppress warning 81 return ""; // suppress warning
69 } 82 }
70 } 83 }
71 84
72 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor) { 85 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor) {
73 if (mulFactor.isOnes()) { 86 if (mulFactor.isOnes()) {
74 *outAppend = SkString(); 87 *outAppend = SkString();
75 } 88 }
76 89
77 if (mulFactor.isZeros()) { 90 if (mulFactor.isZeros()) {
78 outAppend->appendf("%s = vec4(0);", vec4VarName); 91 outAppend->appendf("%s = vec4(0);", vec4VarName);
79 } else { 92 } else {
80 outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str()); 93 outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str());
81 } 94 }
82 } 95 }
OLDNEW
« src/gpu/gl/GrGLSL.h ('K') | « src/gpu/gl/GrGLSL.h ('k') | src/gpu/gl/GrGLShaderVar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698