1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gpu/command_buffer/client/gles2_lib.h"
7 #include "gpu/command_buffer/common/thread_local.h"
11 // This is defined in gles2_c_lib_autogen.h
13 extern const NameToFunc g_gles2_function_table
[];
16 // TODO(kbr): the use of this anonymous namespace core dumps the
17 // linker on Mac OS X 10.6 when the symbol ordering file is used
19 static gpu::ThreadLocalKey g_gl_context_key
;
20 // } // namespace anonymous
23 g_gl_context_key
= gpu::ThreadLocalAlloc();
27 gpu::ThreadLocalFree(g_gl_context_key
);
31 gpu::gles2::GLES2Interface
* GetGLContext() {
32 return static_cast<gpu::gles2::GLES2Interface
*>(
33 gpu::ThreadLocalGetValue(g_gl_context_key
));
36 void SetGLContext(gpu::gles2::GLES2Interface
* context
) {
37 gpu::ThreadLocalSetValue(g_gl_context_key
, context
);
40 GLES2FunctionPointer
GetGLFunctionPointer(const char* name
) {
41 for (const NameToFunc
* named_function
= g_gles2_function_table
;
44 if (!strcmp(name
, named_function
->name
)) {
45 return named_function
->func
;