glapi.c revision 3464ebd5
13464ebd5Sriastradh/* 23464ebd5Sriastradh * Mesa 3-D graphics library 33464ebd5Sriastradh * Version: 7.9 43464ebd5Sriastradh * 53464ebd5Sriastradh * Copyright (C) 2010 LunarG Inc. 63464ebd5Sriastradh * 73464ebd5Sriastradh * Permission is hereby granted, free of charge, to any person obtaining a 83464ebd5Sriastradh * copy of this software and associated documentation files (the "Software"), 93464ebd5Sriastradh * to deal in the Software without restriction, including without limitation 103464ebd5Sriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense, 113464ebd5Sriastradh * and/or sell copies of the Software, and to permit persons to whom the 123464ebd5Sriastradh * Software is furnished to do so, subject to the following conditions: 133464ebd5Sriastradh * 143464ebd5Sriastradh * The above copyright notice and this permission notice shall be included 153464ebd5Sriastradh * in all copies or substantial portions of the Software. 163464ebd5Sriastradh * 173464ebd5Sriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 183464ebd5Sriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 193464ebd5Sriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 203464ebd5Sriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 213464ebd5Sriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 223464ebd5Sriastradh * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 233464ebd5Sriastradh * DEALINGS IN THE SOFTWARE. 243464ebd5Sriastradh * 253464ebd5Sriastradh * Authors: 263464ebd5Sriastradh * Chia-I Wu <olv@lunarg.com> 273464ebd5Sriastradh */ 283464ebd5Sriastradh 293464ebd5Sriastradh#include "glapi/glapi.h" 303464ebd5Sriastradh#include "mapi/u_current.h" 313464ebd5Sriastradh 323464ebd5Sriastradh/* 333464ebd5Sriastradh * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in 343464ebd5Sriastradh * u_current.c. 353464ebd5Sriastradh */ 363464ebd5Sriastradh 373464ebd5Sriastradh#ifdef GLX_USE_TLS 383464ebd5Sriastradh/* not used, but defined for compatibility */ 393464ebd5Sriastradhconst struct _glapi_table *_glapi_Dispatch; 403464ebd5Sriastradhconst void *_glapi_Context; 413464ebd5Sriastradh#endif /* GLX_USE_TLS */ 423464ebd5Sriastradh 433464ebd5Sriastradhvoid 443464ebd5Sriastradh_glapi_destroy_multithread(void) 453464ebd5Sriastradh{ 463464ebd5Sriastradh u_current_destroy(); 473464ebd5Sriastradh} 483464ebd5Sriastradh 493464ebd5Sriastradhvoid 503464ebd5Sriastradh_glapi_check_multithread(void) 513464ebd5Sriastradh{ 523464ebd5Sriastradh u_current_init(); 533464ebd5Sriastradh} 543464ebd5Sriastradh 553464ebd5Sriastradhvoid 563464ebd5Sriastradh_glapi_set_context(void *context) 573464ebd5Sriastradh{ 583464ebd5Sriastradh u_current_set_user((const void *) context); 593464ebd5Sriastradh} 603464ebd5Sriastradh 613464ebd5Sriastradhvoid 623464ebd5Sriastradh_glapi_set_dispatch(struct _glapi_table *dispatch) 633464ebd5Sriastradh{ 643464ebd5Sriastradh u_current_set((const struct mapi_table *) dispatch); 653464ebd5Sriastradh} 66