aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGLSL.cpp
blob: 1062c81a861f5354098dfe62418450a82dc277b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrGLSL.h"

GrGLSLGeneration GetGLSLGeneration(GrGLBinding binding,
                                   const GrGLInterface* gl) {
    GrGLSLVersion ver = GrGLGetGLSLVersion(gl);
    switch (binding) {
        case kDesktop_GrGLBinding:
            GrAssert(ver >= GR_GLSL_VER(1,10));
            if (ver >= GR_GLSL_VER(1,50)) {
                return k150_GLSLGeneration;
            } else if (ver >= GR_GLSL_VER(1,30)) {
                return k130_GLSLGeneration;
            } else {
                return k110_GLSLGeneration;
            }
        case kES2_GrGLBinding:
            // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL
            GrAssert(ver >= GR_GL_VER(1,00));
            return k110_GLSLGeneration;
        default:
            GrCrash("Unknown GL Binding");
            return k110_GLSLGeneration; // suppress warning
    }
}