OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
11 #endif // GL_FALSE | 11 #endif // GL_FALSE |
12 | 12 |
13 #ifndef GL_TRUE | 13 #ifndef GL_TRUE |
14 #define GL_TRUE 1 | 14 #define GL_TRUE 1 |
15 #endif // GL_TRUE | 15 #endif // GL_TRUE |
16 | 16 |
17 #if defined(__GNUC__) && !defined(__APPLE__) | 17 #if defined(__GNUC__) && !defined(__APPLE__) |
18 #define PP_TLS __thread | 18 #define PP_TLS __thread |
19 #elif defined(_MSC_VER) | 19 #elif defined(_MSC_VER) |
20 #define PP_TLS __declspec(thread) | 20 #define PP_TLS __declspec(thread) |
21 #else | 21 #else |
22 // TODO(alokp): Fix all other platforms. | 22 // TODO(alokp): Fix all other platforms. |
23 #define PP_TLS | 23 #define PP_TLS |
24 #endif | 24 #endif |
25 | 25 |
26 // TODO(alokp): This will need to be thread-safe if we build gles2 as a | 26 // TODO(alokp): This will need to be thread-safe if we build gles2 as a |
27 // shared library. | 27 // shared library. |
28 static const struct PPB_OpenGLES2* g_gles2_interface = NULL; | 28 static const struct PPB_OpenGLES2_Dev* g_gles2_interface = NULL; |
29 | 29 |
30 // TODO(alokp): Make sure PP_TLS works on all supported platforms. | 30 // TODO(alokp): Make sure PP_TLS works on all supported platforms. |
31 static PP_TLS PP_Resource g_current_context = 0; | 31 static PP_TLS PP_Resource g_current_context = 0; |
32 | 32 |
33 GLboolean GL_APIENTRY glInitializePPAPI( | 33 GLboolean GL_APIENTRY glInitializePPAPI( |
34 PPB_GetInterface get_browser_interface) { | 34 PPB_GetInterface get_browser_interface) { |
35 if (!g_gles2_interface) { | 35 if (!g_gles2_interface) { |
36 g_gles2_interface = get_browser_interface(PPB_OPENGLES2_INTERFACE); | 36 g_gles2_interface = get_browser_interface(PPB_OPENGLES2_DEV_INTERFACE); |
37 } | 37 } |
38 return g_gles2_interface ? GL_TRUE : GL_FALSE; | 38 return g_gles2_interface ? GL_TRUE : GL_FALSE; |
39 } | 39 } |
40 | 40 |
41 GLboolean GL_APIENTRY glTerminatePPAPI() { | 41 GLboolean GL_APIENTRY glTerminatePPAPI() { |
42 g_gles2_interface = NULL; | 42 g_gles2_interface = NULL; |
43 return GL_TRUE; | 43 return GL_TRUE; |
44 } | 44 } |
45 | 45 |
46 void GL_APIENTRY glSetCurrentContextPPAPI(PP_Resource context) { | 46 void GL_APIENTRY glSetCurrentContextPPAPI(PP_Resource context) { |
47 g_current_context = context; | 47 g_current_context = context; |
48 } | 48 } |
49 | 49 |
50 PP_Resource GL_APIENTRY glGetCurrentContextPPAPI() { | 50 PP_Resource GL_APIENTRY glGetCurrentContextPPAPI() { |
51 return g_current_context; | 51 return g_current_context; |
52 } | 52 } |
53 | 53 |
54 const struct PPB_OpenGLES2* GL_APIENTRY glGetInterfacePPAPI() { | 54 const struct PPB_OpenGLES2_Dev* GL_APIENTRY glGetInterfacePPAPI() { |
55 return g_gles2_interface; | 55 return g_gles2_interface; |
56 } | 56 } |
57 | 57 |
OLD | NEW |