From 3c257e187bded9417d00471286d86ea4e483a98a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Mar 2001 17:19:58 +0000 Subject: New mechanism for thread-safe GL API dispatch. C-based dispatch is faster. Folded glapinoop.c code into glapi.c. Added code to glapitemp.h to fill in dispatch tables. Updated Makefiles. --- src/mesa/main/Makefile.DJ | 22 ++-------------- src/mesa/main/Makefile.X11 | 5 ++-- src/mesa/main/context.c | 3 +-- src/mesa/main/dispatch.c | 65 ++++++++-------------------------------------- 4 files changed, 16 insertions(+), 79 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/Makefile.DJ b/src/mesa/main/Makefile.DJ index 89cbd82eca..4eaafa6079 100644 --- a/src/mesa/main/Makefile.DJ +++ b/src/mesa/main/Makefile.DJ @@ -1,29 +1,12 @@ -# $Id: Makefile.DJ,v 1.9 2000/09/26 21:22:20 brianp Exp $ +# $Id: Makefile.DJ,v 1.10 2001/03/28 17:19:58 brianp Exp $ # Mesa 3-D graphics library # Version: 3.5 -# Copyright (C) 1995-1998 Brian Paul -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - +# Copyright (C) 1995-2001 Brian Paul # Makefile for core library for MS-DOS using djgpp - - ##### MACROS ##### VPATH = RCS @@ -67,7 +50,6 @@ CORE_SOURCES = \ fog.c \ get.c \ glapi.c \ - glapinoop.c \ glthread.c \ hash.c \ hint.c \ diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index a2c0388f3b..fe2e4cece9 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,8 +1,8 @@ -# $Id: Makefile.X11,v 1.47 2001/03/19 02:25:35 keithw Exp $ +# $Id: Makefile.X11,v 1.48 2001/03/28 17:19:58 brianp Exp $ # Mesa 3-D graphics library # Version: 3.5 -# Copyright (C) 1995-2000 Brian Paul +# Copyright (C) 1995-2001 Brian Paul # Makefile for core library @@ -74,7 +74,6 @@ CORE_SOURCES = \ fog.c \ get.c \ glapi.c \ - glapinoop.c \ glthread.c \ hash.c \ highpc.c \ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index c9f180ec0f..6a97bb828d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.130 2001/03/24 06:01:27 gareth Exp $ */ +/* $Id: context.c,v 1.131 2001/03/28 17:20:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -39,7 +39,6 @@ #include "extensions.h" #include "fog.h" #include "get.h" -#include "glapinoop.h" #include "glthread.h" #include "hash.h" #include "imports.h" diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index 0b9b17effc..cc14c4b498 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -1,4 +1,4 @@ -/* $Id: dispatch.c,v 1.21 2001/03/26 23:36:51 brianp Exp $ */ +/* $Id: dispatch.c,v 1.22 2001/03/28 17:20:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -28,9 +28,7 @@ /* * This file generates all the gl* function entyrpoints. * But if we're using X86-optimized dispatch (X86/glapi_x86.S) then - * each of the entrypoints will be prefixed with _glapi_fallback_* - * and will be called by the glapi_x86.S code when we're in thread- - * safe mode. + * we don't use this file's code. * * Eventually this file may be replaced by automatically generated * code from an API spec file. @@ -41,7 +39,6 @@ */ - #ifdef PC_HEADER #include "all.h" #else @@ -51,64 +48,21 @@ #include "glthread.h" #endif - +#if !defined(USE_X86_ASM) #define KEYWORD1 #define KEYWORD2 GLAPIENTRY -#if defined(USE_X86_ASM) && !defined(__WIN32__) && !defined(XF86DRI) -#define NAME(func) _glapi_fallback_##func -#elif defined(USE_MGL_NAMESPACE) +#if defined(USE_MGL_NAMESPACE) #define NAME(func) mgl##func #else #define NAME(func) gl##func #endif -#ifdef DEBUG - -#if 0 -static int -trace(void) -{ - static int trace = -1; - if (trace < 0) - trace = getenv("MESA_TRACE") ? 1 : 0; - return trace > 0; -} -#endif - -#define F stderr - -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - (dispatch->FUNC) ARGS - -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - return (dispatch->FUNC) ARGS - -#if 0 - /* From both macros above... */ - if (trace()) { \ - fprintf MESSAGE; \ - fprintf(F, "\n"); \ - } -#endif - -#else - -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - (dispatch->FUNC) ARGS +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + (_glapi_Dispatch->FUNC) ARGS -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - return (dispatch->FUNC) ARGS - -#endif +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + return (_glapi_Dispatch->FUNC) ARGS #ifndef GLAPIENTRY @@ -116,3 +70,6 @@ trace(void) #endif #include "glapitemp.h" + + +#endif /* USE_X86_ASM */ -- cgit v1.2.3