| 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 "GrTypesPriv.h" |
| 12 | 13 |
| 13 class GrGLShaderVar; | 14 class GrGLShaderVar; |
| 14 class SkString; | 15 class SkString; |
| 15 | 16 |
| 16 // Limited set of GLSL versions we build shaders for. Caller should round | 17 // Limited set of GLSL versions we build shaders for. Caller should round |
| 17 // down the GLSL version to one of these enums. | 18 // down the GLSL version to one of these enums. |
| 18 enum GrGLSLGeneration { | 19 enum GrGLSLGeneration { |
| 19 /** | 20 /** |
| 20 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20) | 21 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20) |
| 21 */ | 22 */ |
| 22 k110_GrGLSLGeneration, | 23 k110_GrGLSLGeneration, |
| 23 /** | 24 /** |
| 24 * Desktop GLSL 1.30 | 25 * Desktop GLSL 1.30 |
| 25 */ | 26 */ |
| 26 k130_GrGLSLGeneration, | 27 k130_GrGLSLGeneration, |
| 27 /** | 28 /** |
| 28 * Desktop GLSL 1.40 | 29 * Desktop GLSL 1.40 |
| 29 */ | 30 */ |
| 30 k140_GrGLSLGeneration, | 31 k140_GrGLSLGeneration, |
| 31 /** | 32 /** |
| 32 * Desktop GLSL 1.50 | 33 * Desktop GLSL 1.50 |
| 33 */ | 34 */ |
| 34 k150_GrGLSLGeneration, | 35 k150_GrGLSLGeneration, |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 /** | |
| 38 * Types of shader-language-specific boxed variables we can create. | |
| 39 * (Currently only GrGLShaderVars, but should be applicable to other shader | |
| 40 * languages.) | |
| 41 */ | |
| 42 enum GrSLType { | |
| 43 kVoid_GrSLType, | |
| 44 kFloat_GrSLType, | |
| 45 kVec2f_GrSLType, | |
| 46 kVec3f_GrSLType, | |
| 47 kVec4f_GrSLType, | |
| 48 kMat33f_GrSLType, | |
| 49 kMat44f_GrSLType, | |
| 50 kSampler2D_GrSLType | |
| 51 }; | |
| 52 | |
| 53 enum GrSLConstantVec { | 38 enum GrSLConstantVec { |
| 54 kZeros_GrSLConstantVec, | 39 kZeros_GrSLConstantVec, |
| 55 kOnes_GrSLConstantVec, | 40 kOnes_GrSLConstantVec, |
| 56 kNone_GrSLConstantVec, | 41 kNone_GrSLConstantVec, |
| 57 }; | 42 }; |
| 58 | 43 |
| 59 namespace { | 44 namespace { |
| 60 static inline int GrSLTypeToVecLength(GrSLType type) { | 45 static inline int GrSLTypeToVecLength(GrSLType type) { |
| 61 static const int kVecLengths[] = { | 46 static const int kVecLengths[] = { |
| 62 0, // kVoid_GrSLType | 47 0, // kVoid_GrSLType |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 * by in0 or in1 will not be emitted. The return value indicates whether a zero
s vec was appended | 156 * by in0 or in1 will not be emitted. The return value indicates whether a zero
s vec was appended |
| 172 * or not. | 157 * or not. |
| 173 */ | 158 */ |
| 174 GrSLConstantVec GrGLSLAdd4f(SkString* outAppend, | 159 GrSLConstantVec GrGLSLAdd4f(SkString* outAppend, |
| 175 const char* in0, | 160 const char* in0, |
| 176 const char* in1, | 161 const char* in1, |
| 177 GrSLConstantVec default0 = kZeros_GrSLConstantVec, | 162 GrSLConstantVec default0 = kZeros_GrSLConstantVec, |
| 178 GrSLConstantVec default1 = kZeros_GrSLConstantVec); | 163 GrSLConstantVec default1 = kZeros_GrSLConstantVec); |
| 179 | 164 |
| 180 #endif | 165 #endif |
| OLD | NEW |