mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 11:10:10 +01:00
glapi: make a separate copy of entry.c for each lib
Using the same .c file in 4 different static/shared libs is difficult to read. Having them separate will make it possible to simplify the code. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34002>
This commit is contained in:
parent
9e24940bc7
commit
d134f97e3f
10 changed files with 187 additions and 78 deletions
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
*
|
||||
* Copyright (C) 2010 LunarG Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "entry.h"
|
||||
#include "glapi/glapi.h"
|
||||
#include "util/u_endian.h"
|
||||
#include "util/u_thread.h"
|
||||
|
||||
#define _U_STRINGIFY(x) #x
|
||||
#define U_STRINGIFY(x) _U_STRINGIFY(x)
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86_tls.h"
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86-64_tls.h"
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_ppc64le_tls.h"
|
||||
#else
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_DECLARES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES
|
||||
#include "mapi_tmp.h"
|
||||
|
||||
#ifndef MAPI_MODE_BRIDGE
|
||||
|
||||
void
|
||||
entry_patch_public(void)
|
||||
{
|
||||
}
|
||||
|
||||
mapi_func
|
||||
entry_get_public(int slot)
|
||||
{
|
||||
/* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
|
||||
return public_entries[slot];
|
||||
}
|
||||
|
||||
#endif /* MAPI_MODE_BRIDGE */
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
|
|
@ -31,6 +31,9 @@
|
|||
#define HIDDEN
|
||||
#endif
|
||||
|
||||
#define _U_STRINGIFY(x) #x
|
||||
#define U_STRINGIFY(x) _U_STRINGIFY(x)
|
||||
|
||||
// NOTE: These must be powers of two:
|
||||
#define PPC64LE_ENTRY_SIZE 64
|
||||
#define PPC64LE_PAGE_ALIGN 65536
|
||||
|
|
|
|||
45
src/mapi/es1api/libgles1_public.c
Normal file
45
src/mapi/es1api/libgles1_public.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Copyright (C) 2010 LunarG Inc.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "entry.h"
|
||||
#include "glapi/glapi.h"
|
||||
#include "util/u_endian.h"
|
||||
#include "util/u_thread.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86_tls.h"
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86-64_tls.h"
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_ppc64le_tls.h"
|
||||
#else
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES
|
||||
#include "mapi_tmp.h"
|
||||
|
||||
#ifndef MAPI_MODE_BRIDGE
|
||||
|
||||
mapi_func
|
||||
entry_get_public(int slot)
|
||||
{
|
||||
/* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
|
||||
return public_entries[slot];
|
||||
}
|
||||
|
||||
#endif /* MAPI_MODE_BRIDGE */
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
|
|
@ -24,7 +24,7 @@ gles1_def = custom_target(
|
|||
|
||||
libglesv1_cm = shared_library(
|
||||
'GLESv1_CM' + get_option('gles-lib-suffix'),
|
||||
['../entry.c', es1_glapi_mapi_tmp_h],
|
||||
['libgles1_public.c', es1_glapi_mapi_tmp_h],
|
||||
vs_module_defs : gles1_def,
|
||||
c_args : [
|
||||
c_msvc_compat_args,
|
||||
|
|
|
|||
45
src/mapi/es2api/libgles2_public.c
Normal file
45
src/mapi/es2api/libgles2_public.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Copyright (C) 2010 LunarG Inc.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "entry.h"
|
||||
#include "glapi/glapi.h"
|
||||
#include "util/u_endian.h"
|
||||
#include "util/u_thread.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86_tls.h"
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86-64_tls.h"
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_ppc64le_tls.h"
|
||||
#else
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES
|
||||
#include "mapi_tmp.h"
|
||||
|
||||
#ifndef MAPI_MODE_BRIDGE
|
||||
|
||||
mapi_func
|
||||
entry_get_public(int slot)
|
||||
{
|
||||
/* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
|
||||
return public_entries[slot];
|
||||
}
|
||||
|
||||
#endif /* MAPI_MODE_BRIDGE */
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
|
|
@ -24,7 +24,7 @@ gles2_def = custom_target(
|
|||
|
||||
libgles2 = shared_library(
|
||||
'GLESv2' + get_option('gles-lib-suffix'),
|
||||
['../entry.c', es2_glapi_mapi_tmp_h],
|
||||
['libgles2_public.c', es2_glapi_mapi_tmp_h],
|
||||
vs_module_defs : gles2_def,
|
||||
c_args : [
|
||||
c_msvc_compat_args,
|
||||
|
|
|
|||
45
src/mapi/glapi/libgl_public.c
Normal file
45
src/mapi/glapi/libgl_public.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Copyright (C) 2010 LunarG Inc.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "entry.h"
|
||||
#include "glapi/glapi.h"
|
||||
#include "util/u_endian.h"
|
||||
#include "util/u_thread.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86_tls.h"
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86-64_tls.h"
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_ppc64le_tls.h"
|
||||
#else
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES
|
||||
#include "mapi_tmp.h"
|
||||
|
||||
#ifndef MAPI_MODE_BRIDGE
|
||||
|
||||
mapi_func
|
||||
entry_get_public(int slot)
|
||||
{
|
||||
/* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
|
||||
return public_entries[slot];
|
||||
}
|
||||
|
||||
#endif /* MAPI_MODE_BRIDGE */
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
|
|
@ -6,7 +6,7 @@ subdir('gen')
|
|||
inc_glapi = include_directories('.')
|
||||
|
||||
bridge_glapi_files = files(
|
||||
'../entry.c',
|
||||
'libgl_public.c',
|
||||
'../entry.h',
|
||||
'../entry_x86-64_tls.h',
|
||||
'../entry_x86_tls.h',
|
||||
|
|
|
|||
45
src/mapi/shared-glapi/core.c
Normal file
45
src/mapi/shared-glapi/core.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Copyright (C) 2010 LunarG Inc.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "entry.h"
|
||||
#include "glapi/glapi.h"
|
||||
#include "util/u_endian.h"
|
||||
#include "util/u_thread.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86_tls.h"
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_x86-64_tls.h"
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "entry_ppc64le_tls.h"
|
||||
#else
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES
|
||||
#include "mapi_tmp.h"
|
||||
|
||||
#ifndef MAPI_MODE_BRIDGE
|
||||
|
||||
mapi_func
|
||||
entry_get_public(int slot)
|
||||
{
|
||||
/* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
|
||||
return public_entries[slot];
|
||||
}
|
||||
|
||||
#endif /* MAPI_MODE_BRIDGE */
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
files_shared_glapi = files(
|
||||
'../entry.c',
|
||||
'core.c',
|
||||
'../u_current.c',
|
||||
'glapi.c',
|
||||
'stub.c',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue