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 |
11 #include "gl/GrGLInterface.h" | 11 #include "gl/GrGLInterface.h" |
12 #include "GrColor.h" | 12 #include "GrColor.h" |
13 #include "GrTypesPriv.h" | 13 #include "GrTypesPriv.h" |
14 | 14 |
| 15 class GrGLContextInfo; |
15 class GrGLShaderVar; | 16 class GrGLShaderVar; |
16 class SkString; | 17 class SkString; |
17 | 18 |
18 // Limited set of GLSL versions we build shaders for. Caller should round | 19 // Limited set of GLSL versions we build shaders for. Caller should round |
19 // down the GLSL version to one of these enums. | 20 // down the GLSL version to one of these enums. |
20 enum GrGLSLGeneration { | 21 enum GrGLSLGeneration { |
21 /** | 22 /** |
22 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20) | 23 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20) |
23 */ | 24 */ |
24 k110_GrGLSLGeneration, | 25 k110_GrGLSLGeneration, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 /** | 77 /** |
77 * Gets the most recent GLSL Generation compatible with the OpenGL context. | 78 * Gets the most recent GLSL Generation compatible with the OpenGL context. |
78 */ | 79 */ |
79 GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding, | 80 GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding, |
80 const GrGLInterface* gl); | 81 const GrGLInterface* gl); |
81 | 82 |
82 /** | 83 /** |
83 * 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 |
84 * version. | 85 * version. |
85 */ | 86 */ |
86 const char* GrGetGLSLVersionDecl(GrGLBinding binding, | 87 const char* GrGetGLSLVersionDecl(const GrGLContextInfo&); |
87 GrGLSLGeneration v); | |
88 | 88 |
89 /** | 89 /** |
90 * Depending on the GLSL version being emitted there may be an assumed output | 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 | 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: | 92 * declare an output variable for the color. If this function returns true: |
93 * * Parameter var's name will be set to nameIfDeclared | 93 * * Parameter var's name will be set to nameIfDeclared |
94 * * The variable must be declared in the fragment shader | 94 * * The variable must be declared in the fragment shader |
95 * * The variable has to be bound as the color output | 95 * * The variable has to be bound as the color output |
96 * (using glBindFragDataLocation) | 96 * (using glBindFragDataLocation) |
97 * If the function returns false: | 97 * If the function returns false: |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 */ | 223 */ |
224 GrSLConstantVec GrGLSLGetComponent4f(SkString* outAppend, | 224 GrSLConstantVec GrGLSLGetComponent4f(SkString* outAppend, |
225 const char* expr, | 225 const char* expr, |
226 GrColorComponentFlags component, | 226 GrColorComponentFlags component, |
227 GrSLConstantVec defaultExpr = kNone_GrSLCon
stantVec, | 227 GrSLConstantVec defaultExpr = kNone_GrSLCon
stantVec, |
228 bool omitIfConst = false); | 228 bool omitIfConst = false); |
229 | 229 |
230 #include "GrGLSL_impl.h" | 230 #include "GrGLSL_impl.h" |
231 | 231 |
232 #endif | 232 #endif |
OLD | NEW |