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 #include "GrGLGLSL.h" | 8 #include "GrGLGLSL.h" |
9 #include "GrGLContext.h" | 9 #include "GrGLContext.h" |
10 #include "GrGLUtil.h" | 10 #include "GrGLUtil.h" |
11 #include "SkString.h" | 11 #include "SkString.h" |
12 | 12 |
13 bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation
) { | 13 bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation
) { |
14 SkASSERT(generation); | 14 SkASSERT(generation); |
15 GrGLSLVersion ver = GrGLGetGLSLVersion(gl); | 15 GrGLSLVersion ver = GrGLGetGLSLVersion(gl); |
16 if (GR_GLSL_INVALID_VER == ver) { | 16 if (GR_GLSL_INVALID_VER == ver) { |
17 return false; | 17 return false; |
18 } | 18 } |
19 switch (gl->fStandard) { | 19 switch (gl->fStandard) { |
20 case kGL_GrGLStandard: | 20 case kGL_GrGLStandard: |
21 SkASSERT(ver >= GR_GLSL_VER(1,10)); | 21 SkASSERT(ver >= GR_GLSL_VER(1,10)); |
22 if (ver >= GR_GLSL_VER(4,00)) { | 22 if (ver >= GR_GLSL_VER(3,30)) { |
23 *generation = k400_GrGLSLGeneration; | |
24 } else if (ver >= GR_GLSL_VER(3,30)) { | |
25 *generation = k330_GrGLSLGeneration; | 23 *generation = k330_GrGLSLGeneration; |
26 } else if (ver >= GR_GLSL_VER(1,50)) { | 24 } else if (ver >= GR_GLSL_VER(1,50)) { |
27 *generation = k150_GrGLSLGeneration; | 25 *generation = k150_GrGLSLGeneration; |
28 } else if (ver >= GR_GLSL_VER(1,40)) { | 26 } else if (ver >= GR_GLSL_VER(1,40)) { |
29 *generation = k140_GrGLSLGeneration; | 27 *generation = k140_GrGLSLGeneration; |
30 } else if (ver >= GR_GLSL_VER(1,30)) { | 28 } else if (ver >= GR_GLSL_VER(1,30)) { |
31 *generation = k130_GrGLSLGeneration; | 29 *generation = k130_GrGLSLGeneration; |
32 } else { | 30 } else { |
33 *generation = k110_GrGLSLGeneration; | 31 *generation = k110_GrGLSLGeneration; |
34 } | 32 } |
35 return true; | 33 return true; |
36 case kGLES_GrGLStandard: | 34 case kGLES_GrGLStandard: |
37 SkASSERT(ver >= GR_GL_VER(1,00)); | 35 SkASSERT(ver >= GR_GL_VER(1,00)); |
38 if (ver >= GR_GLSL_VER(3,2)) { | 36 if (ver >= GR_GLSL_VER(3,1)) { |
39 *generation = k320es_GrGLSLGeneration; | |
40 } else if (ver >= GR_GLSL_VER(3,1)) { | |
41 *generation = k310es_GrGLSLGeneration; | 37 *generation = k310es_GrGLSLGeneration; |
42 } else if (ver >= GR_GLSL_VER(3,0)) { | 38 } |
| 39 else if (ver >= GR_GLSL_VER(3,0)) { |
43 *generation = k330_GrGLSLGeneration; | 40 *generation = k330_GrGLSLGeneration; |
44 } else { | 41 } else { |
45 *generation = k110_GrGLSLGeneration; | 42 *generation = k110_GrGLSLGeneration; |
46 } | 43 } |
47 return true; | 44 return true; |
48 default: | 45 default: |
49 SkFAIL("Unknown GL Standard"); | 46 SkFAIL("Unknown GL Standard"); |
50 return false; | 47 return false; |
51 } | 48 } |
52 } | 49 } |
53 | 50 |
OLD | NEW |