blob: 1062c81a861f5354098dfe62418450a82dc277b2 [file] [log] [blame]
tomhudson@google.com086e5352011-12-08 14:44:10 +00001/*
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 "GrGLSL.h"
9
10GrGLSLGeneration GetGLSLGeneration(GrGLBinding binding,
11 const GrGLInterface* gl) {
12 GrGLSLVersion ver = GrGLGetGLSLVersion(gl);
13 switch (binding) {
14 case kDesktop_GrGLBinding:
15 GrAssert(ver >= GR_GLSL_VER(1,10));
16 if (ver >= GR_GLSL_VER(1,50)) {
17 return k150_GLSLGeneration;
18 } else if (ver >= GR_GLSL_VER(1,30)) {
19 return k130_GLSLGeneration;
20 } else {
21 return k110_GLSLGeneration;
22 }
23 case kES2_GrGLBinding:
24 // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL
25 GrAssert(ver >= GR_GL_VER(1,00));
26 return k110_GLSLGeneration;
27 default:
28 GrCrash("Unknown GL Binding");
29 return k110_GLSLGeneration; // suppress warning
30 }
31}
32