• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "GrGLGLSL.h"
9 #include "GrGLUtil.h"
10 
GrGLGetGLSLGeneration(const GrGLInterface * gl,GrGLSLGeneration * generation)11 bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) {
12     SkASSERT(generation);
13     GrGLSLVersion ver = GrGLGetGLSLVersion(gl);
14     if (GR_GLSL_INVALID_VER == ver) {
15         return false;
16     }
17     switch (gl->fStandard) {
18         case kGL_GrGLStandard:
19             SkASSERT(ver >= GR_GLSL_VER(1,10));
20             if (ver >= GR_GLSL_VER(4,20)) {
21                 *generation = k420_GrGLSLGeneration;
22             } else if (ver >= GR_GLSL_VER(4,00)) {
23                 *generation = k400_GrGLSLGeneration;
24             } else if (ver >= GR_GLSL_VER(3,30)) {
25                 *generation = k330_GrGLSLGeneration;
26             } else if (ver >= GR_GLSL_VER(1,50)) {
27                 *generation = k150_GrGLSLGeneration;
28             } else if (ver >= GR_GLSL_VER(1,40)) {
29                 *generation = k140_GrGLSLGeneration;
30             } else if (ver >= GR_GLSL_VER(1,30)) {
31                 *generation = k130_GrGLSLGeneration;
32             } else {
33                 *generation = k110_GrGLSLGeneration;
34             }
35             return true;
36         case kGLES_GrGLStandard:
37             SkASSERT(ver >= GR_GL_VER(1,00));
38             if (ver >= GR_GLSL_VER(3,20)) {
39                 *generation = k320es_GrGLSLGeneration;
40             } else if (ver >= GR_GLSL_VER(3,10)) {
41                 *generation = k310es_GrGLSLGeneration;
42             } else if (ver >= GR_GLSL_VER(3,00)) {
43                 *generation = k330_GrGLSLGeneration;
44             } else {
45                 *generation = k110_GrGLSLGeneration;
46             }
47             return true;
48         default:
49             SK_ABORT("Unknown GL Standard");
50             return false;
51     }
52 }
53