OLD | NEW |
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 #ifndef GrGLSL_DEFINED | 8 #ifndef GrGLSL_DEFINED |
9 #define GrGLSL_DEFINED | 9 #define GrGLSL_DEFINED |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding, | 80 GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding, |
81 const GrGLInterface* gl); | 81 const GrGLInterface* gl); |
82 | 82 |
83 /** | 83 /** |
84 * Returns a string to include at the beginning of a shader to declare the GLSL | 84 * Returns a string to include at the beginning of a shader to declare the GLSL |
85 * version. | 85 * version. |
86 */ | 86 */ |
87 const char* GrGetGLSLVersionDecl(const GrGLContextInfo&); | 87 const char* GrGetGLSLVersionDecl(const GrGLContextInfo&); |
88 | 88 |
89 /** | 89 /** |
90 * Depending on the GLSL version being emitted there may be an assumed output | |
91 * variable from the fragment shader for the color. Otherwise, the shader must | |
92 * declare an output variable for the color. If this function returns true: | |
93 * * Parameter var's name will be set to nameIfDeclared | |
94 * * The variable must be declared in the fragment shader | |
95 * * The variable has to be bound as the color output | |
96 * (using glBindFragDataLocation) | |
97 * If the function returns false: | |
98 * * Parameter var's name will be set to the GLSL built-in color output name. | |
99 * * Do not declare the variable in the shader. | |
100 * * Do not use glBindFragDataLocation to bind the variable | |
101 * In either case var is initialized to represent the color output in the | |
102 * shader. | |
103 */ | |
104 bool GrGLSLSetupFSColorOuput(GrGLSLGeneration gen, | |
105 const char* nameIfDeclared, | |
106 GrGLShaderVar* var); | |
107 /** | |
108 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty
pe. | 90 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty
pe. |
109 */ | 91 */ |
110 static const char* GrGLSLTypeString(GrSLType t) { | 92 static const char* GrGLSLTypeString(GrSLType t) { |
111 switch (t) { | 93 switch (t) { |
112 case kVoid_GrSLType: | 94 case kVoid_GrSLType: |
113 return "void"; | 95 return "void"; |
114 case kFloat_GrSLType: | 96 case kFloat_GrSLType: |
115 return "float"; | 97 return "float"; |
116 case kVec2f_GrSLType: | 98 case kVec2f_GrSLType: |
117 return "vec2"; | 99 return "vec2"; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 */ | 205 */ |
224 GrSLConstantVec GrGLSLGetComponent4f(SkString* outAppend, | 206 GrSLConstantVec GrGLSLGetComponent4f(SkString* outAppend, |
225 const char* expr, | 207 const char* expr, |
226 GrColorComponentFlags component, | 208 GrColorComponentFlags component, |
227 GrSLConstantVec defaultExpr = kNone_GrSLCon
stantVec, | 209 GrSLConstantVec defaultExpr = kNone_GrSLCon
stantVec, |
228 bool omitIfConst = false); | 210 bool omitIfConst = false); |
229 | 211 |
230 #include "GrGLSL_impl.h" | 212 #include "GrGLSL_impl.h" |
231 | 213 |
232 #endif | 214 #endif |
OLD | NEW |