| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "GrGLAssembleInterface.h" | 10 #include "GrGLAssembleInterface.h" |
| 11 #include "GrGLUtil.h" | 11 #include "GrGLUtil.h" |
| 12 | 12 |
| 13 #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F) | 13 #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F) |
| 14 #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "
gl" #F #S) | 14 #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "
gl" #F #S) |
| 15 #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl
" #F) | 15 #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl
" #F) |
| 16 | 16 |
| 17 const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { | 17 const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { |
| 18 GET_PROC_LOCAL(GetString); | 18 GET_PROC_LOCAL(GetString); |
| 19 GET_PROC_LOCAL(GetStringi); | 19 GET_PROC_LOCAL(GetStringi); |
| 20 GET_PROC_LOCAL(GetIntegerv); | 20 GET_PROC_LOCAL(GetIntegerv); |
| 21 | 21 |
| 22 // GetStringi may be NULL depending on the GL version. | 22 // GetStringi may be NULL depending on the GL version. |
| 23 if (NULL == GetString || NULL == GetIntegerv) { | 23 if (NULL == GetString || NULL == GetIntegerv) { |
| 24 return NULL; | 24 return NULL; |
| 25 } | 25 } |
| 26 | 26 |
| 27 const char* versionString = (const char*) GetString(GR_GL_VERSION); | 27 const char* versionString = (const char*) GetString(GR_GL_VERSION); |
| 28 GrGLVersion glVer = GrGLGetVersionFromString(versionString); | 28 GrGLVersion glVer = GrGLGetVersionFromString(versionString); |
| 29 | 29 |
| 30 if (glVer < GR_GL_VER(1,5)) { | 30 if (glVer < GR_GL_VER(1,5) || GR_GL_INVALID_VER == glVer) { |
| 31 // We must have array and element_array buffer objects. | 31 // We must have array and element_array buffer objects. |
| 32 return NULL; | 32 return NULL; |
| 33 } | 33 } |
| 34 | 34 |
| 35 GrGLExtensions extensions; | 35 GrGLExtensions extensions; |
| 36 if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv))
{ | 36 if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv))
{ |
| 37 return NULL; | 37 return NULL; |
| 38 } | 38 } |
| 39 | 39 |
| 40 GrGLInterface* interface = SkNEW(GrGLInterface()); | 40 GrGLInterface* interface = SkNEW(GrGLInterface()); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 GET_PROC(InvalidateSubFramebuffer); | 280 GET_PROC(InvalidateSubFramebuffer); |
| 281 GET_PROC(InvalidateTexImage); | 281 GET_PROC(InvalidateTexImage); |
| 282 GET_PROC(InvalidateTexSubImage); | 282 GET_PROC(InvalidateTexSubImage); |
| 283 } | 283 } |
| 284 | 284 |
| 285 interface->fStandard = kGL_GrGLStandard; | 285 interface->fStandard = kGL_GrGLStandard; |
| 286 interface->fExtensions.swap(&extensions); | 286 interface->fExtensions.swap(&extensions); |
| 287 | 287 |
| 288 return interface; | 288 return interface; |
| 289 } | 289 } |
| OLD | NEW |