tomhudson@google.com | 086e535 | 2011-12-08 14:44:10 +0000 | [diff] [blame] | 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 | |
Brian Salomon | 23c55b6 | 2018-06-19 16:28:41 -0400 | [diff] [blame] | 8 | #include "GrGLGLSL.h" |
egdaniel | f529439 | 2015-10-21 07:14:17 -0700 | [diff] [blame] | 9 | #include "GrGLUtil.h" |
tomhudson@google.com | 086e535 | 2011-12-08 14:44:10 +0000 | [diff] [blame] | 10 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 11 | bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 12 | SkASSERT(generation); |
tomhudson@google.com | 086e535 | 2011-12-08 14:44:10 +0000 | [diff] [blame] | 13 | GrGLSLVersion ver = GrGLGetGLSLVersion(gl); |
commit-bot@chromium.org | f4e67e3 | 2014-04-30 01:26:04 +0000 | [diff] [blame] | 14 | if (GR_GLSL_INVALID_VER == ver) { |
| 15 | return false; |
| 16 | } |
Kevin Lubick | 8aa203c | 2019-03-19 13:23:10 -0400 | [diff] [blame^] | 17 | if (GR_IS_GR_GL(gl->fStandard)) { |
| 18 | SkASSERT(ver >= GR_GLSL_VER(1,10)); |
| 19 | if (ver >= GR_GLSL_VER(4,20)) { |
| 20 | *generation = k420_GrGLSLGeneration; |
| 21 | } else if (ver >= GR_GLSL_VER(4,00)) { |
| 22 | *generation = k400_GrGLSLGeneration; |
| 23 | } else if (ver >= GR_GLSL_VER(3,30)) { |
| 24 | *generation = k330_GrGLSLGeneration; |
| 25 | } else if (ver >= GR_GLSL_VER(1,50)) { |
| 26 | *generation = k150_GrGLSLGeneration; |
| 27 | } else if (ver >= GR_GLSL_VER(1,40)) { |
| 28 | *generation = k140_GrGLSLGeneration; |
| 29 | } else if (ver >= GR_GLSL_VER(1,30)) { |
| 30 | *generation = k130_GrGLSLGeneration; |
| 31 | } else { |
| 32 | *generation = k110_GrGLSLGeneration; |
| 33 | } |
| 34 | return true; |
| 35 | } else if (GR_IS_GR_GL_ES(gl->fStandard)) { |
| 36 | SkASSERT(ver >= GR_GL_VER(1,00)); |
| 37 | if (ver >= GR_GLSL_VER(3,20)) { |
| 38 | *generation = k320es_GrGLSLGeneration; |
| 39 | } else if (ver >= GR_GLSL_VER(3,10)) { |
| 40 | *generation = k310es_GrGLSLGeneration; |
| 41 | } else if (ver >= GR_GLSL_VER(3,00)) { |
| 42 | *generation = k330_GrGLSLGeneration; |
| 43 | } else { |
| 44 | *generation = k110_GrGLSLGeneration; |
| 45 | } |
| 46 | return true; |
tomhudson@google.com | 086e535 | 2011-12-08 14:44:10 +0000 | [diff] [blame] | 47 | } |
Kevin Lubick | 8aa203c | 2019-03-19 13:23:10 -0400 | [diff] [blame^] | 48 | SK_ABORT("Unknown GL Standard"); |
| 49 | return false; |
tomhudson@google.com | 086e535 | 2011-12-08 14:44:10 +0000 | [diff] [blame] | 50 | } |