| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h" | 5 #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #ifndef GL_FALSE | 9 #ifndef GL_FALSE |
| 10 #define GL_FALSE 0 | 10 #define GL_FALSE 0 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 static const struct PPB_OpenGLES2InstancedArrays_Dev* | 29 static const struct PPB_OpenGLES2InstancedArrays_Dev* |
| 30 g_gles2_instanced_arrays_interface = NULL; | 30 g_gles2_instanced_arrays_interface = NULL; |
| 31 static const struct PPB_OpenGLES2FramebufferBlit_Dev* | 31 static const struct PPB_OpenGLES2FramebufferBlit_Dev* |
| 32 g_gles2_framebuffer_blit_interface = NULL; | 32 g_gles2_framebuffer_blit_interface = NULL; |
| 33 static const struct PPB_OpenGLES2FramebufferMultisample_Dev* | 33 static const struct PPB_OpenGLES2FramebufferMultisample_Dev* |
| 34 g_gles2_framebuffer_multisample_interface = NULL; | 34 g_gles2_framebuffer_multisample_interface = NULL; |
| 35 static const struct PPB_OpenGLES2ChromiumEnableFeature_Dev* | 35 static const struct PPB_OpenGLES2ChromiumEnableFeature_Dev* |
| 36 g_gles2_chromium_enable_feature_interface = NULL; | 36 g_gles2_chromium_enable_feature_interface = NULL; |
| 37 static const struct PPB_OpenGLES2ChromiumMapSub_Dev* | 37 static const struct PPB_OpenGLES2ChromiumMapSub_Dev* |
| 38 g_gles2_chromium_map_sub_interface = NULL; | 38 g_gles2_chromium_map_sub_interface = NULL; |
| 39 static const struct PPB_OpenGLES2Query_Dev* |
| 40 g_gles2_query_interface = NULL; |
| 39 | 41 |
| 40 // TODO(alokp): Make sure PP_TLS works on all supported platforms. | 42 // TODO(alokp): Make sure PP_TLS works on all supported platforms. |
| 41 static PP_TLS PP_Resource g_current_context = 0; | 43 static PP_TLS PP_Resource g_current_context = 0; |
| 42 | 44 |
| 43 GLboolean GL_APIENTRY glInitializePPAPI( | 45 GLboolean GL_APIENTRY glInitializePPAPI( |
| 44 PPB_GetInterface get_browser_interface) { | 46 PPB_GetInterface get_browser_interface) { |
| 45 if (!g_gles2_interface) { | 47 if (!g_gles2_interface) { |
| 46 g_gles2_interface = get_browser_interface(PPB_OPENGLES2_INTERFACE); | 48 g_gles2_interface = get_browser_interface(PPB_OPENGLES2_INTERFACE); |
| 47 } | 49 } |
| 48 if (!g_gles2_instanced_arrays_interface) { | 50 if (!g_gles2_instanced_arrays_interface) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 } | 62 } |
| 61 if (!g_gles2_chromium_enable_feature_interface) { | 63 if (!g_gles2_chromium_enable_feature_interface) { |
| 62 g_gles2_chromium_enable_feature_interface = | 64 g_gles2_chromium_enable_feature_interface = |
| 63 get_browser_interface( | 65 get_browser_interface( |
| 64 PPB_OPENGLES2_CHROMIUMENABLEFEATURE_DEV_INTERFACE); | 66 PPB_OPENGLES2_CHROMIUMENABLEFEATURE_DEV_INTERFACE); |
| 65 } | 67 } |
| 66 if (!g_gles2_chromium_map_sub_interface) { | 68 if (!g_gles2_chromium_map_sub_interface) { |
| 67 g_gles2_chromium_map_sub_interface = | 69 g_gles2_chromium_map_sub_interface = |
| 68 get_browser_interface(PPB_OPENGLES2_CHROMIUMMAPSUB_DEV_INTERFACE); | 70 get_browser_interface(PPB_OPENGLES2_CHROMIUMMAPSUB_DEV_INTERFACE); |
| 69 } | 71 } |
| 72 if (!g_gles2_query_interface) { |
| 73 g_gles2_query_interface = |
| 74 get_browser_interface(PPB_OPENGLES2_QUERY_DEV_INTERFACE); |
| 75 } |
| 70 return g_gles2_interface ? GL_TRUE : GL_FALSE; | 76 return g_gles2_interface ? GL_TRUE : GL_FALSE; |
| 71 } | 77 } |
| 72 | 78 |
| 73 GLboolean GL_APIENTRY glTerminatePPAPI() { | 79 GLboolean GL_APIENTRY glTerminatePPAPI() { |
| 74 g_gles2_interface = NULL; | 80 g_gles2_interface = NULL; |
| 75 return GL_TRUE; | 81 return GL_TRUE; |
| 76 } | 82 } |
| 77 | 83 |
| 78 void GL_APIENTRY glSetCurrentContextPPAPI(PP_Resource context) { | 84 void GL_APIENTRY glSetCurrentContextPPAPI(PP_Resource context) { |
| 79 g_current_context = context; | 85 g_current_context = context; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 104 | 110 |
| 105 const struct PPB_OpenGLES2ChromiumEnableFeature_Dev* GL_APIENTRY | 111 const struct PPB_OpenGLES2ChromiumEnableFeature_Dev* GL_APIENTRY |
| 106 glGetChromiumEnableFeatureInterfacePPAPI() { | 112 glGetChromiumEnableFeatureInterfacePPAPI() { |
| 107 return g_gles2_chromium_enable_feature_interface; | 113 return g_gles2_chromium_enable_feature_interface; |
| 108 } | 114 } |
| 109 | 115 |
| 110 const struct PPB_OpenGLES2ChromiumMapSub_Dev* GL_APIENTRY | 116 const struct PPB_OpenGLES2ChromiumMapSub_Dev* GL_APIENTRY |
| 111 glGetChromiumMapSubInterfacePPAPI() { | 117 glGetChromiumMapSubInterfacePPAPI() { |
| 112 return g_gles2_chromium_map_sub_interface; | 118 return g_gles2_chromium_map_sub_interface; |
| 113 } | 119 } |
| 120 |
| 121 const struct PPB_OpenGLES2Query_Dev* GL_APIENTRY |
| 122 glGetQueryInterfacePPAPI() { |
| 123 return g_gles2_query_interface; |
| 124 } |
| OLD | NEW |