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

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

Issue 23533066: Move the GL shader compilation step into GrGLShaderBuilder (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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/GrGLSL.h ('k') | src/gpu/gl/GrGLShaderBuilder.h » ('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"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return "#version 150\n"; 56 return "#version 150\n";
57 } else { 57 } else {
58 return "#version 150 compatibility\n"; 58 return "#version 150 compatibility\n";
59 } 59 }
60 default: 60 default:
61 GrCrash("Unknown GL version."); 61 GrCrash("Unknown GL version.");
62 return ""; // suppress warning 62 return ""; // suppress warning
63 } 63 }
64 } 64 }
65 65
66 bool GrGLSLSetupFSColorOuput(GrGLSLGeneration gen, const char* nameIfDeclared, G rGLShaderVar* var) {
67 bool declaredOutput = k110_GrGLSLGeneration != gen;
68 var->set(kVec4f_GrSLType,
69 GrGLShaderVar::kOut_TypeModifier,
70 declaredOutput ? nameIfDeclared : "gl_FragColor");
71 return declaredOutput;
72 }
73
74 const char* GrGLSLVectorHomogCoord(int count) { 66 const char* GrGLSLVectorHomogCoord(int count) {
75 static const char* HOMOGS[] = {"ERROR", "", ".y", ".z", ".w"}; 67 static const char* HOMOGS[] = {"ERROR", "", ".y", ".z", ".w"};
76 SkASSERT(count >= 1 && count < (int)GR_ARRAY_COUNT(HOMOGS)); 68 SkASSERT(count >= 1 && count < (int)GR_ARRAY_COUNT(HOMOGS));
77 return HOMOGS[count]; 69 return HOMOGS[count];
78 } 70 }
79 71
80 const char* GrGLSLVectorHomogCoord(GrSLType type) { 72 const char* GrGLSLVectorHomogCoord(GrSLType type) {
81 return GrGLSLVectorHomogCoord(GrSLTypeToVecLength(type)); 73 return GrGLSLVectorHomogCoord(GrSLTypeToVecLength(type));
82 } 74 }
83 75
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 SkASSERT(kZeros_GrSLConstantVec == defaultExpr); 134 SkASSERT(kZeros_GrSLConstantVec == defaultExpr);
143 outAppend->append("0.0"); 135 outAppend->append("0.0");
144 } 136 }
145 } 137 }
146 return defaultExpr; 138 return defaultExpr;
147 } else { 139 } else {
148 outAppend->appendf("(%s).%c", expr, GrColorComponentFlagToChar(component )); 140 outAppend->appendf("(%s).%c", expr, GrColorComponentFlagToChar(component ));
149 return kNone_GrSLConstantVec; 141 return kNone_GrSLConstantVec;
150 } 142 }
151 } 143 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLSL.h ('k') | src/gpu/gl/GrGLShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698