diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-19 22:15:39 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-19 22:15:39 +0000 |
commit | 98c41b12a3dd200ba88db7c3c8ab8740da4ead90 (patch) | |
tree | c9f51c66b7419181de6f30e0b73f1feff306df49 /gpu/pgl | |
parent | 684666433198b901c53e10f40f2d3a2b4d5a7be1 (diff) | |
download | chromium_src-98c41b12a3dd200ba88db7c3c8ab8740da4ead90.zip chromium_src-98c41b12a3dd200ba88db7c3c8ab8740da4ead90.tar.gz chromium_src-98c41b12a3dd200ba88db7c3c8ab8740da4ead90.tar.bz2 |
Added pglGetCurrentContext. Make gles2 implementation pointer global variable thread local.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/549090
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/pgl')
-rw-r--r-- | gpu/pgl/pgl.cc | 16 | ||||
-rw-r--r-- | gpu/pgl/pgl.h | 18 |
2 files changed, 24 insertions, 10 deletions
diff --git a/gpu/pgl/pgl.cc b/gpu/pgl/pgl.cc index c403265..2fd3d8b 100644 --- a/gpu/pgl/pgl.cc +++ b/gpu/pgl/pgl.cc @@ -8,12 +8,6 @@ #include "gpu/pgl/command_buffer_pepper.h" #include "gpu/pgl/pgl.h" -#if defined(_MSC_VER) -#define THREAD_LOCAL __declspec(thread) -#else -#define THREAD_LOCAL __thread -#endif - namespace { const int32 kTransferBufferSize = 512 * 1024; @@ -111,9 +105,9 @@ void PGLContextImpl::Destroy() { bool PGLContextImpl::MakeCurrent(PGLContextImpl* pgl_context) { g_current_pgl_context = pgl_context; if (pgl_context) - gles2::g_gl_impl = pgl_context->gles2_implementation_; + gles2::SetGLContext(pgl_context->gles2_implementation_); else - gles2::g_gl_impl = NULL; + gles2::SetGLContext(NULL); return true; } @@ -143,7 +137,11 @@ PGLBoolean pglMakeCurrent(PGLContext pgl_context) { return PGLContextImpl::MakeCurrent(static_cast<PGLContextImpl*>(pgl_context)); } -PGLBoolean pglSwapBuffers() { +PGLContext pglGetCurrentContext(void) { + return g_current_pgl_context; +} + +PGLBoolean pglSwapBuffers(void) { if (!g_current_pgl_context) return false; diff --git a/gpu/pgl/pgl.h b/gpu/pgl/pgl.h index 6914aae..f848968 100644 --- a/gpu/pgl/pgl.h +++ b/gpu/pgl/pgl.h @@ -8,16 +8,32 @@ #include "npapi.h" #include "npapi_extensions.h" +#ifdef __cplusplus extern "C" { +#endif + typedef void* PGLContext; typedef bool PGLBoolean; +// Create A PGL context from a Pepper 3D device context. PGLContext pglCreateContext(NPP npp, NPDevice* device, NPDeviceContext3D* device_context); + +// Set the current PGL context for the calling thread. PGLBoolean pglMakeCurrent(PGLContext pgl_context); -PGLBoolean pglSwapBuffers(); + +// Get the calling thread's current PGL context. +PGLContext pglGetCurrentContext(void); + +// Display everything that has been rendered since the last call. +PGLBoolean pglSwapBuffers(void); + +// Destroy the given PGL context. PGLBoolean pglDestroyContext(PGLContext pgl_context); + +#ifdef __cplusplus } // extern "C" +#endif #endif // GPU_PGL_PGL_H |