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(3,30)) { | 22 if (ver >= GR_GLSL_VER(4,00)) { |
| 23 *generation = k400_GrGLSLGeneration; |
| 24 } else if (ver >= GR_GLSL_VER(3,30)) { |
23 *generation = k330_GrGLSLGeneration; | 25 *generation = k330_GrGLSLGeneration; |
24 } else if (ver >= GR_GLSL_VER(1,50)) { | 26 } else if (ver >= GR_GLSL_VER(1,50)) { |
25 *generation = k150_GrGLSLGeneration; | 27 *generation = k150_GrGLSLGeneration; |
26 } else if (ver >= GR_GLSL_VER(1,40)) { | 28 } else if (ver >= GR_GLSL_VER(1,40)) { |
27 *generation = k140_GrGLSLGeneration; | 29 *generation = k140_GrGLSLGeneration; |
28 } else if (ver >= GR_GLSL_VER(1,30)) { | 30 } else if (ver >= GR_GLSL_VER(1,30)) { |
29 *generation = k130_GrGLSLGeneration; | 31 *generation = k130_GrGLSLGeneration; |
30 } else { | 32 } else { |
31 *generation = k110_GrGLSLGeneration; | 33 *generation = k110_GrGLSLGeneration; |
32 } | 34 } |
33 return true; | 35 return true; |
34 case kGLES_GrGLStandard: | 36 case kGLES_GrGLStandard: |
35 SkASSERT(ver >= GR_GL_VER(1,00)); | 37 SkASSERT(ver >= GR_GL_VER(1,00)); |
36 if (ver >= GR_GLSL_VER(3,1)) { | 38 if (ver >= GR_GLSL_VER(3,20)) { |
| 39 *generation = k320es_GrGLSLGeneration; |
| 40 } else if (ver >= GR_GLSL_VER(3,10)) { |
37 *generation = k310es_GrGLSLGeneration; | 41 *generation = k310es_GrGLSLGeneration; |
38 } | 42 } else if (ver >= GR_GLSL_VER(3,00)) { |
39 else if (ver >= GR_GLSL_VER(3,0)) { | |
40 *generation = k330_GrGLSLGeneration; | 43 *generation = k330_GrGLSLGeneration; |
41 } else { | 44 } else { |
42 *generation = k110_GrGLSLGeneration; | 45 *generation = k110_GrGLSLGeneration; |
43 } | 46 } |
44 return true; | 47 return true; |
45 default: | 48 default: |
46 SkFAIL("Unknown GL Standard"); | 49 SkFAIL("Unknown GL Standard"); |
47 return false; | 50 return false; |
48 } | 51 } |
49 } | 52 } |
50 | 53 |
OLD | NEW |