diff options
author | gareth <gareth> | 2001-02-15 04:14:20 +0000 |
---|---|---|
committer | gareth <gareth> | 2001-02-15 04:14:20 +0000 |
commit | 1226ea02580549b01f75bca951ef13275b70d745 (patch) | |
tree | e807e3f2b84f129d655a6de2004dc97b11d064b4 | |
parent | 919c3f49ff28b63a1034ac434de612b1a4439f3d (diff) |
Full merge from trunk.
170 files changed, 34028 insertions, 6602 deletions
diff --git a/xc/config/cf/Imake.rules b/xc/config/cf/Imake.rules index 9ddd70a76..1767e8188 100644 --- a/xc/config/cf/Imake.rules +++ b/xc/config/cf/Imake.rules @@ -1297,8 +1297,8 @@ ProgramTargetName($(RMAN)): @@\ #ifndef BuildInstallHtmlManPage #if BuildHtmlManPages +XCOMM Don't do: 'AllTarget(dest.suffix.html)'. It breaks external packages #define BuildInstallHtmlManPage(file,dest,suffix) @@\ -AllTarget(dest.suffix.html) @@\ @@\ dest.suffix.html: file.man RmanCmdDependency @@\ RemoveFiles(dest.suffix.html dest.suffix-html) @@\ diff --git a/xc/config/cf/host.def b/xc/config/cf/host.def index 4a2e9c182..bdf4e48e4 100644 --- a/xc/config/cf/host.def +++ b/xc/config/cf/host.def @@ -1,6 +1,11 @@ +#define DefaultGcc2AxpOpt -O2 -mcpu=ev6 #define DefaultGcc2i386Opt -O2 +#ifdef AlphaArchitecture +#define LibraryCDebugFlags -O2 -mcpu=ev6 +#else #define LibraryCDebugFlags -O2 +#endif #define BuildServersOnly YES #define XF86CardDrivers vga tdfx i810 mga ati glint #define LinuxDistribution LinuxRedHat @@ -36,6 +41,7 @@ /* #define GlxBuiltInI810 YES */ /* #define GlxBuiltInMga YES */ /* #define GlxBuiltInR128 YES */ +/* #define GlxBuiltInRadeon YES */ /* #define DoLoadableServer NO */ /* Optionally turn this on to change the place where you install the build */ diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index 926e0b483..c0f463c39 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -2,19 +2,19 @@ /* * Mesa 3-D graphics library * Version: 3.4.1 - * + * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * + * * 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 @@ -1811,7 +1811,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], alphaIndex = 0; stride = 1; break; - case GL_LUMINANCE: + case GL_LUMINANCE: redIndex = greenIndex = blueIndex = 0; alphaIndex = -1; stride = 1; @@ -2159,7 +2159,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; - rgba[i][rComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); + rgba[i][rComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); rgba[i][gComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 16) & 0xff); rgba[i][bComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 8) & 0xff); rgba[i][aComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p ) & 0xff); @@ -2173,7 +2173,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], rgba[i][rComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p ) & 0xff); rgba[i][gComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 8) & 0xff); rgba[i][bComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 16) & 0xff); - rgba[i][aComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); + rgba[i][aComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); } } break; @@ -2262,7 +2262,7 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, GLboolean applyTransferOps ) { ASSERT(dstFormat == GL_ALPHA || - dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || dstFormat == GL_RGB || @@ -2474,7 +2474,7 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstLuminanceIndex = dstIntensityIndex = -1; break; - case GL_LUMINANCE: + case GL_LUMINANCE: dstLuminanceIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstIntensityIndex = -1; @@ -2581,7 +2581,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, GLboolean applyTransferOps, GLboolean clamp ) { ASSERT(dstFormat == GL_ALPHA || - dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || dstFormat == GL_RGB || @@ -2743,7 +2743,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstLuminanceIndex = dstIntensityIndex = -1; break; - case GL_LUMINANCE: + case GL_LUMINANCE: dstLuminanceIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstIntensityIndex = -1; diff --git a/xc/extras/Mesa/src/tritemp.h b/xc/extras/Mesa/src/tritemp.h index a2bd6565e..eca61a9ce 100644 --- a/xc/extras/Mesa/src/tritemp.h +++ b/xc/extras/Mesa/src/tritemp.h @@ -1,4 +1,4 @@ -/* $Id: tritemp.h,v 1.14.8.1 2001/02/14 06:02:03 gareth Exp $ */ +/* $Id: tritemp.h,v 1.14.8.2 2001/02/15 04:14:20 gareth Exp $ */ /* * Mesa 3-D graphics library diff --git a/xc/extras/freetype2/builds/cygwin/mkinstalldirs b/xc/extras/freetype2/builds/cygwin/mkinstalldirs index 95ff6dfc6..0ce1b8549 100644 --- a/xc/extras/freetype2/builds/cygwin/mkinstalldirs +++ b/xc/extras/freetype2/builds/cygwin/mkinstalldirs @@ -4,7 +4,7 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.1.2.1 2000/12/22 01:43:07 gareth Exp $ +# $Id: mkinstalldirs,v 1.1.2.2 2001/02/15 04:14:20 gareth Exp $ errstatus=0 diff --git a/xc/extras/freetype2/builds/unix/mkinstalldirs b/xc/extras/freetype2/builds/unix/mkinstalldirs index b030aace6..0ce1b8549 100755 --- a/xc/extras/freetype2/builds/unix/mkinstalldirs +++ b/xc/extras/freetype2/builds/unix/mkinstalldirs @@ -4,7 +4,7 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.1.2.1 2000/12/22 01:43:08 gareth Exp $ +# $Id: mkinstalldirs,v 1.1.2.2 2001/02/15 04:14:20 gareth Exp $ errstatus=0 diff --git a/xc/extras/ogl-sample/main/doc/man/manglw/Distfile b/xc/extras/ogl-sample/main/doc/man/manglw/Distfile index 8a5002e2d..43ed76398 100755 --- a/xc/extras/ogl-sample/main/doc/man/manglw/Distfile +++ b/xc/extras/ogl-sample/main/doc/man/manglw/Distfile @@ -1,6 +1,6 @@ # -# $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/Distfile,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +# $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/Distfile,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ # DISTDIR_SI = /xc/doc/man/GL/glw diff --git a/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile b/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile index 39baa7fb4..6bdce56f1 100755 --- a/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile +++ b/xc/extras/ogl-sample/main/doc/man/manglw/GNUmakefile @@ -32,8 +32,8 @@ # published by SGI, but has not been independently verified as being # compliant with the OpenGL(R) version 1.2.1 Specification. # -# $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/GNUmakefile,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +# $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/doc/man/manglw/Attic/GNUmakefile,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ COMMONPREF = standard include $(ROOT)/usr/include/make/commondefs diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile b/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile index 926d3f6f2..9d092269b 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/Distfile @@ -1,6 +1,6 @@ # -# $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/Distfile,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +# $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/Distfile,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ # DISTFILES_SI = \ diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c index e506f7926..288f5ccdc 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c @@ -31,13 +31,13 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ */ /* utility routines for GLX. * Since these routines are used both in the Motif and X versions of * the widget, they cannot peek directly into the structure * - * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDAUtil.c,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ + * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDAUtil.c,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ */ /* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c,v 1.2 2000/11/02 20:39:06 dawes Exp $ */ diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c index 4e917b7e4..72f4d96cb 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.c @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.c,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.c,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ */ #include <stdio.h> diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h index b2052beb5..d5e2a3f9c 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.h,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawA.h,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h index 91189a345..abe734b62 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawAP.h,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwDrawAP.h,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c index 7cd5c1a23..8345d4d5b 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.c @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.c,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.c,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ */ #ifndef __GLX_MOTIF diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h index a275aec47..837c436bb 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.h,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawA.h,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h index b36bb7b93..d9244406a 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawAP.h,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GLwMDrawAP.h,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ */ /* diff --git a/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile b/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile index 4dc3eb204..a9e37fb51 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile +++ b/xc/extras/ogl-sample/main/gfx/lib/glw/GNUmakefile @@ -32,8 +32,8 @@ # published by SGI, but has not been independently verified as being # compliant with the OpenGL(R) version 1.2.1 Specification. # -# $Date: 2000/11/08 02:53:56 $ $Revision: 1.1.1.1 $ -# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GNUmakefile,v 1.1.1.1 2000/11/08 02:53:56 dawes Exp $ +# $Date: 2001/02/15 04:14:20 $ $Revision: 1.1.10.1 $ +# $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glw/Attic/GNUmakefile,v 1.1.10.1 2001/02/15 04:14:20 gareth Exp $ include $(ROOT)/usr/include/make/commondefs diff --git a/xc/include/GL/glx.h b/xc/include/GL/glx.h index ac7284edc..220ec321b 100644 --- a/xc/include/GL/glx.h +++ b/xc/include/GL/glx.h @@ -1,11 +1,10 @@ #ifndef __GLX_glx_h__ #define __GLX_glx_h__ -/* $XFree86: xc/include/GL/glx.h,v 1.7 2000/06/30 18:27:00 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.0 (the "License"), the contents of this +** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 @@ -34,6 +33,9 @@ ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** $Date: 2001/02/15 04:14:20 $ $Revision: 1.9.42.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glx.h,v 1.9.42.1 2001/02/15 04:14:20 gareth Exp $ */ #include <X11/Xlib.h> diff --git a/xc/include/GL/glxmd.h b/xc/include/GL/glxmd.h index 9b634840e..ed0da232a 100644 --- a/xc/include/GL/glxmd.h +++ b/xc/include/GL/glxmd.h @@ -1,26 +1,41 @@ #ifndef _GLX_glxmd_h_ #define _GLX_glxmd_h_ -/* $XFree86: xc/include/GL/glxmd.h,v 1.2 1999/06/14 07:23:28 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glxmd.h,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ /* diff --git a/xc/include/GL/glxproto.h b/xc/include/GL/glxproto.h index a6659cde1..0bbc8aaa6 100644 --- a/xc/include/GL/glxproto.h +++ b/xc/include/GL/glxproto.h @@ -1,47 +1,75 @@ #ifndef _GLX_glxproto_h_ #define _GLX_glxproto_h_ -/* $XFree86: xc/include/GL/glxproto.h,v 1.2 1999/06/14 07:23:29 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glxproto.h,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ -#include "GL/glxmd.h" +#include "glxmd.h" /*****************************************************************************/ /* ** Errrors. -*/ -#define GLXBadContext 0 +*/ +#define GLXBadContext 0 #define GLXBadContextState 1 #define GLXBadDrawable 2 #define GLXBadPixmap 3 #define GLXBadContextTag 4 #define GLXBadCurrentWindow 5 -#define GLXBadRenderRequest 6 -#define GLXBadLargeRequest 7 +#define GLXBadRenderRequest 6 +#define GLXBadLargeRequest 7 #define GLXUnsupportedPrivateRequest 8 +#define GLXBadFBConfig 9 +#define GLXBadPbuffer 10 +#define GLXBadCurrentDrawable 11 +#define GLXBadWindow 12 + +#define __GLX_NUMBER_ERRORS 12 + +/* +** Events. +** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX +** event - this helps initialization if the server supports the pbuffer +** extension and the client doesn't. +*/ +#define GLX_PbufferClobber 0 -#define __GLX_NUMBER_ERRORS 8 -#define __GLX_NUMBER_EVENTS 1 +#define __GLX_NUMBER_EVENTS 17 #define GLX_EXTENSION_NAME "GLX" #define GLX_EXTENSION_ALIAS "SGI-GLX" @@ -62,6 +90,11 @@ #define GLXContextID CARD32 #define GLXPixmap CARD32 #define GLXDrawable CARD32 +#define GLXPbuffer CARD32 +#define GLXWindow CARD32 +#define GLXFBConfigID CARD32 +#define GLXFBConfigIDSGIX CARD32 +#define GLXPbufferSGIX CARD32 /* ** ContextTag is not exposed to the API. @@ -106,7 +139,7 @@ typedef struct GLXRender { /* ** Large render command request. A single large rendering command -** is output in multiple X extension requests. The first packet +** is output in multiple X extension requests. The first packet ** contains an opcode dependent header (see below) that describes ** the data that follows. */ @@ -122,7 +155,7 @@ typedef struct GLXRenderLarge { #define sz_xGLXRenderLargeReq 16 /* -** GLX single request. Commands that go over as single GLX protocol +** GLX single request. Commands that go over as single GLX protocol ** requests use this structure. The glxCode will be one of the X_GLsop ** opcodes. */ @@ -192,7 +225,7 @@ typedef struct GLXMakeCurrent { CARD8 reqType; CARD8 glxCode; CARD16 length B16; - GLXDrawable drawable B32; + GLXDrawable drawable B32; GLXContextID context B32; GLXContextTag oldContextTag B32; } xGLXMakeCurrentReq; @@ -242,7 +275,7 @@ typedef struct GLXSwapBuffers { CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; - GLXDrawable drawable B32; + GLXDrawable drawable B32; } xGLXSwapBuffersReq; #define sz_xGLXSwapBuffersReq 12 @@ -331,10 +364,10 @@ typedef struct GLXVendorPrivateWithReply { ** glXQueryExtensionsString request */ typedef struct GLXQueryExtensionsString { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 screen B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; } xGLXQueryExtensionsStringReq; #define sz_xGLXQueryExtensionsStringReq 8 @@ -342,11 +375,11 @@ typedef struct GLXQueryExtensionsString { ** glXQueryServerString request */ typedef struct GLXQueryServerString { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 screen B32; - CARD32 name B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + CARD32 name B32; } xGLXQueryServerStringReq; #define sz_xGLXQueryServerStringReq 12 @@ -354,29 +387,174 @@ typedef struct GLXQueryServerString { ** glXClientInfo request */ typedef struct GLXClientInfo { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 major B32; - CARD32 minor B32; - CARD32 numbytes B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 major B32; + CARD32 minor B32; + CARD32 numbytes B32; } xGLXClientInfoReq; #define sz_xGLXClientInfoReq 16 +/*** Start of GLX 1.3 requests */ + /* -** glXQueryContextInfoEXT request +** glXGetFBConfigs request */ -typedef struct GLXQueryContextInfoEXT { +typedef struct GLXGetFBConfigs { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; +} xGLXGetFBConfigsReq; +#define sz_xGLXGetFBConfigsReq 8 + +/* +** glXCreatePixmap request +*/ +typedef struct GLXCreatePixmap { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + CARD32 pixmap B32; + GLXPixmap glxpixmap B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreatePixmapReq; +#define sz_xGLXCreatePixmapReq 24 + +/* +** glXDestroyPixmap request +*/ +typedef struct GLXDestroyPixmap { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXPixmap glxpixmap B32; +} xGLXDestroyPixmapReq; +#define sz_xGLXDestroyPixmapReq 8 + +/* +** glXCreateNewContext request +*/ +typedef struct GLXCreateNewContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; - CARD32 vendorCode B32; /* vendor-specific opcode */ - CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXContextID context B32; -} xGLXQueryContextInfoEXTReq; -#define sz_xGLXQueryContextInfoEXTReq 16 + GLXFBConfigID fbconfig B32; + CARD32 screen B32; + CARD32 renderType; + GLXContextID shareList B32; + BOOL isDirect; + CARD8 reserved1; + CARD16 reserved2 B16; +} xGLXCreateNewContextReq; +#define sz_xGLXCreateNewContextReq 28 -/************************************************************************/ +/* +** glXQueryContext request +*/ +typedef struct GLXQueryContext { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXContextID context B32; +} xGLXQueryContextReq; +#define sz_xGLXQueryContextReq 8 + +/* +** glXMakeContextCurrent request +*/ +typedef struct GLXMakeContextCurrent { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXContextTag oldContextTag B32; + GLXDrawable drawable B32; + GLXDrawable readdrawable B32; + GLXContextID context B32; +} xGLXMakeContextCurrentReq; +#define sz_xGLXMakeContextCurrentReq 20 + +/* +** glXCreatePbuffer request +*/ +typedef struct GLXCreatePbuffer { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + GLXPbuffer pbuffer B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreatePbufferReq; +#define sz_xGLXCreatePbufferReq 20 + +/* +** glXDestroyPbuffer request +*/ +typedef struct GLXDestroyPbuffer { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXPbuffer pbuffer B32; +} xGLXDestroyPbufferReq; +#define sz_xGLXDestroyPbufferReq 8 + +/* +** glXGetDrawableAttributes request +*/ +typedef struct GLXGetDrawableAttributes { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXDrawable drawable B32; +} xGLXGetDrawableAttributesReq; +#define sz_xGLXGetDrawableAttributesReq 8 + +/* +** glXChangeDrawableAttributes request +*/ +typedef struct GLXChangeDrawableAttributes { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXDrawable drawable B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXChangeDrawableAttributesReq; +#define sz_xGLXChangeDrawableAttributesReq 12 + +/* +** glXCreateWindow request +*/ +typedef struct GLXCreateWindow { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + CARD32 window B32; + GLXWindow glxwindow B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreateWindowReq; +#define sz_xGLXCreateWindowReq 24 + +/* +** glXDestroyWindow request +*/ +typedef struct GLXDestroyWindow { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXWindow glxwindow B32; +} xGLXDestroyWindowReq; +#define sz_xGLXDestroyWindowReq 8 /* Replies */ @@ -431,7 +609,7 @@ typedef struct { CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; - CARD32 pad5 B32; + CARD32 depth B32; CARD32 pad6 B32; } xGLXGetTexImageReply; #define sz_xGLXGetTexImageReply 32 @@ -441,6 +619,62 @@ typedef struct { CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 height B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetSeparableFilterReply; +#define sz_xGLXGetSeparableFilterReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 height B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetConvolutionFilterReply; +#define sz_xGLXGetConvolutionFilterReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetHistogramReply; +#define sz_xGLXGetHistogramReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetMinmaxReply; +#define sz_xGLXGetMinmaxReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 newMode B32; @@ -520,16 +754,16 @@ typedef struct { ** the number of words of data which follow the header. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 retval B32; - CARD32 size B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 retval B32; + CARD32 size B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXVendorPrivReply; #define sz_xGLXVendorPrivReply 32 @@ -538,16 +772,16 @@ typedef struct { ** n indicates the number of bytes to be returned. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad1 B32; - CARD32 n B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 n B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXQueryExtensionsStringReply; #define sz_xGLXQueryExtensionsStringReply 32 @@ -556,19 +790,142 @@ typedef struct { ** n indicates the number of bytes to be returned. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad1 B32; - CARD32 n B32; - CARD32 pad3 B32; /* NOTE: may hold a single value */ - CARD32 pad4 B32; /* NOTE: may hold half a double */ - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 n B32; + CARD32 pad3 B32; /* NOTE: may hold a single value */ + CARD32 pad4 B32; /* NOTE: may hold half a double */ + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXQueryServerStringReply; #define sz_xGLXQueryServerStringReply 32 +/*** Start of GLX 1.3 replies */ + +/* +** glXGetFBConfigs reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 numFBConfigs B32; + CARD32 numAttribs B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetFBConfigsReply; +#define sz_xGLXGetFBConfigsReply 32 + +/* +** glXQueryContext reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 n B32; /* number of attribute/value pairs */ + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXQueryContextReply; +#define sz_xGLXQueryContextReply 32 + +/* +** glXMakeContextCurrent reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + GLXContextTag contextTag B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXMakeContextCurrentReply; +#define sz_xGLXMakeContextCurrentReply 32 + +/* +** glXCreateGLXPbuffer reply +** This is used only in the direct rendering case on SGIs - otherwise +** CreateGLXPbuffer has no reply. It is not part of GLX 1.3. +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 success; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXCreateGLXPbufferReply; +#define sz_xGLXCreateGLXPbufferReply 32 + +/* +** glXGetDrawableAttributes reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 numAttribs B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetDrawableAttributesReply; +#define sz_xGLXGetDrawableAttributesReply 32 + +/* +** glXGetColorTable reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetColorTableReply; +#define sz_xGLXGetColorTableReply 32 + +/************************************************************************/ + +/* GLX extension requests and replies */ + +/* +** glXQueryContextInfoEXT request +*/ +typedef struct GLXQueryContextInfoEXT { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 vendorCode B32; /* vendor-specific opcode */ + CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ + GLXContextID context B32; +} xGLXQueryContextInfoEXTReq; +#define sz_xGLXQueryContextInfoEXTReq 16 + /* ** glXQueryContextInfoEXT reply */ @@ -577,7 +934,7 @@ typedef struct { CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; - CARD32 n B32; /* number of attribute/value pairs */ + CARD32 n B32; /* number of attribute/value pairs */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; @@ -589,6 +946,29 @@ typedef struct { /************************************************************************/ /* +** Events +*/ + +typedef struct { + BYTE type; + BYTE pad; + CARD16 sequenceNumber B16; + CARD16 event_type B16; /*** was clobber_class */ + CARD16 draw_type B16; + CARD32 drawable B32; + CARD32 buffer_mask B32; /*** was mask */ + CARD16 aux_buffer B16; + CARD16 x B16; + CARD16 y B16; + CARD16 width B16; + CARD16 height B16; + CARD16 count B16; + CARD32 unused2 B32; +} xGLXPbufferClobberEvent; + +/************************************************************************/ + +/* ** Size of the standard X request header. */ #define __GLX_SINGLE_HDR_SIZE sz_xGLXSingleReq @@ -617,7 +997,8 @@ typedef struct { /* ** The glBitmap, glPolygonStipple, glTexImage[12]D, glTexSubImage[12]D ** and glDrawPixels calls all have a pixel header transmitted after the -** Render or RenderLarge header and before their own opcode specific headers. +** Render or RenderLarge header and before their own opcode specific +** headers. */ #define __GLX_PIXEL_HDR \ BOOL swapBytes; \ @@ -626,7 +1007,7 @@ typedef struct { CARD8 reserved1; \ CARD32 rowLength B32; \ CARD32 skipRows B32; \ - CARD32 skipPixels B32; \ + CARD32 skipPixels B32; \ CARD32 alignment B32 #define __GLX_PIXEL_HDR_SIZE 20 @@ -636,6 +1017,27 @@ typedef struct { } __GLXpixelHeader; /* +** glTexImage[34]D and glTexSubImage[34]D calls +** all have a pixel header transmitted after the Render or RenderLarge +** header and before their own opcode specific headers. +*/ +#define __GLX_PIXEL_3D_HDR \ + BOOL swapBytes; \ + BOOL lsbFirst; \ + CARD8 reserved0; \ + CARD8 reserved1; \ + CARD32 rowLength B32; \ + CARD32 imageHeight B32; \ + CARD32 imageDepth B32; \ + CARD32 skipRows B32; \ + CARD32 skipImages B32; \ + CARD32 skipVolumes B32; \ + CARD32 skipPixels B32; \ + CARD32 alignment B32 + +#define __GLX_PIXEL_3D_HDR_SIZE 36 + +/* ** Data that is specific to a glBitmap call. The data is sent in the ** following order: ** Render or RenderLarge header @@ -683,19 +1085,18 @@ typedef struct { #define __GLX_POLYGONSTIPPLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE) - /* ** Data that is specific to a glTexImage1D or glTexImage2D call. The ** data is sent in the following order: -** Render or RenderLarge header -** Pixel header -** TexImage header +** Render or RenderLarge header +** Pixel header +** TexImage header ** When a glTexImage1D call the height field is unexamined by the server. */ #define __GLX_TEXIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ - CARD32 components B32; \ + CARD32 components B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 border B32; \ @@ -728,12 +1129,62 @@ typedef struct { } __GLXdispatchTexImageHeader; /* -** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The +** Data that is specific to a glTexImage3D or glTexImage4D call. The ** data is sent in the following order: -** Render or RenderLarge header -** Pixel header -** TexSubImage header -** When a glTexSubImage1D call is made, the yoffset and height fields +** Render or RenderLarge header +** Pixel 3D header +** TexImage 3D header +** When a glTexImage3D call the size4d and woffset fields are unexamined +** by the server. +** Could be used by all TexImage commands and perhaps should be in the +** future. +*/ +#define __GLX_TEXIMAGE_3D_HDR \ + CARD32 target B32; \ + CARD32 level B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 depth B32; \ + CARD32 size4d B32; \ + CARD32 border B32; \ + CARD32 format B32; \ + CARD32 type B32; \ + CARD32 nullimage B32 + +#define __GLX_TEXIMAGE_3D_HDR_SIZE 44 + +#define __GLX_TEXIMAGE_3D_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ + __GLX_TEXIMAGE_3D_HDR_SIZE) + +#define __GLX_TEXIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXIMAGE_3D_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXtexImage3DHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXtexImage3DLargeHeader; + +typedef struct { + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXdispatchTexImage3DHeader; + +/* +** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The +** data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** TexSubImage header +** When a glTexSubImage1D call is made, the yoffset and height fields ** are unexamined by the server and are considered to be padding. */ #define __GLX_TEXSUBIMAGE_HDR \ @@ -773,11 +1224,61 @@ typedef struct { } __GLXdispatchTexSubImageHeader; /* +** Data that is specific to a glTexSubImage3D and 4D calls. The +** data is sent in the following order: +** Render or RenderLarge header +** Pixel 3D header +** TexSubImage 3D header +** When a glTexSubImage3D call is made, the woffset and size4d fields +** are unexamined by the server and are considered to be padding. +*/ +#define __GLX_TEXSUBIMAGE_3D_HDR \ + CARD32 target B32; \ + CARD32 level B32; \ + CARD32 xoffset B32; \ + CARD32 yoffset B32; \ + CARD32 zoffset B32; \ + CARD32 woffset B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 depth B32; \ + CARD32 size4d B32; \ + CARD32 format B32; \ + CARD32 type B32; \ + CARD32 nullImage \ + +#define __GLX_TEXSUBIMAGE_3D_HDR_SIZE 52 + +#define __GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) + +#define __GLX_TEXSUBIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXtexSubImage3DHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXtexSubImage3DLargeHeader; + +typedef struct { + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXdispatchTexSubImage3DHeader; + +/* ** Data that is specific to a glDrawPixels call. The data is sent in the ** following order: ** Render or RenderLarge header ** Pixel header -** Bitmap header +** DrawPixels header */ #define __GLX_DRAWPIXELS_HDR \ CARD32 width B32; \ @@ -811,6 +1312,46 @@ typedef struct { } __GLXdispatchDrawPixelsHeader; /* +** Data that is specific to a glConvolutionFilter1D or glConvolutionFilter2D +** call. The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ConvolutionFilter header +** When a glConvolutionFilter1D call the height field is unexamined by the server. +*/ +#define __GLX_CONV_FILT_HDR \ + CARD32 target B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_CONV_FILT_HDR_SIZE 24 + +#define __GLX_CONV_FILT_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) + +#define __GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXConvolutionFilterHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXConvolutionFilterLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXdispatchConvolutionFilterHeader; + +/* ** Data that is specific to a glDrawArraysEXT call. The data is sent in the ** following order: ** Render or RenderLarge header @@ -822,7 +1363,7 @@ typedef struct { #define __GLX_DRAWARRAYS_HDR \ CARD32 numVertexes B32; \ CARD32 numComponents B32; \ - CARD32 primType B32 + CARD32 primType B32 #define __GLX_DRAWARRAYS_HDR_SIZE 12 @@ -846,7 +1387,7 @@ typedef struct { #define __GLX_COMPONENT_HDR \ CARD32 datatype B32; \ INT32 numVals B32; \ - CARD32 component B32 + CARD32 component B32 typedef struct { __GLX_COMPONENT_HDR; @@ -854,6 +1395,81 @@ typedef struct { #define __GLX_COMPONENT_HDR_SIZE 12 +/* +** Data that is specific to a glColorTable call +** The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ColorTable header +*/ + +#define __GLX_COLOR_TABLE_HDR \ + CARD32 target B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_COLOR_TABLE_HDR_SIZE 20 + +#define __GLX_COLOR_TABLE_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_COLOR_TABLE_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXColorTableHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXColorTableLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXdispatchColorTableHeader; + +/* +** Data that is specific to a glColorSubTable call +** The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ColorTable header +*/ + +#define __GLX_COLOR_SUBTABLE_HDR \ + CARD32 target B32; \ + CARD32 start B32; \ + CARD32 count B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_COLOR_SUBTABLE_HDR_SIZE 20 + +#define __GLX_COLOR_SUBTABLE_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + \ + __GLX_COLOR_SUBTABLE_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXColorSubTableHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXColorSubTableLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXdispatchColorSubTableHeader; + /*****************************************************************************/ @@ -863,6 +1479,11 @@ typedef struct { #undef GLXContextID #undef GLXPixmap #undef GLXDrawable +#undef GLXPbuffer +#undef GLXWindow +#undef GLXFBConfigID +#undef GLXFBConfigIDSGIX +#undef GLXPbufferSGIX /* Opcodes for GLX commands */ @@ -933,6 +1554,23 @@ typedef struct { #define X_GLsop_GetTexLevelParameteriv 139 #define X_GLsop_IsEnabled 140 #define X_GLsop_IsList 141 +#define X_GLsop_AreTexturesResident 143 +#define X_GLsop_DeleteTextures 144 +#define X_GLsop_GenTextures 145 +#define X_GLsop_IsTexture 146 +#define X_GLsop_GetColorTable 147 +#define X_GLsop_GetColorTableParameterfv 148 +#define X_GLsop_GetColorTableParameteriv 149 +#define X_GLsop_GetConvolutionFilter 150 +#define X_GLsop_GetConvolutionParameterfv 151 +#define X_GLsop_GetConvolutionParameteriv 152 +#define X_GLsop_GetSeparableFilter 153 +#define X_GLsop_GetHistogram 154 +#define X_GLsop_GetHistogramParameterfv 155 +#define X_GLsop_GetHistogramParameteriv 156 +#define X_GLsop_GetMinmax 157 +#define X_GLsop_GetMinmaxParameterfv 158 +#define X_GLsop_GetMinmaxParameteriv 159 /* Opcodes for rendering commands */ @@ -1127,8 +1765,8 @@ typedef struct { #define X_GLrop_Translated 189 #define X_GLrop_Translatef 190 #define X_GLrop_Viewport 191 -#define X_GLrop_DrawArrays 4116 -#define X_GLrop_PolygonOffset 4098 +#define X_GLrop_DrawArrays 193 +#define X_GLrop_PolygonOffset 192 #define X_GLrop_CopyTexImage1D 4119 #define X_GLrop_CopyTexImage2D 4120 #define X_GLrop_CopyTexSubImage1D 4121 @@ -1138,14 +1776,56 @@ typedef struct { #define X_GLrop_BindTexture 4117 #define X_GLrop_PrioritizeTextures 4118 #define X_GLrop_Indexubv 194 +#define X_GLrop_BlendColor 4096 +#define X_GLrop_BlendEquation 4097 +#define X_GLrop_ColorTable 2053 +#define X_GLrop_ColorTableParameterfv 2054 +#define X_GLrop_ColorTableParameteriv 2055 +#define X_GLrop_CopyColorTable 2056 +#define X_GLrop_ColorSubTable 195 +#define X_GLrop_CopyColorSubTable 196 +#define X_GLrop_ConvolutionFilter1D 4101 +#define X_GLrop_ConvolutionFilter2D 4102 +#define X_GLrop_ConvolutionParameterf 4103 +#define X_GLrop_ConvolutionParameterfv 4104 +#define X_GLrop_ConvolutionParameteri 4105 +#define X_GLrop_ConvolutionParameteriv 4106 +#define X_GLrop_CopyConvolutionFilter1D 4107 +#define X_GLrop_CopyConvolutionFilter2D 4108 +#define X_GLrop_SeparableFilter2D 4109 +#define X_GLrop_Histogram 4110 +#define X_GLrop_Minmax 4111 +#define X_GLrop_ResetHistogram 4112 +#define X_GLrop_ResetMinmax 4113 +#define X_GLrop_TexImage3D 4114 +#define X_GLrop_TexSubImage3D 4115 +#define X_GLrop_CopyTexSubImage3D 4123 +#define X_GLrop_ActiveTextureARB 197 +#define X_GLrop_MultiTexCoord1dvARB 198 +#define X_GLrop_MultiTexCoord1fvARB 199 +#define X_GLrop_MultiTexCoord1ivARB 200 +#define X_GLrop_MultiTexCoord1svARB 201 +#define X_GLrop_MultiTexCoord2dvARB 202 +#define X_GLrop_MultiTexCoord2fvARB 203 +#define X_GLrop_MultiTexCoord2ivARB 204 +#define X_GLrop_MultiTexCoord2svARB 205 +#define X_GLrop_MultiTexCoord3dvARB 206 +#define X_GLrop_MultiTexCoord3fvARB 207 +#define X_GLrop_MultiTexCoord3ivARB 208 +#define X_GLrop_MultiTexCoord3svARB 209 +#define X_GLrop_MultiTexCoord4dvARB 210 +#define X_GLrop_MultiTexCoord4fvARB 211 +#define X_GLrop_MultiTexCoord4ivARB 212 +#define X_GLrop_MultiTexCoord4svARB 213 +#define X_GLrop_DrawArraysEXT 4116 /* Opcodes for Vendor Private commands */ -#define X_GLvop_AreTexturesResident 11 -#define X_GLvop_DeleteTextures 12 -#define X_GLvop_GenTextures 13 -#define X_GLvop_IsTexture 14 +#define X_GLvop_AreTexturesResidentEXT 11 +#define X_GLvop_DeleteTexturesEXT 12 +#define X_GLvop_GenTexturesEXT 13 +#define X_GLvop_IsTextureEXT 14 /* Opcodes for GLX vendor private commands */ diff --git a/xc/include/GL/glxtokens.h b/xc/include/GL/glxtokens.h index 8c4f2185a..211303ee9 100644 --- a/xc/include/GL/glxtokens.h +++ b/xc/include/GL/glxtokens.h @@ -1,11 +1,10 @@ #ifndef __GLX_glxtokens_h__ #define __GLX_glxtokens_h__ -/* $XFree86: xc/include/GL/glxtokens.h,v 1.4 2000/06/17 00:02:46 martin Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.0 (the "License"), the contents of this +** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 @@ -34,6 +33,9 @@ ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.6.42.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glxtokens.h,v 1.6.42.1 2001/02/15 04:14:21 gareth Exp $ */ #ifdef __cplusplus @@ -223,7 +225,6 @@ extern "C" { #define GLX_EXT_visual_rating 1 #define GLX_ARB_get_proc_address 1 - #ifdef __cplusplus } #endif diff --git a/xc/lib/GL/Imakefile b/xc/lib/GL/Imakefile index d7cf1884a..7c604c105 100644 --- a/xc/lib/GL/Imakefile +++ b/xc/lib/GL/Imakefile @@ -129,13 +129,14 @@ XCOMM nothing GAMMAPOBJS = mesa/src/drv/gamma/profiled/?*.o GAMMADONES = mesa/src/drv/gamma/DONE - DRVOBJS = $(GAMMAOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVOBJS = $(GAMMAOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) DRVUOBJS = $(GAMMAUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) DRVDOBJS = $(GAMMADOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) DRVPOBJS = $(GAMMAPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) DRVDONES = $(GAMMADONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src mesa/src/drv/gamma + DRVSUBDIRS = mesa/src/drv/gamma + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) #elif GlxBuiltInTdfx @@ -145,7 +146,7 @@ XCOMM nothing TDFXPOBJS = mesa/src/drv/tdfx/profiled/?*.o TDFXDONES = mesa/src/drv/tdfx/DONE - DRVOBJS = $(TDFXOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVOBJS = $(TDFXOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) DRVUOBJS = $(TDFXUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) DRVDOBJS = $(TDFXDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) DRVPOBJS = $(TDFXPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) @@ -153,7 +154,8 @@ XCOMM nothing REQUIREDLIBS += -lglide3 -ldl - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src mesa/src/drv/tdfx + DRVSUBDIRS = mesa/src/drv/tdfx + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) #elif GlxBuiltInI810 @@ -163,13 +165,14 @@ REQUIREDLIBS += -lglide3 -ldl I810POBJS = mesa/src/drv/i810/profiled/?*.o I810DONES = mesa/src/drv/i810/DONE - DRVOBJS = $(I810OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVOBJS = $(I810OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) DRVUOBJS = $(I810UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) DRVDOBJS = $(I810DOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) DRVPOBJS = $(I810POBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) DRVDONES = $(I810DONES) $(COMMONDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src mesa/src/drv/i810 + DRVSUBDIRS = mesa/src/drv/i810 + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) #elif GlxBuiltInMga @@ -179,13 +182,14 @@ REQUIREDLIBS += -lglide3 -ldl MGAPOBJS = mesa/src/drv/mga/profiled/?*.o MGADONES = mesa/src/drv/mga/DONE - DRVOBJS = $(MGAOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVOBJS = $(MGAOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) DRVUOBJS = $(MGAUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) DRVDOBJS = $(MGADOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) DRVPOBJS = $(MGAPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) DRVDONES = $(MGADONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src mesa/src/drv/mga + DRVSUBDIRS = mesa/src/drv/mga + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) #elif GlxBuiltInR128 @@ -195,13 +199,31 @@ REQUIREDLIBS += -lglide3 -ldl R128POBJS = mesa/src/drv/r128/profiled/?*.o R128DONES = mesa/src/drv/r128/DONE - DRVOBJS = $(R128OBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(R128UOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(R128DOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(R128POBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(R128DONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) + DRVOBJS = $(R128OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVUOBJS = $(R128UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) + DRVDOBJS = $(R128DOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) + DRVPOBJS = $(R128POBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) + DRVDONES = $(R128DONES) $(COMMONDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src mesa/src/drv/r128 + DRVSUBDIRS = mesa/src/drv/common mesa/src/drv/r128 + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) + +#elif GlxBuiltInRadeon + + RADEONOBJS = mesa/src/drv/radeon/?*.o + RADEONUOBJS = mesa/src/drv/radeon/unshared/?*.o + RADEONDOBJS = mesa/src/drv/radeon/debugger/?*.o + RADEONPOBJS = mesa/src/drv/radeon/profiled/?*.o + RADEONDONES = mesa/src/drv/radeon/DONE + + DRVOBJS = $(RADEONOBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVUOBJS = $(RADEONUOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) + DRVDOBJS = $(RADEONDOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) + DRVPOBJS = $(RADEONPOBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) + DRVDONES = $(RADEONDONES) $(COMMONDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) + + DRVSUBDIRS = mesa/src/drv/common mesa/src/drv/radeon + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) #elif GlxBuiltInFfb @@ -217,7 +239,8 @@ REQUIREDLIBS += -lglide3 -ldl DRVPOBJS = $(FFBPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) DRVDONES = $(FFBDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src mesa/src/drv/ffb + DRVSUBDIRS = mesa/src/drv/ffb + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) #elif GlxBuiltInSIS @@ -227,13 +250,14 @@ REQUIREDLIBS += -lglide3 -ldl SISPOBJS = mesa/src/drv/sis/profiled/?*.o SISDONES = mesa/src/drv/sis/DONE - DRVOBJS = $(SISOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVOBJS = $(SISOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) DRVUOBJS = $(SISUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) DRVDOBJS = $(SISDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) DRVPOBJS = $(SISPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) DRVDONES = $(SISDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src mesa/src/drv/sis + DRVSUBDIRS = mesa/src/drv/sis + GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) #elif GlxBuiltInMesa @@ -343,6 +367,7 @@ XCOMM libGL has now been made, continue with building the drivers. !GlxBuiltInI810 && \ !GlxBuiltInMga && \ !GlxBuiltInR128 && \ + !GlxBuiltInRadeon && \ !GlxBuiltInFfb && \ !GlxBuiltInSIS && \ !GlxBuiltInMesa diff --git a/xc/lib/GL/glx/clientattrib.c b/xc/lib/GL/glx/clientattrib.c index 0e23c09ad..c2e66d929 100644 --- a/xc/lib/GL/glx/clientattrib.c +++ b/xc/lib/GL/glx/clientattrib.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/clientattrib.c,v 1.4 2000/02/18 16:23:09 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.4.68.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/clientattrib.c,v 1.4.68.1 2001/02/15 04:14:21 gareth Exp $ */ #include <assert.h> @@ -32,22 +47,22 @@ void glEnableClientState(GLenum array) switch (array) { case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_TRUE; + gc->state.vertArray.color.enable = GL_TRUE; break; case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_TRUE; + gc->state.vertArray.edgeFlag.enable = GL_TRUE; break; case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_TRUE; + gc->state.vertArray.index.enable = GL_TRUE; break; case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_TRUE; + gc->state.vertArray.normal.enable = GL_TRUE; break; case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_TRUE; + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_TRUE; break; case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_TRUE; + gc->state.vertArray.vertex.enable = GL_TRUE; break; default: __glXSetError(gc, GL_INVALID_ENUM); @@ -60,22 +75,22 @@ void glDisableClientState(GLenum array) switch (array) { case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_FALSE; + gc->state.vertArray.color.enable = GL_FALSE; break; case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_FALSE; + gc->state.vertArray.edgeFlag.enable = GL_FALSE; break; case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_FALSE; + gc->state.vertArray.index.enable = GL_FALSE; break; case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_FALSE; + gc->state.vertArray.normal.enable = GL_FALSE; break; case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_FALSE; + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_FALSE; break; case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_FALSE; + gc->state.vertArray.vertex.enable = GL_FALSE; break; default: __glXSetError(gc, GL_INVALID_ENUM); diff --git a/xc/lib/GL/glx/compsize.c b/xc/lib/GL/glx/compsize.c index cf5de61bb..eecd049b9 100644 --- a/xc/lib/GL/glx/compsize.c +++ b/xc/lib/GL/glx/compsize.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/compsize.c,v 1.2 1999/06/14 07:23:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/compsize.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ #include <GL/gl.h> @@ -106,15 +121,36 @@ GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } @@ -154,11 +190,19 @@ GLint __glTexParameterfv_size(GLenum e) switch (e) { case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: return 1; case GL_TEXTURE_BORDER_COLOR: return 4; + case GL_TEXTURE_PRIORITY: + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; default: return 0; } @@ -226,15 +270,36 @@ GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } @@ -282,21 +347,121 @@ GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } return (elements * esize * w * h); } +GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d) +{ + GLint elements, esize; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (d * (h * ((w+7)/8))); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return (elements * esize * w * h * d); +} + GLint __glLightfv_size(GLenum pname) { switch (pname) { @@ -326,6 +491,7 @@ GLint __glLightModelfv_size(GLenum pname) case GL_LIGHT_MODEL_AMBIENT: return 4; case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1; case GL_LIGHT_MODEL_TWO_SIDE: return 1; + case GL_LIGHT_MODEL_COLOR_CONTROL: return 1; default: return 0; } @@ -356,3 +522,46 @@ GLint __glMaterialiv_size(GLenum pname) return __glMaterialfv_size(pname); } +GLint __glColorTableParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return -1; + } +} + +GLint __glColorTableParameteriv_size(GLenum pname) +{ + return __glColorTableParameterfv_size(pname); +} + +GLint __glConvolutionParameterfv_size(GLenum pname) +{ + switch(pname) { + case GL_CONVOLUTION_BORDER_MODE: + return 1; + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + default: /* error: bad enum value */ + return -1; + } +} + +GLint __glConvolutionParameteriv_size(GLenum pname) +{ + return __glConvolutionParameterfv_size(pname); +} diff --git a/xc/lib/GL/glx/eval.c b/xc/lib/GL/glx/eval.c index ca4f54ce5..f01193152 100644 --- a/xc/lib/GL/glx/eval.c +++ b/xc/lib/GL/glx/eval.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/eval.c,v 1.2 1999/06/14 07:23:35 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/eval.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/g_render.c b/xc/lib/GL/glx/g_render.c index b9f37c171..7f61e7b26 100644 --- a/xc/lib/GL/glx/g_render.c +++ b/xc/lib/GL/glx/g_render.c @@ -1,21 +1,30 @@ -/* $XFree86: xc/lib/GL/glx/g_render.c,v 1.2 1999/06/14 07:23:35 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packrender.h" @@ -2803,3 +2812,586 @@ void glIndexubv(const GLubyte *c) __GLX_END(8); } +void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_BlendColor,20); + __GLX_PUT_FLOAT(4,red); + __GLX_PUT_FLOAT(8,green); + __GLX_PUT_FLOAT(12,blue); + __GLX_PUT_FLOAT(16,alpha); + __GLX_END(20); +} + +void glBlendEquation(GLenum mode) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_BlendEquation,8); + __GLX_PUT_LONG(4,mode); + __GLX_END(8); +} + +void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glColorTableParameterfv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ColorTableParameterfv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glColorTableParameteriv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ColorTableParameteriv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyColorTable,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyColorSubTable,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,start); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ConvolutionParameterf,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT(12,params); + __GLX_END(16); +} + +void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glConvolutionParameterfv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ConvolutionParameterfv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glConvolutionParameteri(GLenum target, GLenum pname, GLint params) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ConvolutionParameteri,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG(12,params); + __GLX_END(16); +} + +void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glConvolutionParameteriv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ConvolutionParameteriv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyConvolutionFilter1D,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyConvolutionFilter2D,28); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_PUT_LONG(24,height); + __GLX_END(28); +} + +void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_Histogram,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,internalformat); + __GLX_PUT_CHAR(16,sink); + __GLX_END(20); +} + +void glMinmax(GLenum target, GLenum internalformat, GLboolean sink) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_Minmax,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_CHAR(12,sink); + __GLX_END(16); +} + +void glResetHistogram(GLenum target) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ResetHistogram,8); + __GLX_PUT_LONG(4,target); + __GLX_END(8); +} + +void glResetMinmax(GLenum target) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ResetMinmax,8); + __GLX_PUT_LONG(4,target); + __GLX_END(8); +} + +void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyTexSubImage3D,40); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,level); + __GLX_PUT_LONG(12,xoffset); + __GLX_PUT_LONG(16,yoffset); + __GLX_PUT_LONG(20,zoffset); + __GLX_PUT_LONG(24,x); + __GLX_PUT_LONG(28,y); + __GLX_PUT_LONG(32,width); + __GLX_PUT_LONG(36,height); + __GLX_END(40); +} + +void glActiveTextureARB(GLenum texture) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ActiveTextureARB,8); + __GLX_PUT_LONG(4,texture); + __GLX_END(8); +} + +void glMultiTexCoord1dARB(GLenum target, GLdouble s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1dvARB,16); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_LONG(12,target); + __GLX_END(16); +} + +void glMultiTexCoord1dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1dvARB,16); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_LONG(12,target); + __GLX_END(16); +} + +void glMultiTexCoord1fARB(GLenum target, GLfloat s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1fvARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1fvARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord1iARB(GLenum target, GLint s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1ivARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1ivARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord1sARB(GLenum target, GLshort s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2dvARB,24); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_LONG(20,target); + __GLX_END(24); +} + +void glMultiTexCoord2dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2dvARB,24); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_LONG(20,target); + __GLX_END(24); +} + +void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2fvARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_END(16); +} + +void glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2fvARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_END(16); +} + +void glMultiTexCoord2iARB(GLenum target, GLint s, GLint t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2ivARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_END(16); +} + +void glMultiTexCoord2ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2ivARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_END(16); +} + +void glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_END(12); +} + +void glMultiTexCoord2svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_END(12); +} + +void glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3dvARB,32); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_DOUBLE(20,r); + __GLX_PUT_LONG(28,target); + __GLX_END(32); +} + +void glMultiTexCoord3dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3dvARB,32); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_DOUBLE(20,v[2]); + __GLX_PUT_LONG(28,target); + __GLX_END(32); +} + +void glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3fvARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_PUT_FLOAT(16,r); + __GLX_END(20); +} + +void glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3fvARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_PUT_FLOAT(16,v[2]); + __GLX_END(20); +} + +void glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3ivARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_PUT_LONG(16,r); + __GLX_END(20); +} + +void glMultiTexCoord3ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3ivARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_PUT_LONG(16,v[2]); + __GLX_END(20); +} + +void glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_PUT_SHORT(12,r); + __GLX_END(16); +} + +void glMultiTexCoord3svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_PUT_SHORT(12,v[2]); + __GLX_END(16); +} + +void glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4dvARB,40); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_DOUBLE(20,r); + __GLX_PUT_DOUBLE(28,q); + __GLX_PUT_LONG(36,target); + __GLX_END(40); +} + +void glMultiTexCoord4dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4dvARB,40); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_DOUBLE(20,v[2]); + __GLX_PUT_DOUBLE(28,v[3]); + __GLX_PUT_LONG(36,target); + __GLX_END(40); +} + +void glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4fvARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_PUT_FLOAT(16,r); + __GLX_PUT_FLOAT(20,q); + __GLX_END(24); +} + +void glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4fvARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_PUT_FLOAT(16,v[2]); + __GLX_PUT_FLOAT(20,v[3]); + __GLX_END(24); +} + +void glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4ivARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_PUT_LONG(16,r); + __GLX_PUT_LONG(20,q); + __GLX_END(24); +} + +void glMultiTexCoord4ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4ivARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_PUT_LONG(16,v[2]); + __GLX_PUT_LONG(20,v[3]); + __GLX_END(24); +} + +void glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_PUT_SHORT(12,r); + __GLX_PUT_SHORT(14,q); + __GLX_END(16); +} + +void glMultiTexCoord4svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_PUT_SHORT(12,v[2]); + __GLX_PUT_SHORT(14,v[3]); + __GLX_END(16); +} + diff --git a/xc/lib/GL/glx/g_single.c b/xc/lib/GL/glx/g_single.c index b41865ef0..4488e559e 100644 --- a/xc/lib/GL/glx/g_single.c +++ b/xc/lib/GL/glx/g_single.c @@ -1,21 +1,30 @@ -/* $XFree86: xc/lib/GL/glx/g_single.c,v 1.2 1999/06/14 07:23:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packsingle.h" @@ -417,3 +426,237 @@ GLboolean glIsList(GLuint list) return retval; } +/* + * Somewhere between GLX 1.2 and 1.3 (in SGI's code anyway) the + * protocol for glAreTexturesResident, glDeleteTextures, glGenTextures, + * and glIsTexture() was changed. Before, calls to these functions + * generated protocol for the old GL_EXT_texture_object versions of those + * calls. In the newer code, this is actually corrected; calls to the + * 1.1 functions generate 1.1 protocol and calls to the EXT functions + * generate EXT protocol. + * Unfortunately, this correction causes an incompatibility. Specifically, + * an updated libGL.so will send protocol requests that the server won't + * be able to handle. For example, calling glGenTextures will generate a + * BadRequest error. + * For now, we'll keep generating EXT protocol from libGL. We'll update + * the server to understand both the 1.1 and EXT protocol ASAP. At some point + * in the future we'll correct libGL.so as well. That should be a smoother + * transition path. + */ + +GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + GLboolean retval = 0; + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + if (n < 0) return retval; + cmdlen = 4+n*4; + __GLX_SINGLE_BEGIN(X_GLsop_AreTexturesResident,cmdlen); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_PUT_LONG_ARRAY(4,textures,n); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_RETVAL(retval, GLboolean); + __GLX_SINGLE_GET_CHAR_ARRAY(residences,n); + __GLX_SINGLE_END(); + return retval; +#else + return glAreTexturesResidentEXT(n, textures, residences); +#endif +} + +void glDeleteTextures(GLsizei n, const GLuint *textures) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + __GLX_SINGLE_LOAD_VARIABLES(); + if (n < 0) return; + cmdlen = 4+n*4; + __GLX_SINGLE_BEGIN(X_GLsop_DeleteTextures,cmdlen); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_PUT_LONG_ARRAY(4,textures,n); + __GLX_SINGLE_END(); +#else + glDeleteTexturesEXT(n, textures); +#endif +} + +void glGenTextures(GLsizei n, GLuint *textures) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GenTextures,4); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_LONG_ARRAY(textures,n); + __GLX_SINGLE_END(); +#else + glGenTexturesEXT(n, textures); +#endif +} + +GLboolean glIsTexture(GLuint texture) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + GLboolean retval = 0; + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_IsTexture,4); + __GLX_SINGLE_PUT_LONG(0,texture); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_RETVAL(retval, GLboolean); + __GLX_SINGLE_END(); + return retval; +#else + return glIsTextureEXT(texture); +#endif +} + +void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTableParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTableParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogramParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogramParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmaxParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmaxParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + diff --git a/xc/lib/GL/glx/g_vendpriv.c b/xc/lib/GL/glx/g_vendpriv.c index b178ab811..b3258e9dc 100644 --- a/xc/lib/GL/glx/g_vendpriv.c +++ b/xc/lib/GL/glx/g_vendpriv.c @@ -1,26 +1,35 @@ -/* $XFree86: xc/lib/GL/glx/g_vendpriv.c,v 1.2 1999/06/14 07:23:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packvendpriv.h" -GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) +GLboolean glAreTexturesResidentEXT(GLsizei n, const GLuint *textures, GLboolean *residences) { __GLX_VENDPRIV_DECLARE_VARIABLES(); GLboolean retval = 0; @@ -28,7 +37,7 @@ GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *re __GLX_VENDPRIV_LOAD_VARIABLES(); if (n < 0) return retval; cmdlen = 4+n*4; - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_AreTexturesResident,cmdlen); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_AreTexturesResidentEXT,cmdlen); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_PUT_LONG_ARRAY(4,textures,n); __GLX_VENDPRIV_READ_XREPLY(); @@ -38,37 +47,37 @@ GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *re return retval; } -void glDeleteTextures(GLsizei n, const GLuint *textures) +void glDeleteTexturesEXT(GLsizei n, const GLuint *textures) { __GLX_VENDPRIV_DECLARE_VARIABLES(); __GLX_VENDPRIV_LOAD_VARIABLES(); if (n < 0) return; cmdlen = 4+n*4; - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivate,X_GLvop_DeleteTextures,cmdlen); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivate,X_GLvop_DeleteTexturesEXT,cmdlen); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_PUT_LONG_ARRAY(4,textures,n); __GLX_VENDPRIV_END(); } -void glGenTextures(GLsizei n, GLuint *textures) +void glGenTexturesEXT(GLsizei n, GLuint *textures) { __GLX_VENDPRIV_DECLARE_VARIABLES(); xGLXVendorPrivReply reply; __GLX_VENDPRIV_LOAD_VARIABLES(); - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_GenTextures,4); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_GenTexturesEXT,4); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_VENDPRIV_READ_XREPLY(); __GLX_VENDPRIV_GET_LONG_ARRAY(textures,n); __GLX_VENDPRIV_END(); } -GLboolean glIsTexture(GLuint texture) +GLboolean glIsTextureEXT(GLuint texture) { __GLX_VENDPRIV_DECLARE_VARIABLES(); GLboolean retval = 0; xGLXVendorPrivReply reply; __GLX_VENDPRIV_LOAD_VARIABLES(); - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_IsTexture,4); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_IsTextureEXT,4); __GLX_VENDPRIV_PUT_LONG(0,texture); __GLX_VENDPRIV_READ_XREPLY(); __GLX_VENDPRIV_GET_RETVAL(retval, GLboolean); diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h index f89c1b58a..ecf102b31 100644 --- a/xc/lib/GL/glx/glxclient.h +++ b/xc/lib/GL/glx/glxclient.h @@ -1,22 +1,39 @@ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.11.2.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/glxclient.h,v 1.11.2.2 2001/02/15 04:14:21 gareth Exp $ */ /* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.11 2000/12/07 20:26:03 dawes Exp $ */ @@ -32,12 +49,11 @@ #define _GLX_client_h_ #define NEED_REPLIES #define NEED_EVENTS -#include <string.h> -#include <stdlib.h> #include <X11/Xproto.h> #include <X11/Xlibint.h> -#include <GL/gl.h> #include <GL/glx.h> +#include <string.h> +#include <stdlib.h> #include "glxint.h" #include "glxproto.h" #include "glapitable.h" @@ -54,6 +70,8 @@ #define __GL_BOOLEAN_ARRAY (GL_BYTE - 1) +#define __GLX_MAX_TEXTURE_UNITS 32 + typedef struct __GLXcontextRec __GLXcontext; typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate; typedef struct _glapi_table __GLapi; @@ -211,55 +229,34 @@ typedef struct __GLXpixelStoreModeRec { GLboolean swapEndian; GLboolean lsbFirst; GLuint rowLength; + GLuint imageHeight; + GLuint imageDepth; GLuint skipRows; GLuint skipPixels; + GLuint skipImages; GLuint alignment; } __GLXpixelStoreMode; +typedef struct __GLXvertexArrayPointerStateRec { + GLboolean enable; + void (*proc)(const void *); + const GLubyte *ptr; + GLsizei skip; + GLint size; + GLenum type; + GLsizei stride; +} __GLXvertexArrayPointerState; + typedef struct __GLXvertArrayStateRec { - GLboolean vertexEnable; - void (*vertexCall)(const char *); - const char *vertexPtr; - GLsizei vertexSkip; - GLint vertexSize; - GLenum vertexType; - GLsizei vertexStride; - - GLboolean normalEnable; - void (*normalCall)(const char *); - const char *normalPtr; - GLsizei normalSkip; - GLenum normalType; - GLsizei normalStride; - - GLboolean colorEnable; - void (*colorCall)(const char *); - const char *colorPtr; - GLsizei colorSkip; - GLint colorSize; - GLenum colorType; - GLsizei colorStride; - - GLboolean indexEnable; - void (*indexCall)(const char *); - const char *indexPtr; - GLsizei indexSkip; - GLenum indexType; - GLsizei indexStride; - - GLboolean texCoordEnable; - void (*texCoordCall)(const char *); - const char *texCoordPtr; - GLsizei texCoordSkip; - GLint texCoordSize; - GLenum texCoordType; - GLsizei texCoordStride; - - GLboolean edgeFlagEnable; - void (*edgeFlagCall)(const GLboolean *); - GLsizei edgeFlagSkip; - const GLboolean *edgeFlagPtr; - GLsizei edgeFlagStride; + __GLXvertexArrayPointerState vertex; + __GLXvertexArrayPointerState normal; + __GLXvertexArrayPointerState color; + __GLXvertexArrayPointerState index; + __GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS]; + __GLXvertexArrayPointerState edgeFlag; + GLint maxElementsVertices; + GLint maxElementsIndices; + GLint activeTexture; } __GLXvertArrayState; typedef struct __GLXattributeRec { @@ -370,8 +367,8 @@ struct __GLXcontextRec { ** Fill newImage with the unpacked form of oldImage getting it ** ready for transport to the server. */ - void (*fillImage)(__GLXcontext*, GLint, GLint, GLenum, GLenum, - const GLvoid*, GLubyte*, GLubyte*); + void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLvoid*, GLubyte*, GLubyte*); /* ** Client side attribs. @@ -587,7 +584,7 @@ extern CARD8 __glXSetupForCommand(Display *dpy); */ /* Return the size, in bytes, of some pixel data */ -extern GLint __glImageSize(GLint, GLint, GLenum, GLenum); +extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum); /* Return the k value for a given map target */ extern GLint __glEvalComputeK(GLenum); @@ -599,10 +596,8 @@ extern GLint __glEvalComputeK(GLenum); ** updated to contain the modes needed by the server to decode the ** sent data. */ -extern void __glFillImage(__GLXcontext*, GLint, GLint, - GLenum, GLenum, - const GLvoid*, GLubyte*, - GLubyte*); +extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLvoid*, GLubyte*, GLubyte*); /* Copy map data with a stride into a packed buffer */ extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *); @@ -616,8 +611,8 @@ extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint, ** Empty an image out of the reply buffer into the clients memory applying ** the pack modes to pack back into the clients requested format. */ -extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLenum, - GLenum, const GLubyte *, GLvoid *); +extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLubyte *, GLvoid *); /* @@ -637,6 +632,10 @@ extern void __glXClientInfo ( Display *dpy, int opcode ); ** is illegal these procedures return 0. */ extern GLint __glCallLists_size(GLint, GLenum); +extern GLint __glColorTableParameterfv_size(GLenum); +extern GLint __glColorTableParameteriv_size(GLenum); +extern GLint __glConvolutionParameterfv_size(GLenum); +extern GLint __glConvolutionParameteriv_size(GLenum); extern GLint __glDrawPixels_size(GLenum, GLenum, GLint, GLint); extern GLint __glReadPixels_size(GLenum, GLenum, GLint, GLint); extern GLint __glLightModelfv_size(GLenum); @@ -649,6 +648,7 @@ extern GLint __glFogfv_size(GLenum); extern GLint __glFogiv_size(GLenum); extern GLint __glTexImage1D_size(GLenum, GLenum, GLint); extern GLint __glTexImage2D_size(GLenum, GLenum, GLint, GLint); +extern GLint __glTexImage3D_size(GLenum, GLenum, GLint, GLint, GLint); extern GLint __glTexEnvfv_size(GLenum); extern GLint __glTexEnviv_size(GLenum); extern GLint __glTexGenfv_size(GLenum); diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index d89bac9ee..728770f47 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -1,56 +1,67 @@ /* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.13 2000/11/13 23:31:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.18.4.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/glxcmds.c,v 1.18.4.1 2001/02/15 04:14:21 gareth Exp $ */ -/* - * Direct rendering support added by Precision Insight, Inc. - * - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Brian Paul <brian@precisioninsight.com> - */ - #include "packsingle.h" #include "glxclient.h" #include <extutil.h> #include <Xext.h> -#include <string.h> +#include <strings.h> #include "glapi.h" #ifdef GLX_DIRECT_RENDERING #include "indirect_init.h" #endif -static const char GL_ClientExtensions[] = - "GL_EXT_abgr " - "GL_EXT_blend_color " - "GL_EXT_blend_minmax " - "GL_EXT_blend_subtract " ; - -static const char GLXClientVendorName[] = "SGI"; -static const char GLXClientVersion[] = "1.2"; -static const char GLXClientExtensions[] = - "GLX_EXT_visual_info " - "GLX_EXT_visual_rating " - "GLX_EXT_import_context " - "GLX_ARB_get_proc_address "; +static const char __glXGLClientExtensions[] = + "GL_ARB_multitexture " + "GL_ARB_imaging " + "GL_EXT_abgr " + "GL_EXT_blend_color " + "GL_EXT_blend_minmax " + "GL_EXT_blend_subtract " + ; + +static const char __glXGLXClientVendorName[] = "SGI"; +static const char __glXGLXClientVersion[] = "1.2"; +static const char __glXGLXClientExtensions[] = + "GLX_EXT_visual_info " + "GLX_EXT_visual_rating " + "GLX_EXT_import_context " + ; /* ** Create a new context. @@ -1275,7 +1286,7 @@ const char *glXQueryExtensionsString( Display *dpy, int screen ) psc->serverGLXexts = QueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); } - psc->effectiveGLXexts = combine_strings(GLXClientExtensions, + psc->effectiveGLXexts = combine_strings(__glXGLXClientExtensions, psc->serverGLXexts); } @@ -1286,11 +1297,11 @@ const char *glXGetClientString( Display *dpy, int name ) { switch(name) { case GLX_VENDOR: - return (GLXClientVendorName); + return (__glXGLXClientVendorName); case GLX_VERSION: - return (GLXClientVersion); + return (__glXGLXClientVersion); case GLX_EXTENSIONS: - return (GLXClientExtensions); + return (__glXGLXClientExtensions); default: return NULL; } @@ -1363,10 +1374,10 @@ void __glXClientInfo ( Display *dpy, int opcode ) req->major = GLX_MAJOR_VERSION; req->minor = GLX_MINOR_VERSION; - size = strlen(GL_ClientExtensions) + 1; + size = strlen(__glXGLClientExtensions) + 1; req->length += (size + 3) >> 2; req->numbytes = size; - Data(dpy, GL_ClientExtensions, size); + Data(dpy, __glXGLClientExtensions, size); UnlockDisplay(dpy); SyncHandle(); diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c index 4e7f0dd60..be56587eb 100644 --- a/xc/lib/GL/glx/glxext.c +++ b/xc/lib/GL/glx/glxext.c @@ -1,38 +1,55 @@ /* $XFree86: xc/lib/GL/glx/glxext.c,v 1.9 2000/12/07 20:26:03 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.13.2.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/glxext.c,v 1.13.2.2 2001/02/15 04:14:21 gareth Exp $ */ -/* - * Direct rendering support added by Precision Insight, Inc. - * - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * - */ +/* < + * Direct rendering support added by Precision Insight, Inc. < + * < + * Authors: < + * Kevin E. Martin <kevin@precisioninsight.com> < + * < + */ #include "packrender.h" +#include <stdio.h> #include <Xext.h> #include <extutil.h> #include <assert.h> -#include <stdio.h> #include "indirect_init.h" #include "glapi.h" #ifdef XTHREADS @@ -211,7 +228,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) psc->configs = 0; /* NOTE: just for paranoia */ } -#if 0 /* GLX_DIRECT_RENDERING */ +#if GLX_DIRECT_RENDERING /* Free the direct rendering per screen data */ if (psc->driScreen.private) (*psc->driScreen.destroyScreen)(priv->dpy, i, @@ -557,9 +574,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy) XAddToExtensionList(privList, private); if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) { -#if 0 __glXClientInfo(dpy, dpyPriv->majorOpcode); -#endif } __glXUnlock(); diff --git a/xc/lib/GL/glx/indirect.h b/xc/lib/GL/glx/indirect.h index 4e18e0cde..a88ece441 100644 --- a/xc/lib/GL/glx/indirect.h +++ b/xc/lib/GL/glx/indirect.h @@ -42,10 +42,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void __indirect_glAccum(GLenum op, GLfloat value); void __indirect_glAlphaFunc(GLenum func, GLclampf ref); GLboolean __indirect_glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences); +GLboolean __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint *textures, GLboolean *residences); void __indirect_glArrayElement(GLint i); void __indirect_glBegin(GLenum mode); void __indirect_glBindTexture(GLenum target, GLuint texture); void __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +void __indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +void __indirect_glBlendEquation(GLenum mode); void __indirect_glBlendFunc(GLenum sfactor, GLenum dfactor); void __indirect_glCallList(GLuint list); void __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid *lists); @@ -91,14 +94,30 @@ void __indirect_glColor4usv(const GLushort *v); void __indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void __indirect_glColorMaterial(GLenum face, GLenum mode); void __indirect_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table); +void __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +void __indirect_glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); +void __indirect_glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); +void __indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); +void __indirect_glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params); +void __indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params); +void __indirect_glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); +void __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +void __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +void __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +void __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); void __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); void __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); void __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); void __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); void __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +void __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); void __indirect_glCullFace(GLenum mode); void __indirect_glDeleteLists(GLuint list, GLsizei range); void __indirect_glDeleteTextures(GLsizei n, const GLuint *textures); +void __indirect_glDeleteTexturesEXT(GLsizei n, const GLuint *textures); void __indirect_glDepthFunc(GLenum func); void __indirect_glDepthMask(GLboolean flag); void __indirect_glDepthRange(GLclampd zNear, GLclampd zFar); @@ -108,6 +127,7 @@ void __indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count); void __indirect_glDrawBuffer(GLenum mode); void __indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); void __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); void __indirect_glEdgeFlag(GLboolean flag); void __indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer); void __indirect_glEdgeFlagv(const GLboolean *flag); @@ -138,11 +158,21 @@ void __indirect_glFrontFace(GLenum mode); void __indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); GLuint __indirect_glGenLists(GLsizei range); void __indirect_glGenTextures(GLsizei n, GLuint *textures); +void __indirect_glGenTexturesEXT(GLsizei n, GLuint *textures); void __indirect_glGetBooleanv(GLenum val, GLboolean *b); void __indirect_glGetClipPlane(GLenum plane, GLdouble *equation); +void __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table); +void __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params); +void __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); +void __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetDoublev(GLenum val, GLdouble *d); GLenum __indirect_glGetError(void); void __indirect_glGetFloatv(GLenum val, GLfloat *f); +void __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetIntegerv(GLenum val, GLint *i); void __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat *params); void __indirect_glGetLightiv(GLenum light, GLenum pname, GLint *params); @@ -151,12 +181,16 @@ void __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat *v); void __indirect_glGetMapiv(GLenum target, GLenum query, GLint *v); void __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); void __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint *params); +void __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetPixelMapfv(GLenum map, GLfloat *values); void __indirect_glGetPixelMapuiv(GLenum map, GLuint *values); void __indirect_glGetPixelMapusv(GLenum map, GLushort *values); void __indirect_glGetPointerv(GLenum pname, void **params); void __indirect_glGetPolygonStipple(GLubyte *mask); const GLubyte *__indirect_glGetString(GLenum name); +void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); void __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params); void __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params); @@ -168,6 +202,7 @@ void __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pnam void __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params); void __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glHint(GLenum target, GLenum mode); +void __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); void __indirect_glIndexMask(GLuint mask); void __indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer); void __indirect_glIndexd(GLdouble c); @@ -185,6 +220,7 @@ void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid GLboolean __indirect_glIsEnabled(GLenum cap); GLboolean __indirect_glIsList(GLuint list); GLboolean __indirect_glIsTexture(GLuint texture); +GLboolean __indirect_glIsTextureEXT(GLuint texture); void __indirect_glLightModelf(GLenum pname, GLfloat param); void __indirect_glLightModelfv(GLenum pname, const GLfloat *params); void __indirect_glLightModeli(GLenum pname, GLint param); @@ -214,6 +250,7 @@ void __indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params); void __indirect_glMateriali(GLenum face, GLenum pname, GLint param); void __indirect_glMaterialiv(GLenum face, GLenum pname, const GLint *params); void __indirect_glMatrixMode(GLenum mode); +void __indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink); void __indirect_glMultMatrixd(const GLdouble *m); void __indirect_glMultMatrixf(const GLfloat *m); void __indirect_glNewList(GLuint list, GLenum mode); @@ -286,12 +323,15 @@ void __indirect_glRectiv(const GLint *v1, const GLint *v2); void __indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2); void __indirect_glRectsv(const GLshort *v1, const GLshort *v2); GLint __indirect_glRenderMode(GLenum mode); +void __indirect_glResetHistogram(GLenum target); +void __indirect_glResetMinmax(GLenum target); void __indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); void __indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); void __indirect_glScaled(GLdouble x, GLdouble y, GLdouble z); void __indirect_glScalef(GLfloat x, GLfloat y, GLfloat z); void __indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height); void __indirect_glSelectBuffer(GLsizei numnames, GLuint *buffer); +void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); void __indirect_glShadeModel(GLenum mode); void __indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask); void __indirect_glStencilMask(GLuint mask); @@ -341,12 +381,14 @@ void __indirect_glTexGeni(GLenum coord, GLenum pname, GLint param); void __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint *params); void __indirect_glTexImage1D(GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexImage2D(GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param); void __indirect_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params); void __indirect_glTexParameteri(GLenum target, GLenum pname, GLint param); void __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint *params); void __indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z); void __indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z); void __indirect_glVertex2d(GLdouble x, GLdouble y); @@ -376,4 +418,41 @@ void __indirect_glVertex4sv(const GLshort *v); void __indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); void __indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + +void __indirect_glActiveTextureARB(GLenum texture); +void __indirect_glClientActiveTextureARB(GLenum texture); +void __indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s); +void __indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s); +void __indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord1iARB(GLenum target, GLint s); +void __indirect_glMultiTexCoord1ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord1sARB(GLenum target, GLshort s); +void __indirect_glMultiTexCoord1svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +void __indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +void __indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +void __indirect_glMultiTexCoord2ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +void __indirect_glMultiTexCoord2svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +void __indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +void __indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +void __indirect_glMultiTexCoord3ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +void __indirect_glMultiTexCoord3svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +void __indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +void __indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +void __indirect_glMultiTexCoord4ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +void __indirect_glMultiTexCoord4svARB(GLenum target, const GLshort *v); + + #endif /* _INDIRECT_H_ */ diff --git a/xc/lib/GL/glx/indirect_init.c b/xc/lib/GL/glx/indirect_init.c index 3d631bee6..89a53f0d1 100644 --- a/xc/lib/GL/glx/indirect_init.c +++ b/xc/lib/GL/glx/indirect_init.c @@ -140,6 +140,7 @@ __GLapi *__glXNewIndirectAPI(void) glAPI->DrawBuffer = __indirect_glDrawBuffer; glAPI->DrawElements = __indirect_glDrawElements; glAPI->DrawPixels = __indirect_glDrawPixels; + glAPI->DrawRangeElements = __indirect_glDrawRangeElements; glAPI->EdgeFlag = __indirect_glEdgeFlag; glAPI->EdgeFlagPointer = __indirect_glEdgeFlagPointer; glAPI->EdgeFlagv = __indirect_glEdgeFlagv; @@ -408,5 +409,83 @@ __GLapi *__glXNewIndirectAPI(void) glAPI->VertexPointer = __indirect_glVertexPointer; glAPI->Viewport = __indirect_glViewport; + /* 1.2 */ + glAPI->CopyTexSubImage3D = __indirect_glCopyTexSubImage3D; + glAPI->DrawRangeElements = __indirect_glDrawRangeElements; + glAPI->TexImage3D = __indirect_glTexImage3D; + glAPI->TexSubImage3D = __indirect_glTexSubImage3D; + + /* OpenGL 1.2 GL_ARB_imaging */ + glAPI->BlendColor = __indirect_glBlendColor; + glAPI->BlendEquation = __indirect_glBlendEquation; + glAPI->ColorSubTable = __indirect_glColorSubTable; + glAPI->ColorTable = __indirect_glColorTable; + glAPI->ColorTableParameterfv = __indirect_glColorTableParameterfv; + glAPI->ColorTableParameteriv = __indirect_glColorTableParameteriv; + glAPI->ConvolutionFilter1D = __indirect_glConvolutionFilter1D; + glAPI->ConvolutionFilter2D = __indirect_glConvolutionFilter2D; + glAPI->ConvolutionParameterf = __indirect_glConvolutionParameterf; + glAPI->ConvolutionParameterfv = __indirect_glConvolutionParameterfv; + glAPI->ConvolutionParameteri = __indirect_glConvolutionParameteri; + glAPI->ConvolutionParameteriv = __indirect_glConvolutionParameteriv; + glAPI->CopyColorSubTable = __indirect_glCopyColorSubTable; + glAPI->CopyColorTable = __indirect_glCopyColorTable; + glAPI->CopyConvolutionFilter1D = __indirect_glCopyConvolutionFilter1D; + glAPI->CopyConvolutionFilter2D = __indirect_glCopyConvolutionFilter2D; + glAPI->GetColorTable = __indirect_glGetColorTable; + glAPI->GetColorTableParameterfv = __indirect_glGetColorTableParameterfv; + glAPI->GetColorTableParameteriv = __indirect_glGetColorTableParameteriv; + glAPI->GetConvolutionFilter = __indirect_glGetConvolutionFilter; + glAPI->GetConvolutionParameterfv = __indirect_glGetConvolutionParameterfv; + glAPI->GetConvolutionParameteriv = __indirect_glGetConvolutionParameteriv; + glAPI->GetHistogram = __indirect_glGetHistogram; + glAPI->GetHistogramParameterfv = __indirect_glGetHistogramParameterfv; + glAPI->GetHistogramParameteriv = __indirect_glGetHistogramParameteriv; + glAPI->GetMinmax = __indirect_glGetMinmax; + glAPI->GetMinmaxParameterfv = __indirect_glGetMinmaxParameterfv; + glAPI->GetMinmaxParameteriv = __indirect_glGetMinmaxParameteriv; + glAPI->GetSeparableFilter = __indirect_glGetSeparableFilter; + glAPI->Histogram = __indirect_glHistogram; + glAPI->Minmax = __indirect_glMinmax; + glAPI->ResetHistogram = __indirect_glResetHistogram; + glAPI->ResetMinmax = __indirect_glResetMinmax; + glAPI->SeparableFilter2D = __indirect_glSeparableFilter2D; + + /* ARB 1. GL_ARB_multitexture */ + glAPI->ActiveTextureARB = __indirect_glActiveTextureARB; + glAPI->ClientActiveTextureARB = __indirect_glClientActiveTextureARB; + glAPI->MultiTexCoord1dARB = __indirect_glMultiTexCoord1dARB; + glAPI->MultiTexCoord1dvARB = __indirect_glMultiTexCoord1dvARB; + glAPI->MultiTexCoord1fARB = __indirect_glMultiTexCoord1fARB; + glAPI->MultiTexCoord1fvARB = __indirect_glMultiTexCoord1fvARB; + glAPI->MultiTexCoord1iARB = __indirect_glMultiTexCoord1iARB; + glAPI->MultiTexCoord1ivARB = __indirect_glMultiTexCoord1ivARB; + glAPI->MultiTexCoord1sARB = __indirect_glMultiTexCoord1sARB; + glAPI->MultiTexCoord1svARB = __indirect_glMultiTexCoord1svARB; + glAPI->MultiTexCoord2dARB = __indirect_glMultiTexCoord2dARB; + glAPI->MultiTexCoord2dvARB = __indirect_glMultiTexCoord2dvARB; + glAPI->MultiTexCoord2fARB = __indirect_glMultiTexCoord2fARB; + glAPI->MultiTexCoord2fvARB = __indirect_glMultiTexCoord2fvARB; + glAPI->MultiTexCoord2iARB = __indirect_glMultiTexCoord2iARB; + glAPI->MultiTexCoord2ivARB = __indirect_glMultiTexCoord2ivARB; + glAPI->MultiTexCoord2sARB = __indirect_glMultiTexCoord2sARB; + glAPI->MultiTexCoord2svARB = __indirect_glMultiTexCoord2svARB; + glAPI->MultiTexCoord3dARB = __indirect_glMultiTexCoord3dARB; + glAPI->MultiTexCoord3dvARB = __indirect_glMultiTexCoord3dvARB; + glAPI->MultiTexCoord3fARB = __indirect_glMultiTexCoord3fARB; + glAPI->MultiTexCoord3fvARB = __indirect_glMultiTexCoord3fvARB; + glAPI->MultiTexCoord3iARB = __indirect_glMultiTexCoord3iARB; + glAPI->MultiTexCoord3ivARB = __indirect_glMultiTexCoord3ivARB; + glAPI->MultiTexCoord3sARB = __indirect_glMultiTexCoord3sARB; + glAPI->MultiTexCoord3svARB = __indirect_glMultiTexCoord3svARB; + glAPI->MultiTexCoord4dARB = __indirect_glMultiTexCoord4dARB; + glAPI->MultiTexCoord4dvARB = __indirect_glMultiTexCoord4dvARB; + glAPI->MultiTexCoord4fARB = __indirect_glMultiTexCoord4fARB; + glAPI->MultiTexCoord4fvARB = __indirect_glMultiTexCoord4fvARB; + glAPI->MultiTexCoord4iARB = __indirect_glMultiTexCoord4iARB; + glAPI->MultiTexCoord4ivARB = __indirect_glMultiTexCoord4ivARB; + glAPI->MultiTexCoord4sARB = __indirect_glMultiTexCoord4sARB; + glAPI->MultiTexCoord4svARB = __indirect_glMultiTexCoord4svARB; + return glAPI; } diff --git a/xc/lib/GL/glx/packrender.h b/xc/lib/GL/glx/packrender.h index cc699ada5..d692b2ffb 100644 --- a/xc/lib/GL/glx/packrender.h +++ b/xc/lib/GL/glx/packrender.h @@ -1,26 +1,41 @@ #ifndef __GLX_packrender_h__ #define __GLX_packrender_h__ -/* $XFree86: xc/lib/GL/glx/packrender.h,v 1.5 2000/02/18 16:23:10 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.5.68.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/packrender.h,v 1.5.68.1 2001/02/15 04:14:21 gareth Exp $ */ #define NEED_GL_FUNCS_WRAPPED @@ -54,9 +69,9 @@ #define __GLX_LOAD_VARIABLES() \ gc = __glXGetCurrentContext(); \ pc = gc->pc; \ - (void) pixelHeaderPC; \ + (void) cmdlen; \ (void) compsize; \ - (void) cmdlen + (void) pixelHeaderPC /* ** Variable sized command support macro. This macro is used by calls @@ -95,6 +110,24 @@ pixelHeaderPC = pc; \ pc += __GLX_PIXEL_HDR_SIZE +#define __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(opcode,size) \ + if (pc + (size) > gc->bufEnd) { \ + pc = __glXFlushRenderBuffer(gc, pc); \ + } \ + __GLX_PUT_SHORT(0,size); \ + __GLX_PUT_SHORT(2,opcode); \ + pc += __GLX_RENDER_HDR_SIZE; \ + pixelHeaderPC = pc; \ + pc += __GLX_PIXEL_3D_HDR_SIZE + +#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(opcode,size) \ + pc = __glXFlushRenderBuffer(gc, pc); \ + __GLX_PUT_LONG(0,size); \ + __GLX_PUT_LONG(4,opcode); \ + pc += __GLX_RENDER_LARGE_HDR_SIZE; \ + pixelHeaderPC = pc; \ + pc += __GLX_PIXEL_3D_HDR_SIZE + /* ** Fixed size command support macro. This macro is used by calls that ** are never larger than __GLX_SMALL_RENDER_CMD_SIZE. Because they diff --git a/xc/lib/GL/glx/packsingle.h b/xc/lib/GL/glx/packsingle.h index f3195a274..686726757 100644 --- a/xc/lib/GL/glx/packsingle.h +++ b/xc/lib/GL/glx/packsingle.h @@ -1,26 +1,41 @@ #ifndef __GLX_packsingle_h__ #define __GLX_packsingle_h__ -/* $XFree86: xc/lib/GL/glx/packsingle.h,v 1.4 2000/08/28 16:04:48 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.4.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/packsingle.h,v 1.4.18.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/packvendpriv.h b/xc/lib/GL/glx/packvendpriv.h index aa3cf8146..daf0cbe3c 100644 --- a/xc/lib/GL/glx/packvendpriv.h +++ b/xc/lib/GL/glx/packvendpriv.h @@ -1,26 +1,41 @@ #ifndef __GLX_packvendpriv_h__ #define __GLX_packvendpriv_h__ -/* $XFree86: xc/lib/GL/glx/packvendpriv.h,v 1.3 2000/02/08 17:18:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.3.68.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/packvendpriv.h,v 1.3.68.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/pixel.c b/xc/lib/GL/glx/pixel.c index a1dd3637c..924c102a0 100644 --- a/xc/lib/GL/glx/pixel.c +++ b/xc/lib/GL/glx/pixel.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/pixel.c,v 1.3 2000/02/08 17:18:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.3.68.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/pixel.c,v 1.3.68.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packrender.h" @@ -68,14 +83,38 @@ static GLubyte HighBitsMask[9] = { /* ** Return the number of elements per group of a specified format */ -static GLint ElementsPerGroup(GLenum format) +static GLint ElementsPerGroup(GLenum format, GLenum type) { + /* + ** To make row length computation valid for image extraction, + ** packed pixel types assume elements per group equals one. + */ + switch(type) { + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return 1; + default: + break; + } + switch(format) { case GL_RGB: + case GL_BGR: return 3; case GL_LUMINANCE_ALPHA: return 2; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: return 4; case GL_COLOR_INDEX: @@ -101,13 +140,25 @@ static GLint BytesPerElement(GLenum type) switch(type) { case GL_UNSIGNED_SHORT: case GL_SHORT: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: return 2; case GL_UNSIGNED_BYTE: case GL_BYTE: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: return 1; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: return 4; default: return 0; @@ -118,24 +169,25 @@ static GLint BytesPerElement(GLenum type) ** Compute memory required for internal packed array of data of given type ** and format. */ -GLint __glImageSize(GLsizei width, GLsizei height, GLenum format, GLenum type) +GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type) { int bytes_per_row; int components; - if (width < 0 || height < 0) { + if (width < 0 || height < 0 || depth < 0) { return 0; } /* ** Zero is returned if either format or type are invalid. */ - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (type == GL_BITMAP) { bytes_per_row = (width + 7) >> 3; } else { bytes_per_row = BytesPerElement(type) * width; } - return bytes_per_row * height * components; + return bytes_per_row * height * depth * components; } /* @@ -148,6 +200,7 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, GLubyte *destImage) { GLint rowLength = gc->state.storeUnpack.rowLength; + GLint imageHeight = gc->state.storeUnpack.imageHeight; GLint alignment = gc->state.storeUnpack.alignment; GLint skipPixels = gc->state.storeUnpack.skipPixels; GLint skipRows = gc->state.storeUnpack.skipRows; @@ -162,7 +215,7 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, } else { groupsPerRow = width; } - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,GL_BITMAP); rowSize = (groupsPerRow * components + 7) >> 3; padding = (rowSize % alignment); if (padding) { @@ -213,35 +266,43 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, start += rowSize; } } + /* ** Extract array from user's data applying all pixel store modes. ** The internal packed array format used has LSB_FIRST = FALSE and ** ALIGNMENT = 1. */ -void __glFillImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, - GLenum type, const GLvoid *userdata, GLubyte *newimage, - GLubyte *modes) +void __glFillImage(__GLXcontext *gc, GLint dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, + const GLvoid *userdata, GLubyte *newimage, GLubyte *modes) { GLint rowLength = gc->state.storeUnpack.rowLength; + GLint imageHeight = gc->state.storeUnpack.imageHeight; + GLint imageDepth = gc->state.storeUnpack.imageDepth; GLint alignment = gc->state.storeUnpack.alignment; GLint skipPixels = gc->state.storeUnpack.skipPixels; GLint skipRows = gc->state.storeUnpack.skipRows; + GLint skipImages = gc->state.storeUnpack.skipImages; GLint swapBytes = gc->state.storeUnpack.swapEndian; GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize; - GLint elementsPerRow, i, j, k; - const GLubyte *start, *iter; + GLint elementsPerRow, imageSize, rowsPerImage, h, i, j, k; + const GLubyte *start, *iter, *itera, *iterb, *iterc; GLubyte *iter2; if (type == GL_BITMAP) { - /* All formats except GL_BITMAP fall out trivially */ FillBitmap(gc, width, height, format, userdata, newimage); } else { - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = width; } + if (imageHeight > 0) { + rowsPerImage = imageHeight; + } else { + rowsPerImage = height; + } elementSize = BytesPerElement(type); groupSize = elementSize * components; @@ -252,50 +313,77 @@ void __glFillImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, if (padding) { rowSize += alignment - padding; } - start = ((const GLubyte*) userdata) + skipRows * rowSize - + skipPixels * groupSize; + imageSize = rowSize * rowsPerImage; + start = ((const GLubyte*) userdata) + skipImages * imageSize + + skipRows * rowSize + skipPixels * groupSize; iter2 = newimage; elementsPerRow = width * components; if (swapBytes) { - for (i = 0; i < height; i++) { - iter = start; - for (j = 0; j < elementsPerRow; j++) { - for (k = 1; k <= elementSize; k++) { - iter2[k-1] = iter[elementSize - k]; + itera = start; + for (h = 0; h < depth; h++) { + iterb = itera; + for (i = 0; i < height; i++) { + iterc = iterb; + for (j = 0; j < elementsPerRow; j++) { + for (k = 1; k <= elementSize; k++) { + iter2[k-1] = iterc[elementSize - k]; + } + iter2 += elementSize; + iterc += elementSize; } - iter2 += elementSize; - iter += elementSize; + iterb += rowSize; } - start += rowSize; + itera += imageSize; } } else { - if (rowSize == elementsPerRow * elementSize) { - /* Ha! This is mondo easy! */ - __GLX_MEM_COPY(iter2, start, - elementsPerRow * elementSize * height); - } else { - iter = start; - for (i = 0; i < height; i++) { - __GLX_MEM_COPY(iter2, iter, elementsPerRow * elementSize); - iter2 += elementsPerRow * elementSize; - iter += rowSize; + itera = start; + for (h = 0; h < depth; h++) { + if (rowSize == elementsPerRow * elementSize) { + /* Ha! This is mondo easy! */ + __GLX_MEM_COPY(iter2, itera, + elementsPerRow * elementSize * height); + iter2 += elementsPerRow * elementSize * height; + } else { + iter = itera; + for (i = 0; i < height; i++) { + __GLX_MEM_COPY(iter2, iter, elementsPerRow*elementSize); + iter2 += elementsPerRow * elementSize; + iter += rowSize; + } } - } + itera += imageSize; + } } } /* Setup store modes that describe what we just did */ if (modes) { - GLubyte *pc = modes; - __GLX_PUT_CHAR(0,GL_FALSE); - __GLX_PUT_CHAR(1,GL_FALSE); - __GLX_PUT_CHAR(2,0); - __GLX_PUT_CHAR(3,0); - __GLX_PUT_LONG(4,0); - __GLX_PUT_LONG(8,0); - __GLX_PUT_LONG(12,0); - __GLX_PUT_LONG(16,1); + if (dim == 3) { + GLubyte *pc = modes; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } else { + GLubyte *pc = modes; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } } } @@ -319,7 +407,7 @@ static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height, GLint writeMask, i; GLubyte writeByte; - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,GL_BITMAP); if (rowLength > 0) { groupsPerRow = rowLength; } else { @@ -413,26 +501,37 @@ static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height, ** SWAP_BYTES = the current pixel storage pack mode, and ALIGNMENT = 4. ** Named __glEmptyImage() because it is the opposite of __glFillImage(). */ -void __glEmptyImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, - GLenum type, const GLubyte *sourceImage, GLvoid *userdata) +/* ARGSUSED */ +void __glEmptyImage(__GLXcontext *gc, GLint dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, + const GLubyte *sourceImage, GLvoid *userdata) { GLint rowLength = gc->state.storePack.rowLength; + GLint imageHeight = gc->state.storePack.imageHeight; + GLint imageDepth = gc->state.storePack.imageDepth; GLint alignment = gc->state.storePack.alignment; GLint skipPixels = gc->state.storePack.skipPixels; GLint skipRows = gc->state.storePack.skipRows; + GLint skipImages = gc->state.storePack.skipImages; GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize; - GLint elementsPerRow, sourceRowSize, sourcePadding, i; - GLubyte *start, *iter; + GLint elementsPerRow, sourceRowSize, sourcePadding, g, h, i; + GLint imageSize, rowsPerImage; + GLubyte *start, *iter, *itera; if (type == GL_BITMAP) { EmptyBitmap(gc, width, height, format, sourceImage, userdata); } else { - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = width; } + if (imageHeight > 0) { + rowsPerImage = imageHeight; + } else { + rowsPerImage = height; + } elementSize = BytesPerElement(type); groupSize = elementSize * components; rowSize = groupsPerRow * groupSize; @@ -445,22 +544,28 @@ void __glEmptyImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, if (sourcePadding) { sourceRowSize += 4 - sourcePadding; } - start = ((GLubyte*) userdata) + skipRows * rowSize - + skipPixels * groupSize; + imageSize = sourceRowSize * rowsPerImage; + start = ((GLubyte*) userdata) + skipImages * imageSize + + skipRows * rowSize + skipPixels * groupSize; elementsPerRow = width * components; - if ((rowSize == sourceRowSize) && (sourcePadding == 0)) { - /* Ha! This is mondo easy! */ - __GLX_MEM_COPY(start, sourceImage, - elementsPerRow * elementSize * height); - } else { - iter = start; - for (i = 0; i < height; i++) { - __GLX_MEM_COPY(iter, sourceImage, - elementsPerRow * elementSize); - sourceImage += sourceRowSize; - iter += rowSize; + itera = start; + for (h = 0; h < depth; h++) { + if ((rowSize == sourceRowSize) && (sourcePadding == 0)) { + /* Ha! This is mondo easy! */ + __GLX_MEM_COPY(itera, sourceImage, + elementsPerRow * elementSize * height); + sourceImage += elementsPerRow * elementSize * height; + } else { + iter = itera; + for (i = 0; i < height; i++) { + __GLX_MEM_COPY(iter, sourceImage, + elementsPerRow * elementSize); + sourceImage += sourceRowSize; + iter += rowSize; + } } + itera += imageSize; } } } diff --git a/xc/lib/GL/glx/pixelstore.c b/xc/lib/GL/glx/pixelstore.c index 9dcef2057..5207c4b2e 100644 --- a/xc/lib/GL/glx/pixelstore.c +++ b/xc/lib/GL/glx/pixelstore.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/pixelstore.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/pixelstore.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packsingle.h" @@ -42,6 +57,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storePack.rowLength = a; break; + case GL_PACK_IMAGE_HEIGHT: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.imageHeight = a; + break; case GL_PACK_SKIP_ROWS: a = (GLuint) (param + 0.5); if (((GLint) a) < 0) { @@ -58,6 +81,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storePack.skipPixels = a; break; + case GL_PACK_SKIP_IMAGES: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.skipImages = a; + break; case GL_PACK_ALIGNMENT: a = (GLint) (param + 0.5); switch (a) { @@ -84,6 +115,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storeUnpack.rowLength = a; break; + case GL_UNPACK_IMAGE_HEIGHT: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.imageHeight = a; + break; case GL_UNPACK_SKIP_ROWS: a = (GLuint) (param + 0.5); if (((GLint) a) < 0) { @@ -100,6 +139,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storeUnpack.skipPixels = a; break; + case GL_UNPACK_SKIP_IMAGES: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.skipImages = a; + break; case GL_UNPACK_ALIGNMENT: a = (GLint) (param + 0.5); switch (a) { @@ -143,6 +190,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storePack.rowLength = param; break; + case GL_PACK_IMAGE_HEIGHT: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.imageHeight = param; + break; case GL_PACK_SKIP_ROWS: if (param < 0) { __glXSetError(gc, GL_INVALID_VALUE); @@ -157,6 +211,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storePack.skipPixels = param; break; + case GL_PACK_SKIP_IMAGES: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.skipImages = param; + break; case GL_PACK_ALIGNMENT: switch (param) { case 1: case 2: case 4: case 8: @@ -181,6 +242,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storeUnpack.rowLength = param; break; + case GL_UNPACK_IMAGE_HEIGHT: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.imageHeight = param; + break; case GL_UNPACK_SKIP_ROWS: if (param < 0) { __glXSetError(gc, GL_INVALID_VALUE); @@ -195,6 +263,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storeUnpack.skipPixels = param; break; + case GL_UNPACK_SKIP_IMAGES: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.skipImages = param; + break; case GL_UNPACK_ALIGNMENT: switch (param) { case 1: case 2: case 4: case 8: diff --git a/xc/lib/GL/glx/render2.c b/xc/lib/GL/glx/render2.c index 099bd9747..864a002fa 100644 --- a/xc/lib/GL/glx/render2.c +++ b/xc/lib/GL/glx/render2.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/render2.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/render2.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packrender.h" @@ -412,24 +427,26 @@ void glEnable(GLenum cap) if (!gc->currentDpy) return; switch (cap) { - case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_TRUE; +#if 0 + case GL_VERTEX_ARRAY_EXT: + gc->state.vertArray.vertex.enable = GL_TRUE; return; - case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_TRUE; + case GL_NORMAL_ARRAY_EXT: + gc->state.vertArray.normal.enable = GL_TRUE; return; - case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_TRUE; + case GL_COLOR_ARRAY_EXT: + gc->state.vertArray.color.enable = GL_TRUE; return; - case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_TRUE; + case GL_INDEX_ARRAY_EXT: + gc->state.vertArray.index.enable = GL_TRUE; return; - case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_TRUE; + case GL_TEXTURE_COORD_ARRAY_EXT: + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_TRUE; return; - case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_TRUE; + case GL_EDGE_FLAG_ARRAY_EXT: + gc->state.vertArray.edgeFlag.enable = GL_TRUE; return; +#endif } __GLX_BEGIN(X_GLrop_Enable,8); __GLX_PUT_LONG(4,cap); @@ -444,24 +461,26 @@ void glDisable(GLenum cap) if (!gc->currentDpy) return; switch (cap) { - case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_FALSE; +#if 0 + case GL_VERTEX_ARRAY_EXT: + gc->state.vertArray.vertex.enable = GL_FALSE; return; - case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_FALSE; + case GL_NORMAL_ARRAY_EXT: + gc->state.vertArray.normal.enable = GL_FALSE; return; - case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_FALSE; + case GL_COLOR_ARRAY_EXT: + gc->state.vertArray.color.enable = GL_FALSE; return; - case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_FALSE; + case GL_INDEX_ARRAY_EXT: + gc->state.vertArray.index.enable = GL_FALSE; return; - case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_FALSE; + case GL_TEXTURE_COORD_ARRAY_EXT: + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_FALSE; return; - case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_FALSE; + case GL_EDGE_FLAG_ARRAY_EXT: + gc->state.vertArray.edgeFlag.enable = GL_FALSE; return; +#endif } __GLX_BEGIN(X_GLrop_Disable,8); __GLX_PUT_LONG(4,cap); diff --git a/xc/lib/GL/glx/renderpix.c b/xc/lib/GL/glx/renderpix.c index e6b34567d..6451b9bae 100644 --- a/xc/lib/GL/glx/renderpix.c +++ b/xc/lib/GL/glx/renderpix.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/renderpix.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/renderpix.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packrender.h" @@ -40,8 +55,8 @@ ** Send a large image to the server. If necessary, a buffer is allocated ** to hold the unpacked data that is copied from the clients memory. */ -static void SendLargeImage(__GLXcontext *gc, - GLint compsize, GLint width, GLint height, +static void SendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim, + GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *src, GLubyte *pc, GLubyte *modes) { @@ -54,7 +69,8 @@ static void SendLargeImage(__GLXcontext *gc, } /* Apply pixel store unpack modes to copy data into buf */ - (*gc->fillImage)(gc, width, height, format, type, src, buf, modes); + (*gc->fillImage)(gc, dim, width, height, depth, format, type, src, buf, + modes); /* Send large command */ __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); @@ -70,10 +86,10 @@ static void SendLargeImage(__GLXcontext *gc, /* ** Send a large null image to the server. To be backwards compatible, ** data must be sent to the server even when the application has passed -** a null pointer into glTexImage1D or glTexImage2D. +** a null pointer into glTexImage1D, glTexImage2D or glTexImage3D. */ -static void SendLargeNULLImage(__GLXcontext *gc, - GLint compsize, GLint width, GLint height, +static void SendLargeNULLImage(__GLXcontext *gc, GLint compsize, + GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *src, GLubyte *pc, GLubyte *modes) { @@ -98,7 +114,7 @@ void glPolygonStipple(const GLubyte *mask) { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(32, 32, GL_COLOR_INDEX, GL_BITMAP); + compsize = __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP); cmdlen = __GLX_PAD(__GLX_POLYGONSTIPPLE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -107,7 +123,7 @@ void glPolygonStipple(const GLubyte *mask) pc += __GLX_RENDER_HDR_SIZE; pixelHeaderPC = pc; pc += __GLX_PIXEL_HDR_SIZE; - (*gc->fillImage)(gc, 32, 32, GL_COLOR_INDEX, GL_BITMAP, + (*gc->fillImage)(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask, pc, pixelHeaderPC); __GLX_END(__GLX_PAD(compsize)); } @@ -117,7 +133,7 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(width, height, GL_COLOR_INDEX, GL_BITMAP); + compsize = __glImageSize(width, height, 1, GL_COLOR_INDEX, GL_BITMAP); cmdlen = __GLX_PAD(__GLX_BITMAP_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -133,8 +149,8 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, __GLX_PUT_FLOAT(20,ymove); pc += __GLX_BITMAP_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, GL_COLOR_INDEX, GL_BITMAP, - bitmap, pc, pixelHeaderPC); + (*gc->fillImage)(gc, 2, width, height, 1, GL_COLOR_INDEX, + GL_BITMAP, bitmap, pc, pixelHeaderPC); } else { /* Setup default store modes */ GLubyte *pc = pixelHeaderPC; @@ -158,7 +174,7 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, __GLX_PUT_FLOAT(16,xmove); __GLX_PUT_FLOAT(20,ymove); pc += __GLX_BITMAP_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, GL_COLOR_INDEX, + SendLargeImage(gc, compsize, 2, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, bitmap, pc, pixelHeaderPC); } } @@ -172,7 +188,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, if (target == GL_PROXY_TEXTURE_1D) { compsize = 0; } else { - compsize = __glImageSize(width, 1, format, type); + compsize = __glImageSize(width, 1, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); @@ -190,7 +206,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (compsize > 0 && image != NULL) { - (*gc->fillImage)(gc, width, 1, format, type, + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -218,7 +234,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (image != NULL) { - SendLargeImage(gc, compsize, width, 1, format, + SendLargeImage(gc, compsize, 1, width, 1, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -233,7 +249,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(12,0); __GLX_PUT_LONG(16,1); } - SendLargeNULLImage(gc, compsize, width, 1, format, + SendLargeNULLImage(gc, compsize, width, 1, 1, format, type, image, pc, pixelHeaderPC); } } @@ -248,7 +264,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, if (target == GL_PROXY_TEXTURE_2D) { compsize = 0; } else { - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); @@ -267,7 +283,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (compsize > 0 && image != NULL) { - (*gc->fillImage)(gc, width, height, format, type, + (*gc->fillImage)(gc, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -295,7 +311,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (image != NULL) { - SendLargeImage(gc, compsize, width, height, format, + SendLargeImage(gc, compsize, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -310,7 +326,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(12,0); __GLX_PUT_LONG(16,1); } - SendLargeNULLImage(gc, compsize, width, height, format, + SendLargeNULLImage(gc, compsize, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -321,7 +337,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); cmdlen = __GLX_PAD(__GLX_DRAWPIXELS_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -335,7 +351,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, __GLX_PUT_LONG(12,type); pc += __GLX_DRAWPIXELS_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, format, type, + (*gc->fillImage)(gc, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -358,7 +374,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, __GLX_PUT_LONG(8,format); __GLX_PUT_LONG(12,type); pc += __GLX_DRAWPIXELS_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, format, + SendLargeImage(gc, compsize, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -366,14 +382,14 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, - const GLvoid *image) + const GLvoid *image, GLint dim) { __GLX_DECLARE_VARIABLES(); if (image == NULL) { compsize = 0; } else { - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_CMD_HDR_SIZE + compsize); @@ -398,8 +414,8 @@ static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, } pc += __GLX_TEXSUBIMAGE_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, format, type, image, - pc, pixelHeaderPC); + (*gc->fillImage)(gc, dim, width, height, 1, format, type, image, + pc, pixelHeaderPC); } else { /* Setup default store modes */ GLubyte *pc = pixelHeaderPC; @@ -430,7 +446,7 @@ static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, __GLX_PUT_LONG(32,GL_FALSE); } pc += __GLX_TEXSUBIMAGE_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, + SendLargeImage(gc, compsize, dim, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -440,7 +456,7 @@ void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, const GLvoid *image) { __glx_TexSubImage1D2D(X_GLrop_TexSubImage1D, target, level, xoffset, - 0, width, 1, format, type, image); + 0, width, 1, format, type, image, 1); } void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, @@ -448,6 +464,442 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLenum format, GLenum type, const GLvoid *image) { __glx_TexSubImage1D2D(X_GLrop_TexSubImage2D, target, level, xoffset, - yoffset, width, height, format, type, image); + yoffset, width, height, format, type, image, 2); +} + +void glColorTable(GLenum target, GLenum internalformat, GLsizei width, + GLenum format, GLenum type, const GLvoid *table) +{ + __GLX_DECLARE_VARIABLES(); + + switch (target) { + case GL_PROXY_TEXTURE_1D: + case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_3D: + case GL_PROXY_COLOR_TABLE: + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + compsize = 0; + break; + default: + compsize = __glImageSize(width, 1, 1, format, type); + break; + } + cmdlen = __GLX_PAD(__GLX_COLOR_TABLE_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) { + return; + } + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorTable, (short)cmdlen); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, (long)internalformat); + __GLX_PUT_LONG(8, width); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_TABLE_HDR_SIZE; + if (compsize > 0 && table != NULL) { + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, table, pc, + pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0, GL_FALSE); + __GLX_PUT_CHAR(1, GL_FALSE); + __GLX_PUT_CHAR(2, 0); + __GLX_PUT_CHAR(3, 0); + __GLX_PUT_LONG(4, 0); + __GLX_PUT_LONG(8, 0); + __GLX_PUT_LONG(12, 0); + __GLX_PUT_LONG(16, 1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorTable, cmdlen+4); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, (long)internalformat); + __GLX_PUT_LONG(8, width); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_TABLE_HDR_SIZE; + SendLargeImage(gc, compsize, 1, width, 1, 1, format, + type, table, pc, pixelHeaderPC); + } +} + +void glColorSubTable(GLenum target, GLsizei start, GLsizei count, + GLenum format, GLenum type, const GLvoid *table) +{ + __GLX_DECLARE_VARIABLES(); + + compsize = __glImageSize(count, 1, 1, format, type); + cmdlen = __GLX_PAD(__GLX_COLOR_SUBTABLE_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) { + return; + } + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorSubTable, (short)cmdlen); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, start); + __GLX_PUT_LONG(8, count); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_SUBTABLE_HDR_SIZE; + if (compsize > 0 && table != NULL) { + (*gc->fillImage)(gc, 1, start+count, 1, 1, format, type, table, pc, + pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0, GL_FALSE); + __GLX_PUT_CHAR(1, GL_FALSE); + __GLX_PUT_CHAR(2, 0); + __GLX_PUT_CHAR(3, 0); + __GLX_PUT_LONG(4, 0); + __GLX_PUT_LONG(8, 0); + __GLX_PUT_LONG(12, 0); + __GLX_PUT_LONG(16, 1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorSubTable, cmdlen+4); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, start); + __GLX_PUT_LONG(8, count); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_SUBTABLE_HDR_SIZE; + SendLargeImage(gc, compsize, 1, start+count, 1, 1, format, + type, table, pc, pixelHeaderPC); + } +} + +static void __glx_ConvolutionFilter1D2D(GLshort opcode, GLint dim, + GLenum target, + GLenum internalformat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + compsize = __glImageSize(width, height, 1, format, type); + cmdlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode, cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += __GLX_CONV_FILT_HDR_SIZE; + if (compsize > 0) { + (*gc->fillImage)(gc, dim, width, height, 1, format, type, + image, pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += __GLX_CONV_FILT_HDR_SIZE; + SendLargeImage(gc, compsize, dim, width, height, 1, format, + type, image, pc, pixelHeaderPC); + } +} + +void glConvolutionFilter1D(GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *image) +{ + __glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter1D, 1, target, + internalformat, width, 1, format, type, + image); +} + +void glConvolutionFilter2D(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image) +{ + __glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter2D, 2, target, + internalformat, width, height, format, type, + image); +} + +void glSeparableFilter2D(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, + const GLvoid *column) +{ + __GLX_DECLARE_VARIABLES(); + GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len; + + compsize = __glImageSize(width, 1, 1, format, type); + compsize2 = __glImageSize(height, 1, 1, format, type); + totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); + hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE); + image1len = __GLX_PAD(compsize); + image2len = __GLX_PAD(compsize2); + cmdlen = totalhdrlen + image1len + image2len; + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_SeparableFilter2D, cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += hdrlen; + if (compsize > 0) { + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, + row, pc, pixelHeaderPC); + pc += image1len; + } + if (compsize2 > 0) { + (*gc->fillImage)(gc, 1, height, 1, 1, format, type, + column, pc, NULL); + pc += image2len; + } + if ((compsize == 0) && (compsize2 == 0)) { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } + __GLX_END(0); + } else { + GLint bufsize; + + bufsize = image1len + image2len; + + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += hdrlen; + + if (!gc->fastImageUnpack) { + /* Allocate a temporary holding buffer */ + GLubyte *buf = (GLubyte *) Xmalloc(bufsize); + if (!buf) { + __glXSetError(gc, GL_OUT_OF_MEMORY); + return; + } + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, row, buf, pixelHeaderPC); + + (*gc->fillImage)(gc, 1, height, 1, 1, format, type, column, + buf + image1len, pixelHeaderPC); + + /* Send large command */ + __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), buf, bufsize); + /* Free buffer */ + Xfree((char*) buf); + } else { + /* Just send the data straight as is */ + __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), pc, bufsize); + } + } +} + +void glTexImage3D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLsizei depth, GLint border, + GLenum format, GLenum type, const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + if ((target == GL_PROXY_TEXTURE_3D) || (image == NULL)) { + compsize = 0; + } else { + compsize = __glImageSize(width, height, depth, format, type); + } + cmdlen = __GLX_PAD(__GLX_TEXIMAGE_3D_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,width); + __GLX_PUT_LONG(16,height); + __GLX_PUT_LONG(20,depth); + __GLX_PUT_LONG(24,0); /* size4d */ + __GLX_PUT_LONG(28,border); + __GLX_PUT_LONG(32,format); + __GLX_PUT_LONG(36,type); + if (image == NULL) { + __GLX_PUT_LONG(40,GL_TRUE); + } else { + __GLX_PUT_LONG(40,GL_FALSE); + } + pc += __GLX_TEXIMAGE_3D_HDR_SIZE; + if (compsize > 0 && image != NULL) { + (*gc->fillImage)(gc, 3, width, height, depth, format, type, + image, pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,width); + __GLX_PUT_LONG(16,height); + __GLX_PUT_LONG(20,depth); + __GLX_PUT_LONG(24,0); /* size4d */ + __GLX_PUT_LONG(28,border); + __GLX_PUT_LONG(32,format); + __GLX_PUT_LONG(36,type); + if (image == NULL) { + __GLX_PUT_LONG(40,GL_TRUE); + } else { + __GLX_PUT_LONG(40,GL_FALSE); + } + pc += __GLX_TEXIMAGE_3D_HDR_SIZE; + SendLargeImage(gc, compsize, 3, width, height, depth, format, + type, image, pc, pixelHeaderPC); + } } +void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, + GLsizei depth, GLenum format, GLenum type, + const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + if (image == NULL) { + compsize = 0; + } else { + compsize = __glImageSize(width, height, depth, format, type); + } + cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D,cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,xoffset); + __GLX_PUT_LONG(12,yoffset); + __GLX_PUT_LONG(16,zoffset); + __GLX_PUT_LONG(20,0); /* woffset */ + __GLX_PUT_LONG(24,width); + __GLX_PUT_LONG(28,height); + __GLX_PUT_LONG(32,depth); + __GLX_PUT_LONG(36,0); /* size4d */ + __GLX_PUT_LONG(40,format); + __GLX_PUT_LONG(44,type); + if (image == NULL) { + __GLX_PUT_LONG(48,GL_TRUE); + } else { + __GLX_PUT_LONG(48,GL_FALSE); + } + pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE; + if (compsize > 0) { + (*gc->fillImage)(gc, 3, width, height, depth, format, type, image, + pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D, + cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,xoffset); + __GLX_PUT_LONG(12,yoffset); + __GLX_PUT_LONG(16,zoffset); + __GLX_PUT_LONG(20,0); /* woffset */ + __GLX_PUT_LONG(24,width); + __GLX_PUT_LONG(28,height); + __GLX_PUT_LONG(32,depth); + __GLX_PUT_LONG(36,0); /* size4d */ + __GLX_PUT_LONG(40,format); + __GLX_PUT_LONG(44,type); + if (image == NULL) { + __GLX_PUT_LONG(48,GL_TRUE); + } else { + __GLX_PUT_LONG(48,GL_FALSE); + } + pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE; + SendLargeImage(gc, compsize, 3, width, height, depth, format, type, + image, pc, pixelHeaderPC); + } +} diff --git a/xc/lib/GL/glx/single2.c b/xc/lib/GL/glx/single2.c index 2d2998729..694b86181 100644 --- a/xc/lib/GL/glx/single2.c +++ b/xc/lib/GL/glx/single2.c @@ -1,27 +1,43 @@ -/* $XFree86: xc/lib/GL/glx/single2.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/single2.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ -#include "packsingle.h" +#define NEED_GL_FUNCS_WRAPPED #include "glxclient.h" +#include "packsingle.h" GLenum glGetError(void) { @@ -86,12 +102,18 @@ void glGetBooleanv(GLenum val, GLboolean *b) case GL_PACK_ROW_LENGTH: *b = (GLboolean)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *b = (GLboolean)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *b = (GLboolean)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *b = (GLboolean)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *b = (GLboolean)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *b = (GLboolean)gc->state.storePack.alignment; break; @@ -104,12 +126,18 @@ void glGetBooleanv(GLenum val, GLboolean *b) case GL_UNPACK_ROW_LENGTH: *b = (GLboolean)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *b = (GLboolean)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *b = (GLboolean)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *b = (GLboolean)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *b = (GLboolean)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *b = (GLboolean)gc->state.storeUnpack.alignment; break; @@ -120,68 +148,77 @@ void glGetBooleanv(GLenum val, GLboolean *b) *b = (GLboolean)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *b = (GLboolean)gc->state.vertArray.vertexEnable; + *b = (GLboolean)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.vertexSize; + *b = (GLboolean)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.vertexType; + *b = (GLboolean)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.vertexStride; + *b = (GLboolean)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *b = (GLboolean)gc->state.vertArray.normalEnable; + *b = (GLboolean)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.normalType; + *b = (GLboolean)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.normalStride; + *b = (GLboolean)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *b = (GLboolean)gc->state.vertArray.colorEnable; + *b = (GLboolean)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.colorSize; + *b = (GLboolean)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.colorType; + *b = (GLboolean)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.colorStride; + *b = (GLboolean)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *b = (GLboolean)gc->state.vertArray.indexEnable; + *b = (GLboolean)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.indexType; + *b = (GLboolean)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.indexStride; + *b = (GLboolean)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *b = (GLboolean)gc->state.vertArray.texCoordEnable; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.texCoordSize; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.texCoordType; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.texCoordStride; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *b = (GLboolean)gc->state.vertArray.edgeFlagEnable; + *b = (GLboolean)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.edgeFlagStride; + *b = (GLboolean)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *b = (GLboolean)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *b = (GLboolean)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *b = (GLboolean)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *b = (GLboolean)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -223,12 +260,18 @@ void glGetDoublev(GLenum val, GLdouble *d) case GL_PACK_ROW_LENGTH: *d = (GLdouble)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *d = (GLdouble)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *d = (GLdouble)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *d = (GLdouble)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *d = (GLdouble)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *d = (GLdouble)gc->state.storePack.alignment; break; @@ -241,12 +284,18 @@ void glGetDoublev(GLenum val, GLdouble *d) case GL_UNPACK_ROW_LENGTH: *d = (GLdouble)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *d = (GLdouble)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *d = (GLdouble)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *d = (GLdouble)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *d = (GLdouble)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *d = (GLdouble)gc->state.storeUnpack.alignment; break; @@ -257,68 +306,77 @@ void glGetDoublev(GLenum val, GLdouble *d) *d = (GLdouble)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *d = (GLdouble)gc->state.vertArray.vertexEnable; + *d = (GLdouble)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.vertexSize; + *d = (GLdouble)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.vertexType; + *d = (GLdouble)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.vertexStride; + *d = (GLdouble)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *d = (GLdouble)gc->state.vertArray.normalEnable; + *d = (GLdouble)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.normalType; + *d = (GLdouble)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.normalStride; + *d = (GLdouble)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *d = (GLdouble)gc->state.vertArray.colorEnable; + *d = (GLdouble)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.colorSize; + *d = (GLdouble)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.colorType; + *d = (GLdouble)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.colorStride; + *d = (GLdouble)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *d = (GLdouble)gc->state.vertArray.indexEnable; + *d = (GLdouble)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.indexType; + *d = (GLdouble)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.indexStride; + *d = (GLdouble)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *d = (GLdouble)gc->state.vertArray.texCoordEnable; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.texCoordSize; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.texCoordType; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.texCoordStride; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *d = (GLdouble)gc->state.vertArray.edgeFlagEnable; + *d = (GLdouble)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.edgeFlagStride; + *d = (GLdouble)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *d = (GLdouble)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *d = (GLdouble)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *d = (GLdouble)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *d = (GLdouble)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -360,12 +418,18 @@ void glGetFloatv(GLenum val, GLfloat *f) case GL_PACK_ROW_LENGTH: *f = (GLfloat)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *f = (GLfloat)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *f = (GLfloat)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *f = (GLfloat)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *f = (GLfloat)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *f = (GLfloat)gc->state.storePack.alignment; break; @@ -378,12 +442,18 @@ void glGetFloatv(GLenum val, GLfloat *f) case GL_UNPACK_ROW_LENGTH: *f = (GLfloat)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *f = (GLfloat)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *f = (GLfloat)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *f = (GLfloat)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *f = (GLfloat)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *f = (GLfloat)gc->state.storeUnpack.alignment; break; @@ -394,68 +464,77 @@ void glGetFloatv(GLenum val, GLfloat *f) *f = (GLfloat)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *f = (GLfloat)gc->state.vertArray.vertexEnable; + *f = (GLfloat)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.vertexSize; + *f = (GLfloat)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.vertexType; + *f = (GLfloat)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.vertexStride; + *f = (GLfloat)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *f = (GLfloat)gc->state.vertArray.normalEnable; + *f = (GLfloat)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.normalType; + *f = (GLfloat)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.normalStride; + *f = (GLfloat)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *f = (GLfloat)gc->state.vertArray.colorEnable; + *f = (GLfloat)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.colorSize; + *f = (GLfloat)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.colorType; + *f = (GLfloat)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.colorStride; + *f = (GLfloat)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *f = (GLfloat)gc->state.vertArray.indexEnable; + *f = (GLfloat)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.indexType; + *f = (GLfloat)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.indexStride; + *f = (GLfloat)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *f = (GLfloat)gc->state.vertArray.texCoordEnable; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.texCoordSize; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.texCoordType; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.texCoordStride; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *f = (GLfloat)gc->state.vertArray.edgeFlagEnable; + *f = (GLfloat)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.edgeFlagStride; + *f = (GLfloat)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *f = (GLfloat)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *f = (GLfloat)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *f = (GLfloat)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *f = (GLfloat)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -480,7 +559,7 @@ void glGetIntegerv(GLenum val, GLint *i) __GLX_SINGLE_PUT_LONG(0,val); __GLX_SINGLE_READ_XREPLY(); __GLX_SINGLE_GET_SIZE(compsize); - + if (compsize == 0) { /* ** Error occured; don't modify user's buffer. @@ -497,12 +576,18 @@ void glGetIntegerv(GLenum val, GLint *i) case GL_PACK_ROW_LENGTH: *i = (GLint)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *i = (GLint)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *i = (GLint)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *i = (GLint)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *i = (GLint)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *i = (GLint)gc->state.storePack.alignment; break; @@ -515,12 +600,18 @@ void glGetIntegerv(GLenum val, GLint *i) case GL_UNPACK_ROW_LENGTH: *i = (GLint)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *i = (GLint)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *i = (GLint)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *i = (GLint)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *i = (GLint)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *i = (GLint)gc->state.storeUnpack.alignment; break; @@ -531,68 +622,77 @@ void glGetIntegerv(GLenum val, GLint *i) *i = (GLint)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *i = (GLint)gc->state.vertArray.vertexEnable; + *i = (GLint)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.vertexSize; + *i = (GLint)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.vertexType; + *i = (GLint)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.vertexStride; + *i = (GLint)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *i = (GLint)gc->state.vertArray.normalEnable; + *i = (GLint)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.normalType; + *i = (GLint)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.normalStride; + *i = (GLint)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *i = (GLint)gc->state.vertArray.colorEnable; + *i = (GLint)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.colorSize; + *i = (GLint)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.colorType; + *i = (GLint)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.colorStride; + *i = (GLint)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *i = (GLint)gc->state.vertArray.indexEnable; + *i = (GLint)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.indexType; + *i = (GLint)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.indexStride; + *i = (GLint)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *i = (GLint)gc->state.vertArray.texCoordEnable; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.texCoordSize; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.texCoordType; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.texCoordStride; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *i = (GLint)gc->state.vertArray.edgeFlagEnable; + *i = (GLint)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.edgeFlagStride; + *i = (GLint)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *i = (GLint)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *i = (GLint)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *i = (GLint)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *i = (GLint)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -778,17 +878,17 @@ GLboolean glIsEnabled(GLenum cap) switch(cap) { case GL_VERTEX_ARRAY: - return gc->state.vertArray.vertexEnable; + return gc->state.vertArray.vertex.enable; case GL_NORMAL_ARRAY: - return gc->state.vertArray.normalEnable; + return gc->state.vertArray.normal.enable; case GL_COLOR_ARRAY: - return gc->state.vertArray.colorEnable; + return gc->state.vertArray.color.enable; case GL_INDEX_ARRAY: - return gc->state.vertArray.indexEnable; + return gc->state.vertArray.index.enable; case GL_TEXTURE_COORD_ARRAY: - return gc->state.vertArray.texCoordEnable; + return gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; case GL_EDGE_FLAG_ARRAY: - return gc->state.vertArray.edgeFlagEnable; + return gc->state.vertArray.edgeFlag.enable; } __GLX_SINGLE_LOAD_VARIABLES(); @@ -809,32 +909,32 @@ void glGetPointerv(GLenum pname, void **params) switch(pname) { case GL_VERTEX_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.vertexPtr; + *params = (void *)gc->state.vertArray.vertex.ptr; return; case GL_NORMAL_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.normalPtr; + *params = (void *)gc->state.vertArray.normal.ptr; return; case GL_COLOR_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.colorPtr; + *params = (void *)gc->state.vertArray.color.ptr; return; case GL_INDEX_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.indexPtr; + *params = (void *)gc->state.vertArray.index.ptr; return; case GL_TEXTURE_COORD_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.texCoordPtr; + *params = (void *)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].ptr; return; case GL_EDGE_FLAG_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.edgeFlagPtr; - return; + *params = (void *)gc->state.vertArray.edgeFlag.ptr; + return; case GL_FEEDBACK_BUFFER_POINTER: - *params = (void *)gc->feedbackBuf; - return; + *params = (void *)gc->feedbackBuf; + return; case GL_SELECTION_BUFFER_POINTER: - *params = (void *)gc->selectBuf; - return; + *params = (void *)gc->selectBuf; + return; default: __glXSetError(gc, GL_INVALID_ENUM); - return; + return; } } diff --git a/xc/lib/GL/glx/singlepix.c b/xc/lib/GL/glx/singlepix.c index 82edb3904..fa368fa7f 100644 --- a/xc/lib/GL/glx/singlepix.c +++ b/xc/lib/GL/glx/singlepix.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/lib/GL/glx/singlepix.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/singlepix.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ #include "packsingle.h" @@ -58,7 +73,7 @@ void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, ** to put data back into client memory */ __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize); - __glEmptyImage(gc, width, height, format, type, buf, pixels); + __glEmptyImage(gc, 2, width, height, 1, format, type, buf, pixels); Xfree((char*) buf); } } else { @@ -97,7 +112,7 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, _XEatData(dpy, compsize); __glXSetError(gc, GL_OUT_OF_MEMORY); } else { - GLint width, height; + GLint width, height, depth; /* ** Fetch data into holding buffer. Apply pixel store pack modes @@ -105,8 +120,10 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, */ width = reply.width; height = reply.height; + depth = reply.depth; __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize); - __glEmptyImage(gc, width, height, format, type, buf, texels); + __glEmptyImage(gc, 2, width, height, depth, format, type, buf, + texels); Xfree((char*) buf); } } else { @@ -131,7 +148,255 @@ void glGetPolygonStipple(GLubyte *mask) __GLX_SINGLE_READ_XREPLY(); if (reply.length == 32) { __GLX_SINGLE_GET_CHAR_ARRAY(buf,128); - __glEmptyImage(gc, 32, 32, GL_COLOR_INDEX, GL_BITMAP, buf, mask); + __glEmptyImage(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, buf, mask); + } + __GLX_SINGLE_END(); +} + +void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetColorTableReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTable,__GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = (int)reply.width; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, table); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, + GLvoid *image) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetConvolutionFilterReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionFilter, __GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,format); + __GLX_SINGLE_PUT_LONG(8,type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*) Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width, height; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = reply.width; + height = reply.height; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),compsize); + __glEmptyImage(gc, 2, width, height, 1, format, type, buf, image); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, + GLvoid *row, GLvoid *column, GLvoid *span) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetSeparableFilterReply reply; + GLubyte *rowBuf, *colBuf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,format); + __GLX_SINGLE_PUT_LONG(8,type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = reply.length << 2; + + if (compsize != 0) { + GLint width, height; + GLint widthsize, heightsize; + + width = reply.width; + height = reply.height; + + widthsize = __glImageSize(width,1,1,format, type); + heightsize = __glImageSize(height,1,1,format, type); + + /* Allocate a holding buffer to transform the data from */ + rowBuf = (GLubyte*) Xmalloc(widthsize); + if (!rowBuf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + UnlockDisplay(dpy); + SyncHandle(); + return; + } else { + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)rowBuf),widthsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row); + Xfree((char*) rowBuf); + } + colBuf = (GLubyte*) Xmalloc(heightsize); + if (!colBuf) { + /* Throw data away */ + _XEatData(dpy, compsize - __GLX_PAD(widthsize)); + __glXSetError(gc, GL_OUT_OF_MEMORY); + UnlockDisplay(dpy); + SyncHandle(); + return; + } else { + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)colBuf),heightsize); + __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column); + Xfree((char*) colBuf); + } + } else { + /* + ** don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); + +} + +void glGetHistogram(GLenum target, GLboolean reset, GLenum format, + GLenum type, GLvoid *values) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetHistogramReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogram,__GLX_PAD(14)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_PUT_CHAR(13,reset); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = (int)reply.width; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, values); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, + GLvoid *values) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetMinmaxReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmax,__GLX_PAD(14)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_PUT_CHAR(13,reset); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, 2, 1, 1, format, type, buf, values); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ } __GLX_SINGLE_END(); } diff --git a/xc/lib/GL/glx/size.h b/xc/lib/GL/glx/size.h index 1005d298a..650820e21 100644 --- a/xc/lib/GL/glx/size.h +++ b/xc/lib/GL/glx/size.h @@ -1,26 +1,41 @@ #ifndef _size_h_ #define _size_h_ -/* $XFree86: xc/lib/GL/glx/size.h,v 1.2 1999/06/14 07:23:40 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/size.h,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ /* @@ -29,6 +44,10 @@ */ extern GLint __glBitmap_size(GLsizei w, GLsizei h); extern GLint __glCallLists_size(GLsizei n, GLenum type); +extern GLint __glColorTableParameterfv_size(GLenum pname); +extern GLint __glColorTableParameteriv_size(GLenum pname); +extern GLint __glConvolutionParameterfv_size(GLenum pname); +extern GLint __glConvolutionParameteriv_size(GLenum pname); extern GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h); extern GLint __glFogfv_size(GLenum pname); extern GLint __glFogiv_size(GLenum pname); @@ -44,8 +63,8 @@ extern GLint __glTexGendv_size(GLenum e); extern GLint __glTexGenfv_size(GLenum e); extern GLint __glTexGeniv_size(GLenum pname); extern GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w); -extern GLint __glTexImage2D_size(GLenum format, GLenum type, - GLsizei w, GLsizei h); +extern GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h); +extern GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d); extern GLint __glTexParameterfv_size(GLenum e); extern GLint __glTexParameteriv_size(GLenum e); diff --git a/xc/lib/GL/glx/vertarr.c b/xc/lib/GL/glx/vertarr.c index e62e52663..b4293060a 100644 --- a/xc/lib/GL/glx/vertarr.c +++ b/xc/lib/GL/glx/vertarr.c @@ -1,133 +1,162 @@ -/* $XFree86: xc/lib/GL/glx/vertarr.c,v 1.2 1999/06/14 07:23:40 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:21 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/glx/vertarr.c,v 1.1.1.3.18.1 2001/02/15 04:14:21 gareth Exp $ */ -#include "packrender.h" +#define NEED_GL_FUNCS_WRAPPED #include "glxclient.h" +#include "packrender.h" #include <string.h> +#include <limits.h> /* INT_MAX */ /* macros for setting function pointers */ #define __GL_VERTEX_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 2) \ - va->vertexCall = (void (*)(const char *))glVertex2##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex2##let##v; \ else if (size == 3) \ - va->vertexCall = (void (*)(const char *))glVertex3##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex3##let##v; \ else if (size == 4) \ - va->vertexCall = (void (*)(const char *))glVertex4##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex4##let##v; \ break #define __GL_NORMAL_FUNC(NAME, let) \ case GL_##NAME: \ - va->normalCall = (void (*)(const char *))glNormal3##let##v; \ + normalPointer->proc = (void (*)(const void *))glNormal3##let##v; \ break #define __GL_COLOR_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 3) \ - va->colorCall = (void (*)(const char *))glColor3##let##v; \ + colorPointer->proc = (void (*)(const void *))glColor3##let##v; \ else if (size == 4)\ - va->colorCall = (void (*)(const char *))glColor4##let##v; \ + colorPointer->proc = (void (*)(const void *))glColor4##let##v; \ break #define __GL_INDEX_FUNC(NAME, let) \ case GL_##NAME: \ - va->indexCall = (void (*)(const char *))glIndex##let##v; \ + indexPointer->proc = (void (*)(const void *))glIndex##let##v; \ break #define __GL_TEXTURE_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 1) \ - va->texCoordCall = (void (*)(const char *))glTexCoord1##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord1##let##v; \ else if (size == 2) \ - va->texCoordCall = (void (*)(const char *))glTexCoord2##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord2##let##v; \ else if (size == 3) \ - va->texCoordCall = (void (*)(const char *))glTexCoord3##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord3##let##v; \ else if (size == 4) \ - va->texCoordCall = (void (*)(const char *))glTexCoord4##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord4##let##v; \ break static GLuint __glXTypeSize(GLenum enm) { - switch (enm) { - case __GL_BOOLEAN_ARRAY: return sizeof(GLboolean); - case GL_BYTE: return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: return sizeof(GLubyte); - case GL_SHORT: return sizeof(GLshort); - case GL_UNSIGNED_SHORT: return sizeof(GLushort); - case GL_INT: return sizeof(GLint); - case GL_UNSIGNED_INT: return sizeof(GLint); - case GL_FLOAT: return sizeof(GLfloat); - case GL_DOUBLE: return sizeof(GLdouble); - default: return 0; - } + switch (enm) { + case __GL_BOOLEAN_ARRAY: return sizeof(GLboolean); + case GL_BYTE: return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: return sizeof(GLubyte); + case GL_SHORT: return sizeof(GLshort); + case GL_UNSIGNED_SHORT: return sizeof(GLushort); + case GL_INT: return sizeof(GLint); + case GL_UNSIGNED_INT: return sizeof(GLint); + case GL_FLOAT: return sizeof(GLfloat); + case GL_DOUBLE: return sizeof(GLdouble); + default: return 0; + } } void __glXInitVertexArrayState(__GLXcontext *gc) { __GLXvertArrayState *va = &gc->state.vertArray; + GLint i; + + va->vertex.enable = GL_FALSE; + va->vertex.proc = NULL; + va->vertex.skip = 0; + va->vertex.ptr = 0; + va->vertex.size = 4; + va->vertex.type = GL_FLOAT; + va->vertex.stride = 0; + + va->normal.enable = GL_FALSE; + va->normal.proc = NULL; + va->normal.skip = 0; + va->normal.ptr = 0; + va->normal.size = 3; + va->normal.type = GL_FLOAT; + va->normal.stride = 0; + + va->color.enable = GL_FALSE; + va->color.proc = NULL; + va->color.skip = 0; + va->color.ptr = 0; + va->color.size = 4; + va->color.type = GL_FLOAT; + va->color.stride = 0; + + va->index.enable = GL_FALSE; + va->index.proc = NULL; + va->index.skip = 0; + va->index.ptr = 0; + va->index.size = 1; + va->index.type = GL_FLOAT; + va->index.stride = 0; + + for (i=0; i<__GLX_MAX_TEXTURE_UNITS; ++i) { + __GLXvertexArrayPointerState *texCoord = &va->texCoord[i]; + + texCoord->enable = GL_FALSE; + texCoord->proc = NULL; + texCoord->skip = 0; + texCoord->ptr = 0; + texCoord->size = 4; + texCoord->type = GL_FLOAT; + texCoord->stride = 0; + } - va->vertexEnable = GL_FALSE; - va->vertexCall = NULL; - va->vertexSkip = 0; - va->vertexPtr = 0; - va->vertexSize = 4; - va->vertexType = GL_FLOAT; - va->vertexStride = 0; - - va->normalEnable = GL_FALSE; - va->normalCall = NULL; - va->normalSkip = 0; - va->normalPtr = 0; - va->normalType = GL_FLOAT; - va->normalStride = 0; - - va->colorEnable = GL_FALSE; - va->colorCall = NULL; - va->colorSkip = 0; - va->colorPtr = 0; - va->colorSize = 4; - va->colorType = GL_FLOAT; - va->colorStride = 0; - - va->indexEnable = GL_FALSE; - va->indexCall = NULL; - va->indexSkip = 0; - va->indexPtr = 0; - va->indexType = GL_FLOAT; - va->indexStride = 0; - - va->texCoordEnable = GL_FALSE; - va->texCoordCall = NULL; - va->texCoordSkip = 0; - va->texCoordPtr = 0; - va->texCoordSize = 4; - va->texCoordType = GL_FLOAT; - va->texCoordStride = 0; - - va->edgeFlagEnable = GL_FALSE; - va->edgeFlagCall = NULL; - va->edgeFlagSkip = 0; - va->edgeFlagPtr = 0; - va->edgeFlagStride = 0; + va->edgeFlag.enable = GL_FALSE; + va->edgeFlag.proc = NULL; + va->edgeFlag.skip = 0; + va->edgeFlag.ptr = 0; + va->edgeFlag.size = 1; + va->edgeFlag.type = GL_UNSIGNED_BYTE; + va->edgeFlag.stride = 0; + + va->maxElementsVertices = INT_MAX; + va->maxElementsIndices = INT_MAX; } /*****************************************************************************/ @@ -136,7 +165,7 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *vertexPointer = &gc->state.vertArray.vertex; /* Check arguments */ if (size < 2 || size > 4 || stride < 0) { @@ -144,7 +173,7 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_VERTEX_FUNC(SHORT, s); __GL_VERTEX_FUNC(INT, i); @@ -155,23 +184,23 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, return; } - va->vertexSize = size; - va->vertexType = type; - va->vertexStride = stride; - va->vertexPtr = pointer; + vertexPointer->size = size; + vertexPointer->type = type; + vertexPointer->stride = stride; + vertexPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->vertexSkip = __glXTypeSize(type) * size; + vertexPointer->skip = __glXTypeSize(type) * size; } else { - va->vertexSkip = stride; + vertexPointer->skip = stride; } } void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *normalPointer = &gc->state.vertArray.normal; /* Check arguments */ if (stride < 0) { @@ -179,7 +208,7 @@ void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_NORMAL_FUNC(BYTE, b); __GL_NORMAL_FUNC(SHORT, s); @@ -191,15 +220,15 @@ void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - va->normalType = type; - va->normalStride = stride; - va->normalPtr = pointer; + normalPointer->type = type; + normalPointer->stride = stride; + normalPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->normalSkip = 3 * __glXTypeSize(type); + normalPointer->skip = 3 * __glXTypeSize(type); } else { - va->normalSkip = stride; + normalPointer->skip = stride; } } @@ -207,7 +236,7 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *colorPointer = &gc->state.vertArray.color; /* Check arguments */ if (stride < 0) { @@ -215,7 +244,7 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_COLOR_FUNC(BYTE, b); __GL_COLOR_FUNC(UNSIGNED_BYTE, ub); @@ -229,23 +258,24 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, __glXSetError(gc, GL_INVALID_ENUM); return; } - va->colorSize = size; - va->colorType = type; - va->colorStride = stride; - va->colorPtr = pointer; + + colorPointer->size = size; + colorPointer->type = type; + colorPointer->stride = stride; + colorPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->colorSkip = size * __glXTypeSize(type); + colorPointer->skip = size * __glXTypeSize(type); } else { - va->colorSkip = stride; + colorPointer->skip = stride; } } void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *indexPointer = &gc->state.vertArray.index; /* Check arguments */ if (stride < 0) { @@ -253,7 +283,7 @@ void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_INDEX_FUNC(UNSIGNED_BYTE, ub); __GL_INDEX_FUNC(SHORT, s); @@ -265,15 +295,15 @@ void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - va->indexType = type; - va->indexStride = stride; - va->indexPtr = pointer; + indexPointer->type = type; + indexPointer->stride = stride; + indexPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->indexSkip = __glXTypeSize(type); + indexPointer->skip = __glXTypeSize(type); } else { - va->indexSkip = stride; + indexPointer->skip = stride; } } @@ -281,7 +311,8 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *texCoordPointer = + &gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture]; /* Check arguments */ if (size < 1 || size > 4 || stride < 0) { @@ -289,7 +320,7 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_TEXTURE_FUNC(SHORT, s); __GL_TEXTURE_FUNC(INT, i); @@ -300,23 +331,23 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - va->texCoordSize = size; - va->texCoordType = type; - va->texCoordStride = stride; - va->texCoordPtr = pointer; + texCoordPointer->size = size; + texCoordPointer->type = type; + texCoordPointer->stride = stride; + texCoordPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->texCoordSkip = __glXTypeSize(type) * size; + texCoordPointer->skip = __glXTypeSize(type) * size; } else { - va->texCoordSkip = stride; + texCoordPointer->skip = stride; } } void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *edgeFlagPointer = &gc->state.vertArray.edgeFlag; /* Check arguments */ if (stride < 0) { @@ -324,19 +355,19 @@ void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer) return; } - va->edgeFlagStride = stride; - va->edgeFlagPtr = pointer; + /* Choose appropriate api proc */ + edgeFlagPointer->proc = (void (*)(const void *))glEdgeFlagv; + + edgeFlagPointer->stride = stride; + edgeFlagPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->edgeFlagSkip = sizeof(GLboolean); + edgeFlagPointer->skip = sizeof(GLboolean); } else { - va->edgeFlagSkip = stride; + edgeFlagPointer->skip = stride; } - /* Choose appropriate api call */ - va->edgeFlagCall = glEdgeFlagv; - } void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) @@ -506,29 +537,32 @@ void glArrayElement(GLint i) { __GLXcontext *gc = __glXGetCurrentContext(); __GLXvertArrayState *va = &gc->state.vertArray; + GLint j; - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(va->edgeFlagPtr+i*va->edgeFlagSkip); + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(va->edgeFlag.ptr+i*va->edgeFlag.skip); } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(va->texCoordPtr+i*va->texCoordSkip); + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(va->texCoord[j].ptr+i*va->texCoord[j].skip); + } } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(va->colorPtr+i*va->colorSkip); + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(va->color.ptr+i*va->color.skip); } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(va->indexPtr+i*va->indexSkip); + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(va->index.ptr+i*va->index.skip); } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(va->normalPtr+i*va->normalSkip); + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(va->normal.ptr+i*va->normal.skip); } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(va->vertexPtr+i*va->vertexSkip); + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(va->vertex.ptr+i*va->vertex.skip); } } @@ -537,9 +571,9 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) __GLXcontext *gc = __glXGetCurrentContext(); __GLXvertArrayState *va = &gc->state.vertArray; const char *vaPtr = NULL, *naPtr = NULL, *caPtr = NULL, - *iaPtr = NULL, *tcaPtr = NULL; + *iaPtr = NULL, *tcaPtr[__GLX_MAX_TEXTURE_UNITS]; const GLboolean *efaPtr = NULL; - GLint i; + GLint i, j; switch(mode) { case GL_POINTS: @@ -566,44 +600,48 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) /* ** Set up pointers for quick array traversal. */ - if (va->normalEnable == GL_TRUE) - naPtr = va->normalPtr + first * va->normalSkip; - if (va->colorEnable == GL_TRUE) - caPtr = va->colorPtr + first * va->colorSkip; - if (va->indexEnable == GL_TRUE) - iaPtr = va->indexPtr + first * va->indexSkip; - if (va->texCoordEnable == GL_TRUE) - tcaPtr = va->texCoordPtr + first * va->texCoordSkip; - if (va->edgeFlagEnable == GL_TRUE) - efaPtr = va->edgeFlagPtr + first * va->edgeFlagSkip; - if (va->vertexEnable == GL_TRUE) - vaPtr = va->vertexPtr + first * va->vertexSkip; + if (va->normal.enable == GL_TRUE) + naPtr = va->normal.ptr + first * va->normal.skip; + if (va->color.enable == GL_TRUE) + caPtr = va->color.ptr + first * va->color.skip; + if (va->index.enable == GL_TRUE) + iaPtr = va->index.ptr + first * va->index.skip; + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) + tcaPtr[j] = va->texCoord[j].ptr + first * va->texCoord[j].skip; + } + if (va->edgeFlag.enable == GL_TRUE) + efaPtr = va->edgeFlag.ptr + first * va->edgeFlag.skip; + if (va->vertex.enable == GL_TRUE) + vaPtr = va->vertex.ptr + first * va->vertex.skip; glBegin(mode); for (i = 0; i < count; i++) { - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(efaPtr); - efaPtr += va->edgeFlagSkip; + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(efaPtr); + efaPtr += va->edgeFlag.skip; } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(tcaPtr); - tcaPtr += va->texCoordSkip; - } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(caPtr); - caPtr += va->colorSkip; + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(tcaPtr[j]); + tcaPtr[j] += va->texCoord[j].skip; + } + } + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(caPtr); + caPtr += va->color.skip; } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(iaPtr); - iaPtr += va->indexSkip; + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(iaPtr); + iaPtr += va->index.skip; } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(naPtr); - naPtr += va->normalSkip; + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(naPtr); + naPtr += va->normal.skip; } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(vaPtr); - vaPtr += va->vertexSkip; + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(vaPtr); + vaPtr += va->vertex.skip; } } glEnd(); @@ -617,7 +655,7 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLubyte *iPtr1 = NULL; const GLushort *iPtr2 = NULL; const GLuint *iPtr3 = NULL; - GLint i, offset = 0; + GLint i, j, offset = 0; switch (mode) { case GL_POINTS: @@ -669,24 +707,53 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, offset = (GLint)(*iPtr3++); break; } - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(va->edgeFlagPtr+(offset*va->edgeFlagSkip)); - } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(va->texCoordPtr+(offset*va->texCoordSkip)); + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(va->edgeFlag.ptr+(offset*va->edgeFlag.skip)); } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(va->colorPtr+(offset*va->colorSkip)); + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(va->texCoord[j].ptr+ + (offset*va->texCoord[j].skip)); + } + } + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(va->color.ptr+(offset*va->color.skip)); } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(va->indexPtr+(offset*va->indexSkip)); + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(va->index.ptr+(offset*va->index.skip)); } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(va->normalPtr+(offset*va->normalSkip)); + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(va->normal.ptr+(offset*va->normal.skip)); } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(va->vertexPtr+(offset*va->vertexSkip)); + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(va->vertex.ptr+(offset*va->vertex.skip)); } } glEnd(); } + +void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + __GLXcontext *gc = __glXGetCurrentContext(); + + if (end < start) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + + glDrawElements(mode,count,type,indices); +} + +void glClientActiveTextureARB(GLenum texture) +{ + __GLXcontext *gc = __glXGetCurrentContext(); + GLint unit = (GLint) texture - GL_TEXTURE0_ARB; + + if (unit < 0 || __GLX_MAX_TEXTURE_UNITS <= unit) { + __glXSetError(gc, GL_INVALID_ENUM); + return; + } + gc->state.vertArray.activeTexture = unit; +} diff --git a/xc/lib/GL/include/GL/internal/glcore.h b/xc/lib/GL/include/GL/internal/glcore.h index 08de67219..53fc7dfc1 100644 --- a/xc/lib/GL/include/GL/internal/glcore.h +++ b/xc/lib/GL/include/GL/internal/glcore.h @@ -1,32 +1,52 @@ #ifndef __gl_core_h_ #define __gl_core_h_ -/* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.5 1999/06/14 07:23:42 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:22 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/lib/GL/include/GL/internal/Attic/glcore.h,v 1.1.1.3.18.1 2001/02/15 04:14:22 gareth Exp $ */ #ifndef XFree86LOADER #include <sys/types.h> #endif +#ifdef CAPI +#undef CAPI +#endif +#define CAPI + #define GL_CORE_SGI 1 #define GL_CORE_MESA 2 @@ -202,13 +222,13 @@ struct __GLdrawableBufferRec { void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLuint val, GLint x, GLint y, GLint w, GLint h); void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - void *other; /* exported */ void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); void *private; /* private */ + void *other; /* implementation private data */ __GLbufMainInitFn mainInit; __GLbufFallbackInitFn fallbackInit; }; @@ -260,7 +280,7 @@ struct __GLdrawablePrivateRec { __GLdrawableBuffer accumBuffer; __GLdrawableBuffer depthBuffer; __GLdrawableBuffer stencilBuffer; -#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) +#if __GL_NUMBER_OF_AUX_BUFFERS > 0 __GLdrawableBuffer *auxBuffer; #endif @@ -295,12 +315,12 @@ struct __GLdrawablePrivateRec { void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); void (*unlockDP)(__GLdrawablePrivate *glPriv); - - void *other; - /* exported */ - void (*freePrivate)(__GLdrawablePrivate *); void *private; + void (*freePrivate)(__GLdrawablePrivate *); + + /* client data */ + void *other; }; /* @@ -330,7 +350,7 @@ struct __GLdrawablePrivateRec { */ typedef struct __GLimportsRec { /* Memory management */ - void *(*malloc)(__GLcontext *gc, size_t size); + void * (*malloc)(__GLcontext *gc, size_t size); void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize); void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize); void (*free)(__GLcontext *gc, void *addr); @@ -340,11 +360,12 @@ typedef struct __GLimportsRec { void (*fatal)(__GLcontext *gc, char *fmt); /* other system calls */ - char *(*getenv)(__GLcontext *gc, const char *var); - int (*sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); - void *(*fopen)(__GLcontext *gc, const char *path, const char *mode); - int (*fclose)(__GLcontext *gc, void *stream); - int (*fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); + char *(CAPI *getenv)(__GLcontext *gc, const char *var); + int (CAPI *atoi)(__GLcontext *gc, const char *str); + int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); + void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode); + int (CAPI *fclose)(__GLcontext *gc, void *stream); + int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); /* Drawing surface management */ __GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc); diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c index 3254bf877..57dc6a15f 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.c +++ b/xc/lib/GL/mesa/dri/dri_mesa.c @@ -32,6 +32,27 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Brian E. Paul <brian@precisioninsight.com> */ +/* + * This file gets compiled into each of the DRI 3D drivers. The + * functions defined here are called from the GL library via + * function pointers in the __DRIdisplayRec, __DRIscreenRec, + * __DRIcontextRec, __DRIdrawableRec structures defined in glxclient.h + * + * Those function pointers are initialized by code in this file. + * The process starts when libGL calls the __driCreateScreen() function + * at the end of this file. + * + * The above-mentioned DRI structures have no dependencies on Mesa. + * Each structure instead has a generic (void *) private pointer that + * points to a private structure. For Mesa drivers, these private + * structures are the __DRIdrawablePrivateRec, __DRIcontextPrivateRec, + * __DRIscreenPrivateRec, and __DRIvisualPrivateRec structures defined + * in dri_mesaint.h. We allocate and attach those structs here in + * this file. + */ + + + #ifdef GLX_DIRECT_RENDERING #include <unistd.h> @@ -58,19 +79,19 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn, static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw, VisualID vid, __DRIdrawable *pdraw); static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw, - void *private); -static void driMesaSwapBuffers(Display *dpy, void *private); -static void driMesaDestroyDrawable(Display *dpy, void *private); + void *screenPrivate); +static void driMesaSwapBuffers(Display *dpy, void *drawPrivate); +static void driMesaDestroyDrawable(Display *dpy, void *drawPrivate); /* Context methods */ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, __DRIcontext *pctx); -static void driMesaDestroyContext(Display *dpy, int scrn, void *private); +static void driMesaDestroyContext(Display *dpy, int scrn, void *screenPrivate); /* Screen methods */ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config); -static void driMesaDestroyScreen(Display *dpy, int scrn, void *private); +static void driMesaDestroyScreen(Display *dpy, int scrn, void *screenPrivate); static Bool driFeatureOn(const char *name) { @@ -184,10 +205,15 @@ static void __driMesaGarbageCollectDrawables(void *drawHash) /*****************************************************************/ +/* + * XXX get rid of this level of indirection? + * Since the code in this file is compiled into each DRI 3D driver + * this layer of indirection serves no purpose. + */ static void driMesaInitAPI(__MesaAPI *MesaAPI) { - MesaAPI->InitDriver = XMesaInitDriver; - MesaAPI->ResetDriver = XMesaResetDriver; + MesaAPI->InitDriver = XMesaInitDriver; /* XXX rename as CreateScreen? */ + MesaAPI->ResetDriver = XMesaResetDriver; /* rename as DestroyScreen? */ MesaAPI->CreateVisual = XMesaCreateVisual; MesaAPI->CreateContext = XMesaCreateContext; MesaAPI->DestroyContext = XMesaDestroyContext; @@ -283,9 +309,15 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn, #endif } + /* XXX this is disabled so that if we call SwapBuffers on an unbound + * window we can determine the last context bound to the window and + * use that context's lock. (BrianP, 2-Dec-2000) + */ +#if 0 /* Unbind the drawable */ pcp->driDrawablePriv = NULL; pdp->driContextPriv = &psp->dummyContextPriv; +#endif return GL_TRUE; } @@ -444,10 +476,11 @@ static Bool driMesaBindContext(Display *dpy, int scrn, /* * This function basically updates the __DRIdrawablePrivate struct's - * cliprect information by calling XF86DRIGetDrawableInfo(). - * This is usually called by a macro which compares the - * __DRIdrwablePrivate pStamp and lastStamp values. If the values - * are different that means we have to update the clipping info. + * cliprect information by calling XF86DRIGetDrawableInfo(). This is + * usually called by the DRI_MESA_VALIDATE_DRAWABLE_INFO macro which + * compares the __DRIdrwablePrivate pStamp and lastStamp values. If + * the values are different that means we have to update the clipping + * info. */ void driMesaUpdateDrawableInfo(Display *dpy, int scrn, __DRIdrawablePrivate *pdp) @@ -571,9 +604,9 @@ static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw, } static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw, - void *private) + void *screenPrivate) { - __DRIscreenPrivate *psp = (__DRIscreenPrivate *)private; + __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; /* ** Make sure this routine returns NULL if the drawable is not bound @@ -582,17 +615,22 @@ static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw, return __driMesaFindDrawable(psp->drawHash, draw); } -static void driMesaSwapBuffers(Display *dpy, void *private) +/* + * XXX if we get rid of the XMesa function table then we should probably + * get rid of this function and require each driver to implement a + * driMesaSwapBuffers function. + */ +static void driMesaSwapBuffers(Display *dpy, void *drawPrivate) { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)private; + __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawPrivate; __DRIscreenPrivate *psp = pdp->driScreenPriv; (*psp->MesaAPI.SwapBuffers)(pdp); } -static void driMesaDestroyDrawable(Display *dpy, void *private) +static void driMesaDestroyDrawable(Display *dpy, void *drawPrivate) { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)private; + __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)drawPrivate; __DRIscreenPrivate *psp = pdp->driScreenPriv; int scrn = psp->myNum; @@ -634,6 +672,7 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, psp->dummyContextPriv.driScreenPriv = psp; psp->dummyContextPriv.mesaContext = NULL; psp->dummyContextPriv.driDrawablePriv = NULL; + psp->dummyContextPriv.driverPrivate = NULL; /* No other fields should be used! */ } @@ -672,6 +711,7 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, else { gl_destroy_context(pcp->mesaContext); pcp->mesaContext = NULL; + pcp->driverPrivate = NULL; } } } @@ -692,9 +732,9 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, return pcp; } -static void driMesaDestroyContext(Display *dpy, int scrn, void *private) +static void driMesaDestroyContext(Display *dpy, int scrn, void *contextPrivate) { - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)private; + __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -757,6 +797,8 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, psp->fd = drmOpen(NULL,BusID); if (psp->fd < 0) { + fprintf(stderr, "libGL error: failed to open DRM: %s\n", strerror(-psp->fd)); + fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n"); Xfree(BusID); Xfree(psp); (void)XF86DRICloseConnection(dpy, scrn); @@ -793,6 +835,11 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * Get device name (like "tdfx") and the ddx version numbers. + * We'll check the version in each DRI driver's "createScreen" + * function. + */ if (!XF86DRIGetClientDriverName(dpy, scrn, &psp->ddxMajor, &psp->ddxMinor, @@ -804,8 +851,17 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * XXX this XMesa indirection may go away. + */ driMesaInitAPI(&psp->MesaAPI); + /* + * Get device-specific info. pDevPriv will point to a struct + * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) + * that has information about the screen size, depth, pitch, + * ancilliary buffers, DRM mmap handles, etc. + */ if (!XF86DRIGetDeviceInfo(dpy, scrn, &hFB, &psp->fbOrigin, @@ -822,6 +878,9 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, psp->fbHeight = DisplayHeight(dpy, scrn); psp->fbBPP = 32; /* NOT_DONE: Get this from X server */ + /* + * Map the framebuffer region. + */ if (drmMap(psp->fd, hFB, psp->fbSize, (drmAddressPtr)&psp->pFB)) { Xfree(psp->pDevPriv); (void)drmClose(psp->fd); @@ -830,6 +889,10 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * Map the SAREA region. Further mmap regions may be setup in + * each DRI driver's "createScreen" function. + */ if (drmMap(psp->fd, hSAREA, SAREA_MAX, (drmAddressPtr)&psp->pSAREA)) { (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); Xfree(psp->pDevPriv); @@ -839,6 +902,9 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * Allocate space for an array of visual records and initialize them. + */ psp->numVisuals = numConfigs; psp->visuals = (__DRIvisualPrivate *)Xmalloc(numConfigs * sizeof(__DRIvisualPrivate)); @@ -922,15 +988,21 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return (void *)psp; } -static void driMesaDestroyScreen(Display *dpy, int scrn, void *private) +static void driMesaDestroyScreen(Display *dpy, int scrn, void *screenPrivate) { - __DRIscreenPrivate *psp = (__DRIscreenPrivate *)private; + __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; if (psp) { +#if 0 + /* + ** NOT_DONE: For the same reason as that listed below, we cannot + ** call the X server here to destroy the dummy context. + */ if (psp->dummyContextPriv.driScreenPriv) { (void)XF86DRIDestroyContext(dpy, scrn, psp->dummyContextPriv.contextID); } +#endif if (psp->MesaAPI.ResetDriver) (*psp->MesaAPI.ResetDriver)(psp); while (--psp->numVisuals >= 0) { @@ -959,13 +1031,14 @@ static void driMesaDestroyScreen(Display *dpy, int scrn, void *private) /* - * This is the entrypoint into the driver. - * The driCreateScreen name is the symbol that libGL.so fetches. + * This is the entrypoint into the DRI 3D driver. + * The driCreateScreen name is the symbol that libGL.so fetches via + * dlsym() in order to bootstrap the driver. */ void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { - return driMesaCreateScreen(dpy, scrn, psc, numConfigs, config); + return driMesaCreateScreen(dpy, scrn, psc, numConfigs, config); } diff --git a/xc/lib/GL/mesa/src/drv/common/depthtmp.h b/xc/lib/GL/mesa/src/drv/common/depthtmp.h index 0c10eae19..971401413 100644 --- a/xc/lib/GL/mesa/src/drv/common/depthtmp.h +++ b/xc/lib/GL/mesa/src/drv/common/depthtmp.h @@ -4,6 +4,7 @@ #define DBG 0 #endif + #ifndef HAVE_HW_DEPTH_SPANS #define HAVE_HW_DEPTH_SPANS 0 #endif @@ -11,13 +12,19 @@ #define HAVE_HW_DEPTH_PIXELS 0 #endif +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif static void TAG(WriteDepthSpan)( GLcontext *ctx, - GLuint n, GLint x, GLint y, + GLuint n, GLint x, GLint y, const GLdepth *depth, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -54,7 +61,7 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteDepthPixels)( GLcontext *ctx, @@ -64,7 +71,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, const GLdepth depth[], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_DEPTH_VARS; @@ -89,7 +96,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -99,7 +106,7 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth depth[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint x1, n1; LOCAL_DEPTH_VARS; @@ -123,14 +130,14 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_READ_UNLOCK(); } static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLdepth depth[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_DEPTH_VARS; @@ -153,9 +160,10 @@ static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_READ_UNLOCK(); } + #if HAVE_HW_DEPTH_SPANS #undef WRITE_DEPTH_SPAN #undef WRITE_DEPTH_PIXELS diff --git a/xc/lib/GL/mesa/src/drv/common/spantmp.h b/xc/lib/GL/mesa/src/drv/common/spantmp.h index 1e69d7b7f..4cac09bd0 100644 --- a/xc/lib/GL/mesa/src/drv/common/spantmp.h +++ b/xc/lib/GL/mesa/src/drv/common/spantmp.h @@ -2,21 +2,45 @@ #define DBG 0 #endif -static void TAG(WriteRGBASpan)( const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif + +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif + +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_CLIPLOOP +#define HW_READ_CLIPLOOP() HW_CLIPLOOP() +#endif + +#ifndef HW_WRITE_CLIPLOOP +#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() +#endif + + +static void TAG(WriteRGBASpan)( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; LOCAL_VARS; - - y = Y_FLIP(y); + y = Y_FLIP(y); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); @@ -26,31 +50,31 @@ static void TAG(WriteRGBASpan)( const GLcontext *ctx, if (mask) { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) - WRITE_RGBA( x1, y, - rgba[i][0], rgba[i][1], + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } else { - for (;i<n1;i++,x1++) - WRITE_RGBA( x1, y, - rgba[i][0], rgba[i][1], + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteRGBSpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], + const GLubyte rgb[][3], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -58,7 +82,7 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx, y = Y_FLIP(y); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); @@ -68,59 +92,59 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx, if (mask) { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } else { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteRGBAPixels)( const GLcontext *ctx, - GLuint n, - const GLint x[], + GLuint n, + const GLint x[], const GLint y[], - const GLubyte rgba[][4], + const GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_VARS; if (DBG) fprintf(stderr, "WriteRGBAPixels\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { for (i=0;i<n;i++) { if (mask[i]) { const int fy = Y_FLIP(y[i]); if (CLIPPIXEL(x[i],fy)) - WRITE_RGBA( x[i], fy, - rgba[i][0], rgba[i][1], + WRITE_RGBA( x[i], fy, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } -static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, - GLuint n, GLint x, GLint y, +static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, + GLuint n, GLint x, GLint y, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -131,26 +155,26 @@ static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) WRITE_PIXEL( x1, y, p ); } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, - GLuint n, + GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_VARS; @@ -158,7 +182,7 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { for (i=0;i<n;i++) if (mask[i]) { @@ -168,20 +192,16 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, } } HW_ENDCLIPLOOP(); - } - HW_UNLOCK(); + } + HW_WRITE_UNLOCK(); } - -/* - * Read a horizontal span of color pixels. - */ static void TAG(ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]) { - HW_LOCK() + HW_READ_LOCK() { GLint x1,n1; LOCAL_VARS; @@ -190,30 +210,31 @@ static void TAG(ReadRGBASpan)( const GLcontext *ctx, if (DBG) fprintf(stderr, "ReadRGBASpan\n"); - HW_CLIPLOOP() + HW_READ_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); - for (;i<n1;i++) - READ_RGBA( rgba[i], (x1+i), y ); + for (;n1>0;i++,x1++,n1--) + READ_RGBA( rgba[i], x1, y ); } - HW_ENDCLIPLOOP(); + HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } + static void TAG(ReadRGBAPixels)( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_VARS; if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); - - HW_CLIPLOOP() + + HW_READ_CLIPLOOP() { for (i=0;i<n;i++) if (mask[i]) { @@ -224,7 +245,7 @@ static void TAG(ReadRGBAPixels)( const GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } diff --git a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h b/xc/lib/GL/mesa/src/drv/common/stenciltmp.h index d22f6867c..2dada8da7 100644 --- a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h +++ b/xc/lib/GL/mesa/src/drv/common/stenciltmp.h @@ -4,13 +4,26 @@ #define DBG 0 #endif +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif static void TAG(WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLstencil *stencil, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -40,7 +53,7 @@ static void TAG(WriteStencilSpan)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -51,7 +64,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, const GLstencil stencil[], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_STENCIL_VARS; @@ -71,7 +84,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -81,7 +94,7 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLstencil stencil[]) { - HW_LOCK() + HW_READ_LOCK() { GLint x1,n1; LOCAL_STENCIL_VARS; @@ -99,14 +112,14 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLstencil stencil[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_STENCIL_VARS; @@ -123,7 +136,7 @@ static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810span.c b/xc/lib/GL/mesa/src/drv/i810/i810span.c index aa4f22d0c..9e86e9b68 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810span.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810span.c @@ -36,18 +36,18 @@ _y >= miny && _y < maxy) -#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ - if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ - else { \ - _n1 = _n; \ - _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ - } +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } #define Y_FLIP(_y) (height - _y - 1) - #define HW_LOCK() \ i810ContextPtr imesa = I810_CONTEXT(ctx); \ LOCK_HARDWARE_QUIESCENT(imesa); diff --git a/xc/lib/GL/mesa/src/drv/i810/i810state.c b/xc/lib/GL/mesa/src/drv/i810/i810state.c index 55f63db2e..cdccbd5ec 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810state.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810state.c @@ -63,11 +63,18 @@ static void i810DDAlphaFunc(GLcontext *ctx, GLenum func, GLclampf ref) static void i810DDBlendEquation(GLcontext *ctx, GLenum mode) { + i810ContextPtr imesa = I810_CONTEXT(ctx); + if (mode != GL_FUNC_ADD_EXT) { ctx->Color.BlendEquation = GL_FUNC_ADD_EXT; if (0) fprintf(stderr, "Unsupported blend equation: %s\n", gl_lookup_enum_by_nr(mode)); } + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + imesa->Fallback |= I810_FALLBACK_LOGICOP; + else + imesa->Fallback &= ~I810_FALLBACK_LOGICOP; } static void i810DDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) @@ -244,10 +251,10 @@ static void i810DDDither(GLcontext *ctx, GLboolean enable) static void i810DDLogicOp( GLcontext *ctx, GLenum opcode ) { + i810ContextPtr imesa = I810_CONTEXT(ctx); + if (ctx->Color.ColorLogicOpEnabled) { - i810ContextPtr imesa = I810_CONTEXT(ctx); - FLUSH_BATCH( imesa ); if (opcode == GL_COPY) @@ -255,6 +262,8 @@ static void i810DDLogicOp( GLcontext *ctx, GLenum opcode ) else imesa->Fallback |= I810_FALLBACK_LOGICOP; } + else + imesa->Fallback &= ~I810_FALLBACK_LOGICOP; } static GLboolean i810DDSetDrawBuffer(GLcontext *ctx, GLenum mode ) @@ -529,6 +538,13 @@ static void i810DDEnable(GLcontext *ctx, GLenum cap, GLboolean state) imesa->Setup[I810_CTXREG_B1] &= ~B1_BLEND_ENABLE; if (state) imesa->Setup[I810_CTXREG_B1] |= B1_BLEND_ENABLE; + + /* For some reason enable(GL_BLEND) affects ColorLogicOpEnabled. + */ + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + imesa->Fallback |= I810_FALLBACK_LOGICOP; + else + imesa->Fallback &= ~I810_FALLBACK_LOGICOP; break; case GL_DEPTH_TEST: FLUSH_BATCH(imesa); @@ -621,7 +637,6 @@ static void i810DDEnable(GLcontext *ctx, GLenum cap, GLboolean state) } break; case GL_COLOR_LOGIC_OP: - case GL_INDEX_LOGIC_OP: FLUSH_BATCH( imesa ); imesa->Fallback &= ~I810_FALLBACK_LOGICOP; if (state && ctx->Color.LogicOp != GL_COPY) diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile b/xc/lib/GL/mesa/src/drv/mga/Imakefile index 2630d8159..219690a8f 100644 --- a/xc/lib/GL/mesa/src/drv/mga/Imakefile +++ b/xc/lib/GL/mesa/src/drv/mga/Imakefile @@ -72,6 +72,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ mgafastpath.c \ mgaioctl.c \ mgapipeline.c \ + mgapixel.c \ mgaspan.c \ mgastate.c \ mgatex.c \ @@ -87,6 +88,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ mgafastpath.o \ mgaioctl.o \ mgapipeline.o \ + mgapixel.o \ mgaspan.o \ mgastate.o \ mgatex.o \ diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c index 23e5c0409..c803ac5b5 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c @@ -132,7 +132,8 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "\n\nflush"); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); } buf = &(mmesa->mgaScreen->bufs->list[idx]); @@ -371,7 +372,7 @@ void mgaDDFinish( GLcontext *ctx ) fprintf(stderr, "mgaRegetLockQuiescent\n"); LOCK_HARDWARE( mmesa ); - mgaUpdateLock( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH); + UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); UNLOCK_HARDWARE( mmesa ); mmesa->sarea->last_quiescent = mmesa->sarea->last_enqueue; @@ -381,7 +382,7 @@ void mgaDDFinish( GLcontext *ctx ) void mgaWaitAgeLocked( mgaContextPtr mmesa, int age ) { if (GET_DISPATCH_AGE(mmesa) < age) { - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH ); } } @@ -391,7 +392,7 @@ void mgaWaitAge( mgaContextPtr mmesa, int age ) if (GET_DISPATCH_AGE(mmesa) < age) { LOCK_HARDWARE(mmesa); if (GET_DISPATCH_AGE(mmesa) < age) { - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH ); } UNLOCK_HARDWARE(mmesa); } @@ -581,7 +582,7 @@ void mgaFireILoadLocked( mgaContextPtr mmesa, /* HACK */ - mgaUpdateLock( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH); + UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); mga_iload_dma_ioctl( mmesa, offset, length ); } @@ -619,7 +620,7 @@ void mgaDDFlush( GLcontext *ctx ) */ if (1 || GET_DISPATCH_AGE( mmesa ) < mmesa->sarea->last_enqueue) { LOCK_HARDWARE( mmesa ); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH ); UNLOCK_HARDWARE( mmesa ); } } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h index e34a0c65b..1f70d3dbc 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h @@ -7,10 +7,10 @@ #include "mga_xmesa.h" GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all, - GLint cx, GLint cy, GLint cw, GLint ch ); + GLint cx, GLint cy, GLint cw, GLint ch ); -void mgaSwapBuffers( mgaContextPtr mmesa ); +void mgaSwapBuffers( mgaContextPtr mmesa ); @@ -21,19 +21,19 @@ void mgaGetILoadBufferLocked( mgaContextPtr mmesa ); drmBufPtr mgaGetBufferLocked( mgaContextPtr mmesa ); -void mgaFireILoadLocked( mgaContextPtr mmesa, +void mgaFireILoadLocked( mgaContextPtr mmesa, GLuint offset, GLuint length ); void mgaWaitAgeLocked( mgaContextPtr mmesa, int age ); void mgaWaitAge( mgaContextPtr mmesa, int age ); int mgaUpdateLock( mgaContextPtr mmesa, drmLockFlags flags ); -void mgaFlushVertices( mgaContextPtr mmesa ); +void mgaFlushVertices( mgaContextPtr mmesa ); void mgaFlushVerticesLocked( mgaContextPtr mmesa ); -void mgaFireEltsLocked( mgaContextPtr mmesa, - GLuint start, +void mgaFireEltsLocked( mgaContextPtr mmesa, + GLuint start, GLuint end, GLuint discard ); @@ -51,7 +51,7 @@ void mgaDDFlush( GLcontext *ctx ); void mgaDDFinish( GLcontext *ctx ); void mgaDDInitIoctlFuncs( GLcontext *ctx ); - + #define FLUSH_BATCH(mmesa) do { \ if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) \ fprintf(stderr, "FLUSH_BATCH in %s\n", __FUNCTION__); \ @@ -70,12 +70,12 @@ GLuint *mgaAllocVertexDwordsInline( mgaContextPtr mmesa, int dwords ) if (!mmesa->vertex_dma_buffer) { LOCK_HARDWARE( mmesa ); - if (mmesa->first_elt != mmesa->next_elt) + if (mmesa->first_elt != mmesa->next_elt) mgaFlushEltsLocked(mmesa); mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa ); UNLOCK_HARDWARE( mmesa ); - } else if (mmesa->vertex_dma_buffer->used + bytes > + } else if (mmesa->vertex_dma_buffer->used + bytes > mmesa->vertex_dma_buffer->total) { LOCK_HARDWARE( mmesa ); mgaFlushVerticesLocked( mmesa ); @@ -83,11 +83,23 @@ GLuint *mgaAllocVertexDwordsInline( mgaContextPtr mmesa, int dwords ) UNLOCK_HARDWARE( mmesa ); } - head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address + + head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address + mmesa->vertex_dma_buffer->used); mmesa->vertex_dma_buffer->used += bytes; return head; } + +#define UPDATE_LOCK( mmesa, flags ) \ +do { \ + GLint ret = drmMGAFlushDMA( mmesa->driFd, flags ); \ + if ( ret ) { \ + drmMGAEngineReset( mmesa ); \ + UNLOCK_HARDWARE( mmesa ); \ + fprintf( stderr, "drmMGAFlushDMA: return = %d\n", ret ); \ + exit( 1 ); \ + } \ +} while (0) + #endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/BUGS b/xc/lib/GL/mesa/src/drv/tdfx/BUGS new file mode 100644 index 000000000..b15f6a91e --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/BUGS @@ -0,0 +1,64 @@ +REMOVE THIS FILE BEFORE MERGING WITH TRUNK +------------------------------------------ + +OUTSTANDING BUGS + +demos/reflect - reading back Z on Voodoo3, image offset to right + Fixed in latest Glide. + +Q3 - some polygons drawn as vertical strips, similar to bug that was + seen in demos/fire. Voodoo3 only. May be related to glDepthMask + or glColorMask. + +book/fog - not fogging + Fog in orthograph mode still not implemented. Checking with + 3dfx engineers for ideas. + +Q3 demo crashes after changing display settings + but the full Q3 game version seems OK. + + + +MORE OUTSTANDING BUGS + +private context was NULL! causing immediate failure of any glx prog. cant +reproduce after restarting the X server. putting it down as halluc. + +texture object image was NULL, causing segmentation failure. happens with +prboom. ive put a check in tdfx_texstate.c but this isn't a fix. + +prboom, wall textures near first chainsaw aren't bound properly. sideways +movements causes the wall textures to move with you. prboom busted? + +16bpp mode, quake3, windowed, q3dm1, floor under rocketlauncher bands. it +looks like multitexturing gone wrong. i'll disable a tmu and test. + +sof, polygons appear at wrong x,y,z positions, intermittent, have not yet +found reliable way of reproducing. culling? sometimes polys disappear. + +descent3 is all black in 16bpp mode - FIXED (palette problems) + +smeared pixels in quake3 - FIXED (texture memory overlapped FB) + + + +PERFORMANCE COMPARISON (Brian / Alan) + + V3/16 is Voodoo3 in 16bpp on a P3/500 + V5/16 is Voodoo5 in 16bpp on a P3/600 + V5/32 is Voodoo5 in 32bpp on a P3/600 + V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600 + V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600 + + tdfx-2-1-branch tdfx-3-0-0-branch +demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32 +------------------------------------------------------------------------ +gloss 257 183 174 320 308 177 313 167 +fire 42 39 52 41 +fire (no help) 98 80 50 106 113 73 124 80 +tunnel 61 50 70 58 +tunnel (no help) 167 142 57 138 152 113 171 122 +gears 663 554 540 881 1232 776 1484 830 +teapot 20 21 37 36 +teapot (no help) 22 14 14 24 30 30 43 42 + diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile index 160a33da6..ebb353844 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile @@ -57,41 +57,43 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../../../dri/drm/xf86drmRandom.o \ ../../../../dri/drm/xf86drmSL.o - TDFXSRCS = tdfx_xmesa.c \ - tdfx_init.c \ - tdfx_inithw.c \ - fxclip.c \ - fxcva.c \ - fxdd.c \ - fxddspan.c \ - fxddtex.c \ - fxfastpath.c \ - fxglidew.c \ - fxpipeline.c \ - fxrender.c \ - fxsanity.c \ - fxsetup.c \ - fxtexman.c \ - fxtrifuncs.c \ - fxvsetup.c - - TDFXOBJS = tdfx_xmesa.o \ - tdfx_init.o \ - tdfx_inithw.o \ - fxclip.o \ - fxcva.o \ - fxdd.o \ - fxddspan.o \ - fxddtex.o \ - fxfastpath.o \ - fxglidew.o \ - fxpipeline.o \ - fxrender.o \ - fxsanity.o \ - fxsetup.o \ - fxtexman.o \ - fxtrifuncs.o \ - fxvsetup.o + TDFXSRCS = tdfx_context.c \ + tdfx_dd.c \ + tdfx_pixels.c \ + tdfx_fastpath.c \ + tdfx_g3ext.c \ + tdfx_lock.c \ + tdfx_pipeline.c \ + tdfx_render.c \ + tdfx_screen.c \ + tdfx_span.c \ + tdfx_state.c \ + tdfx_tex.c \ + tdfx_texman.c \ + tdfx_texstate.c \ + tdfx_tris.c \ + tdfx_vb.c \ + tdfx_wrapper.c \ + tdfx_xmesa.c + + TDFXOBJS = tdfx_context.o \ + tdfx_dd.o \ + tdfx_pixels.o \ + tdfx_fastpath.o \ + tdfx_g3ext.o \ + tdfx_lock.o \ + tdfx_pipeline.o \ + tdfx_render.o \ + tdfx_screen.o \ + tdfx_span.o \ + tdfx_state.o \ + tdfx_tex.o \ + tdfx_texman.o \ + tdfx_texstate.o \ + tdfx_tris.o \ + tdfx_vb.o \ + tdfx_wrapper.o \ + tdfx_xmesa.o MESASRCS = ../../aatriangle.c \ ../../accum.c \ @@ -346,7 +348,6 @@ REQUIREDLIBS = -l$(GLIDE3LIBNAME) MathLibrary REQUIREDLIBS += -L../../../.. -lGL #endif - #if !GlxUseBuiltInDRIDriver #undef DoNormalLib NormalLibGlx #undef DoExtraLib SharedLibGlx diff --git a/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h b/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h new file mode 100644 index 000000000..83223b07c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h @@ -0,0 +1,63 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __DRI_GLIDE_H__ +#define __DRI_GLIDE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <glide.h> +#include "dri_mesaint.h" + +/* + * This is the private interface between Glide and the DRI. + */ +extern void grDRIOpen( char *pFB, char *pRegs, int deviceID, + int width, int height, + int mem, int cpp, int stride, + int fifoOffset, int fifoSize, + int fbOffset, int backOffset, int depthOffset, + int textureOffset, int textureSize, + volatile int *fifoPtr, volatile int *fifoRead ); +extern void grDRIPosition( int x, int y, int w, int h, + int numClip, XF86DRIClipRectPtr pClip ); +extern void grDRILostContext( void ); +extern void grDRIImportFifo( int fifoPtr, int fifoRead ); +extern void grDRIInvalidateAll( void ); +extern void grDRIResetSAREA( void ); +extern void grDRIBufferSwap( FxU32 swapInterval ); +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h deleted file mode 100644 index b84e3c3f2..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h +++ /dev/null @@ -1,353 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcliptmp.h,v 1.1 2000/09/24 13:51:13 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#define V1 VARS_XYZW -#define S1 DO_SETUP_XYZW -#define T1 COPY_XYZW_STRIDE -#define Z1 4 - -#if (IND & SETUP_RGBA) -#define V2 V1 VARS_RGBA -#define S2 S1 DO_SETUP_RGBA -#define T2 T1 COPY_RGBA_STRIDE -#define Z2 (Z1 + 4) -#else -#define V2 V1 -#define S2 S1 -#define T2 T1 -#define Z2 Z1 -#endif - -#if (IND & SETUP_TMU0) -#define V3 V2 VARS_TMU0 -#define S3 S2 DO_SETUP_TMU0(Z2) -#define T3 T2 COPY_TMU0_STRIDE(Z2) -#define Z3 (Z2 + 2) -#else -#define V3 V2 -#define S3 S2 -#define T3 T2 -#define Z3 Z2 -#endif - -#if (IND & SETUP_TMU1) -#define V4 V3 VARS_TMU1 -#define S4 S3 DO_SETUP_TMU1(Z3) -#define T4 T3 COPY_TMU1_STRIDE(Z3) -#define Z4 (Z3 + 2) -#else -#define V4 V3 -#define S4 S3 -#define T4 T3 -#define Z4 Z3 -#endif - -#if (Z4 & 2) -#define SIZE (Z4+2) -#define COPY_STRIDE T4 COPY_NIL(Z4) -#else -#define SIZE Z4 -#define COPY_STRIDE T4 -#endif - -#define VARS V4 -#define SETUP S4 - -#define DRAW_LINE(fxMesa, tmp0, tmp1, width) \ - if (width <= 1.0) { \ - FX_grDrawLine(fxMesa, tmp0, tmp1); \ - } \ - else { \ - GrVertex verts[4]; \ - float dx, dy, ix, iy; \ - \ - dx = tmp0->x - tmp1->x; \ - dy = tmp0->y - tmp1->y; \ - \ - if (dx * dx > dy * dy) { \ - iy = width * .5; \ - ix = 0; \ - } \ - else { \ - iy = 0; \ - ix = width * .5; \ - } \ - \ - verts[0] = *tmp0; \ - verts[1] = *tmp0; \ - verts[2] = *tmp1; \ - verts[3] = *tmp1; \ - \ - verts[0].x = tmp0->x - ix; \ - verts[0].y = tmp0->y - iy; \ - \ - verts[1].x = tmp0->x + ix; \ - verts[1].y = tmp0->y + iy; \ - \ - verts[2].x = tmp1->x + ix; \ - verts[2].y = tmp1->y + iy; \ - \ - verts[3].x = tmp1->x - ix; \ - verts[3].y = tmp1->y - iy; \ - \ - FX_grDrawPolygonVertexList(fxMesa, 4, verts); \ - } - - - -static void TAG(fx_tri_view_clip) (struct vertex_buffer * VB, - GLuint v[], GLubyte mask) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLfloat data[VB_MAX_CLIPPED_VERTS * 12]; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GrVertex *verts[VB_MAX_CLIPPED_VERTS]; - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLfloat *out = data; - GLfloat *mat = ctx->Viewport.WindowMap.m; - GLuint i, n; - GLubyte *clipmask = VB->ClipMask; - - GLuint tmu0_source = fxMesa->tmu_source[0]; - GLuint tmu1_source = fxMesa->tmu_source[1]; - GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; - GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; - - (void) fxMesa; - (void) tmu0_source; - (void) tc0_vec; - (void) tmu1_source; - (void) tc1_vec; - - for (i = 0; i < 3; i++) { - GLuint e = v[i]; - verts[i] = 0; - if (!clipmask[e]) - verts[i] = (GrVertex *) gWin[e].f; - vlist[i] = out; - COPY_STRIDE; - out += SIZE; - } - - if ((n = fx_view_clip_triangle(ctx, vlist, verts, SIZE, mask)) >= 3) { - GrVertex tmp[VB_MAX_CLIPPED_VERTS]; - GrVertex *v = tmp, *v2, *v3; - VARS; - - for (i = 0; i < n; i++) - if (!verts[i]) { - GLfloat *data = vlist[i]; - SETUP; - verts[i] = v++; - } - - v = verts[0]; - v2 = verts[1]; - v3 = verts[2]; - - for (i = 2; i < n; v2 = v3, v3 = verts[++i]) - FX_grDrawTriangle(fxMesa, v, v2, v3); - } -} - - - - - -static void TAG(fx_tri_clip_stride) (struct vertex_buffer * VB, - GLuint v[], GLuint mask) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLfloat data[VB_MAX_CLIPPED_VERTS * 12]; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GrVertex *verts[VB_MAX_CLIPPED_VERTS]; - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLfloat *out = data; - GLfloat *mat = ctx->Viewport.WindowMap.m; - GLuint i, n; - GLubyte *clipmask = VB->ClipMask; - - GLuint tmu0_source = fxMesa->tmu_source[0]; - GLuint tmu1_source = fxMesa->tmu_source[1]; - GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; - GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; - - (void) fxMesa; - (void) tmu0_source; - (void) tc0_vec; - (void) tmu1_source; - (void) tc1_vec; - - for (i = 0; i < 3; i++) { - GLuint e = v[i]; - verts[i] = 0; - if (!clipmask[e]) - verts[i] = (GrVertex *) gWin[e].f; - vlist[i] = out; - COPY_STRIDE; - out += SIZE; - } - - if (VB->ClipPtr->size < 4) { - vlist[0][3] = vlist[1][3] = vlist[2][3] = 1.0; - if (VB->ClipPtr->size == 2) - vlist[0][2] = vlist[1][2] = vlist[2][2] = 0.0; - } - - if ((n = fx_clip_triangle(ctx, vlist, verts, SIZE, mask)) >= 3) { - GrVertex tmp[VB_MAX_CLIPPED_VERTS]; - GrVertex *v = tmp, *v2, *v3; - VARS; - - for (i = 0; i < n; i++) - if (!verts[i]) { - GLfloat *data = vlist[i]; - SETUP; - verts[i] = v++; - } - - v = verts[0]; - v2 = verts[1]; - v3 = verts[2]; - - for (i = 2; i < n; v2 = v3, v3 = verts[++i]) - FX_grDrawTriangle(fxMesa, v, v2, v3); - } -} - - - -static void TAG(fx_line_clip) (struct vertex_buffer * VB, - GLuint v1, GLuint v2, GLubyte mask) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLfloat data[VB_MAX_CLIPPED_VERTS * 12]; - GLfloat *vlist[VB_MAX_CLIPPED_VERTS]; - GLfloat *out = data; - GLfloat *mat = ctx->Viewport.WindowMap.m; - GLfloat w = ctx->Line.Width * .5; - GLuint e, n; - - GLuint tmu0_source = fxMesa->tmu_source[0]; - GLuint tmu1_source = fxMesa->tmu_source[1]; - GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; - GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; - - VARS; - - (void) fxMesa; - (void) tmu0_source; - (void) tc0_vec; - (void) tmu1_source; - (void) tc1_vec; - - vlist[0] = out; - e = v1; - COPY_STRIDE; - out += SIZE; - - vlist[1] = out; - e = v2; - COPY_STRIDE; - out += SIZE; - - if (VB->ClipPtr->size < 4) { - vlist[0][3] = vlist[1][3] = 1.0; - if (VB->ClipPtr->size == 2) - vlist[0][2] = vlist[1][2] = 0.0; - } - - if ((n = fx_clip_line(ctx, vlist, SIZE, mask)) != 0) { - GrVertex gWin[2]; - GrVertex *v; - GLfloat *data; - - v = gWin; - data = vlist[0]; - SETUP; - - v++; - data = vlist[1]; - SETUP; - - DRAW_LINE(fxMesa, gWin, v, w); - } -} - - - -#undef V1 -#undef S1 -#undef C1 -#undef Z1 -#undef T1 - -#undef V2 -#undef S2 -#undef C2 -#undef Z2 -#undef T2 - -#undef V3 -#undef S3 -#undef C3 -#undef Z3 -#undef T3 - -#undef V4 -#undef S4 -#undef C4 -#undef Z4 -#undef T4 - -#undef VARS -#undef SETUP -#undef COPY -#undef COPY_STRIDE -#undef SIZE -#undef IND -#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.h b/xc/lib/GL/mesa/src/drv/tdfx/fxcva.h deleted file mode 100644 index 98ae5f075..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcva.h,v 1.1 2000/09/24 13:51:14 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#ifndef _FXCVA_H_ -#define _FXCVA_H_ - - - -extern GLboolean fxMergeAndRenderCVA(struct vertex_buffer *VB, - struct vertex_buffer *cvaVB); - -extern void fxRenderCVAElements(struct vertex_buffer *VB, - GLenum mode, GLuint * elts, GLuint n); - -extern GLboolean fxCheckCVA(GLcontext * ctx); - -extern void fxPrecalcCVA(struct vertex_buffer *VB); - -extern void fxDDCheckMergeAndRender(GLcontext * ctx, - struct gl_pipeline_stage *d); - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h deleted file mode 100644 index 20523e33e..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h +++ /dev/null @@ -1,278 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcvatmp.h,v 1.1 2000/09/24 13:51:14 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -static void TAG(cva_render_points) (struct vertex_buffer * cvaVB, - struct vertex_buffer * VB, - const struct gl_prim_state * state, - GLuint start, GLuint count) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxVertex *gWin = FX_DRIVER_DATA(cvaVB)->verts; - const GLuint *elt = VB->EltPtr->data; - GLuint i; - - VARS; - INIT; - (void) fxMesa; - - if (cvaVB->ClipOrMask) { - const GLubyte *clip = cvaVB->ClipMask; - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - if (!clip[e]) { - GLfloat *v = gWin[e].f; - (void) v; - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - DRAW_POINT; - } - } - } - else { - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[e].f; - (void) v; - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - DRAW_POINT; - } - } -} - -static void TAG(cva_render_lines) (struct vertex_buffer * cvaVB, - struct vertex_buffer * VB, - const struct gl_prim_state * state, - GLuint start, GLuint count) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxVertex *gWin = FX_DRIVER_DATA(cvaVB)->verts; - const GLuint *elt = VB->EltPtr->data; - GLuint i; - - VARS; - INIT; - (void) fxMesa; - - if (cvaVB->ClipOrMask) { - const GLubyte *clip = cvaVB->ClipMask; - GLuint prev = 0; - GLfloat *prev_v = 0; - - (void) ctx; - - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[e].f; - - MERGE_VB; - - if (!clip[e]) - MERGE_RAST; - - if (state->draw) { - if (clip[e] | clip[prev]) - CLIP_LINE; - else - DRAW_LINE; - } - - prev = e; - prev_v = v; - state = state->next; - } - if (state->finish_loop) { - GLuint e = elt[start]; - GLfloat *v = gWin[e].f; - (void) v; - - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - - if (clip[e] | clip[prev]) - CLIP_LINE; - else - DRAW_LINE; - } - } - else { - GLuint prev = 0; - GLfloat *prev_v = 0; - - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[e].f; - - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - if (state->draw) - DRAW_LINE; - prev = e; - prev_v = v; - state = state->next; - } - if (state->finish_loop) { - GLuint e = elt[start]; - GLfloat *v = gWin[e].f; - (void) v; - - if (!DIRECT) { - MERGE_VB; - } - MERGE_RAST; - DRAW_LINE; - } - } -} - - -static void TAG(cva_render_tris) (struct vertex_buffer * cvaVB, - struct vertex_buffer * VB, - const struct gl_prim_state * state, - GLuint start, GLuint count) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - fxVertex *gWin = FX_DRIVER_DATA(cvaVB)->verts; - const GLuint *elt = VB->EltPtr->data; - GLuint i; - VARS; - INIT; - (void) fxMesa; - - if (cvaVB->ClipOrMask) { - GLuint vlist[VB_MAX_CLIPPED_VERTS]; - GLuint l[3]; - const GLubyte *clip = cvaVB->ClipMask; - - (void) vlist; - - for (i = start; i < count; i++ INCR) { - GLuint e = l[2] = elt[i]; - GLfloat *v = gWin[e].f; - (void) v; - - MERGE_VB; /* needed for clip-interp */ - - if (!clip[e]) { - MERGE_RAST; - } - - if (state->draw) - CLIP_OR_DRAW_TRI; - - - l[0] = l[state->v0]; - l[1] = l[state->v1]; - state = state->next; - } - } - else if (DIRECT) { - GrVertex *vl[3]; - for (i = start; i < count; i++ INCR) { - GLuint e = elt[i]; - GLfloat *v = gWin[elt[i]].f; - - vl[2] = (GrVertex *) v; - - (void) v; - (void) e; - - MERGE_RAST; - - if (state->draw) - DRAW_TRI2; - - vl[0] = vl[state->v0]; - vl[1] = vl[state->v1]; - state = state->next; - } - } - else { - GLuint l[3]; - for (i = start; i < count; i++ INCR) { - GLuint e = l[2] = elt[i]; - GLfloat *v = gWin[e].f; - (void) v; - - MERGE_VB; /* needed for ctx->trianglefunc? */ - MERGE_RAST; - - if (state->draw) - DRAW_TRI; - - l[0] = l[state->v0]; - l[1] = l[state->v1]; - state = state->next; - } - } -} - - -static void TAG(init_cva) (void) -{ - merge_and_render_tab[DIRECT][IDX][PRIM_POINTS] = TAG(cva_render_points); - merge_and_render_tab[DIRECT][IDX][PRIM_LINES] = TAG(cva_render_lines); - merge_and_render_tab[DIRECT][IDX][PRIM_TRIS] = TAG(cva_render_tris); - merge_and_render_tab[DIRECT][IDX][PRIM_CULLED] = fxCvaRenderNoop; -} - - -#undef IDX -#undef MERGE_RAST -#undef MERGE_VB -#undef VARS -#undef INIT -#undef INCR -#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c b/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c deleted file mode 100644 index eaa2ab962..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c +++ /dev/null @@ -1,293 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.c,v 1.1 2000/09/24 13:51:16 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include "fxdrv.h" -#include "fxcva.h" -#include "fxpipeline.h" -#include "vbindirect.h" - - -/* We don't handle texcoord-4 in the safe clip routines - maybe we should. - */ -static void -fxDDRenderElements(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (fxMesa->render_index != 0 || - ((ctx->Texture.ReallyEnabled & 0xf) && VB->TexCoordPtr[0]->size > 2) - || ((ctx->Texture.ReallyEnabled & 0xf0) - && VB->TexCoordPtr[1]->size > 2) || (VB->ClipPtr->size != 4)) /* Brokes clipping otherwise */ - gl_render_elts(VB); - else - fxDDRenderElementsDirect(VB); -} - -static void -fxDDCheckRenderVBIndirect(GLcontext * ctx, struct gl_pipeline_stage *d) -{ - d->type = 0; - - if ((ctx->IndirectTriangles & DD_SW_SETUP) == 0 && - ctx->Driver.MultipassFunc == 0) { - d->type = PIPE_IMMEDIATE; - d->inputs = VERT_SETUP_FULL | VERT_ELT | VERT_PRECALC_DATA; - } -} - -static void -fxDDRenderVBIndirect(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - struct vertex_buffer *cvaVB = ctx->CVA.VB; - - if (fxMesa->render_index != 0 || ((ctx->Texture.ReallyEnabled & 0xf) - && cvaVB->TexCoordPtr[0]->size > 2) - || ((ctx->Texture.ReallyEnabled & 0xf0) - && cvaVB->TexCoordPtr[1]->size > 2) || (VB->ClipPtr->size != 4)) /* Brokes clipping otherwise */ - gl_render_vb_indirect(VB); - else - fxDDRenderVBIndirectDirect(VB); -} - - -static void -fxDDRenderVB(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if ((fxMesa->render_index != 0) || - ((ctx->Texture.ReallyEnabled & 0xf) && VB->TexCoordPtr[0]->size > 2) - || ((ctx->Texture.ReallyEnabled & 0xf0) - && VB->TexCoordPtr[1]->size > 2)) - gl_render_vb(VB); - else - fxDDDoRenderVB(VB); -} - - - - -/* This sort of driver-based reconfiguration of the pipeline could be - * used to support accelerated transformation and lighting on capable - * hardware. - * - */ -GLuint -fxDDRegisterPipelineStages(struct gl_pipeline_stage *out, - const struct gl_pipeline_stage *in, GLuint nr) -{ - GLuint i, o; - - for (i = o = 0; i < nr; i++) { - switch (in[i].ops) { - case PIPE_OP_RAST_SETUP_1 | PIPE_OP_RENDER: - out[o] = in[i]; - out[o].state_change = NEW_CLIENT_STATE; - out[o].check = fxDDCheckMergeAndRender; - out[o].run = fxDDMergeAndRender; - o++; - break; - case PIPE_OP_RAST_SETUP_0: - out[o] = in[i]; - out[o].cva_state_change = - NEW_LIGHTING | NEW_TEXTURING | NEW_RASTER_OPS; - out[o].state_change = ~0; - out[o].check = fxDDCheckPartialRasterSetup; - out[o].run = fxDDPartialRasterSetup; - o++; - break; - case PIPE_OP_RAST_SETUP_0 | PIPE_OP_RAST_SETUP_1: - out[o] = in[i]; - out[o].run = fxDDDoRasterSetup; - o++; - break; - case PIPE_OP_RENDER: - out[o] = in[i]; - if (in[i].run == gl_render_elts) { - out[o].run = fxDDRenderElements; - } - else if (in[i].run == gl_render_vb_indirect) { - out[o].check = fxDDCheckRenderVBIndirect; - out[o].run = fxDDRenderVBIndirect; - } - else if (in[i].run == gl_render_vb) { - out[o].run = fxDDRenderVB; - } - - o++; - break; - default: - out[o++] = in[i]; - break; - } - } - - return o; -} - -#define ILLEGAL_ENABLES (TEXTURE0_3D| \ - TEXTURE1_3D| \ - ENABLE_TEXMAT0 | \ - ENABLE_TEXMAT1 | \ - ENABLE_TEXGEN0 | \ - ENABLE_TEXGEN1 | \ - ENABLE_USERCLIP | \ - ENABLE_LIGHT | \ - ENABLE_FOG) - - - -/* Because this is slotted in by the OptimizePipeline function, most - * of the information here is just for gl_print_pipeline(). Only the - * run member is required. - */ -static struct gl_pipeline_stage fx_fast_stage = { - "FX combined vertex transform, setup and rasterization stage", - PIPE_OP_VERT_XFORM | PIPE_OP_RAST_SETUP_0 | PIPE_OP_RAST_SETUP_1 | - PIPE_OP_RENDER, - PIPE_PRECALC, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, /* never called */ - fxDDFastPath -}; - - - - -/* Better than optimizing the pipeline, we can do the whole build very - * quickly with the aid of a new flags member. - */ -GLboolean -fxDDBuildPrecalcPipeline(GLcontext * ctx) -{ - struct gl_pipeline *pipe = &ctx->CVA.pre; - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - - if (fxMesa->is_in_hardware && - fxMesa->render_index == 0 && - (ctx->Enabled & ILLEGAL_ENABLES) == 0 && - (ctx->Array.Flags & (VERT_OBJ_234 | - VERT_TEX0_4 | - VERT_TEX1_4 | - VERT_ELT)) == (VERT_OBJ_23 | VERT_ELT)) { - if (MESA_VERBOSE & (VERBOSE_STATE | VERBOSE_DRIVER)) - if (!fxMesa->using_fast_path) - fprintf(stderr, "fxMesa: using fast path\n"); - - pipe->stages[0] = &fx_fast_stage; - pipe->stages[1] = 0; - pipe->new_inputs = ctx->RenderFlags & VERT_DATA; - pipe->ops = pipe->stages[0]->ops; - fxMesa->using_fast_path = 1; - return 1; - } - - if (fxMesa->using_fast_path) { - if (MESA_VERBOSE & (VERBOSE_STATE | VERBOSE_DRIVER)) - fprintf(stderr, - "fxMesa: fall back to full pipeline %x %x %x %x %x\n", - fxMesa->is_in_hardware, fxMesa->render_index, - (ctx->Enabled & ILLEGAL_ENABLES), - (ctx->Array.Summary & (VERT_OBJ_23)), - (ctx->Array.Summary & (VERT_OBJ_4 | VERT_TEX0_4 | - VERT_TEX1_4))); - - fxMesa->using_fast_path = 0; - ctx->CVA.VB->ClipOrMask = 0; - ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS; - ctx->Array.NewArrayState |= ctx->Array.Summary; - return 0; - } - - return 0; -} - - - - - - -/* Perform global optimizations to the pipeline. The fx driver - * implements a single such fast path, which corresponds to the standard - * quake3 cva pipeline. - * - * This is now handled by the 'build' function above. - */ -void -fxDDOptimizePrecalcPipeline(GLcontext * ctx, struct gl_pipeline *pipe) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - - if (fxMesa->is_in_hardware && - fxMesa->render_index == 0 && - (ctx->Enabled & ILLEGAL_ENABLES) == 0 && - (ctx->Array.Summary & VERT_ELT)) { - pipe->stages[0] = &fx_fast_stage; - pipe->stages[1] = 0; - } -} - - - -/* unused? -void -fxDDOptimizeEltPipeline( GLcontext *ctx, struct gl_pipeline *pipe ) -{ - (void) ctx; - (void) pipe; -} -*/ - diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h b/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h deleted file mode 100644 index 49a98320d..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h +++ /dev/null @@ -1,16 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxpipeline.h,v 1.1 2000/09/24 13:51:16 alanh Exp $ */ -#ifndef FXPIPELINE_H -#define FXPIPELINE_H - - -extern GLuint fxDDRegisterPipelineStages(struct gl_pipeline_stage *out, - const struct gl_pipeline_stage *in, - GLuint nr); - -extern GLboolean fxDDBuildPrecalcPipeline(GLcontext * ctx); - -extern void fxDDOptimizePrecalcPipeline(GLcontext * ctx, - struct gl_pipeline *pipe); - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxrender.c b/xc/lib/GL/mesa/src/drv/tdfx/fxrender.c deleted file mode 100644 index 2ec5fa4b3..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxrender.c +++ /dev/null @@ -1,780 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxrender.c,v 1.2 2000/11/13 23:31:32 dawes Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxrender.c - 3Dfx VooDoo RenderVB driver function support */ - -#include "fxdrv.h" -#include "vbcull.h" -#include "fxsetup.h" - - - -/* - * Render a line segment from VB[v1] to VB[v2] when either one or both - * endpoints must be clipped. - */ -#if !defined(__MWERKS__) -INLINE -#endif - void -fxRenderClippedLine(struct vertex_buffer *VB, GLuint v1, GLuint v2) -{ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLubyte mask = VB->ClipMask[v1] | VB->ClipMask[v2]; - - if (!mask || (VB->ctx->line_clip_tab[VB->ClipPtr->size]) (VB, &v1, &v2, - mask)) - FX_grDrawLine(fxMesa, (GrVertex *) gWin[v1].f, (GrVertex *) gWin[v2].f); -} - - - - -/* This is legal for Quads as well as triangles, hence the 'n' parameter. - */ -INLINE void -fxRenderClippedTriangle(struct vertex_buffer *VB, GLuint n, GLuint vlist[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - GLubyte mask = 0; - GLuint i; - - for (i = 0; i < n; i++) - mask |= VB->ClipMask[vlist[i]]; - - if (mask & CLIP_USER_BIT) { - GLubyte *userclipmask = VB->UserClipMask; - if (userclipmask[vlist[0]] & userclipmask[vlist[1]] & - userclipmask[vlist[2]]) - return; - } - - n = (VB->ctx->poly_clip_tab[VB->ClipPtr->size]) (VB, n, vlist, mask); - if (n >= 3) { - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GrVertex *i0 = (GrVertex *) gWin[vlist[0]].f; - GrVertex *i1 = (GrVertex *) gWin[vlist[1]].f; - GrVertex *i2 = (GrVertex *) gWin[vlist[2]].f; - GLuint i; - - for (i = 2; i < n; i++, i1 = i2, i2 = (GrVertex *) gWin[vlist[i]].f) { - FX_grDrawTriangle(fxMesa, i0, i1, i2); - } - } -} - - - - - -static INLINE void -fxSafeClippedLine(struct vertex_buffer *VB, GLuint v1, GLuint v2) -{ - GLubyte mask = VB->ClipMask[v1] | VB->ClipMask[v2]; - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - - if (!mask) { - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - FX_grDrawLine(fxMesa, (GrVertex *) gWin[v1].f, (GrVertex *) gWin[v2].f); - } - else { - fxMesaContext fxMesa = (fxMesaContext) VB->ctx->DriverCtx; - fxLineClipTab[fxMesa->setupindex & 0x7] (VB, v1, v2, mask); - } -} - - -static INLINE void -fxSafeClippedTriangle(struct vertex_buffer *VB, - fxVertex * gWin, - tfxTriClipFunc cliptri, GLuint v2, GLuint v1, GLuint v) -{ - GLubyte *clipmask = VB->ClipMask; - GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v]; - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - - if (!mask) { - FX_grDrawTriangle(fxMesa, (GrVertex *) gWin[v2].f, - (GrVertex *) gWin[v1].f, (GrVertex *) gWin[v].f); - return; - } - - if (!(clipmask[v2] & clipmask[v1] & clipmask[v] & CLIP_ALL_BITS)) { - GLuint vl[3]; - GLuint imask = mask; - - if (imask & CLIP_USER_BIT) { - GLubyte *userclipmask = VB->UserClipMask; - if (userclipmask[v2] & userclipmask[v1] & userclipmask[v]) - return; - imask |= - (userclipmask[v2] | userclipmask[v1] | userclipmask[v]) << 8; - } - - ASSIGN_3V(vl, v2, v1, v); - cliptri(VB, vl, imask); - } -} - - -static INLINE void -fxSafeClippedTriangle2(struct vertex_buffer *VB, - fxVertex * gWin, - tfxTriViewClipFunc cliptri, - GLuint v2, GLuint v1, GLuint v) -{ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - GLubyte *clipmask = VB->ClipMask; - GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v]; - - if (!mask) { - FX_grDrawTriangle(fxMesa, - (GrVertex *) gWin[v2].f, (GrVertex *) gWin[v1].f, - (GrVertex *) gWin[v].f); - } - else if (!(clipmask[v2] & clipmask[v1] & clipmask[v])) { - GLuint vl[3]; - ASSIGN_3V(vl, v2, v1, v); - cliptri(VB, vl, mask); - } -} - - -static INLINE void -fxSafeClippedTriangle3(struct vertex_buffer *VB, - fxVertex * gWin, - tfxTriClipFunc cliptri, GLuint v2, GLuint v1, GLuint v) -{ - GLubyte *clipmask = VB->ClipMask; - GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v]; - GLuint imask = mask; - - if (imask & CLIP_USER_BIT) { - GLubyte *userclipmask = VB->UserClipMask; - if (userclipmask[v2] & userclipmask[v1] & userclipmask[v]) - return; - imask |= (userclipmask[v2] | userclipmask[v1] | userclipmask[v]) << 8; - } - - { - GLuint vl[3]; - ASSIGN_3V(vl, v2, v1, v); - cliptri(VB, vl, imask); - } -} - - - - - -/************************************************************************/ -/************************ RenderVB functions ****************************/ -/************************************************************************/ - - -/* Render front-facing, non-clipped primitives. - */ - -#define RENDER_POINTS( start, count ) \ - (void) gWin; \ - (void) VB; \ - (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count ) - -#define RENDER_LINE( i1, i ) \ - do { \ - RVB_COLOR(i); \ - FX_grDrawLine(fxMesa, (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity ) \ - do { \ - RVB_COLOR(pv); \ - if (parity) { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i].f); \ - } else { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv ) \ - do { \ - RVB_COLOR(pv); \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i3].f, \ - (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i].f); \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } while (0) - - - -#define LOCAL_VARS \ - fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - (void) fxMesa; - -#define INIT(x) - -#define TAG(x) x##_fx_flat_raw -#undef RVB_COLOR -#define RVB_COLOR(pv) FX_VB_COLOR(fxMesa, VB->ColorPtr->data[pv]) -#define PRESERVE_VB_DEFS - -#include "render_tmp.h" - -#define TAG(x) x##_fx_smooth_raw -#undef RVB_COLOR -#define RVB_COLOR(x) - -#include "render_tmp.h" - - - -/* Render with clipped and/or culled primitives with cullmask information. - */ -#define RENDER_POINTS( start, count ) \ - (void) gWin; \ - (void) cullmask; \ - (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count ) - - -#define RENDER_LINE( i1, i ) \ - do { \ - const GLubyte flags = cullmask[i]; \ - \ - if (!(flags & PRIM_NOT_CULLED)) \ - continue; \ - \ - RVB_COLOR(i); \ - if (flags & PRIM_ANY_CLIP) \ - fxRenderClippedLine( VB, i1, i ); \ - else \ - FX_grDrawLine( fxMesa, (GrVertex *)gWin[i1].f, (GrVertex *)gWin[i].f ); \ - } while (0) - - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - const GLubyte flags = cullmask[i]; \ - GLuint e2,e1; \ - \ - if (!(flags & PRIM_NOT_CULLED)) \ - continue; \ - \ - e2=i2, e1=i1; \ - if (parity) { e2=i1; e1=i2; } \ - \ - RVB_COLOR(pv); \ - if (flags & PRIM_ANY_CLIP) { \ - fxSafeClippedTriangle3(VB,gWin,cliptri,e2,e1,i); \ - } else { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e1].f, \ - (GrVertex *)gWin[i].f); \ - } \ - } while (0) - - -#define RENDER_QUAD(i3, i2, i1, i, pv) \ - do { \ - const GLubyte flags = cullmask[i]; \ - \ - if (!(flags & PRIM_NOT_CULLED)) \ - continue; \ - \ - RVB_COLOR(pv); \ - if (flags&PRIM_ANY_CLIP) { \ - fxSafeClippedTriangle3(VB,gWin,cliptri,i3,i2,i); \ - fxSafeClippedTriangle3(VB,gWin,cliptri,i2,i1,i); \ - } else { \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i3].f, \ - (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i].f); \ - FX_grDrawTriangle(fxMesa, (GrVertex *)gWin[i2].f, \ - (GrVertex *)gWin[i1].f, \ - (GrVertex *)gWin[i].f); \ - } \ - } while (0) - - - - - -#define LOCAL_VARS \ - fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - const GLubyte *cullmask = VB->CullMask; \ - tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - - - - -#define INIT(x) (void) cliptri; (void) fxMesa; - -#define TAG(x) x##_fx_smooth_culled -#undef RVB_COLOR -#define RVB_COLOR(x) -#define PRESERVE_VB_DEFS -#include "render_tmp.h" - -#define TAG(x) x##_fx_flat_culled -#undef RVB_COLOR -#define RVB_COLOR(pv) FX_VB_COLOR(fxMesa, VB->ColorPtr->data[pv]) - -#include "render_tmp.h" - - - - -/* Direct, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - GLubyte *clipmask = VB->ClipMask; \ - GLuint i; \ - for (i = start ; i < count ; i++) \ - if (clipmask[i] == 0) { \ - RVB_COLOR(i); \ - FX_grDrawPoint( fxMesa, (GrVertex *)gWin[i].f );\ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - RVB_COLOR(i); \ - fxSafeClippedLine( VB, i1, i ); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2=i2, e1=i1; \ - if (parity) { GLuint t=e2; e2=e1; e1=t; } \ - RVB_COLOR(pv); \ - fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,i); \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - RVB_COLOR(pv); \ - fxSafeClippedTriangle(VB,gWin,cliptri,i3,i2,i); \ - fxSafeClippedTriangle(VB,gWin,cliptri,i2,i1,i); \ - } while (0) - -#define LOCAL_VARS \ - fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define INIT(x) (void) cliptri; (void) gWin; - -#define TAG(x) x##_fx_smooth_clipped -#undef RVB_COLOR -#define RVB_COLOR(x) -#define PRESERVE_VB_DEFS -#include "render_tmp.h" - - -#define TAG(x) x##_fx_flat_clipped -#undef RVB_COLOR -#define RVB_COLOR(pv) FX_VB_COLOR(fxMesa, VB->ColorPtr->data[pv]) -#include "render_tmp.h" - - - - - - -/* Indirect, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - GLuint e; \ - GLubyte *clipmask = VB->ClipMask; \ - for(e=start;e<count;e++) \ - if(clipmask[elt[e]]==0) { \ - FX_grDrawPoint(fxMesa, (GrVertex *)gWin[elt[e]].f); \ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - GLuint e1 = elt[i1], e = elt[i]; \ - RVB_COLOR(e); \ - fxSafeClippedLine( VB, e1, e ); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - if (parity) { GLuint t=e2; e2=e1; e1=t; } \ - fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ - fxSafeClippedTriangle(VB,gWin,cliptri,e3,e2,e); \ - fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \ - fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define INIT(x) (void) cliptri; (void) gWin; - -#define TAG(x) x##_fx_smooth_indirect_clipped -#undef RVB_COLOR -#define RVB_COLOR(x) -#include "render_tmp.h" - - -/* Indirect, clipped, but no user clip. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - GLuint e; \ - GLubyte *clipmask = VB->ClipMask; \ - for(e=start;e<count;e++) \ - if(clipmask[elt[e]]==0) { \ - FX_grDrawPoint(fxMesa, (GrVertex *)gWin[elt[e]].f); \ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - GLuint e1 = elt[i1], e = elt[i]; \ - RVB_COLOR(e); \ - fxSafeClippedLine( VB, e1, e ); \ - } while (0) - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - if (parity) { GLuint t=e2; e2=e1; e1=t; } \ - fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ - fxSafeClippedTriangle2(VB,gWin,cliptri,e3,e2,e); \ - fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \ - } while (0) - -#define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \ - fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - tfxTriViewClipFunc cliptri = fxMesa->view_clip_tri; - -#define INIT(x) (void) cliptri; (void) gWin; - -#define TAG(x) x##_fx_smooth_indirect_view_clipped -#undef RVB_COLOR -#define RVB_COLOR(x) -#include "render_tmp.h" - - - - - - - -/* Indirect, and no clipping required. - */ -#define RENDER_POINTS( start, count ) \ - do { \ - GLuint e; \ - for(e=start;e<count;e++) { \ - FX_grDrawPoint_NoLock((GrVertex *)gWin[elt[e]].f);\ - } \ - } while (0) - -#define RENDER_LINE( i1, i ) \ - do { \ - GLuint e1 = elt[i1], e = elt[i]; \ - FX_grDrawLine_NoLock((GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f);\ - } while (0) - - -#define RENDER_TRI( i2, i1, i, pv, parity) \ - do { \ - GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ - if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \ - FX_grDrawTriangle_NoLock((GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e1].f, \ - (GrVertex *)gWin[e].f); \ - } while (0) - - -#define RENDER_QUAD( i3, i2, i1, i, pv) \ - do { \ - GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ - FX_grDrawTriangle_NoLock((GrVertex *)gWin[e3].f, \ - (GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e].f); \ - FX_grDrawTriangle_NoLock((GrVertex *)gWin[e2].f, \ - (GrVertex *)gWin[e1].f, \ - (GrVertex *)gWin[e].f); \ - } while (0) - -#define LOCAL_VARS \ - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ - const GLuint *elt = VB->EltPtr->data; \ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - -#define INIT(x) BEGIN_CLIP_LOOP(fxMesa); -#define POSTFIX END_CLIP_LOOP(fxMesa); - -#define TAG(x) x##_fx_smooth_indirect -#undef RVB_COLOR -#define RVB_COLOR(x) -#include "render_tmp.h" - - - - - -/* Direct in this context means that triangles, lines, points can be - * rendered simply by calling grDrawTriangle, etc., without any - * additional setup (such as calling grConstantColor). We also use a - * 'safe' set of clipping routines which don't require write-access to - * the arrays in the vertex buffer, and don't care about array - * stride. - * - * Thus there is no call to gl_import_arrays() in this function. - * - * This safe clipping should be generalized to call driver->trianglefunc - * under the appropriate conditions. - * - * We don't handle texcoord-4 in the safe clip routines - maybe we should. - * - */ -void -fxDDRenderElementsDirect(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - struct vertex_buffer *saved_vb = ctx->VB; - GLenum prim = ctx->CVA.elt_mode; - GLuint nr = VB->EltPtr->count; - render_func func = render_tab_fx_smooth_indirect[prim]; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint p = 0; - - if (!nr) - return; - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - if (!nr) - return; - - if (VB->ClipOrMask) { - func = render_tab_fx_smooth_indirect_view_clipped[prim]; - if (VB->ClipOrMask & CLIP_USER_BIT) - func = render_tab_fx_smooth_indirect_clipped[prim]; - } - - ctx->VB = VB; /* kludge */ - - do { - func(VB, 0, nr, 0); - } while (ctx->Driver.MultipassFunc && ctx->Driver.MultipassFunc(VB, ++p)); - - - ctx->VB = saved_vb; -} - - -void -fxDDRenderVBIndirectDirect(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - struct vertex_buffer *cvaVB = ctx->CVA.VB; - struct vertex_buffer *saved_vb = ctx->VB; - GLuint i, next, count = VB->Count; - render_func *tab = render_tab_fx_smooth_indirect; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint p = 0; - - if (cvaVB->ClipOrMask) - tab = render_tab_fx_smooth_indirect_clipped; - - if (!VB->CullDone) - gl_fast_copy_vb(VB); - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - ctx->VB = cvaVB; - cvaVB->EltPtr = VB->EltPtr; - - do { - GLuint parity = VB->Parity; - - for (i = VB->CopyStart; i < count; parity = 0, i = next) { - GLuint prim = VB->Primitive[i]; - next = VB->NextPrimitive[i]; - tab[prim] (cvaVB, i, next, parity); - } - /* loop never taken */ - } while (ctx->Driver.MultipassFunc && - ctx->Driver.MultipassFunc(cvaVB, ++p)); - - cvaVB->EltPtr = 0; - ctx->VB = saved_vb; -} - - -static render_func *fxDDRenderVBSmooth_tables[3] = { - render_tab_fx_smooth_clipped, - render_tab_fx_smooth_culled, - render_tab_fx_smooth_raw -}; - -static render_func *fxDDRenderVBFlat_tables[3] = { - render_tab_fx_flat_clipped, - render_tab_fx_flat_culled, - render_tab_fx_flat_raw -}; - - -static render_func *null_tables[3] = { - 0, - 0, - 0 -}; - -#if defined(FX_GLIDE3) -#include "fxstripdet.c" -#endif - -void -fxDDRenderInit(GLcontext * ctx) -{ - render_init_fx_smooth_indirect_view_clipped(); - render_init_fx_smooth_indirect_clipped(); - render_init_fx_smooth_indirect(); - render_init_fx_smooth_raw(); - render_init_fx_smooth_culled(); - render_init_fx_smooth_clipped(); - render_init_fx_flat_raw(); - render_init_fx_flat_culled(); - render_init_fx_flat_clipped(); -#if defined(FX_GLIDE3) - fxDDRenderInitGlide3(ctx); -#endif -} - - -/* Now used to set an internal var in fxMesa - we hook out at the - * level of gl_render_vb() instead. - */ -render_func ** -fxDDChooseRenderVBTables(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (ctx->IndirectTriangles & DD_SW_SETUP) - return null_tables; - - switch (fxMesa->render_index) { -/* case FX_FLAT: */ -/* return fxDDRenderVBFlat_tables; */ - case 0: - return fxDDRenderVBSmooth_tables; - default: - return null_tables; - } -} - - -void -fxDDDoRenderVB(struct vertex_buffer *VB) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint i, next, prim; - GLuint parity = VB->Parity; - render_func *tab; - GLuint count = VB->Count; - GLint p = 0; - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - if (VB->Indirect) { - return; - } - else if (VB->CullMode & CLIP_MASK_ACTIVE) { - tab = fxMesa->RenderVBClippedTab; - } - else { - tab = fxMesa->RenderVBRawTab; - } - - if (!VB->CullDone) - gl_fast_copy_vb(VB); - - do { - for (i = VB->CopyStart; i < count; parity = 0, i = next) { - prim = VB->Primitive[i]; - next = VB->NextPrimitive[i]; - tab[prim] (VB, i, next, parity); - } - - } while (ctx->Driver.MultipassFunc && ctx->Driver.MultipassFunc(VB, ++p)); -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h deleted file mode 100644 index 95794538c..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h +++ /dev/null @@ -1,154 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsdettmp.h,v 1.1 2000/09/24 13:51:19 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* - * Notes: the folowing code works only if count is > start. - * Corrently we are looking for the pattern: - * v0,v1,v2 v2,v1,v3, v2,v3,v4.... - * - * For this: - * #define STRIP0 ((u1 == v1) && (u2 == v0)) - * #define STRIP1 ((u0 == v0) && (u2 == v1)) - * - */ - - -static void TAG(render_vb_triangles_smooth_indirect_sd) - (struct vertex_buffer * VB, GLuint start, GLuint count, GLuint parity) -{ - GLint u0, u1, u2; - GLint v0, v1, v2; - GLuint *elt = VB->EltPtr->data; - - int i; - LOCAL_VARS INIT(GL_TRIANGLES); - - elt = &elt[start - 1]; - u0 = *(++elt); - u1 = *(++elt); - u2 = *(++elt); - i = start + 3; - while (i < count) { - v0 = *(++elt); - v1 = *(++elt); - v2 = *(++elt); - - if (CLIPPED(u0, u1, u2)) { - if (!CULLED(u0, u1, u2)) - SENDCLIPTRI(u0, u1, u2); - } - else { - if (STRIP0(u, v)) { - int is_strips = 1; - int parity = 0; - STRIPSLOCAL_VAR FLUSHTRI(); - STARTSTRIPS(u0, u1, u2); - while (is_strips && i < count) { - SENDSTRIPS(v2); - - u0 = v0; - u1 = v1; - u2 = v2; - i += 3; - v0 = *(++elt); - v1 = *(++elt); - v2 = *(++elt); - - if (parity) { - is_strips = STRIP0(u, v); - parity = 0; - } - else { - is_strips = STRIP1(u, v); - parity = 1; - } - } - FLUSHSTRIPS(); - - if (i >= count) - return; - } - else { - SENDTRI(u0, u1, u2); - } - } - u0 = v0; - u1 = v1; - u2 = v2; - i += 3; - } - if (CLIPPED(u0, u1, u2)) { - if (!CULLED(u0, u1, u2)) - SENDCLIPTRI(u0, u1, u2); - } - else { - SENDTRI(u0, u1, u2); - } - FLUSHTRI(); - -} - -#ifndef PRESERVE_VB_DEFS -#undef SENDTRI -#undef STRIP0 -#undef STRIP1 -#undef LOCAL_VARS -#undef STRIPSLOCAL_VAR -#undef INIT -#undef SENDTRI -#undef FLUSHTRI -#undef STARTSTRIPS -#undef SENDSTRIPS -#undef FLUSHSTRIPS -#undef CLIPPED -#undef CULLED -#undef SENDCLIPTRI -#endif - -#ifndef PRESERVE_TAG -#undef TAG -#endif - -#undef PRESERVE_VB_DEFS -#undef PRESERVE_TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c b/xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c deleted file mode 100644 index 98e62b1ff..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c +++ /dev/null @@ -1,161 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxstripdet.c,v 1.1 2000/09/24 13:51:19 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#include "fxdrv.h" -#include "vbcull.h" - - -#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) -#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) - -#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ - GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b;\ - fxMesaContext fxMesa = FX_CONTEXT(VB->ctx); - - -#define STRIPSLOCAL_VAR int sc = 0; - -#define INIT(a) - -#define SENDTRI(u0,u1,u2) FX_grDrawTriangle(fxMesa, (GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) -#define FLUSHTRI() /* No-Op */ -#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } -#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } -#define FLUSHSTRIPS() FX_grDrawVertexArray(fxMesa, GR_TRIANGLE_STRIP,sc,sb) - -#define CLIPPED(a,b,c) 0 -#define CULLED(a,b,c) 0 -#define SENDCLIPTRI(a,b,c) /* NoOp */ - -#define TAG(x) x##_fx - -#include "fxsdettmp.h" - - -/* Clipped but no userclip */ -#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2] -#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2] - -#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ - GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ - const GLubyte *const clipmask = VB->ClipMask; \ - const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define STRIPSLOCAL_VAR int sc = 0; - -#define INIT(a) - -#define SENDTRI(u0,u1,u2) FX_grDrawTriangle(fxMesa, (GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) -#define FLUSHTRI() /* No-Op */ -#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } -#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } -#define FLUSHSTRIPS() FX_grDrawVertexArray(fxMesa, GR_TRIANGLE_STRIP,sc,sb) - -#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) -#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2]) -#define SENDCLIPTRI(u0,u1,u2) { \ - GLuint vl[3]; \ - ASSIGN_3V(vl, u0, u1, u2 ); \ - cliptri(VB,vl,clipmask[u0] | clipmask[u1] | clipmask[u2]); \ - } - -#define TAG(x) x##_fx_view_clipped - -#include "fxsdettmp.h" - -/* Clipped and might be userclip */ -#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2] -#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2] - -#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ - GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ - const GLubyte *const clipmask = VB->ClipMask; \ - const GLubyte *userclipmask = VB->UserClipMask; \ - const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ - const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; - -#define STRIPSLOCAL_VAR int sc = 0; - -#define INIT(a) - -#define SENDTRI(u0,u1,u2) FX_grDrawTriangle(fxMesa, (GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) -#define FLUSHTRI() /* No-Op */ -#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } -#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } -#define FLUSHSTRIPS() FX_grDrawVertexArray(fxMesa, GR_TRIANGLE_STRIP,sc,sb) - -#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) -#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2] & CLIP_ALL_BITS) -#define SENDCLIPTRI(u0,u1,u2) { \ - GLuint vl[3]; \ - GLuint imask = (clipmask[u0] | clipmask[u1] | clipmask[u2]); \ - \ - if (imask & CLIP_USER_BIT) { \ - if (!(userclipmask[u2] & userclipmask[u1] & userclipmask[u0])) \ - { ASSIGN_3V(vl, u2, u1, u0 ); \ - imask |= (userclipmask[u2] | userclipmask[u1] | userclipmask[u0]) << 8; \ - cliptri( VB, vl, imask );} \ - } \ - else { ASSIGN_3V(vl, u2, u1, u0 ); \ - cliptri( VB, vl, imask ); } \ - } - -#define TAG(x) x##_fx_clipped - -#include "fxsdettmp.h" - - -void -fxDDRenderInitGlide3(GLcontext * ctx) -{ -#if 0 - render_tab_fx_smooth_indirect[GL_TRIANGLES] = - render_vb_triangles_smooth_indirect_sd_fx; - render_tab_fx_smooth_indirect_view_clipped[GL_TRIANGLES] = - render_vb_triangles_smooth_indirect_sd_fx_view_clipped; - render_tab_fx_smooth_indirect_clipped[GL_TRIANGLES] = - render_vb_triangles_smooth_indirect_sd_fx_clipped; -#endif -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c b/xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c deleted file mode 100644 index 0980a7ad7..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c +++ /dev/null @@ -1,365 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtrifuncs.c,v 1.1 2000/09/24 13:51:20 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -/* fxtris.c - 3Dfx VooDoo triangle functions */ - - -#include "fxdrv.h" -#include "../mmath.h" - - - -/* Is this enough? Do we need more triangle funcs? - */ -static triangle_func tri_tab[0x40]; /* only 0x20 actually used */ -static quad_func quad_tab[0x40]; /* only 0x20 actually used */ -static line_func line_tab[0x40]; /* less than 0x20 used */ -static points_func points_tab[0x40]; /* less than 0x20 used */ - -#define IND (0) -#define TAG(x) x -#include "fxtritmp.h" - -#define IND (FX_OFFSET) -#define TAG(x) x##_offset -#include "fxtritmp.h" - -#define IND (FX_TWOSIDE) -#define TAG(x) x##_twoside -#include "fxtritmp.h" - -#define IND (FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK) -#define TAG(x) x##_front_back -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_front_back_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT) -#define TAG(x) x##_flat -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_OFFSET) -#define TAG(x) x##_flat_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_TWOSIDE) -#define TAG(x) x##_flat_twoside -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_flat_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK) -#define TAG(x) x##_flat_front_back -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_flat_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_flat_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_flat_front_back_twoside_offset -#include "fxtritmp.h" - -/* We don't actually do antialiasing correctly. Geometry has to be - sorted for glide's antialiasing to operate */ -#if 0 -#define IND (FX_ANTIALIAS) -#define TAG(x) x##_aa -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_OFFSET) -#define TAG(x) x##_aa_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_TWOSIDE) -#define TAG(x) x##_aa_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK) -#define TAG(x) x##_aa_front_back -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_aa_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_aa_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_front_back_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT) -#define TAG(x) x##_aa_flat -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_OFFSET) -#define TAG(x) x##_aa_flat_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_TWOSIDE) -#define TAG(x) x##_aa_flat_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_flat_twoside_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK) -#define TAG(x) x##_aa_flat_front_back -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK|FX_OFFSET) -#define TAG(x) x##_aa_flat_front_back_offset -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE) -#define TAG(x) x##_aa_flat_front_back_twoside -#include "fxtritmp.h" - -#define IND (FX_ANTIALIAS|FX_FLAT|FX_FRONT_BACK|FX_TWOSIDE|FX_OFFSET) -#define TAG(x) x##_aa_flat_front_back_twoside_offset -#include "fxtritmp.h" -#endif - -void -fxDDTrifuncInit() -{ - init(); - init_offset(); - init_twoside(); - init_twoside_offset(); - init_front_back(); - init_front_back_offset(); - init_front_back_twoside(); - init_front_back_twoside_offset(); - init_flat(); - init_flat_offset(); - init_flat_twoside(); - init_flat_twoside_offset(); - init_flat_front_back(); - init_flat_front_back_offset(); - init_flat_front_back_twoside(); - init_flat_front_back_twoside_offset(); -#if 0 - init_aa(); - init_aa_offset(); - init_aa_twoside(); - init_aa_twoside_offset(); - init_aa_front_back(); - init_aa_front_back_offset(); - init_aa_front_back_twoside(); - init_aa_front_back_twoside_offset(); - init_aa_flat(); - init_aa_flat_offset(); - init_aa_flat_twoside(); - init_aa_flat_twoside_offset(); - init_aa_flat_front_back(); - init_aa_flat_front_back_offset(); - init_aa_flat_front_back_twoside(); - init_aa_flat_front_back_twoside_offset(); -#endif -} - -void -fxPrintRenderState(const char *msg, GLuint state) -{ - fprintf(stderr, "%s: (%x) %s%s%s%s%s%s\n", - msg, state, - (state & FX_ANTIALIAS) ? "antialias, " : "", - (state & FX_FLAT) ? "flat, " : "", - (state & FX_TWOSIDE) ? "twoside, " : "", - (state & FX_OFFSET) ? "offset, " : "", - (state & FX_FRONT_BACK) ? "front-back, " : "", - (state & FX_FALLBACK) ? "fallback" : ""); -} - - -void -fxPrintHintState(const char *msg, GLuint state) -{ - fprintf(stderr, "%s: (%x) %s %s%s %s%s\n", - msg, state, - (state & GR_STWHINT_W_DIFF_FBI) ? "w-fbi, " : "", - (state & GR_STWHINT_W_DIFF_TMU0) ? "w-tmu0, " : "", - (state & GR_STWHINT_ST_DIFF_TMU0) ? "st-tmu0, " : "", - (state & GR_STWHINT_W_DIFF_TMU1) ? "w-tmu1, " : "", - (state & GR_STWHINT_ST_DIFF_TMU1) ? "st-tmu1, " : ""); - -} - - -void -fxDDChooseRenderState(GLcontext * ctx) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - GLuint ind = 0; - GLuint flags = ctx->TriangleCaps; - - ctx->IndirectTriangles &= ~DD_SW_RASTERIZE; - - if (flags) { - if (fxMesa->render_index & FX_OFFSET) - FX_grDepthBiasLevel(fxMesa, 0); - - if (flags & (DD_SELECT | DD_FEEDBACK)) { - fxMesa->PointsFunc = 0; - fxMesa->LineFunc = 0; - fxMesa->TriangleFunc = 0; - fxMesa->QuadFunc = 0; - fxMesa->render_index = FX_FALLBACK; - ctx->IndirectTriangles |= DD_SW_RASTERIZE; -#if 0 - fprintf(stderr, "Fallback select|feeback\n"); -#endif - return; - } - - if (flags & DD_FLATSHADE) - ind |= FX_FLAT; - if (flags & DD_TRI_LIGHT_TWOSIDE) - ind |= FX_TWOSIDE; -#if 000 - /* XXX this is rather broken, don't use it. */ - if (flags & DD_MULTIDRAW) - ind |= FX_FRONT_BACK; -#else - if (flags & DD_MULTIDRAW) - ctx->IndirectTriangles |= DD_SW_RASTERIZE; -#endif - - if (flags & (DD_POINT_ATTEN | DD_POINT_SMOOTH)) { - ind |= FX_FALLBACK; -#if 0 - if (flags & DD_POINT_ATTEN) - fprintf(stderr, "Fallback point atten\n"); - if (flags & DD_POINT_SMOOTH) - fprintf(stderr, "Fallback point smooth\n"); -#endif - } - - fxMesa->render_index = ind; - fxMesa->PointsFunc = points_tab[ind]; - if (ind & FX_FALLBACK) - ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE; - ind &= ~(FX_ANTIALIAS | FX_FALLBACK); - - if (flags & (DD_LINE_STIPPLE | DD_LINE_SMOOTH)) { - ind |= FX_FALLBACK; -#if 0 - if (flags & DD_LINE_STIPPLE) - fprintf(stderr, "Fallback line stipple\n"); - if (flags & DD_LINE_SMOOTH) - fprintf(stderr, "Fallback line smooth\n"); -#endif - } - - fxMesa->render_index |= ind; - fxMesa->LineFunc = line_tab[ind]; - if (ind & FX_FALLBACK) - ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE; - ind &= ~(FX_ANTIALIAS | FX_FALLBACK); - - if (flags & DD_TRI_OFFSET) - ind |= FX_OFFSET; - if (flags & (DD_TRI_UNFILLED | DD_TRI_STIPPLE | DD_TRI_SMOOTH)) { - ind |= FX_FALLBACK; -#if 0 - if (flags & DD_TRI_UNFILLED) - fprintf(stderr, "Fallback tri unfilled\n"); - if (flags & DD_TRI_STIPPLE) - fprintf(stderr, "Fallback tri stippled\n"); - if (flags & DD_TRI_SMOOTH) - fprintf(stderr, "Fallback tri smooth\n"); -#endif - } - - fxMesa->render_index |= ind; - fxMesa->TriangleFunc = tri_tab[ind]; - fxMesa->QuadFunc = quad_tab[ind]; - - if (ind & FX_FALLBACK) - ctx->IndirectTriangles |= - DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE; - } - else if (fxMesa->render_index) { - if (fxMesa->render_index & FX_OFFSET) - FX_grDepthBiasLevel(fxMesa, 0); - - fxMesa->render_index = 0; - fxMesa->PointsFunc = points_tab[0]; - fxMesa->LineFunc = line_tab[0]; - fxMesa->TriangleFunc = tri_tab[0]; - fxMesa->QuadFunc = quad_tab[0]; - } - - if (MESA_VERBOSE & (VERBOSE_STATE | VERBOSE_DRIVER)) - fxPrintRenderState("fxmesa: Render state", fxMesa->render_index); -} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h deleted file mode 100644 index bc7621aa1..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h +++ /dev/null @@ -1,215 +0,0 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvs_tmp.h,v 1.1 2000/09/24 13:51:20 alanh Exp $ */ -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * 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 - * BRIAN PAUL 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. - * - * - * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the - * terms stated above. - * - * Thank you for your contribution, David! - * - * Please make note of the above copyright/license statement. If you - * contributed code or bug fixes to this code under the previous (GNU - * Library) license and object to the new license, your code will be - * removed at your request. Please see the Mesa docs/COPYRIGHT file - * for more information. - * - * Additional Mesa/3Dfx driver developers: - * Daryll Strauss <daryll@precisioninsight.com> - * Keith Whitwell <keith@precisioninsight.com> - * - * See fxapi.h for more revision/author details. - */ - - -#if (IND & (SETUP_XY|SETUP_W|SETUP_Z)) -#define V1 VARS_XY -#define I1 , INCR_XY -#else -#define V1 -#define I1 -#endif - -#if (IND & SETUP_XY) -#define S1 DO_SETUP_XY -#else -#define S1 -#endif - -#if (IND & SETUP_W) -#define S2 S1 DO_SETUP_W -#define V2 V1 VARS_W -#else -#define S2 S1 -#define V2 V1 -#endif - -#if (IND & SETUP_Z) -#define S3 S2 DO_SETUP_Z -#else -#define S3 S2 -#endif - -#if (IND & SETUP_RGBA) -#define V4 V2 VARS_RGBA -#define S4 S3 DO_SETUP_RGBA -#define I4 I1 , INCR_RGBA -#else -#define V4 V2 -#define S4 S3 -#define I4 I1 -#endif - -#if (IND & SETUP_TMU0) -#define V5 V4 VARS_TMU0 -#define S5 S4 DO_SETUP_TMU0 -#define I5 I4 , INCR_TMU0 -#define F5 FIXUP_TMU0 -#else -#define V5 V4 -#define S5 S4 -#define I5 I4 -#define F5 -#endif - -#if (IND & SETUP_TMU1) -#define V6 V5 VARS_TMU1 -#define S6 S5 DO_SETUP_TMU1 -#define I6 I5 , INCR_TMU1 -#define F6 F5 FIXUP_TMU1 -#else -#define V6 V5 -#define S6 S5 -#define I6 I5 -#define F6 F5 -#endif - -#if (IND & SETUP_TMU0) && (IND & SETUP_TMU1) -#define F7 FIXUP_TMU01 -#else -#define F7 F6 -#endif - -#define VARS V6 -#define DO_SETUP S6 -#define INCR I6 -#define FIXUP F7 - -static void -NAME(struct vertex_buffer *VB, GLuint start, GLuint end) -{ - GLcontext *ctx = VB->ctx; - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - - if (fxMesa->new_state) - fxSetupFXUnits(ctx); - - { - const float snapper = (3L << 18); - fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLfloat *v = gWin[start].f; - GLfloat *vend = gWin[end].f; - VARS; - - (void) gWin; - (void) fxMesa; - (void) snapper; - - if (VB->ClipOrMask) { - GLubyte *clipmask = &VB->ClipMask[start]; - for (; v != vend; v += 16, clipmask++ INCR) { - if (*clipmask == 0) { - DO_SETUP; - } - } - } - else { - for (; v != vend; v += 16 INCR) { - DO_SETUP; - } - } - - if (ctx->FogMode == FOG_FRAGMENT - && ctx->ProjectionMatrix.m[15] != 0.0F) { - /* need to compute W values for fogging purposes */ - const GLfloat m10 = ctx->ProjectionMatrix.m[10]; - const GLfloat m14 = ctx->ProjectionMatrix.m[14]; - const GLfloat v10 = ctx->Viewport.WindowMap.m[10]; - const GLfloat v14 = ctx->Viewport.WindowMap.m[14]; - GLfloat *v = gWin[start].f; - GLfloat *win = VB->Win.data[start]; - if (VB->ClipOrMask) { - GLubyte *clipmask = &VB->ClipMask[start]; - for (; v != vend; v += 16, clipmask++, win += 4) { - if (*clipmask == 0) { - GLfloat zNDC = (win[2] - v14) / v10; - GLfloat zEye = (zNDC - m14) / m10; - v[OOWCOORD] = -1.0F / zEye; - } - } - } - else { - for (; v != vend; v += 16, win += 4) { - GLfloat zNDC = (win[2] - v14) / v10; - GLfloat zEye = (zNDC - m14) / m10; - v[OOWCOORD] = -1.0F / zEye; - } - } - } - - /* rare - I hope */ - FIXUP; - } -} - - -#undef V1 -#undef V2 -#undef V3 -#undef V4 -#undef V5 -#undef V6 -#undef VARS - -#undef S1 -#undef S2 -#undef S3 -#undef S4 -#undef S5 -#undef S6 -#undef DO_SETUP - -#undef I1 -#undef I4 -#undef I5 -#undef I6 -#undef INCR - -#undef F5 -#undef F6 -#undef F7 -#undef FIXUP - - -#undef IND -#undef NAME diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c new file mode 100644 index 000000000..1d6d41724 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c @@ -0,0 +1,470 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "dri_glide.h" +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_render.h" +#include "tdfx_pipeline.h" +#include "tdfx_span.h" +#include "tdfx_texman.h" +#include "extensions.h" + + + +#if 0 +/* Example extension function */ +static void +fxFooBarEXT(GLint i) +{ + printf("You called glFooBarEXT(%d)\n", i); +} +#endif + + +/* + * Enable/Disable the extensions for this context. + */ +static void tdfxDDInitExtensions( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); + gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); + gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); + gl_extensions_disable( ctx, "GL_EXT_blend_color" ); + gl_extensions_disable( ctx, "GL_EXT_blend_func_separate" ); + gl_extensions_disable( ctx, "GL_EXT_point_parameters" ); + gl_extensions_disable( ctx, "GL_EXT_shared_texture_palette" ); + gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); + gl_extensions_enable( ctx, "GL_HP_occlusion_test" ); + + if ( !fxMesa->haveTwoTMUs ) { + gl_extensions_disable( ctx, "GL_EXT_texture_env_add" ); + gl_extensions_disable( ctx, "GL_ARB_multitexture" ); + } + + if ( TDFX_IS_NAPALM( fxMesa ) ) { + gl_extensions_enable( ctx, "GL_ARB_texture_compression" ); + gl_extensions_enable( ctx, "GL_EXT_texture_env_combine" ); + gl_extensions_enable( ctx, "GL_3DFX_texture_compression_FXT1" ); + } + + if (fxMesa->haveHwStencil) { + gl_extensions_enable( ctx, "GL_EXT_stencil_wrap" ); + } + + /* Example of hooking in an extension function. + * For DRI-based drivers, also see __driRegisterExtensions in the + * tdfx_xmesa.c file. + */ +#if 0 + { + void **dispatchTable = (void **) ctx->Exec; + const int _gloffset_FooBarEXT = 555; /* just an example number! */ + const int tabSize = _glapi_get_dispatch_table_size(); + assert(_gloffset_FooBarEXT < tabSize); + dispatchTable[_gloffset_FooBarEXT] = (void *) tdfxFooBarEXT; + /* XXX You would also need to hook into the display list dispatch + * table. Really, the implementation of extensions might as well + * be in the core of Mesa since core Mesa and the device driver + * is one big shared lib. + */ + } +#endif +} + + + +GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ) +{ + tdfxContextPtr fxMesa; + GLcontext *ctx = driContextPriv->mesaContext; + __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; + TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA + + sizeof(XF86DRISAREARec)); + + + fxMesa = (tdfxContextPtr) Xmalloc( sizeof(tdfxContextRec) ); + if ( !fxMesa ) { + return GL_FALSE; + } + BZERO(fxMesa, sizeof(tdfxContextRec)); + + /* Mirror some important DRI state + */ + fxMesa->hHWContext = driContextPriv->hHWContext; + fxMesa->driHwLock = &sPriv->pSAREA->lock; + fxMesa->driFd = sPriv->fd; + + fxMesa->driScreen = sPriv; + fxMesa->driContext = driContextPriv; + fxMesa->fxScreen = fxScreen; + fxMesa->sarea = saPriv; + + + + fxMesa->haveHwStencil = ( TDFX_IS_NAPALM( fxMesa ) && + mesaVis->StencilBits && + mesaVis->DepthBits == 24 ); + + fxMesa->screen_width = fxScreen->width; + fxMesa->screen_height = fxScreen->height; + + fxMesa->new_state = ~0; + fxMesa->dirty = ~0; + + fxMesa->vertexFormat = 0; + + fxMesa->glCtx = driContextPriv->mesaContext; + fxMesa->glVis = mesaVis; + + grDRIOpen( sPriv->pFB, fxScreen->regs.map, fxScreen->deviceID, + fxScreen->width, fxScreen->height, fxScreen->mem, fxScreen->cpp, + fxScreen->stride, fxScreen->fifoOffset, fxScreen->fifoSize, + fxScreen->fbOffset, fxScreen->backOffset, fxScreen->depthOffset, + fxScreen->textureOffset, fxScreen->textureSize, &saPriv->fifoPtr, + &saPriv->fifoRead ); + + if ( getenv( "FX_GLIDE_SWAPINTERVAL" ) ) { + fxMesa->Glide.SwapInterval = atoi( getenv( "FX_GLIDE_SWAPINTERVAL" ) ); + } else { + fxMesa->Glide.SwapInterval = 1; + } + if ( getenv( "FX_MAX_PENDING_SWAPS" ) ) { + fxMesa->Glide.MaxPendingSwaps = atoi( getenv( "FX_MAX_PENDING_SWAPS" ) ); + } else { + fxMesa->Glide.MaxPendingSwaps = 2; + } + + fxMesa->Glide.Initialized = GL_FALSE; + fxMesa->Glide.Board = 0; + + + if (getenv("FX_EMULATE_SINGLE_TMU")) { + fxMesa->haveTwoTMUs = GL_FALSE; + } + else { + if ( TDFX_IS_BANSHEE( fxMesa ) ) { + fxMesa->haveTwoTMUs = GL_FALSE; + } else { + fxMesa->haveTwoTMUs = GL_TRUE; + } + } + + fxMesa->stats.swapBuffer = 0; + fxMesa->stats.reqTexUpload = 0; + fxMesa->stats.texUpload = 0; + fxMesa->stats.memTexUpload = 0; + + fxMesa->tmuSrc = TDFX_TMU_NONE; + + if ( TDFX_IS_NAPALM( fxMesa ) ) { + ctx->Const.MaxTextureLevels = 12; + ctx->Const.MaxTextureSize = 2048; + ctx->Const.NumCompressedTextureFormats = 1; + } else { + ctx->Const.MaxTextureLevels = 9; + ctx->Const.MaxTextureSize = 256; + ctx->Const.NumCompressedTextureFormats = 0; + } + ctx->Const.MaxTextureUnits = TDFX_IS_BANSHEE( fxMesa ) ? 1 : 2; + ctx->NewState |= NEW_DRVSTATE1; + + + ctx->DriverCtx = (void *) fxMesa; + + tdfxDDInitExtensions( ctx ); + + tdfxDDInitDriverFuncs( ctx ); + tdfxDDInitStateFuncs( ctx ); + tdfxDDInitRenderFuncs( ctx ); + tdfxDDInitSpanFuncs( ctx ); + + ctx->Driver.TriangleCaps = (DD_TRI_CULL | + DD_TRI_LIGHT_TWOSIDE | + DD_TRI_STIPPLE | + DD_TRI_OFFSET); + + if ( ctx->VB ) + tdfxDDRegisterVB( ctx->VB ); + + if ( ctx->NrPipelineStages ) + ctx->NrPipelineStages = + tdfxDDRegisterPipelineStages( ctx->PipelineStage, + ctx->PipelineStage, + ctx->NrPipelineStages ); + + /* Run the config file */ + gl_context_initialize( ctx ); + +#if 0 + /* HACK: Allocate buffer for vertex data. + */ + if ( fxMesa->buffer ) { + ALIGN_FREE( fxMesa->buffer ); + } + fxMesa->buffer = ALIGN_MALLOC( 2048, 32 ); + fxMesa->buffer_total = 2048; + fxMesa->buffer_used = 0; +#endif + + tdfxInitState( fxMesa ); + + driContextPriv->driverPrivate = (void *) fxMesa; + + return GL_TRUE; +} + + +static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa ) +{ + FxI32 result; + int i; + + LOCK_HARDWARE( fxMesa ); + + grGet( GR_GLIDE_VERTEXLAYOUT_SIZE, sizeof(FxI32), &result ); + for ( i = 0 ; i < TDFX_NUM_LAYOUTS ; i++ ) { + fxMesa->layout[i] = MALLOC( result ); + if ( !fxMesa->layout[i] ) { + UNLOCK_HARDWARE( fxMesa ); + return GL_FALSE; + } + } + + /* Single textured vertex format - 32 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_SINGLE] ); + + /* Multitextured vertex format - 40 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_MULTI] ); + + /* Projected texture vertex format - 48 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q1, TDFX_Q1_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJECT] ); + + UNLOCK_HARDWARE( fxMesa ); + + return GL_TRUE; +} + + +/* + * Initialize the state in an tdfxContextPtr struct. + */ +GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, + tdfxContextPtr fxMesa ) +{ + /* KW: Would be nice to make one of these a member of the other. + */ + FxI32 result[2]; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa ); + } + +#if DEBUG_LOCKING + fprintf(stderr, "Debug locking enabled\n"); +#endif + + if ( fxMesa->Glide.Initialized ) + return GL_TRUE; + + fxMesa->width = driDrawPriv->w; + fxMesa->height = driDrawPriv->h; + + /* We have to use a light lock here, because we can't do any glide + * operations yet. No use of FX_* functions in this function. + */ + DRM_LIGHT_LOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); + + grGlideInit(); + grSstSelect( fxMesa->Glide.Board ); + + fxMesa->Glide.Context = grSstWinOpen( (FxU32) -1, + GR_RESOLUTION_NONE, + GR_REFRESH_NONE, + fxMesa->Glide.ColorFormat, + fxMesa->Glide.Origin, + 2, 1 ); + + grDRIResetSAREA(); + + DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); + + if ( !fxMesa->Glide.Context ) + return GL_FALSE; + + + /* Perform the Glide-dependant part of the context initialization. + */ + FX_grColorMaskv( fxMesa->glCtx, true4 ); + + tdfxTMInit( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + + if ( fxMesa->glVis->DepthBits > 0 ) { + grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); + } else { + grDepthBufferMode(GR_DEPTHBUFFER_DISABLE); + } + + grLfbWriteColorFormat( GR_COLORFORMAT_ABGR ); + + grGet( GR_TEXTURE_ALIGN, sizeof(FxI32), result ); + fxMesa->Glide.TextureAlign = result[0]; + + fxMesa->Glide.State = NULL; + grGet( GR_GLIDE_STATE_SIZE, sizeof(FxI32), result ); + fxMesa->Glide.State = MALLOC( result[0] ); + + fxMesa->Fog.Table = NULL; + grGet( GR_FOG_TABLE_ENTRIES, sizeof(FxI32), result ); + fxMesa->Fog.Table = MALLOC( result[0] * sizeof(GrFog_t) ); + + UNLOCK_HARDWARE( fxMesa ); + + if ( !fxMesa->Glide.State || !fxMesa->Fog.Table ) { + if ( fxMesa->Glide.State ) + FREE( fxMesa->Glide.State ); + if ( fxMesa->Fog.Table ) + FREE( fxMesa->Fog.Table ); + return GL_FALSE; + } + + if ( !tdfxInitVertexFormats( fxMesa ) ) { + return GL_FALSE; + } + + LOCK_HARDWARE( fxMesa ); + + grGlideGetState( fxMesa->Glide.State ); + + if ( getenv( "FX_GLIDE_INFO" ) ) { + printf( "GR_RENDERER = %s\n", (char *) grGetString( GR_RENDERER ) ); + printf( "GR_VERSION = %s\n", (char *) grGetString( GR_VERSION ) ); + printf( "GR_VENDOR = %s\n", (char *) grGetString( GR_VENDOR ) ); + printf( "GR_HARDWARE = %s\n", (char *) grGetString( GR_HARDWARE ) ); + printf( "GR_EXTENSION = %s\n", (char *) grGetString( GR_EXTENSION ) ); + } + + UNLOCK_HARDWARE( fxMesa ); + + fxMesa->numClipRects = 0; + fxMesa->pClipRects = NULL; + fxMesa->scissoredClipRects = GL_FALSE; + + fxMesa->Glide.Initialized = GL_TRUE; + + return GL_TRUE; +} + + +void tdfxDestroyContext( tdfxContextPtr fxMesa ) +{ + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa ); + } + + if ( fxMesa ) { + if (fxMesa->glCtx->Shared->RefCount == 1) { + /* This share group is about to go away, free our private + * texture object data. + */ + struct gl_texture_object *tObj; + tObj = fxMesa->glCtx->Shared->TexObjectList; + while (tObj) { + tdfxTMFreeTexture(fxMesa, tObj); + tObj = tObj->Next; + } + } + + tdfxTMClose(fxMesa); /* free texture memory */ + XFree( fxMesa ); + } + +#if 0 + glx_fini_prof(); +#endif +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h new file mode 100644 index 000000000..d630184bd --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h @@ -0,0 +1,774 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_CONTEXT_H__ +#define __TDFX_CONTEXT_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <sys/time.h> +#include "dri_tmm.h" +#include "dri_mesaint.h" +#include "dri_mesa.h" +#include "dri_xmesaapi.h" +#ifdef XFree86Server +#include "GL/xf86glx.h" +#else +#include "glheader.h" +#endif +#if defined(__linux__) +#include <signal.h> +#endif +#include "clip.h" +#include "context.h" + +#include "macros.h" +#include "matrix.h" +#include "mem.h" +#include "texture.h" +#include "types.h" +#include "vb.h" +#include "vbrender.h" +#include "xform.h" + +#include "tdfx_wrapper.h" +#include "tdfx_screen.h" +#include "tdfx_lock.h" +#include "tdfx_g3ext.h" + + + +/* Mergable items first + */ +#define SETUP_RGBA 0x1 +#define SETUP_TMU0 0x2 +#define SETUP_TMU1 0x4 +#define SETUP_XY 0x8 +#define SETUP_Z 0x10 +#define SETUP_W 0x20 + +#define MAX_MERGABLE 0x8 + + +#define TDFX_TMU0 GR_TMU0 +#define TDFX_TMU1 GR_TMU1 +#define TDFX_TMU_SPLIT 98 +#define TDFX_TMU_BOTH 99 +#define TDFX_TMU_NONE 100 + + + +/* Flags for fxMesa->new_state + */ +#define TDFX_NEW_COLOR 0x0001 +#define TDFX_NEW_ALPHA 0x0002 +#define TDFX_NEW_DEPTH 0x0004 +#define TDFX_NEW_FOG 0x0008 +#define TDFX_NEW_STENCIL 0x0010 +#define TDFX_NEW_CLIP 0x0020 +#define TDFX_NEW_VIEWPORT 0x0040 +#define TDFX_NEW_CULL 0x0080 +#define TDFX_NEW_GLIDE 0x0100 +#define TDFX_NEW_TEXTURE 0x0200 +#define TDFX_NEW_CONTEXT 0x0400 +#define TDFX_NEW_LINE 0x0800 +#define TDFX_NEW_RENDER 0x1000 +#define TDFX_NEW_STIPPLE 0x2000 +#define TDFX_NEW_TEXTURE_BIND 0x4000 /* experimental */ + + +/* Flags for fxMesa->dirty + */ +#define TDFX_UPLOAD_COLOR_COMBINE 0x00000001 +#define TDFX_UPLOAD_ALPHA_COMBINE 0x00000002 +#define TDFX_UPLOAD_RENDER_BUFFER 0x00000004 +#define TDFX_UPLOAD_ALPHA_TEST 0x00000008 +#define TDFX_UPLOAD_ALPHA_REF 0x00000010 +#define TDFX_UPLOAD_BLEND_FUNC 0x00000020 +#define TDFX_UPLOAD_DEPTH_MODE 0x00000040 +#define TDFX_UPLOAD_DEPTH_BIAS 0x00000080 +#define TDFX_UPLOAD_DEPTH_FUNC 0x00000100 +#define TDFX_UPLOAD_DEPTH_MASK 0x00000200 +#define TDFX_UPLOAD_FOG_MODE 0x00000400 +#define TDFX_UPLOAD_FOG_COLOR 0x00000800 +#define TDFX_UPLOAD_FOG_TABLE 0x00001000 + +#define TDFX_UPLOAD_CLIP 0x00002000 +#define TDFX_UPLOAD_CULL 0x00004000 +#define TDFX_UPLOAD_VERTEX_LAYOUT 0x00008000 +#define TDFX_UPLOAD_COLOR_MASK 0x00010000 +#define TDFX_UPLOAD_CONSTANT_COLOR 0x00020000 +#define TDFX_UPLOAD_DITHER 0x00040000 +#define TDFX_UPLOAD_STENCIL 0x00080000 + +#define TDFX_UPLOAD_TEXTURE_SOURCE 0x00100000 +#define TDFX_UPLOAD_TEXTURE_PARAMS 0x00200000 +#define TDFX_UPLOAD_TEXTURE_PALETTE 0x00400000 +#define TDFX_UPLOAD_TEXTURE_ENV 0x00800000 +#define TDFX_UPLOAD_TEXTURE_IMAGES 0x01000000 + +#define TDFX_UPLOAD_LINE 0x02000000 + +#define TDFX_UPLOAD_STIPPLE 0x04000000 + +/* Flags for software fallback cases + */ +#define TDFX_FALLBACK_TEXTURE 0x0001 +#define TDFX_FALLBACK_BUFFER 0x0002 +#define TDFX_FALLBACK_SPECULAR 0x0004 +#define TDFX_FALLBACK_STENCIL 0x0008 +#define TDFX_FALLBACK_RENDER_MODE 0x0010 +#define TDFX_FALLBACK_MULTIDRAW 0x0020 +#define TDFX_FALLBACK_LOGICOP 0x0040 +#define TDFX_FALLBACK_WIDE_AA_LINE 0x0080 +#define TDFX_FALLBACK_TEXTURE_ENV 0x0100 +#define TDFX_FALLBACK_TEXTURE_BORDER 0x0200 +#define TDFX_FALLBACK_COLORMASK 0x0400 +#define TDFX_FALLBACK_BLEND 0x0800 + +/* Different Glide vertex layouts + */ +#define TDFX_LAYOUT_SINGLE 0 +#define TDFX_LAYOUT_MULTI 1 +#define TDFX_LAYOUT_PROJECT 2 +#define TDFX_NUM_LAYOUTS 3 + +#define TDFX_XY_OFFSET 0 +#define TDFX_Z_OFFSET 8 +#define TDFX_Q_OFFSET 12 +#define TDFX_ARGB_OFFSET 16 +#define TDFX_PAD_OFFSET 20 +#define TDFX_FOG_OFFSET 20 /* experimental */ +#define TDFX_ST0_OFFSET 24 +#define TDFX_ST1_OFFSET 32 +#define TDFX_Q0_OFFSET 40 +#define TDFX_Q1_OFFSET 44 + + +/* Flags for buffer clears + */ +#define TDFX_FRONT 0x1 +#define TDFX_BACK 0x2 +#define TDFX_DEPTH 0x4 +#define TDFX_STENCIL 0x8 + +/* + * Subpixel offsets to adjust Mesa's (true) window coordinates to + * Glide coordinates. We need these to ensure precise rasterization. + * Otherwise, we'll fail a bunch of conformance tests. + */ +#define TRI_X_OFFSET ( 0.0F) +#define TRI_Y_OFFSET ( 0.0F) +#define LINE_X_OFFSET ( 0.0F) +#define LINE_Y_OFFSET ( 0.125F) +#define PNT_X_OFFSET ( 0.375F) +#define PNT_Y_OFFSET ( 0.375F) + + +#define TDFX_DEPTH_BIAS_SCALE 128 + +/* Including xf86PciInfo.h causes a bunch of errors + */ +#ifndef PCI_CHIP_BANSHEE +#define PCI_CHIP_BANSHEE 0x0003 +#define PCI_CHIP_VOODOO3 0x0005 +#define PCI_CHIP_VOODOO4 0x0009 +#define PCI_CHIP_VOODOO5 0x0009 +#endif + +#define TDFX_IS_BANSHEE( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_BANSHEE ) +#define TDFX_IS_VOODOO3( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO3 ) +#define TDFX_IS_VOODOO4( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4 ) +#define TDFX_IS_VOODOO5( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5 ) +#define TDFX_IS_NAPALM( fxMesa ) \ + ( (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4) || \ + (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5) ) + + +#define PACK_BGRA32(R, G, B, A) \ + ( (((GLuint) (R)) << 16) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) ) | \ + (((GLuint) (A)) << 24) ) + +#define PACK_RGBA32(R, G, B, A) \ + ( (((GLuint) (R)) ) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) << 16) | \ + (((GLuint) (A)) << 24) ) + +/* + * The first two macros are to pack 8 bit color + * channel values into a 565 format. + */ +#define PACK_RGB16(R, G, B) \ + ((((GLuint) (R) & 0xF8) << 8) | \ + (((GLuint) (G) & 0xFC) << 3) | \ + (((GLuint) (B) & 0xFF) >> 3)) +#define PACK_BGR16(R, G, B) \ + ((((GLuint) (B) & 0xF8) << 8) | \ + (((GLuint) (G) & 0xFC) << 3) | \ + (((GLuint) (R) & 0xFF) >> 3)) +/* + * The second two macros pack 8 bit color channel values + * into 1555 values. + */ +#define PACK_RGBA16(R, G, B, A) \ + (((((GLuint) (A) & 0xFF) > 0) << 15)| \ + (((GLuint) (R) & 0xF8) << 7) | \ + (((GLuint) (G) & 0xF8) << 2) | \ + (((GLuint) (B) & 0xF8) >> 3)) +#define PACK_BGRA16(R, G, B, A) \ + (((((GLuint) (A) & 0xFF) > 0) << 15)| \ + (((GLuint) (B) & 0xF8) << 7) | \ + (((GLuint) (G) & 0xF8) << 2) | \ + (((GLuint) (R) & 0xF8) >> 3)) + +typedef void (*tdfxRenderEltsFunc)( struct vertex_buffer * ); + +/* Used in calls to grColorMaskv()... + */ +extern const GLboolean false4[4]; +extern const GLboolean true4[4]; + + +typedef void (*tdfx_interp_func)( GLfloat t, + GLfloat *result, + const GLfloat *in, + const GLfloat *out ); + +typedef struct { + volatile int fifoPtr; + volatile int fifoRead; + volatile int fifoOwner; + volatile int ctxOwner; + volatile int texOwner; +} +TDFXSAREAPriv; + + +typedef struct { + GLuint swapBuffer; + GLuint reqTexUpload; + GLuint texUpload; + GLuint memTexUpload; + GLuint texSwaps; +} tdfxStats; + + + +/* + * Memory range from startAddr to endAddr-1 + */ +typedef struct mem_range { + struct mem_range *next; + FxU32 startAddr, endAddr; +} +tdfxMemRange; + + +typedef struct { + GLsizei width, height; /* image size */ + GLint texelSize; /* How many bytes to a texel */ + GrTextureFormat_t glideFormat; /* Glide image format */ + void *data; /* Glide-formated texture image */ + FxU32 dataSize; /* image size in bytes */ +} +tdfxMipMapLevel; + + +#define TDFX_NUM_TMU 2 + + +typedef struct tdfxTexInfo_t +{ + GLboolean isInTM; + GLboolean reloadImages; /* if true, resend images to Glide */ + GLuint lastTimeUsed; + FxU32 whichTMU; + + GrTexInfo info; + GrAspectRatio_t aspectRatio; + tdfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS]; + tdfxMemRange *tm[TDFX_NUM_TMU]; + + GLint minLevel, maxLevel; + GrTextureFilterMode_t minFilt; + GrTextureFilterMode_t magFilt; + GrTextureClampMode_t sClamp; + GrTextureClampMode_t tClamp; + FxBool LODblend; + GrMipMapMode_t mmMode; + + GLfloat sScale, tScale; /* texcoord scale factor */ + + GuTexPalette palette; +} +tdfxTexInfo; + + +#define TDFX_TEXTURE_DATA(mesaObj) ((tdfxTexInfo *)((mesaObj)->DriverData)) + + + +/* + * This is state which may be shared by several tdfx contexts. + * It hangs off of Mesa's gl_shared_state object (ctx->Shared->DriverData). + */ +struct tdfxSharedState { + GLboolean umaTexMemory; + GLuint totalTexMem[TDFX_NUM_TMU]; /* constant */ + GLuint freeTexMem[TDFX_NUM_TMU]; /* changes as we go */ + tdfxMemRange *tmPool; + tdfxMemRange *tmFree[TDFX_NUM_TMU]; +}; + + + + +/* ================================================================ + * + * We want to keep a mirror of the Glide function call parameters so we + * can avoid updating our state too often. + * + * Each of these broad groups will typically have a new state flag + * associated with it, and will be updated together. The individual + * Glide function calls each have a dirty flag and will only be called + * when absolutely necessary. + */ + +/* for grTexSource() */ +struct tdfx_texsource { + FxU32 StartAddress; + FxU32 EvenOdd; + GrTexInfo *Info; +}; + +/* Texture object params */ +struct tdfx_texparams { + GrTextureClampMode_t sClamp; + GrTextureClampMode_t tClamp; + GrTextureFilterMode_t minFilt; + GrTextureFilterMode_t magFilt; + GrMipMapMode_t mmMode; + FxBool LODblend; + GLfloat LodBias; +}; + +/* for grTexDownloadTable() texture palettes */ +struct tdfx_texpalette { + GrTexTable_t Type; + void *Data; +}; + +/* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */ +struct tdfx_combine { + GrCombineFunction_t Function; /* Combine function */ + GrCombineFactor_t Factor; /* Combine scale factor */ + GrCombineLocal_t Local; /* Local combine source */ + GrCombineOther_t Other; /* Other combine source */ + FxBool Invert; /* Combine result inversion flag */ +}; + +/* for Voodoo3's grTexCombine() */ +struct tdfx_texcombine { + GrCombineFunction_t FunctionRGB; + GrCombineFactor_t FactorRGB; + GrCombineFunction_t FunctionAlpha; + GrCombineFactor_t FactorAlpha; + FxBool InvertRGB; + FxBool InvertAlpha; +}; + + +/* for Voodoo5's grColorCombineExt() */ +struct tdfx_combine_color_ext { + GrCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrCCUColor_t SourceC; + FxBool InvertC; + GrCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grAlphaCombineExt() */ +struct tdfx_combine_alpha_ext { + GrACUColor_t SourceA; + GrCombineMode_t ModeA; + GrACUColor_t SourceB; + GrCombineMode_t ModeB; + GrACUColor_t SourceC; + FxBool InvertC; + GrACUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexColorCombineExt() */ +struct tdfx_color_texenv { + GrTCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrTCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrTCCUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexAlphaCombineExt() */ +struct tdfx_alpha_texenv { + GrTACUColor_t SourceA; + GrCombineMode_t ModeA; + GrTACUColor_t SourceB; + GrCombineMode_t ModeB; + GrTACUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* Voodoo5's texture combine environment */ +struct tdfx_texcombine_ext { + struct tdfx_alpha_texenv Alpha; + struct tdfx_color_texenv Color; + GrColor_t EnvColor; +}; + +/* Used to track changes between Glide's state and Mesa's */ +struct tdfx_texstate { + GLuint Enabled; /* bitmask of all units */ + GLenum EnvMode[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */ + GLenum TexFormat[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */ +}; + +struct tdfx_color { + GrColor_t ClearColor; /* Buffer clear color value */ + GrAlpha_t ClearAlpha; /* Buffer clear alpha value */ + FxBool ColorMask[4]; /* Per-channel write enable flags */ + + GrColor_t MonoColor; /* Constant color value */ + + /* Alpha testing */ + GrCmpFnc_t AlphaFunc; /* Alpha test function */ + GrAlpha_t AlphaRef; /* Alpha ref value in range [0,255] */ + + /* Blending */ + GrAlphaBlendFnc_t BlendSrcRGB; /* Blend source RGB factor */ + GrAlphaBlendFnc_t BlendDstRGB; /* Blend destination RGB factor */ + GrAlphaBlendFnc_t BlendSrcA; /* Blend source alpha factor */ + GrAlphaBlendFnc_t BlendDstA; /* Blend destination alpha factor */ + + GrDitherMode_t Dither; /* Dither enable */ +}; + +struct tdfx_depth { + GrDepthBufferMode_t Mode; /* Fixed-point Z or floating-point W */ + FxI32 Bias; /* Polygon offset factor */ + GrCmpFnc_t Func; /* Depth test function */ + FxU32 Clear; /* Buffer clear value */ + FxBool Mask; /* Write enable flag */ +}; + +struct tdfx_stipple { + GrStippleMode_t Mode; /* Stipple enable/disable */ + FxU32 Pattern; /* 8x4 Stipple Pattern */ +}; + +struct tdfx_fog { + GrFogMode_t Mode; /* Glide fog mode */ + GrColor_t Color; /* Fog color value */ + GLenum TableMode; /* GL fog mode currently in table */ + GrFog_t *Table; /* Fog value table */ + FxFloat Density; /* Density >= 0 */ + FxFloat Near; /* Start distance in eye coords */ + FxFloat Far; /* End distance in eye coords */ +}; + +struct tdfx_stencil { + GrCmpFnc_t Function; /* Stencil function */ + GrStencil_t RefValue; /* Stencil reference value */ + GrStencil_t ValueMask; /* Value mask */ + GrStencil_t WriteMask; /* Write mask */ + GrStencil_t FailFunc; /* Stencil fail function */ + GrStencil_t ZFailFunc; /* Stencil pass, depth fail function */ + GrStencil_t ZPassFunc; /* Stencil pass, depth pass function */ + GrStencil_t Clear; /* Buffer clear value */ +}; + +struct tdfx_scissor { + FxU32 minX, minY; /* Lower left corner */ + FxU32 maxX, maxY; /* Upper right corner */ +}; + +struct tdfx_viewport { + GrCoordinateSpaceMode_t Mode; /* Coordinate space */ + FxI32 X, Y; /* Position */ + FxI32 Width, Height; /* Size */ + FxFloat Near, Far; /* Depth buffer range */ +}; + +struct tdfx_glide { + void *State; /* Mirror of internal Glide state */ + GrContext_t Context; /* Glide context identifier */ + FxI32 Board; /* Current graphics subsystem */ + GrColorFormat_t ColorFormat; /* Framebuffer format */ + GrOriginLocation_t Origin; /* Location of screen space origin */ + + FxBool Initialized; /* Glide initialization done? */ + + FxI32 SwapInterval; /* SwapBuffers interval */ + FxI32 MaxPendingSwaps; /* Maximum outstanding SwapBuffers */ + FxI32 TextureAlign; + + /* Extensions */ + FxBool HaveCombineExt; /* COMBINE */ + FxBool HaveCommandTransportExt; /* COMMAND_TRANSPORT */ + FxBool HaveFogCoordExt; /* FOGCOORD */ + FxBool HavePixelExt; /* PIXEXT */ + FxBool HaveTextureBufferExt; /* TEXTUREBUFFER */ + FxBool HaveTexFmtExt; /* TEXFMT */ + FxBool HaveTexUMAExt; /* TEXUMA */ + FxBool HaveTexus2; /* Texus 2 - FXT1 */ +}; + + +struct tdfx_context { + /* Set once and never changed: + */ + GLcontext *glCtx; /* The core Mesa context */ + GLvisual *glVis; /* Describes the color buffer */ + + GLuint new_state; + GLuint dirty; + + /* Mirror of hardware state, Glide parameters + */ + struct tdfx_texsource TexSource[TDFX_NUM_TMU]; + struct tdfx_texparams TexParams[TDFX_NUM_TMU]; + struct tdfx_texpalette TexPalette; + + /* Voodoo3 texture/color combine state */ + struct tdfx_combine ColorCombine; + struct tdfx_combine AlphaCombine; + struct tdfx_texcombine TexCombine[TDFX_NUM_TMU]; + + /* Voodoo5 texture/color combine state */ + struct tdfx_combine_color_ext ColorCombineExt; + struct tdfx_combine_alpha_ext AlphaCombineExt; + struct tdfx_texcombine_ext TexCombineExt[TDFX_NUM_TMU]; + + /* Tracks tex state difference between Glide and Mesa */ + struct tdfx_texstate TexState; + + GrBuffer_t DrawBuffer; /* Current draw buffer */ + GrBuffer_t ReadBuffer; /* Current read buffer */ + + struct tdfx_color Color; + struct tdfx_depth Depth; + struct tdfx_fog Fog; + struct tdfx_stencil Stencil; + struct tdfx_scissor Scissor; + struct tdfx_viewport Viewport; + struct tdfx_stipple Stipple; + + GrCullMode_t CullMode; + + struct tdfx_glide Glide; + + /* Variable-size Glide vertex formats + */ + GLuint vertsize; /* bytes per vertex */ + GLuint vertexFormat; /* the current format */ + void *layout[TDFX_NUM_LAYOUTS]; + + GLuint tmu_source[TDFX_NUM_TMU]; + GLuint tex_dest[MAX_TEXTURE_UNITS]; + + GLuint SetupIndex; + GLuint SetupDone; + GLuint RenderIndex; + + GLuint IndirectTriangles; + GLuint Fallback; + + GLfloat sScale0, tScale0; + GLfloat sScale1, tScale1; + +#if 0 + GLuint last_tri_caps; + GLuint stw_hint_state; /* for grHints */ +#endif + GLuint using_fast_path, passes, multipass; + GLuint texBindNumber; + GLint tmuSrc; + + int screen_width; + int screen_height; + +#if 0 + void *state; /* Glide state buffer */ + + GLint textureAlign; + GLboolean verbose; +#endif + GLboolean haveTwoTMUs; /* True if we have 2 tmu's */ + GLboolean haveHwStencil; + + GLint maxPendingSwapBuffers; + + /* stuff added for DRI */ + __DRIscreenPrivate *driScreen; + __DRIcontextPrivate *driContext; + __DRIdrawablePrivate *driDrawable; + drmContext hHWContext; + drmLock *driHwLock; + int driFd; + tdfxScreenPrivate *fxScreen; + TDFXSAREAPriv *sarea; + + + /* + * Changes during execution: + */ + int width, height; /* size of window */ + int x_offset; /* distance from window left to screen left */ + int y_offset; /* distance from window top to screen top */ + int y_delta; /* distance from window bottom to screen bottom */ + + int numClipRects; + XF86DRIClipRectPtr pClipRects; + GLboolean scissoredClipRects; /* if true, pClipRects is private storage */ + + + GuTexPalette glbPalette; /* global texture palette */ + + tdfx_interp_func interp; + + points_func PointsFunc; + line_func LineFunc; + triangle_func TriangleFunc; + quad_func QuadFunc; + render_func *RenderVBRawTab; + tdfxRenderEltsFunc RenderElementsRaw; + + + tdfxStats stats; + + /* HACK: Let's get some buffering of vertices happening... + */ + GLuint *buffer; + GLuint buffer_total; + GLuint buffer_used; +}; + +#define TDFX_CONTEXT(ctx) ((tdfxContextPtr)((ctx)->DriverCtx)) + + +extern GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ); +extern void tdfxDestroyContext( tdfxContextPtr fxMesa ); + +extern GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, + tdfxContextPtr fxMesa ); + + +/* Color packing utilities + */ +#define TDFXPACKCOLOR332( r, g, b ) \ + (((b) & 0xe0) | (((g) & 0xe0) >> 3) | (((r) & 0xc0) >> 6)) + +#define TDFXPACKCOLOR1555( r, g, b, a ) \ + ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) + +#define TDFXPACKCOLOR565( r, g, b ) \ + ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) + +#define TDFXPACKCOLOR888( r, g, b ) \ + (((b) << 16) | ((g) << 8) | (r)) + +#define TDFXPACKCOLOR8888( r, g, b, a ) \ + (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) + +#define TDFXPACKCOLOR4444( r, g, b, a ) \ + ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((g) & 0xf0) | ((r) >> 4)) + +static __inline__ GrColor_t tdfxPackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) +{ + switch ( cpp ) { + case 2: + return TDFXPACKCOLOR565( r, g, b ); + case 4: + return TDFXPACKCOLOR8888( r, g, b, a ); + default: + return 0; + } +} + +#define DO_DEBUG 0 +#if DO_DEBUG +extern int TDFX_DEBUG; +#else +#define TDFX_DEBUG 0 +#endif + +#define DEBUG_ALWAYS_SYNC 0x01 +#define DEBUG_VERBOSE_API 0x02 +#define DEBUG_VERBOSE_MSG 0x04 +#define DEBUG_VERBOSE_LRU 0x08 +#define DEBUG_VERBOSE_DRI 0x10 +#define DEBUG_VERBOSE_IOCTL 0x20 +#define DEBUG_VERBOSE_2D 0x40 + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_CONTEXT_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c new file mode 100644 index 000000000..ec5b25871 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c @@ -0,0 +1,273 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_vb.h" +#include "tdfx_pipeline.h" +#include "tdfx_pixels.h" + +#include "enums.h" +#include "pb.h" + + +#define TDFX_DATE "20010104" + + +/* These are used in calls to FX_grColorMaskv() */ +const GLboolean false4[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; +const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE }; + + + +/* KW: Put the word Mesa in the render string because quakeworld + * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE). + * Why? + */ +static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name ) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + + switch ( name ) { + case GL_RENDERER: + { + static char buffer[100]; + char hardware[100]; + + strcpy( hardware, FX_grGetString( fxMesa, GR_HARDWARE ) ); + + if ( strcmp( hardware, "Voodoo3 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo3" ); + } + else if ( strcmp( hardware, "Voodoo Banshee (tm)" ) == 0 ) { + strcpy( hardware, "VoodooBanshee" ); + } + else if ( strcmp( hardware, "Voodoo4 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo4" ); + } + else if ( strcmp( hardware, "Voodoo5 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo5" ); + } + else { + /* unexpected result: replace spaces with hyphens */ + int i; + for ( i = 0 ; hardware[i] ; i++ ) { + if ( hardware[i] == ' ' || hardware[i] == '\t' ) + hardware[i] = '-'; + } + } + /* now make the GL_RENDERER string */ + sprintf( buffer, "Mesa DRI %s " TDFX_DATE, hardware ); + return buffer; + } + case GL_VENDOR: + return "VA Linux Systems, Inc."; + default: + return NULL; + } +} + + +/* Return buffer size information. + */ +static void tdfxDDGetBufferSize( GLcontext *ctx, + GLuint *width, GLuint *height ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + *width = fxMesa->width; + *height = fxMesa->height; +} + + +static GLint tdfxDDGetParameteri( const GLcontext *ctx, GLint param ) +{ + switch ( param ) { + case DD_HAVE_HARDWARE_FOG: + return 1; + default: + return 0; + } +} + +/* + * Return the current value of the occlusion test flag and + * reset the flag (hardware counters) to false. + */ +static GLboolean get_occlusion_result( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLboolean result; + + LOCK_HARDWARE( fxMesa ); + + if (ctx->Depth.OcclusionTest) { + if (ctx->OcclusionResult) { + result = GL_TRUE; /* result of software rendering */ + } + else { + FxI32 zfail, in; + zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL); + in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN); + if (in == zfail) + result = GL_FALSE; /* geom was completely occluded */ + else + result = GL_TRUE; /* all or part of geom was visible */ + } + } + else { + result = ctx->OcclusionResultSaved; + } + + /* reset results now */ + grReset(GR_STATS_PIXELS); + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + + UNLOCK_HARDWARE( fxMesa ); + + return result; +} + + +/* + * We're only implementing this function to handle the + * GL_OCCLUSTION_TEST_RESULT_HP case. It's special because it + * has a side-effect: resetting the occlustion result flag. + */ +static GLboolean tdfxDDGetBooleanv( GLcontext *ctx, GLenum pname, + GLboolean *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetDoublev( GLcontext *ctx, GLenum pname, + GLdouble *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLdouble) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetFloatv( GLcontext *ctx, GLenum pname, + GLfloat *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLfloat) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetIntegerv( GLcontext *ctx, GLenum pname, + GLint *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLint) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + + + +#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \ + ((vis->RedBits == r) && \ + (vis->GreenBits == g) && \ + (vis->BlueBits == b) && \ + (vis->AlphaBits == a)) + +void tdfxDDInitDriverFuncs( GLcontext *ctx ) +{ + if ( MESA_VERBOSE & VERBOSE_DRIVER ) { + fprintf( stderr, "tdfx: %s()\n", __FUNCTION__ ); + } + + ctx->Driver.GetString = tdfxDDGetString; + ctx->Driver.GetBufferSize = tdfxDDGetBufferSize; + ctx->Driver.Error = NULL; + ctx->Driver.GetParameteri = tdfxDDGetParameteri; + + if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) ) + { + ctx->Driver.DrawPixels = tdfx_drawpixels_R8G8B8A8; + ctx->Driver.ReadPixels = tdfx_readpixels_R8G8B8A8; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) ) + { + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = tdfx_readpixels_R5G6B5; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + else + { + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = NULL; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + + ctx->Driver.RegisterVB = tdfxDDRegisterVB; + ctx->Driver.UnregisterVB = tdfxDDUnregisterVB; + ctx->Driver.ResetVB = NULL; + ctx->Driver.ResetCvaVB = NULL; + + if ( !getenv( "TDFX_NO_FAST" ) ) { + ctx->Driver.BuildPrecalcPipeline = tdfxDDBuildPrecalcPipeline; + } else { + ctx->Driver.BuildPrecalcPipeline = NULL; + } + ctx->Driver.BuildEltPipeline = NULL; + + ctx->Driver.OptimizeImmediatePipeline = NULL; + ctx->Driver.OptimizePrecalcPipeline = NULL; + + ctx->Driver.GetBooleanv = tdfxDDGetBooleanv; + ctx->Driver.GetDoublev = tdfxDDGetDoublev; + ctx->Driver.GetFloatv = tdfxDDGetFloatv; + ctx->Driver.GetIntegerv = tdfxDDGetIntegerv; + ctx->Driver.GetPointerv = NULL; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h new file mode 100644 index 000000000..1bb037a0f --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h @@ -0,0 +1,47 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_DD_H__ +#define __TDFX_DD_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern void tdfxDDInitDriverFuncs( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c new file mode 100644 index 000000000..f41d86b3c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c @@ -0,0 +1,594 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "types.h" +#include "enums.h" +#include "cva.h" +#include "vertices.h" +#include "mmath.h" + +#include "tdfx_context.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" +#include "tdfx_pipeline.h" + + +struct tdfx_fast_tab { + void (*build_vertices)( struct vertex_buffer *VB, GLuint do_cliptest ); + void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ); + void (*project_vertices)( struct vertex_buffer *VB ); + void (*project_clipped_vertices)( struct vertex_buffer *VB ); +}; + + +#define POINT(x) tdfx_draw_point( fxMesa, &vert[x], psize ) +#define LINE(x,y) tdfx_draw_line( fxMesa, &vert[x], &vert[y], lwidth ) +#define TRI(x,y,z) grDrawTriangle( &vert[x], &vert[y], &vert[z] ); + + +#define INDIRECT_TRI(x,y,z) \ +do { \ + out[next_elt + 0] = &vert[x]; \ + out[next_elt + 1] = &vert[y]; \ + out[next_elt + 2] = &vert[z]; \ + next_elt += 3; \ +} while (0) + + + +/* Direct, and no clipping required. The clip funcs have not been + * written yet, so this is only useful for the fast path. + */ +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint e; \ + for ( e = start ; e < count ; e++ ) \ + POINT( elt[e] ); \ +} while (0) + +#define RENDER_LINE( i1, i ) \ +do { \ + GLuint e1 = elt[i1], e = elt[i]; \ + LINE( e1, e ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + if ( parity ) { \ + GLuint tmp = e2; e2 = e1; e1 = tmp; \ + } \ + TRI( e2, e1, e ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + TRI( e3, e2, e ); \ + TRI( e2, e1, e ); \ +} while (0) + +#define LOCAL_VARS \ + tdfxVertexPtr vert = TDFX_DRIVER_DATA(VB)->verts; \ + const GLuint *elt = VB->EltPtr->data; \ + GLcontext *ctx = VB->ctx; \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + const GLfloat lwidth = ctx->Line.Width; \ + const GLfloat psize = ctx->Point.Size; \ + (void) lwidth; (void) psize; (void) vert; (void) fxMesa; + +#define TAG(x) tdfx_##x##_smooth_direct +#include "render_tmp.h" + + + +/* Indirect, and no clipping required. The clip funcs have not been + * written yet, so this is only useful for the fast path. + */ +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint e; \ + for ( e = start ; e < count ; e++ ) \ + POINT( elt[e] ); \ +} while (0) + +#define RENDER_LINE( i1, i ) \ +do { \ + GLuint e1 = elt[i1], e = elt[i]; \ + LINE( e1, e ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + if ( parity ) { \ + GLuint tmp = e2; e2 = e1; e1 = tmp; \ + } \ + INDIRECT_TRI( e2, e1, e ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + TRI( e3, e2, e ); \ + TRI( e2, e1, e ); \ +} while (0) + +#define LOCAL_VARS \ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); \ + tdfxVertexPtr vert = fxVB->verts; \ + GLuint next_elt = fxVB->last_elt; \ + tdfxVertexPtr *out = fxVB->elts; \ + const GLuint *elt = VB->EltPtr->data; \ + GLcontext *ctx = VB->ctx; \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + const GLfloat lwidth = ctx->Line.Width; \ + const GLfloat psize = ctx->Point.Size; \ + (void) lwidth; (void) psize; (void) vert; (void) out; (void) fxMesa; + +#define POSTFIX \ + fxVB->last_elt = next_elt; + +#define TAG(x) tdfx_##x##_smooth_indirect +#include "render_tmp.h" + + + +#define NEGATIVE(f) (f < 0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) +#define LINTERP(T, A, B) ((A) + (T) * ((B) - (A))) + +#define INTERP_RGBA( t, out, a, b ) \ +do { \ + int i; \ + for ( i = 0 ; i < 4 ; i++ ) { \ + GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR( a[i] ); \ + GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR( b[i] ); \ + GLfloat fo = LINTERP( t, fa, fb ); \ + FLOAT_COLOR_TO_UBYTE_COLOR( out[i], fo ); \ + } \ +} while (0) + +#define CLIP( SGN, V, PLANE ) \ +do { \ + if ( mask & PLANE ) { \ + GLuint *indata = inlist[in]; \ + GLuint *outdata = inlist[in ^= 1]; \ + GLuint nr = n; \ + GLfloat *J = verts[indata[nr-1]].f; \ + GLfloat dpJ = (SGN J[V]) + J[3]; \ + \ + inlist[0] = vlist1; \ + for ( i = n = 0 ; i < nr ; i++ ) { \ + GLuint elt_i = indata[i]; \ + GLfloat *I = verts[elt_i].f; \ + GLfloat dpI = (SGN I[V]) + I[3]; \ + \ + if ( DIFFERENT_SIGNS( dpI, dpJ ) ) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t, *in, *out; \ + \ + if ( NEGATIVE( dpI ) ) { \ + t = dpI / (dpI - dpJ); \ + in = I; \ + out = J; \ + } else { \ + t = dpJ / (dpJ - dpI); \ + in = J; \ + out = I; \ + } \ + \ + interp( t, O, in, out ); \ + \ + clipmask[next_vert] = 0; \ + outdata[n++] = next_vert++; \ + } \ + \ + clipmask[elt_i] |= PLANE; /* don't set up */ \ + \ + if ( !NEGATIVE( dpI ) ) { \ + outdata[n++] = elt_i; \ + clipmask[elt_i] &= ~PLANE; /* set up after all */ \ + } \ + \ + J = I; \ + dpJ = dpI; \ + } \ + \ + if ( n < 3 ) return; \ + } \ +} while (0) + +#define LINE_CLIP( x, y, z, w, PLANE ) \ +do { \ + if ( mask & PLANE ) { \ + GLfloat dpI = DOT4V( I, x, y, z, w ); \ + GLfloat dpJ = DOT4V( J, x, y, z, w ); \ + \ + if ( DIFFERENT_SIGNS( dpI, dpJ ) ) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t = dpI / (dpI - dpJ); \ + \ + interp( t, O, I, J ); \ + \ + clipmask[next_vert] = 0; \ + \ + if ( NEGATIVE( dpI ) ) { \ + clipmask[elts[0]] |= PLANE; \ + I = O; \ + elts[0] = next_vert++; \ + } else { \ + clipmask[elts[1]] |= PLANE; \ + J = O; \ + elts[1] = next_vert++; \ + } \ + } else if ( NEGATIVE( dpI ) ) { \ + return; \ + } \ + } \ +} while (0) + + +static __inline void tdfx_tri_clip( GLuint **p_elts, + tdfxVertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + tdfx_interp_func interp ) +{ + GLuint *elts = *p_elts; + GLuint next_vert = *p_next_vert; + GLuint in = 0; + GLuint n = 3; + GLuint vlist1[VB_MAX_CLIPPED_VERTS]; + GLuint vlist2[VB_MAX_CLIPPED_VERTS]; + GLuint *inlist[2]; + GLuint *out; + GLuint i; + + inlist[0] = elts; + inlist[1] = vlist2; + + CLIP( -, 0, CLIP_RIGHT_BIT ); + CLIP( +, 0, CLIP_LEFT_BIT ); + CLIP( -, 1, CLIP_TOP_BIT ); + CLIP( +, 1, CLIP_BOTTOM_BIT ); + CLIP( -, 2, CLIP_FAR_BIT ); + CLIP( +, 2, CLIP_NEAR_BIT ); + + /* Convert the planar polygon to a list of triangles */ + out = inlist[in]; + + for ( i = 2 ; i < n ; i++ ) { + elts[0] = out[0]; + elts[1] = out[i-1]; + elts[2] = out[i]; + elts += 3; + } + + *p_next_vert = next_vert; + *p_elts = elts; +} + + +static __inline void tdfx_line_clip( GLuint **p_elts, + tdfxVertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + tdfx_interp_func interp ) +{ + GLuint *elts = *p_elts; + GLfloat *I = verts[elts[0]].f; + GLfloat *J = verts[elts[1]].f; + GLuint next_vert = *p_next_vert; + + LINE_CLIP( 1, 0, 0, -1, CLIP_LEFT_BIT ); + LINE_CLIP( -1, 0, 0, 1, CLIP_RIGHT_BIT ); + LINE_CLIP( 0, 1, 0, -1, CLIP_TOP_BIT ); + LINE_CLIP( 0, -1, 0, 1, CLIP_BOTTOM_BIT ); + LINE_CLIP( 0, 0, 1, -1, CLIP_FAR_BIT ); + LINE_CLIP( 0, 0, -1, 1, CLIP_NEAR_BIT ); + + *p_next_vert = next_vert; + *p_elts += 2; +} + + +#define CLIP_POINT( e ) \ +do { \ + if ( mask[e] ) *out++ = e; \ +} while (0) + +#define CLIP_LINE( e1, e0 ) \ +do { \ + GLubyte ormask = mask[e0] | mask[e1]; \ + out[0] = e1; \ + out[1] = e0; \ + out += 2; \ + if ( ormask ) { \ + out-=2; \ + if ( !(mask[e0] & mask[e1]) ) { \ + tdfx_line_clip( &out, verts, mask, \ + &next_vert, ormask, interp ); \ + } \ + } \ +} while (0) + +#define CLIP_TRIANGLE( e2, e1, e0 ) \ +do { \ + GLubyte ormask; \ + out[0] = e2; \ + out[1] = e1; \ + out[2] = e0; \ + out += 3; \ + ormask = mask[e2] | mask[e1] | mask[e0]; \ + if ( ormask ) { \ + out -= 3; \ + if ( !(mask[e2] & mask[e1] & mask[e0]) ) { \ + tdfx_tri_clip( &out, verts, mask, \ + &next_vert, ormask, interp ); \ + } \ + } \ +} while (0) + + + +/* Build a table of functions to clip each primitive type. These + * produce a list of elements in the appropriate 'reduced' primitive, + * ie (points, lines, triangles) containing all the clipped and + * unclipped primitives from the original list. + */ +#define LOCAL_VARS \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx); \ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); \ + GLuint *elt = VB->EltPtr->data; \ + tdfxVertexPtr verts = fxVB->verts; \ + GLuint next_vert = fxVB->last_vert; \ + GLuint *out = fxVB->clipped_elements.data; \ + GLubyte *mask = VB->ClipMask; \ + tdfx_interp_func interp = fxMesa->interp; \ + (void) interp; (void) verts; + +#define POSTFIX \ + fxVB->clipped_elements.count = out - fxVB->clipped_elements.data; \ + fxVB->last_vert = next_vert; + + +#define INIT( x ) + +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint i; \ + for ( i = start ; i < count ; i++ ) \ + CLIP_POINT( elt[i] ); \ +} while (0) + +#define RENDER_LINE( i1, i0 ) \ +do { \ + CLIP_LINE( elt[i1], elt[i0] ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i0, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ + if ( parity ) e2 = elt[i1], e1 = elt[i2]; \ + CLIP_TRIANGLE( e2, e1, e0 ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i0, pv ) \ +do { \ + CLIP_TRIANGLE( elt[i3], elt[i2], elt[i0] ); \ + CLIP_TRIANGLE( elt[i2], elt[i1], elt[i0] ); \ +} while (0) + +#define TAG(x) tdfx_##x##_clip_elt +#include "render_tmp.h" + + + + +/* Pack rgba and/or texture into the remaining half of a 32 byte vertex. + */ +#define CLIP_UBYTE_COLOR 4 +#define CLIP_UBYTE_B 0 +#define CLIP_UBYTE_G 1 +#define CLIP_UBYTE_R 2 +#define CLIP_UBYTE_A 3 +#define CLIP_S0 6 +#define CLIP_T0 7 +#define CLIP_S1 8 +#define CLIP_T1 9 + +#define TYPE (0) +#define TAG(x) x +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT) +#define TAG(x) x##_RGBA +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_TEX0_BIT) +#define TAG(x) x##_TEX0 +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT | TDFX_TEX0_BIT) +#define TAG(x) x##_RGBA_TEX0 +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT | TDFX_TEX0_BIT | TDFX_TEX1_BIT) +#define TAG(x) x##_RGBA_TEX0_TEX1 +#include "tdfx_fasttmp.h" + +/* This one *could* get away with sneaking TEX1 into the color and + * specular slots, thus fitting inside a cache line. Would be even + * better to switch to a smaller vertex. + */ +#define TYPE (TDFX_TEX0_BIT | TDFX_TEX1_BIT) +#define TAG(x) x##_TEX0_TEX1 +#include "tdfx_fasttmp.h" + + + +/* Render elements directly from original list of vertices. + */ +static void tdfx_render_elements_direct( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_smooth_direct[prim]; + GLuint p = 0; + + if ( fxMesa->new_state ) + tdfxDDUpdateHwState( ctx ); + + BEGIN_CLIP_LOOP( fxMesa ); + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + END_CLIP_LOOP( fxMesa ); +} + +/* Render elements indirectly from original list of vertices. + */ +#if 0 +static void tdfx_render_elements_indirect( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_smooth_indirect[prim]; + GLuint p = 0; + + if ( fxMesa->new_state ) + tdfxDDUpdateHwState( ctx ); + + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + + BEGIN_CLIP_LOOP( fxMesa ); + grDrawVertexArray( GR_TRIANGLES, fxVB->last_elt, fxVB->elts ); + END_CLIP_LOOP( fxMesa ); + + fxVB->last_elt = 0; +} +#endif + +/* Very sparsely popluated array - fix the indices. + */ +static struct tdfx_fast_tab fxFastTab[0x80]; + +void tdfxDDFastPathInit( void ) +{ + tdfx_render_init_clip_elt(); + tdfx_render_init_smooth_direct(); + tdfx_render_init_smooth_indirect(); + + tdfx_init_fastpath( &fxFastTab[0] ); + tdfx_init_fastpath_RGBA( &fxFastTab[TDFX_RGBA_BIT] ); + tdfx_init_fastpath_TEX0( &fxFastTab[TDFX_TEX0_BIT] ); + tdfx_init_fastpath_RGBA_TEX0( &fxFastTab[TDFX_RGBA_BIT|TDFX_TEX0_BIT] ); + tdfx_init_fastpath_TEX0_TEX1( &fxFastTab[TDFX_TEX0_BIT|TDFX_TEX1_BIT] ); + tdfx_init_fastpath_RGBA_TEX0_TEX1( &fxFastTab[TDFX_RGBA_BIT|TDFX_TEX0_BIT| + TDFX_TEX1_BIT] ); +} + + +#define VALID_SETUP (TDFX_RGBA_BIT | TDFX_TEX0_BIT | TDFX_TEX1_BIT) + + +void tdfxDDFastPath( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + GLenum prim = ctx->CVA.elt_mode; + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + struct tdfx_fast_tab *tab = &fxFastTab[fxMesa->SetupIndex & VALID_SETUP]; + + if ( fxMesa->new_state ) { + tdfxDDUpdateHwState( ctx ); + } + else if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) { + /* After extensive debugging I discovered that the vertex layout + * may need to be updated at this point. Not sure how this works + * in the other drivers. -BP + */ + LOCK_HARDWARE( fxMesa ); + grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] ); + fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT; + UNLOCK_HARDWARE( fxMesa ); + } + + gl_prepare_arrays_cva( VB ); /* still need this */ + + /* Reserve enough space for the pathological case */ + if ( VB->EltPtr->count * 12 > fxVB->size ) + tdfxDDResizeVB( VB, VB->EltPtr->count * 12 ); + + tab->build_vertices( VB, 1 ); /* object->clip space */ + + if ( VB->ClipOrMask ) { + if ( !VB->ClipAndMask ) { + render_func *clip = tdfx_render_tab_clip_elt; + + fxMesa->interp = tab->interp; + + clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* build new elts */ + + ctx->CVA.elt_mode = gl_reduce_prim[prim]; + VB->EltPtr = &(fxVB->clipped_elements); + + tab->project_clipped_vertices( VB ); /* clip->device space */ + tdfx_render_elements_direct( VB ); /* render using new list */ + } + } else { + tab->project_vertices( VB ); /* clip->device space */ + tdfx_render_elements_direct( VB ); /* render using orig list */ + } + + /* This indicates that there is no cached data to reuse */ + VB->pipeline->data_valid = 0; + VB->pipeline->new_state = 0; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h new file mode 100644 index 000000000..24abcb4eb --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h @@ -0,0 +1,293 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +/* The first part of setup is applied to all vertices, clipped or + * unclipped. This data will be used for clipping, and then all + * vertices with a zero clipmask will be projected to device space. + * + * This could be split into several loops, but - it seems that the + * large stride of the fxVertices makes cache issues the big + * performance factor, and that multiple loops mean multiple cache + * misses.... + */ + +static void TAG(tdfx_setup_full)( struct vertex_buffer *VB, + GLuint do_cliptest ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLfloat * const m = ctx->ModelProjectMatrix.m; + GLuint start = VB->CopyStart; + GLuint count = VB->Count; + + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + gl_xform_points3_v16_general( TDFX_DRIVER_DATA(VB)->verts[start].f, + m, + VB->ObjPtr->start, + VB->ObjPtr->stride, + count - start ); + + if ( do_cliptest ) { + VB->ClipAndMask = ~0; + VB->ClipOrMask = 0; + gl_cliptest_points4_v16( fxVB->verts[start].f, + fxVB->verts[count].f, + &(VB->ClipOrMask), + &(VB->ClipAndMask), + VB->ClipMask + start ); + } + + /* These branches are all resolved at compile time. Hopefully all + * the pointers are valid addresses even when not enabled. + */ + if ( TYPE ) { + GLubyte *color = VB->ColorPtr->start; + GLfloat *tex0_data = VB->TexCoordPtr[fxMesa->tmu_source[0]]->start; + GLfloat *tex1_data = VB->TexCoordPtr[fxMesa->tmu_source[1]]->start; + + const GLuint color_stride = VB->ColorPtr->stride; + const GLuint tex0_stride = VB->TexCoordPtr[fxMesa->tmu_source[0]]->stride; + const GLuint tex1_stride = VB->TexCoordPtr[fxMesa->tmu_source[1]]->stride; + + GLfloat *f = fxVB->verts[start].f; + GLfloat *end = f + (16 * (count - start)); + + while ( f != end ) { + if ( TYPE & TDFX_RGBA_BIT ) { +#if defined(USE_X86_ASM) + __asm__ ( + "movl (%%edx),%%eax \n" + "bswap %%eax \n" + "rorl $8,%%eax \n" + "movl %%eax,16(%%edi) \n" + : + : "d" (color), "D" (f) + : "%eax" ); +#else + GLubyte *col = color; + GLubyte *b = (GLubyte *)&f[CLIP_UBYTE_COLOR]; + b[CLIP_UBYTE_B] = col[2]; + b[CLIP_UBYTE_G] = col[1]; + b[CLIP_UBYTE_R] = col[0]; + b[CLIP_UBYTE_A] = col[3]; +#endif + } + if (TYPE & TDFX_TEX0_BIT) { +#if defined (USE_X86_ASM) + __asm__ ( + "movl (%%ecx), %%eax \n" + "movl %%eax, 24(%%edi) \n" + "movl 4(%%ecx), %%eax \n" + "movl %%eax, 28(%%edi)" + : + : "c" (tex0_data), "D" (f) + : "%eax"); +#else + *(unsigned int *)(f+CLIP_S0) = *(unsigned int *)tex0_data; + *(unsigned int *)(f+CLIP_T0) = *(unsigned int *)(tex0_data+1); +#endif + } + if (TYPE & TDFX_TEX1_BIT) { + /* Hits a second cache line. + */ +#if defined (USE_X86_ASM) + __asm__ ( + "movl (%%esi), %%eax \n" + "movl %%eax, 32(%%edi) \n" + "movl 4(%%esi), %%eax \n" + "movl %%eax, 36(%%edi)" + : + : "S" (tex1_data), "D" (f) + : "%eax"); +#else + *(unsigned int *)(f+CLIP_S1) = *(unsigned int *)tex1_data; + *(unsigned int *)(f+CLIP_T1) = *(unsigned int *)(tex1_data+1); +#endif + } + if ( TYPE & TDFX_RGBA_BIT ) color += color_stride; + if ( TYPE & TDFX_TEX0_BIT ) STRIDE_F( tex0_data, tex0_stride ); + if ( TYPE & TDFX_TEX1_BIT ) STRIDE_F( tex1_data, tex1_stride ); + f += 16; + } + } + + fxVB->clipped_elements.count = start; + fxVB->last_vert = count; +} + + +/* Changed to just put the interp func instead of the whole clip + * routine into the header. Less code and better chance of doing some + * of this stuff in assembly. + */ +static void TAG(tdfx_interp_vert)( GLfloat t, + GLfloat *O, + const GLfloat *I, + const GLfloat *J ) +{ + O[0] = LINTERP( t, I[0], J[0] ); + O[1] = LINTERP( t, I[1], J[1] ); + O[2] = LINTERP( t, I[2], J[2] ); + O[3] = LINTERP( t, I[3], J[3] ); + + if ( TYPE & TDFX_RGBA_BIT ) { + INTERP_RGBA( t, + ((GLubyte *)&(O[4])), + ((GLubyte *)&(I[4])), + ((GLubyte *)&(J[4])) ); + } + + if ( TYPE & TDFX_TEX0_BIT ) { + O[6] = LINTERP( t, I[6], J[6] ); + O[7] = LINTERP( t, I[7], J[7] ); + } + + if ( TYPE & TDFX_TEX1_BIT ) { + O[8] = LINTERP( t, I[8], J[8] ); + O[9] = LINTERP( t, I[9], J[9] ); + } +} + + + +static void TAG(tdfx_project_vertices)( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLfloat *first = fxVB->verts[VB->CopyStart].f; + GLfloat *last = fxVB->verts[fxVB->last_vert].f; + GLfloat m[16]; + GLfloat *f; + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET; + m[MAT_SY] = mat->m[MAT_SY]; + m[MAT_TY] = mat->m[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET; + m[MAT_SZ] = mat->m[MAT_SZ]; + m[MAT_TZ] = mat->m[MAT_TZ]; + + gl_project_v16( first, last, m, 16 * 4 ); + + /* V3 at least requires texcoords to be multiplied by 1/w: + */ + if ( TYPE & (TDFX_TEX0_BIT|TDFX_TEX1_BIT) ) { + + const GLfloat sScale0 = fxMesa->sScale0; + const GLfloat tScale0 = fxMesa->tScale0; + const GLfloat sScale1 = fxMesa->sScale1; + const GLfloat tScale1 = fxMesa->tScale1; + + + for ( f = first ; f != last ; f += 16) { + const GLfloat oow = f[3]; + + if (TYPE & TDFX_TEX0_BIT) { + f[CLIP_S0] *= sScale0 * oow; + f[CLIP_T0] *= tScale0 * oow; + } + + if (TYPE & TDFX_TEX1_BIT) { + f[CLIP_S1] *= sScale1 * oow; + f[CLIP_T1] *= tScale1 * oow; + } + } + } +} + +static void TAG(tdfx_project_clipped_vertices)( struct vertex_buffer *VB ) +{ + GLfloat *f; + + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLfloat *first = fxVB->verts[VB->CopyStart].f; + GLfloat *last = fxVB->verts[fxVB->last_vert].f; + const GLubyte *mask = VB->ClipMask + VB->CopyStart; + GLfloat m[16]; + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET; + m[MAT_SY] = mat->m[MAT_SY]; + m[MAT_TY] = mat->m[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET; + m[MAT_SZ] = mat->m[MAT_SZ]; + m[MAT_TZ] = mat->m[MAT_TZ]; + + gl_project_clipped_v16( first, last, m, 16 * 4, mask ); + + /* V3 at least requires texcoords to be multiplied by 1/w: + */ + if ( TYPE & (TDFX_TEX0_BIT|TDFX_TEX1_BIT) ) { + + const GLfloat sScale0 = fxMesa->sScale0; + const GLfloat tScale0 = fxMesa->tScale0; + const GLfloat sScale1 = fxMesa->sScale1; + const GLfloat tScale1 = fxMesa->tScale1; + + for ( f = first ; f != last ; f += 16, mask++) { + if (!*mask) { + const GLfloat oow = f[3]; + if (TYPE & TDFX_TEX0_BIT) { + f[CLIP_S0] *= sScale0 * oow; + f[CLIP_T0] *= tScale0 * oow; + } + + if (TYPE & TDFX_TEX1_BIT) { + f[CLIP_S1] *= sScale1 * oow; + f[CLIP_T1] *= tScale1 * oow; + } + } + } + } +} + +static void TAG(tdfx_init_fastpath)( struct tdfx_fast_tab *tab ) +{ + tab->build_vertices = TAG(tdfx_setup_full); + tab->interp = TAG(tdfx_interp_vert); + tab->project_vertices = TAG(tdfx_project_vertices); + tab->project_clipped_vertices = TAG(tdfx_project_clipped_vertices); +} + +#undef TYPE +#undef TAG +#undef SIZE diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c new file mode 100644 index 000000000..1f49142be --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c @@ -0,0 +1,122 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include <stdlib.h> +#include <string.h> +#include <dlfcn.h> + +#include "tdfx_context.h" +#include "tdfx_g3ext.h" + + +/* STENCIL extension + */ +GrProc grStencilFuncProc = NULL; +GrProc grStencilMaskProc = NULL; +GrProc grStencilOpProc = NULL; +GrProc grBufferClearExtProc = NULL; +GrProc grColorMaskExtProc = NULL; + +/* COMBINE extension + */ +GrProc grColorCombineExtProc = NULL; +GrProc grTexColorCombineExtProc = NULL; +GrProc grAlphaCombineExtProc = NULL; +GrProc grTexAlphaCombineExtProc = NULL; +GrProc grAlphaBlendFunctionExtProc = NULL; +GrProc grConstantColorValueExtProc = NULL; + +/* Texus 2 + */ +GrProc txImgQuantizeProc = NULL; +GrProc txImgDequantizeFXT1Proc = NULL; +GrProc txErrorSetCallbackProc = NULL; + + +/* Initialize the Glide extensions not exported in the Glide headers. + * This is just plain evil stuff... + */ +void tdfxDDGlideExtensionsInit( void ) +{ + void *handle; + + /* Get Glide3 extension function pointers */ + handle = dlopen( NULL, RTLD_NOW | RTLD_GLOBAL ); + + if ( handle ) { + /* PIXEXT extension */ + grStencilFuncProc = dlsym( handle, "grStencilFunc" ); + grStencilMaskProc = dlsym( handle, "grStencilMask" ); + grStencilOpProc = dlsym( handle, "grStencilOp" ); + grBufferClearExtProc = dlsym( handle, "grBufferClearExt" ); + grColorMaskExtProc = dlsym( handle, "grColorMaskExt" ); + + /* COMBINE extension */ + grColorCombineExtProc = dlsym( handle, "grColorCombineExt" ); + grTexColorCombineExtProc = dlsym( handle, "grTexColorCombineExt" ); + grAlphaCombineExtProc = dlsym( handle, "grAlphaCombineExt" ); + grTexAlphaCombineExtProc = dlsym( handle, "grTexAlphaCombineExt" ); + grAlphaBlendFunctionExtProc = dlsym( handle, "grAlphaBlendFunctionExt" ); + grConstantColorValueExtProc = dlsym( handle, "grConstantColorValueExt" ); + + /* Texus 2 */ + txImgQuantizeProc = dlsym( handle, "txImgQuantize" ); + txImgDequantizeFXT1Proc = dlsym( handle, "_txImgDequantizeFXT1" ); + txErrorSetCallbackProc = dlsym( handle, "txErrorSetCallback" ); + } else { + /* PIXEXT extension */ + grStencilFuncProc = NULL; + grStencilMaskProc = NULL; + grStencilOpProc = NULL; + grBufferClearExtProc = NULL; + grColorMaskExtProc = NULL; + + /* COMBINE extension */ + grColorCombineExtProc = NULL; + grTexColorCombineExtProc = NULL; + grAlphaCombineExtProc = NULL; + grTexAlphaCombineExtProc = NULL; + grAlphaBlendFunctionExtProc = NULL; + grConstantColorValueExtProc = NULL; + + /* Texus 2 */ + txImgQuantizeProc = NULL; + txImgDequantizeFXT1Proc = NULL; + txErrorSetCallbackProc = NULL; + } + + dlclose( handle ); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h new file mode 100644 index 000000000..29cfc0907 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h @@ -0,0 +1,145 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_G3EXT_H__ +#define __TDFX_G3EXT_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <glide.h> +#include <g3ext.h> + +/* + * These are glide extension definitions. These are not + * defined in glide.h. They should really be defined in + * g3ext.h, but they are not. + */ +typedef void (*grStencilFunc_t)( GrCmpFnc_t fnc, GrStencil_t ref, + GrStencil_t mask ); +typedef void (*grStencilMask_t)( GrStencil_t write_mask ); +typedef void (*grStencilOp_t)( GrStencilOp_t stencil_fail, + GrStencilOp_t depth_fail, + GrStencilOp_t depth_pass ); +typedef void (*grBufferClearExt_t)( GrColor_t color, GrAlpha_t alpha, + FxU32 depth, GrStencil_t stencil ); +typedef void (*grColorMaskExt_t)( FxBool r, FxBool g, FxBool b, FxBool a ); + +/* + * "COMBINE" extension for Napalm + */ +typedef void (*grColorCombineExt_t)( GrCCUColor_t a, GrCombineMode_t a_mode, + GrCCUColor_t b, GrCombineMode_t b_mode, + GrCCUColor_t c, FxBool c_invert, + GrCCUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grTexColorCombineExt_t)( FxU32 tmu, + GrTCCUColor_t a, + GrCombineMode_t a_mode, + GrTCCUColor_t b, + GrCombineMode_t b_mode, + GrTCCUColor_t c, FxBool c_invert, + GrTCCUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grAlphaCombineExt_t)( GrACUColor_t a, GrCombineMode_t a_mode, + GrACUColor_t b, GrCombineMode_t b_mode, + GrACUColor_t c, FxBool c_invert, + GrACUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grTexAlphaCombineExt_t)( FxU32 tmu, + GrTACUColor_t a, + GrCombineMode_t a_mode, + GrTACUColor_t b, + GrCombineMode_t b_mode, + GrTACUColor_t c, FxBool c_invert, + GrTACUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grAlphaBlendFunctionExt_t)( GrAlphaBlendFnc_t rgb_sf, + GrAlphaBlendFnc_t rgb_df, + GrAlphaBlendOp_t rgb_op, + GrAlphaBlendFnc_t alpha_sf, + GrAlphaBlendFnc_t alpha_df, + GrAlphaBlendOp_t alpha_op); +typedef void (*grConstantColorValueExt_t)( FxU32 tmu, GrColor_t value ); + + + +/* + * These are functions to compress and decompress images. + * The types of the first and second parameters are not exactly + * right. The texus library declares them to be "char *", not + * "void *". However, "void *" is more correct, and more convenient. + */ +typedef void (*txImgQuantize_t)( void *dst, void *src, + int w, int h, + FxU32 format, FxU32 dither ); +typedef void (*txImgDeQuantize_t)( void *dst, void *src, int w, int h ); + +/* + * These next three declarations should probably be taken from + * texus.h. However, there are duplicate declarations in g3ext.h + * and texus.h which make it hard to include them both. + */ +typedef void (*TxErrorCallbackFnc_t)( const char *string, FxBool fatal ); +typedef void (*txErrorSetCallback_t)( TxErrorCallbackFnc_t fnc, + TxErrorCallbackFnc_t *old_fnc ); + +/* PIXEXT extension + */ +GrProc grStencilFuncProc; +GrProc grStencilMaskProc; +GrProc grStencilOpProc; +GrProc grBufferClearExtProc; +GrProc grColorMaskExtProc; + +/* COMBINE extension + */ +GrProc grColorCombineExtProc; +GrProc grTexColorCombineExtProc; +GrProc grAlphaCombineExtProc; +GrProc grTexAlphaCombineExtProc; +GrProc grAlphaBlendFunctionExtProc; +GrProc grConstantColorValueExtProc; + +/* Texus extensions??? + */ +GrProc txImgQuantizeProc; +GrProc txImgDequantizeFXT1Proc; +GrProc txErrorSetCallbackProc; + +extern void tdfxDDGlideExtensionsInit( void ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c deleted file mode 100644 index 0c0ae8b0c..000000000 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -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, sub license, 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 (including the -next paragraph) 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_init.c,v 1.5 2000/09/26 15:56:50 tsi Exp $ */ - -/* - * Authors: - * Daryll Strauss <daryll@precisioninsight.com> - * - */ - -#ifdef GLX_DIRECT_RENDERING - -#include <X11/Xlibint.h> -#include "xf86dri.h" -#include "tdfx_dri.h" -#include "fxdrv.h" - - -#ifdef DEBUG_LOCKING -char *prevLockFile = 0; -int prevLockLine = 0; -#endif - -static void -performMagic(__DRIscreenPrivate * driScrnPriv) -{ - tdfxScreenPrivate *gPriv = (tdfxScreenPrivate *) driScrnPriv->private; - TDFXDRIPtr gDRIPriv = (TDFXDRIPtr) driScrnPriv->pDevPriv; - - gPriv->regs.handle = gDRIPriv->regs; - gPriv->regs.size = gDRIPriv->regsSize; - gPriv->deviceID = gDRIPriv->deviceID; - gPriv->width = gDRIPriv->width; - gPriv->height = gDRIPriv->height; - gPriv->mem = gDRIPriv->mem; - gPriv->cpp = gDRIPriv->cpp; - gPriv->stride = gDRIPriv->stride; - gPriv->fifoOffset = gDRIPriv->fifoOffset; - gPriv->fifoSize = gDRIPriv->fifoSize; - gPriv->fbOffset = gDRIPriv->fbOffset; - gPriv->backOffset = gDRIPriv->backOffset; - gPriv->depthOffset = gDRIPriv->depthOffset; - gPriv->textureOffset = gDRIPriv->textureOffset; - gPriv->textureSize = gDRIPriv->textureSize; -} - -GLboolean -tdfxMapAllRegions(__DRIscreenPrivate * driScrnPriv) -{ - tdfxScreenPrivate *gPriv = (tdfxScreenPrivate *) driScrnPriv->private; - - /* First, pick apart pDevPriv & friends */ - performMagic(driScrnPriv); - - if (drmMap(driScrnPriv->fd, gPriv->regs.handle, gPriv->regs.size, - &gPriv->regs.map)) { - return GL_FALSE; - } - - return GL_TRUE; -} - -void -tdfxUnmapAllRegions(__DRIscreenPrivate * driScrnPriv) -{ - tdfxScreenPrivate *gPriv = (tdfxScreenPrivate *) driScrnPriv->private; - - drmUnmap(gPriv->regs.map, gPriv->regs.size); -} - - -#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c new file mode 100644 index 000000000..f63541be9 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c @@ -0,0 +1,96 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_lock.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" +#include "tdfx_tris.h" + + +void tdfxGetLock( tdfxContextPtr fxMesa ) +{ + __DRIcontextPrivate *cPriv = fxMesa->driContext; + __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; + __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; + TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + + sizeof(XF86DRISAREARec)); + int stamp = dPriv->lastStamp; + int one_rect = (fxMesa->numClipRects <= 1); + + drmGetLock( fxMesa->driFd, fxMesa->hHWContext, 0 ); + + /* This macro will update dPriv's cliprects if needed */ + XMESA_VALIDATE_DRAWABLE_INFO( cPriv->display, sPriv, dPriv ); + + if ( saPriv->fifoOwner != fxMesa->hHWContext ) { + grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead ); + } + + if ( saPriv->ctxOwner != fxMesa->hHWContext ) { + /* This sequence looks a little odd. Glide mirrors the state, and + * when you get the state you are forcing the mirror to be up to + * date, and then getting a copy from the mirror. You can then force + * that state onto the hardware when you set the state. + */ + void *state; + state = malloc( FX_grGetInteger_NoLock( FX_GLIDE_STATE_SIZE ) ); + FX_grGlideGetState_NoLock( state ); + FX_grGlideSetState_NoLock( state ); + free( state ); + } + +#if 0 + if ( saPriv->texOwner != fxMesa->hHWContext ) { + tdfxTMRestoreTextures_NoLock( fxMesa ); + } +#endif + + if ( *dPriv->pStamp != stamp || saPriv->ctxOwner != fxMesa->hHWContext ) { + tdfxUpdateClipping(fxMesa->glCtx); + tdfxUploadClipping(fxMesa); + } + + /* Detect if we have swapped between 1 and >1 cliprects, and change + * triangle funcs if necessary. + */ + if (one_rect != (fxMesa->numClipRects <= 1)) + tdfxDDToggleTriCliprects( fxMesa->glCtx ); + + DEBUG_LOCK(); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h new file mode 100644 index 000000000..3cfa52c0e --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h @@ -0,0 +1,149 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_LOCK_H__ +#define __TDFX_LOCK_H__ + +#ifdef GLX_DIRECT_RENDERING + +/* You can turn this on to find locking conflicts. + */ +#define DEBUG_LOCKING 0 + +#if DEBUG_LOCKING +extern char *prevLockFile; +extern int prevLockLine; + +#define DEBUG_LOCK() \ + do { \ + prevLockFile = (__FILE__); \ + prevLockLine = (__LINE__); \ + } while (0) + +#define DEBUG_RESET() \ + do { \ + prevLockFile = 0; \ + prevLockLine = 0; \ + } while (0) + +#define DEBUG_CHECK_LOCK() \ + do { \ + if ( prevLockFile ) { \ + fprintf( stderr, \ + "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \ + prevLockFile, prevLockLine, __FILE__, __LINE__ ); \ + exit( 1 ); \ + } \ + } while (0) + +#else + +#define DEBUG_LOCK() +#define DEBUG_RESET() +#define DEBUG_CHECK_LOCK() + +#endif /* DEBUG_LOCKING */ + + +extern void tdfxGetLock( tdfxContextPtr fxMesa ); + + +/* !!! We may want to separate locks from locks with validation. + This could be used to improve performance for those things + commands that do not do any drawing !!! */ + +#define DRM_LIGHT_LOCK_RETURN(fd,lock,context,__ret) \ + do { \ + DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \ + if (__ret) drmGetLock(fd,context,0); \ + } while(0) + +#define LOCK_HARDWARE( fxMesa ) \ + do { \ + char __ret = 0; \ + \ + DEBUG_CHECK_LOCK(); \ + DRM_CAS( fxMesa->driHwLock, fxMesa->hHWContext, \ + DRM_LOCK_HELD | fxMesa->hHWContext, __ret ); \ + if ( __ret ) { \ + tdfxGetLock( fxMesa ); \ + } \ + DEBUG_LOCK(); \ + } while (0) + +/* Unlock the hardware using the global current context */ +#define UNLOCK_HARDWARE( fxMesa ) \ + do { \ + DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); \ + DEBUG_RESET(); \ + } while (0) + +/* + * This pair of macros makes a loop over the drawing operations + * so it is not self contained and doesn't have the nice single + * statement semantics of most macros. + */ +#define BEGIN_CLIP_LOOP(fxMesa) \ + do { \ + LOCK_HARDWARE( fxMesa ); \ + BEGIN_CLIP_LOOP_LOCKED( fxMesa ) + +#define BEGIN_CLIP_LOOP_LOCKED(fxMesa) \ + do { \ + int _nc = fxMesa->numClipRects; \ + while (_nc--) { \ + if (fxMesa->numClipRects > 1) { \ + int _height = fxMesa->screen_height; \ + grClipWindow(fxMesa->pClipRects[_nc].x1, \ + _height - fxMesa->pClipRects[_nc].y2, \ + fxMesa->pClipRects[_nc].x2, \ + _height - fxMesa->pClipRects[_nc].y1); \ + } + + +#define END_CLIP_LOOP_LOCKED( fxMesa ) \ + } \ + } while (0) + +#define END_CLIP_LOOP( fxMesa ) \ + END_CLIP_LOOP_LOCKED( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + } while (0) + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_LOCK_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c new file mode 100644 index 000000000..b26e174c8 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c @@ -0,0 +1,177 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_pipeline.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" + +#include "vbindirect.h" + +static struct gl_pipeline_stage tdfx_fast_stage = { + "TDFX Fast Path", + (PIPE_OP_VERT_XFORM | + PIPE_OP_RAST_SETUP_0 | + PIPE_OP_RAST_SETUP_1 | + PIPE_OP_RENDER), + PIPE_PRECALC, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + tdfxDDFastPath +}; + +#define ILLEGAL_ENABLES (TEXTURE0_3D | \ + TEXTURE1_3D | \ + ENABLE_TEXMAT0 | \ + ENABLE_TEXMAT1 | \ + ENABLE_TEXGEN0 | \ + ENABLE_TEXGEN1 | \ + ENABLE_USERCLIP | \ + ENABLE_LIGHT | \ + ENABLE_FOG) + +/* Build the PRECALC pipeline with our stage, if possible. Otherwise, + * return GL_FALSE. + */ +GLboolean tdfxDDBuildPrecalcPipeline( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_pipeline *pipe = &ctx->CVA.pre; + + if ( (fxMesa->RenderIndex & ~TDFX_CLIPRECT_BIT) == 0 && + (ctx->Enabled & ILLEGAL_ENABLES) == 0 && +#ifdef VAO + (ctx->Array.Current->Flags & (VERT_OBJ_234 | +#else + (ctx->Array.Flags & (VERT_OBJ_234 | +#endif + VERT_TEX0_4 | + VERT_TEX1_4 | + VERT_ELT)) == (VERT_OBJ_23 | VERT_ELT) ) + { + pipe->stages[0] = &tdfx_fast_stage; + pipe->stages[1] = 0; + pipe->new_inputs = ctx->RenderFlags & VERT_DATA; + pipe->ops = pipe->stages[0]->ops; + + fxMesa->using_fast_path = GL_TRUE; + return GL_TRUE; + } + + if ( fxMesa->using_fast_path ) { + fxMesa->using_fast_path = GL_FALSE; + + ctx->CVA.VB->ClipOrMask = 0; + ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS; +#ifdef VAO + ctx->Array.NewArrayState |= ctx->Array.Current->Summary; +#else + ctx->Array.NewArrayState |= ctx->Array.Summary; +#endif + } + + return GL_FALSE; +} + + +static void tdfxDDCheckRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *d ) +{ + d->type = PIPE_IMMEDIATE | PIPE_PRECALC; + d->inputs = ctx->RenderFlags; + + d->outputs = VERT_SETUP_FULL; + + if ( ctx->IndirectTriangles & DD_SW_SETUP ) + d->type = PIPE_IMMEDIATE; +} + + +static void tdfxDDRenderElements(struct vertex_buffer *VB) +{ + if (VB->ClipOrMask) { + gl_render_elts( VB ); + } else { + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + fxMesa->RenderElementsRaw( VB ); + } +} + + +/* Register the pipeline with our stages included */ +GLuint tdfxDDRegisterPipelineStages( struct gl_pipeline_stage *out, + const struct gl_pipeline_stage *in, + GLuint nr ) +{ + int i, o; + + for ( i = o = 0 ; i < nr ; i++ ) { + switch ( in[i].ops ) { + + case PIPE_OP_RAST_SETUP_0: + out[o] = in[i]; + out[o].cva_state_change = (NEW_LIGHTING | + NEW_TEXTURING | + NEW_RASTER_OPS); + out[o].state_change = ~0; + out[o].check = tdfxDDCheckPartialRasterSetup; + out[o].run = tdfxDDPartialRasterSetup; + o++; + break; + + case PIPE_OP_RAST_SETUP_0 | PIPE_OP_RAST_SETUP_1: + out[o] = in[i]; + out[o].check = tdfxDDCheckRasterSetup; + out[o].run = tdfxDDDoRasterSetup; + o++; + break; + + case PIPE_OP_RENDER: + out[o] = in[i]; + if (in[i].type == PIPE_PRECALC) + out[o].run = tdfxDDRenderElements; + o++; + break; + + default: + out[o++] = in[i]; + break; + } + } + + return o; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h new file mode 100644 index 000000000..a87a8cf74 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h @@ -0,0 +1,54 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_PIPELINE_H__ +#define __TDFX_PIPELINE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern GLboolean tdfxDDBuildPrecalcPipeline( GLcontext *ctx ); +extern GLuint tdfxDDRegisterPipelineStages( struct gl_pipeline_stage *out, + const struct gl_pipeline_stage *in, + GLuint nr ); + +extern void tdfxDDFastPathInit( void ); +extern void tdfxDDFastPath( struct vertex_buffer *VB ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c new file mode 100644 index 000000000..e650e6615 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c @@ -0,0 +1,638 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Nathan Hand <nhand@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_vb.h" +#include "tdfx_pipeline.h" +#include "tdfx_pixels.h" +#include "tdfx_render.h" + +#include "../../image.h" + +#if 0 +/* test if window coord (px,py) is visible */ +static GLboolean +inClipRects(tdfxContextPtr fxMesa, int px, int py) +{ + int i; + for (i = 0; i < fxMesa->numClipRects; i++) { + if ((px >= fxMesa->pClipRects[i].x1) && + (px < fxMesa->pClipRects[i].x2) && + (py >= fxMesa->pClipRects[i].y1) && + (py < fxMesa->pClipRects[i].y2)) return GL_TRUE; + } + return GL_FALSE; +} +#endif + +/* test if rectangle of pixels (px,py) (px+width,py+height) is visible */ +static GLboolean +inClipRects_Region(tdfxContextPtr fxMesa, int x, int y, int width, int height) +{ + int i; + int x1, y1, x2, y2; + int xmin, xmax, ymin, ymax, pixelsleft; + + y1 = y - height + 1; y2 = y; + x1 = x; x2 = x + width - 1; + pixelsleft = width * height; + + for (i = 0; i < fxMesa->numClipRects; i++) + { + /* algorithm requires x1 < x2 and y1 < y2 */ + if ((fxMesa->pClipRects[i].x1 < fxMesa->pClipRects[i].x2)) { + xmin = fxMesa->pClipRects[i].x1; + xmax = fxMesa->pClipRects[i].x2-1; + } else { + xmin = fxMesa->pClipRects[i].x2; + xmax = fxMesa->pClipRects[i].x1-1; + } + if ((fxMesa->pClipRects[i].y1 < fxMesa->pClipRects[i].y2)) { + ymin = fxMesa->pClipRects[i].y1; + ymax = fxMesa->pClipRects[i].y2-1; + } else { + ymin = fxMesa->pClipRects[i].y2; + ymax = fxMesa->pClipRects[i].y1-1; + } + + /* reject trivial cases */ + if (xmax < x1) continue; + if (ymax < y1) continue; + if (xmin > x2) continue; + if (ymin > y2) continue; + + /* find the intersection */ + if (xmin < x1) xmin = x1; + if (ymin < y1) ymin = y1; + if (xmax > x2) xmax = x2; + if (ymax > y2) ymax = y2; + + pixelsleft -= (xmax-xmin+1) * (ymax-ymin+1); + } + + return pixelsleft == 0; +} + +#if 0 +GLboolean +tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte * bitmap) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + TdfxU16 color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if (ctx->RasterMask & (ALPHATEST_BIT | + BLEND_BIT | + DEPTH_BIT | + FOG_BIT | + LOGIC_OP_BIT | + SCISSOR_BIT | + STENCIL_BIT | + MASKING_BIT | + ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return GL_TRUE; /* totally scissored away */ + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); + /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f); */ + if (fxMesa->bgrOrder) { + color = (TdfxU16) + (((TdfxU16) 0xf8 & b) << (11 - 3)) | + (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) | + (((TdfxU16) 0xf8 & r) >> 3); + } + else + color = (TdfxU16) + (((TdfxU16) 0xf8 & r) << (11 - 3)) | + (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) | + (((TdfxU16) 0xf8 & b) >> 3); + } + + info.size = sizeof(info); + if (!TDFX_grLfbLock(fxMesa, + GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_565, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { +#ifndef TDFX_SILENT + fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n"); +#endif + return GL_TRUE; + } + + { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + /* The dest stride depends on the hardware and whether we're drawing + * to the front or back buffer. This compile-time test seems to do + * the job for now. + */ + const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 2); + GLint row; + /* compute dest address of bottom-left pixel in bitmap */ + GLushort *dst = (GLushort *) info.lfbPtr + + (winY - py) * dstStride + (winX + px); + + for (row = 0; row < height; row++) { + const GLubyte *src = + (const GLubyte *) _mesa_image_address(finalUnpack, + bitmap, width, height, + GL_COLOR_INDEX, + GL_BITMAP, 0, row, 0); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + + TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); + return GL_TRUE; +} +#endif + +#if 0 +GLboolean +tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte * bitmap) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLuint color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if (ctx->RasterMask & (ALPHATEST_BIT | + BLEND_BIT | + DEPTH_BIT | + FOG_BIT | + LOGIC_OP_BIT | + SCISSOR_BIT | + STENCIL_BIT | + MASKING_BIT | + ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return GL_TRUE; /* totally scissored away */ + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); + GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0f); + color = PACK_BGRA32(r, g, b, a); + } + + info.size = sizeof(info); + if (!TDFX_grLfbLock(fxMesa, GR_LFB_WRITE_ONLY, + fxMesa->currentFB, GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { +#ifndef TDFX_SILENT + fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n"); +#endif + return GL_TRUE; + } + + { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + GLint dstStride; + GLuint *dst; + GLint row; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + dstStride = fxMesa->screen_width; + dst = + (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + + px); + } + else { + dstStride = info.strideInBytes / 4; + dst = + (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + + px); + } + + /* compute dest address of bottom-left pixel in bitmap */ + for (row = 0; row < height; row++) { + const GLubyte *src = + (const GLubyte *) _mesa_image_address(finalUnpack, + bitmap, width, height, + GL_COLOR_INDEX, + GL_BITMAP, 0, row, 0); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + + TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); + return GL_TRUE; +} +#endif + +GLboolean +tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid * dstImage) +{ + if (!(format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5)) { + return GL_FALSE; /* format/type not recognised */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + LOCK_HARDWARE( fxMesa ); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->ReadBuffer, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == + GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2); + const GLushort *src = (const GLushort *) info.lfbPtr + + scrY * srcStride + scrX; + const GLubyte *dst = (GLubyte *) _mesa_image_address(packing, + dstImage, width, height, format, type, 0, 0, 0); + const GLint dstStride = _mesa_image_row_stride(packing, + width, format, type); + + if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { + /* directly memcpy 5R6G5B pixels into client's buffer */ + const GLint widthInBytes = width * 2; + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer); + } + UNLOCK_HARDWARE( fxMesa ); + return result; + } +} + +GLboolean +tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid * dstImage) +{ + if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) && + !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + return GL_FALSE; /* format/type not optimised */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + LOCK_HARDWARE(fxMesa); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->ReadBuffer, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) + { + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 4); + const GLuint *src = (const GLuint *) info.lfbPtr + + scrY * srcStride + scrX; + const GLint dstStride = + _mesa_image_row_stride(packing, width, format, type); + const GLubyte *dst = (GLubyte *) _mesa_image_address(packing, + dstImage, width, height, format, type, 0, 0, 0); + const GLint widthInBytes = width * 4; + + if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) || + (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer); + } + UNLOCK_HARDWARE(fxMesa); + return result; + } +} + +GLboolean +tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid * pixels) +{ + if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) && + !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + return GL_FALSE; /* format/type not optimised */ + } + + if (ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F) { + return GL_FALSE; /* can't scale pixels */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + if (ctx->RasterMask & (~BLEND_BIT)) { + return GL_FALSE; /* can't do any raster ops, except blend */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + /* lock early to make sure cliprects are right */ + LOCK_HARDWARE(fxMesa); + + /* make sure hardware has latest blend funcs */ + if (ctx->RasterMask & BLEND_BIT) { + fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC; + tdfxEmitHwStateLocked( fxMesa ); + } + + /* look for clipmasks, giveup if region obscured */ + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + if (!inClipRects_Region(fxMesa, scrX, scrY, width, height)) { + UNLOCK_HARDWARE(fxMesa); + return GL_FALSE; + } + } + + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->DrawBuffer, + GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) + { + const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width * 4) : (info.strideInBytes); + const GLubyte *dst = (const GLubyte *) info.lfbPtr + + scrY * dstStride + scrX * 4; + const GLint srcStride = + _mesa_image_row_stride(unpack, width, format, type); + const GLubyte *src = (GLubyte *) _mesa_image_address(unpack, + pixels, width, height, format, type, 0, 0, 0); + const GLint widthInBytes = width * 4; + + if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) || + (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst -= dstStride; + src += srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer); + } + UNLOCK_HARDWARE(fxMesa); + return result; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h new file mode 100644 index 000000000..655f03bd1 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h @@ -0,0 +1,80 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Nathan Hand <nhand@valinux.com> + * + */ + +#ifndef __TDFX_PIXELS_H__ +#define __TDFX_PIXELS_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern GLboolean +tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern GLboolean +tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern GLboolean +tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage ); + +extern GLboolean +tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage ); + +extern GLboolean +tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c new file mode 100644 index 000000000..97931a351 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c @@ -0,0 +1,864 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "dri_glide.h" +#include "tdfx_context.h" +#include "tdfx_render.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" + +/* Clear the color and/or depth buffers. + */ +static GLbitfield tdfxDDClear( GLcontext *ctx, + GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLbitfield softwareMask = mask & (DD_ACCUM_BIT); + const GLuint stencil_size = + fxMesa->haveHwStencil ? fxMesa->glVis->StencilBits : 0; + +#if 0 + GLuint flags; + + FLUSH_BATCH( fxMesa ); + + if ( mask & DD_FRONT_LEFT_BIT ) { + flags |= TDFX_FRONT; + mask &= ~DD_FRONT_LEFT_BIT; + } + + if ( mask & DD_BACK_LEFT_BIT ) { + flags |= TDFX_BACK; + mask &= ~DD_BACK_LEFT_BIT; + } + + if ( (mask & DD_DEPTH_BIT) && ctx->Depth.Mask ) { + flags |= TDFX_DEPTH; + mask &= ~DD_DEPTH_BIT; + } + + if ( (mask & DD_STENCIL_BIT) && fxMesa->haveHwStencil ) { + clear.flags |= TDFX_STENCIL; + mask &= ~DD_STENCIL_BIT; + } + + if ( !flags ) + return mask; + + LOCK_HARDWARE( fxMesa ); + + + if ( flags & TDFX_FRONT ) { + + } + + if ( flags & TDFX_BACK ) { + + } + + if ( flags & TDFX_DEPTH ) { + + } + + if ( flags & TDFX_STENCIL ) { + grStencilMask( fxMesa->Stencil.WriteMask ); + /* set stencil ref value = desired clear value */ + grStencilFunc( GR_CMP_ALWAYS, fxMesa->Stencil.Clear, 0xff ); + grStencilOp( GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE ); + grEnable( GR_STENCIL_MODE_EXT ); + + if ( ctx->Stencil.Enabled ) { + grStencilOp( fxMesa->Stencil.FailFunc, + fxMesa->Stencil.ZFailFunc, + fxMesa->Stencil.ZPassFunc ); + grStencilMask( fxMesa->Stencil.WriteMask ); + grStencilFunc( fxMesa->Stencil.Function, + fxMesa->Stencil.RefValue, + fxMesa->Stencil.ValueMask ); + grEnable_NoLock( GR_STENCIL_MODE_EXT ); + } else { + grDisable( GR_STENCIL_MODE_EXT ); + } + + } + UNLOCK_HARDWARE( fxMesa ); + +#else + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %d, %d, %d, %d )\n", + __FUNCTION__, (int) x, (int) y, (int) width, (int) height ); + } + + /* Need this check to respond to glScissor and clipping updates */ + if ((fxMesa->new_state & (TDFX_NEW_CLIP | TDFX_NEW_DEPTH)) || + (fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK)) { + tdfxDDUpdateHwState(ctx); + } + + /* we can't clear accum buffers */ + mask &= ~(DD_ACCUM_BIT); + + if (mask & DD_STENCIL_BIT) { + if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask != 0xff) { + /* Napalm seems to have trouble with stencil write masks != 0xff */ + /* do stencil clear in software */ + mask &= ~(DD_STENCIL_BIT); + softwareMask |= DD_STENCIL_BIT; + } + } + + if (fxMesa->glVis->RedBits != 8) { + /* can only do color masking if running in 24/32bpp on Napalm */ + if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] || + ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) { + softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)); + mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); + } + } + + if (fxMesa->haveHwStencil) { + /* + * If we want to clear stencil, it must be enabled + * in the HW, even if the stencil test is not enabled + * in the OGL state. + */ + LOCK_HARDWARE(fxMesa); + if (mask & DD_STENCIL_BIT) { + FX_grStencilMask_NoLock(/*ctx->Stencil.WriteMask*/ 0xff); + /* set stencil ref value = desired clear value */ + FX_grStencilFunc_NoLock(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff); + FX_grStencilOp_NoLock(GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE); + FX_grEnable_NoLock(GR_STENCIL_MODE_EXT); + } + else { + FX_grDisable_NoLock(GR_STENCIL_MODE_EXT); + } + UNLOCK_HARDWARE(fxMesa); + } + + /* + * FIXME: This is just plain ugly... + */ + BEGIN_CLIP_LOOP(fxMesa); + { + /* + * This could probably be done fancier but doing each possible case + * explicitly is less error prone. + */ + switch (mask & ~DD_STENCIL_BIT) { + case DD_BACK_LEFT_BIT | DD_DEPTH_BIT: + /* back buffer & depth */ + FX_grColorMaskv_NoLock(ctx, true4); /* work around Voodoo3 bug */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) { + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + } + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT: + /* XXX it appears that the depth buffer isn't cleared when + * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set. + * This is a work-around/ + */ + /* clear depth */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grColorMaskv_NoLock(ctx, false4); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + /* clear front */ + FX_grColorMaskv_NoLock(ctx, true4); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_BACK_LEFT_BIT: + /* back buffer only */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT: + /* front buffer only */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT: + /* front and back */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT: + /* clear front */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + /* clear back and depth */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Mask) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_DEPTH_BIT: + /* just the depth buffer */ + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grColorMaskv_NoLock(ctx, false4); + FX_grDepthMask_NoLock(FXTRUE); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + FX_grColorMaskv_NoLock(ctx, true4); + if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (!ctx->Depth.Test || !ctx->Depth.Mask) + FX_grDepthMask_NoLock(FXFALSE); + break; + default: + /* clear no color buffers or depth buffer but might clear stencil */ + if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) { + /* XXX need this RenderBuffer call to work around Glide bug */ + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grDepthMask_NoLock(FXFALSE); + FX_grColorMaskv_NoLock(ctx, false4); + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + FX_grColorMaskv_NoLock(ctx, true4); + if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + } + } + } + END_CLIP_LOOP(fxMesa); + + if (fxMesa->haveHwStencil && (mask & DD_STENCIL_BIT)) { + /* We changed the stencil state above. Signal that we need to + * upload it again. + */ + fxMesa->dirty |= TDFX_UPLOAD_STENCIL; + } + +#endif + return softwareMask; +} + + + +static void tdfxDDFinish( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + grFinish(); + UNLOCK_HARDWARE( fxMesa ); +} + +static void tdfxDDFlush( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + grFlush(); + UNLOCK_HARDWARE( fxMesa ); +} + + + +static const char *texSource(int k) +{ + switch (k) { + case GR_CMBX_ZERO: + return "GR_CMBX_ZERO"; + case GR_CMBX_TEXTURE_ALPHA: + return "GR_CMBX_TEXTURE_ALPHA"; + case GR_CMBX_ALOCAL: + return "GR_CMBX_ALOCAL"; + case GR_CMBX_AOTHER: + return "GR_CMBX_AOTHER"; + case GR_CMBX_B: + return "GR_CMBX_B"; + case GR_CMBX_CONSTANT_ALPHA: + return "GR_CMBX_CONSTANT_ALPHA"; + case GR_CMBX_CONSTANT_COLOR: + return "GR_CMBX_CONSTANT_COLOR"; + case GR_CMBX_DETAIL_FACTOR: + return "GR_CMBX_DETAIL_FACTOR"; + case GR_CMBX_ITALPHA: + return "GR_CMBX_ITALPHA"; + case GR_CMBX_ITRGB: + return "GR_CMBX_ITRGB"; + case GR_CMBX_LOCAL_TEXTURE_ALPHA: + return "GR_CMBX_LOCAL_TEXTURE_ALPHA"; + case GR_CMBX_LOCAL_TEXTURE_RGB: + return "GR_CMBX_LOCAL_TEXTURE_RGB"; + case GR_CMBX_LOD_FRAC: + return "GR_CMBX_LOD_FRAC"; + case GR_CMBX_OTHER_TEXTURE_ALPHA: + return "GR_CMBX_OTHER_TEXTURE_ALPHA"; + case GR_CMBX_OTHER_TEXTURE_RGB: + return "GR_CMBX_OTHER_TEXTURE_RGB"; + case GR_CMBX_TEXTURE_RGB: + return "GR_CMBX_TEXTURE_RGB"; + case GR_CMBX_TMU_CALPHA: + return "GR_CMBX_TMU_CALPHA"; + case GR_CMBX_TMU_CCOLOR: + return "GR_CMBX_TMU_CCOLOR"; + default: + return ""; + } +} + +static const char *texMode(int k) +{ + switch (k) { + case GR_FUNC_MODE_ZERO: + return "GR_FUNC_MODE_ZERO"; + case GR_FUNC_MODE_X: + return "GR_FUNC_MODE_X"; + case GR_FUNC_MODE_ONE_MINUS_X: + return "GR_FUNC_MODE_ONE_MINUS_X"; + case GR_FUNC_MODE_NEGATIVE_X: + return "GR_FUNC_MODE_NEGATIVE_X"; + case GR_FUNC_MODE_X_MINUS_HALF: + return "GR_FUNC_MODE_X_MINUS_HALF"; + default: + return ""; + } +} + +static const char *texInvert(int k) +{ + return k ? "FXTRUE" : "FXFALSE"; +} + +static void uploadTextureEnv( tdfxContextPtr fxMesa ) +{ + if (TDFX_IS_NAPALM(fxMesa)) { + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { +#if 0 + printf("upload env %d\n", unit); + printf(" cSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceA)); + printf(" cModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeA)); + printf(" cSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceB)); + printf(" cModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeB)); + printf(" cSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceC)); + printf(" cInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertC)); + printf(" cSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceD)); + printf(" cInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertD)); + printf(" cShift = %d\t", fxMesa->TexCombineExt[unit].Color.Shift); + printf(" cInvert = %d\n", fxMesa->TexCombineExt[unit].Color.Invert); + printf(" aSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceA)); + printf(" aModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeA)); + printf(" aSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceB)); + printf(" aModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeB)); + printf(" aSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceC)); + printf(" aInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertC)); + printf(" aSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceD)); + printf(" aInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertD)); + printf(" aShift = %d\t", fxMesa->TexCombineExt[unit].Alpha.Shift); + printf(" aInvert = %d\n", fxMesa->TexCombineExt[unit].Alpha.Invert); + printf(" Color = 0x%08x\n", fxMesa->TexCombineExt[unit].EnvColor); +#endif + (*grTexColorCombineExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].Color.SourceA, + fxMesa->TexCombineExt[unit].Color.ModeA, + fxMesa->TexCombineExt[unit].Color.SourceB, + fxMesa->TexCombineExt[unit].Color.ModeB, + fxMesa->TexCombineExt[unit].Color.SourceC, + fxMesa->TexCombineExt[unit].Color.InvertC, + fxMesa->TexCombineExt[unit].Color.SourceD, + fxMesa->TexCombineExt[unit].Color.InvertD, + fxMesa->TexCombineExt[unit].Color.Shift, + fxMesa->TexCombineExt[unit].Color.Invert); + (*grTexAlphaCombineExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].Alpha.SourceA, + fxMesa->TexCombineExt[unit].Alpha.ModeA, + fxMesa->TexCombineExt[unit].Alpha.SourceB, + fxMesa->TexCombineExt[unit].Alpha.ModeB, + fxMesa->TexCombineExt[unit].Alpha.SourceC, + fxMesa->TexCombineExt[unit].Alpha.InvertC, + fxMesa->TexCombineExt[unit].Alpha.SourceD, + fxMesa->TexCombineExt[unit].Alpha.InvertD, + fxMesa->TexCombineExt[unit].Alpha.Shift, + fxMesa->TexCombineExt[unit].Alpha.Invert); + (*grConstantColorValueExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].EnvColor); + } + } + else { + /* Voodoo3 */ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + struct tdfx_texcombine *comb = &fxMesa->TexCombine[unit]; + FX_grTexCombine_NoLock(TDFX_TMU0 + unit, + comb->FunctionRGB, + comb->FactorRGB, + comb->FunctionAlpha, + comb->FactorAlpha, + comb->InvertRGB, + comb->InvertAlpha); + } + } +} + + +static void uploadTextureParams( tdfxContextPtr fxMesa ) +{ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + const struct tdfx_texparams *p = &fxMesa->TexParams[unit]; + /* + printf("upload params %d\n", unit); + printf(" clamp %x %x\n", env->sClamp, env->tClamp); + printf(" filter %x %x\n", env->minFilt, env->magFilt); + printf(" mipmap %x %x\n", env->mmMode, env->LODblend); + printf(" lod bias %f\n", env->LodBias); + */ + FX_grTexClampMode_NoLock(GR_TMU0 + unit, p->sClamp, p->tClamp); + FX_grTexFilterMode_NoLock(GR_TMU0 + unit, p->minFilt, p->magFilt); + FX_grTexMipMapMode_NoLock(GR_TMU0 + unit, p->mmMode, p->LODblend); + FX_grTexLodBiasValue_NoLock(GR_TMU0 + unit, p->LodBias); + } +} + + +static void uploadTextureSource( tdfxContextPtr fxMesa ) +{ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + const struct tdfx_texsource *src = &fxMesa->TexSource[unit]; + /* + printf("upload source %d @ %d %p\n", unit, src->StartAddress, src->Info); + */ + if (src->Info) { + /* + printf(" smallLodLog2=%d largeLodLog2=%d ar=%d format=%d data=%p\n", + src->Info->smallLodLog2, src->Info->largeLodLog2, + src->Info->aspectRatioLog2, src->Info->format, + src->Info->data); + */ + FX_grTexSource_NoLock(GR_TMU0 + unit, + src->StartAddress, + src->EvenOdd, + src->Info); + } + } +} + + +static void uploadTextureImages( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + if (ctx->Texture.Unit[unit].ReallyEnabled == TEXTURE0_2D) { + struct gl_texture_object *tObj = ctx->Texture.Unit[unit].CurrentD[2]; + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + if (ti && ti->reloadImages) { + /* + printf("download texture image on unit %d\n", unit); + */ + tdfxTMDownloadTexture(fxMesa, tObj); + ti->reloadImages = GL_FALSE; + } + } + } +} + + + +/* + * If scissoring is enabled, compute intersection of scissor region + * with all X clip rects, resulting in new cliprect list. + * If number of cliprects is zero or one, call grClipWindow to setup + * the clip region. Otherwise we'll call grClipWindow inside the + * BEGIN_CLIP_LOOP macro. + */ +void tdfxUploadClipping( tdfxContextPtr fxMesa ) +{ + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; + + assert(dPriv); + + if (fxMesa->numClipRects == 0) { + /* all drawing clipped away */ + grClipWindow(0, 0, 0, 0); + } + else if (fxMesa->numClipRects == 1) { + grClipWindow(fxMesa->pClipRects[0].x1, + fxMesa->screen_height - fxMesa->pClipRects[0].y2, + fxMesa->pClipRects[0].x2, + fxMesa->screen_height - fxMesa->pClipRects[0].y1); + } + /* else, we'll do a cliprect loop around all drawing */ + + grDRIPosition( dPriv->x, dPriv->y, dPriv->w, dPriv->h, + fxMesa->numClipRects, fxMesa->pClipRects ); +} + + +void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa ) +{ + if ( !fxMesa->dirty ) + return; + + if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_COMBINE ) { + if (TDFX_IS_NAPALM(fxMesa)) { + (*grColorCombineExtProc)(fxMesa->ColorCombineExt.SourceA, + fxMesa->ColorCombineExt.ModeA, + fxMesa->ColorCombineExt.SourceB, + fxMesa->ColorCombineExt.ModeB, + fxMesa->ColorCombineExt.SourceC, + fxMesa->ColorCombineExt.InvertC, + fxMesa->ColorCombineExt.SourceD, + fxMesa->ColorCombineExt.InvertD, + fxMesa->ColorCombineExt.Shift, + fxMesa->ColorCombineExt.Invert); + } + else { + /* Voodoo 3 */ + grColorCombine( fxMesa->ColorCombine.Function, + fxMesa->ColorCombine.Factor, + fxMesa->ColorCombine.Local, + fxMesa->ColorCombine.Other, + fxMesa->ColorCombine.Invert ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_COMBINE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_COMBINE ) { + if (TDFX_IS_NAPALM(fxMesa)) { + (*grAlphaCombineExtProc)(fxMesa->AlphaCombineExt.SourceA, + fxMesa->AlphaCombineExt.ModeA, + fxMesa->AlphaCombineExt.SourceB, + fxMesa->AlphaCombineExt.ModeB, + fxMesa->AlphaCombineExt.SourceC, + fxMesa->AlphaCombineExt.InvertC, + fxMesa->AlphaCombineExt.SourceD, + fxMesa->AlphaCombineExt.InvertD, + fxMesa->AlphaCombineExt.Shift, + fxMesa->AlphaCombineExt.Invert); + } + else { + /* Voodoo 3 */ + grAlphaCombine( fxMesa->AlphaCombine.Function, + fxMesa->AlphaCombine.Factor, + fxMesa->AlphaCombine.Local, + fxMesa->AlphaCombine.Other, + fxMesa->AlphaCombine.Invert ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_COMBINE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_RENDER_BUFFER ) { + grRenderBuffer( fxMesa->DrawBuffer ); + fxMesa->dirty &= ~TDFX_UPLOAD_RENDER_BUFFER; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE) { + grStipplePattern( fxMesa->Stipple.Pattern ); + grStippleMode( fxMesa->Stipple.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_TEST ) { + grAlphaTestFunction( fxMesa->Color.AlphaFunc ); + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_TEST; + } + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_REF ) { + grAlphaTestReferenceValue( fxMesa->Color.AlphaRef ); + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_REF; + } + if ( fxMesa->dirty & TDFX_UPLOAD_BLEND_FUNC ) { + if (grAlphaBlendFunctionExtProc) { + (*grAlphaBlendFunctionExtProc)( fxMesa->Color.BlendSrcRGB, + fxMesa->Color.BlendDstRGB, + GR_BLEND_OP_ADD, + fxMesa->Color.BlendSrcA, + fxMesa->Color.BlendDstA, + GR_BLEND_OP_ADD ); + } + else { + grAlphaBlendFunction( fxMesa->Color.BlendSrcRGB, + fxMesa->Color.BlendDstRGB, + fxMesa->Color.BlendSrcA, + fxMesa->Color.BlendDstA ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_BLEND_FUNC; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MODE ) { + grDepthBufferMode( fxMesa->Depth.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MODE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_BIAS ) { + grDepthBiasLevel( fxMesa->Depth.Bias ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_BIAS; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_FUNC ) { + grDepthBufferFunction( fxMesa->Depth.Func ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_FUNC; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MASK ) { + grDepthMask( fxMesa->Depth.Mask ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MASK; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_DITHER) { + grDitherMode( fxMesa->Color.Dither ); + } + + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_MODE ) { + grFogMode( fxMesa->Fog.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_MODE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_COLOR ) { + grFogColorValue( fxMesa->Fog.Color ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_COLOR; + } + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_TABLE ) { + grFogTable( fxMesa->Fog.Table ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_TABLE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) { + grCullMode( fxMesa->CullMode ); + fxMesa->dirty &= ~TDFX_UPLOAD_CULL; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CLIP ) { + tdfxUploadClipping( fxMesa ); + fxMesa->dirty &= ~TDFX_UPLOAD_CLIP; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK ) { + if ( grColorMaskExtProc && fxMesa->glCtx->Visual->RedBits == 8) { + grColorMaskExtProc( fxMesa->Color.ColorMask[RCOMP], + fxMesa->Color.ColorMask[GCOMP], + fxMesa->Color.ColorMask[BCOMP], + fxMesa->Color.ColorMask[ACOMP] ); + } else { + grColorMask( fxMesa->Color.ColorMask[RCOMP] || + fxMesa->Color.ColorMask[GCOMP] || + fxMesa->Color.ColorMask[BCOMP], + fxMesa->Color.ColorMask[ACOMP] ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_MASK; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CONSTANT_COLOR ) { + grConstantColorValue( fxMesa->Color.MonoColor ); + fxMesa->dirty &= ~TDFX_UPLOAD_CONSTANT_COLOR; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_LINE ) { + if (fxMesa->glCtx->Line.SmoothFlag && fxMesa->glCtx->Line.Width == 1.0) + grEnable(GR_AA_ORDERED); + else + grDisable(GR_AA_ORDERED); + fxMesa->dirty &= ~TDFX_UPLOAD_LINE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) { + if (fxMesa->glCtx->Stencil.Enabled) { + grEnable(GR_STENCIL_MODE_EXT); + FX_grStencilOp_NoLock(fxMesa->Stencil.FailFunc, + fxMesa->Stencil.ZFailFunc, + fxMesa->Stencil.ZPassFunc); + FX_grStencilFunc_NoLock(fxMesa->Stencil.Function, + fxMesa->Stencil.RefValue, + fxMesa->Stencil.ValueMask); + FX_grStencilMask_NoLock(fxMesa->Stencil.WriteMask); + } + else { + grDisable(GR_STENCIL_MODE_EXT); + } + fxMesa->dirty &= ~TDFX_UPLOAD_STENCIL; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) { + grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] ); + fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_ENV ) { + uploadTextureEnv(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_ENV; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PARAMS ) { + uploadTextureParams(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PARAMS; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PALETTE ) { + if (fxMesa->TexPalette.Data) { + grTexDownloadTable(fxMesa->TexPalette.Type, fxMesa->TexPalette.Data); + } + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PALETTE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_SOURCE ) { + uploadTextureSource(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_SOURCE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_IMAGES ) { + uploadTextureImages(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_IMAGES; + } + + fxMesa->dirty = 0; +} + + + +void tdfxDDInitRenderFuncs( GLcontext *ctx ) +{ + ctx->Driver.Clear = tdfxDDClear; + ctx->Driver.Finish = tdfxDDFinish; + ctx->Driver.Flush = tdfxDDFlush; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h new file mode 100644 index 000000000..9d1c25069 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h @@ -0,0 +1,54 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_RENDER_H__ +#define __TDFX_RENDER_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "tdfx_context.h" + +extern void tdfxDDInitRenderFuncs( GLcontext *ctx ); + +extern void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa ); + +extern void tdfxUploadClipping( tdfxContextPtr fxMesa ); + +#define FLUSH_BATCH( fxMesa ) + + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c new file mode 100644 index 000000000..801cf42e0 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c @@ -0,0 +1,106 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include <X11/Xlibint.h> + +#include "tdfx_dri.h" +#include "tdfx_context.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" +#include "tdfx_pipeline.h" + + +#ifdef DEBUG_LOCKING +char *prevLockFile = 0; +int prevLockLine = 0; +#endif + + +GLboolean tdfxCreateScreen( __DRIscreenPrivate *sPriv ) +{ + tdfxScreenPrivate *fxScreen; + TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; + + /* Allocate the private area */ + fxScreen = (tdfxScreenPrivate *) Xmalloc( sizeof(tdfxScreenPrivate) ); + if ( !fxScreen ) + return GL_FALSE; + + fxScreen->driScrnPriv = sPriv; + sPriv->private = (void *) fxScreen; + + fxScreen->regs.handle = fxDRIPriv->regs; + fxScreen->regs.size = fxDRIPriv->regsSize; + fxScreen->deviceID = fxDRIPriv->deviceID; + fxScreen->width = fxDRIPriv->width; + fxScreen->height = fxDRIPriv->height; + fxScreen->mem = fxDRIPriv->mem; + fxScreen->cpp = fxDRIPriv->cpp; + fxScreen->stride = fxDRIPriv->stride; + fxScreen->fifoOffset = fxDRIPriv->fifoOffset; + fxScreen->fifoSize = fxDRIPriv->fifoSize; + fxScreen->fbOffset = fxDRIPriv->fbOffset; + fxScreen->backOffset = fxDRIPriv->backOffset; + fxScreen->depthOffset = fxDRIPriv->depthOffset; + fxScreen->textureOffset = fxDRIPriv->textureOffset; + fxScreen->textureSize = fxDRIPriv->textureSize; + + + if ( drmMap( sPriv->fd, fxScreen->regs.handle, + fxScreen->regs.size, &fxScreen->regs.map ) ) { + return GL_FALSE; + } + + tdfxDDSetupInit(); + tdfxDDTriangleFuncsInit(); + tdfxDDFastPathInit(); + + tdfxDDGlideExtensionsInit(); + + return GL_TRUE; +} + +void tdfxDestroyScreen( __DRIscreenPrivate *sPriv ) +{ + tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; + + if ( fxScreen ) { + drmUnmap( fxScreen->regs.map, fxScreen->regs.size ); + + Xfree( fxScreen ); + sPriv->private = NULL; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h new file mode 100644 index 000000000..330c394a6 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h @@ -0,0 +1,77 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_SCREEN_H__ +#define __TDFX_SCREEN_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "dri_mesaint.h" + +typedef struct { + drmHandle handle; + drmSize size; + drmAddress map; +} tdfxRegion, *tdfxRegionPtr; + +typedef struct { + tdfxRegion regs; + + int deviceID; + int width; + int height; + int mem; + int cpp; + int stride; + + int fifoOffset; + int fifoSize; + + int fbOffset; + int backOffset; + int depthOffset; + int textureOffset; + int textureSize; + + __DRIscreenPrivate *driScrnPriv; +} tdfxScreenPrivate; + + +extern GLboolean tdfxCreateScreen( __DRIscreenPrivate *driScrnPriv ); +extern void tdfxDestroyScreen( __DRIscreenPrivate *driScrnPriv ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c new file mode 100644 index 000000000..61dafe3a8 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c @@ -0,0 +1,1335 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_span.h" +#include "tdfx_render.h" + + +#define DBG 0 + + +#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \ + tdfxScreenPrivate *fxPriv = fxMesa->fxScreen; \ + GLuint pitch = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) \ + ? (fxMesa->screen_width * BYTESPERPIXEL) : \ + (info.strideInBytes); \ + GLuint height = fxMesa->height; \ + char *buf = (char *)((char *)info.lfbPtr + \ + dPriv->x * fxPriv->cpp + \ + dPriv->y * pitch); \ + GLuint p; \ + (void) buf; (void) p; + + +#define INIT_MONO_PIXEL( p ) p = fxMesa->Color.MonoColor; + +#define CLIPPIXEL( _x, _y ) ( _x >= minx && _x < maxx && \ + _y >= miny && _y < maxy ) + +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } + +#define Y_FLIP(_y) (height - _y - 1) + + +#define HW_WRITE_LOCK() \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + FLUSH_BATCH( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + LOCK_HARDWARE( fxMesa ); \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \ + { + +#define HW_WRITE_UNLOCK() \ + grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer ); \ + } + + +#define HW_READ_LOCK() \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + FLUSH_BATCH( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + LOCK_HARDWARE( fxMesa ); \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \ + { + +#define HW_READ_UNLOCK() \ + grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer ); \ + } + + +#define HW_WRITE_CLIPLOOP() \ + do { \ + int _nc = fxMesa->numClipRects; \ + while (_nc--) { \ + int minx = fxMesa->pClipRects[_nc].x1 - fxMesa->x_offset; \ + int miny = fxMesa->pClipRects[_nc].y1 - fxMesa->y_offset; \ + int maxx = fxMesa->pClipRects[_nc].x2 - fxMesa->x_offset; \ + int maxy = fxMesa->pClipRects[_nc].y2 - fxMesa->y_offset; + +#define HW_READ_CLIPLOOP() \ + do { \ + const __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \ + XF86DRIClipRectPtr rect = dPriv->pClipRects; \ + int _nc = dPriv->numClipRects; \ + while (_nc--) { \ + const int minx = rect->x1 - fxMesa->x_offset; \ + const int miny = rect->y1 - fxMesa->y_offset; \ + const int maxx = rect->x2 - fxMesa->x_offset; \ + const int maxy = rect->y2 - fxMesa->y_offset; \ + rect++; + +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) + + + +#define LFB_MODE GR_LFBWRITEMODE_565 + + +/* 16 bit, RGB565 color spanline and pixel functions */ \ + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ + rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \ + rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \ + rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \ + rgba[3] = 0xff; \ + } while (0) + +#define TAG(x) tdfx##x##_RGB565 +#define BYTESPERPIXEL 2 +#include "spantmp.h" +#undef BYTESPERPIXEL + + +/* 16 bit, BGR565 color spanline and pixel functions */ \ +#if 0 + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)b & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)r & 0xf8) >> 3)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ + rgba[0] = (p << 3) & 0xf8; \ + rgba[1] = (p >> 3) & 0xfc; \ + rgba[2] = (p >> 8) & 0xf8; \ + rgba[3] = 0xff; \ + } while (0) + +#define TAG(x) tdfx##x##_BGR565 +#define BYTESPERPIXEL 2 +#include "spantmp.h" +#undef BYTESPERPIXEL +#endif + + +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_888 + + +/* 24 bit, RGB888 color spanline and pixel functions */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(buf + _x*3 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 0xff; \ +} while (0) + +#define TAG(x) tdfx##x##_RGB888 +#define BYTESPERPIXEL 4 +#include "spantmp.h" +#undef BYTESPERPIXEL + + +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_8888 + + +/* 32 bit, ARGB8888 color spanline and pixel functions */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16) | \ + (a << 24) ) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = (p >> 24) & 0xff; \ +} while (0) + +#define TAG(x) tdfx##x##_ARGB8888 +#define BYTESPERPIXEL 4 +#include "spantmp.h" +#undef BYTESPERPIXEL + + + +/* ================================================================ + * Old span functions below... + */ + + +/* + * Examine the cliprects to generate an array of flags to indicate + * which pixels in a span are visible. Note: (x,y) is a screen + * coordinate. + */ +static void +generate_vismask(const tdfxContextPtr fxMesa, GLint x, GLint y, GLint n, + GLubyte vismask[]) +{ + GLboolean initialized = GL_FALSE; + GLint i, j; + + /* Ensure we clear the visual mask */ + MEMSET(vismask, 0, n); + + /* turn on flags for all visible pixels */ + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + + if (y >= rect->y1 && y < rect->y2) { + if (x >= rect->x1 && x + n <= rect->x2) { + /* common case, whole span inside cliprect */ + MEMSET(vismask, 1, n); + return; + } + if (x < rect->x2 && x + n >= rect->x1) { + /* some of the span is inside the rect */ + GLint start, end; + if (!initialized) { + MEMSET(vismask, 0, n); + initialized = GL_TRUE; + } + if (x < rect->x1) + start = rect->x1 - x; + else + start = 0; + if (x + n > rect->x2) + end = rect->x2 - x; + else + end = n; + assert(start >= 0); + assert(end <= n); + for (j = start; j < end; j++) + vismask[j] = 1; + } + } + } +} + +/* + * Examine cliprects and determine if the given screen pixel is visible. + */ +static GLboolean +visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY) +{ + int i; + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + if (scrX >= rect->x1 && + scrX < rect->x2 && + scrY >= rect->y1 && scrY < rect->y2) return GL_TRUE; + } + return GL_FALSE; +} + + + +/* + * Depth buffer read/write functions. + */ +/* + * To read the frame buffer, we need to lock and unlock it. The + * four macros {READ,WRITE}_FB_SPAN_{LOCK,UNLOCK} + * do this for us. + * + * Note that the lock must be matched with an unlock. These + * macros include a spare curly brace, so they must + * be syntactically matched. + * + * Note, also, that you can't lock a buffer twice with different + * modes. That is to say, you can't lock a buffer in both read + * and write modes. The strideInBytes and LFB pointer will be + * the same with read and write locks, so you can use either. + * o The HW has different state for reads and writes, so + * locking it twice may give screwy results. + * o The DRM won't let you lock twice. It hangs. This is probably + * because of the LOCK_HARDWARE IN THE *_FB_SPAN_LOCK macros, + * and could be eliminated with nonlocking lock routines. But + * what's the point after all. + */ +#define READ_FB_SPAN_LOCK(fxMesa, info, target_buffer) \ + UNLOCK_HARDWARE(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + (info).size=sizeof(info); \ + if (grLfbLock(GR_LFB_READ_ONLY, \ + target_buffer, \ + GR_LFBWRITEMODE_ANY, \ + GR_ORIGIN_UPPER_LEFT, \ + FXFALSE, \ + &(info))) { + +#define READ_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ + grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \ + } else { \ + fprintf(stderr, "tdfxDriver: Can't get %s (%d) read lock\n", \ + (target_buffer == GR_BUFFER_BACKBUFFER) \ + ? "back buffer" \ + : ((target_buffer == GR_BUFFER_AUXBUFFER) \ + ? "depth buffer" \ + : "unknown buffer"), \ + target_buffer); \ + } + +#define WRITE_FB_SPAN_LOCK(fxMesa, info, target_buffer, write_mode) \ + UNLOCK_HARDWARE(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + info.size=sizeof(info); \ + if (grLfbLock(GR_LFB_WRITE_ONLY, \ + target_buffer, \ + write_mode, \ + GR_ORIGIN_UPPER_LEFT, \ + FXFALSE, \ + &info)) { + +#define WRITE_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ + grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \ + } else { \ + fprintf(stderr, "tdfxDriver: Can't get %s (%d) write lock\n", \ + (target_buffer == GR_BUFFER_BACKBUFFER) \ + ? "back buffer" \ + : ((target_buffer == GR_BUFFER_AUXBUFFER) \ + ? "depth buffer" \ + : "unknown buffer"), \ + target_buffer); \ + } + +/* + * Because the Linear Frame Buffer is not necessarily aligned + * with the depth buffer, we have to do some fiddling + * around to get the right addresses. + * + * Perhaps a picture is in order. The Linear Frame Buffer + * looks like this: + * + * |<----------------------info.strideInBytes------------->| + * |<-----physicalStrideInBytes------->| + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * | | | + * | Legal Memory | Forbidden Zone | + * | | | + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * + * You can only reliably read and write legal locations. Reads + * and writes from the Forbidden Zone will return undefined values, + * and may cause segmentation faults. + * + * Now, the depth buffer may not end up in a location such each + * scan line is an LFB line. For example, the depth buffer may + * look like this: + * + * wrapped ordinary. + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * |0000000000000000000000 | | back + * |1111111111111111111111 | | buffer + * |2222222222222222222222 | | + * |4096b align. padxx00000000000000000| Forbidden Zone | depth + * |0000 11111111111111111| | buffer + * |1111 22222222222222222| | + * |2222 | | + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * where each number is the scan line number. We know it will + * be aligned on 128 byte boundaries, at least. Aligning this + * on a scanline boundary causes the back and depth buffers to + * thrash in the SST1 cache. (Note that the back buffer is always + * allocated at the beginning of LFB memory, and so it is always + * properly aligned with the LFB stride.) + * + * We call the beginning of the line (which is the rightmost + * part of the depth line in the picture above) the *ordinary* part + * of the scanline, and the end of the line (which is the + * leftmost part, one line below) the *wrapped* part of the scanline. + * a.) We need to know what x value to subtract from the screen + * x coordinate to index into the wrapped part. + * b.) We also need to figure out if we need to read from the ordinary + * part scan line, or from the wrapped part of the scan line. + * + * [ad a] + * The first wrapped x coordinate is that coordinate such that + * depthBufferOffset&(info.strideInBytes) + x*elmentSize {*} + * > physicalStrideInBytes + * where depthBufferOffset is the LFB distance in bytes + * from the back buffer to the depth buffer. The expression + * depthBufferOffset&(info.strideInBytes) + * is then the offset (in bytes) from the beginining of (any) + * depth buffer line to first element in the line. + * Simplifying inequation {*} above we see that x is the smallest + * value such that + * x*elementSize > physicalStrideInBytes {**} + * - depthBufferOffset&(info.strideInBytes) + * Now, we know that both the summands on the right are multiples of + * 128, and elementSize <= 4, so if equality holds in {**}, x would + * be a multiple of 32. Thus we can set x to + * xwrapped = (physicalStrideInBytes + * - depthBufferOffset&(info.strideInBytes))/elementSize + * + 1 + * + * [ad b] + * Question b is now simple. We read from the wrapped scan line if + * x is greater than xwrapped. + */ +#define TILE_WIDTH_IN_BYTES 128 +#define TILE_WIDTH_IN_ZOXELS(bpz) (TILE_WIDTH_IN_BYTES/(bpz)) +#define TILE_HEIGHT_IN_LINES 32 +typedef struct +{ + void *lfbPtr; + void *lfbWrapPtr; + FxU32 LFBStrideInElts; + GLint firstWrappedX; +} +LFBParameters; + +/* + * We need information about the back buffer. Note that + * this function *cannot be called* while the aux buffer + * is locked, or the caller will hang. + * + * Only Glide knows the LFB address of the back and depth + * offsets. The upper levels of Mesa know the depth offset, + * but that is not in LFB space, it is tiled memory space, + * and is not useable for us. + */ +static void +GetBackBufferInfo(tdfxContextPtr fxMesa, GrLfbInfo_t * backBufferInfo) +{ + READ_FB_SPAN_LOCK(fxMesa, *backBufferInfo, GR_BUFFER_BACKBUFFER); + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_BACKBUFFER); +} + +static void +GetFbParams(tdfxContextPtr fxMesa, + GrLfbInfo_t * info, + GrLfbInfo_t * backBufferInfo, + LFBParameters * ReadParamsp, FxU32 elementSize) +{ + FxU32 physicalStrideInBytes, bufferOffset; + FxU32 strideInBytes = info->strideInBytes; + char *lfbPtr = (char *) (info->lfbPtr); /* For arithmetic, use char * */ + + /* + * These two come directly from the info structure. + */ + ReadParamsp->lfbPtr = (void *) lfbPtr; + ReadParamsp->LFBStrideInElts = strideInBytes / elementSize; + /* + * Now, calculate the value of firstWrappedX. + * + * The physical stride is the screen width in bytes rounded up to + * the next highest multiple of 128 bytes. Note that this fails + * when TILE_WIDTH_IN_BYTES is not a power of two. + * + * The buffer Offset is the distance between the beginning of + * the LFB space, which is the beginning of the back buffer, + * and the buffer we are gathering information about. + * We want to make this routine usable for operations on the + * back buffer, though we don't actually use it on the back + * buffer. Note, then, that if bufferOffset == 0, the firstWrappedX + * is in the forbidden zone, and is therefore never reached. + * + * Note that if + * physicalStrideInBytes + * < bufferOffset&(info->strideInBytes-1) + * the buffer begins in the forbidden zone. We assert for this. + */ + bufferOffset = (FxU32)(lfbPtr - (char *) backBufferInfo->lfbPtr); + physicalStrideInBytes + = (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1) + & ~(TILE_WIDTH_IN_BYTES - 1); + assert(physicalStrideInBytes > (bufferOffset & (strideInBytes - 1))); + ReadParamsp->firstWrappedX + = (physicalStrideInBytes + - (bufferOffset & (strideInBytes - 1))) / elementSize; + /* + * This is the address of the next physical line. + */ + ReadParamsp->lfbWrapPtr + = (void *) ((char *) backBufferInfo->lfbPtr + + (bufferOffset & ~(strideInBytes - 1)) + + (TILE_HEIGHT_IN_LINES) * strideInBytes); +} + +/* + * These macros fetch data from the frame buffer. The type is + * the type of data we want to fetch. It should match the type + * whose size was used with GetFbParams to fill in the structure + * in *ReadParamsp. We have a macro to read the ordinary + * part, a second macro to read the wrapped part, and one which + * will do either. When we are reading a span, we will know + * when the ordinary part ends, so there's no need to test for + * it. However, when reading and writing pixels, we don't + * necessarily know. I suppose it's a matter of taste whether + * it's better in the macro or in the call. + * + * Recall that x and y are screen coordinates. + */ +#define GET_FB_DATA(ReadParamsp, type, x, y) \ + (((x) < (ReadParamsp)->firstWrappedX) \ + ? (((type *)((ReadParamsp)->lfbPtr)) \ + [(y) * ((ReadParamsp)->LFBStrideInElts) \ + + (x)]) \ + : (((type *)((ReadParamsp)->lfbWrapPtr)) \ + [((y)) * ((ReadParamsp)->LFBStrideInElts) \ + + ((x) - (ReadParamsp)->firstWrappedX)])) +#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \ + (((type *)((ReadParamsp)->lfbPtr)) \ + [(y) * ((ReadParamsp)->LFBStrideInElts) \ + + (x)]) +#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) \ + (((type *)((ReadParamsp)->lfbWrapPtr)) \ + [((y)) * ((ReadParamsp)->LFBStrideInElts) \ + + ((x) - (ReadParamsp)->firstWrappedX)]) +#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) +#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) +#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) + +static void +tdfxDDWriteDepthSpan(GLcontext * ctx, + GLuint n, GLint x, GLint y, const GLdepth depth[], + const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->y_offset + fxMesa->height - 1; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GrLfbInfo_t info; + GLubyte visMask[MAX_WIDTH]; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthSpan(...)\n"); + } + + assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); + /* + * Convert x and y to screen coordinates. + */ + x += fxMesa->x_offset; + y = bottom - y; + if (mask) { + GLint i; + GLushort d16; + GrLfbInfo_t backBufferInfo; + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + int wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (mask[i] && visMask[i]) { + d16 = depth[i]; + PUT_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y, d16); + } + } + for (; i < n; i++) { + if (mask[i] && visMask[i]) { + d16 = depth[i]; + PUT_WRAPPED_FB_DATA(&ReadParams, GLushort, x + i, y, d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + int wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + GLuint d32; + if (mask[i] && visMask[i]) { + if (stencil_size > 0) { + d32 = + GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + for (; i < n; i++) { + GLuint d32; + if (mask[i] && visMask[i]) { + if (stencil_size > 0) { + d32 = + GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } + else { + GLint i; + GLuint d32; + GLushort d16; + GrLfbInfo_t backBufferInfo; + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + GLuint wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i]) { + d16 = depth[i]; + PUT_ORDINARY_FB_DATA(&ReadParams, + GLushort, + x + i, y, + d16); + } + } + for (; i < n; i++) { + if (visMask[i]) { + d16 = depth[i]; + PUT_WRAPPED_FB_DATA(&ReadParams, + GLushort, + x + i, y, + d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + GLuint wrappedPartStart; + + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i]) { + if (stencil_size > 0) { + d32 = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + for (; i < n; i++) { + if (visMask[i]) { + if (stencil_size > 0) { + d32 = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } +} + +static void +tdfxDDReadDepthSpan(GLcontext * ctx, + GLuint n, GLint x, GLint y, GLdepth depth[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLuint depth_size = fxMesa->glVis->DepthBits; + GrLfbInfo_t info; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDReadDepthSpan(...)\n"); + } + + /* + * Convert to screen coordinates. + */ + x += fxMesa->x_offset; + y = bottom - y; + switch (depth_size) { + case 16: + { + LFBParameters ReadParams; + GrLfbInfo_t backBufferInfo; + int wrappedPartStart; + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + /* + * Read the line. + */ + for (i = 0; i < wrappedPartStart; i++) { + depth[i] = + GET_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y); + } + for (; i < n; i++) { + depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLushort, + x + i, y); + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + case 24: + case 32: + { + LFBParameters ReadParams; + GrLfbInfo_t backBufferInfo; + int wrappedPartStart; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + /* + * Read the line. + */ + for (i = 0; i < wrappedPartStart; i++) { + const GLuint mask = + (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; + depth[i] = + GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); + depth[i] &= mask; + } + for (; i < n; i++) { + const GLuint mask = + (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; + depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); + depth[i] &= mask; + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } +} + + +static void +tdfxDDWriteDepthPixels(GLcontext * ctx, + GLuint n, const GLint x[], const GLint y[], + const GLdepth depth[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLushort d16; + GLuint d32; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GrLfbInfo_t info; + int xpos; + int ypos; + GrLfbInfo_t backBufferInfo; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthPixels(...)\n"); + } + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + for (i = 0; i < n; i++) { + if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) { + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d16 = depth[i]; + PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + for (i = 0; i < n; i++) { + if (mask[i]) { + if (visible_pixel(fxMesa, x[i], y[i])) { + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + if (stencil_size > 0) { + d32 = + GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); + d32 = (d32 & 0xFF000000) | (depth[i] & 0xFFFFFF); + } + else { + d32 = depth[i]; + } + PUT_FB_DATA(&ReadParams, GLuint, xpos, ypos, d32); + } + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } +} + + +static void +tdfxDDReadDepthPixels(GLcontext * ctx, GLuint n, + const GLint x[], const GLint y[], GLdepth depth[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLushort d16; + int xpos; + int ypos; + GrLfbInfo_t info; + GLuint stencil_size; + GrLfbInfo_t backBufferInfo; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDReadDepthPixels(...)\n"); + } + + assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + for (i = 0; i < n; i++) { + /* + * Convert to screen coordinates. + */ + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d16 = GET_FB_DATA(&ReadParams, GLushort, xpos, ypos); + depth[i] = d16; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + stencil_size = fxMesa->glVis->StencilBits; + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + for (i = 0; i < n; i++) { + GLuint d32; + + /* + * Convert to screen coordinates. + */ + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d32 = GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); + if (stencil_size > 0) { + d32 &= 0x00FFFFFF; + } + depth[i] = d32; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + default: + assert(0); + } +} + +/* + * Stencil buffer read/write functions. + */ +#define EXTRACT_S_FROM_ZS(zs) (((zs) >> 24) & 0xFF) +#define EXTRACT_Z_FROM_ZS(zs) ((zs) & 0xffffff) +#define BUILD_ZS(z, s) (((s) << 24) | (z)) + +static void +write_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, + const GLstencil stencil[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + LFBParameters ReadParams; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + int wrappedPartStart; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + generate_vismask(fxMesa, scrX, scrY, n, visMask); + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i] && (!mask || mask[i])) { + GLuint z = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + scrX + i, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); + } + } + for (; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + GLuint z = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + scrX + i, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +read_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, + GLstencil stencil[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + GLuint i; + LFBParameters ReadParams; + int wrappedPartStart; + + /* + * Convert to screen coordinates. + */ + x += winX; + y = winY - y; + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + stencil[i] = (GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + x + i, y) >> 24) & 0xFF; + } + for (; i < n; i++) { + stencil[i] = (GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + x + i, y) >> 24) & 0xFF; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +write_stencil_pixels(GLcontext * ctx, GLuint n, + const GLint x[], const GLint y[], + const GLstencil stencil[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + LFBParameters ReadParams; + GLuint i; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + for (i = 0; i < n; i++) { + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + if ((!mask || mask[i]) && visible_pixel(fxMesa, scrX, scrY)) { + GLuint z = + GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_FB_DATA(&ReadParams, GLuint, scrX, scrY, z); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +read_stencil_pixels(GLcontext * ctx, GLuint n, const GLint x[], + const GLint y[], GLstencil stencil[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + GLuint i; + LFBParameters ReadParams; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + for (i = 0; i < n; i++) { + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + stencil[i] = + (GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) >> 24) & 0xFF; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + +#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \ + ((vis->RedBits == r) && \ + (vis->GreenBits == g) && \ + (vis->BlueBits == b) && \ + (vis->AlphaBits == a)) + +void tdfxDDInitSpanFuncs( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) ) + { + /* 16bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_RGB565; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_RGB565; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB565; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_RGB565; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB565; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_RGB565; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_RGB565; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 0) ) + { + /* 24bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_RGB888; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_RGB888; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB888; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_RGB888; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB888; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_RGB888; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_RGB888; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) ) + { + /* 32bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_ARGB8888; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_ARGB8888; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB8888; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB8888; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB8888; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_ARGB8888; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_ARGB8888; + } + else + { + abort(); + } + + if ( fxMesa->haveHwStencil ) { + ctx->Driver.WriteStencilSpan = write_stencil_span; + ctx->Driver.ReadStencilSpan = read_stencil_span; + ctx->Driver.WriteStencilPixels = write_stencil_pixels; + ctx->Driver.ReadStencilPixels = read_stencil_pixels; + } + + ctx->Driver.WriteDepthSpan = tdfxDDWriteDepthSpan; + ctx->Driver.WriteDepthPixels = tdfxDDWriteDepthPixels; + ctx->Driver.ReadDepthSpan = tdfxDDReadDepthSpan; + ctx->Driver.ReadDepthPixels = tdfxDDReadDepthPixels; + + ctx->Driver.WriteCI8Span = NULL; + ctx->Driver.WriteCI32Span = NULL; + ctx->Driver.WriteMonoCISpan = NULL; + ctx->Driver.WriteCI32Pixels = NULL; + ctx->Driver.WriteMonoCIPixels = NULL; + ctx->Driver.ReadCI32Span = NULL; + ctx->Driver.ReadCI32Pixels = NULL; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h new file mode 100644 index 000000000..47303c600 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h @@ -0,0 +1,48 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_SPAN_H__ +#define __TDFX_SPAN_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c new file mode 100644 index 000000000..eb9a6a98b --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c @@ -0,0 +1,1558 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "types.h" +#include "pb.h" + +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" +#include "tdfx_texstate.h" +#include "tdfx_tris.h" +#include "tdfx_render.h" + + + +/* ============================================================= + * Alpha blending + */ + +static void tdfxUpdateAlphaMode( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCmpFnc_t func; + GrAlphaBlendFnc_t srcRGB, dstRGB, srcA, dstA; + GrAlpha_t ref = ctx->Color.AlphaRef; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Color.AlphaEnabled ) { + switch ( ctx->Color.AlphaFunc ) { + case GL_NEVER: + func = GR_CMP_NEVER; + break; + case GL_LESS: + func = GR_CMP_LESS; + break; + case GL_LEQUAL: + func = GR_CMP_LEQUAL; + break; + case GL_EQUAL: + func = GR_CMP_EQUAL; + break; + case GL_GEQUAL: + func = GR_CMP_GEQUAL; + break; + case GL_GREATER: + func = GR_CMP_GREATER; + break; + case GL_NOTEQUAL: + func = GR_CMP_NOTEQUAL; + break; + case GL_ALWAYS: + default: + func = GR_CMP_ALWAYS; + break; + } + } else { + func = GR_CMP_ALWAYS; + } + + if ( ctx->Color.BlendEnabled + && (fxMesa->Fallback & TDFX_FALLBACK_BLEND) == 0 ) { + switch ( ctx->Color.BlendSrcRGB ) { + case GL_ZERO: + srcRGB = GR_BLEND_ZERO; + break; + case GL_ONE: + srcRGB = GR_BLEND_ONE; + break; + case GL_DST_COLOR: + srcRGB = GR_BLEND_DST_COLOR; + break; + case GL_ONE_MINUS_DST_COLOR: + srcRGB = GR_BLEND_ONE_MINUS_DST_COLOR; + break; + case GL_SRC_ALPHA: + srcRGB = GR_BLEND_SRC_ALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + srcRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; + break; + case GL_DST_ALPHA: + srcRGB = GR_BLEND_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + srcRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + break; + case GL_SRC_ALPHA_SATURATE: + srcRGB = GR_BLEND_ALPHA_SATURATE; + break; + default: + srcRGB = GR_BLEND_ONE; + } + + switch ( ctx->Color.BlendSrcA ) { + case GL_ZERO: + srcA = GR_BLEND_ZERO; + break; + case GL_ONE: + srcA = GR_BLEND_ONE; + break; + case GL_DST_COLOR: + srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_COLOR: + srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA: + srcA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_ALPHA: + srcA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_DST_ALPHA: + srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_ALPHA: + srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA_SATURATE: + srcA = GR_BLEND_ONE; + break; + default: + srcA = GR_BLEND_ONE; + } + + switch ( ctx->Color.BlendDstRGB ) { + case GL_ZERO: + dstRGB = GR_BLEND_ZERO; + break; + case GL_ONE: + dstRGB = GR_BLEND_ONE; + break; + case GL_SRC_COLOR: + dstRGB = GR_BLEND_SRC_COLOR; + break; + case GL_ONE_MINUS_SRC_COLOR: + dstRGB = GR_BLEND_ONE_MINUS_SRC_COLOR; + break; + case GL_SRC_ALPHA: + dstRGB = GR_BLEND_SRC_ALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + dstRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; + break; + case GL_DST_ALPHA: + dstRGB = GR_BLEND_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + dstRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + break; + default: + dstRGB = GR_BLEND_ZERO; + } + + switch ( ctx->Color.BlendDstA ) { + case GL_ZERO: + dstA = GR_BLEND_ZERO; + break; + case GL_ONE: + dstA = GR_BLEND_ONE; + break; + case GL_SRC_COLOR: + dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_COLOR: + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA: + dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_ALPHA: + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_DST_ALPHA: + dstA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_ALPHA: + dstA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + default: + dstA = GR_BLEND_ZERO; + } + } else { + /* blend disabled */ + srcRGB = GR_BLEND_ONE; + dstRGB = GR_BLEND_ZERO; + srcA = GR_BLEND_ONE; + dstA = GR_BLEND_ZERO; + } + + if ( fxMesa->Color.AlphaFunc != func ) { + fxMesa->Color.AlphaFunc = func; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_TEST; + } + if ( fxMesa->Color.AlphaRef != ref ) { + fxMesa->Color.AlphaRef = ref; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_REF; + } + + if ( fxMesa->Color.BlendSrcRGB != srcRGB || + fxMesa->Color.BlendDstRGB != dstRGB || + fxMesa->Color.BlendSrcA != srcA || + fxMesa->Color.BlendDstA != dstA ) + { + fxMesa->Color.BlendSrcRGB = srcRGB; + fxMesa->Color.BlendDstRGB = dstRGB; + fxMesa->Color.BlendSrcA = srcA; + fxMesa->Color.BlendDstA = dstA; + fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC; + } +} + +static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLclampf ref ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; +} + +static void tdfxDDBlendEquation( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; +} + +static void tdfxDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + + /* + * XXX - Voodoo5 seems to suffer from precision problems in some + * blend modes. To pass all the conformance tests we'd have to + * fall back to software for many modes. Revisit someday. + */ +} + +static void tdfxDDBlendFuncSeparate( GLcontext *ctx, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; +} + +/* ============================================================= + * Stipple + */ + +static void tdfxUpdateStipple( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GrStippleMode_t mode = GR_STIPPLE_DISABLE; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + + if (ctx->Polygon.StippleFlag) { + mode = GR_STIPPLE_PATTERN; + } + + if ( fxMesa->Stipple.Mode != mode ) { + fxMesa->Stipple.Mode = mode; + fxMesa->dirty |= TDFX_UPLOAD_STIPPLE; + } +} + + +/* ============================================================= + * Depth testing + */ + +static void tdfxUpdateZMode( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GrCmpFnc_t func; + FxI32 bias; + FxBool mask; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE); + + if ( ctx->Depth.Test ) { + switch ( ctx->Depth.Func ) { + case GL_NEVER: + func = GR_CMP_NEVER; + break; + case GL_LESS: + func = GR_CMP_LESS; + break; + case GL_LEQUAL: + func = GR_CMP_LEQUAL; + break; + case GL_EQUAL: + func = GR_CMP_EQUAL; + break; + case GL_GEQUAL: + func = GR_CMP_GEQUAL; + break; + case GL_GREATER: + func = GR_CMP_GREATER; + break; + case GL_NOTEQUAL: + func = GR_CMP_NOTEQUAL; + break; + case GL_ALWAYS: + default: + func = GR_CMP_ALWAYS; + break; + } + + if ( ctx->Depth.Mask ) { + mask = FXTRUE; + } + else { + mask = FXFALSE; + } + } + else { + /* depth testing disabled */ + func = GR_CMP_ALWAYS; /* fragments always pass */ + mask = FXFALSE; /* zbuffer is not touched */ + } + + fxMesa->Depth.Clear = (FxU32) (((1 << fxMesa->glVis->DepthBits) - 1) + * ctx->Depth.Clear); + + if ( fxMesa->Depth.Bias != bias ) { + fxMesa->Depth.Bias = bias; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS; + } + if ( fxMesa->Depth.Func != func ) { + fxMesa->Depth.Func = func; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_FUNC | TDFX_UPLOAD_DEPTH_MASK; + } + if ( fxMesa->Depth.Mask != mask ) { + fxMesa->Depth.Mask = mask; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_MASK; + } +} + +static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + +static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + +static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + + + +/* ============================================================= + * Stencil + */ + + +/* Evaluate all stencil state and make the Glide calls. + */ +static GrStencil_t convertGLStencilOp( GLenum op ) +{ + switch ( op ) { + case GL_KEEP: + return GR_STENCILOP_KEEP; + case GL_ZERO: + return GR_STENCILOP_ZERO; + case GL_REPLACE: + return GR_STENCILOP_REPLACE; + case GL_INCR: + return GR_STENCILOP_INCR_CLAMP; + case GL_DECR: + return GR_STENCILOP_DECR_CLAMP; + case GL_INVERT: + return GR_STENCILOP_INVERT; + case GL_INCR_WRAP_EXT: + return GR_STENCILOP_INCR_WRAP; + case GL_DECR_WRAP_EXT: + return GR_STENCILOP_DECR_WRAP; + default: + gl_problem( NULL, "bad stencil op in convertGLStencilOp" ); + } + return GR_STENCILOP_KEEP; /* never get, silence compiler warning */ +} + + +static void tdfxUpdateStencil( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if (fxMesa->haveHwStencil) { + if (ctx->Stencil.Enabled) { + fxMesa->Stencil.Function = ctx->Stencil.Function - GL_NEVER; + fxMesa->Stencil.RefValue = ctx->Stencil.Ref; + fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask; + fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask; + fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc); + fxMesa->Stencil.ZFailFunc =convertGLStencilOp(ctx->Stencil.ZFailFunc); + fxMesa->Stencil.ZPassFunc =convertGLStencilOp(ctx->Stencil.ZPassFunc); + fxMesa->Stencil.Clear = ctx->Stencil.Clear & 0xff; + } + fxMesa->dirty |= TDFX_UPLOAD_STENCIL; + } +} + + +static void tdfxDDStencilFunc( GLcontext *ctx, GLenum func, + GLint ref, GLuint mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + +static void tdfxDDStencilMask( GLcontext *ctx, GLuint mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + +static void tdfxDDStencilOp( GLcontext *ctx, GLenum sfail, + GLenum zfail, GLenum zpass ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + + +/* ============================================================= + * Fog - orthographic fog still not working + */ + +static void tdfxUpdateFogAttrib( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrFogMode_t mode; + GrColor_t color; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Fog.Enabled ) { + mode = GR_FOG_WITH_TABLE_ON_Q; + } else { + mode = GR_FOG_DISABLE; + } + + color = TDFXPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F), + (GLubyte)(ctx->Fog.Color[1]*255.0F), + (GLubyte)(ctx->Fog.Color[2]*255.0F)); + + if ( fxMesa->Fog.Mode != mode ) { + fxMesa->Fog.Mode = mode; + fxMesa->dirty |= TDFX_UPLOAD_FOG_MODE; + } + if ( fxMesa->Fog.Color != color ) { + fxMesa->Fog.Color = color; + fxMesa->dirty |= TDFX_UPLOAD_FOG_COLOR; + } + if ( fxMesa->Fog.TableMode != ctx->Fog.Mode || + fxMesa->Fog.Density != ctx->Fog.Density || + fxMesa->Fog.Near != ctx->Fog.Start || + fxMesa->Fog.Far != ctx->Fog.End ) + { + switch( ctx->Fog.Mode ) { + case GL_EXP: + guFogGenerateExp( fxMesa->Fog.Table, ctx->Fog.Density ); + break; + case GL_EXP2: + guFogGenerateExp2( fxMesa->Fog.Table, ctx->Fog.Density ); + break; + case GL_LINEAR: + guFogGenerateLinear( fxMesa->Fog.Table, + ctx->Fog.Start, ctx->Fog.End ); + break; + } + + fxMesa->Fog.TableMode = ctx->Fog.Mode; + fxMesa->Fog.Density = ctx->Fog.Density; + fxMesa->Fog.Near = ctx->Fog.Start; + fxMesa->Fog.Far = ctx->Fog.End; + fxMesa->dirty |= TDFX_UPLOAD_FOG_TABLE; + } +} + +static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_FOG; +} + + +/* ============================================================= + * Clipping + */ + +static int intersect_rect( XF86DRIClipRectPtr out, + const XF86DRIClipRectPtr a, + const XF86DRIClipRectPtr b) +{ + *out = *a; + if (b->x1 > out->x1) out->x1 = b->x1; + if (b->y1 > out->y1) out->y1 = b->y1; + if (b->x2 < out->x2) out->x2 = b->x2; + if (b->y2 < out->y2) out->y2 = b->y2; + if (out->x1 >= out->x2) return 0; + if (out->y1 >= out->y2) return 0; + return 1; +} + + +/* + * Examine XF86 cliprect list and scissor state to recompute our + * cliprect list. + */ +void tdfxUpdateClipping( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + assert(ctx); + assert(fxMesa); + assert(dPriv); + + if ( dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset || + dPriv->w != fxMesa->width || dPriv->h != fxMesa->height ) { + fxMesa->x_offset = dPriv->x; + fxMesa->y_offset = dPriv->y; + fxMesa->width = dPriv->w; + fxMesa->height = dPriv->h; + fxMesa->y_delta = + fxMesa->screen_height - fxMesa->y_offset - fxMesa->height; + } + + if (fxMesa->scissoredClipRects && fxMesa->pClipRects) { + free(fxMesa->pClipRects); + } + + if (ctx->Scissor.Enabled) { + /* intersect OpenGL scissor box with all cliprects to make a new + * list of cliprects. + */ + XF86DRIClipRectRec scissor; + int x1 = ctx->Scissor.X + fxMesa->x_offset; + int y1 = fxMesa->screen_height - fxMesa->y_delta + - ctx->Scissor.Y - ctx->Scissor.Height; + int x2 = x1 + ctx->Scissor.Width; + int y2 = y1 + ctx->Scissor.Height; + scissor.x1 = MAX2(x1, 0); + scissor.y1 = MAX2(y1, 0); + scissor.x2 = MAX2(x2, 0); + scissor.y2 = MAX2(y2, 0); + + assert(scissor.x2 >= scissor.x1); + assert(scissor.y2 >= scissor.y1); + + fxMesa->pClipRects = malloc(dPriv->numClipRects + * sizeof(XF86DRIClipRectRec)); + if (fxMesa->pClipRects) { + int i; + fxMesa->numClipRects = 0; + for (i = 0; i < dPriv->numClipRects; i++) { + if (intersect_rect(&fxMesa->pClipRects[fxMesa->numClipRects], + &scissor, &dPriv->pClipRects[i])) { + fxMesa->numClipRects++; + } + } + fxMesa->scissoredClipRects = GL_TRUE; + } + else { + /* out of memory, forgo scissor */ + fxMesa->numClipRects = dPriv->numClipRects; + fxMesa->pClipRects = dPriv->pClipRects; + fxMesa->scissoredClipRects = GL_FALSE; + } + } + else { + fxMesa->numClipRects = dPriv->numClipRects; + fxMesa->pClipRects = dPriv->pClipRects; + fxMesa->scissoredClipRects = GL_FALSE; + } + + fxMesa->dirty |= TDFX_UPLOAD_CLIP; +} + + + +/* ============================================================= + * Culling + */ + +static void tdfxUpdateCull( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCullMode_t mode = GR_CULL_DISABLE; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Polygon.CullFlag && + (ctx->PB->primitive == GL_POLYGON || + ctx->PB->primitive == GL_BITMAP) ) { + switch ( ctx->Polygon.CullFaceMode ) { + case GL_FRONT: + if ( ctx->Polygon.FrontFace == GL_CCW ) { + mode = GR_CULL_POSITIVE; + } else { + mode = GR_CULL_NEGATIVE; + } + break; + + case GL_BACK: + if ( ctx->Polygon.FrontFace == GL_CCW ) { + mode = GR_CULL_NEGATIVE; + } else { + mode = GR_CULL_POSITIVE; + } + break; + + case GL_FRONT_AND_BACK: + default: + mode = GR_CULL_DISABLE; + break; + } + } + + if ( fxMesa->CullMode != mode ) { + fxMesa->CullMode = mode; + fxMesa->dirty |= TDFX_UPLOAD_CULL; + } +} + +static void tdfxDDCullFace( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; +} + +static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; +} + + +/* ============================================================= + * Line drawing. + */ + +static void tdfxUpdateLine( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + fxMesa->dirty |= TDFX_UPLOAD_LINE; +} + + +static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_LINE; +} + + + +/* ============================================================= + * Color Attributes + */ + +static void tdfxDDLogicOp( GLcontext *ctx, GLenum opcode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if (ctx->Color.ColorLogicOpEnabled) + { + FLUSH_BATCH( fxMesa ); + + if (opcode == GL_COPY) + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; + else + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + } + else + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; +} + + +static GLboolean tdfxDDColorMask( GLcontext *ctx, + GLboolean r, GLboolean g, + GLboolean b, GLboolean a ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + if ( fxMesa->Color.ColorMask[RCOMP] != r || + fxMesa->Color.ColorMask[GCOMP] != g || + fxMesa->Color.ColorMask[BCOMP] != b || + fxMesa->Color.ColorMask[ACOMP] != a ) { + fxMesa->Color.ColorMask[RCOMP] = r; + fxMesa->Color.ColorMask[GCOMP] = g; + fxMesa->Color.ColorMask[BCOMP] = b; + fxMesa->Color.ColorMask[ACOMP] = a; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_MASK; + + if (ctx->Visual->RedBits < 8) { + /* Can't do RGB colormasking in 16bpp mode. */ + /* We can completely ignore the alpha mask. */ + if (r != g || g != b) { + fxMesa->Fallback |= TDFX_FALLBACK_COLORMASK; + } + else { + fxMesa->Fallback &= ~TDFX_FALLBACK_COLORMASK; + } + } + } + + return GL_FALSE; /* This forces the software paths to do colormasking. */ + /* This function will return void when we use Mesa 3.5 */ +} + +static void tdfxDDColor( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrColor_t color; + + FLUSH_BATCH( fxMesa ); + + color = tdfxPackColor( fxMesa->fxScreen->cpp, r, g, b, a ); + + if ( fxMesa->Color.MonoColor != color ) { + fxMesa->Color.MonoColor = color; + fxMesa->dirty |= TDFX_UPLOAD_CONSTANT_COLOR; + } +} + +static void tdfxDDClearColor( GLcontext *ctx, + GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + fxMesa->Color.ClearColor = TDFXPACKCOLOR888( red, green, blue ); + fxMesa->Color.ClearAlpha = alpha; +} + + +/* ============================================================= + * Light Model + */ + +static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname, + const GLfloat *param ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) { + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_SPECULAR; + + if ( ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) { + fxMesa->Fallback |= TDFX_FALLBACK_SPECULAR; + } + } +} + +static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + /* FIXME: Can we implement native flat shading? */ + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + + +/* ============================================================= + * Scissor + */ + +static void +tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CLIP; +} + +/* ============================================================= + * Render + */ + +static void tdfxUpdateRenderAttrib( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->dirty |= TDFX_UPLOAD_RENDER_BUFFER; +} + +/* ============================================================= + * Viewport + */ + +static void tdfxUpdateViewport( GLcontext *ctx ) +{ + /* XXX: Implement this when we're doing clip coordinates */ + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } +} + + +static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y, + GLsizei w, GLsizei h ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_VIEWPORT; +} + + +static void tdfxDDNearFar( GLcontext *ctx, GLfloat nearVal, GLfloat farVal ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_VIEWPORT; +} + + +/* ============================================================= + * State enable/disable + */ + +static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + switch ( cap ) { + case GL_ALPHA_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + break; + + case GL_BLEND: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; + break; + + case GL_CULL_FACE: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; + break; + + case GL_DEPTH_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; + break; + + case GL_DITHER: + FLUSH_BATCH( fxMesa ); + if ( state ) { + fxMesa->Color.Dither = GR_DITHER_2x2; + } else { + fxMesa->Color.Dither = GR_DITHER_DISABLE; + } + fxMesa->dirty |= TDFX_UPLOAD_DITHER; + break; + + case GL_FOG: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_FOG; + break; + + case GL_COLOR_LOGIC_OP: + FLUSH_BATCH( fxMesa ); + if ( state && ctx->Color.LogicOp != GL_COPY ) { + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + } else { + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; + } + break; + + case GL_LINE_SMOOTH: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_LINE; + break; + + case GL_POLYGON_STIPPLE: + FLUSH_BATCH(fxMesa); + fxMesa->new_state |= TDFX_NEW_STIPPLE; + break; + + case GL_SCISSOR_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CLIP; + break; + + case GL_STENCIL_TEST: + FLUSH_BATCH( fxMesa ); + if (fxMesa->haveHwStencil) + fxMesa->new_state |= TDFX_NEW_STENCIL; + else if (state) + fxMesa->Fallback |= TDFX_FALLBACK_STENCIL; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_STENCIL; + break; + + case GL_TEXTURE_1D: + case GL_TEXTURE_3D: + if (state) + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_2D: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + default: + return; + } +} + + + +/* Set the buffer used for drawing */ +/* XXX support for separate read/draw buffers hasn't been tested */ +static GLboolean tdfxDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_BUFFER; + + switch ( mode ) { + case GL_FRONT_LEFT: + fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER; + fxMesa->new_state |= TDFX_NEW_RENDER; + return GL_TRUE; + + case GL_BACK_LEFT: + fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER; + fxMesa->new_state |= TDFX_NEW_RENDER; + return GL_TRUE; + + case GL_NONE: + FX_grColorMaskv( ctx, false4 ); + return GL_TRUE; + + default: + fxMesa->Fallback |= TDFX_FALLBACK_BUFFER; + return GL_FALSE; + } +} + + +/* Set the buffer used for reading */ +/* XXX support for separate read/draw buffers hasn't been tested */ +static void tdfxDDSetReadBuffer( GLcontext *ctx, + GLframebuffer *buffer, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + (void) buffer; + + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_BUFFER; + + switch ( mode ) { + case GL_FRONT_LEFT: + fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; + break; + + case GL_BACK_LEFT: + fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; + break; + + default: + fxMesa->Fallback |= TDFX_FALLBACK_BUFFER; + break; + } +} + +/* ============================================================= + * Polygon stipple + */ + +static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLubyte *m = mask; + GLubyte q[4]; + int i,j,k; + int active = (ctx->Polygon.StippleFlag && ctx->PB->primitive == GL_POLYGON); + + FLUSH_BATCH(fxMesa); + + if (active) { + ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; + } + + q[0] = mask[0]; + q[1] = mask[4]; + q[2] = mask[8]; + q[3] = mask[12]; + + for (k = 0 ; k < 8 ; k++) + for (j = 0 ; j < 4; j++) + for (i = 0 ; i < 4 ; i++,m++) { + if (*m != q[j]) { + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; + fxMesa->Stipple.Pattern = 0xffffffff; /* ensure all pixels on */ + return; + } + } + + /* We can do it, so flag an upload of the stipple pattern */ + fxMesa->Stipple.Pattern = ( (q[0] << 0) | + (q[1] << 8) | + (q[2] << 16) | + (q[3] << 24) ); + fxMesa->dirty |= TDFX_UPLOAD_STIPPLE; +} + +/* Always called between RenderStart and RenderFinish --> We already + * hold the lock. + */ +static void tdfxDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + + tdfxUpdateCull(ctx); + if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) { + grCullMode( fxMesa->CullMode ); + fxMesa->dirty &= ~TDFX_UPLOAD_CULL; + } + + tdfxUpdateStipple(ctx); + if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE ) { + grStipplePattern ( fxMesa->Stipple.Pattern ); + grStippleMode ( fxMesa->Stipple.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE; + } +} + + + +static void tdfxDDPrintState( const char *msg, GLuint flags ) +{ + fprintf( stderr, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & TDFX_NEW_COLOR) ? "color, " : "", + (flags & TDFX_NEW_ALPHA) ? "alpha, " : "", + (flags & TDFX_NEW_DEPTH) ? "depth, " : "", + (flags & TDFX_NEW_RENDER) ? "render, " : "", + (flags & TDFX_NEW_FOG) ? "fog, " : "", + (flags & TDFX_NEW_STENCIL) ? "stencil, " : "", + (flags & TDFX_NEW_STIPPLE) ? "stipple, " : "", + (flags & TDFX_NEW_CLIP) ? "clip, " : "", + (flags & TDFX_NEW_VIEWPORT) ? "viewport, " : "", + (flags & TDFX_NEW_CULL) ? "cull, " : "", + (flags & TDFX_NEW_GLIDE) ? "glide, " : "", + (flags & TDFX_NEW_TEXTURE) ? "texture, " : "", + (flags & TDFX_NEW_CONTEXT) ? "context, " : ""); +} + + + +void tdfxDDUpdateHwState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + int new_state = fxMesa->new_state; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( new_state ) + { + FLUSH_BATCH( fxMesa ); + + fxMesa->new_state = 0; + + if ( 0 ) + tdfxDDPrintState( "tdfxUpdateHwState", new_state ); + + /* Update the various parts of the context's state. + */ + if ( new_state & TDFX_NEW_ALPHA ) { + tdfxUpdateAlphaMode( ctx ); + } + + if ( new_state & TDFX_NEW_DEPTH ) + tdfxUpdateZMode( ctx ); + + if ( new_state & TDFX_NEW_FOG ) + tdfxUpdateFogAttrib( ctx ); + + if ( new_state & TDFX_NEW_CLIP ) + tdfxUpdateClipping( ctx ); + + if ( new_state & TDFX_NEW_STIPPLE ) + tdfxUpdateStipple( ctx ); + + if ( new_state & TDFX_NEW_CULL ) + tdfxUpdateCull( ctx ); + + if ( new_state & TDFX_NEW_LINE ) + tdfxUpdateLine( ctx ); + + if ( new_state & TDFX_NEW_VIEWPORT ) + tdfxUpdateViewport( ctx ); + + if ( new_state & TDFX_NEW_RENDER ) + tdfxUpdateRenderAttrib( ctx ); + + if ( new_state & TDFX_NEW_STENCIL ) + tdfxUpdateStencil( ctx ); + + if ( new_state & TDFX_NEW_TEXTURE ) { + tdfxUpdateTextureState( ctx ); + } + else if ( new_state & TDFX_NEW_TEXTURE_BIND ) { + tdfxUpdateTextureBinding( ctx ); + } + } + + if ( 0 ) { + FxI32 bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE); + + if ( fxMesa->Depth.Bias != bias ) { + fxMesa->Depth.Bias = bias; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS; + } + } + + if ( fxMesa->dirty ) { + LOCK_HARDWARE( fxMesa ); + tdfxEmitHwStateLocked( fxMesa ); + UNLOCK_HARDWARE( fxMesa ); + } +} + + +static void tdfxDDRenderStart( GLcontext *ctx ) +{ + tdfxDDUpdateHwState( ctx ); + LOCK_HARDWARE( TDFX_CONTEXT(ctx) ); +} + +static void tdfxDDRenderFinish( GLcontext *ctx ) +{ + UNLOCK_HARDWARE( TDFX_CONTEXT(ctx) ); +} + +#define INTERESTED (~(NEW_MODELVIEW | \ + NEW_PROJECTION | \ + NEW_TEXTURE_MATRIX | \ + NEW_USER_CLIP | \ + NEW_CLIENT_STATE | \ + NEW_TEXTURE_ENABLE)) + +static void tdfxDDUpdateState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + /* Have to do this here to detect texture, line fallbacks in time: + */ + if ( fxMesa->new_state & (TDFX_NEW_TEXTURE | TDFX_NEW_LINE) ) + tdfxDDUpdateHwState( ctx ); + + if ( ctx->NewState & INTERESTED ) { + tdfxDDChooseRenderState( ctx ); + } + + /* The choise of vertex setup function only depends on whether fog + * and/or texturing is enabled. + */ + if ( ctx->NewState & (NEW_FOG | NEW_TEXTURE_ENABLE | NEW_TEXTURING)) { + tdfxDDChooseRasterSetupFunc( ctx ); + } + + if ( 0 ) + fprintf( stderr, "fallback %x indirect %x\n", + fxMesa->Fallback, fxMesa->IndirectTriangles ); + + if ( fxMesa->Fallback ) { + ctx->IndirectTriangles |= ctx->TriangleCaps; + } + else { + ctx->IndirectTriangles &= ~DD_SW_RASTERIZE; + ctx->IndirectTriangles |= fxMesa->IndirectTriangles; + + ctx->Driver.PointsFunc = fxMesa->PointsFunc; + ctx->Driver.LineFunc = fxMesa->LineFunc; + ctx->Driver.TriangleFunc = fxMesa->TriangleFunc; + ctx->Driver.QuadFunc = fxMesa->QuadFunc; + ctx->Driver.RenderVBRawTab = fxMesa->RenderVBRawTab; + } +} + + + +/* Initialize the context's Glide state mirror. These values will be + * used as Glide function call parameters when the time comes. + */ +void tdfxInitState( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + GLint i; + + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + + fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + + fxMesa->sScale0 = fxMesa->tScale0 = 1.0; + fxMesa->sScale1 = fxMesa->tScale1 = 1.0; + + fxMesa->TexPalette.Type = 0; + fxMesa->TexPalette.Data = NULL; + + for ( i = 0 ; i < TDFX_NUM_TMU ; i++ ) { + fxMesa->TexSource[i].StartAddress = 0; + fxMesa->TexSource[i].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[i].Info = NULL; + + fxMesa->TexCombine[i].FunctionRGB = 0; + fxMesa->TexCombine[i].FactorRGB = 0; + fxMesa->TexCombine[i].FunctionAlpha = 0; + fxMesa->TexCombine[i].FactorAlpha = 0; + fxMesa->TexCombine[i].InvertRGB = FXFALSE; + fxMesa->TexCombine[i].InvertAlpha = FXFALSE; + + fxMesa->TexCombineExt[i].Alpha.SourceA = 0; + /* XXX more state to init here */ + fxMesa->TexCombineExt[i].Color.SourceA = 0; + fxMesa->TexCombineExt[i].EnvColor = 0x0; + + fxMesa->TexParams[i].sClamp = GR_TEXTURECLAMP_WRAP; + fxMesa->TexParams[i].tClamp = GR_TEXTURECLAMP_WRAP; + fxMesa->TexParams[i].minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + fxMesa->TexParams[i].magFilt = GR_TEXTUREFILTER_BILINEAR; + fxMesa->TexParams[i].mmMode = GR_MIPMAP_DISABLE; + fxMesa->TexParams[i].LODblend = FXFALSE; + fxMesa->TexParams[i].LodBias = 0.0; + + fxMesa->TexState.EnvMode[i] = ~0; + fxMesa->TexState.TexFormat[i] = ~0; + fxMesa->TexState.Enabled = 0; + } + + if ( ctx->Visual->DBflag) { + fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER; + fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; + } else { + fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER; + fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; + } + + fxMesa->Color.ClearColor = 0x00000000; + fxMesa->Color.ClearAlpha = 0x00; + fxMesa->Color.ColorMask[RCOMP] = FXTRUE; + fxMesa->Color.ColorMask[BCOMP] = FXTRUE; + fxMesa->Color.ColorMask[GCOMP] = FXTRUE; + fxMesa->Color.ColorMask[ACOMP] = FXTRUE; + fxMesa->Color.MonoColor = 0xffffffff; + + fxMesa->Color.AlphaFunc = GR_CMP_ALWAYS; + fxMesa->Color.AlphaRef = 0x00; + fxMesa->Color.BlendSrcRGB = GR_BLEND_ONE; + fxMesa->Color.BlendDstRGB = GR_BLEND_ZERO; + fxMesa->Color.BlendSrcA = GR_BLEND_ONE; + fxMesa->Color.BlendSrcA = GR_BLEND_ZERO; + + fxMesa->Color.Dither = GR_DITHER_2x2; + + if ( fxMesa->glVis->DepthBits > 0 ) { + fxMesa->Depth.Mode = GR_DEPTHBUFFER_ZBUFFER; + } else { + fxMesa->Depth.Mode = GR_DEPTHBUFFER_DISABLE; + } + fxMesa->Depth.Bias = 0; + fxMesa->Depth.Func = GR_CMP_LESS; + fxMesa->Depth.Clear = 0; /* computed later */ + fxMesa->Depth.Mask = FXTRUE; + + + fxMesa->Fog.Mode = GR_FOG_DISABLE; + fxMesa->Fog.Color = 0x00000000; + fxMesa->Fog.Table = NULL; + fxMesa->Fog.Density = 1.0; + fxMesa->Fog.Near = 1.0; + fxMesa->Fog.Far = 1.0; + + fxMesa->Stencil.Function = GR_CMP_ALWAYS; + fxMesa->Stencil.RefValue = 0; + fxMesa->Stencil.ValueMask = 0xff; + fxMesa->Stencil.WriteMask = 0xff; + fxMesa->Stencil.FailFunc = 0; + fxMesa->Stencil.ZFailFunc = 0; + fxMesa->Stencil.ZPassFunc = 0; + fxMesa->Stencil.Clear = 0; + + fxMesa->Stipple.Mode = GR_STIPPLE_DISABLE; + fxMesa->Stipple.Pattern = 0xffffffff; + + fxMesa->Scissor.minX = 0; + fxMesa->Scissor.minY = 0; + fxMesa->Scissor.maxX = 0; + fxMesa->Scissor.maxY = 0; + + fxMesa->Viewport.Mode = GR_WINDOW_COORDS; + fxMesa->Viewport.X = 0; + fxMesa->Viewport.Y = 0; + fxMesa->Viewport.Width = 0; + fxMesa->Viewport.Height = 0; + fxMesa->Viewport.Near = 0.0; + fxMesa->Viewport.Far = 0.0; + + fxMesa->CullMode = GR_CULL_DISABLE; + + fxMesa->Glide.ColorFormat = GR_COLORFORMAT_ABGR; + fxMesa->Glide.Origin = GR_ORIGIN_LOWER_LEFT; + fxMesa->Glide.Initialized = FXFALSE; +} + + + +void tdfxDDInitStateFuncs( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + ctx->Driver.UpdateState = tdfxDDUpdateState; + + ctx->Driver.ClearIndex = NULL; + ctx->Driver.ClearColor = tdfxDDClearColor; + ctx->Driver.Index = NULL; + ctx->Driver.Color = tdfxDDColor; + ctx->Driver.SetDrawBuffer = tdfxDDSetDrawBuffer; + ctx->Driver.SetReadBuffer = tdfxDDSetReadBuffer; + + ctx->Driver.IndexMask = NULL; + ctx->Driver.ColorMask = tdfxDDColorMask; + + ctx->Driver.NearFar = tdfxDDNearFar; + + ctx->Driver.RenderStart = tdfxDDRenderStart; + ctx->Driver.RenderFinish = tdfxDDRenderFinish; + ctx->Driver.RasterSetup = NULL; + + ctx->Driver.RenderVBClippedTab = NULL; + ctx->Driver.RenderVBCulledTab = NULL; + ctx->Driver.RenderVBRawTab = NULL; + + ctx->Driver.ReducedPrimitiveChange = tdfxDDReducedPrimitiveChange; + ctx->Driver.MultipassFunc = NULL; + + ctx->Driver.AlphaFunc = tdfxDDAlphaFunc; + ctx->Driver.BlendEquation = tdfxDDBlendEquation; + ctx->Driver.BlendFunc = tdfxDDBlendFunc; + ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate; + ctx->Driver.ClearDepth = tdfxDDClearDepth; + ctx->Driver.ClearStencil = NULL; + ctx->Driver.CullFace = tdfxDDCullFace; + ctx->Driver.FrontFace = tdfxDDFrontFace; + ctx->Driver.DepthFunc = tdfxDDDepthFunc; + ctx->Driver.DepthMask = tdfxDDDepthMask; + ctx->Driver.DepthRange = NULL; + ctx->Driver.Enable = tdfxDDEnable; + ctx->Driver.Fogfv = tdfxDDFogfv; + ctx->Driver.Hint = NULL; + ctx->Driver.Lightfv = NULL; + ctx->Driver.LightModelfv = tdfxDDLightModelfv; + ctx->Driver.LineStipple = NULL; + ctx->Driver.LineWidth = tdfxDDLineWidth; + ctx->Driver.LogicOpcode = tdfxDDLogicOp; +#if 0 + ctx->Driver.PolygonMode = NULL; +#endif + ctx->Driver.PolygonStipple = tdfxDDPolygonStipple; + ctx->Driver.Scissor = tdfxDDScissor; + ctx->Driver.ShadeModel = tdfxDDShadeModel; + + ctx->Driver.BindTexture = tdfxDDBindTexture; + ctx->Driver.DeleteTexture = tdfxDDDeleteTexture; + ctx->Driver.TexEnv = tdfxDDTexEnv; + ctx->Driver.TexParameter = tdfxDDTexParameter; + ctx->Driver.TexImage2D = tdfxDDTexImage2D; + ctx->Driver.TexSubImage2D = tdfxDDTexSubImage2D; + ctx->Driver.GetTexImage = tdfxDDGetTexImage; + ctx->Driver.UpdateTexturePalette = tdfxDDTexturePalette; + + if ( fxMesa->haveHwStencil ) { + ctx->Driver.StencilFunc = tdfxDDStencilFunc; + ctx->Driver.StencilMask = tdfxDDStencilMask; + ctx->Driver.StencilOp = tdfxDDStencilOp; + } else { + ctx->Driver.StencilFunc = NULL; + ctx->Driver.StencilMask = NULL; + ctx->Driver.StencilOp = NULL; + } + + ctx->Driver.Viewport = tdfxDDViewport; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h new file mode 100644 index 000000000..735c858b4 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h @@ -0,0 +1,55 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_STATE_H__ +#define __TDFX_STATE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" +#include "tdfx_context.h" + +extern void tdfxDDInitStateFuncs( GLcontext *ctx ); + +extern void tdfxDDUpdateHwState( GLcontext *ctx ); + +extern void tdfxInitState( tdfxContextPtr fxMesa ); + +extern void tdfxUpdateClipping( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c new file mode 100644 index 000000000..fbdf9a612 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c @@ -0,0 +1,1603 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "image.h" +#include "texutil.h" +#include "tdfx_context.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" + + + +static int +logbase2(int n) +{ + GLint i = 1; + GLint log2 = 0; + + if (n < 0) { + return -1; + } + + while (n > i) { + i *= 2; + log2++; + } + if (i != n) { + return -1; + } + else { + return log2; + } +} + + +/* + * Compute various texture image parameters. + * Input: w, h - source texture width and height + * Output: lodlevel - Glide lod level token for the larger texture dimension + * aspectratio - Glide aspect ratio token + * sscale - S scale factor used during triangle setup + * tscale - T scale factor used during triangle setup + * wscale - OpenGL -> Glide image width scale factor + * hscale - OpenGL -> Glide image height scale factor + * + * Sample results: + * w h lodlevel aspectRatio + * 128 128 GR_LOD_LOG2_128 (=7) GR_ASPECT_LOG2_1x1 (=0) + * 64 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x1 (=0) + * 64 32 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_2x1 (=1) + * 32 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x2 (=-1) + * 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0) + */ +static void +tdfxTexGetInfo(const GLcontext *ctx, int w, int h, + GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio, + float *sscale, float *tscale, + int *wscale, int *hscale) +{ + int logw, logh, ar, lod, ws, hs; + float s, t; + + ASSERT(w >= 1); + ASSERT(h >= 1); + + logw = logbase2(w); + logh = logbase2(h); + ar = logw - logh; /* aspect ratio = difference in log dimensions */ + + /* Hardware only allows a maximum aspect ratio of 8x1, so handle + |ar| > 3 by scaling the image and using an 8x1 aspect ratio */ + if (ar >= 0) { + ASSERT(width >= height); + lod = logw; + s = 256.0; + ws = 1; + if (ar <= GR_ASPECT_LOG2_8x1) { + t = 256 >> ar; + hs = 1; + } + else { + /* have to stretch image height */ + t = 32.0; + hs = 1 << (ar - 3); + } + } + else { + ASSERT(width < height); + lod = logh; + t = 256.0; + hs = 1; + if (ar >= GR_ASPECT_LOG2_1x8) { + s = 256 >> -ar; + ws = 1; + } + else { + /* have to stretch image width */ + s = 32.0; + ws = 1 << (-ar - 3); + } + } + + if (ar < GR_ASPECT_LOG2_1x8) + ar = GR_ASPECT_LOG2_1x8; + else if (ar > GR_ASPECT_LOG2_8x1) + ar = GR_ASPECT_LOG2_8x1; + + if (lodlevel) + *lodlevel = (GrLOD_t) lod; + if (aspectratio) + *aspectratio = (GrAspectRatio_t) ar; + if (sscale) + *sscale = s; + if (tscale) + *tscale = t; + if (wscale) + *wscale = ws; + if (hscale) + *hscale = hs; +} + + +/* + * We need to call this when a texture object's minification filter + * or texture image sizes change. + */ +static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj) +{ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + GLint minl, maxl; + + if (!ti) + return; + + minl = maxl = tObj->BaseLevel; + + if (tObj->Image[minl]) { + maxl = MIN2(tObj->MaxLevel, tObj->Image[minl]->MaxLog2); + + /* compute largeLodLog2, aspect ratio and texcoord scale factors */ + tdfxTexGetInfo(ctx, tObj->Image[minl]->Width, tObj->Image[minl]->Height, + &ti->info.largeLodLog2, + &ti->info.aspectRatioLog2, + &(ti->sScale), &(ti->tScale), NULL, NULL); + } + + if (tObj->Image[maxl] && (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) { + /* mipmapping: need to compute smallLodLog2 */ + tdfxTexGetInfo(ctx, tObj->Image[maxl]->Width, + tObj->Image[maxl]->Height, + &ti->info.smallLodLog2, NULL, + NULL, NULL, NULL, NULL); + } + else { + /* not mipmapping: smallLodLog2 = largeLodLog2 */ + ti->info.smallLodLog2 = ti->info.largeLodLog2; + } + + ti->minLevel = minl; + ti->maxLevel = maxl; + ti->info.data = NULL; +} + + +static tdfxTexInfo * +fxAllocTexObjData(tdfxContextPtr fxMesa) +{ + tdfxTexInfo *ti; + int i; + + if (!(ti = CALLOC(sizeof(tdfxTexInfo)))) { + gl_problem(NULL, "tdfx driver: out of memory"); + return NULL; + } + + ti->isInTM = GL_FALSE; + + ti->whichTMU = TDFX_TMU_NONE; + + ti->tm[TDFX_TMU0] = NULL; + ti->tm[TDFX_TMU1] = NULL; + + ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + ti->magFilt = GR_TEXTUREFILTER_BILINEAR; + + ti->sClamp = GR_TEXTURECLAMP_WRAP; + ti->tClamp = GR_TEXTURECLAMP_WRAP; + + ti->mmMode = GR_MIPMAP_NEAREST; + ti->LODblend = FXFALSE; + + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + ti->mipmapLevel[i].data = NULL; + } + + return ti; +} + + +/* + * Called via glBindTexture. + */ + +void +tdfxDDBindTexture(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexBind(%d,%p)\n", tObj->Name, + tObj->DriverData); + } + + if (target != GL_TEXTURE_2D) + return; + + if (!tObj->DriverData) { + tObj->DriverData = fxAllocTexObjData(fxMesa); + } + + ti = TDFX_TEXTURE_DATA(tObj); + ti->lastTimeUsed = fxMesa->texBindNumber++; + + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + + +/* + * Called via glTexEnv. + */ +void +tdfxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname, + const GLfloat * param) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + if (param) + fprintf(stderr, "fxmesa: texenv(%x,%x)\n", pname, + (GLint) (*param)); + else + fprintf(stderr, "fxmesa: texenv(%x)\n", pname); + } + + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + + +/* + * Called via glTexParameter. + */ +void +tdfxDDTexParameter(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj, + GLenum pname, const GLfloat * params) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLenum param = (GLenum) (GLint) params[0]; + tdfxTexInfo *ti; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexParam(%d,%p,%x,%x)\n", tObj->Name, + tObj->DriverData, pname, param); + } + + if (target != GL_TEXTURE_2D) + return; + + if (!tObj->DriverData) + tObj->DriverData = fxAllocTexObjData(fxMesa); + + ti = TDFX_TEXTURE_DATA(tObj); + + switch (pname) { + case GL_TEXTURE_MIN_FILTER: + switch (param) { + case GL_NEAREST: + ti->mmMode = GR_MIPMAP_DISABLE; + ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + ti->LODblend = FXFALSE; + break; + case GL_LINEAR: + ti->mmMode = GR_MIPMAP_DISABLE; + ti->minFilt = GR_TEXTUREFILTER_BILINEAR; + ti->LODblend = FXFALSE; + break; + case GL_NEAREST_MIPMAP_LINEAR: + if (TDFX_IS_NAPALM(fxMesa)) { + if (fxMesa->haveTwoTMUs) { + ti->mmMode = GR_MIPMAP_NEAREST; + ti->LODblend = FXTRUE; + } + else { + ti->mmMode = GR_MIPMAP_NEAREST_DITHER; + ti->LODblend = FXFALSE; + } + ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + break; + } + /* XXX Voodoo3/Banshee mipmap blending seems to produce + * incorrectly filtered colors for the smallest mipmap levels. + * To work-around we fall-through here and use a different filter. + */ + case GL_NEAREST_MIPMAP_NEAREST: + ti->mmMode = GR_MIPMAP_NEAREST; + ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + ti->LODblend = FXFALSE; + break; + case GL_LINEAR_MIPMAP_LINEAR: + if (TDFX_IS_NAPALM(fxMesa)) { + if (fxMesa->haveTwoTMUs) { + ti->mmMode = GR_MIPMAP_NEAREST; + ti->LODblend = FXTRUE; + } + else { + ti->mmMode = GR_MIPMAP_NEAREST_DITHER; + ti->LODblend = FXFALSE; + } + ti->minFilt = GR_TEXTUREFILTER_BILINEAR; + break; + } + /* XXX Voodoo3/Banshee mipmap blending seems to produce + * incorrectly filtered colors for the smallest mipmap levels. + * To work-around we fall-through here and use a different filter. + */ + case GL_LINEAR_MIPMAP_NEAREST: + ti->mmMode = GR_MIPMAP_NEAREST; + ti->minFilt = GR_TEXTUREFILTER_BILINEAR; + ti->LODblend = FXFALSE; + break; + default: + break; + } + RevalidateTexture(ctx, tObj); + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_MAG_FILTER: + switch (param) { + case GL_NEAREST: + ti->magFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + break; + case GL_LINEAR: + ti->magFilt = GR_TEXTUREFILTER_BILINEAR; + break; + default: + break; + } + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_WRAP_S: + switch (param) { + case GL_CLAMP: + ti->sClamp = GR_TEXTURECLAMP_CLAMP; + break; + case GL_REPEAT: + ti->sClamp = GR_TEXTURECLAMP_WRAP; + break; + default: + break; + } + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_WRAP_T: + switch (param) { + case GL_CLAMP: + ti->tClamp = GR_TEXTURECLAMP_CLAMP; + break; + case GL_REPEAT: + ti->tClamp = GR_TEXTURECLAMP_WRAP; + break; + default: + break; + } + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_BORDER_COLOR: + /* TO DO */ + break; + case GL_TEXTURE_MIN_LOD: + /* TO DO */ + break; + case GL_TEXTURE_MAX_LOD: + /* TO DO */ + break; + case GL_TEXTURE_BASE_LEVEL: + RevalidateTexture(ctx, tObj); + break; + case GL_TEXTURE_MAX_LEVEL: + RevalidateTexture(ctx, tObj); + break; + + default: + break; + } +} + + +/* + * Called via glDeleteTextures to delete a texture object. + * Here, we delete the Glide data associated with the texture. + */ +void +tdfxDDDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTMFreeTexture(fxMesa, tObj); + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + + +/* + * Return true if texture is resident, false otherwise. + */ +GLboolean +tdfxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj) +{ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + return (GLboolean) (ti && ti->isInTM); +} + + + +/* + * Convert a gl_color_table texture palette to Glide's format. + */ +static void +convertPalette(FxU32 data[256], const struct gl_color_table *table) +{ + const GLubyte *tableUB = (const GLubyte *) table->Table; + GLint width = table->Size; + FxU32 r, g, b, a; + GLint i; + + ASSERT(table->TableType == GL_UNSIGNED_BYTE); + + switch (table->Format) { + case GL_INTENSITY: + for (i = 0; i < width; i++) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = tableUB[i]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_LUMINANCE: + for (i = 0; i < width; i++) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = 255; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_ALPHA: + for (i = 0; i < width; i++) { + r = g = b = 255; + a = tableUB[i]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_LUMINANCE_ALPHA: + for (i = 0; i < width; i++) { + r = g = b = tableUB[i * 2 + 0]; + a = tableUB[i * 2 + 1]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_RGB: + for (i = 0; i < width; i++) { + r = tableUB[i * 3 + 0]; + g = tableUB[i * 3 + 1]; + b = tableUB[i * 3 + 2]; + a = 255; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_RGBA: + for (i = 0; i < width; i++) { + r = tableUB[i * 4 + 0]; + g = tableUB[i * 4 + 1]; + b = tableUB[i * 4 + 2]; + a = tableUB[i * 4 + 3]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + } +} + + + +void +tdfxDDTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if (tObj) { + /* per-texture palette */ + tdfxTexInfo *ti; + if (!tObj->DriverData) + tObj->DriverData = fxAllocTexObjData(fxMesa); + ti = TDFX_TEXTURE_DATA(tObj); + convertPalette(ti->palette.data, &tObj->Palette); + /*tdfxTexInvalidate(ctx, tObj);*/ + } + else { + /* global texture palette */ + convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette); + } + fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX too heavy-handed */ +} + + +/* + * Given an OpenGL internal texture format, return the corresponding + * Glide internal texture format and MesaIntTexFormat. + * If allow32bpp is true, we'll return 32-bit texel formats when + * appropriate. + */ +static void +tdfxTexGetFormat(GLenum intFormatHint, GLboolean allow32bpp, + GrTextureFormat_t *glideFormat, + MesaIntTexFormat *mesaFormat, + GLint *texelSize) +{ + switch (intFormatHint) { + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + if (glideFormat) + *glideFormat = GR_TEXFMT_INTENSITY_8; + if (mesaFormat) + *mesaFormat = MESA_L8; + if (texelSize) + *texelSize = 1; + break; + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + if (glideFormat) + *glideFormat = GR_TEXFMT_ALPHA_INTENSITY_88; + if (mesaFormat) + *mesaFormat = MESA_A8_L8; + if (texelSize) + *texelSize = 2; + break; + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + if (glideFormat) + *glideFormat = GR_TEXFMT_ALPHA_8; + if (mesaFormat) + *mesaFormat = MESA_I8; + if (texelSize) + *texelSize = 1; + break; + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + if (glideFormat) + *glideFormat = GR_TEXFMT_ALPHA_8; + if (mesaFormat) + *mesaFormat = MESA_A8; + if (texelSize) + *texelSize = 1; + break; + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + if (glideFormat) + *glideFormat = GR_TEXFMT_RGB_565; + if (mesaFormat) + *mesaFormat = MESA_R5_G6_B5; + if (texelSize) + *texelSize = 2; + break; + case 3: + case GL_RGB: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + if (allow32bpp) { + if (glideFormat) + *glideFormat = GR_TEXFMT_ARGB_8888; + if (mesaFormat) + *mesaFormat = MESA_FF_R8_G8_B8; + if (texelSize) + *texelSize = 4; + } + else { + if (glideFormat) + *glideFormat = GR_TEXFMT_RGB_565; + if (mesaFormat) + *mesaFormat = MESA_R5_G6_B5; + if (texelSize) + *texelSize = 2; + } + break; + case GL_RGBA2: + case GL_RGBA4: + if (glideFormat) + *glideFormat = GR_TEXFMT_ARGB_4444; + if (mesaFormat) + *mesaFormat = MESA_A4_R4_G4_B4; + if (texelSize) + *texelSize = 2; + break; + case 4: + case GL_RGBA: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + if (allow32bpp) { + if (glideFormat) + *glideFormat = GR_TEXFMT_ARGB_8888; + if (mesaFormat) + *mesaFormat = MESA_A8_R8_G8_B8; + if (texelSize) + *texelSize = 4; + } + else { + if (glideFormat) + *glideFormat = GR_TEXFMT_ARGB_4444; + if (mesaFormat) + *mesaFormat = MESA_A4_R4_G4_B4; + if (texelSize) + *texelSize = 2; + } + break; + case GL_RGB5_A1: + if (glideFormat) + *glideFormat = GR_TEXFMT_ARGB_1555; + if (mesaFormat) + *mesaFormat = MESA_A1_R5_G5_B5; + if (texelSize) + *texelSize = 2; + break; + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + if (glideFormat) + *glideFormat = GR_TEXFMT_P_8; + if (mesaFormat) + *mesaFormat = MESA_C8; + if (texelSize) + *texelSize = 1; + break; + case GL_COMPRESSED_RGB_FXT1_3DFX: + if (glideFormat) + *glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; + if (mesaFormat) + *mesaFormat = MESA_A8_R8_G8_B8; + if (texelSize) + *texelSize = 4; + break; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + if (glideFormat) + *glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; + if (mesaFormat) + *mesaFormat = MESA_A8_R8_G8_B8; + if (texelSize) + *texelSize = 4; + break; + default: + fprintf(stderr, "bad texture format in fxTexGetFormat() %d", intFormatHint); + break; + } +} + + +/**********************************************************************/ +/**** NEW TEXTURE IMAGE FUNCTIONS ****/ +/**********************************************************************/ + +static FxBool TexusFatalError = FXFALSE; +static FxBool TexusError = FXFALSE; + +#define TX_DITHER_NONE 0x00000000 + +static void +fxTexusError(const char *string, FxBool fatal) +{ + gl_problem(NULL, string); + /* + * Just propagate the fatal value up. + */ + TexusError = FXTRUE; + TexusFatalError = fatal; +} + +GLboolean +tdfxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage, + GLboolean * retainInternalCopy) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLboolean allow32bpt = 0 /*TDFX_IS_NAPALM(fxMesa)*/; + GrTextureFormat_t gldformat; + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; + GLint dstWidth, dstHeight, wScale, hScale, texelSize, dstStride; + MesaIntTexFormat intFormat; + GLboolean isCompressedFormat; + GLint texsize; + void *uncompressedImage; + + /* + printf("TexImage id=%d int 0x%x format 0x%x type 0x%x %dx%d\n", + texObj->Name, texImage->IntFormat, format, type, + texImage->Width, texImage->Height); + */ + + isCompressedFormat = texImage->IsCompressed; + if (target != GL_TEXTURE_2D || texImage->Border > 0) + return GL_FALSE; + + if (!texObj->DriverData) + texObj->DriverData = fxAllocTexObjData(fxMesa); + + ti = TDFX_TEXTURE_DATA(texObj); + mml = &ti->mipmapLevel[level]; + + /* Determine the appropriate GL internal texel format, Mesa internal + * texel format, and texelSize (bytes) given the user's internal + * texture format hint. + */ + tdfxTexGetFormat(texImage->IntFormat, allow32bpt, + &gldformat, &intFormat, &texelSize); + + /* Determine width and height scale factors for texture. + * Remember, Glide is limited to 8:1 aspect ratios. + */ + tdfxTexGetInfo(ctx, + texImage->Width, texImage->Height, + NULL, /* lod level */ + NULL, /* aspect ratio */ + NULL, NULL, /* sscale, tscale */ + &wScale, &hScale); + dstWidth = texImage->Width * wScale; + dstHeight = texImage->Height * hScale; + if (isCompressedFormat) { + texsize = tdfxDDCompressedImageSize(ctx, + texImage->IntFormat, + 2, + texImage->Width, + texImage->Height, + 1); + } + else { + texsize = dstWidth * dstHeight * texelSize; + } + + /* + * If the image is not compressed, this doesn't + * matter, but it might as well have a sensible + * value, and it might save a failure later on. + */ + texImage->CompressedSize = texsize; + /* housekeeping */ + _mesa_set_teximage_component_sizes(intFormat, texImage); + + /* + * allocate new storage for texture image, if needed. + * This conditional wants to set uncompressedImage to + * point to the uncompressed image, and mml->data to + * the texture data. If the image is uncompressed, + * these are identical. If the image is not compressed, + * these are different. + */ + if (!mml->data || mml->glideFormat != gldformat || + mml->width != dstWidth || mml->height != dstHeight || + texsize != mml->dataSize ) { + if (mml->data) { + FREE(mml->data); + } + uncompressedImage + = (void *)MALLOC(dstWidth * dstHeight * texelSize); + if (!uncompressedImage) { + return GL_FALSE; + } + if (isCompressedFormat) { + mml->data = MALLOC(texsize); + if (!mml->data) { + FREE(uncompressedImage); + return GL_FALSE; + } + } else { + mml->data = uncompressedImage; + } + mml->texelSize = texelSize; + mml->glideFormat = gldformat; + mml->width = dstWidth; + mml->height = dstHeight; + mml->dataSize = texsize; + ti->info.format = gldformat; + tdfxTMMoveOutTM(fxMesa, texObj); + /*tdfxTexInvalidate(ctx, texObj);*/ + } + else { + /* + * Here we don't have to allocate anything, but we + * do have to point uncompressedImage to the uncompressed + * data. + */ + if (isCompressedFormat) { + uncompressedImage + = (void *)MALLOC(dstWidth * dstHeight * texelSize); + if (!uncompressedImage) { + return GL_FALSE; + } + } else { + uncompressedImage = mml->data; + } + } + + dstStride = dstWidth * texelSize; + + /* store the texture image into uncompressedImage */ + if (!_mesa_convert_teximage(intFormat, + dstWidth, dstHeight, + uncompressedImage, + dstStride, + texImage->Width, texImage->Height, + format, type, pixels, packing)) { + /*printf("convert failed\n");*/ + return GL_FALSE; /* not necessarily an error */ + } + + /* + * Now compress it if necessary. + */ + if (isCompressedFormat) { + TxErrorCallbackFnc_t oldErrorCallback; + (*txErrorSetCallbackProc)(fxTexusError, &oldErrorCallback); + (*txImgQuantizeProc)((char *)mml->data, + (char *)uncompressedImage, + texImage->Width, + texImage->Height, + gldformat, + TX_DITHER_NONE); + (*txErrorSetCallbackProc)(oldErrorCallback, NULL); + if (uncompressedImage != mml->data) { + /* + * We do not need this any more, errors or no. + */ + FREE(uncompressedImage); + } + TexusError = FXFALSE; + if (TexusFatalError) { + FREE(mml->data); + mml->data = NULL; + TexusFatalError = FXFALSE; + return GL_FALSE; + } + } + + + RevalidateTexture(ctx, texObj); + + ti->reloadImages = GL_TRUE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + + *retainInternalCopy = GL_FALSE; + return GL_TRUE; +} + + +GLboolean +tdfxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; + GLint wscale, hscale, dstStride = 0; + tdfxMipMapLevel *mml; + GLboolean result; + void *uncompressedImage = (void *)0; + FxU32 uncompressedSize; + TxErrorCallbackFnc_t oldErrorCallback; + + if (target != GL_TEXTURE_2D) + return GL_FALSE; + + if (!texObj->DriverData) + return GL_FALSE; + + /* + printf("TexSubImage id=%d lvl=%d int=0x%x format=0x%x type=0x%x x=%d y=%d w=%d h=%d fullW=%d fullH=%d\n", + texObj->Name, level, + texImage->IntFormat, format, type, xoffset, yoffset, width, height, + texImage->Width, texImage->Height); + */ + + ti = TDFX_TEXTURE_DATA(texObj); + mml = &ti->mipmapLevel[level]; + + tdfxTexGetInfo(ctx, texImage->Width, texImage->Height, NULL, NULL, + NULL, NULL, &wscale, &hscale); + + /* + * Must have an existing texture image! + */ + assert(mml->data); + + switch (mml->glideFormat) { + case GR_TEXFMT_INTENSITY_8: + dstStride = mml->width; + result = _mesa_convert_texsubimage(MESA_I8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ALPHA_8: + dstStride = mml->width; + result = _mesa_convert_texsubimage(MESA_A8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_P_8: + dstStride = mml->width; + result = _mesa_convert_texsubimage(MESA_C8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ALPHA_INTENSITY_88: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_A8_L8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_RGB_565: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_R5_G6_B5, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ARGB_4444: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_A4_R4_G4_B4, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ARGB_CMP_FXT1: + /* + * There are some special legality constraints for compressed + * textures. + */ + if ((xoffset != texImage->Border) + || (yoffset != texImage->Border)) { + gl_error( ctx, + GL_INVALID_OPERATION, + "glTexSubImage2D(offset)" ); + return GL_FALSE; + } + if ((width != texImage->Width) + || (height != texImage->Height)) { + gl_error( ctx, + GL_INVALID_VALUE, + "glTexSubImage2D(image size)" ); + return GL_FALSE; + } + /* + * The width and height have to be multiples of + * 8 and 4 respectively. + */ + width = (mml->width + 0x7) &~ 0x7; + height = (mml->height + 0x3) &~ 0x3; + /* + * A texel is 8888 for this format. + */ + uncompressedSize = mml->width * mml->height * 4; + uncompressedImage = (void *)MALLOC(uncompressedSize); + /* + * Convert the data. + */ + dstStride = mml->width * 4; + result = _mesa_convert_texsubimage(MESA_A8_R8_G8_B8, xoffset, yoffset, + mml->width, mml->height, uncompressedImage, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + if (!result) { + FREE(uncompressedImage); + printf("TexSubImage convert failed\n"); + return GL_FALSE; + } + /* + * Now that we have converted the data, then compress it. + */ + (*txErrorSetCallbackProc)(fxTexusError, &oldErrorCallback); + (*txImgQuantizeProc)((char *)mml->data, + (char *)uncompressedImage, + mml->width, + mml->height, + mml->glideFormat, + TX_DITHER_NONE); + (*txErrorSetCallbackProc)(oldErrorCallback, NULL); + result = TexusFatalError; + TexusFatalError = TexusError = FXFALSE; + /* + * We don't need this any more. + */ + FREE(uncompressedImage); + break; + case GR_TEXFMT_ARGB_8888: + { + MesaIntTexFormat intFormat; + if (texImage->Format == GL_RGB) { + /* An RGB image padded out to 4 bytes/texel */ + intFormat = MESA_FF_R8_G8_B8; + } + else { + intFormat = MESA_A8_R8_G8_B8; + } + dstStride = mml->width * 4; + result = _mesa_convert_texsubimage(intFormat, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + } + break; + case GR_TEXFMT_ARGB_1555: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_A1_R5_G5_B5, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + default: + gl_problem(NULL, "tdfx driver: fxTexBuildSubImageMap() bad format"); + result = GL_FALSE; + } + + if (!result) { + return GL_FALSE; + } + + ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */ + fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX this might be a bit much */ + + return GL_TRUE; +} + + +/**********************************************************************/ +/**** COMPRESSED TEXTURE IMAGE FUNCTIONS ****/ +/**********************************************************************/ + +GLboolean +tdfxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, + GLint level, GLsizei imageSize, + const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLboolean allow32bpt = TDFX_IS_NAPALM(fxMesa); + GrTextureFormat_t gldformat; + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; + GLint dstWidth, dstHeight, wScale, hScale, texelSize; + MesaIntTexFormat intFormat; + GLboolean isCompressedFormat; + GLsizei texsize; + + if (target != GL_TEXTURE_2D || texImage->Border > 0) + return GL_FALSE; + + if (!texObj->DriverData) + texObj->DriverData = fxAllocTexObjData(fxMesa); + + ti = TDFX_TEXTURE_DATA(texObj); + mml = &ti->mipmapLevel[level]; + + isCompressedFormat = tdfxDDIsCompressedGlideFormatMacro(texImage->IntFormat); + if (!isCompressedFormat) { + gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(format)" ); + return GL_FALSE; + } + /* Determine the apporpriate GL internal texel format, Mesa internal + * texel format, and texelSize (bytes) given the user's internal + * texture format hint. + */ + tdfxTexGetFormat(texImage->IntFormat, allow32bpt, + &gldformat, &intFormat, &texelSize); + + /* Determine width and height scale factors for texture. + * Remember, Glide is limited to 8:1 aspect ratios. + */ + tdfxTexGetInfo(ctx, + texImage->Width, texImage->Height, + NULL, /* lod level */ + NULL, /* aspect ratio */ + NULL, NULL, /* sscale, tscale */ + &wScale, &hScale); + dstWidth = texImage->Width * wScale; + dstHeight = texImage->Height * hScale; + /* housekeeping */ + _mesa_set_teximage_component_sizes(intFormat, texImage); + + texsize = tdfxDDCompressedImageSize(ctx, + texImage->IntFormat, + 2, + texImage->Width, + texImage->Height, + 1); + if (texsize != imageSize) { + gl_error(ctx, + GL_INVALID_VALUE, + "glCompressedTexImage2D(texsize)"); + return GL_FALSE; + } + + /* allocate new storage for texture image, if needed */ + if (!mml->data || mml->glideFormat != gldformat || + mml->width != dstWidth || mml->height != dstHeight || + texsize != mml->dataSize) { + if (mml->data) { + FREE(mml->data); + } + mml->data = MALLOC(texsize); + if (!mml->data) { + return GL_FALSE; + } + mml->texelSize = texelSize; + mml->glideFormat = gldformat; + mml->width = dstWidth; + mml->height = dstHeight; + tdfxTMMoveOutTM(fxMesa, texObj); + /*tdfxTexInvalidate(ctx, texObj);*/ + } + + /* save the texture data */ + MEMCPY(mml->data, data, imageSize); + + RevalidateTexture(ctx, texObj); + + ti->reloadImages = GL_TRUE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + + *retainInternalCopy = GL_FALSE; + return GL_TRUE; +} + +GLboolean +tdfxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; + + /* + * We punt if we are not replacing the entire image. This + * is allowed by the spec. + */ + if ((xoffset != 0) && (yoffset != 0) + && (width != texImage->Width) + && (height != texImage->Height)) { + return GL_FALSE; + } + + ti = TDFX_TEXTURE_DATA(texObj); + mml = &ti->mipmapLevel[level]; + if (imageSize != mml->dataSize) { + return GL_FALSE; + } + MEMCPY(data, mml->data, imageSize); + + ti->reloadImages = GL_TRUE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + + return GL_TRUE; +} + + +#if 0 +static void +PrintTexture(int w, int h, int c, const GLubyte * data) +{ + int i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + if (c == 2) + printf("%02x %02x ", data[0], data[1]); + else if (c == 3) + printf("%02x %02x %02x ", data[0], data[1], data[2]); + data += c; + } + printf("\n"); + } +} +#endif + + +GLboolean +tdfxDDTestProxyTexImage(GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + + switch (target) { + case GL_PROXY_TEXTURE_1D: + return GL_TRUE; /* software rendering */ + case GL_PROXY_TEXTURE_2D: + { + struct gl_texture_object *tObj; + tdfxTexInfo *ti; + int memNeeded; + + tObj = ctx->Texture.Proxy2D; + if (!tObj->DriverData) + tObj->DriverData = fxAllocTexObjData(fxMesa); + ti = TDFX_TEXTURE_DATA(tObj); + + /* assign the parameters to test against */ + tObj->Image[level]->Width = width; + tObj->Image[level]->Height = height; + tObj->Image[level]->Border = border; + tObj->Image[level]->IntFormat = internalFormat; + if (level == 0) { + /* don't use mipmap levels > 0 */ + tObj->MinFilter = tObj->MagFilter = GL_NEAREST; + } + else { + /* test with all mipmap levels */ + tObj->MinFilter = GL_LINEAR_MIPMAP_LINEAR; + tObj->MagFilter = GL_NEAREST; + } + RevalidateTexture(ctx, tObj); + + /* + printf("small lodlog2 0x%x\n", ti->info.smallLodLog2); + printf("large lodlog2 0x%x\n", ti->info.largeLodLog2); + printf("aspect ratio 0x%x\n", ti->info.aspectRatioLog2); + printf("glide format 0x%x\n", ti->info.format); + printf("data %p\n", ti->info.data); + printf("lodblend %d\n", (int) ti->LODblend); + */ + + /* determine where texture will reside */ + if (ti->LODblend && !shared->umaTexMemory) { + /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */ + memNeeded = FX_grTexTextureMemRequired_NoLock( + GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); + } + else { + /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */ + memNeeded = FX_grTexTextureMemRequired_NoLock( + GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); + } + /* + printf("Proxy test %d > %d\n", memNeeded, shared->totalTexMem[0]); + */ + if (memNeeded > shared->totalTexMem[0]) + return GL_FALSE; + else + return GL_TRUE; + } + case GL_PROXY_TEXTURE_3D: + return GL_TRUE; /* software rendering */ + default: + return GL_TRUE; /* never happens, silence compiler */ + } +} + + +/* + * Return a texture image to Mesa. This is either to satisfy + * a glGetTexImage() call or to prepare for software texturing. + */ +GLvoid * +tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum * formatOut, GLenum * typeOut, + GLboolean * freeImageOut) +{ + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; + + if (target != GL_TEXTURE_2D) + return NULL; + + if (!texObj->DriverData) + return NULL; + + ti = TDFX_TEXTURE_DATA(texObj); + mml = &ti->mipmapLevel[level]; + if (mml->data) { + MesaIntTexFormat mesaFormat; + GLenum glFormat; + struct gl_texture_image *texImage = texObj->Image[level]; + GLint srcStride; + void *uncompressedImage = NULL; + + GLubyte *data = + (GLubyte *) MALLOC(texImage->Width * texImage->Height * 4); + if (!data) + return NULL; + + uncompressedImage = (void *)mml->data; + switch (mml->glideFormat) { + case GR_TEXFMT_INTENSITY_8: + mesaFormat = MESA_I8; + glFormat = GL_INTENSITY; + srcStride = mml->width; + break; + case GR_TEXFMT_ALPHA_INTENSITY_88: + mesaFormat = MESA_A8_L8; + glFormat = GL_LUMINANCE_ALPHA; + srcStride = mml->width; + break; + case GR_TEXFMT_ALPHA_8: + if (texImage->Format == GL_INTENSITY) { + mesaFormat = MESA_I8; + glFormat = GL_INTENSITY; + } + else { + mesaFormat = MESA_A8; + glFormat = GL_ALPHA; + } + srcStride = mml->width; + break; + case GR_TEXFMT_RGB_565: + mesaFormat = MESA_R5_G6_B5; + glFormat = GL_RGB; + srcStride = mml->width * 2; + break; + case GR_TEXFMT_ARGB_8888: + mesaFormat = MESA_A8_R8_G8_B8; + glFormat = GL_RGBA; + srcStride = mml->width * 4; + break; + case GR_TEXFMT_ARGB_4444: + mesaFormat = MESA_A4_R4_G4_B4; + glFormat = GL_RGBA; + srcStride = mml->width * 2; + break; + case GR_TEXFMT_ARGB_1555: + mesaFormat = MESA_A1_R5_G5_B5; + glFormat = GL_RGBA; + srcStride = mml->width * 2; + break; + case GR_TEXFMT_P_8: + mesaFormat = MESA_C8; + glFormat = GL_COLOR_INDEX; + srcStride = mml->width; + break; + case GR_TEXFMT_ARGB_CMP_FXT1: + mesaFormat = MESA_A8_R8_G8_B8; + glFormat = GL_RGBA; + srcStride = mml->width * 4; + /* + * Allocate data for the uncompressed image, + * decompress the image. The data will be deallocated + * after it is converted to the mesa format. + */ + uncompressedImage = MALLOC(mml->width * mml->height * 4); + if (!uncompressedImage) { + gl_problem(NULL, "can't get memory in tdfxDDGetTexImage"); + return NULL; + } + (*txImgDequantizeFXT1Proc)((FxU32 *)uncompressedImage, + (FxU32 *)mml->data, + mml->width, + mml->height); + break; + default: + gl_problem(NULL, "Bad glideFormat in tdfxDDGetTexImage"); + return NULL; + } + _mesa_unconvert_teximage(mesaFormat, mml->width, mml->height, + uncompressedImage, srcStride, texImage->Width, + texImage->Height, glFormat, data); + if (uncompressedImage != mml->data) { + FREE(uncompressedImage); + } + *formatOut = glFormat; + *typeOut = GL_UNSIGNED_BYTE; + *freeImageOut = GL_TRUE; + return data; + } + else { + return NULL; + } +} + +/* + * This is called from _mesa_GetCompressedTexImage. We just + * copy out the compressed data. + */ +void +tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, + GLint lod, void *image, + const struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) +{ + tdfxTexInfo *ti; + tdfxMipMapLevel *mml; + + if (target != GL_TEXTURE_2D) + return; + + if (!texObj->DriverData) + return; + + ti = TDFX_TEXTURE_DATA(texObj); + mml = &ti->mipmapLevel[lod]; + if (mml->data) { + MEMCPY(image, mml->data, mml->dataSize); + } +} + +/* + * Calculate a specific texture format given a generic + * texture format. + */ +GLint +tdfxDDSpecificCompressedTexFormat(GLcontext *ctx, + GLint internalFormat, + GLint numDimensions) +{ + if (numDimensions != 2) { + return internalFormat; + } + /* + * If we don't have pointers to the functions, then + * we drop back to uncompressed format. The logic + * in Mesa proper handles this for us. + * + * This is just to ease the transition to a Glide with + * the texus2 library. + */ + if (!txImgQuantizeProc || !txImgDequantizeFXT1Proc) { + return internalFormat; + } + switch (internalFormat) { + case GL_COMPRESSED_RGB_ARB: + return GL_COMPRESSED_RGB_FXT1_3DFX; + case GL_COMPRESSED_RGBA_ARB: + return GL_COMPRESSED_RGBA_FXT1_3DFX; + } + return internalFormat; +} + +/* + * Calculate a specific texture format given a generic + * texture format. + */ +GLint +tdfxDDBaseCompressedTexFormat(GLcontext *ctx, + GLint internalFormat) +{ + switch (internalFormat) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + return GL_RGB; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + return GL_RGBA; + } + return -1; +} + +/* + * Tell us if an image is compressed. The real work is done + * in a macro, but we need to have a function to create a + * function pointer. + */ +GLboolean +tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat) +{ + return tdfxDDIsCompressedFormatMacro(internalFormat); +} + + +/* + * Calculate the image size of a compressed texture. + * + * The current compressed format, the FXT1 family, all + * map 8x32 texel blocks into 128 bits. + * + * We return 0 if we can't calculate the size. + * + * Glide would report this out to us, but we don't have + * exactly the right parameters. + */ +GLsizei +tdfxDDCompressedImageSize(GLcontext *ctx, + GLenum intFormat, + GLuint numDimensions, + GLuint width, + GLuint height, + GLuint depth) +{ + if (numDimensions != 2) { + return 0; + } + switch (intFormat) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + /* + * Round height and width to multiples of 4 and 8, + * divide the resulting product by 32 to get the number + * of blocks, and multiply by 32 = 128/8 to get the. + * number of bytes required. That is to say, just + * return the product. Remember that we are returning + * bytes, not texels, so we have shrunk the texture + * by a factor of the texel size. + */ + width = (width + 0x7) &~ 0x7; + height = (height + 0x3) &~ 0x3; + return width * height; + } + return 0; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h new file mode 100644 index 000000000..95ef3b018 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h @@ -0,0 +1,157 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef _TDFX_TEX_H_ +#define _TDFX_TEX_H_ + + +#include "texutil.h" + + +#define tdfxDDIsCompressedFormatMacro(internalFormat) \ + (((internalFormat) == GL_COMPRESSED_RGB_FXT1_3DFX) || \ + ((internalFormat) == GL_COMPRESSED_RGBA_FXT1_3DFX)) +#define tdfxDDIsCompressedGlideFormatMacro(internalFormat) \ + ((internalFormat) == GR_TEXFMT_ARGB_CMP_FXT1) + + + +extern void +tdfxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj); + +extern void +tdfxDDBindTexture(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj); + +extern void +tdfxDDDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj); + +extern GLboolean +tdfxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj); + +extern void +tdfxDDTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj); + +#if 000 /* DEAD? */ +extern void +fxDDTexUseGlobalPalette(GLcontext * ctx, GLboolean state); +#endif + +extern void +tdfxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname, + const GLfloat * param); + +extern void +tdfxDDTexParameter(GLcontext * ctx, GLenum target, + struct gl_texture_object *tObj, + GLenum pname, const GLfloat * params); + +extern GLboolean +tdfxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage, + GLboolean * retainInternalCopy); + +extern GLboolean +tdfxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib * packing, + struct gl_texture_object * texObj, + struct gl_texture_image * texImage); + +extern GLboolean +tdfxDDCompressedTexImage2D( GLcontext *ctx, GLenum target, + GLint level, GLsizei imageSize, + const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + +extern GLboolean +tdfxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + +extern GLboolean +tdfxDDTestProxyTexImage(GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border); + +extern GLvoid * +tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum * formatOut, GLenum * typeOut, + GLboolean * freeImageOut); + +extern void +tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, + GLint lod, void *image, + const struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + +extern GLint +tdfxDDSpecificCompressedTexFormat(GLcontext *ctx, + GLint internalFormat, + GLint numDimensions); + +extern GLint +tdfxDDBaseCompressedTexFormat(GLcontext *ctx, + GLint internalFormat); + +extern GLboolean +tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat); + +extern GLsizei +tdfxDDCompressedImageSize(GLcontext *ctx, + GLenum intFormat, + GLuint numDimensions, + GLuint width, + GLuint height, + GLuint depth); + + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c new file mode 100644 index 000000000..97fe9d4c6 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c @@ -0,0 +1,968 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" + + +#define BAD_ADDRESS ((FxU32) -1) + + +#if 0 /* DEBUG use */ +/* + * Verify the consistancy of the texture memory manager. + * This involves: + * Traversing all texture objects and computing total memory used. + * Traverse the free block list and computing total memory free. + * Compare the total free and total used amounts to the total memory size. + * Make various assertions about the results. + */ +static void +VerifyFreeList(tdfxContextPtr fxMesa, FxU32 tmu) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *block; + int prevStart = -1, prevEnd = -1; + int totalFree = 0; + int numObj = 0, numRes = 0; + int totalUsed = 0; + + for (block = shared->tmFree[tmu]; block; block = block->next) { + assert( block->endAddr > 0 ); + assert( block->startAddr <= shared->totalTexMem[tmu] ); + assert( block->endAddr <= shared->totalTexMem[tmu] ); + assert( (int) block->startAddr > prevStart ); + assert( (int) block->startAddr >= prevEnd ); + prevStart = (int) block->startAddr; + prevEnd = (int) block->endAddr; + totalFree += (block->endAddr - block->startAddr); + } + assert(totalFree == shared->freeTexMem[tmu]); + + { + struct gl_texture_object *obj; + for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) { + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(obj); + numObj++; + if (ti) { + if (ti->isInTM) { + numRes++; + assert(ti->tm[0]); + if (ti->tm[tmu]) + totalUsed += (ti->tm[tmu]->endAddr - ti->tm[tmu]->startAddr); + } + else { + assert(!ti->tm[0]); + } + } + } + } + + printf("totalFree: %d totalUsed: %d totalMem: %d #objs=%d #res=%d\n", + shared->freeTexMem[tmu], totalUsed, shared->totalTexMem[tmu], + numObj, numRes); + + assert(totalUsed + totalFree == shared->totalTexMem[tmu]); +} + + +static void +dump_texmem(tdfxContextPtr fxMesa) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj; + tdfxMemRange *r; + FxU32 prev; + + printf("DUMP Objects:\n"); + for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) { + tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj); + + if (info && info->isInTM) { + printf("Obj %8p: %4d info = %p\n", obj, obj->Name, info); + + printf(" isInTM=%d whichTMU=%d lastTimeUsed=%d\n", + info->isInTM, info->whichTMU, info->lastTimeUsed); + printf(" tm[0] = %p", info->tm[0]); + assert(info->tm[0]); + if (info->tm[0]) { + printf(" tm startAddr = %d endAddr = %d", + info->tm[0]->startAddr, + info->tm[0]->endAddr); + } + printf("\n"); + printf(" tm[1] = %p", info->tm[1]); + if (info->tm[1]) { + printf(" tm startAddr = %d endAddr = %d", + info->tm[1]->startAddr, + info->tm[1]->endAddr); + } + printf("\n"); + } + } + + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + + printf("Free memory unit 0: %d bytes\n", shared->freeTexMem[0]); + prev = 0; + for (r = shared->tmFree[0]; r; r = r->next) { + printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev); + prev = r->endAddr; + } + + printf("Free memory unit 1: %d bytes\n", shared->freeTexMem[1]); + prev = 0; + for (r = shared->tmFree[1]; r; r = r->next) { + printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev); + prev = r->endAddr; + } + +} +#endif + + + +#ifdef TEXSANITY +static void +fubar(void) +{ +} + +/* + * Sanity Check + */ +static void +sanity(tdfxContextPtr fxMesa) +{ + tdfxMemRange *tmp, *prev, *pos; + + prev = 0; + tmp = fxMesa->tmFree[0]; + while (tmp) { + if (!tmp->startAddr && !tmp->endAddr) { + fprintf(stderr, "Textures fubar\n"); + fubar(); + } + if (tmp->startAddr >= tmp->endAddr) { + fprintf(stderr, "Node fubar\n"); + fubar(); + } + if (prev && (prev->startAddr >= tmp->startAddr || + prev->endAddr > tmp->startAddr)) { + fprintf(stderr, "Sorting fubar\n"); + fubar(); + } + prev = tmp; + tmp = tmp->next; + } + prev = 0; + tmp = fxMesa->tmFree[1]; + while (tmp) { + if (!tmp->startAddr && !tmp->endAddr) { + fprintf(stderr, "Textures fubar\n"); + fubar(); + } + if (tmp->startAddr >= tmp->endAddr) { + fprintf(stderr, "Node fubar\n"); + fubar(); + } + if (prev && (prev->startAddr >= tmp->startAddr || + prev->endAddr > tmp->startAddr)) { + fprintf(stderr, "Sorting fubar\n"); + fubar(); + } + prev = tmp; + tmp = tmp->next; + } +} +#endif + + + + + +/* + * Allocate and initialize a new MemRange struct. + * Try to allocate it from the pool of free MemRange nodes rather than malloc. + */ +static tdfxMemRange * +NewRangeNode(tdfxContextPtr fxMesa, FxU32 start, FxU32 end) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *result; + + _glthread_LOCK_MUTEX(mesaShared->Mutex); + if (shared && shared->tmPool) { + result = shared->tmPool; + shared->tmPool = shared->tmPool->next; + } + else { + result = MALLOC(sizeof(tdfxMemRange)); + + } + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + + if (!result) { + /*fprintf(stderr, "fxDriver: out of memory!\n");*/ + return NULL; + } + + result->startAddr = start; + result->endAddr = end; + result->next = NULL; + + return result; +} + + +/* + * Initialize texture memory. + * We take care of one or both TMU's here. + */ +void +tdfxTMInit(tdfxContextPtr fxMesa) +{ + if (!fxMesa->glCtx->Shared->DriverData) { + const char *extensions; + struct tdfxSharedState *shared = CALLOC_STRUCT(tdfxSharedState); + if (!shared) + return; + + extensions = FX_grGetString(fxMesa, GR_EXTENSION); + if (strstr(extensions, "TEXUMA")) { + FxU32 start, end; + shared->umaTexMemory = GL_TRUE; + FX_grEnable(fxMesa, GR_TEXTURE_UMA_EXT); + start = FX_grTexMinAddress(fxMesa, 0); + end = FX_grTexMaxAddress(fxMesa, 0); + shared->totalTexMem[0] = end - start; + shared->totalTexMem[1] = 0; + shared->freeTexMem[0] = end - start; + shared->freeTexMem[1] = 0; + shared->tmFree[0] = NewRangeNode(fxMesa, start, end); + shared->tmFree[1] = NULL; + /*printf("UMA tex memory: %d\n", (int) (end - start));*/ + } + else { + const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1; + int tmu; + shared->umaTexMemory = GL_FALSE; + for (tmu = 0; tmu < numTMUs; tmu++) { + FxU32 start = FX_grTexMinAddress(fxMesa, tmu); + FxU32 end = FX_grTexMaxAddress(fxMesa, tmu); + shared->totalTexMem[tmu] = end - start; + shared->freeTexMem[tmu] = end - start; + shared->tmFree[tmu] = NewRangeNode(fxMesa, start, end); + /*printf("Split tex memory: %d\n", (int) (end - start));*/ + } + } + + shared->tmPool = NULL; + fxMesa->glCtx->Shared->DriverData = shared; + /*printf("Texture memory init UMA: %d\n", shared->umaTexMemory);*/ + } +} + + +/* + * Clean-up texture memory before destroying context. + */ +void +tdfxTMClose(tdfxContextPtr fxMesa) +{ + if (fxMesa->glCtx->Shared->RefCount == 1) { + /* refcount will soon go to zero, free our 3dfx stuff */ + struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData; + + const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1; + int tmu; + tdfxMemRange *tmp, *next; + + /* Deallocate the pool of free tdfxMemRange nodes */ + tmp = shared->tmPool; + while (tmp) { + next = tmp->next; + FREE(tmp); + tmp = next; + } + + /* Delete the texture memory block tdfxMemRange nodes */ + for (tmu = 0; tmu < numTMUs; tmu++) { + tmp = shared->tmFree[tmu]; + while (tmp) { + next = tmp->next; + FREE(tmp); + tmp = next; + } + } + + FREE(shared); + fxMesa->glCtx->Shared->DriverData = NULL; + } +} + + + +/* + * Delete a tdfxMemRange struct. + * We keep a linked list of free/available tdfxMemRange structs to + * avoid extra malloc/free calls. + */ +#if 0 +static void +DeleteRangeNode_NoLock(struct TdfxSharedState *shared, tdfxMemRange *range) +{ + /* insert at head of list */ + range->next = shared->tmPool; + shared->tmPool = range; +} +#endif + +#define DELETE_RANGE_NODE(shared, range) \ + (range)->next = (shared)->tmPool; \ + (shared)->tmPool = (range) + + + +/* + * When we've run out of texture memory we have to throw out an + * existing texture to make room for the new one. This function + * determins the texture to throw out. + */ +static struct gl_texture_object * +FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu) +{ + const GLuint bindnumber = fxMesa->texBindNumber; + struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj; + GLfloat lowestPriority; + GLuint oldestAge; + + oldestObj = NULL; + oldestAge = 0; + + lowestPriority = 1.0F; + lowestPriorityObj = NULL; + + for (obj = fxMesa->glCtx->Shared->TexObjectList; obj; obj = obj->Next) { + tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj); + + if (info && info->isInTM && + ((info->whichTMU == tmu) || (info->whichTMU == TDFX_TMU_BOTH) || + (info->whichTMU == TDFX_TMU_SPLIT))) { + GLuint age, lasttime; + + assert(info->tm[0]); + lasttime = info->lastTimeUsed; + + if (lasttime > bindnumber) + age = bindnumber + (UINT_MAX - lasttime + 1); /* TO DO: check wrap around */ + else + age = bindnumber - lasttime; + + if (age >= oldestAge) { + oldestAge = age; + oldestObj = obj; + } + + /* examine priority */ + if (obj->Priority < lowestPriority) { + lowestPriority = obj->Priority; + lowestPriorityObj = obj; + } + } + } + + if (lowestPriority < 1.0) { + ASSERT(lowestPriorityObj); + /* + printf("discard %d pri=%f\n", lowestPriorityObj->Name, lowestPriority); + */ + return lowestPriorityObj; + } + else { + /* + printf("discard %d age=%d\n", oldestObj->Name, oldestAge); + */ + return oldestObj; + } +} + + +#if 0 +static void +FlushTexMemory(tdfxContextPtr fxMesa) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + struct gl_texture_object *obj; + + for (obj = mesaShared->TexObjectList; obj; obj = obj->Next) { + if (obj->RefCount < 2) { + /* don't flush currently bound textures */ + tdfxTMMoveOutTM_NoLock(fxMesa, obj); + } + } +} +#endif + + +/* + * Find the address (offset?) at which we can store a new texture. + * <tmu> is the texture unit. + * <size> is the texture size in bytes. + */ +static FxU32 +FindStartAddr(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 size) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *prev, *block; + FxU32 result; +#if 0 + int discardedCount = 0; +#define MAX_DISCARDS 10 +#endif + + if (shared->umaTexMemory) { + assert(tmu == TDFX_TMU0); + } + + _glthread_LOCK_MUTEX(mesaShared->Mutex); + while (1) { + prev = NULL; + block = shared->tmFree[tmu]; + while (block) { + if (block->endAddr - block->startAddr >= size) { + /* The texture will fit here */ + result = block->startAddr; + block->startAddr += size; + if (block->startAddr == block->endAddr) { + /* Remove this node since it's empty */ + if (prev) { + prev->next = block->next; + } + else { + shared->tmFree[tmu] = block->next; + } + DELETE_RANGE_NODE(shared, block); + } + shared->freeTexMem[tmu] -= size; + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return result; + } + prev = block; + block = block->next; + } + /* We failed to find a block large enough to accomodate <size> bytes. + * Find the oldest texObject and free it. + */ +#if 0 + discardedCount++; + if (discardedCount > MAX_DISCARDS + 1) { + gl_problem(NULL, "tdfx driver: extreme texmem fragmentation"); + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return BAD_ADDRESS; + } + else if (discardedCount > MAX_DISCARDS) { + /* texture memory is probably really fragmented, flush it */ + FlushTexMemory(fxMesa); + } + else +#endif + { + struct gl_texture_object *obj = FindOldestObject(fxMesa, tmu); + if (obj) { + tdfxTMMoveOutTM_NoLock(fxMesa, obj); + fxMesa->stats.texSwaps++; + } + else { + gl_problem(NULL, "tdfx driver: extreme texmem fragmentation"); + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return BAD_ADDRESS; + } + } + } + + /* never get here, but play it safe */ + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); + return BAD_ADDRESS; +} + + +/* + * Remove the given tdfxMemRange node from hardware texture memory. + */ +static void +RemoveRange_NoLock(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxMemRange *block, *prev; + + if (shared->umaTexMemory) { + assert(tmu == TDFX_TMU0); + } + + if (!range) + return; + + if (range->startAddr == range->endAddr) { + DELETE_RANGE_NODE(shared, range); + return; + } + shared->freeTexMem[tmu] += range->endAddr - range->startAddr; + + /* find position in linked list to insert this tdfxMemRange node */ + prev = NULL; + block = shared->tmFree[tmu]; + while (block) { + assert(range->startAddr != block->startAddr); + if (range->startAddr > block->startAddr) { + prev = block; + block = block->next; + } + else { + break; + } + } + + /* Insert the free block, combine with adjacent blocks when possible */ + range->next = block; + if (block) { + if (range->endAddr == block->startAddr) { + /* Combine */ + block->startAddr = range->startAddr; + DELETE_RANGE_NODE(shared, range); + range = block; + } + } + if (prev) { + if (prev->endAddr == range->startAddr) { + /* Combine */ + prev->endAddr = range->endAddr; + prev->next = range->next; + DELETE_RANGE_NODE(shared, range); + } + else { + prev->next = range; + } + } + else { + shared->tmFree[tmu] = range; + } +} + + +#if 0 /* NOT USED */ +static void +RemoveRange(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + _glthread_LOCK_MUTEX(mesaShared->Mutex); + RemoveRange_NoLock(fxMesa, tmu, range); + _glthread_UNLOCK_MUTEX(mesaShared->Mutex); +} +#endif + + +/* + * Allocate space for a texture image. + * <tmu> is the texture unit + * <texmemsize> is the number of bytes to allocate + */ +static tdfxMemRange * +AllocTexMem(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 texmemsize) +{ + FxU32 startAddr; + startAddr = FindStartAddr(fxMesa, tmu, texmemsize); + if (startAddr == BAD_ADDRESS) { + printf("AllocTexMem returned NULL! tmu=%d texmemsize=%d\n", + tmu, texmemsize); + return NULL; + } + else { + tdfxMemRange *range; + range = NewRangeNode(fxMesa, startAddr, startAddr + texmemsize); + return range; + } +} + + +/* + * Download (copy) the given texture data (all mipmap levels) into the + * Voodoo's texture memory. + * The texture memory must have already been allocated. + */ +void +tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) +{ + tdfxTexInfo *ti; + GLint l; + FxU32 targetTMU; + + assert(tObj); + ti = TDFX_TEXTURE_DATA(tObj); + assert(ti); + targetTMU = ti->whichTMU; + + switch (targetTMU) { + case TDFX_TMU0: + case TDFX_TMU1: + if (ti->tm[targetTMU]) { + for (l = ti->minLevel; l <= ti->maxLevel + && ti->mipmapLevel[l].data; l++) { + GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; + FX_grTexDownloadMipMapLevel_NoLock(targetTMU, + ti->tm[targetTMU]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[l].data); + } + } + break; + case TDFX_TMU_SPLIT: + if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) { + for (l = ti->minLevel; l <= ti->maxLevel + && ti->mipmapLevel[l].data; l++) { + GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, + ti->tm[TDFX_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_ODD, + ti->mipmapLevel[l].data); + + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, + ti->tm[TDFX_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_EVEN, + ti->mipmapLevel[l].data); + } + } + break; + case TDFX_TMU_BOTH: + if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) { + for (l = ti->minLevel; l <= ti->maxLevel + && ti->mipmapLevel[l].data; l++) { + GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, + ti->tm[TDFX_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[l].data); + + FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, + ti->tm[TDFX_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[l].data); + } + } + break; + default: + gl_problem(NULL, "error in tdfxTMDownloadTexture: bad tmu"); + return; + } +} + + +void +tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, + GLint level) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + GrLOD_t glideLod; + FxU32 tmu; + + tmu = ti->whichTMU; + glideLod = ti->info.largeLodLog2 - level + tObj->BaseLevel; + ASSERT(ti->isInTM); + + switch (tmu) { + case TDFX_TMU0: + case TDFX_TMU1: + FX_grTexDownloadMipMapLevel(fxMesa, tmu, + ti->tm[tmu]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[level].data); + break; + case TDFX_TMU_SPLIT: + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU0, + ti->tm[GR_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_ODD, + ti->mipmapLevel[level].data); + + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU1, + ti->tm[GR_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_EVEN, + ti->mipmapLevel[level].data); + break; + case TDFX_TMU_BOTH: + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU0, + ti->tm[GR_TMU0]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[level].data); + + FX_grTexDownloadMipMapLevel(fxMesa, GR_TMU1, + ti->tm[GR_TMU1]->startAddr, + glideLod, + ti->info.largeLodLog2, + ti->info.aspectRatioLog2, + ti->info.format, + GR_MIPMAPLEVELMASK_BOTH, + ti->mipmapLevel[level].data); + break; + + default: + gl_problem(ctx, "error in tdfxTMReloadMipMapLevel(): wrong tmu"); + break; + } +} + + +/* + * Allocate space for the given texture in texture memory then + * download (copy) it into that space. + */ +void +tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj, + FxU32 targetTMU ) +{ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + FxU32 texmemsize; + + fxMesa->stats.reqTexUpload++; + + if (ti->isInTM) { + if (ti->whichTMU == targetTMU) + return; + if (targetTMU == TDFX_TMU_SPLIT || ti->whichTMU == TDFX_TMU_SPLIT) { + tdfxTMMoveOutTM_NoLock(fxMesa, tObj); + } + else { + if (ti->whichTMU == TDFX_TMU_BOTH) + return; + targetTMU = TDFX_TMU_BOTH; + } + } + + ti->whichTMU = targetTMU; + + switch (targetTMU) { + case TDFX_TMU0: + case TDFX_TMU1: + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, + &(ti->info)); + ti->tm[targetTMU] = AllocTexMem(fxMesa, targetTMU, texmemsize); + break; + case TDFX_TMU_SPLIT: + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD, + &(ti->info)); + ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize); + if (ti->tm[TDFX_TMU0]) + fxMesa->stats.memTexUpload += texmemsize; + + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_EVEN, + &(ti->info)); + ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize); + break; + case TDFX_TMU_BOTH: + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, + &(ti->info)); + ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize); + if (ti->tm[TDFX_TMU0]) + fxMesa->stats.memTexUpload += texmemsize; + + texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, + &(ti->info)); + ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize); + break; + default: + gl_problem(NULL, "error in tdfxTMMoveInTM() -> bad tmu (%d)"); + return; + } + + ti->reloadImages = GL_TRUE; + ti->isInTM = GL_TRUE; + + fxMesa->stats.texUpload++; +} + + +/* + * Move the given texture out of hardware texture memory. + * This deallocates the texture's memory space. + */ +void +tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj ) +{ + struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxTMMoveOutTM(%p (%d))\n", tObj, tObj->Name); + } + + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ + + if (!ti || !ti->isInTM) + return; + + switch (ti->whichTMU) { + case TDFX_TMU0: + case TDFX_TMU1: + RemoveRange_NoLock(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]); + break; + case TDFX_TMU_SPLIT: + case TDFX_TMU_BOTH: + assert(!shared->umaTexMemory); + RemoveRange_NoLock(fxMesa, TDFX_TMU0, ti->tm[TDFX_TMU0]); + RemoveRange_NoLock(fxMesa, TDFX_TMU1, ti->tm[TDFX_TMU1]); + break; + default: + gl_problem(NULL, "tdfx driver: bad tmu in tdfxTMMOveOutTM()"); + return; + } + + ti->isInTM = GL_FALSE; + ti->tm[0] = NULL; + ti->tm[1] = NULL; + ti->whichTMU = TDFX_TMU_NONE; + + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ +} + + +/* + * Called via glDeleteTexture to delete a texture object. + */ +void +tdfxTMFreeTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) +{ + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + if (ti) { + int i; + tdfxTMMoveOutTM(fxMesa, tObj); + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + if (ti->mipmapLevel[i].data) { + FREE(ti->mipmapLevel[i].data); + ti->mipmapLevel[i].data = NULL; + } + } + FREE(ti); + tObj->DriverData = NULL; + } + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ +} + + + +/* + * After a context switch this function will be called to restore + * texture memory for the new context. + */ +void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + struct gl_texture_object *tObj; + int i; + + for ( tObj = ctx->Shared->TexObjectList ; tObj ; tObj = tObj->Next ) { + tdfxTexInfo *ti = TDFX_TEXTURE_DATA( tObj ); + if ( ti && ti->isInTM ) { + for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) { + if ( ctx->Texture.Unit[i].Current == tObj ) { + tdfxTMDownloadTexture( fxMesa, tObj ); + break; + } + } + if ( i == MAX_TEXTURE_UNITS ) { + tdfxTMMoveOutTM_NoLock( fxMesa, tObj ); + } + } + } + /* + VerifyFreeList(fxMesa, 0); + VerifyFreeList(fxMesa, 1); + */ +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h new file mode 100644 index 000000000..1965aaa84 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h @@ -0,0 +1,84 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_TEXMAN_H__ +#define __TDFX_TEXMAN_H__ + + +#include "tdfx_lock.h" + + +extern void tdfxTMInit( tdfxContextPtr fxMesa ); + +extern void tdfxTMClose( tdfxContextPtr fxMesa ); + +extern void tdfxTMDownloadTexture(tdfxContextPtr fxMesa, + struct gl_texture_object *tObj); + +extern void tdfxTMReloadMipMapLevel( GLcontext *ctx, + struct gl_texture_object *tObj, + GLint level ); + +extern void tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj, + FxU32 targetTMU ); + +extern void tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ); + +extern void tdfxTMFreeTexture( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ); + +extern void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa ); + + +#define tdfxTMMoveInTM( fxMesa, tObj, targetTMU ) \ + do { \ + LOCK_HARDWARE( fxMesa ); \ + tdfxTMMoveInTM_NoLock( fxMesa, tObj, targetTMU ); \ + UNLOCK_HARDWARE( fxMesa ); \ + } while (0) + +#define tdfxTMMoveOutTM( fxMesa, tObj ) \ + do { \ + LOCK_HARDWARE( fxMesa ); \ + tdfxTMMoveOutTM_NoLock( fxMesa, tObj ); \ + UNLOCK_HARDWARE( fxMesa ); \ + } while (0) + + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c new file mode 100644 index 000000000..5493eea8a --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c @@ -0,0 +1,2102 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_state.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" +#include "tdfx_texstate.h" + + +/* ============================================================= + * Texture + */ + +/* + * These macros are used below when handling COMBINE_EXT. + */ +#define TEXENV_OPERAND_INVERTED(operand) \ + (((operand) == GL_ONE_MINUS_SRC_ALPHA) \ + || ((operand) == GL_ONE_MINUS_SRC_COLOR)) +#define TEXENV_OPERAND_ALPHA(operand) \ + (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA)) +#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \ + if (!TEXENV_OPERAND_ALPHA(operand)) { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_RGB; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CCOLOR; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITRGB; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedColor; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } else { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } + +#define TEXENV_SETUP_MODE_RGB(param, operand) \ + switch (operand) { \ + case GL_SRC_COLOR: \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + case GL_ONE_MINUS_SRC_COLOR: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_MODE_A(param, operand) \ + switch (operand) { \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + + + +/* + * Setup a texture environment on Voodoo5. + * Return GL_TRUE for success, GL_FALSE for failure. + * If we fail, we'll have to use software rendering. + */ +static GLboolean +SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA, + const struct gl_texture_unit *texUnit, GLenum baseFormat, + struct tdfx_texcombine_ext *env) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrTCCUColor_t incomingRGB, incomingAlpha; + const GLenum envMode = texUnit->EnvMode; + + if (useIteratedRGBA) { + incomingRGB = GR_CMBX_ITRGB; + incomingAlpha = GR_CMBX_ITALPHA; + } + else { + incomingRGB = GR_CMBX_OTHER_TEXTURE_RGB; + incomingAlpha = GR_CMBX_OTHER_TEXTURE_ALPHA; + } + + /* invariant: */ + env->Color.Shift = 0; + env->Color.Invert = FXFALSE; + env->Alpha.Shift = 0; + env->Alpha.Invert = FXFALSE; + + switch (envMode) { + case GL_REPLACE: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceA = incomingRGB; + } + else { + /* Rv = Rt */ + env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + } + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceD = incomingAlpha; + } + else { + /* Av = At */ + env->Alpha.SourceD = GR_CMBX_LOCAL_TEXTURE_ALPHA; + } + env->Alpha.SourceA = GR_CMBX_ITALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_ZERO; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXFALSE; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_MODULATE: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + } + else { + /* Result = Frag * Tex */ + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.InvertC = FXFALSE; + } + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + } + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_DECAL: + /* -- Setup RGB combiner */ + if (baseFormat == GL_RGB) { + /* Rv = Rt */ + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_X; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + } + else { + /* Rv = Rf * (1 - At) + Rt * At */ + env->Color.SourceB = incomingRGB; + env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Color.InvertC = FXFALSE; + env->Color.SourceD = GR_CMBX_B; + env->Color.InvertD = FXFALSE; + } + env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.ModeA = GR_FUNC_MODE_X; + /* -- Setup Alpha combiner */ + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_BLEND: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + } + else { + /* Rv = Rf * (1 - Rt) + Rc * Rt */ + env->Color.SourceA = GR_CMBX_TMU_CCOLOR; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = incomingRGB; + env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.InvertC = FXFALSE; + env->Color.SourceD = GR_CMBX_B; + env->Color.InvertD = FXFALSE; + } + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ZERO; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af * (1 - It) + Ac * It */ + env->Alpha.SourceA = GR_CMBX_TMU_CALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = incomingAlpha; + env->Alpha.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Alpha.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.InvertC = FXFALSE; + env->Alpha.SourceD = GR_CMBX_B; + env->Alpha.InvertD = FXFALSE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + } + /* Also have to set up the tex env constant color */ + env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F, + texUnit->EnvColor[1] * 255.0F, + texUnit->EnvColor[2] * 255.0F, + texUnit->EnvColor[3] * 255.0F); + break; + case GL_ADD: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + } + else { + /* Rv = Rf + Tt */ + env->Color.SourceB = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.ModeB = GR_FUNC_MODE_X; + } + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af + It */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceB = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_X; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + } + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_COMBINE_EXT: + { + FxU32 A_RGB, B_RGB, C_RGB, D_RGB; + FxU32 Amode_RGB, Bmode_RGB; + FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB; + FxU32 Shift_RGB; + FxU32 A_A, B_A, C_A, D_A; + FxU32 Amode_A, Bmode_A; + FxBool Cinv_A, Dinv_A, Ginv_A; + FxU32 Shift_A; + + /* + * + * In the formulas below, we write: + * o "1(x)" for the identity function applied to x, + * so 1(x) = x. + * o "0(x)" for the constant function 0, so + * 0(x) = 0 for all values of x. + * + * Calculate the color combination. + */ + Shift_RGB = texUnit->CombineScaleShiftRGB; + Shift_A = texUnit->CombineScaleShiftA; + switch (texUnit->CombineModeRGB) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_FUNC_MODE_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_RGB(C_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + Cinv_RGB = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1]); + D_RGB = GR_CMBX_ZERO; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Bmode_RGB, + texUnit->CombineOperandRGB[1]); + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X; + } + else { + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + } + } + else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + } + else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) { + /* + * This case is wrong. + */ + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + else { + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_RGB, + texUnit->CombineSourceRGB[2], + texUnit->CombineOperandRGB[2], + incomingAlpha); + Cinv_RGB = FXFALSE; + D_RGB = GR_CMBX_B; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the texture values + * to zero. + */ + A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X; + Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE; + break; + } + /* + * Calculate the alpha combination. + */ + switch (texUnit->CombineModeA) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ITALPHA; + Bmode_A = GR_FUNC_MODE_ZERO; + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ZERO; + Bmode_A = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + Cinv_A = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1]); + D_A = GR_CMBX_ZERO; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + TEXENV_SETUP_MODE_A(Bmode_A, + texUnit->CombineOperandA[0]); + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_A = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X; + } else { + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + } + } else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_A = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X_MINUS_HALF; + } else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + } + else { + /* + * This case is wrong. + */ + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[2], + texUnit->CombineOperandA[2], + incomingAlpha); + Cinv_A = FXFALSE; + D_A = GR_CMBX_ZERO; + Dinv_A = Ginv_A = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the alpha values + * to one. + */ + A_A = B_A = C_A = D_A = GR_CMBX_ZERO; + Amode_A = Bmode_A = GR_FUNC_MODE_X; + Cinv_A = Dinv_A = FXFALSE; + Ginv_A = FXTRUE; + break; + } + /* + * Save the parameters. + */ + env->Color.SourceA = A_RGB; + env->Color.ModeA = Amode_RGB; + env->Color.SourceB = B_RGB; + env->Color.ModeB = Bmode_RGB; + env->Color.SourceC = C_RGB; + env->Color.InvertC = Cinv_RGB; + env->Color.SourceD = D_RGB; + env->Color.InvertD = Dinv_RGB; + env->Color.Shift = Shift_RGB; + env->Color.Invert = Ginv_RGB; + env->Alpha.SourceA = A_A; + env->Alpha.ModeA = Amode_A; + env->Alpha.SourceB = B_A; + env->Alpha.ModeB = Bmode_A; + env->Alpha.SourceC = C_A; + env->Alpha.InvertC = Cinv_A; + env->Alpha.SourceD = D_A; + env->Alpha.InvertD = Dinv_A; + env->Alpha.Shift = Shift_A; + env->Alpha.Invert = Ginv_A; + env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F, + texUnit->EnvColor[1] * 255.0F, + texUnit->EnvColor[2] * 255.0F, + texUnit->EnvColor[3] * 255.0F); + } + break; + + default: + gl_problem(ctx, "Bad envMode in SetupTexEnvNapalm"); + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; + + fxMesa->ColorCombineExt.SourceA = GR_CMBX_TEXTURE_RGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X, + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_TEXTURE_ALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + return GL_TRUE; /* success */ +} + + + +/* + * Setup the Voodoo3 texture environment for a single texture unit. + * Return GL_TRUE for success, GL_FALSE for failure. + * If failure, we'll use software rendering. + */ +static GLboolean +SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit, + GLenum envMode, GLenum baseFormat) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCombineLocal_t localc, locala; + struct tdfx_combine alphaComb, colorComb; + + if (1 /*iteratedRGBA*/) + localc = locala = GR_COMBINE_LOCAL_ITERATED; + else + localc = locala = GR_COMBINE_LOCAL_CONSTANT; + + switch (envMode) { + case GL_DECAL: + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + colorComb.Function = GR_COMBINE_FUNCTION_BLEND; + colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + break; + case GL_MODULATE: + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_LOCAL; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + case GL_BLEND: + /* + * XXX we can't do real GL_BLEND mode. These settings assume that + * the TexEnv color is black and incoming fragment color is white. + */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af * (1 - It) + Ac * It */ + /* XXX this is wrong */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + /* Av = Af * At */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXTRUE; + } + /* XXX return GL_FALSE for modes we don't support */ + break; + + case GL_REPLACE: + if ((baseFormat == GL_RGB) || (baseFormat == GL_LUMINANCE)) { + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + case GL_ADD: + if (baseFormat == GL_ALPHA || + baseFormat == GL_LUMINANCE_ALPHA || + baseFormat == GL_RGBA) { + /* product of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + else if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* fragment alpha is unchanged */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + ASSERT(baseFormat == GL_INTENSITY); + /* sum of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + /* rgb unchanged */ + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + /* sum of texel and fragment rgb */ + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + default: + gl_problem(NULL, "bad texture env mode in SetupSingleTexEnvVoodoo3"); + } + + if (colorComb.Function != fxMesa->ColorCombine.Function || + colorComb.Factor != fxMesa->ColorCombine.Factor || + colorComb.Local != fxMesa->ColorCombine.Local || + colorComb.Other != fxMesa->ColorCombine.Other || + colorComb.Invert != fxMesa->ColorCombine.Invert) { + fxMesa->ColorCombine = colorComb; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + } + + if (alphaComb.Function != fxMesa->AlphaCombine.Function || + alphaComb.Factor != fxMesa->AlphaCombine.Factor || + alphaComb.Local != fxMesa->AlphaCombine.Local || + alphaComb.Other != fxMesa->AlphaCombine.Other || + alphaComb.Invert != fxMesa->AlphaCombine.Invert) { + fxMesa->AlphaCombine = alphaComb; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + } + return GL_TRUE; +} + + +/* + * Setup the Voodoo3 texture environment for dual texture units. + * Return GL_TRUE for success, GL_FALSE for failure. + * If failure, we'll use software rendering. + */ +static GLboolean +SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0, + GLenum envMode0, GLenum baseFormat0, + GLenum envMode1, GLenum baseFormat1) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GrCombineLocal_t locala = GR_COMBINE_LOCAL_ITERATED; + const GrCombineLocal_t localc = GR_COMBINE_LOCAL_ITERATED; + const int tmu1 = 1 - tmu0; + + if (envMode0 == GL_MODULATE && envMode1 == GL_MODULATE) { + GLboolean isalpha[TDFX_NUM_TMU]; + + if (baseFormat0 == GL_ALPHA) + isalpha[tmu0] = GL_TRUE; + else + isalpha[tmu0] = GL_FALSE; + + if (baseFormat1 == GL_ALPHA) + isalpha[tmu1] = GL_TRUE; + else + isalpha[tmu1] = GL_FALSE; + + if (isalpha[TDFX_TMU1]) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + if (isalpha[TDFX_TMU0]) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else if (envMode0 == GL_REPLACE && envMode1 == GL_BLEND) { /* Quake */ + if (tmu1 == TDFX_TMU1) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else if (envMode0 == GL_REPLACE && envMode1 == GL_MODULATE) { + /* Quake 2/3 */ + if (tmu1 == TDFX_TMU1) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXTRUE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + if (baseFormat0 == GL_RGB) { + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else { + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + } + else if (envMode0 == GL_MODULATE && envMode1 == GL_ADD) { + /* Quake 3 sky */ + GLboolean isalpha[TDFX_NUM_TMU]; + if (baseFormat0 == GL_ALPHA) + isalpha[tmu0] = GL_TRUE; + else + isalpha[tmu0] = GL_FALSE; + if (baseFormat1 == GL_ALPHA) + isalpha[tmu1] = GL_TRUE; + else + isalpha[tmu1] = GL_FALSE; + + if (isalpha[TDFX_TMU1]) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + if (isalpha[TDFX_TMU0]) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else { + /*gl_problem(ctx, "Unexpected dual texture mode encountered\n");*/ + return GL_FALSE; + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + return GL_TRUE; +} + + +/* + * This function makes sure that the correct mipmap levels are loaded + * in the right places in memory and then makes the Glide calls to + * setup the texture source pointers. + */ +static void +setupSingleTMU(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) +{ + struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData; + tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); + const GLcontext *ctx = fxMesa->glCtx; + + /* Make sure we're not loaded incorrectly */ + if (ti->isInTM && !shared->umaTexMemory) { + /* if doing filtering between mipmap levels, alternate mipmap levels + * must be in alternate TMUs. + */ + if (ti->LODblend) { + if (ti->whichTMU != TDFX_TMU_SPLIT) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj); + } + else { + if (ti->whichTMU == TDFX_TMU_SPLIT) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj); + } + } + + /* Make sure we're loaded correctly */ + if (!ti->isInTM) { + /* Have to download the texture */ + if (shared->umaTexMemory) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0); + } + else { + /* Voodoo3 (split texture memory) */ + if (ti->LODblend) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU_SPLIT); + } + else { +#if 0 + /* XXX putting textures into the second memory bank when the + * first bank is full is not working at this time. + */ + if (fxMesa->haveTwoTMUs) { + GLint memReq = FX_grTexTextureMemRequired_NoLock( + GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); + if (shared->freeTexMem[TDFX_TMU0] > memReq) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0); + } + else { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU1); + } + } + else +#endif + { + tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0); + } + } + } + } + + if (ti->LODblend && ti->whichTMU == TDFX_TMU_SPLIT) { + /* mipmap levels split between texture banks */ + GLint u; + + if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + + for (u = 0; u < 2; u++) { + fxMesa->TexParams[u].sClamp = ti->sClamp; + fxMesa->TexParams[u].tClamp = ti->tClamp; + fxMesa->TexParams[u].minFilt = ti->minFilt; + fxMesa->TexParams[u].magFilt = ti->magFilt; + fxMesa->TexParams[u].mmMode = ti->mmMode; + fxMesa->TexParams[u].LODblend = ti->LODblend; + fxMesa->TexParams[u].LodBias = ctx->Texture.Unit[u].LodBias; + } + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + + fxMesa->TexSource[0].StartAddress = ti->tm[TDFX_TMU0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD; + fxMesa->TexSource[0].Info = &(ti->info); + fxMesa->TexSource[1].StartAddress = ti->tm[TDFX_TMU1]->startAddr; + fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[1].Info = &(ti->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + } + else { + FxU32 tmu; + + if (ti->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = ti->whichTMU; + + if (shared->umaTexMemory) { + assert(ti->whichTMU == TDFX_TMU0); + assert(tmu == TDFX_TMU0); + } + + if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + + /* KW: The alternative is to do the download to the other tmu. If + * we get to this point, I think it means we are thrashing the + * texture memory, so perhaps it's not a good idea. + */ + + if (fxMesa->TexParams[tmu].sClamp != ti->sClamp || + fxMesa->TexParams[tmu].tClamp != ti->tClamp || + fxMesa->TexParams[tmu].minFilt != ti->minFilt || + fxMesa->TexParams[tmu].magFilt != ti->magFilt || + fxMesa->TexParams[tmu].mmMode != ti->mmMode || + fxMesa->TexParams[tmu].LODblend != FXFALSE || + fxMesa->TexParams[tmu].LodBias != ctx->Texture.Unit[tmu].LodBias) { + fxMesa->TexParams[tmu].sClamp = ti->sClamp; + fxMesa->TexParams[tmu].tClamp = ti->tClamp; + fxMesa->TexParams[tmu].minFilt = ti->minFilt; + fxMesa->TexParams[tmu].magFilt = ti->magFilt; + fxMesa->TexParams[tmu].mmMode = ti->mmMode; + fxMesa->TexParams[tmu].LODblend = FXFALSE; + fxMesa->TexParams[tmu].LodBias = ctx->Texture.Unit[tmu].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + /* Glide texture source info */ + fxMesa->TexSource[0].Info = NULL; + fxMesa->TexSource[1].Info = NULL; + if (ti->tm[tmu]) { + fxMesa->TexSource[tmu].StartAddress = ti->tm[tmu]->startAddr; + fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu].Info = &(ti->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + } + } + + fxMesa->sScale0 = ti->sScale; + fxMesa->tScale0 = ti->tScale; +} + +static void +selectSingleTMUSrc(tdfxContextPtr fxMesa, GLint tmu, FxBool LODblend) +{ + if (LODblend) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + + if (fxMesa->haveTwoTMUs) { + const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + int tmu; + + if (shared->umaTexMemory) + tmu = GR_TMU0; + else + tmu = GR_TMU1; + + fxMesa->TexCombine[tmu].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[tmu].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[tmu].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[tmu].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[tmu].InvertRGB = FXFALSE; + fxMesa->TexCombine[tmu].InvertAlpha = FXFALSE; + } + fxMesa->tmuSrc = TDFX_TMU_SPLIT; + } + else { + if (tmu != TDFX_TMU1) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + if (fxMesa->haveTwoTMUs) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + fxMesa->tmuSrc = TDFX_TMU0; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */ + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + fxMesa->tmuSrc = TDFX_TMU1; + } + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; +} + +static void print_state(tdfxContextPtr fxMesa) +{ + GLcontext *ctx = fxMesa->glCtx; + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + GLenum base0 = tObj0->Image[tObj0->BaseLevel] ? tObj0->Image[tObj0->BaseLevel]->Format : 99; + GLenum base1 = tObj1->Image[tObj1->BaseLevel] ? tObj1->Image[tObj1->BaseLevel]->Format : 99; + + printf("Unit 0: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[0].ReallyEnabled, + fxMesa->TexState.Enabled); + printf(" EnvMode: GL=0x%x Gr=0x%x\n", ctx->Texture.Unit[0].EnvMode, + fxMesa->TexState.EnvMode[0]); + printf(" BaseFmt: GL=0x%x Gr=0x%x\n", base0, fxMesa->TexState.TexFormat[0]); + + + printf("Unit 1: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[1].ReallyEnabled, + fxMesa->TexState.Enabled); + printf(" EnvMode: GL=0x%x Gr:0x%x\n", ctx->Texture.Unit[1].EnvMode, + fxMesa->TexState.EnvMode[1]); + printf(" BaseFmt: GL=0x%x Gr:0x%x\n", base1, fxMesa->TexState.TexFormat[1]); +} + + +/* + * When we're only using a single texture unit, we always use the 0th + * Glide/hardware unit, regardless if it's GL_TEXTURE0_ARB or GL_TEXTURE1_ARB + * that's enalbed. + * Input: ctx - the context + * unit - the OpenGL texture unit to use. + */ +static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexInfo *ti; + struct gl_texture_object *tObj; + int tmu; + GLenum envMode, baseFormat; + + tObj = ctx->Texture.Unit[unit].CurrentD[2]; + + if (!tObj->Image[tObj->BaseLevel]) { + fprintf(stderr, "tObj->Image[BaseLevel] is nil, how did this happen?!?\n"); + return; + } + + if (tObj->Image[tObj->BaseLevel]->Border > 0) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_BORDER; + return; + } + + setupSingleTMU(fxMesa, tObj); + + ti = TDFX_TEXTURE_DATA(tObj); + if (ti->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = ti->whichTMU; + + if (fxMesa->tmuSrc != tmu) { + selectSingleTMUSrc(fxMesa, tmu, ti->LODblend); + } + + if (ti->reloadImages) + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES; + + /* Some texture environments not supported */ + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE_ENV; + + /* Check if we really need to update the texenv state */ + envMode = ctx->Texture.Unit[unit].EnvMode; + baseFormat = tObj->Image[tObj->BaseLevel]->Format; + + if (TDFX_IS_NAPALM(fxMesa)) { + /* see if we really need to update the unit */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode != fxMesa->TexState.EnvMode[0] || + envMode == GL_COMBINE_EXT || + baseFormat != fxMesa->TexState.TexFormat[0]) { + struct tdfx_texcombine_ext *otherEnv; + if (!SetupTexEnvNapalm(ctx, GL_TRUE, + &ctx->Texture.Unit[unit], baseFormat, + &fxMesa->TexCombineExt[0])) { + /* software fallback */ + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + /* disable other unit */ + otherEnv = &fxMesa->TexCombineExt[1]; + otherEnv->Color.SourceA = GR_CMBX_ZERO; + otherEnv->Color.ModeA = GR_FUNC_MODE_ZERO; + otherEnv->Color.SourceB = GR_CMBX_ZERO; + otherEnv->Color.ModeB = GR_FUNC_MODE_ZERO; + otherEnv->Color.SourceC = GR_CMBX_ZERO; + otherEnv->Color.InvertC = FXFALSE; + otherEnv->Color.SourceD = GR_CMBX_ZERO; + otherEnv->Color.InvertD = FXFALSE; + otherEnv->Color.Shift = 0; + otherEnv->Color.Invert = FXFALSE; + otherEnv->Alpha.SourceA = GR_CMBX_ITALPHA; + otherEnv->Alpha.ModeA = GR_FUNC_MODE_ZERO; + otherEnv->Alpha.SourceB = GR_CMBX_ITALPHA; + otherEnv->Alpha.ModeB = GR_FUNC_MODE_ZERO; + otherEnv->Alpha.SourceC = GR_CMBX_ZERO; + otherEnv->Alpha.InvertC = FXFALSE; + otherEnv->Alpha.SourceD = GR_CMBX_ZERO; + otherEnv->Alpha.InvertD = FXFALSE; + otherEnv->Alpha.Shift = 0; + otherEnv->Alpha.Invert = FXFALSE; + + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + fxMesa->TexState.EnvMode[0] = envMode; + fxMesa->TexState.TexFormat[0] = baseFormat; + fxMesa->TexState.EnvMode[1] = 0; + fxMesa->TexState.TexFormat[1] = 0; + } + } + else { + /* Voodoo3 */ + + /* see if we really need to update the unit */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode != fxMesa->TexState.EnvMode[0] || + envMode == GL_COMBINE_EXT || + baseFormat != fxMesa->TexState.TexFormat[0]) { + if (!SetupSingleTexEnvVoodoo3(ctx, tmu, envMode, baseFormat)) { + /* software fallback */ + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + fxMesa->TexState.EnvMode[0] = envMode; + fxMesa->TexState.TexFormat[0] = baseFormat; + fxMesa->TexState.EnvMode[1] = 0; + fxMesa->TexState.TexFormat[1] = 0; + } + } +} + + +static void +setupDoubleTMU(tdfxContextPtr fxMesa, + struct gl_texture_object *tObj0, + struct gl_texture_object *tObj1) +{ +#define T0_NOT_IN_TMU 0x01 +#define T1_NOT_IN_TMU 0x02 +#define T0_IN_TMU0 0x04 +#define T1_IN_TMU0 0x08 +#define T0_IN_TMU1 0x10 +#define T1_IN_TMU1 0x20 + + const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + const GLcontext *ctx = fxMesa->glCtx; + tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); + GLuint tstate = 0; + int tmu0 = 0, tmu1 = 1; + + if (shared->umaTexMemory) { + if (!ti0->isInTM) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0); + assert(ti0->isInTM); + } + if (!ti1->isInTM) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0); + assert(ti1->isInTM); + } + } + else { + /* We shouldn't need to do this. There is something wrong with + multitexturing when the TMUs are swapped. So, we're forcing + them to always be loaded correctly. !!! */ + if (ti0->whichTMU == TDFX_TMU1) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj0); + if (ti1->whichTMU == TDFX_TMU0) + tdfxTMMoveOutTM_NoLock(fxMesa, tObj1); + + if (ti0->isInTM) { + switch (ti0->whichTMU) { + case TDFX_TMU0: + tstate |= T0_IN_TMU0; + break; + case TDFX_TMU1: + tstate |= T0_IN_TMU1; + break; + case TDFX_TMU_BOTH: + tstate |= T0_IN_TMU0 | T0_IN_TMU1; + break; + case TDFX_TMU_SPLIT: + tstate |= T0_NOT_IN_TMU; + break; + } + } + else + tstate |= T0_NOT_IN_TMU; + + if (ti1->isInTM) { + switch (ti1->whichTMU) { + case TDFX_TMU0: + tstate |= T1_IN_TMU0; + break; + case TDFX_TMU1: + tstate |= T1_IN_TMU1; + break; + case TDFX_TMU_BOTH: + tstate |= T1_IN_TMU0 | T1_IN_TMU1; + break; + case TDFX_TMU_SPLIT: + tstate |= T1_NOT_IN_TMU; + break; + } + } + else + tstate |= T1_NOT_IN_TMU; + + /* Move texture maps into TMUs */ + + if (!(((tstate & T0_IN_TMU0) && (tstate & T1_IN_TMU1)) || + ((tstate & T0_IN_TMU1) && (tstate & T1_IN_TMU0)))) { + if (tObj0 == tObj1) { + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU_BOTH); + } + else { + /* Find the minimal way to correct the situation */ + if ((tstate & T0_IN_TMU0) || (tstate & T1_IN_TMU1)) { + /* We have one in the standard order, setup the other */ + if (tstate & T0_IN_TMU0) { + /* T0 is in TMU0, put T1 in TMU1 */ + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1); + } + else { + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0); + } + /* tmu0 and tmu1 are setup */ + } + else if ((tstate & T0_IN_TMU1) || (tstate & T1_IN_TMU0)) { + /* we have one in the reverse order, setup the other */ + if (tstate & T1_IN_TMU0) { + /* T1 is in TMU0, put T0 in TMU1 */ + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU1); + } + else { + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0); + } + tmu0 = 1; + tmu1 = 0; + } + else { /* Nothing is loaded */ + tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0); + tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1); + /* tmu0 and tmu1 are setup */ + } + } + } + } + + ti0->lastTimeUsed = fxMesa->texBindNumber; + ti1->lastTimeUsed = fxMesa->texBindNumber; + + + if (!ctx->Texture.SharedPalette) { + if (ti0->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti0->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else if (ti1->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti1->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else { + fxMesa->TexPalette.Data = NULL; + } + } + + /* + * Setup Unit 0 + */ + assert(ti0->isInTM); + assert(ti0->tm[tmu0]); + fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &(ti0->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + + if (fxMesa->TexParams[tmu0].sClamp != ti0->sClamp || + fxMesa->TexParams[tmu0].tClamp != ti0->tClamp || + fxMesa->TexParams[tmu0].minFilt != ti0->minFilt || + fxMesa->TexParams[tmu0].magFilt != ti0->magFilt || + fxMesa->TexParams[tmu0].mmMode != ti0->mmMode || + fxMesa->TexParams[tmu0].LODblend != FXFALSE || + fxMesa->TexParams[tmu0].LodBias != ctx->Texture.Unit[tmu0].LodBias) { + fxMesa->TexParams[tmu0].sClamp = ti0->sClamp; + fxMesa->TexParams[tmu0].tClamp = ti0->tClamp; + fxMesa->TexParams[tmu0].minFilt = ti0->minFilt; + fxMesa->TexParams[tmu0].magFilt = ti0->magFilt; + fxMesa->TexParams[tmu0].mmMode = ti0->mmMode; + fxMesa->TexParams[tmu0].LODblend = FXFALSE; + fxMesa->TexParams[tmu0].LodBias = ctx->Texture.Unit[tmu0].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + /* + * Setup Unit 1 + */ + if (shared->umaTexMemory) { + ASSERT(ti1->isInTM); + ASSERT(ti1->tm[0]); + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + else { + ASSERT(ti1->isInTM); + ASSERT(ti1->tm[tmu1]); + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + + if (fxMesa->TexParams[tmu1].sClamp != ti1->sClamp || + fxMesa->TexParams[tmu1].tClamp != ti1->tClamp || + fxMesa->TexParams[tmu1].minFilt != ti1->minFilt || + fxMesa->TexParams[tmu1].magFilt != ti1->magFilt || + fxMesa->TexParams[tmu1].mmMode != ti1->mmMode || + fxMesa->TexParams[tmu1].LODblend != FXFALSE || + fxMesa->TexParams[tmu1].LodBias != ctx->Texture.Unit[tmu1].LodBias) { + fxMesa->TexParams[tmu1].sClamp = ti1->sClamp; + fxMesa->TexParams[tmu1].tClamp = ti1->tClamp; + fxMesa->TexParams[tmu1].minFilt = ti1->minFilt; + fxMesa->TexParams[tmu1].magFilt = ti1->magFilt; + fxMesa->TexParams[tmu1].mmMode = ti1->mmMode; + fxMesa->TexParams[tmu1].LODblend = FXFALSE; + fxMesa->TexParams[tmu1].LodBias = ctx->Texture.Unit[tmu1].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + fxMesa->sScale0 = ti0->sScale; + fxMesa->tScale0 = ti0->tScale; + fxMesa->sScale1 = ti1->sScale; + fxMesa->tScale1 = ti1->tScale; + +#undef T0_NOT_IN_TMU +#undef T1_NOT_IN_TMU +#undef T0_IN_TMU0 +#undef T1_IN_TMU0 +#undef T0_IN_TMU1 +#undef T1_IN_TMU1 +} + +static void setupTextureDoubleTMU(GLcontext * ctx) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); + struct gl_texture_image *baseImage0 = tObj0->Image[tObj0->BaseLevel]; + struct gl_texture_image *baseImage1 = tObj1->Image[tObj1->BaseLevel]; + const GLenum envMode0 = ctx->Texture.Unit[0].EnvMode; + const GLenum envMode1 = ctx->Texture.Unit[1].EnvMode; + + if (baseImage0->Border > 0 || baseImage1->Border >0) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_BORDER; + return; + } + + setupDoubleTMU(fxMesa, tObj0, tObj1); + + if (ti0->reloadImages || ti1->reloadImages) + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES; + + fxMesa->tmuSrc = TDFX_TMU_BOTH; + + /* Some texture environments not supported */ + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE_ENV; + + if (TDFX_IS_NAPALM(fxMesa)) { + /* Remember, Glide has its texture units numbered in backward + * order compared to OpenGL. + */ + GLboolean hw1 = GL_TRUE, hw2 = GL_TRUE; + + /* check if we really need to update glide unit 1 */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode0 != fxMesa->TexState.EnvMode[1] || + envMode0 == GL_COMBINE_EXT || + baseImage0->Format != fxMesa->TexState.TexFormat[1] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + hw1 = SetupTexEnvNapalm(ctx, GL_TRUE, &ctx->Texture.Unit[0], + baseImage0->Format, &fxMesa->TexCombineExt[1]); + fxMesa->TexState.EnvMode[1] = envMode0; + fxMesa->TexState.TexFormat[1] = baseImage0->Format; + } + + /* check if we really need to update glide unit 0 */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode1 != fxMesa->TexState.EnvMode[0] || + envMode1 == GL_COMBINE_EXT || + baseImage1->Format != fxMesa->TexState.TexFormat[0] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + hw2 = SetupTexEnvNapalm(ctx, GL_FALSE, &ctx->Texture.Unit[1], + baseImage1->Format, &fxMesa->TexCombineExt[0]); + fxMesa->TexState.EnvMode[0] = envMode1; + fxMesa->TexState.TexFormat[0] = baseImage1->Format; + } + + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + + if (!hw1 || !hw2) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + } + else { + int unit0, unit1; + if ((ti0->whichTMU == TDFX_TMU1) || (ti1->whichTMU == TDFX_TMU0)) + unit0 = 1; + else + unit0 = 0; + unit1 = 1 - unit0; + + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode0 != fxMesa->TexState.EnvMode[unit0] || + envMode0 == GL_COMBINE_EXT || + envMode1 != fxMesa->TexState.EnvMode[unit1] || + envMode1 == GL_COMBINE_EXT || + baseImage0->Format != fxMesa->TexState.TexFormat[unit0] || + baseImage1->Format != fxMesa->TexState.TexFormat[unit1] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + + if (!SetupDoubleTexEnvVoodoo3(ctx, unit0, + ctx->Texture.Unit[0].EnvMode, baseImage0->Format, + ctx->Texture.Unit[1].EnvMode, baseImage1->Format)) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + + fxMesa->TexState.EnvMode[unit0] = envMode0; + fxMesa->TexState.TexFormat[unit0] = baseImage0->Format; + fxMesa->TexState.EnvMode[unit1] = envMode1; + fxMesa->TexState.TexFormat[unit1] = baseImage1->Format; + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + } + } +} + + +void +tdfxUpdateTextureState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLuint tex2Denabled = ctx->Texture.ReallyEnabled; + + if (!fxMesa->haveTwoTMUs) + tex2Denabled &= TEXTURE0_2D; + + switch (tex2Denabled) { + case TEXTURE0_2D: + LOCK_HARDWARE( fxMesa ); /* XXX remove locking eventually */ + setupTextureSingleTMU(ctx, 0); + UNLOCK_HARDWARE( fxMesa ); + break; + case TEXTURE1_2D: + LOCK_HARDWARE( fxMesa ); + setupTextureSingleTMU(ctx, 1); + UNLOCK_HARDWARE( fxMesa ); + break; + case (TEXTURE0_2D | TEXTURE1_2D): + LOCK_HARDWARE( fxMesa ); + setupTextureDoubleTMU(ctx); + UNLOCK_HARDWARE( fxMesa ); + break; + default: + /* disable hardware texturing */ + if (TDFX_IS_NAPALM(fxMesa)) { + fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + } + else { + /* Voodoo 3*/ + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + + fxMesa->TexState.Enabled = 0; + fxMesa->TexState.EnvMode[0] = 0; + fxMesa->TexState.EnvMode[1] = 0; + + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + } +} + + + +/* + * This is a special case of texture state update. + * It's used when we've simply bound a new texture to a texture + * unit and the new texture has the exact same attributes as the + * previously bound texture. + * This is very common in Quake3. + */ +void +tdfxUpdateTextureBinding( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); + + const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; + const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; + + if (ti0) { + fxMesa->sScale0 = ti0->sScale; + fxMesa->tScale0 = ti0->tScale; + if (ti0->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti0->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else if (ti1 && ti1->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(ti1->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + } + if (ti1) { + fxMesa->sScale1 = ti1->sScale; + fxMesa->tScale1 = ti1->tScale; + } + + if (ctx->Texture.ReallyEnabled == TEXTURE0_2D) { + if (shared->umaTexMemory) { + fxMesa->TexSource[0].StartAddress = ti0->tm[0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[0].Info = &(ti0->info); + } + else { + if (ti0->LODblend && ti0->whichTMU == TDFX_TMU_SPLIT) { + fxMesa->TexSource[0].StartAddress = ti0->tm[TDFX_TMU0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD; + fxMesa->TexSource[0].Info = &(ti0->info); + fxMesa->TexSource[1].StartAddress = ti0->tm[TDFX_TMU1]->startAddr; + fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[1].Info = &(ti0->info); + } + else { + FxU32 tmu; + if (ti0->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = ti0->whichTMU; + fxMesa->TexSource[0].Info = NULL; + fxMesa->TexSource[1].Info = NULL; + if (ti0->tm[tmu]) { + fxMesa->TexSource[tmu].StartAddress = ti0->tm[tmu]->startAddr; + fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu].Info = &(ti0->info); + } + } + } + } + else if (ctx->Texture.ReallyEnabled == TEXTURE1_2D) { + if (shared->umaTexMemory) { + fxMesa->TexSource[0].StartAddress = ti1->tm[0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[0].Info = &(ti1->info); + } + } + else if (ctx->Texture.ReallyEnabled == (TEXTURE0_2D | TEXTURE1_2D)) { + if (shared->umaTexMemory) { + const FxU32 tmu0 = 0, tmu1 = 1; + fxMesa->TexSource[tmu0].StartAddress = ti0->tm[0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &(ti0->info); + + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + else { + const FxU32 tmu0 = 0, tmu1 = 1; + fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &(ti0->info); + + fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(ti1->info); + } + } + + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h new file mode 100644 index 000000000..0c0d4adcb --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h @@ -0,0 +1,44 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_TEXSTATE_H__ +#define __TDFX_TEXSTATE_H__ + +extern void tdfxUpdateTextureState( GLcontext *ctx ); +extern void tdfxUpdateTextureBinding( GLcontext *ctx ); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c new file mode 100644 index 000000000..21f7cdad3 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c @@ -0,0 +1,508 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_tris.h" + +#include "pipeline.h" +#include "vbindirect.h" + +static struct { + points_func points; + line_func line; + triangle_func triangle; + quad_func quad; + render_func *render_tab; +} rast_tab[TDFX_MAX_TRIFUNC]; + +#define TDFX_COLOR( to, from ) \ + do { \ + (to)[0] = (from)[2]; \ + (to)[1] = (from)[1]; \ + (to)[2] = (from)[0]; \ + (to)[3] = (from)[3]; \ + } while (0) + + +static void tdfxPrintRenderState( const char *msg, GLuint state ) +{ + fprintf( stderr, "%s: (0x%x) %s%s%s%s\n", + msg, state, + (state & TDFX_FLAT_BIT) ? "flat, " : "", + (state & TDFX_OFFSET_BIT) ? "offset, " : "", + (state & TDFX_TWOSIDE_BIT) ? "twoside, " : "", + (state & TDFX_CLIPRECT_BIT) ? "cliprects, " : ""); +} + + +#define IND (0) +#define TAG(x) x +#include "tdfx_tritmp.h" + +#define IND (TDFX_FLAT_BIT) +#define TAG(x) x##_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT) +#define TAG(x) x##_offset +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_offset_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT) +#define TAG(x) x##_twoside +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_twoside_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT) +#define TAG(x) x##_twoside_offset +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_twoside_offset_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_CLIPRECT_BIT) +#define TAG(x) x##_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_offset_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_offset_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_offset_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_offset_flat_cliprect +#include "tdfx_tritmp.h" + +static void tdfx_render_vb_points( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* Adjust point coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += PNT_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_POINTS, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore point coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= PNT_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_line_strip( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* adjust line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_lines( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* adjust line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_LINES, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_triangles( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLES, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +static void tdfx_render_vb_tri_strip( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +static void tdfx_render_vb_tri_fan( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start, fxVB+start, + sizeof(*fxVB) ); + (void) parity; +} + + +static void tdfx_render_vb_poly( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_POLYGON, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +#define RENDER_POINTS( start, count ) \ +do { \ + int i; \ + for (i = start ; i < count ; i++) { \ + v[elt[i]].v.x += PNT_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i]].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; \ + grDrawPoint(&v[elt[i]]); \ + v[elt[i]].v.x -= PNT_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i]].v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; \ + } \ +} while (0) + +#define RENDER_LINE( i0, i1 ) \ +do { \ + v[elt[i0]].v.x += LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i0]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \ + v[elt[i1]].v.x += LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i1]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \ + grDrawLine( &v[elt[i0]], &v[elt[i1]] ); \ + v[elt[i0]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i0]].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \ + v[elt[i1]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i1]].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + if (parity) grDrawTriangle( &v[elt[i1]], &v[elt[i2]], &v[elt[i]] ); \ + else grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + grDrawTriangle( &v[elt[i3]], &v[elt[i2]], &v[elt[i]] ); \ + grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \ +} while (0) + + +#define LOCAL_VARS \ + GLcontext *ctx = VB->ctx; \ + const GLuint *elt = VB->EltPtr->data; \ + tdfxVertexPtr v = TDFX_DRIVER_DATA(VB)->verts; \ + (void) v; (void) ctx; + +#define TAG(x) tdfx_##x##_elts +#include "render_tmp.h" + + +static void tdfxDDRenderEltsRaw( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + struct vertex_buffer *OldVB = ctx->VB; + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_elts[prim]; + GLuint p = 0; + + ctx->VB = VB; + ctx->Driver.RenderStart( ctx ); + + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + END_CLIP_LOOP_LOCKED( fxMesa ); + + ctx->Driver.RenderFinish( ctx ); + ctx->VB = OldVB; +} + + +void tdfxDDTriangleFuncsInit( void ) +{ + init(); + init_flat(); + init_offset(); + init_offset_flat(); + init_twoside(); + init_twoside_flat(); + init_twoside_offset(); + init_twoside_offset_flat(); + + init_cliprect(); + init_flat_cliprect(); + init_offset_cliprect(); + init_offset_flat_cliprect(); + init_twoside_cliprect(); + init_twoside_flat_cliprect(); + init_twoside_offset_cliprect(); + init_twoside_offset_flat_cliprect(); + + rast_tab[0].render_tab[GL_POINTS] = tdfx_render_vb_points; + rast_tab[0].render_tab[GL_LINE_STRIP] = tdfx_render_vb_line_strip; + rast_tab[0].render_tab[GL_LINES] = tdfx_render_vb_lines; + rast_tab[0].render_tab[GL_TRIANGLES] = tdfx_render_vb_triangles; + rast_tab[0].render_tab[GL_TRIANGLE_STRIP] = tdfx_render_vb_tri_strip; + rast_tab[0].render_tab[GL_TRIANGLE_FAN] = tdfx_render_vb_tri_fan; + rast_tab[0].render_tab[GL_POLYGON] = tdfx_render_vb_poly; + + tdfx_render_init_elts(); +} + + +#define ALL_FALLBACK (DD_SELECT | DD_FEEDBACK) +#define POINT_FALLBACK (ALL_FALLBACK | DD_POINT_SMOOTH | DD_POINT_ATTEN) +#define LINE_FALLBACK (ALL_FALLBACK | DD_LINE_STIPPLE) +#define TRI_FALLBACK (ALL_FALLBACK | DD_TRI_SMOOTH | DD_TRI_UNFILLED) +#define ANY_FALLBACK (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK | DD_TRI_STIPPLE | DD_LINE_SMOOTH | DD_LINE_WIDTH | DD_POINT_SIZE ) +#define ANY_RENDER_FLAGS (DD_FLATSHADE | DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET) + +/* Setup the Point, Line, Triangle and Quad functions based on the + * current rendering state. Wherever possible, use the hardware to + * render the primitive. Otherwise, fallback to software rendering. + */ +void tdfxDDChooseRenderState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GLuint flags = ctx->TriangleCaps; + CARD32 index = 0; + fxMesa->RenderElementsRaw = tdfxDDRenderEltsRaw; + + if ( fxMesa->Fallback ) { + fxMesa->RenderElementsRaw = gl_render_elts; + fxMesa->RenderIndex = TDFX_FALLBACK_BIT; + return; + } + + if ( flags & ANY_RENDER_FLAGS ) { + if ( flags & DD_FLATSHADE ) index |= TDFX_FLAT_BIT; + if ( flags & DD_TRI_LIGHT_TWOSIDE ) index |= TDFX_TWOSIDE_BIT; + if ( flags & DD_TRI_OFFSET ) index |= TDFX_OFFSET_BIT; + fxMesa->RenderElementsRaw = gl_render_elts; + } + + if ( fxMesa->numClipRects > 1 ) + index |= TDFX_CLIPRECT_BIT; + + fxMesa->PointsFunc = rast_tab[index].points; + fxMesa->LineFunc = rast_tab[index].line; + fxMesa->TriangleFunc = rast_tab[index].triangle; + fxMesa->QuadFunc = rast_tab[index].quad; + fxMesa->RenderVBRawTab = rast_tab[index].render_tab; + fxMesa->RenderIndex = index; + fxMesa->IndirectTriangles = 0; + + if ( flags & ANY_FALLBACK ) { + if ( flags & POINT_FALLBACK ) { + fxMesa->PointsFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= DD_POINT_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if ( flags & LINE_FALLBACK ) { + fxMesa->LineFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= DD_LINE_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if ( flags & TRI_FALLBACK ) { + fxMesa->TriangleFunc = 0; + fxMesa->QuadFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | + DD_QUAD_SW_RASTERIZE); + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + /* Special case: wide, AA lines must be done in software */ + if (flags & DD_LINE_SMOOTH) { + if (ctx->Line.Width != 1.0) { + fxMesa->RenderVBRawTab = 0; + fxMesa->LineFunc = 0; + fxMesa->IndirectTriangles |= DD_LINE_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + } + + /* Special case: we can do polygon stipples, but otherwise */ + if ((flags & DD_TRI_STIPPLE) && + (ctx->IndirectTriangles & DD_TRI_STIPPLE)) { + fxMesa->TriangleFunc = 0; + fxMesa->QuadFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | + DD_QUAD_SW_RASTERIZE); + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if (flags & (DD_LINE_WIDTH | DD_POINT_SIZE)) + fxMesa->RenderVBRawTab = 0; + + fxMesa->RenderElementsRaw = gl_render_elts; + } + + + if ( 0 ) { + gl_print_tri_caps( "tricaps", ctx->TriangleCaps ); + tdfxPrintRenderState( "tdfx render state", fxMesa->RenderIndex ); + } +} + + +void tdfxDDToggleTriCliprects( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + int oldidx = fxMesa->RenderIndex; + int newidx; + + if (fxMesa->Fallback) + return; + + if (fxMesa->numClipRects > 1) + newidx = (fxMesa->RenderIndex |= TDFX_CLIPRECT_BIT); + else + newidx = (fxMesa->RenderIndex &= ~TDFX_CLIPRECT_BIT); + + if (ctx->Driver.TriangleFunc == rast_tab[oldidx].triangle) + ctx->Driver.TriangleFunc = rast_tab[newidx].triangle; + + if (ctx->Driver.QuadFunc == rast_tab[oldidx].quad) + ctx->Driver.QuadFunc = rast_tab[newidx].quad; + + if (ctx->Driver.LineFunc == rast_tab[oldidx].line) + ctx->Driver.LineFunc = rast_tab[newidx].line; + + if (ctx->Driver.PointsFunc == rast_tab[oldidx].points) + ctx->Driver.PointsFunc = rast_tab[newidx].points; + + if (ctx->Driver.RenderVBRawTab == rast_tab[oldidx].render_tab) + ctx->Driver.RenderVBRawTab = rast_tab[newidx].render_tab; + + if (ctx->TriangleFunc == rast_tab[oldidx].triangle) + ctx->TriangleFunc = rast_tab[newidx].triangle; + + if (ctx->QuadFunc == rast_tab[oldidx].quad) + ctx->QuadFunc = rast_tab[newidx].quad; + + fxMesa->PointsFunc = rast_tab[newidx].points; + fxMesa->LineFunc = rast_tab[newidx].line; + fxMesa->TriangleFunc = rast_tab[newidx].triangle; + fxMesa->QuadFunc = rast_tab[newidx].quad; + fxMesa->RenderVBRawTab = rast_tab[newidx].render_tab; + + if (newidx == 0 && + (ctx->IndirectTriangles & (DD_LINE_WIDTH|DD_POINT_SIZE)) == 0) + fxMesa->RenderElementsRaw = tdfxDDRenderEltsRaw; + else + fxMesa->RenderElementsRaw = gl_render_elts; + + if (0) + tdfxPrintRenderState( "toggle tdfx render state", fxMesa->RenderIndex ); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h new file mode 100644 index 000000000..1de26cefa --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h @@ -0,0 +1,176 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_TRIS_H__ +#define __TDFX_TRIS_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "tdfx_vb.h" +#include "tdfx_render.h" + +extern void tdfxDDChooseRenderState( GLcontext *ctx ); +extern void tdfxDDTriangleFuncsInit( void ); + + +#define TDFX_FLAT_BIT 0x01 +#define TDFX_OFFSET_BIT 0x02 +#define TDFX_TWOSIDE_BIT 0x04 +#define TDFX_CLIPRECT_BIT 0x10 +#define TDFX_FALLBACK_BIT 0x20 +#define TDFX_MAX_TRIFUNC 0x40 + + +static __inline void tdfx_draw_triangle( tdfxContextPtr fxMesa, + tdfxVertex *v0, + tdfxVertex *v1, + tdfxVertex *v2 ) +{ + grDrawTriangle( v0, v1, v2 ); +} + + +static __inline void tdfx_draw_point( tdfxContextPtr fxMesa, + tdfxVertex *tmp, float sz ) +{ + if ( sz <= 1.0 ) { + /* Save and restore original x,y rather than copying whole + * vertex. + */ + GLfloat x = tmp->v.x, y = tmp->v.y; + tmp->v.x += PNT_X_OFFSET - TRI_X_OFFSET; + tmp->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; + grDrawPoint( tmp ); + tmp->v.x = x; + tmp->v.y = y; + } + else { + const GLfloat xLeft = tmp->v.x - 0.5 * sz - TRI_X_OFFSET + PNT_X_OFFSET; + const GLfloat xRight = tmp->v.x + 0.5 * sz - TRI_X_OFFSET + PNT_X_OFFSET; + const GLfloat yBot = tmp->v.y - 0.5 * sz - TRI_Y_OFFSET + PNT_Y_OFFSET; + const GLfloat yTop = tmp->v.y + 0.5 * sz - TRI_Y_OFFSET + PNT_Y_OFFSET; + tdfxVertex verts[4]; + + verts[0] = *tmp; + verts[1] = *tmp; + verts[2] = *tmp; + verts[3] = *tmp; + + verts[0].v.x = xLeft; + verts[0].v.y = yBot; + + verts[1].v.x = xRight; + verts[1].v.y = yBot; + + verts[2].v.x = xRight; + verts[2].v.y = yTop; + + verts[3].v.x = xLeft; + verts[3].v.y = yTop; + + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts, + sizeof(tdfxVertex) ); + } +} + + +static __inline void tdfx_draw_line( tdfxContextPtr fxMesa, + tdfxVertex *tmp0, + tdfxVertex *tmp1, + float width ) +{ + if ( width <= 1.0 ) + { + /* Faster to save and restore 4 dwords than to copy 32 dwords. + */ + GLfloat x0 = tmp0->v.x, y0 = tmp0->v.y; + GLfloat x1 = tmp1->v.x, y1 = tmp1->v.y; + tmp0->v.x += LINE_X_OFFSET - TRI_X_OFFSET; + tmp0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + tmp1->v.x += LINE_X_OFFSET - TRI_X_OFFSET; + tmp1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + grDrawLine(tmp0, tmp1); + tmp0->v.x = x0; + tmp0->v.y = y0; + tmp1->v.x = x1; + tmp1->v.y = y1; + } + else + { + tdfxVertex verts[4]; + float dx, dy, ix, iy; + + dx = tmp0->v.x - tmp1->v.x; + dy = tmp0->v.y - tmp1->v.y; + + if (dx * dx > dy * dy) { + iy = width * .5; + ix = 0; + } else { + iy = 0; + ix = width * .5; + } + + verts[0] = *tmp0; + verts[1] = *tmp0; + verts[2] = *tmp1; + verts[3] = *tmp1; + + verts[0].v.x = tmp0->v.x - ix; + verts[0].v.y = tmp0->v.y - iy; + + verts[1].v.x = tmp0->v.x + ix; + verts[1].v.y = tmp0->v.y + iy; + + verts[2].v.x = tmp1->v.x + ix; + verts[2].v.y = tmp1->v.y + iy; + + verts[3].v.x = tmp1->v.x - ix; + verts[3].v.y = tmp1->v.y - iy; + + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts, + sizeof(tdfxVertex) ); + } +} + +void tdfxDDToggleTriCliprects( GLcontext *ctx ); + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_TRIS_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h new file mode 100644 index 000000000..a1039c99c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h @@ -0,0 +1,422 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +static __inline void TAG(triangle)( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts; + tdfxVertex *v[3]; + +#if (IND & TDFX_OFFSET_BIT) + GLfloat offset; + GLfloat z[3]; +#endif + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + GLuint c[3]; +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); +#endif + + v[0] = &fxverts[e0]; + v[1] = &fxverts[e1]; + v[2] = &fxverts[e2]; + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; +#endif + + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT)) + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & TDFX_TWOSIDE_BIT) + { + GLuint facing = ( cc < 0.0 ) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & TDFX_FLAT_BIT) { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + TDFX_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + TDFX_COLOR( (char *)&v[2]->ui[4], vbcolor[e2] ); + } + } +#endif + +#if (IND & TDFX_OFFSET_BIT) + { + offset = ctx->Polygon.OffsetUnits; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + } +#endif + } +#elif (IND & TDFX_FLAT_BIT) + { + GLuint color = fxverts[pv].ui[4]; + v[0]->ui[4] = color; + v[1]->ui[4] = color; + v[2]->ui[4] = color; + } +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + grDrawTriangle( v[0], v[1], v[2] ); + END_CLIP_LOOP_LOCKED( fxMesa ); +#else + grDrawTriangle( v[0], v[1], v[2] ); +#endif + +#if (IND & TDFX_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; +#endif + +#if (IND & (TDFX_FLAT_BIT | TDFX_TWOSIDE_BIT)) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; +#endif + +} + + + +static __inline void TAG(quad)( GLcontext *ctx, GLuint e0, + GLuint e1, GLuint e2, GLuint e3, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts; + tdfxVertex *v[4]; + +#if (IND & TDFX_OFFSET_BIT) + GLfloat offset; + GLfloat z[4]; +#endif + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + GLuint c[4]; +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); +#endif + + + v[0] = &fxverts[e0]; + v[1] = &fxverts[e1]; + v[2] = &fxverts[e2]; + v[3] = &fxverts[e3]; + + +/* fprintf(stderr, "%s\n", __FUNCTION__); */ + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; + c[3] = v[3]->ui[4]; +#endif + + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT)) + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & TDFX_TWOSIDE_BIT) + { + GLuint facing = ( cc < 0.0 ) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & TDFX_FLAT_BIT) { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[3]->ui[4] = v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + TDFX_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + TDFX_COLOR( (char *)&v[2]->ui[4], vbcolor[e2] ); + TDFX_COLOR( (char *)&v[3]->ui[4], vbcolor[e3] ); + } + } +#endif + +#if (IND & TDFX_OFFSET_BIT) + { + offset = ctx->Polygon.OffsetUnits; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + z[3] = v[3]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + v[3]->v.z += offset; + } +#endif + } +#elif (IND & TDFX_FLAT_BIT) + { + GLuint color = fxverts[pv].ui[4]; + v[0]->ui[4] = color; + v[1]->ui[4] = color; + v[2]->ui[4] = color; + v[3]->ui[4] = color; + } +#endif + +/* Marginally faster to call grDrawTriangle twice + * than calling grDrawVertexArray. + */ +#if (IND & TDFX_CLIPRECT_BIT) + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); +/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */ + grDrawTriangle( v[0], v[1], v[3] ); + grDrawTriangle( v[1], v[2], v[3] ); + END_CLIP_LOOP_LOCKED( fxMesa ); +#else +/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */ + grDrawTriangle( v[0], v[1], v[3] ); + grDrawTriangle( v[1], v[2], v[3] ); +#endif + +#if (IND & TDFX_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; + v[3]->v.z = z[3]; +#endif + +#if (IND & (TDFX_FLAT_BIT | TDFX_TWOSIDE_BIT)) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; + v[3]->ui[4] = c[3]; +#endif +} + + + + + +static __inline void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint pv ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(ctx->VB)->verts; + float width = ctx->Line.Width; + GLfloat z0, z1; + GLuint c0, c1; + tdfxVertex *vert0 = &fxVB[v0]; + tdfxVertex *vert1 = &fxVB[v1]; + + if ( IND & TDFX_TWOSIDE_BIT ) { + GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; + + if ( IND & TDFX_FLAT_BIT ) { + TDFX_COLOR( (char *)&vert0->v.color,vbcolor[pv] ); + *(int *)&vert1->v.color = *(int *)&vert0->v.color; + } else { + TDFX_COLOR( (char *)&vert0->v.color,vbcolor[v0] ); + TDFX_COLOR( (char *)&vert1->v.color,vbcolor[v1] ); + } + } else if ( IND & TDFX_FLAT_BIT ) { + c0 = *(GLuint *) &(vert0->v.color); + c1 = *(GLuint *) &(vert1->v.color); + *(int *)&vert0->v.color = + *(int *)&vert1->v.color = *(int *)&fxVB[pv].v.color; + } + + if ( IND & TDFX_OFFSET_BIT ) { + GLfloat offset = ctx->LineZoffset; + z0 = vert0->v.z; + z1 = vert1->v.z; + vert0->v.z += offset; + vert1->v.z += offset; + } + + if (IND & TDFX_CLIPRECT_BIT) { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_line( fxMesa, &fxVB[v0], &fxVB[v1], width ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } else + tdfx_draw_line( fxMesa, &fxVB[v0], &fxVB[v1], width ); + + if ( IND & TDFX_OFFSET_BIT ) { + vert0->v.z = z0; + vert1->v.z = z1; + } + + if ( (IND & TDFX_FLAT_BIT) && !(IND & TDFX_TWOSIDE_BIT) ) { + *(GLuint *) &(vert0->v.color) = c0; + *(GLuint *) &(vert1->v.color) = c1; + } +} + + +static __inline void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLfloat sz = ctx->Point.Size; + int i; + + for ( i = first ; i < last ; i++ ) { + if ( VB->ClipMask[i] == 0 ) { + if ( IND & (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT) ) + { + tdfxVertex tmp0 = fxVB[i]; + + if ( IND & TDFX_TWOSIDE_BIT ) { + GLubyte (*vbcolor)[4] = VB->ColorPtr->data; + TDFX_COLOR( (char *)&tmp0.v.color, vbcolor[i] ); + } + + if ( IND & TDFX_OFFSET_BIT ) { + GLfloat offset = ctx->PointZoffset; + tmp0.v.z += offset; + } + + if (IND & TDFX_CLIPRECT_BIT) { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_point( fxMesa, &tmp0, sz ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } else + tdfx_draw_point( fxMesa, &tmp0, sz ); + } + else if (IND & TDFX_CLIPRECT_BIT) + { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_point( fxMesa, &fxVB[i], sz ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } + else + tdfx_draw_point( fxMesa, &fxVB[i], sz ); + } + } +} + + + + +/* Accelerate unclipped VB rendering when fxMesa->renderIndex != 0 + * + * The versions for renderIndex == 0 are further optimized and appear + * in tdfx_tris.c + */ +#if (TYPE == 0) +#define RENDER_POINTS( start, count ) TAG(points)( ctx, start, count ) +#define RENDER_LINE( i1, i ) TAG(line)( ctx, i1, i, i ) +#define RENDER_TRI( i2, i1, i, pv, parity ) \ + do { \ + if (parity) TAG(triangle)( ctx, i1, i2, i, pv ); \ + else TAG(triangle)( ctx, i2, i1, i, pv ); \ + } while (0) +#define RENDER_QUAD( i3, i2, i1, i, pv ) TAG(quad)( ctx, i3, i2, i1, i, pv ) +#define LOCAL_VARS GLcontext *ctx = VB->ctx; +#define PRESERVE_TAG +#include "render_tmp.h" +#endif + + + +static void TAG(init)( void ) +{ + rast_tab[IND].triangle = TAG(triangle); + rast_tab[IND].quad = TAG(quad); + rast_tab[IND].line = TAG(line); + rast_tab[IND].points = TAG(points); +#if (TYPE == 0) + rast_tab[IND].render_tab = TAG(render_tab); +#else + rast_tab[IND].render_tab = 0; +#endif + TAG(render_init)(); +} + + +#undef IND +#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c new file mode 100644 index 000000000..a5cb9b6bc --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c @@ -0,0 +1,498 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_vb.h" + +#include "stages.h" +#include "mem.h" + + +#define COORD \ +do { \ + v->v.x = winCoord[0] + xoffset; \ + v->v.y = winCoord[1] + yoffset; \ + v->v.z = winCoord[2]; \ + v->v.rhw = w; \ +} while (0) + + +/* The assembly is slower... + */ +#if 0 && defined(USE_X86_ASM) +#define COL \ +do { \ + __asm__ ( \ + "movl (%%edx),%%eax \n" \ + "bswap %%eax \n" \ + "rorl $8,%%eax \n" \ + "movl %%eax,16(%%edi) \n" \ + : \ + : "d" (color), "D" (v) \ + : "%eax" ); \ +} while (0) +#else +#define COL \ +do { \ + v->v.color.blue = color[2]; \ + v->v.color.green = color[1]; \ + v->v.color.red = color[0]; \ + v->v.color.alpha = color[3]; \ +} while (0) +#endif + + +#define TEX0 \ +do { \ + v->v.tu0 = tc0[i][0] * sScale0 * w; \ + v->v.tv0 = tc0[i][1] * tScale0 * w; \ +} while (0) + +#define TEX1 \ +do { \ + v->v.tu1 = tc1[i][0] * sScale1 * w; \ + v->v.tv1 = tc1[i][1] * tScale1 * w; \ +} while (0) + + +#define TEX0_4 \ + if ( VB->TexCoordPtr[0]->size == 4 ) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[0]->data; \ + winCoord = VB->Win.data[start]; \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + for ( i = start ; i < end ; i++, v++, winCoord+=4 ) { \ + v->v.tq0 = tc[i][3] * winCoord[3]; \ + } \ + } + +#define TEX1_4 \ + if ( VB->TexCoordPtr[1]->size == 4 ) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[1]->data; \ + winCoord = VB->Win.data[start]; \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + for ( i = start ; i < end ; i++, v++, winCoord+=4 ) { \ + v->v.tq1 = tc[i][3] * winCoord[3]; \ + } \ + } + + +#define FOG + + +#define NOP + + + +#define SETUPFUNC(name,win,col,tex0,tex1,tex0_4,tex1_4,fog) \ +static void name( struct vertex_buffer *VB, GLuint start, GLuint end ) \ +{ \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx); \ + tdfxVertexPtr v; \ + const GLfloat *winCoord; \ + GLfloat (*tc0)[4]; \ + GLfloat (*tc1)[4]; \ + const GLfloat xoffset = fxMesa->x_offset + TRI_X_OFFSET; \ + const GLfloat yoffset = fxMesa->y_delta + TRI_Y_OFFSET; \ + const GLfloat sScale0 = fxMesa->sScale0; \ + const GLfloat tScale0 = fxMesa->tScale0; \ + const GLfloat sScale1 = fxMesa->sScale1; \ + const GLfloat tScale1 = fxMesa->tScale1; \ + const GLubyte *color; \ + int i; \ + \ + (void) xoffset; (void) yoffset; \ + (void) sScale0; (void) tScale0; \ + (void) sScale1; (void) tScale1; \ + \ + if (0) fprintf(stderr, "%s\n", __FUNCTION__); \ + gl_import_client_data( VB, VB->ctx->RenderFlags, \ + (VB->ClipOrMask \ + ? VEC_WRITABLE|VEC_GOOD_STRIDE \ + : VEC_GOOD_STRIDE)); \ + \ + tc0 = VB->TexCoordPtr[fxMesa->tmu_source[0]]->data; \ + tc1 = VB->TexCoordPtr[fxMesa->tmu_source[1]]->data; \ + color = VB->Color[0]->data[start]; \ + winCoord = VB->Win.data[start]; \ + \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + \ + if ( VB->ClipOrMask == 0 ) { \ + for ( i = start ; i < end ; i++, v++, color+=4, winCoord+=4 ) { \ + const GLfloat w = winCoord[3]; \ + (void) w; \ + win; \ + col; \ + fog; \ + tex0; \ + tex1; \ + } \ + } else { \ + for ( i = start ; i < end ; i++, v++, color+=4, winCoord+=4 ) { \ + if ( VB->ClipMask[i] == 0 ) { \ + const GLfloat w = winCoord[3]; \ + (void) w; \ + win; \ + fog; \ + tex0; \ + tex1; \ + } \ + col; \ + } \ + } \ + tex0_4; \ + tex1_4; \ +} + + +SETUPFUNC(rs_wt0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_wt0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_wft0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_wft0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, FOG) +SETUPFUNC(rs_wg, COORD, COL, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_wgt0, COORD, COL, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_wgt0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_wgf, COORD, COL, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_wgft0, COORD, COL, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_wgft0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, FOG) + +SETUPFUNC(rs_t0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_t0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_f, NOP, NOP, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_ft0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_ft0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, FOG) +SETUPFUNC(rs_g, NOP, COL, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_gt0, NOP, COL, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_gt0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_gf, NOP, COL, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_gft0, NOP, COL, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_gft0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, FOG) + + + +static void rs_invalid( struct vertex_buffer *VB, GLuint start, GLuint end ) +{ + fprintf( stderr, "tdfxRasterSetup(): invalid setup function\n" ); +} + +typedef void (*setupFunc)( struct vertex_buffer *, GLuint, GLuint ); + +static setupFunc setup_func[0x40]; + + +void tdfxDDSetupInit( void ) +{ + int i; + + for (i = 0; i < Elements(setup_func); i++) + setup_func[i] = rs_invalid; + + /* Functions to build vertices from scratch */ + setup_func[TDFX_WIN_BIT|TDFX_TEX0_BIT] = rs_wt0; + setup_func[TDFX_WIN_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wt0t1; + setup_func[TDFX_WIN_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_wft0; + setup_func[TDFX_WIN_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wft0t1; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT] = rs_wg; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_TEX0_BIT] = rs_wgt0; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wgt0t1; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT] = rs_wgf; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_wgft0; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wgft0t1; + + /* Repair functions */ + setup_func[TDFX_TEX0_BIT] = rs_t0; + setup_func[TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_t0t1; + setup_func[TDFX_FOG_BIT] = rs_f; + setup_func[TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_ft0; + setup_func[TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_ft0t1; + setup_func[TDFX_RGBA_BIT] = rs_g; + setup_func[TDFX_RGBA_BIT|TDFX_TEX0_BIT] = rs_gt0; + setup_func[TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_gt0t1; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT] = rs_gf; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_gft0; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_gft0t1; +} + + +void tdfxPrintSetupFlags( char *msg, GLuint flags ) +{ + fprintf( stderr, "%s: 0x%x %s%s%s%s%s\n", + msg, + (int)flags, + (flags & TDFX_WIN_BIT) ? " xyzw," : "", + (flags & TDFX_RGBA_BIT) ? " rgba," : "", + (flags & TDFX_FOG_BIT) ? " fog," : "", + (flags & TDFX_TEX0_BIT) ? " tex-0," : "", + (flags & TDFX_TEX1_BIT) ? " tex-1," : "" ); +} + + +/* ================================================================ + * Raster Setup + */ + +void tdfxDDChooseRasterSetupFunc( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + int index = TDFX_WIN_BIT | TDFX_RGBA_BIT; + int vertexFormat = fxMesa->vertexFormat; + + fxMesa->vertsize = 8; + fxMesa->tmu_source[0] = 0; + fxMesa->tmu_source[1] = 1; + fxMesa->tex_dest[0] = TDFX_TEX0_BIT; + fxMesa->tex_dest[1] = TDFX_TEX1_BIT; + fxMesa->vertexFormat = TDFX_LAYOUT_SINGLE; + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + index |= TDFX_TEX0_BIT; + } + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX1 ) { + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + fxMesa->vertexFormat = TDFX_LAYOUT_MULTI; + fxMesa->vertsize = 10; + index |= TDFX_TEX1_BIT; + } else { + /* Just a funny way of doing single texturing. + */ + fxMesa->tmu_source[0] = 1; + fxMesa->tex_dest[1] = TDFX_TEX0_BIT; + index |= TDFX_TEX0_BIT; + } + } + + if (ctx->Texture.ReallyEnabled & (ENABLE_TEX0 | ENABLE_TEX1)) { + if ((ctx->VB->TexCoordPtr[0] && ctx->VB->TexCoordPtr[0]->size == 4) || + (ctx->VB->TexCoordPtr[1] && ctx->VB->TexCoordPtr[1]->size == 4)) { + fxMesa->vertexFormat = TDFX_LAYOUT_PROJECT; + } + } + + if ( ctx->Fog.Enabled ) + index |= TDFX_FOG_BIT; + + fxMesa->SetupIndex = index; + ctx->Driver.RasterSetup = setup_func[index]; + + if ( fxMesa->vertexFormat != vertexFormat ) { + fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT; + } + + if (0) { + tdfxPrintSetupFlags( "full setup function", index ); + fprintf(stderr, "full setup function %p\n", ctx->Driver.RasterSetup); + } +} + +/* Check to see if vertices need repairing. + */ +void tdfxDDCheckPartialRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *d ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + int tmp = fxMesa->SetupDone; + + d->type = 0; + fxMesa->SetupDone = 0; /* cleared if we return */ + + if ( (ctx->Array.Summary & VERT_OBJ_ANY) == 0 ) + return; + if ( ctx->IndirectTriangles ) + return; + + fxMesa->SetupDone = tmp; +} + +/* Repair existing precalculated vertices with new data. + */ +void tdfxDDPartialRasterSetup( struct vertex_buffer *VB ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( VB->ctx ); + GLuint new = VB->pipeline->new_outputs; + GLuint available = VB->pipeline->outputs; + GLuint index = 0; + + if ( new & VERT_WIN ) { + new = available; + index |= TDFX_WIN_BIT | TDFX_FOG_BIT; + } + + if ( new & VERT_RGBA ) + index |= TDFX_RGBA_BIT; + + if ( new & VERT_TEX0_ANY ) + index |= TDFX_TEX0_BIT; + + if ( new & VERT_TEX1_ANY ) + index |= fxMesa->tex_dest[1]; + + if ( new & VERT_FOG_COORD ) + index |= TDFX_FOG_BIT; + + fxMesa->SetupDone &= ~index; + index &= fxMesa->SetupIndex; + fxMesa->SetupDone |= index; + + if ( 0 ) + tdfxPrintSetupFlags( "partial setup function", index ); + + if ( index ) + setup_func[index]( VB, VB->Start, VB->Count ); +} + +void tdfxDDDoRasterSetup( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + + if ( VB->Type == VB_CVA_PRECALC ) { + tdfxDDPartialRasterSetup( VB ); + } else if ( ctx->Driver.RasterSetup ) { + ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count ); + } +} + + +/* ================================================================ + * Device-specific Vertex Buffers + */ + +void tdfxDDResizeVB( struct vertex_buffer *VB, GLuint size ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + while ( fxVB->size < size ) + fxVB->size *= 2; + + ALIGN_FREE( fxVB->vert_store ); + fxVB->vert_store = ALIGN_MALLOC( sizeof(tdfxVertex) * fxVB->size, 32 ); + if ( !fxVB->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + fxVB->verts = (tdfxVertexPtr)fxVB->vert_store; + + gl_vector1ui_free( &fxVB->clipped_elements ); + gl_vector1ui_alloc( &fxVB->clipped_elements, + VEC_WRITABLE, fxVB->size, 32 ); + if ( !fxVB->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * fxVB->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } +} + +void tdfxDDResizeElts( struct vertex_buffer *VB, GLuint size ) +{ +#if 0 + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + FREE(fxVB->elts); + + while (fxVB->elt_size < size) + fxVB->elt_size *= 2; + + FREE(fxVB->elts); + fxVB->elts = MALLOC( sizeof(tdfxVertex *) * fxVB->elt_size ); + if ( !fxVB->elts ) { + fprintf( stderr, "Cannot allocate vertex indirection! Exiting...\n" ); + exit( 1 ); + } +#endif +} + +void tdfxDDRegisterVB( struct vertex_buffer *VB ) +{ + tdfxVertexBufferPtr fxVB; + + fxVB = (tdfxVertexBufferPtr) CALLOC( sizeof(*fxVB) ); + + fxVB->elt_size = fxVB->size = VB->Size * 2; + fxVB->vert_store = ALIGN_MALLOC( sizeof(tdfxVertex) * fxVB->size, 32 ); + if ( !fxVB->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + fxVB->verts = (tdfxVertexPtr)fxVB->vert_store; + +#if 0 + fxVB->elts = MALLOC( sizeof(tdfxVertex *) * fxVB->elt_size ); + if ( !fxVB->elts ) { + fprintf( stderr, "Cannot allocate vertex indirection! Exiting...\n" ); + exit( 1 ); + } +#endif + + gl_vector1ui_alloc( &fxVB->clipped_elements, + VEC_WRITABLE, fxVB->size, 32 ); + if ( !fxVB->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * fxVB->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } + + VB->driver_data = fxVB; +} + +void tdfxDDUnregisterVB( struct vertex_buffer *VB ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + if ( fxVB ) { + if ( fxVB->vert_store ) ALIGN_FREE( fxVB->vert_store ); + if ( fxVB->elts ) ALIGN_FREE( fxVB->elts ); + gl_vector1ui_free( &fxVB->clipped_elements ); + FREE( fxVB ); + VB->driver_data = NULL; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h new file mode 100644 index 000000000..1f928ea2d --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h @@ -0,0 +1,127 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_VB_H__ +#define __TDFX_VB_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "types.h" +#include "vb.h" + +/* + * Color type for the vertex data + */ +typedef struct { + GLubyte blue; + GLubyte green; + GLubyte red; + GLubyte alpha; +} tdfx_color_t; + + +/* The vertex structure. The final tu1/tv1 values only used in + * multitexture modes, and tq0/tq1 in projected texture modes. + */ +typedef struct { + GLfloat x, y, z; /* Coordinates in screen space */ + GLfloat rhw; /* Reciprocal homogeneous w */ + tdfx_color_t color; /* Diffuse color */ + GLuint padding; /* ... */ + GLfloat tu0, tv0; /* Texture 0 coordinates */ + GLfloat tu1, tv1; /* Texture 1 coordinates */ + GLfloat tq0, tq1; /* Projected texture coordinates */ +} tdfx_vertex; + + +/* The fastpath code still expects a 16-float stride vertex. + */ +union tdfx_vertex_t { + tdfx_vertex v; + GLfloat f[16]; + GLuint ui[16]; +}; + +typedef union tdfx_vertex_t tdfxVertex; +typedef union tdfx_vertex_t *tdfxVertexPtr; + +/* Vertex buffer for use when on the fast path */ +struct tdfx_vertex_buffer { + tdfxVertexPtr verts; + GLvector1ui clipped_elements; + GLuint size; + int last_vert; + void *vert_store; + + tdfxVertexPtr *elts; + GLuint elt_size; + GLuint last_elt; +}; + +typedef struct tdfx_vertex_buffer *tdfxVertexBufferPtr; + +#define TDFX_DRIVER_DATA(vb) ((tdfxVertexBufferPtr)((vb)->driver_data)) + + +#define TDFX_WIN_BIT 0x01 +#define TDFX_RGBA_BIT 0x02 +#define TDFX_FOG_BIT 0x04 +#define TDFX_SPEC_BIT 0x08 +#define TDFX_TEX0_BIT 0x10 +#define TDFX_TEX1_BIT 0x20 + + +extern void tdfxDDSetupInit( void ); + +extern void tdfxDDChooseRasterSetupFunc( GLcontext *ctx ); +extern void tdfxPrintSetupFlags( char *msg, GLuint flags ); + +extern void tdfxDDCheckPartialRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *s ); +extern void tdfxDDPartialRasterSetup( struct vertex_buffer *VB ); +extern void tdfxDDDoRasterSetup( struct vertex_buffer *VB ); + +extern void tdfxDDResizeVB( struct vertex_buffer *VB, GLuint size ); +extern void tdfxDDResizeElts( struct vertex_buffer *VB, GLuint size ); +extern void tdfxDDRegisterVB( struct vertex_buffer *VB ); +extern void tdfxDDUnregisterVB( struct vertex_buffer *VB ); + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_VB_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c new file mode 100644 index 000000000..e2abe0800 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c @@ -0,0 +1,382 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include <stdlib.h> +#include <string.h> + +#include "tdfx_context.h" + + +FxI32 +FX_grGetInteger_NoLock(FxU32 pname) +{ + switch (pname) { + case FX_FOG_TABLE_ENTRIES: + case FX_GLIDE_STATE_SIZE: + case FX_LFB_PIXEL_PIPE: + case FX_PENDING_BUFFERSWAPS: + case FX_TEXTURE_ALIGN: + case GR_STATS_PIXELS_DEPTHFUNC_FAIL: + case GR_STATS_PIXELS_IN: + case GR_STATS_PIXELS_OUT: + { + FxI32 result; + FxU32 grname = pname; + grGet(grname, 4, &result); + return result; + } + case FX_ZDEPTH_MAX: + { + FxI32 zvals[2]; + grGet(GR_ZDEPTH_MIN_MAX, 8, zvals); + return zvals[0]; + } + default: + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n"); + } + } + + return 0; +} + + +FxI32 +FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname) +{ + int result; + LOCK_HARDWARE(fxMesa); + result = FX_grGetInteger_NoLock(pname); + UNLOCK_HARDWARE(fxMesa); + return result; +} + + +const char * +FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname) +{ + const char *s; + LOCK_HARDWARE(fxMesa); + s = grGetString(pname); + UNLOCK_HARDWARE(fxMesa); + return s; +} + + + +/* Wrapper for grColorMask() and grColorMaskExt(). + */ +void +FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + LOCK_HARDWARE(fxMesa); + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(r, g, b, a); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(r || g || b, GL_FALSE); + } + UNLOCK_HARDWARE(fxMesa); +} + + +void +FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a) +{ + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(r, g, b, a); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(r || g || b, GL_FALSE); + } +} + + +/* As above, but pass the mask as an array + */ +void +FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + LOCK_HARDWARE(fxMesa); + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP], + rgba[BCOMP], rgba[ACOMP]); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); + } + UNLOCK_HARDWARE(fxMesa); +} + +void +FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]) +{ + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP], + rgba[BCOMP], rgba[ACOMP]); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); + } +} + + + +FxBool +FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer, + GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, + FxBool pixelPipeline, GrLfbInfo_t * info) +{ + FxBool result; + + LOCK_HARDWARE(fxMesa); + result = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +FxU32 +FX_grTexTextureMemRequired(tdfxContextPtr fxMesa, FxU32 evenOdd, GrTexInfo * info) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexTextureMemRequired(evenOdd, info); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +FxU32 +FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexMinAddress(tmu); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +extern FxU32 +FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexMaxAddress(tmu); + UNLOCK_HARDWARE(fxMesa); + return result; +} + + +int +FX_getFogTableSize(tdfxContextPtr fxMesa) +{ + int result; + LOCK_HARDWARE(fxMesa); + grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +int +FX_getGrStateSize(tdfxContextPtr fxMesa) +{ + int result; + LOCK_HARDWARE(fxMesa); + grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +void +FX_grAADrawLine(tdfxContextPtr fxMesa, GrVertex * a, GrVertex * b) +{ + /* ToDo */ + BEGIN_CLIP_LOOP(fxMesa); + grDrawLine(a, b); + END_CLIP_LOOP(fxMesa); +} + +void +FX_grAADrawPoint(tdfxContextPtr fxMesa, GrVertex * a) +{ + BEGIN_CLIP_LOOP(fxMesa); + grDrawPoint(a); + END_CLIP_LOOP(fxMesa); +} + +void +FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa, int n, GrVertex * verts) +{ + BEGIN_CLIP_LOOP(fxMesa); + grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); + END_CLIP_LOOP(fxMesa); +} + +#if TDFX_USE_PARGB +void +FX_setupGrVertexLayout(tdfxContextPtr fxMesa) +{ + LOCK_HARDWARE(fxMesa); + grReset(GR_VERTEX_PARAMETER); + + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + UNLOCK_HARDWARE(fxMesa); +} +#else /* TDFX_USE_PARGB */ +void +FX_setupGrVertexLayout(tdfxContextPtr fxMesa) +{ + LOCK_HARDWARE(fxMesa); + grReset(GR_VERTEX_PARAMETER); + + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + UNLOCK_HARDWARE(fxMesa); +} +#endif /* TDFX_USE_PARGB */ + +void +FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask) +{ + switch (hintType) { + case GR_HINT_STWHINT: + { + if (hintMask & GR_STWHINT_W_DIFF_TMU0) + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_ST_DIFF_TMU1) + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_W_DIFF_TMU1) + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + } + } +} + +void +FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask) +{ + LOCK_HARDWARE(fxMesa); + FX_grHints_NoLock(hintType, hintMask); + UNLOCK_HARDWARE(fxMesa); +} + +/* It appears to me that this function is needed either way. */ +FX_GrContext_t +FX_grSstWinOpen(tdfxContextPtr fxMesa, + FxU32 hWnd, + GrScreenResolution_t screen_resolution, + GrScreenRefresh_t refresh_rate, + GrColorFormat_t color_format, + GrOriginLocation_t origin_location, + int nColBuffers, int nAuxBuffers) +{ + FX_GrContext_t i; + LOCK_HARDWARE(fxMesa); + i = grSstWinOpen(hWnd, + screen_resolution, + refresh_rate, + color_format, origin_location, nColBuffers, nAuxBuffers); + + /* + fprintf(stderr, + "grSstWinOpen( win %d res %d ref %d fmt %d\n" + " org %d ncol %d naux %d )\n" + " ==> %d\n", + hWnd, + screen_resolution, + refresh_rate, + color_format, + origin_location, + nColBuffers, + nAuxBuffers, + i); + */ + UNLOCK_HARDWARE(fxMesa); + return i; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h new file mode 100644 index 000000000..20e5530c5 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h @@ -0,0 +1,675 @@ +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * 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 + * BRIAN PAUL 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. + * + * + * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the + * terms stated above. + * + * Thank you for your contribution, David! + * + * Please make note of the above copyright/license statement. If you + * contributed code or bug fixes to this code under the previous (GNU + * Library) license and object to the new license, your code will be + * removed at your request. Please see the Mesa docs/COPYRIGHT file + * for more information. + * + * Additional Mesa/3Dfx driver developers: + * Daryll Strauss <daryll@precisioninsight.com> + * Keith Whitwell <keith@precisioninsight.com> + * + * See fxapi.h for more revision/author details. + */ + + +#ifndef __FX_GLIDE_WARPER__ +#define __FX_GLIDE_WARPER__ + +#include <glide.h> +#include <g3ext.h> + +typedef struct tdfx_context tdfxContextRec; +typedef struct tdfx_context *tdfxContextPtr; + +/* + * General context: + */ +typedef GrContext_t FX_GrContext_t; + +#define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES +#define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE +#define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE +#define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS +#define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN + +#define FX_ZDEPTH_MAX 0x100 + + +#define GR_ASPECT_1x1 GR_ASPECT_LOG2_1x1 +#define GR_ASPECT_2x1 GR_ASPECT_LOG2_2x1 +#define GR_ASPECT_4x1 GR_ASPECT_LOG2_4x1 +#define GR_ASPECT_8x1 GR_ASPECT_LOG2_8x1 +#define GR_ASPECT_1x2 GR_ASPECT_LOG2_1x2 +#define GR_ASPECT_1x4 GR_ASPECT_LOG2_1x4 +#define GR_ASPECT_1x8 GR_ASPECT_LOG2_1x8 + +#define GR_LOD_256 GR_LOD_LOG2_256 +#define GR_LOD_128 GR_LOD_LOG2_128 +#define GR_LOD_64 GR_LOD_LOG2_64 +#define GR_LOD_32 GR_LOD_LOG2_32 +#define GR_LOD_16 GR_LOD_LOG2_16 +#define GR_LOD_8 GR_LOD_LOG2_8 +#define GR_LOD_4 GR_LOD_LOG2_4 +#define GR_LOD_2 GR_LOD_LOG2_2 +#define GR_LOD_1 GR_LOD_LOG2_1 + +#define GR_FOG_WITH_TABLE GR_FOG_WITH_TABLE_ON_Q + + +typedef FxU32 GrHint_t; +#define GR_HINTTYPE_MIN 0 +#define GR_HINT_STWHINT 0 + +typedef FxU32 GrSTWHint_t; +#define GR_STWHINT_W_DIFF_FBI FXBIT(0) +#define GR_STWHINT_W_DIFF_TMU0 FXBIT(1) +#define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2) +#define GR_STWHINT_W_DIFF_TMU1 FXBIT(3) +#define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4) +#define GR_STWHINT_W_DIFF_TMU2 FXBIT(5) +#define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6) + +#define GR_CONTROL_ACTIVATE 1 +#define GR_CONTROL_DEACTIVATE 0 + +#define GrState void + +/* +** move the vertex layout defintion to application +*/ +typedef struct +{ + GLfloat sow; /* s texture ordinate (s over w) */ + GLfloat tow; /* t texture ordinate (t over w) */ + GLfloat oow; /* 1/w (used mipmapping - really 0xfff/w) */ +} +GrTmuVertex; + + +#if FX_USE_PARGB + +/* standard vertex, packed argb, double texture, 12 dwords */ +typedef struct +{ + GLfloat x, y; /* X and Y in screen space */ + GLfloat ooz; /* 65535/Z (used for Z-buffering) */ + GLfloat oow; /* 1/W (used for W-buffering, texturing) */ + FxU32 argb; /* R, G, B, A [0..255.0] */ + GrTmuVertex tmuvtx[GLIDE_NUM_TMU]; + GLfloat z; /* Z is ignored */ +} +GrVertex; + +/* optimised vertex, packed argb, single texture, 8 dwords = 1 cacheline */ +typedef struct +{ + GLfloat x, y; /* X and Y in screen space */ + GLfloat ooz; /* 65535/Z (used for Z-buffering) */ + GLfloat oow; /* 1/W (used for W-buffering, texturing) */ + FxU32 argb; /* R, G, B, A [0..255.0] */ + GrTmuVertex tmuvtx; /* only 1 TMU used to keep vertex size down */ +} +GrVertex_Fast; + +/* following offsets work for both vertex layouts */ +#define GR_VERTEX_X_OFFSET 0 +#define GR_VERTEX_Y_OFFSET 1 +#define GR_VERTEX_OOZ_OFFSET 2 +#define GR_VERTEX_OOW_OFFSET 3 +#define GR_VERTEX_PARGB_OFFSET 4 +#define GR_VERTEX_SOW_TMU0_OFFSET 5 +#define GR_VERTEX_TOW_TMU0_OFFSET 6 +#define GR_VERTEX_OOW_TMU0_OFFSET 7 +#define GR_VERTEX_SOW_TMU1_OFFSET 8 +#define GR_VERTEX_TOW_TMU1_OFFSET 9 +#define GR_VERTEX_OOW_TMU1_OFFSET 10 +#define GR_VERTEX_Z_OFFSET 11 + +#if GLIDE_ENDIAN == GLIDE_ENDIAN_BIG +#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3] +#define GET_PR(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+2] +#define GET_PG(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+1] +#define GET_PB(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+0] +#else +#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+0] +#define GET_PR(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+1] +#define GET_PG(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+2] +#define GET_PB(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3] +#endif + +#define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET] +#define PACK_4F_ARGB(dest, a, r, g, b) { \ + const GLuint cr = (int)r; \ + const GLuint cg = (int)g; \ + const GLuint ca = (int)a; \ + const GLuint cb = (int)b; \ + dest = ca << 24 | cr << 16 | cg << 8 | cb; \ +} + +#else /* FX_USE_PARGB */ + +typedef struct +{ + float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */ + float r, g, b; /* R, G, B, ([0..255.0]) */ + float ooz; /* 65535/Z (used for Z-buffering) */ + float a; /* Alpha [0..255.0] */ + float oow; /* 1/W (used for W-buffering, texturing) */ + GrTmuVertex tmuvtx[GLIDE_NUM_TMU]; +} +GrVertex; + +#define GR_VERTEX_X_OFFSET 0 +#define GR_VERTEX_Y_OFFSET 1 +#define GR_VERTEX_Z_OFFSET 2 +#define GR_VERTEX_R_OFFSET 3 +#define GR_VERTEX_G_OFFSET 4 +#define GR_VERTEX_B_OFFSET 5 +#define GR_VERTEX_OOZ_OFFSET 6 +#define GR_VERTEX_A_OFFSET 7 +#define GR_VERTEX_OOW_OFFSET 8 +#define GR_VERTEX_SOW_TMU0_OFFSET 9 +#define GR_VERTEX_TOW_TMU0_OFFSET 10 +#define GR_VERTEX_OOW_TMU0_OFFSET 11 +#define GR_VERTEX_SOW_TMU1_OFFSET 12 +#define GR_VERTEX_TOW_TMU1_OFFSET 13 +#define GR_VERTEX_OOW_TMU1_OFFSET 14 +#endif /* FX_USE_PARGB */ + + + +extern FxI32 FX_grGetInteger_NoLock(FxU32 pname); + +extern FxI32 FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname); + +extern const char *FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname); + + +#define FX_grTexDownloadTable(fxMesa, type, data) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexDownloadTable(type,data); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0); + +#define FX_grTexDownloadTable_NoLock(type, data) \ + grTexDownloadTable(type, data) + + +#define FX_grFlush(fxMesa) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFlush(); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFinish(fxMesa) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFinish(); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + + +#define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \ + UNLOCK_HARDWARE(fxMesa); \ + } while(0) + + +#define FX_grLfbReadRegion(fxMesa,src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0); + + +#define FX_grDrawTriangle_NoLock(a,b,c) grDrawTriangle(a,b,c) +#define FX_grDrawTriangle(fxMesa, a,b,c) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + FX_grDrawTriangle_NoLock(a,b,c); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + + + +extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask); +extern void FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask); + + +extern void FX_grAADrawLine(tdfxContextPtr fxMesa, GrVertex * a, GrVertex * b); + +extern void FX_grAADrawPoint(tdfxContextPtr fxMesa, GrVertex * a); + + +extern void FX_setupGrVertexLayout(tdfxContextPtr fxMesa); + + +extern FX_GrContext_t FX_grSstWinOpen(tdfxContextPtr fxMesa, + FxU32 hWnd, + GrScreenResolution_t screen_resolution, + GrScreenRefresh_t refresh_rate, + GrColorFormat_t color_format, + GrOriginLocation_t origin_location, + int nColBuffers, int nAuxBuffers); + + +#define FX_grDrawLine_NoLock(v1, v2) grDrawLine(v1, v2) +#define FX_grDrawLine(fxMesa, v1, v2) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + FX_grDrawLine_NoLock(v1, v2); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grDrawPoint_NoLock(p) grDrawPoint(p) +#define FX_grDrawPoint(fxMesa, p) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + FX_grDrawPoint_NoLock(p); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +extern void FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa, + int n, GrVertex * v); + +#define FX_grDitherMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDitherMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grRenderBuffer(fxMesa, b) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grRenderBuffer(b); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grRenderBuffer_NoLock(b) grRenderBuffer(b) + +#define FX_grBufferClear(fxMesa, c, a, d) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grBufferClear(c, a, d); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grBufferClear_NoLock(c, a, d) grBufferClear(c, a, d) + + +#define FX_grBufferClearExt_NoLock(c, a, d, s) grBufferClearExtProc(c, a, d, s) + +#define FX_grBufferClearExt(fxMesa, c, a, d, s) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grBufferClearExtProc(c, a, d, s); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grEnable(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grEnable(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grEnable_NoLock(m) grEnable(m) + +#define FX_grDisable(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDisable(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDisable_NoLock(m) grDisable(m) + + +#define FX_grStencilFunc(fxMesa, fnc, ref, mask) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grStencilFuncProc((fnc), (ref), (mask)); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grStencilFunc_NoLock(f, r, m) grStencilFuncProc(f, r, m) + +#define FX_grStencilMask(fxMesa, write_mask) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grStencilMaskProc(write_mask); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grStencilMask_NoLock(m) grStencilMaskProc(m) + +#define FX_grStencilOp(fxMesa, stencil_fail, depth_fail, depth_pass) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grStencilOpProc((stencil_fail), (depth_fail), (depth_pass)); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grStencilOp_NoLock(sf, df, dp) grStencilOpProc(sf, df, dp) + +#define FX_grDepthMask(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthMask(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDepthMask_NoLock(m) grDepthMask(m) + + +extern void FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a); + +extern void FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a); + +extern void FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]); + +extern void FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]); + + +extern FxBool FX_grLfbLock(tdfxContextPtr fxMesa, + GrLock_t type, GrBuffer_t buffer, + GrLfbWriteMode_t writeMode, + GrOriginLocation_t origin, FxBool pixelPipeline, + GrLfbInfo_t * info); + +#define FX_grLfbUnlock(fxMesa, t, b) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbUnlock(t, b); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grConstantColorValue(fxMesa, v) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grConstantColorValue(v); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grConstantColorValue_NoLock grConstantColorValue + +#define FX_grAADrawTriangle(fxMesa, a, b, c, ab, bc, ca) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grAADrawTriangle(a, b, c, ab, bc, ca); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grAlphaBlendFunction(rs, rd, as, ad) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaBlendFunction(rs, rd, as, ad); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grAlphaCombine(func, fact, loc, oth, inv) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaCombine(func, fact, loc, oth, inv); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grAlphaCombine_NoLock grAlphaCombine + +#define FX_grAlphaTestFunction(fxMesa, f) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaTestFunction(f); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grAlphaTestReferenceValue(fxMesa, v) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaTestReferenceValue(v); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grClipWindow(fxMesa, minx, miny, maxx, maxy) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grClipWindow(minx, miny, maxx, maxy); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grClipWindow_NoLock grClipWindow + +#define FX_grColorCombine(fxMesa, func, fact, loc, oth, inv) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grColorCombine(func, fact, loc, oth, inv); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grColorCombine_NoLock grColorCombine + +#define FX_grCullMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grCullMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDepthBiasLevel(fxMesa, lev) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthBiasLevel(lev); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDepthBufferFunction(fxMesa, func) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthBufferFunction(func); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFogColorValue(fxMesa, c) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFogColorValue(c); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFogMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFogMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFogTable(fxMesa, t)\ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFogTable(t); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexClampMode(fxMesa, t, sc, tc) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexClampMode(t, sc, tc); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexClampMode_NoLock grTexClampMode + +#define FX_grTexCombine(fxMesa, t, rfunc, rfact, afunc, afact, rinv, ainv) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexCombine_NoLock grTexCombine + +#define FX_grTexDownloadMipMapLevel(fxMesa, t, sa, tlod, llod, ar, f, eo, d) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexDownloadMipMapLevel_NoLock grTexDownloadMipMapLevel + +#define FX_grTexDownloadMipMapLevelPartial(fxMesa, t, sa, tlod, llod, ar, f, eo, d, s, e); \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexFilterMode(fxMesa, t, minf, magf) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexFilterMode(t, minf, magf); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexFilterMode_NoLock grTexFilterMode + +extern FxU32 FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu); +extern FxU32 FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu); + +#define FX_grTexMipMapMode(t, m, lod) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexMipMapMode(t, m, lod); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexMipMapMode_NoLock grTexMipMapMode + +#define FX_grTexSource(t, sa, eo, i) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexSource(t, sa, eo, i); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexSource_NoLock grTexSource + +extern FxU32 FX_grTexTextureMemRequired(tdfxContextPtr fxMesa, + FxU32 evenOdd, GrTexInfo * info); + +#define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired + +#define FX_grGlideGetState(fxMesa, s) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grGlideGetState(s); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) +#define FX_grGlideGetState_NoLock(s) grGlideGetState(s); + +#define FX_grDRIBufferSwap(fxMesa, i) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDRIBufferSwap(i); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grSstSelect(fxMesa, b) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grSstSelect(b); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grSstSelect_NoLock grSstSelect + +#define FX_grGlideSetState(fxMesa, s) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grGlideSetState(s); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) +#define FX_grGlideSetState_NoLock(s) grGlideSetState(s); + +#define FX_grDepthBufferMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthBufferMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grLfbWriteColorFormat(fxMesa, f) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbWriteColorFormat(f); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDrawVertexArray(fxMesa, m, c, p) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grDrawVertexArray(m, c, p); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grGlideShutdown(fxMesa) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grGlideShutdown(); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexLodBiasValue_NoLock(t, v) grTexLodBiasValue(t, v) + +#define FX_grTexLodBiasValue(t, v) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexLodBiasValue(t, v); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grGlideInit_NoLock grGlideInit +#define FX_grSstWinOpen_NoLock grSstWinOpen + +extern int FX_getFogTableSize(tdfxContextPtr fxMesa); + +extern int FX_getGrStateSize(tdfxContextPtr fxMesa); + +#endif /* __FX_GLIDE_WARPER__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c index 206953dec..06930691d 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -1,139 +1,153 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -All Rights Reserved. - -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, sub license, 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 (including the -next paragraph) 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c,v 1.10 2000/12/08 19:36:24 alanh Exp $ */ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * VA LINUX SYSTEMS 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. + */ +/* $XFree86$ */ /* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * * Authors: - * Daryll Strauss <daryll@valinux.com> - * Brian E. Paul <brianp@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * */ #ifdef GLX_DIRECT_RENDERING #include <X11/Xlibint.h> -#include <glide.h> -#include "fxdrv.h" + #include "context.h" #include "matrix.h" #include "mmath.h" #include "vbxform.h" -#include "fxtexman.h" +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_render.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" -/* including xf86PciInfo.h causes a bunch of errors */ -#ifndef PCI_CHIP_VOODOO5 -#define PCI_CHIP_VOODOO5 0x0009 + +#ifndef TDFX_DEBUG +int TDFX_DEBUG = (0 +/* | DEBUG_ALWAYS_SYNC */ +/* | DEBUG_VERBOSE_API */ +/* | DEBUG_VERBOSE_MSG */ +/* | DEBUG_VERBOSE_LRU */ +/* | DEBUG_VERBOSE_DRI */ +/* | DEBUG_VERBOSE_IOCTL */ +/* | DEBUG_VERBOSE_2D */ + ); #endif GLboolean -XMesaInitDriver(__DRIscreenPrivate * sPriv) +XMesaInitDriver( __DRIscreenPrivate *sPriv ) { - tdfxScreenPrivate *gsp; - - /* Check the DRI version */ - { - int major, minor, patch; - if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 0 || patch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DRI version 3.0.x but got version %d.%d.%d", - major, minor, patch); - __driMesaMessage(msg); - return GL_FALSE; - } - } - } - - /* Check that the DDX driver version is compatible */ - if (sPriv->ddxMajor != 1 || sPriv->ddxMinor != 0 || sPriv->ddxPatch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", - sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); - __driMesaMessage(msg); - return GL_FALSE; - } - - /* Check that the DRM driver version is compatible */ - if (sPriv->drmMajor != 1 || sPriv->drmMinor != 0 || sPriv->drmPatch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", - sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); - __driMesaMessage(msg); - return GL_FALSE; - } - - /* Allocate the private area */ - gsp = (tdfxScreenPrivate *) Xmalloc(sizeof(tdfxScreenPrivate)); - if (!gsp) - return GL_FALSE; - - gsp->driScrnPriv = sPriv; - - sPriv->private = (void *) gsp; - - if (!tdfxMapAllRegions(sPriv)) { - Xfree(gsp); - sPriv->private = NULL; - return GL_FALSE; - } - - return GL_TRUE; + int major, minor, patch; + char msg[1024]; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv ); + } + + /* Check the DRI version */ + if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { + if ( major != 3 || + minor != 0 || + patch < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DRI version 3.0.x " + "but got version %d.%d.%d", + major, minor, patch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + } + + /* Check that the DDX driver version is compatible */ + if ( sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DDX driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if ( sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DRM driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + + if ( !tdfxCreateScreen( sPriv ) ) { + tdfxDestroyScreen( sPriv ); + return GL_FALSE; + } + + return GL_TRUE; } void -XMesaResetDriver(__DRIscreenPrivate * sPriv) +XMesaResetDriver( __DRIscreenPrivate *sPriv ) { - tdfxUnmapAllRegions(sPriv); - Xfree(sPriv->private); - sPriv->private = NULL; + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv ); + } + + tdfxDestroyScreen( sPriv ); } GLvisual * -XMesaCreateVisual(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - const XVisualInfo * visinfo, - const __GLXvisualConfig * config) +XMesaCreateVisual( Display * dpy, + __DRIscreenPrivate *driScrnPriv, + const XVisualInfo *visinfo, + const __GLXvisualConfig *config ) { - /* Drivers may change the args to _mesa_create_visual() in order to - * setup special visuals. - */ - return _mesa_create_visual(config->rgba, + /* Drivers may change the args to _mesa_create_visual() in order to + * setup special visuals. + */ + return _mesa_create_visual( config->rgba, config->doubleBuffer, config->stereo, - _mesa_bitcount(visinfo->red_mask), - _mesa_bitcount(visinfo->green_mask), - _mesa_bitcount(visinfo->blue_mask), + _mesa_bitcount( visinfo->red_mask ), + _mesa_bitcount( visinfo->green_mask ), + _mesa_bitcount( visinfo->blue_mask ), config->alphaSize, 0, /* index bits */ config->depthSize, @@ -142,216 +156,247 @@ XMesaCreateVisual(Display * dpy, config->accumGreenSize, config->accumBlueSize, config->accumAlphaSize, - 0 /* num samples */ - ); + 0 /* num samples */ ); } GLboolean -XMesaCreateContext(Display * dpy, GLvisual * mesaVis, - __DRIcontextPrivate * driContextPriv) +XMesaCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ) { - fxMesaContext fxMesa; - __DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv; - tdfxScreenPrivate *sPriv = (tdfxScreenPrivate *) driScrnPriv->private; - TDFXSAREAPriv *saPriv; - - fxMesa = (fxMesaContext) Xmalloc(sizeof(struct tfxMesaContext)); - if (!fxMesa) { - return GL_FALSE; - } - - fxMesa->hHWContext = driContextPriv->hHWContext; - fxMesa->tdfxScrnPriv = sPriv; - /* deviceID = 0x05 = Voodoo3 */ - /* deviceID = 0x09 = Voodoo5 (and Voodoo4?) */ - fxMesa->isNapalm = sPriv->deviceID == PCI_CHIP_VOODOO5; - fxMesa->haveHwStencil = fxMesa->isNapalm && sPriv->cpp == 4; - - - fxMesa->glVis = mesaVis; - fxMesa->screen_width = sPriv->width; - fxMesa->screen_height = sPriv->height; - fxMesa->new_state = ~0; - fxMesa->driContextPriv = driContextPriv; - fxMesa->glCtx = driContextPriv->mesaContext; - fxMesa->initDone = GL_FALSE; - - saPriv = - (TDFXSAREAPriv *) ((char *) driScrnPriv->pSAREA + - sizeof(XF86DRISAREARec)); - grDRIOpen(driScrnPriv->pFB, sPriv->regs.map, sPriv->deviceID, - sPriv->width, sPriv->height, sPriv->mem, sPriv->cpp, - sPriv->stride, sPriv->fifoOffset, sPriv->fifoSize, - sPriv->fbOffset, sPriv->backOffset, sPriv->depthOffset, - sPriv->textureOffset, sPriv->textureSize, &saPriv->fifoPtr, - &saPriv->fifoRead); - - driContextPriv->driverPrivate = (void *) fxMesa; + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } - return GL_TRUE; + return tdfxCreateContext( dpy, mesaVis, driContextPriv ); } void -XMesaDestroyContext(__DRIcontextPrivate * driContextPriv) +XMesaDestroyContext( __DRIcontextPrivate *driContextPriv ) { - fxMesaContext fxMesa = (fxMesaContext) driContextPriv->driverPrivate; - if (fxMesa) { - if (fxMesa->glCtx->Shared->RefCount == 1) { - /* This share group is about to go away, free our private - * texture object data. - */ - struct gl_texture_object *tObj; - tObj = fxMesa->glCtx->Shared->TexObjectList; - while (tObj) { - fxTMFreeTexture(fxMesa, tObj); - tObj = tObj->Next; - } - } - XFree(fxMesa); - driContextPriv->driverPrivate = NULL; - } + tdfxContextPtr fxMesa; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate; + tdfxDestroyContext( fxMesa ); + driContextPriv->driverPrivate = NULL; } GLframebuffer * -XMesaCreateWindowBuffer(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - __DRIdrawablePrivate * driDrawPriv, - GLvisual * mesaVis) +XMesaCreateWindowBuffer( Display *dpy, + __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + GLvisual *mesaVis ) { - return gl_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, - mesaVis->AccumRedBits > 0, - GL_FALSE /* software alpha channel? */ - ); + return gl_create_framebuffer( mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->StencilBits > 0, + mesaVis->AccumRedBits > 0, + GL_FALSE /* software alpha channel? */ ); } GLframebuffer * -XMesaCreatePixmapBuffer(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - __DRIdrawablePrivate * driDrawPriv, - GLvisual * mesaVis) +XMesaCreatePixmapBuffer( Display *dpy, + __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + GLvisual *mesaVis ) { #if 0 - /* Different drivers may have different combinations of hardware and - * software ancillary buffers. - */ - return gl_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, - mesaVis->AccumRedBits > 0, - mesaVis->AlphaBits > 0); + /* Different drivers may have different combinations of hardware and + * software ancillary buffers. + */ + return gl_create_framebuffer( mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->StencilBits > 0, + mesaVis->AccumRedBits > 0, + mesaVis->AlphaBits > 0 ); #else - return NULL; /* not implemented yet */ + return NULL; /* not implemented yet */ #endif } - void -XMesaSwapBuffers(__DRIdrawablePrivate * driDrawPriv) +XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv ) { - GET_CURRENT_CONTEXT(ctx); - fxMesaContext fxMesa = 0; - - if (!driDrawPriv->mesaBuffer->Visual->DBflag) - return; /* can't swap a single-buffered window */ - - /* If the current context's drawable matches the given drawable - * we have to do a glFinish (per the GLX spec). - */ - if (ctx) { - __DRIdrawablePrivate *curDrawPriv; - fxMesa = FX_CONTEXT(ctx); - curDrawPriv = fxMesa->driContextPriv->driDrawablePriv; - if (curDrawPriv == driDrawPriv) { - /* swapping window bound to current context, flush first */ - FLUSH_VB(ctx, "swap buffers"); - BEGIN_BOARD_LOCK(fxMesa); - } - else { - /* make fxMesa context current */ - grGlideGetState((GrState *) fxMesa->state); - fxMesa = (fxMesaContext) driDrawPriv->driContextPriv->driverPrivate; - BEGIN_BOARD_LOCK(fxMesa); - grSstSelect(fxMesa->board); - grGlideSetState((GrState *) fxMesa->state); - } - } - + GET_CURRENT_CONTEXT(ctx); + tdfxContextPtr fxMesa = 0; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driDrawPriv ); + } + + if ( !driDrawPriv->mesaBuffer->Visual->DBflag ) + return; /* can't swap a single-buffered window */ + + /* If the current context's drawable matches the given drawable + * we have to do a glFinish (per the GLX spec). + */ + if ( ctx ) { + __DRIdrawablePrivate *curDrawPriv; + fxMesa = TDFX_CONTEXT(ctx); + curDrawPriv = fxMesa->driContext->driDrawablePriv; + + if ( curDrawPriv == driDrawPriv ) { + /* swapping window bound to current context, flush first */ + FLUSH_VB( ctx, "swap buffers" ); + LOCK_HARDWARE( fxMesa ); + } + else { + /* find the fxMesa context previously bound to the window */ + fxMesa = (tdfxContextPtr) driDrawPriv->driContextPriv->driverPrivate; + if (!fxMesa) + return; + LOCK_HARDWARE( fxMesa ); + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( (GrState *) fxMesa->Glide.State ); + } + } #ifdef STATS - { - int stalls; - static int prevStalls = 0; - stalls = grFifoGetStalls(); - if (stalls != prevStalls) { - fprintf(stderr, "%d stalls occurred\n", stalls - prevStalls); - prevStalls = stalls; - } - if (fxMesa && fxMesa->texSwaps) { - fprintf(stderr, "%d texture swaps occurred\n", fxMesa->texSwaps); - fxMesa->texSwaps = 0; - } - } + { + int stalls; + static int prevStalls = 0; + + stalls = grFifoGetStalls(); + + fprintf( stderr, "%s:\n", __FUNCTION__ ); + if ( stalls != prevStalls ) { + fprintf( stderr, " %d stalls occurred\n", + stalls - prevStalls ); + prevStalls = stalls; + } + if ( fxMesa && fxMesa->texSwaps ) { + fprintf( stderr, " %d texture swaps occurred\n", + fxMesa->texSwaps ); + fxMesa->texSwaps = 0; + } + } #endif + if (fxMesa->scissoredClipRects) { + /* restore clip rects without scissor box */ + grDRIPosition( driDrawPriv->x, driDrawPriv->y, + driDrawPriv->w, driDrawPriv->h, + driDrawPriv->numClipRects, driDrawPriv->pClipRects ); + } - /* XXX prototype grDRISwapClipRects() function may not be - * needed after all - */ -#if 0 - FX_grDRIBufferSwap(fxMesa, fxMesa->swapInterval); -#elif 1 - grDRIBufferSwap(fxMesa->swapInterval); -#else - grDRISwapClipRects(fxMesa->swapInterval, - driDrawPriv->numClipRects, - driDrawPriv->pClipRects); -#endif + grDRIBufferSwap( fxMesa->Glide.SwapInterval ); + + if (fxMesa->scissoredClipRects) { + /* restore clip rects WITH scissor box */ + grDRIPosition( driDrawPriv->x, driDrawPriv->y, + driDrawPriv->w, driDrawPriv->h, + fxMesa->numClipRects, fxMesa->pClipRects ); + } #if 0 - { - FxI32 result; - do { - result = FX_grGetInteger(FX_PENDING_BUFFERSWAPS); - } while (result > fxMesa->maxPendingSwapBuffers); - } + { + FxI32 result; + do { + result = FX_grGetInteger( FX_PENDING_BUFFERSWAPS ); + } while ( result > fxMesa->maxPendingSwapBuffers ); + } #endif - fxMesa->stats.swapBuffer++; - - - if (ctx) { - if (ctx->DriverCtx != fxMesa) { - /* restore original context */ - fxMesa = FX_CONTEXT(ctx); - grSstSelect(fxMesa->board); - grGlideSetState((GrState *) fxMesa->state); - } - END_BOARD_LOCK(fxMesa); - } + + fxMesa->stats.swapBuffer++; + + if (ctx) { + if (ctx->DriverCtx != fxMesa) { + fxMesa = TDFX_CONTEXT(ctx); + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( (GrState *) fxMesa->Glide.State ); + } + UNLOCK_HARDWARE( fxMesa ); + } } GLboolean -XMesaUnbindContext(__DRIcontextPrivate * driContextPriv) +XMesaUnbindContext( __DRIcontextPrivate *driContextPriv ) { - GET_CURRENT_CONTEXT(ctx); - if (driContextPriv && driContextPriv->mesaContext == ctx) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - FX_grGlideGetState(fxMesa, (GrState *) fxMesa->state); - } - return GL_TRUE; + GET_CURRENT_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + if ( driContextPriv && driContextPriv->mesaContext == ctx ) { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FX_grGlideGetState( fxMesa, (GrState *) fxMesa->Glide.State ); + } + return GL_TRUE; } + +GLboolean +XMesaMakeCurrent( __DRIcontextPrivate *driContextPriv, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv ) +{ + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + if ( driContextPriv ) { + tdfxContextPtr fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate; + GLcontext *ctx = fxMesa->glCtx; + + if ( fxMesa->driDrawable != driDrawPriv ) { + fxMesa->driDrawable = driDrawPriv; + fxMesa->dirty = ~0; + } + + if ( !fxMesa->Glide.Initialized ) { + if ( !tdfxInitContext( driDrawPriv, fxMesa ) ) + return GL_FALSE; + + LOCK_HARDWARE( fxMesa ); + + /* FIXME: Force loading of window information */ + fxMesa->width = 0; + tdfxUpdateClipping(ctx); + tdfxUploadClipping(fxMesa); + + UNLOCK_HARDWARE( fxMesa ); + } else { + LOCK_HARDWARE( fxMesa ); + + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( fxMesa->Glide.State ); + + tdfxUpdateClipping(ctx); + tdfxUploadClipping(fxMesa); + + UNLOCK_HARDWARE( fxMesa ); + } + + assert( ctx == driContextPriv->mesaContext ); + + gl_make_current2( ctx, driDrawPriv->mesaBuffer, + driReadPriv->mesaBuffer ); + + if ( !ctx->Viewport.Width ) { + gl_Viewport( ctx, 0, 0, driDrawPriv->w, driDrawPriv->h ); + } + } else { + gl_make_current( 0, 0 ); + } + + return GL_TRUE; +} + + GLboolean XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) { - fprintf(stderr,"XMesaOpenFullScreen\n"); + fprintf(stderr,"***** XMesaOpenFullScreen *****\n"); #if 0 /* When new glide3 calls exist */ return((GLboolean)grDRISetupFullScreen(GL_TRUE)); #else @@ -359,6 +404,7 @@ XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) #endif } + GLboolean XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) { @@ -371,182 +417,24 @@ XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) } -/* - * This function sends the window position and cliprect list to - * Glide for the given context. - */ -static void -XMesaWindowMoved(fxMesaContext fxMesa) -{ - __DRIdrawablePrivate *dPriv = fxMesa->driContextPriv->driDrawablePriv; - GLcontext *ctx = fxMesa->glCtx; - - grDRIPosition(dPriv->x, dPriv->y, dPriv->w, dPriv->h, - dPriv->numClipRects, dPriv->pClipRects); - fxMesa->numClipRects = dPriv->numClipRects; - fxMesa->pClipRects = dPriv->pClipRects; - if (dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset || - dPriv->w != fxMesa->width || dPriv->h != fxMesa->height) { - fxMesa->x_offset = dPriv->x; - fxMesa->y_offset = dPriv->y; - fxMesa->width = dPriv->w; - fxMesa->height = dPriv->h; - fxMesa->y_delta = - fxMesa->screen_height - fxMesa->y_offset - fxMesa->height; - } - switch (dPriv->numClipRects) { - case 0: - fxMesa->clipMinX = dPriv->x; - fxMesa->clipMaxX = dPriv->x + dPriv->w; - fxMesa->clipMinY = dPriv->y; - fxMesa->clipMaxY = dPriv->y + dPriv->h; - fxSetScissorValues(ctx); - fxMesa->needClip = 0; - break; - case 1: - fxMesa->clipMinX = dPriv->pClipRects[0].x1; - fxMesa->clipMaxX = dPriv->pClipRects[0].x2; - fxMesa->clipMinY = dPriv->pClipRects[0].y1; - fxMesa->clipMaxY = dPriv->pClipRects[0].y2; - fxSetScissorValues(ctx); - fxMesa->needClip = 0; - break; - default: - fxMesa->needClip = 1; - } -} - - -GLboolean -XMesaMakeCurrent(__DRIcontextPrivate * driContextPriv, - __DRIdrawablePrivate * driDrawPriv, - __DRIdrawablePrivate * driReadPriv) -{ - if (driContextPriv) { - fxMesaContext fxMesa; - - fxMesa = (fxMesaContext) driContextPriv->driverPrivate; - - if (!fxMesa->initDone) { - if (!tdfxInitHW(driDrawPriv, fxMesa)) - return GL_FALSE; - fxMesa->width = 0; - XMesaWindowMoved(fxMesa); - FX_grGlideGetState(fxMesa, (GrState *) fxMesa->state); - } - else { - FX_grSstSelect(fxMesa, fxMesa->board); - FX_grGlideSetState(fxMesa, (GrState *) fxMesa->state); - XMesaWindowMoved(fxMesa); - } - - assert(fxMesa->glCtx == driContextPriv->mesaContext); - - gl_make_current2(fxMesa->glCtx, driDrawPriv->mesaBuffer, - driReadPriv->mesaBuffer); - - if (!fxMesa->glCtx->Viewport.Width) - gl_Viewport(fxMesa->glCtx, 0, 0, driDrawPriv->w, driDrawPriv->h); - } - else { - gl_make_current(0, 0); - } - return GL_TRUE; -} - - -/* This is called from within the LOCK_HARDWARE routine */ -void -XMesaUpdateState(fxMesaContext fxMesa) -{ - __DRIcontextPrivate *cPriv = fxMesa->driContextPriv; - __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; - __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; - TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + - sizeof(XF86DRISAREARec)); - int stamp; - char ret; - - DEBUG_CHECK_LOCK(); - DRM_CAS(&sPriv->pSAREA->lock, dPriv->driContextPriv->hHWContext, - DRM_LOCK_HELD | dPriv->driContextPriv->hHWContext, ret); - if (!ret) { - DEBUG_LOCK(); - return; - } - drmGetLock(sPriv->fd, dPriv->driContextPriv->hHWContext, 0); - stamp = dPriv->lastStamp; - /* This macro will update dPriv's cliprects if needed */ - XMESA_VALIDATE_DRAWABLE_INFO(cPriv->display, sPriv, dPriv); - /* fprintf(stderr, "In FifoPtr=%d FifoRead=%d\n", saPriv->fifoPtr, saPriv->fifoRead); */ - if (saPriv->fifoOwner != dPriv->driContextPriv->hHWContext) { - grDRIImportFifo(saPriv->fifoPtr, saPriv->fifoRead); - } - if (saPriv->ctxOwner != dPriv->driContextPriv->hHWContext) { - /* This sequence looks a little odd. Glide mirrors the state, and - when you get the state you are forcing the mirror to be up to - date, and then getting a copy from the mirror. You can then force - that state onto the hardware when you set the state. */ - void *state; - state = malloc(FX_grGetInteger_NoLock(FX_GLIDE_STATE_SIZE)); - FX_grGlideGetState_NoLock(state); - FX_grGlideSetState_NoLock(state); - free(state); - } - if (saPriv->texOwner != dPriv->driContextPriv->hHWContext) { - fxTMRestoreTextures_NoLock(fxMesa); - } -#if 0 - if (*dPriv->pStamp != stamp) -#else - if (*dPriv->pStamp != stamp || - saPriv->ctxOwner != dPriv->driContextPriv->hHWContext) -#endif - XMesaWindowMoved(fxMesa); - DEBUG_LOCK(); -} - - -/* - * XXX is this used by anyone? +/* Silence compiler warnings. */ -#if 000 -static void -XMesaSetSAREA(void) -{ - __DRIdrawablePrivate *dPriv = gCC->driDrawablePriv; - __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; - TDFXSAREAPriv *saPriv = - (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + - sizeof(XF86DRISAREARec)); - - saPriv->fifoOwner = dPriv->driContextPriv->hHWContext; - saPriv->ctxOwner = dPriv->driContextPriv->hHWContext; - saPriv->texOwner = dPriv->driContextPriv->hHWContext; - grDRIResetSAREA(); - /* fprintf(stderr, "Out FifoPtr=%d FifoRead=%d\n", saPriv->fifoPtr, saPriv->fifoRead); */ -} -#endif - - - -extern void __driRegisterExtensions(void); /* silence compiler warning */ +extern void __driRegisterExtensions( void ); /* This function is called by libGL.so as soon as libGL.so is loaded. * This is where we'd register new extension functions with the dispatcher. */ -void -__driRegisterExtensions(void) +void __driRegisterExtensions( void ) { #if 0 - /* Example. Also look in fxdd.c for more details. */ - { - const int _gloffset_FooBarEXT = 555; /* just an example number! */ - if (_glapi_add_entrypoint("glFooBarEXT", _gloffset_FooBarEXT)) { - void *f = glXGetProcAddressARB("glFooBarEXT"); - assert(f); - } - } + /* Example. Also look in tdfx_dd.c for more details. */ + { + const int _gloffset_FooBarEXT = 555; /* just an example number! */ + if ( _glapi_add_entrypoint( "glFooBarEXT", _gloffset_FooBarEXT ) ) { + void *f = glXGetProcAddressARB( "glFooBarEXT" ); + assert( f ); + } + } #endif } diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 03f86330c..0f62df601 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -165,7 +165,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) 0, pDRIPriv->pDriverInfo->SAREASize, DRM_SHM, - DRM_CONTAINS_LOCK, + DRM_CONTAINS_LOCK, &pDRIPriv->hSAREA) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -179,7 +179,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) "[drm] added %d byte SAREA at 0x%08lx\n", pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA); - if (drmMap( pDRIPriv->drmFD, + if (drmMap( pDRIPriv->drmFD, pDRIPriv->hSAREA, pDRIPriv->pDriverInfo->SAREASize, (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) @@ -194,12 +194,12 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA 0x%08lx to %p\n", pDRIPriv->hSAREA, pDRIPriv->pSAREA); - - if (drmAddMap( pDRIPriv->drmFD, + + if (drmAddMap( pDRIPriv->drmFD, (drmHandle)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, pDRIPriv->pDriverInfo->frameBufferSize, - DRM_FRAME_BUFFER, - 0, + DRM_FRAME_BUFFER, + 0, &pDRIPriv->hFrameBuffer) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -234,7 +234,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) /* validate max drawable table entry set by driver */ if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) || (pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "Invalid max drawable table size set by driver: %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); } @@ -266,7 +266,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, &pDRIPriv->myContext, flags))) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to create server context\n"); return FALSE; } @@ -289,12 +289,12 @@ DRIFinishScreenInit(ScreenPtr pScreen) /* Server will handle 3D swaps, and hide 2D swaps from kernel. * Register server context as a preserved context. */ - + /* allocate memory for hidden context store */ pDRIPriv->hiddenContextStore = (void *)xcalloc(1, pDRIInfo->contextSize); if (!pDRIPriv->hiddenContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to allocate hidden context\n"); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; @@ -304,17 +304,17 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->partial3DContextStore = (void *)xcalloc(1, pDRIInfo->contextSize); if (!pDRIPriv->partial3DContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] failed to allocate partial 3D context\n"); xfree(pDRIPriv->hiddenContextStore); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } - + /* save initial context store */ if (pDRIInfo->SwapContext) { (*pDRIInfo->SwapContext)( - pScreen, + pScreen, DRI_NO_SYNC, DRI_2D_CONTEXT, pDRIPriv->hiddenContextStore, @@ -328,7 +328,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) * setup signal handler for receiving swap requests from kernel */ if (!drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to setup DRM signal handler\n"); if (pDRIPriv->hiddenContextStore) xfree(pDRIPriv->hiddenContextStore); @@ -337,7 +337,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } else { - DRIDrvMsg(pScreen->myNum, X_INFO, + DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] installed DRM signal handler\n"); } @@ -377,7 +377,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; } - + DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n"); return TRUE; @@ -400,13 +400,13 @@ DRICloseScreen(ScreenPtr pScreen) if (pDRIPriv->pDriverInfo->driverSwapMethod != DRI_KERNEL_SWAP) { if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to remove DRM signal handler\n"); } } if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to destroy server context\n"); } @@ -440,7 +440,7 @@ DRICloseScreen(ScreenPtr pScreen) pDRIPriv->hSAREA, pDRIPriv->pSAREA); } - + drmClose(pDRIPriv->drmFD); xfree(pDRIPriv); pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; @@ -457,7 +457,7 @@ DRIExtensionInit(void) return FALSE; } - /* Allocate a window private index with a zero sized private area for + /* Allocate a window private index with a zero sized private area for * each window, then should a window become a DRI window, we'll hang * a DRIWindowPrivateRec off of this private index. */ @@ -550,7 +550,7 @@ DRIGetClientDriverName(ScreenPtr pScreen, /* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper functions that layer on drmCreateContext and drmAddContextTag. - + DRICreateContextPriv always creates a kernel drmContext and then calls DRICreateContextPrivFromHandle to create a DRIContextPriv structure for DRI tracking. For the SIGIO handler, the drmContext is associated with @@ -591,7 +591,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1); drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv); - + pDRIContextPriv->hwContext = hHWContext; pDRIContextPriv->pScreen = pScreen; pDRIContextPriv->flags = flags; @@ -601,7 +601,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_2DONLY)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set 2D context flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; @@ -611,7 +611,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_PRESERVED)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set preserved flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; @@ -626,7 +626,7 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) DRIScreenPrivPtr pDRIPriv; if (!pDRIContextPriv) return TRUE; - + pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) { @@ -670,14 +670,14 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, /* No matching GLX visual found */ return FALSE; } - + if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) { return FALSE; } contextStore=DRIGetContextStore(pDRIContextPriv); if (pDRIPriv->pDriverInfo->CreateContext) { - if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, + if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, *pHWContext, *pVisualConfigPriv, (DRIContextType)(long)contextStore))) { DRIDestroyContextPriv(pDRIContextPriv); @@ -721,9 +721,9 @@ DRIContextPrivDelete(pointer pResource, XID id) * in the case of transition from private to shared backbuffers. It's * not necessary for correctness, because DRIClipNotify gets called in * time to prevent any conflict, but the transition from - * shared->private is sometimes missed if we don't do this. + * shared->private is sometimes missed if we don't do this. */ -static void +static void DRIClipNotifyAllDrawables(ScreenPtr pScreen) { int i; @@ -731,11 +731,11 @@ DRIClipNotifyAllDrawables(ScreenPtr pScreen) for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; - } + } } -static void +static void DRITransitionToSharedBuffers(ScreenPtr pScreen) { /* ErrorF("DRITransitionToSharedBuffers\n"); */ @@ -743,7 +743,7 @@ DRITransitionToSharedBuffers(ScreenPtr pScreen) } -static void +static void DRITransitionToPrivateBuffers(ScreenPtr pScreen) { /* ErrorF("DRITransitionToPrivateBuffers\n"); */ @@ -808,7 +808,7 @@ DRICreateDrawable(ScreenPtr pScreen, Drawable id, pDRIDrawablePriv->drawableIndex = -1; /* save private off of preallocated index */ - pWin->devPrivates[DRIWindowPrivIndex].ptr = + pWin->devPrivates[DRIWindowPrivIndex].ptr = (pointer)pDRIDrawablePriv; switch (++pDRIPriv->nrWindows) { @@ -847,7 +847,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable) pDRIDrawablePriv->refCount--; if (pDRIDrawablePriv->refCount <= 0) { /* This calls back DRIDrawablePrivDelete which frees private area */ - FreeResourceByType(id, DRIDrawablePrivResType, FALSE); + FreeResourceByType(id, DRIDrawablePrivResType, FALSE); } } else { /* pixmap (or for GLX 1.3, a PBuffer) */ @@ -875,7 +875,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id) pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; } - if (drmDestroyDrawable(pDRIPriv->drmFD, + if (drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable)) { return FALSE; } @@ -937,7 +937,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, if (!(pDRIPriv->DRIDrawables[i])) { pDRIPriv->DRIDrawables[i] = pDrawable; pDRIDrawablePriv->drawableIndex = i; - pDRIPriv->pSAREA->drawableTable[i].stamp = + pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; break; } @@ -950,10 +950,10 @@ DRIGetDrawableInfo(ScreenPtr pScreen, int oldestIndex = 0; i = pDRIPriv->pDriverInfo->maxDrawableTableEntry; while (i--) { - if (pDRIPriv->pSAREA->drawableTable[i].stamp < + if (pDRIPriv->pSAREA->drawableTable[i].stamp < oldestStamp) { oldestIndex = i; - oldestStamp = + oldestStamp = pDRIPriv->pSAREA->drawableTable[i].stamp; } } @@ -968,15 +968,15 @@ DRIGetDrawableInfo(ScreenPtr pScreen, pDRIPriv->DRIDrawables[oldestIndex] = pDrawable; /* validate SAREA entry */ - pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = + pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = DRIDrawableValidationStamp++; /* check for stamp wrap around */ if (oldestStamp > DRIDrawableValidationStamp) { /* walk SAREA table and invalidate all drawables */ - for( i=0; - i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; + for( i=0; + i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; @@ -992,10 +992,10 @@ DRIGetDrawableInfo(ScreenPtr pScreen, pDRIDrawablePriv->drawableIndex); /* reinit drawable ID if window is visible */ - if ((pWin->viewable) && + if ((pWin->viewable) && (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS)) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, + (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, &pWin->clipList, pDRIDrawablePriv->drawableIndex); } } @@ -1023,7 +1023,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, *numClipRects = 1; *pClipRects = &pDRIPriv->fullscreen_rect; } - + *backX = *X; *backY = *Y; @@ -1173,7 +1173,7 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData, } } -void +void DRIDoBlockHandler(int screenNum, pointer blockData, pointer pTimeout, pointer pReadmask) { @@ -1192,7 +1192,7 @@ DRIDoBlockHandler(int screenNum, pointer blockData, DRIUnlock(pScreen); } -void +void DRISwapContext(int drmFD, void *oldctx, void *newctx) { DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx; @@ -1235,7 +1235,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) #endif if (!pDRIPriv->pDriverInfo->SwapContext) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] DDX driver missing context swap call back\n"); return; } @@ -1251,7 +1251,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContextType = DRI_NO_CONTEXT; } newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1265,8 +1265,8 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) /* optimize 2D context swaps */ if (newContext->flags & DRI_CONTEXT_2DONLY) { - /* go from 3D context to 2D context and only save 2D - * subset of 3D state + /* go from 3D context to 2D context and only save 2D + * subset of 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; @@ -1277,8 +1277,8 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) } else if (oldContext->flags & DRI_CONTEXT_2DONLY) { if (pDRIPriv->lastPartial3DContext == newContext) { - /* go from 2D context back to previous 3D context and - * only restore 2D subset of previous 3D state + /* go from 2D context back to previous 3D context and + * only restore 2D subset of previous 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; @@ -1291,7 +1291,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) /* call DDX driver to do partial restore */ oldContextStore = DRIGetContextStore(oldContext); - newContextStore = + newContextStore = DRIGetContextStore(pDRIPriv->lastPartial3DContext); (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, DRI_2D_SYNC, @@ -1305,7 +1305,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1321,7 +1321,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1341,33 +1341,33 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) newContextStore); } -void* +void* DRIGetContextStore(DRIContextPrivPtr context) { return((void *)context->pContextStore); } -void +void DRIPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - /* NOT_DONE: HACK until we have newly transitioned 3D->2D - * windows computed + /* NOT_DONE: HACK until we have newly transitioned 3D->2D + * windows computed */ if(what == PW_BACKGROUND) { if ((pDRIPriv->pDriverInfo->bufferRequests == DRI_3D_WINDOWS_ONLY) && (pDRIDrawablePriv)) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, + (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, pDRIDrawablePriv->drawableIndex); } else if (pDRIPriv->pDriverInfo->bufferRequests == DRI_ALL_WINDOWS) { if (pDRIDrawablePriv) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, + (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, pDRIDrawablePriv->drawableIndex); } else { @@ -1409,7 +1409,7 @@ DRIPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) } } -void +void DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1606,7 +1606,7 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy) } } -CARD32 +CARD32 DRIGetDrawableIndex(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1624,7 +1624,7 @@ DRIGetDrawableIndex(WindowPtr pWin) return index; } -unsigned int +unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1636,56 +1636,62 @@ void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - + ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock); } void -DRILock(ScreenPtr pScreen, int flags) { +DRILock(ScreenPtr pScreen, int flags) +{ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - + if (!lockRefCount) - DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags); + DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags); lockRefCount++; } void -DRIUnlock(ScreenPtr pScreen) { +DRIUnlock(ScreenPtr pScreen) +{ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (lockRefCount>0) lockRefCount--; + if (lockRefCount > 0) { + lockRefCount--; + } else { - ErrorF("DRIUnlock called when not locked\n"); - return; + ErrorF("DRIUnlock called when not locked\n"); + return; } if (!lockRefCount) - DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); + DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); } void * DRIGetSAREAPrivate(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (!pDRIPriv) return 0; - return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + if (!pDRIPriv) + return 0; + return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); } drmContext DRIGetContext(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (!pDRIPriv) return 0; - return pDRIPriv->myContext; + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + if (!pDRIPriv) + return 0; + return pDRIPriv->myContext; } - + /* This lets get at the unwrapped functions so that they can correctly * call the lowerlevel functions, and choose whether they will be - * called at every level of recursion (eg in validatetree). + * called at every level of recursion (eg in validatetree). */ DRIWrappedFuncsRec * DRIGetWrappedFuncs(ScreenPtr pScreen) { - return &(DRI_SCREEN_PRIV(pScreen)->wrap); + return &(DRI_SCREEN_PRIV(pScreen)->wrap); } void @@ -1693,9 +1699,9 @@ DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion) { - *majorVersion = XF86DRI_MAJOR_VERSION; - *minorVersion = XF86DRI_MINOR_VERSION; - *patchVersion = XF86DRI_PATCH_VERSION; + *majorVersion = XF86DRI_MAJOR_VERSION; + *minorVersion = XF86DRI_MINOR_VERSION; + *patchVersion = XF86DRI_PATCH_VERSION; } static void @@ -1767,7 +1773,7 @@ DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; WindowPtr pWin = (WindowPtr)pDrawable; XF86DRIClipRectPtr pClipRects = (void *)REGION_RECTS(&pWin->clipList); - + _DRIAdjustFrame(pScrn, pDRIPriv, pScrn->frameX0, pScrn->frameY0); if (pDrawable->type != DRAWABLE_WINDOW) return FALSE; @@ -1796,7 +1802,7 @@ DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) pScrn->vtSema = FALSE; pDRIPriv->fullscreen = pDrawable; DRIClipNotify(pWin, 0, 0); - + if (pDRIPriv->pDriverInfo->OpenFullScreen) pDRIPriv->pDriverInfo->OpenFullScreen(pScreen); @@ -1827,7 +1833,7 @@ _DRICloseFullScreen(pointer pResource, XID id) pScrn->EnableDisableFBAccess(pScreen->myNum, TRUE); pWin->eventMask = mask; pWin->optional = optional; - + xf86EnableVTSwitch(TRUE); pDRIPriv->pSAREA->frame.fullscreen = 0; return TRUE; diff --git a/xc/programs/Xserver/GL/glx/g_disptab.c b/xc/programs/Xserver/GL/glx/g_disptab.c index f05e213f3..52b378bd6 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab.c +++ b/xc/programs/Xserver/GL/glx/g_disptab.c @@ -1,22 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "glxserver.h" @@ -166,6 +175,23 @@ __GLXdispatchSingleProcPtr __glXSingleTable[] = { __glXDisp_IsEnabled, __glXDisp_IsList, __glXDisp_Flush, + __glXDisp_AreTexturesResident, + __glXDisp_DeleteTextures, + __glXDisp_GenTextures, + __glXDisp_IsTexture, + __glXDisp_GetColorTable, + __glXDisp_GetColorTableParameterfv, + __glXDisp_GetColorTableParameteriv, + __glXDisp_GetConvolutionFilter, + __glXDisp_GetConvolutionParameterfv, + __glXDisp_GetConvolutionParameteriv, + __glXDisp_GetSeparableFilter, + __glXDisp_GetHistogram, + __glXDisp_GetHistogramParameterfv, + __glXDisp_GetHistogramParameteriv, + __glXDisp_GetMinmax, + __glXDisp_GetMinmaxParameterfv, + __glXDisp_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXRenderTable[] = { @@ -361,9 +387,28 @@ __GLXdispatchRenderProcPtr __glXRenderTable[] = { __glXDisp_Translated, __glXDisp_Translatef, __glXDisp_Viewport, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDisp_PolygonOffset, + __glXDisp_DrawArrays, __glXDisp_Indexubv, + __glXDisp_ColorSubTable, + __glXDisp_CopyColorSubTable, + __glXDisp_ActiveTextureARB, + __glXDisp_MultiTexCoord1dvARB, + __glXDisp_MultiTexCoord1fvARB, + __glXDisp_MultiTexCoord1ivARB, + __glXDisp_MultiTexCoord1svARB, + __glXDisp_MultiTexCoord2dvARB, + __glXDisp_MultiTexCoord2fvARB, + __glXDisp_MultiTexCoord2ivARB, + __glXDisp_MultiTexCoord2svARB, + __glXDisp_MultiTexCoord3dvARB, + __glXDisp_MultiTexCoord3fvARB, + __glXDisp_MultiTexCoord3ivARB, + __glXDisp_MultiTexCoord3svARB, + __glXDisp_MultiTexCoord4dvARB, + __glXDisp_MultiTexCoord4fvARB, + __glXDisp_MultiTexCoord4ivARB, + __glXDisp_MultiTexCoord4svARB, }; __GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { @@ -510,6 +555,23 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { __glXDispSwap_IsEnabled, __glXDispSwap_IsList, __glXDispSwap_Flush, + __glXDispSwap_AreTexturesResident, + __glXDispSwap_DeleteTextures, + __glXDispSwap_GenTextures, + __glXDispSwap_IsTexture, + __glXDispSwap_GetColorTable, + __glXDispSwap_GetColorTableParameterfv, + __glXDispSwap_GetColorTableParameteriv, + __glXDispSwap_GetConvolutionFilter, + __glXDispSwap_GetConvolutionParameterfv, + __glXDispSwap_GetConvolutionParameteriv, + __glXDispSwap_GetSeparableFilter, + __glXDispSwap_GetHistogram, + __glXDispSwap_GetHistogramParameterfv, + __glXDispSwap_GetHistogramParameteriv, + __glXDispSwap_GetMinmax, + __glXDispSwap_GetMinmaxParameterfv, + __glXDispSwap_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { @@ -705,7 +767,26 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { __glXDispSwap_Translated, __glXDispSwap_Translatef, __glXDispSwap_Viewport, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDispSwap_PolygonOffset, + __glXDispSwap_DrawArrays, __glXDispSwap_Indexubv, + __glXDispSwap_ColorSubTable, + __glXDispSwap_CopyColorSubTable, + __glXDispSwap_ActiveTextureARB, + __glXDispSwap_MultiTexCoord1dvARB, + __glXDispSwap_MultiTexCoord1fvARB, + __glXDispSwap_MultiTexCoord1ivARB, + __glXDispSwap_MultiTexCoord1svARB, + __glXDispSwap_MultiTexCoord2dvARB, + __glXDispSwap_MultiTexCoord2fvARB, + __glXDispSwap_MultiTexCoord2ivARB, + __glXDispSwap_MultiTexCoord2svARB, + __glXDispSwap_MultiTexCoord3dvARB, + __glXDispSwap_MultiTexCoord3fvARB, + __glXDispSwap_MultiTexCoord3ivARB, + __glXDispSwap_MultiTexCoord3svARB, + __glXDispSwap_MultiTexCoord4dvARB, + __glXDispSwap_MultiTexCoord4fvARB, + __glXDispSwap_MultiTexCoord4ivARB, + __glXDispSwap_MultiTexCoord4svARB, }; diff --git a/xc/programs/Xserver/GL/glx/g_disptab.h b/xc/programs/Xserver/GL/glx/g_disptab.h index 247b27ea9..56d26a1f7 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab.h +++ b/xc/programs/Xserver/GL/glx/g_disptab.h @@ -1,24 +1,33 @@ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifndef _GLX_g_disptab_h_ #define _GLX_g_disptab_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ extern int __glXRender(__GLXclientState*, GLbyte*); @@ -83,6 +92,23 @@ extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDisp_IsList(__GLXclientState*, GLbyte*); extern int __glXDisp_Flush(__GLXclientState*, GLbyte*); +extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDisp_CallList(GLbyte*); extern void __glXDisp_CallLists(GLbyte*); @@ -274,7 +300,28 @@ extern void __glXDisp_Scalef(GLbyte*); extern void __glXDisp_Translated(GLbyte*); extern void __glXDisp_Translatef(GLbyte*); extern void __glXDisp_Viewport(GLbyte*); +extern void __glXDisp_PolygonOffset(GLbyte*); +extern void __glXDisp_DrawArrays(GLbyte*); extern void __glXDisp_Indexubv(GLbyte*); +extern void __glXDisp_ColorSubTable(GLbyte*); +extern void __glXDisp_CopyColorSubTable(GLbyte*); +extern void __glXDisp_ActiveTextureARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4svARB(GLbyte*); extern int __glXSwapRender(__GLXclientState*, GLbyte*); extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*); @@ -338,6 +385,23 @@ extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDispSwap_CallList(GLbyte*); extern void __glXDispSwap_CallLists(GLbyte*); @@ -529,16 +593,37 @@ extern void __glXDispSwap_Scalef(GLbyte*); extern void __glXDispSwap_Translated(GLbyte*); extern void __glXDispSwap_Translatef(GLbyte*); extern void __glXDispSwap_Viewport(GLbyte*); +extern void __glXDispSwap_PolygonOffset(GLbyte*); +extern void __glXDispSwap_DrawArrays(GLbyte*); extern void __glXDispSwap_Indexubv(GLbyte*); +extern void __glXDispSwap_ColorSubTable(GLbyte*); +extern void __glXDispSwap_CopyColorSubTable(GLbyte*); +extern void __glXDispSwap_ActiveTextureARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*); #define __GLX_MIN_GLXCMD_OPCODE 1 #define __GLX_MAX_GLXCMD_OPCODE 20 #define __GLX_MIN_RENDER_OPCODE 1 -#define __GLX_MAX_RENDER_OPCODE 194 +#define __GLX_MAX_RENDER_OPCODE 213 #define __GLX_MIN_SINGLE_OPCODE 1 -#define __GLX_MAX_SINGLE_OPCODE 142 -#define __GLX_SINGLE_TABLE_SIZE 143 -#define __GLX_RENDER_TABLE_SIZE 195 +#define __GLX_MAX_SINGLE_OPCODE 159 +#define __GLX_SINGLE_TABLE_SIZE 160 +#define __GLX_RENDER_TABLE_SIZE 214 extern __GLXdispatchRenderProcPtr __glXRenderTable[__GLX_RENDER_TABLE_SIZE]; extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE]; diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.c b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c index 1ac56e678..5923aa225 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab_EXT.c +++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c @@ -1,31 +1,1052 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "glxserver.h" #include "glxext.h" #include "g_disptab_EXT.h" __GLXdispatchRenderProcPtr __glXRenderTable_EXT[] = { - __glXDisp_PolygonOffset, - __glXDisp_TexSubImage1D, - __glXDisp_TexSubImage2D, + __glXDisp_ColorTable, + __glXDisp_ColorTableParameterfv, + __glXDisp_ColorTableParameteriv, + __glXDisp_CopyColorTable, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -41,26 +1062,2073 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXDisp_DrawArrays, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXDisp_BlendColor, + __glXDisp_BlendEquation, + __glXNoSuchRenderOpcode, + __glXDisp_TexSubImage1D, + __glXDisp_TexSubImage2D, + __glXDisp_ConvolutionFilter1D, + __glXDisp_ConvolutionFilter2D, + __glXDisp_ConvolutionParameterf, + __glXDisp_ConvolutionParameterfv, + __glXDisp_ConvolutionParameteri, + __glXDisp_ConvolutionParameteriv, + __glXDisp_CopyConvolutionFilter1D, + __glXDisp_CopyConvolutionFilter2D, + __glXDisp_SeparableFilter2D, + __glXDisp_Histogram, + __glXDisp_Minmax, + __glXDisp_ResetHistogram, + __glXDisp_ResetMinmax, + __glXDisp_TexImage3D, + __glXDisp_TexSubImage3D, + __glXDisp_DrawArraysEXT, __glXDisp_BindTexture, __glXDisp_PrioritizeTextures, __glXDisp_CopyTexImage1D, __glXDisp_CopyTexImage2D, __glXDisp_CopyTexSubImage1D, __glXDisp_CopyTexSubImage2D, + __glXDisp_CopyTexSubImage3D, }; __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[] = { - __glXDisp_AreTexturesResident, - __glXDisp_DeleteTextures, - __glXDisp_GenTextures, - __glXDisp_IsTexture, + __glXDisp_AreTexturesResidentEXT, + __glXDisp_DeleteTexturesEXT, + __glXDisp_GenTexturesEXT, + __glXDisp_IsTextureEXT, }; __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[] = { - __glXDispSwap_PolygonOffset, - __glXDispSwap_TexSubImage1D, - __glXDispSwap_TexSubImage2D, + __glXDispSwap_ColorTable, + __glXDispSwap_ColorTableParameterfv, + __glXDispSwap_ColorTableParameteriv, + __glXDispSwap_CopyColorTable, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -76,18 +3144,1051 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXDispSwap_DrawArrays, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXDispSwap_BlendColor, + __glXDispSwap_BlendEquation, + __glXNoSuchRenderOpcode, + __glXDispSwap_TexSubImage1D, + __glXDispSwap_TexSubImage2D, + __glXDispSwap_ConvolutionFilter1D, + __glXDispSwap_ConvolutionFilter2D, + __glXDispSwap_ConvolutionParameterf, + __glXDispSwap_ConvolutionParameterfv, + __glXDispSwap_ConvolutionParameteri, + __glXDispSwap_ConvolutionParameteriv, + __glXDispSwap_CopyConvolutionFilter1D, + __glXDispSwap_CopyConvolutionFilter2D, + __glXDispSwap_SeparableFilter2D, + __glXDispSwap_Histogram, + __glXDispSwap_Minmax, + __glXDispSwap_ResetHistogram, + __glXDispSwap_ResetMinmax, + __glXDispSwap_TexImage3D, + __glXDispSwap_TexSubImage3D, + __glXDispSwap_DrawArraysEXT, __glXDispSwap_BindTexture, __glXDispSwap_PrioritizeTextures, __glXDispSwap_CopyTexImage1D, __glXDispSwap_CopyTexImage2D, __glXDispSwap_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage2D, + __glXDispSwap_CopyTexSubImage3D, }; __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[] = { - __glXDispSwap_AreTexturesResident, - __glXDispSwap_DeleteTextures, - __glXDispSwap_GenTextures, - __glXDispSwap_IsTexture, + __glXDispSwap_AreTexturesResidentEXT, + __glXDispSwap_DeleteTexturesEXT, + __glXDispSwap_GenTexturesEXT, + __glXDispSwap_IsTextureEXT, }; diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.h b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h index 59c7e3024..f28d3b9ff 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab_EXT.h +++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h @@ -1,64 +1,115 @@ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifndef _GLX_g_disptab_EXT_h_ #define _GLX_g_disptab_EXT_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.2 1999/06/14 07:31:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ -extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); -extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); -extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); -extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDisp_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsTextureEXT(__GLXclientState*, GLbyte*); -extern void __glXDisp_PolygonOffset(GLbyte*); +extern void __glXDisp_ColorTable(GLbyte*); +extern void __glXDisp_ColorTableParameterfv(GLbyte*); +extern void __glXDisp_ColorTableParameteriv(GLbyte*); +extern void __glXDisp_CopyColorTable(GLbyte*); +extern void __glXDisp_BlendColor(GLbyte*); +extern void __glXDisp_BlendEquation(GLbyte*); extern void __glXDisp_TexSubImage1D(GLbyte*); extern void __glXDisp_TexSubImage2D(GLbyte*); -extern void __glXDisp_DrawArrays(GLbyte*); +extern void __glXDisp_ConvolutionFilter1D(GLbyte*); +extern void __glXDisp_ConvolutionFilter2D(GLbyte*); +extern void __glXDisp_ConvolutionParameterf(GLbyte*); +extern void __glXDisp_ConvolutionParameterfv(GLbyte*); +extern void __glXDisp_ConvolutionParameteri(GLbyte*); +extern void __glXDisp_ConvolutionParameteriv(GLbyte*); +extern void __glXDisp_CopyConvolutionFilter1D(GLbyte*); +extern void __glXDisp_CopyConvolutionFilter2D(GLbyte*); +extern void __glXDisp_SeparableFilter2D(GLbyte*); +extern void __glXDisp_Histogram(GLbyte*); +extern void __glXDisp_Minmax(GLbyte*); +extern void __glXDisp_ResetHistogram(GLbyte*); +extern void __glXDisp_ResetMinmax(GLbyte*); +extern void __glXDisp_TexImage3D(GLbyte*); +extern void __glXDisp_TexSubImage3D(GLbyte*); +extern void __glXDisp_DrawArraysEXT(GLbyte*); extern void __glXDisp_BindTexture(GLbyte*); extern void __glXDisp_PrioritizeTextures(GLbyte*); extern void __glXDisp_CopyTexImage1D(GLbyte*); extern void __glXDisp_CopyTexImage2D(GLbyte*); extern void __glXDisp_CopyTexSubImage1D(GLbyte*); extern void __glXDisp_CopyTexSubImage2D(GLbyte*); +extern void __glXDisp_CopyTexSubImage3D(GLbyte*); -extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsTextureEXT(__GLXclientState*, GLbyte*); -extern void __glXDispSwap_PolygonOffset(GLbyte*); +extern void __glXDispSwap_ColorTable(GLbyte*); +extern void __glXDispSwap_ColorTableParameterfv(GLbyte*); +extern void __glXDispSwap_ColorTableParameteriv(GLbyte*); +extern void __glXDispSwap_CopyColorTable(GLbyte*); +extern void __glXDispSwap_BlendColor(GLbyte*); +extern void __glXDispSwap_BlendEquation(GLbyte*); extern void __glXDispSwap_TexSubImage1D(GLbyte*); extern void __glXDispSwap_TexSubImage2D(GLbyte*); -extern void __glXDispSwap_DrawArrays(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_ConvolutionParameterf(GLbyte*); +extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*); +extern void __glXDispSwap_ConvolutionParameteri(GLbyte*); +extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_SeparableFilter2D(GLbyte*); +extern void __glXDispSwap_Histogram(GLbyte*); +extern void __glXDispSwap_Minmax(GLbyte*); +extern void __glXDispSwap_ResetHistogram(GLbyte*); +extern void __glXDispSwap_ResetMinmax(GLbyte*); +extern void __glXDispSwap_TexImage3D(GLbyte*); +extern void __glXDispSwap_TexSubImage3D(GLbyte*); +extern void __glXDispSwap_DrawArraysEXT(GLbyte*); extern void __glXDispSwap_BindTexture(GLbyte*); extern void __glXDispSwap_PrioritizeTextures(GLbyte*); extern void __glXDispSwap_CopyTexImage1D(GLbyte*); extern void __glXDispSwap_CopyTexImage2D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*); +extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*); -#define __GLX_MIN_RENDER_OPCODE_EXT 4098 -#define __GLX_MAX_RENDER_OPCODE_EXT 4122 +#define __GLX_MIN_RENDER_OPCODE_EXT 2053 +#define __GLX_MAX_RENDER_OPCODE_EXT 4123 #define __GLX_MIN_VENDPRIV_OPCODE_EXT 11 #define __GLX_MAX_VENDPRIV_OPCODE_EXT 14 #define __GLX_VENDPRIV_TABLE_SIZE_EXT 4 -#define __GLX_RENDER_TABLE_SIZE_EXT 25 +#define __GLX_RENDER_TABLE_SIZE_EXT 2071 extern __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_VENDPRIV_TABLE_SIZE_EXT]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; diff --git a/xc/programs/Xserver/GL/glx/g_render.c b/xc/programs/Xserver/GL/glx/g_render.c index d8214d02a..7948fab82 100644 --- a/xc/programs/Xserver/GL/glx/g_render.c +++ b/xc/programs/Xserver/GL/glx/g_render.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -1739,3 +1747,330 @@ void __glXDisp_Indexubv(GLbyte *pc) ); } +void __glXDisp_BlendColor(GLbyte *pc) +{ + glBlendColor( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ); +} + +void __glXDisp_BlendEquation(GLbyte *pc) +{ + glBlendEquation( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_ColorTableParameterfv(GLbyte *pc) +{ + glColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ColorTableParameteriv(GLbyte *pc) +{ + glColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDisp_CopyColorTable(GLbyte *pc) +{ + glCopyColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_CopyColorSubTable(GLbyte *pc) +{ + glCopyColorSubTable( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_ConvolutionParameterf(GLbyte *pc) +{ + glConvolutionParameterf( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameterfv(GLbyte *pc) +{ + glConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameteri(GLbyte *pc) +{ + glConvolutionParameteri( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameteriv(GLbyte *pc) +{ + glConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDisp_CopyConvolutionFilter1D(GLbyte *pc) +{ + glCopyConvolutionFilter1D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_CopyConvolutionFilter2D(GLbyte *pc) +{ + glCopyConvolutionFilter2D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20) + ); +} + +void __glXDisp_Histogram(GLbyte *pc) +{ + glHistogram( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLboolean *)(pc + 12) + ); +} + +void __glXDisp_Minmax(GLbyte *pc) +{ + glMinmax( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLboolean *)(pc + 8) + ); +} + +void __glXDisp_ResetHistogram(GLbyte *pc) +{ + glResetHistogram( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_ResetMinmax(GLbyte *pc) +{ + glResetMinmax( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_CopyTexSubImage3D(GLbyte *pc) +{ + glCopyTexSubImage3D( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLint *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32) + ); +} + +void __glXDisp_ActiveTextureARB(GLbyte *pc) +{ + glActiveTextureARB( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord1dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 12); + pc -= 4; + } +#endif + glMultiTexCoord1dvARB( + *(GLenum *)(pc + 8), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord1fvARB(GLbyte *pc) +{ + glMultiTexCoord1fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord1ivARB(GLbyte *pc) +{ + glMultiTexCoord1ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord1svARB(GLbyte *pc) +{ + glMultiTexCoord1svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + glMultiTexCoord2dvARB( + *(GLenum *)(pc + 16), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord2fvARB(GLbyte *pc) +{ + glMultiTexCoord2fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2ivARB(GLbyte *pc) +{ + glMultiTexCoord2ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2svARB(GLbyte *pc) +{ + glMultiTexCoord2svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 28); + pc -= 4; + } +#endif + glMultiTexCoord3dvARB( + *(GLenum *)(pc + 24), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord3fvARB(GLbyte *pc) +{ + glMultiTexCoord3fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3ivARB(GLbyte *pc) +{ + glMultiTexCoord3ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3svARB(GLbyte *pc) +{ + glMultiTexCoord3svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + glMultiTexCoord4dvARB( + *(GLenum *)(pc + 32), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord4fvARB(GLbyte *pc) +{ + glMultiTexCoord4fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4ivARB(GLbyte *pc) +{ + glMultiTexCoord4ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4svARB(GLbyte *pc) +{ + glMultiTexCoord4svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + diff --git a/xc/programs/Xserver/GL/glx/g_renderswap.c b/xc/programs/Xserver/GL/glx/g_renderswap.c index 5b57a07a3..5673420a3 100644 --- a/xc/programs/Xserver/GL/glx/g_renderswap.c +++ b/xc/programs/Xserver/GL/glx/g_renderswap.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -2715,3 +2723,545 @@ void __glXDispSwap_Indexubv(GLbyte *pc) ); } +void __glXDispSwap_BlendColor(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_FLOAT(pc + 12); + + glBlendColor( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ); +} + +void __glXDispSwap_BlendEquation(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glBlendEquation( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_ColorTableParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + + glColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ColorTableParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + + glColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDispSwap_CopyColorTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_CopyColorSubTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyColorSubTable( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_ConvolutionParameterf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + + glConvolutionParameterf( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + + glConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameteri(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + + glConvolutionParameteri( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + + glConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyConvolutionFilter1D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + + glCopyConvolutionFilter2D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20) + ); +} + +void __glXDispSwap_Histogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + + glHistogram( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLboolean *)(pc + 12) + ); +} + +void __glXDispSwap_Minmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + + glMinmax( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLboolean *)(pc + 8) + ); +} + +void __glXDispSwap_ResetHistogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glResetHistogram( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_ResetMinmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glResetMinmax( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_INT(pc + 28); + __GLX_SWAP_INT(pc + 32); + + glCopyTexSubImage3D( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLint *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32) + ); +} + +void __glXDispSwap_ActiveTextureARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glActiveTextureARB( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 12); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); + + glMultiTexCoord1dvARB( + *(GLenum *)(pc + 8), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1); + + glMultiTexCoord1fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 1); + + glMultiTexCoord1ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 1); + + glMultiTexCoord1svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + + glMultiTexCoord2dvARB( + *(GLenum *)(pc + 16), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2); + + glMultiTexCoord2fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 2); + + glMultiTexCoord2ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); + + glMultiTexCoord2svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 28); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + + glMultiTexCoord3dvARB( + *(GLenum *)(pc + 24), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3); + + glMultiTexCoord3fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 3); + + glMultiTexCoord3ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 3); + + glMultiTexCoord3svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 32); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + + glMultiTexCoord4dvARB( + *(GLenum *)(pc + 32), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4); + + glMultiTexCoord4fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 4); + + glMultiTexCoord4ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 4); + + glMultiTexCoord4svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + diff --git a/xc/programs/Xserver/GL/glx/g_single.c b/xc/programs/Xserver/GL/glx/g_single.c index e86d68f86..cb9f4eb33 100644 --- a/xc/programs/Xserver/GL/glx/g_single.c +++ b/xc/programs/Xserver/GL/glx/g_single.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -431,8 +439,8 @@ int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -445,8 +453,8 @@ int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; @@ -477,8 +485,8 @@ int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -491,8 +499,8 @@ int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; @@ -523,8 +531,8 @@ int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -537,8 +545,8 @@ int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; @@ -1238,11 +1246,11 @@ int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) GLboolean answerBuffer[200]; char *answer; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); @@ -1266,11 +1274,11 @@ int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); glDeleteTextures( @@ -1289,11 +1297,11 @@ int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc) GLuint answerBuffer[200]; char *answer; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); @@ -1314,14 +1322,468 @@ int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + + retval = + glIsTexture( + *(GLuint *)(pc + 0) + ); + __GLX_PUT_RETVAL(retval); + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + return Success; +} + +int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLboolean answerBuffer[200]; + char *answer; + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = - glIsTexture( + glAreTexturesResidentEXT( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4), + (GLboolean *) answer + ); + __GLX_PUT_RETVAL(retval); + __GLX_BEGIN_REPLY(n); + __GLX_SEND_HEADER(); + __GLX_SEND_BYTE_ARRAY(n); + return Success; +} + +int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + + glDeleteTexturesEXT( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4) + ); + return Success; +} + +int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLuint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); + glGenTexturesEXT( + *(GLsizei *)(pc + 0), + (GLuint *) answer + ); + __GLX_BEGIN_REPLY(n*4); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(n); + return Success; +} + +int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + + retval = + glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); diff --git a/xc/programs/Xserver/GL/glx/g_singleswap.c b/xc/programs/Xserver/GL/glx/g_singleswap.c index 98f8631a6..4b88c4ee9 100644 --- a/xc/programs/Xserver/GL/glx/g_singleswap.c +++ b/xc/programs/Xserver/GL/glx/g_singleswap.c @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.3 1999/06/14 07:31:24 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -513,8 +521,8 @@ int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -529,10 +537,10 @@ int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; @@ -569,8 +577,8 @@ int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -585,10 +593,10 @@ int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; @@ -625,8 +633,8 @@ int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -641,10 +649,10 @@ int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; @@ -1500,6 +1508,560 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) char *answer; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, n); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); + retval = + glAreTexturesResident( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4), + (GLboolean *) answer + ); + __GLX_PUT_RETVAL(retval); + __GLX_SWAP_REPLY_RETVAL(); + __GLX_BEGIN_REPLY(n); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + __GLX_SEND_BYTE_ARRAY(n); + return Success; +} + +int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, n); + + glDeleteTextures( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4) + ); + return Success; +} + +int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLuint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); + glGenTextures( + *(GLsizei *)(pc + 0), + (GLuint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, n); + __GLX_BEGIN_REPLY(n*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(n); + return Success; +} + +int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) +{ + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + + retval = + glIsTexture( + *(GLuint *)(pc + 0) + ); + __GLX_PUT_RETVAL(retval); + __GLX_SWAP_REPLY_RETVAL(); + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + return Success; +} + +int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLboolean answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { @@ -1512,7 +2074,7 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = - glAreTexturesResident( + glAreTexturesResidentEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLboolean *) answer @@ -1526,7 +2088,7 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; @@ -1544,14 +2106,14 @@ int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); - glDeleteTextures( + glDeleteTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4) ); return Success; } -int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; @@ -1571,7 +2133,7 @@ int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); - glGenTextures( + glGenTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *) answer ); @@ -1583,7 +2145,7 @@ int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; @@ -1600,7 +2162,7 @@ int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(pc + 0); retval = - glIsTexture( + glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); diff --git a/xc/programs/Xserver/GL/glx/global.c b/xc/programs/Xserver/GL/glx/global.c index 5a7ae7ff9..f56c52eae 100644 --- a/xc/programs/Xserver/GL/glx/global.c +++ b/xc/programs/Xserver/GL/glx/global.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/global.c,v 1.2 1999/06/14 07:31:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/global.c,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ #define NEED_REPLIES diff --git a/xc/programs/Xserver/GL/glx/glxbuf.c b/xc/programs/Xserver/GL/glx/glxbuf.c index 6c42e588a..87a4c7b45 100644 --- a/xc/programs/Xserver/GL/glx/glxbuf.c +++ b/xc/programs/Xserver/GL/glx/glxbuf.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxbuf.c,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ #include "glxserver.h" @@ -65,7 +80,7 @@ __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes) } } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; @@ -134,7 +149,7 @@ __glXPixInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes) } } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; @@ -189,7 +204,7 @@ __glXResizeBuffers(__GLdrawablePrivate *glPriv, __GLX_SET_ACCEL_BUFFER_MASK(__GL_BACK_BUFFER_MASK); } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; @@ -250,7 +265,7 @@ __glXFreeBuffers(__GLXdrawablePrivate *glxPriv) (*glPriv->backBuffer.free)(&glPriv->backBuffer, glPriv); } -#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) +#if __GL_MAX_AUXBUFFERS > 0 if (modes->maxAuxBuffers > 0) { GLint i; diff --git a/xc/programs/Xserver/GL/glx/glxbuf.h b/xc/programs/Xserver/GL/glx/glxbuf.h index 05cea4a44..e81aebcf9 100644 --- a/xc/programs/Xserver/GL/glx/glxbuf.h +++ b/xc/programs/Xserver/GL/glx/glxbuf.h @@ -1,26 +1,41 @@ #ifndef _glxbuf_h_ #define _glxbuf_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.h,v 1.2 1999/06/14 07:31:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxbuf.h,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ extern void __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, diff --git a/xc/programs/Xserver/GL/glx/glxcmds.c b/xc/programs/Xserver/GL/glx/glxcmds.c index 64b28a206..a622c15d4 100644 --- a/xc/programs/Xserver/GL/glx/glxcmds.c +++ b/xc/programs/Xserver/GL/glx/glxcmds.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.5 2000/06/17 00:03:12 martin Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.3.42.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxcmds.c,v 1.3.42.1 2001/02/15 04:14:23 gareth Exp $ */ #define NEED_REPLIES @@ -32,6 +47,7 @@ #include "glximports.h" #include "glxutil.h" #include "glxext.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -43,12 +59,14 @@ static __GLimports imports = { __glXImpWarning, __glXImpFatal, __glXImpGetenv, + __glXImpAtoi, __glXImpSprintf, __glXImpFopen, __glXImpFclose, __glXImpFprintf, __glXImpGetDrawablePrivate, NULL, + NULL }; /************************************************************************/ diff --git a/xc/programs/Xserver/GL/glx/glxcmdsswap.c b/xc/programs/Xserver/GL/glx/glxcmdsswap.c index 6437c2938..e22873285 100644 --- a/xc/programs/Xserver/GL/glx/glxcmdsswap.c +++ b/xc/programs/Xserver/GL/glx/glxcmdsswap.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ #define NEED_REPLIES @@ -31,6 +46,7 @@ #include <pixmapstr.h> #include <windowstr.h> #include "glxext.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -763,7 +779,7 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { - (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req); + (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); return Success; } cl->client->errorValue = req->vendorCode; @@ -785,7 +801,7 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { - return (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req); + return (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); } cl->client->errorValue = req->vendorCode; return __glXUnsupportedPrivateRequest; diff --git a/xc/programs/Xserver/GL/glx/glxcontext.h b/xc/programs/Xserver/GL/glx/glxcontext.h index c3e353fc7..2e5a2ce2f 100644 --- a/xc/programs/Xserver/GL/glx/glxcontext.h +++ b/xc/programs/Xserver/GL/glx/glxcontext.h @@ -1,26 +1,41 @@ #ifndef _GLX_context_h_ #define _GLX_context_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxcontext.h,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ typedef struct __GLXcontextRec __GLXcontext; diff --git a/xc/programs/Xserver/GL/glx/glxdrawable.h b/xc/programs/Xserver/GL/glx/glxdrawable.h index 89fe4dbcb..7b32f3a37 100644 --- a/xc/programs/Xserver/GL/glx/glxdrawable.h +++ b/xc/programs/Xserver/GL/glx/glxdrawable.h @@ -1,26 +1,41 @@ #ifndef _GLX_drawable_h_ #define _GLX_drawable_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ typedef struct { @@ -76,7 +91,7 @@ struct __GLXdrawablePrivateRec { GLboolean (*swapBuffers)(struct __GLXdrawablePrivateRec *); /* - ** The GL drawable (information shared between GLX and the GL core + ** The GL drawable (information shared between GLX and the GL core) */ __GLdrawablePrivate glPriv; diff --git a/xc/programs/Xserver/GL/glx/glxerror.h b/xc/programs/Xserver/GL/glx/glxerror.h index d6adf95a6..9874d079d 100644 --- a/xc/programs/Xserver/GL/glx/glxerror.h +++ b/xc/programs/Xserver/GL/glx/glxerror.h @@ -1,26 +1,41 @@ #ifndef _GLX_error_h_ #define _GLX_error_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxerror.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxerror.h,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxext.c b/xc/programs/Xserver/GL/glx/glxext.c index 240a8cba5..07eb51e54 100644 --- a/xc/programs/Xserver/GL/glx/glxext.c +++ b/xc/programs/Xserver/GL/glx/glxext.c @@ -16,7 +16,8 @@ ** Those portions of the Subject Software created by Silicon Graphics, Inc. ** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. ** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.4.8.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxext.c,v 1.1.1.4.8.1 2001/02/15 04:14:23 gareth Exp $ */ #define NEED_REPLIES @@ -216,7 +217,7 @@ GLboolean __glXErrorOccured(void) */ void GlxExtensionInit(void) { - ExtensionEntry *extEntry, *AddExtension(); + ExtensionEntry *extEntry; int i; #ifdef X11R5 diff --git a/xc/programs/Xserver/GL/glx/glxext.h b/xc/programs/Xserver/GL/glx/glxext.h index 543eefcd6..a186f403c 100644 --- a/xc/programs/Xserver/GL/glx/glxext.h +++ b/xc/programs/Xserver/GL/glx/glxext.h @@ -1,46 +1,64 @@ #ifndef _glxext_h_ #define _glxext_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.3 1999/06/14 07:31:27 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxext.h,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ +/* + * Added by VA Linux for XFree86 4.0.x + */ typedef struct { int type; void (*resetExtension)(void); Bool (*initVisuals)( - VisualPtr * visualp, - DepthPtr * depthp, - int * nvisualp, - int * ndepthp, - int * rootDepthp, - VisualID * defaultVisp, - unsigned long sizes, - int bitsPerRGB - ); + VisualPtr * visualp, + DepthPtr * depthp, + int * nvisualp, + int * ndepthp, + int * rootDepthp, + VisualID * defaultVisp, + unsigned long sizes, + int bitsPerRGB + ); void (*setVisualConfigs)( - int nconfigs, - __GLXvisualConfig *configs, - void **privates - ); + int nconfigs, + __GLXvisualConfig *configs, + void **privates + ); } __GLXextensionInfo; extern GLboolean __glXFreeContext(__GLXcontext *glxc); @@ -56,14 +74,12 @@ extern void __glXResetLargeCommandStatus(__GLXclientState*); extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); -extern Bool __glXCoreType(void); extern void GlxExtensionInit(void); -extern void GlxSetVisualConfigs( - int nconfigs, - __GLXvisualConfig *configs, - void **privates -); + +extern Bool __glXCoreType(void); + extern int GlxInitVisuals( +#if NeedFunctionPrototypes VisualPtr * visualp, DepthPtr * depthp, int * nvisualp, @@ -73,6 +89,7 @@ extern int GlxInitVisuals( unsigned long sizes, int bitsPerRGB, int preferredVis +#endif ); #endif /* _glxext_h_ */ diff --git a/xc/programs/Xserver/GL/glx/glxfb.c b/xc/programs/Xserver/GL/glx/glxfb.c index 67ea31434..2a6450820 100644 --- a/xc/programs/Xserver/GL/glx/glxfb.c +++ b/xc/programs/Xserver/GL/glx/glxfb.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.c,v 1.2 1999/06/14 07:31:27 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:23 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxfb.c,v 1.1.1.3.18.1 2001/02/15 04:14:23 gareth Exp $ */ /* @@ -30,7 +45,7 @@ #include <gcstruct.h> -/* can't include glmath.h */ +/* so we don't include glmath.h */ extern GLuint __glFloorLog2(GLuint); typedef struct __GLFBbufferInfoRec { diff --git a/xc/programs/Xserver/GL/glx/glxfb.h b/xc/programs/Xserver/GL/glx/glxfb.h index 9b6022591..47be6fe90 100644 --- a/xc/programs/Xserver/GL/glx/glxfb.h +++ b/xc/programs/Xserver/GL/glx/glxfb.h @@ -1,26 +1,41 @@ #ifndef _glxfb_h_ #define _glxfb_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxfb.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ extern void __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glximports.c b/xc/programs/Xserver/GL/glx/glximports.c index 2dc836571..3bd9f1197 100644 --- a/xc/programs/Xserver/GL/glx/glximports.c +++ b/xc/programs/Xserver/GL/glx/glximports.c @@ -1,28 +1,44 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glximports.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #include "glxserver.h" #include "glxcontext.h" #include "glximports.h" +#include "GL/glx_ansic.h" void *__glXImpMalloc(__GLcontext *gc, size_t size) { @@ -105,6 +121,11 @@ char *__glXImpGetenv(__GLcontext *gc, const char *var) return __glXGetenv(var); } +int __glXImpAtoi(__GLcontext *gc, const char *str) +{ + return __glXAtoi(str); +} + int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) { va_list ap; diff --git a/xc/programs/Xserver/GL/glx/glximports.h b/xc/programs/Xserver/GL/glx/glximports.h index b6a1580c7..0a3e880c6 100644 --- a/xc/programs/Xserver/GL/glx/glximports.h +++ b/xc/programs/Xserver/GL/glx/glximports.h @@ -1,26 +1,41 @@ #ifndef _glximports_h_ #define _glximports_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glximports.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ extern void *__glXImpMalloc(__GLcontext *gc, size_t size); @@ -32,6 +47,7 @@ extern void __glXImpWarning(__GLcontext *gc, char *msg); extern void __glXImpFatal(__GLcontext *gc, char *msg); extern char *__glXImpGetenv(__GLcontext *gc, const char *var); +extern int __glXImpAtoi(__GLcontext *gc, const char *str); extern int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...); extern void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode); diff --git a/xc/programs/Xserver/GL/glx/glxmem.c b/xc/programs/Xserver/GL/glx/glxmem.c index 52a60f848..a7e02e335 100644 --- a/xc/programs/Xserver/GL/glx/glxmem.c +++ b/xc/programs/Xserver/GL/glx/glxmem.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxmem.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxmem.h b/xc/programs/Xserver/GL/glx/glxmem.h index 1c208a2f5..aec834253 100644 --- a/xc/programs/Xserver/GL/glx/glxmem.h +++ b/xc/programs/Xserver/GL/glx/glxmem.h @@ -1,26 +1,41 @@ #ifndef _glxmem_h_ #define _glxmem_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxmem.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ extern void __glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glxpix.c b/xc/programs/Xserver/GL/glx/glxpix.c index 8771bb0e0..a41893d34 100644 --- a/xc/programs/Xserver/GL/glx/glxpix.c +++ b/xc/programs/Xserver/GL/glx/glxpix.c @@ -1,23 +1,39 @@ /* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.4.8.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxpix.c,v 1.1.1.4.8.1 2001/02/15 04:14:24 gareth Exp $ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxpix.h b/xc/programs/Xserver/GL/glx/glxpix.h index 09a33a80a..f0e33bc4b 100644 --- a/xc/programs/Xserver/GL/glx/glxpix.h +++ b/xc/programs/Xserver/GL/glx/glxpix.h @@ -1,26 +1,41 @@ #ifndef _glxpix_h_ #define _glxpix_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxpix.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ extern void __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glxscreens.c b/xc/programs/Xserver/GL/glx/glxscreens.c index d68bca06e..e0494a0e3 100644 --- a/xc/programs/Xserver/GL/glx/glxscreens.c +++ b/xc/programs/Xserver/GL/glx/glxscreens.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.4 2000/06/17 00:03:12 martin Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.3.42.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxscreens.c,v 1.3.42.1 2001/02/15 04:14:24 gareth Exp $ */ #ifdef IN_MODULE @@ -32,6 +47,15 @@ #include "glxserver.h" #include "glxutil.h" +static char GLServerExtensions[] = + "GL_ARB_multitexture " + "GL_ARB_imaging " + "GL_EXT_abgr " + "GL_EXT_blend_color " + "GL_EXT_blend_minmax " + "GL_EXT_blend_subtract " + ; + /* ** We have made the simplifying assuption that the same extensions are ** supported across all screens in a multi-screen system. @@ -41,7 +65,8 @@ static char GLXServerVersion[] = "1.2"; static char GLXServerExtensions[] = "GLX_EXT_visual_info " "GLX_EXT_visual_rating " - "GLX_EXT_import_context "; + "GLX_EXT_import_context " + ; /* ** This comes from the GL library that the server will link with. Right @@ -259,6 +284,7 @@ void __glXScreenInit(GLint numscreens) #else __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; #endif + __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); diff --git a/xc/programs/Xserver/GL/glx/glxscreens.h b/xc/programs/Xserver/GL/glx/glxscreens.h index 771ecf866..e0fdfbf6c 100644 --- a/xc/programs/Xserver/GL/glx/glxscreens.h +++ b/xc/programs/Xserver/GL/glx/glxscreens.h @@ -1,30 +1,47 @@ #ifndef _GLX_screens_h_ #define _GLX_screens_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.2 1999/06/14 07:31:32 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxscreens.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #include "GL/internal/glcore.h" + + /* ** Screen dependent data. These methods are the interface between the DIX ** and DDX layers of the GLX server extension. The methods provide an @@ -58,6 +75,8 @@ typedef struct { GLint numVisuals; GLint numUsableVisuals; + char *GLextensions; + char *GLXvendor; char *GLXversion; char *GLXextensions; diff --git a/xc/programs/Xserver/GL/glx/glxserver.h b/xc/programs/Xserver/GL/glx/glxserver.h index 80a23ce1a..0ee0f722d 100644 --- a/xc/programs/Xserver/GL/glx/glxserver.h +++ b/xc/programs/Xserver/GL/glx/glxserver.h @@ -1,26 +1,41 @@ #ifndef _GLX_server_h_ #define _GLX_server_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.2 1999/06/14 07:31:32 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxserver.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #include <X11/X.h> @@ -42,6 +57,7 @@ #undef abs #undef fabs +#define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include <GL/gl.h> #include <GL/glxproto.h> #include <GL/glxint.h> @@ -110,7 +126,7 @@ struct __GLXclientStateRec { */ GLbyte *returnBuf; GLint returnBufSize; - + /* ** Keep track of large rendering commands, which span multiple requests. */ @@ -127,7 +143,7 @@ struct __GLXclientStateRec { */ __GLXcontext **currentContexts; GLint numCurrentContexts; - + /* Back pointer to X client record */ ClientPtr client; @@ -168,7 +184,7 @@ typedef struct { } __GLXrenderSizeData; extern __GLXrenderSizeData __glXRenderSizeTable[]; extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; - + /************************************************************************/ /* @@ -215,6 +231,15 @@ extern void glxSwapQueryServerStringReply(ClientPtr client, * Routines for computing the size of variably-sized rendering commands. */ +extern int __glXTypeSize(GLenum enm); +extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLint rowLength, GLint skipRows, GLint alignment); +extern int __glXImage3DSize(GLenum format, GLenum type, + GLsizei w, GLsizei h, GLsizei d, + GLint imageHeight, GLint rowLength, + GLint skipImages, GLint skipRows, + GLint alignment); + extern int __glXCallListsReqSize(GLbyte *pc, Bool swap); extern int __glXBitmapReqSize(GLbyte *pc, Bool swap); extern int __glXFogfvReqSize(GLbyte *pc, Bool swap); @@ -242,10 +267,28 @@ extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap); extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap); extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap); extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap); -extern int __glXTypeSize(GLenum enm); extern int __glXDrawArraysSize(GLbyte *pc, Bool swap); extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap); extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap); extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap); +extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ); +extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap); + +/* + * Routines for computing the size of returned data. + */ +extern int __glXConvolutionParameterivSize(GLenum pname); +extern int __glXConvolutionParameterfvSize(GLenum pname); +extern int __glXColorTableParameterfvSize(GLenum pname); +extern int __glXColorTableParameterivSize(GLenum pname); #endif /* !__GLX_server_h__ */ diff --git a/xc/programs/Xserver/GL/glx/glxutil.c b/xc/programs/Xserver/GL/glx/glxutil.c index c5d33d604..d486d9881 100644 --- a/xc/programs/Xserver/GL/glx/glxutil.c +++ b/xc/programs/Xserver/GL/glx/glxutil.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxutil.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES @@ -29,6 +44,7 @@ #include <windowstr.h> #include "glxutil.h" #include "glxbuf.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -200,8 +216,12 @@ __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config) modes->greenMask = config->greenMask; modes->blueMask = config->blueMask; modes->alphaMask = config->alphaMask; +#if 0 modes->rgbBits = modes->redBits + modes->greenBits + modes->blueBits + modes->alphaBits; +#endif + assert( !modes->rgbMode || ((config->bufferSize & 0x7) == 0) ); + modes->rgbBits = config->bufferSize; modes->indexBits = config->bufferSize; modes->accumRedBits = config->accumRedSize; @@ -234,8 +254,6 @@ LockDP(__GLdrawablePrivate *glPriv, __GLcontext *gc) /* some pending state. Deal with it */ if (glxc->pendingState & __GLX_PENDING_RESIZE) { - __GLXdrawablePrivate *glxPriv = glxc->glxPriv; - glxc->pendingState &= ~__GLX_PENDING_RESIZE; (*glci->exports.notifyResize)(gc); diff --git a/xc/programs/Xserver/GL/glx/glxutil.h b/xc/programs/Xserver/GL/glx/glxutil.h index d074d77ce..ded3bb238 100644 --- a/xc/programs/Xserver/GL/glx/glxutil.h +++ b/xc/programs/Xserver/GL/glx/glxutil.h @@ -1,26 +1,41 @@ #ifndef _glxcmds_h_ #define _glxcmds_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/glxutil.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ extern void __glXNop(void); diff --git a/xc/programs/Xserver/GL/glx/impsize.h b/xc/programs/Xserver/GL/glx/impsize.h index 597da569e..80f3083d9 100644 --- a/xc/programs/Xserver/GL/glx/impsize.h +++ b/xc/programs/Xserver/GL/glx/impsize.h @@ -1,26 +1,41 @@ #ifndef _impsize_h_ #define _impsize_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/impsize.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ /* @@ -31,6 +46,10 @@ ** replicate the code in here. */ extern int __glCallLists_size(GLsizei n, GLenum type); +extern int __glColorTableParameterfv_size(GLenum pname); +extern int __glColorTableParameteriv_size(GLenum pname); +extern int __glConvolutionParameterfv_size(GLenum pname); +extern int __glConvolutionParameteriv_size(GLenum pname); extern int __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h); extern int __glFogfv_size(GLenum pname); extern int __glFogiv_size(GLenum pname); @@ -47,7 +66,6 @@ extern int __glTexGenfv_size(GLenum e); extern int __glTexGeniv_size(GLenum pname); extern int __glTexParameterfv_size(GLenum e); extern int __glTexParameteriv_size(GLenum e); - extern int __glEvalComputeK(GLenum target); #endif /* _impsize_h_ */ diff --git a/xc/programs/Xserver/GL/glx/render2.c b/xc/programs/Xserver/GL/glx/render2.c index 01a57411d..fe3efe85e 100644 --- a/xc/programs/Xserver/GL/glx/render2.c +++ b/xc/programs/Xserver/GL/glx/render2.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/render2.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ /* #define NEED_REPLIES */ -#include "glxserver.h" +#include <glxserver.h> #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" extern GLint __glEvalComputeK(GLenum target); @@ -33,7 +49,7 @@ void __glXDisp_Map1f(GLbyte *pc) GLfloat u1, u2, *points; GLenum target; - target = *(GLenum *)(pc + 0); + target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); u1 = *(GLfloat *)(pc + 4); u2 = *(GLfloat *)(pc + 8); @@ -48,8 +64,8 @@ void __glXDisp_Map2f(GLbyte *pc) GLint uorder, vorder, ustride, vstride, k; GLfloat u1, u2, v1, v2, *points; GLenum target; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); u1 = *(GLfloat *)(pc + 4); @@ -169,7 +185,7 @@ void __glXDisp_DrawArrays(GLbyte *pc) GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); + stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); } pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); @@ -180,36 +196,36 @@ void __glXDisp_DrawArrays(GLbyte *pc) GLint numVals = compHeader[i].numVals; GLenum component = compHeader[i].component; - switch (component) { - case GL_VERTEX_ARRAY: + switch (component) { + case GL_VERTEX_ARRAY: glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: + break; + case GL_NORMAL_ARRAY: glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: + break; + case GL_COLOR_ARRAY: glEnableClientState(GL_COLOR_ARRAY); glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: + break; + case GL_INDEX_ARRAY: glEnableClientState(GL_INDEX_ARRAY); glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: + break; + case GL_TEXTURE_COORD_ARRAY: glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: + break; + case GL_EDGE_FLAG_ARRAY: glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - default: - break; + break; + default: + break; } - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); + pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); } glDrawArrays(primType, 0, numVertexes); @@ -222,3 +238,9 @@ void __glXDisp_DrawArrays(GLbyte *pc) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); } + +void __glXDisp_DrawArraysEXT(GLbyte *pc) +{ +#ifdef XXX_STUB +#endif /*XXX_STUB*/ +} diff --git a/xc/programs/Xserver/GL/glx/render2swap.c b/xc/programs/Xserver/GL/glx/render2swap.c index 040a24594..368d36709 100644 --- a/xc/programs/Xserver/GL/glx/render2swap.c +++ b/xc/programs/Xserver/GL/glx/render2swap.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/render2swap.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ /* #define NEED_REPLIES */ #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" extern GLint __glEvalComputeK(GLenum target); @@ -363,3 +379,9 @@ void __glXDispSwap_DrawArrays(GLbyte *pc) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); } + +void __glXDispSwap_DrawArraysEXT(GLbyte *pc) +{ +#ifdef XXX_STUB +#endif /*XXX_STUB*/ +} diff --git a/xc/programs/Xserver/GL/glx/renderpix.c b/xc/programs/Xserver/GL/glx/renderpix.c index bbaab81a9..e7521c697 100644 --- a/xc/programs/Xserver/GL/glx/renderpix.c +++ b/xc/programs/Xserver/GL/glx/renderpix.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/renderpix.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/renderpix.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" void __glXDisp_PolygonStipple(GLbyte *pc) { @@ -48,12 +64,12 @@ void __glXDisp_Bitmap(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glBitmap((GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLfloat) hdr->xorig, - (GLfloat) hdr->yorig, + glBitmap((GLsizei) hdr->width, + (GLsizei) hdr->height, + (GLfloat) hdr->xorig, + (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, - (GLfloat) hdr->ymove, + (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } @@ -68,13 +84,13 @@ void __glXDisp_TexImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLint) hdr->border, - hdr->format, - hdr->type, + (GLint) hdr->border, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -89,17 +105,35 @@ void __glXDisp_TexImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLint) hdr->border, - hdr->format, + (GLsizei) hdr->height, + (GLint) hdr->border, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } +void __glXDisp_TexImage3D(GLbyte *pc) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, + hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + void __glXDisp_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -111,9 +145,9 @@ void __glXDisp_DrawPixels(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glDrawPixels((GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + glDrawPixels((GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } @@ -129,12 +163,12 @@ void __glXDisp_TexSubImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLsizei) hdr->width, - hdr->format, - hdr->type, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -149,13 +183,126 @@ void __glXDisp_TexSubImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLint) hdr->yoffset, - (GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + (GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } + +void __glXDisp_TexSubImage3D(GLbyte *pc) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, + hdr->zoffset, hdr->width, hdr->height, hdr->depth, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDisp_ColorTable(GLbyte *pc) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorTable(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_ColorSubTable(GLbyte *pc) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, + hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDisp_ConvolutionFilter1D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter1D(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_ConvolutionFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_SeparableFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + GLint hdrlen, image1len; + + hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE); + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + /* XXX check this usage - internal code called + ** a version without the packing parameters + */ + image1len = __glXImageSize(hdr->format, hdr->type, hdr->width, 1, + hdr->rowLength, hdr->skipRows, hdr->alignment); + image1len = __GLX_PAD(image1len); + + glSeparableFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); +} diff --git a/xc/programs/Xserver/GL/glx/renderpixswap.c b/xc/programs/Xserver/GL/glx/renderpixswap.c index 51e96844e..90a06a2f4 100644 --- a/xc/programs/Xserver/GL/glx/renderpixswap.c +++ b/xc/programs/Xserver/GL/glx/renderpixswap.c @@ -1,29 +1,45 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" void __glXDispSwap_PolygonStipple(GLbyte *pc) { @@ -53,26 +69,26 @@ void __glXDispSwap_Bitmap(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove); __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove); - + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glBitmap((GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLfloat) hdr->xorig, - (GLfloat) hdr->yorig, + glBitmap((GLsizei) hdr->width, + (GLsizei) hdr->height, + (GLfloat) hdr->xorig, + (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, - (GLfloat) hdr->ymove, + (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } @@ -85,7 +101,7 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); @@ -94,7 +110,7 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -106,13 +122,13 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLint) hdr->border, - hdr->format, - hdr->type, + (GLint) hdr->border, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -125,7 +141,7 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); @@ -134,7 +150,7 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -146,17 +162,60 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLint) hdr->border, - hdr->format, + (GLsizei) hdr->height, + (GLint) hdr->border, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } +void __glXDispSwap_TexImage3D(GLbyte *pc) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->border); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, + hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + void __glXDispSwap_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -166,12 +225,12 @@ void __glXDispSwap_DrawPixels(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -183,9 +242,9 @@ void __glXDispSwap_DrawPixels(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glDrawPixels((GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + glDrawPixels((GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } @@ -199,14 +258,14 @@ void __glXDispSwap_TexSubImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -218,12 +277,12 @@ void __glXDispSwap_TexSubImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLsizei) hdr->width, - hdr->format, - hdr->type, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -236,7 +295,7 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); @@ -245,7 +304,7 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -257,13 +316,236 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLint) hdr->yoffset, - (GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + (GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } + +void __glXDispSwap_TexSubImage3D(GLbyte *pc) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->zoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, + hdr->zoffset, hdr->width, hdr->height, hdr->depth, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ColorTable(GLbyte *pc) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorTable(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ColorSubTable(GLbyte *pc) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->start); + __GLX_SWAP_INT((GLbyte *)&hdr->count); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, + hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, 1, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_SeparableFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + GLint hdrlen, image1len; + __GLX_DECLARE_SWAP_VARIABLES; + + hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + /* XXX check this usage - internal code called + ** a version without the packing parameters + */ + image1len = __glXImageSize(hdr->format, hdr->type, hdr->width, 1, + hdr->rowLength, hdr->skipRows, hdr->alignment); + image1len = __GLX_PAD(image1len); + + + glSeparableFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); +} diff --git a/xc/programs/Xserver/GL/glx/rensize.c b/xc/programs/Xserver/GL/glx/rensize.c index 484a16eab..30ae56005 100644 --- a/xc/programs/Xserver/GL/glx/rensize.c +++ b/xc/programs/Xserver/GL/glx/rensize.c @@ -1,28 +1,43 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/rensize.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ -#include "glxserver.h" #include <GL/gl.h> -#include <GL/glxproto.h> +#include "glxserver.h" +#include "GL/glxproto.h" #include "unpack.h" #include "impsize.h" @@ -64,7 +79,7 @@ int __glXLightfvReqSize(GLbyte *pc, Bool swap ) } return 4 * __glLightfv_size( pname ); /* defined in samplegl lib */ } - + int __glXLightivReqSize(GLbyte *pc, Bool swap ) { return __glXLightfvReqSize( pc, swap ); @@ -159,7 +174,7 @@ int __glXMap1dReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint order, k; - + target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); if (swap) { @@ -174,8 +189,8 @@ int __glXMap1fReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint order, k; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); if (swap) { target = SWAPL( target ); @@ -195,7 +210,7 @@ int __glXMap2dReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint uorder, vorder, k; - + target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); vorder = *(GLint *)(pc + 40); @@ -212,8 +227,8 @@ int __glXMap2fReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint uorder, vorder, k; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); if (swap) { @@ -250,19 +265,19 @@ int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap ) return 2 * mapsize; } -static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, - GLint rowLength, GLint skipRows, GLint alignment ) +int __glXImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, + GLint rowLength, GLint skipRows, GLint alignment ) { GLint bytesPerElement, elementsPerGroup, groupsPerRow; GLint groupSize, rowSize, padding; - + if (w < 0 || h < 0 || (type == GL_BITMAP && (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { return -1; } if (w==0 || h==0) return 0; - + if (type == GL_BITMAP) { if (rowLength > 0) { groupsPerRow = rowLength; @@ -276,23 +291,117 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, } return ((h + skipRows) * rowSize); } else { + switch(format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + elementsPerGroup = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elementsPerGroup = 1; + break; + case GL_LUMINANCE_ALPHA: + elementsPerGroup = 2; + break; + case GL_RGB: + case GL_BGR: + elementsPerGroup = 3; + break; + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + elementsPerGroup = 4; + break; + default: + return -1; + } switch(type) { case GL_UNSIGNED_BYTE: case GL_BYTE: bytesPerElement = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + bytesPerElement = 1; + elementsPerGroup = 1; + break; case GL_UNSIGNED_SHORT: case GL_SHORT: bytesPerElement = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + bytesPerElement = 2; + elementsPerGroup = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: bytesPerElement = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + bytesPerElement = 4; + elementsPerGroup = 1; + break; default: return -1; } + groupSize = bytesPerElement * elementsPerGroup; + if (rowLength > 0) { + groupsPerRow = rowLength; + } else { + groupsPerRow = w; + } + rowSize = groupsPerRow * groupSize; + padding = (rowSize % alignment); + if (padding) { + rowSize += alignment - padding; + } + return ((h + skipRows) * rowSize); + } +} + +/* XXX + * This should be folded into __glXImageSize(). + */ +int __glXImage3DSize( GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d, GLint imageHeight, GLint rowLength, + GLint skipImages, GLint skipRows, GLint alignment ) +{ + GLint bytesPerElement, elementsPerGroup, groupsPerRow; + GLint groupSize, rowSize, padding, imageSize; + + if (w < 0 || h < 0 || d < 0 || + (type == GL_BITMAP && + (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { + return -1; + } + if (w==0 || h==0 || d == 0) return 0; + + if (type == GL_BITMAP) { + if (rowLength > 0) { + groupsPerRow = rowLength; + } else { + groupsPerRow = w; + } + rowSize = (groupsPerRow + 7) >> 3; + padding = (rowSize % alignment); + if (padding) { + rowSize += alignment - padding; + } + return ((h + skipRows) * rowSize); + } else { switch(format) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: @@ -310,15 +419,55 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, elementsPerGroup = 2; break; case GL_RGB: + case GL_BGR: elementsPerGroup = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elementsPerGroup = 4; break; default: return -1; } + switch(type) { + case GL_UNSIGNED_BYTE: + case GL_BYTE: + bytesPerElement = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + bytesPerElement = 1; + elementsPerGroup = 1; + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + bytesPerElement = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + bytesPerElement = 2; + elementsPerGroup = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + bytesPerElement = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + bytesPerElement = 4; + elementsPerGroup = 1; + break; + default: + return -1; + } groupSize = bytesPerElement * elementsPerGroup; if (rowLength > 0) { groupsPerRow = rowLength; @@ -330,10 +479,16 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, if (padding) { rowSize += alignment - padding; } - return ((h + skipRows) * rowSize); + if (imageHeight > 0) { + imageSize = (imageHeight + skipRows) * rowSize; + } else { + imageSize = (h + skipRows) * rowSize; + } + return ((d + skipImages) * imageSize); } } + int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -350,11 +505,11 @@ int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); - rowLength = SWAPL( rowLength ); + rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); } int __glXBitmapReqSize(GLbyte *pc, Bool swap ) @@ -369,11 +524,11 @@ int __glXBitmapReqSize(GLbyte *pc, Bool swap ) if (swap) { w = SWAPL( w ); h = SWAPL( h ); - rowLength = SWAPL( rowLength ); + rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( GL_COLOR_INDEX, GL_BITMAP, w, h, + return __glXImageSize( GL_COLOR_INDEX, GL_BITMAP, w, h, rowLength, skipRows, alignment ); } @@ -402,7 +557,7 @@ int __glXTexImage1DReqSize(GLbyte *pc, Bool swap ) } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } - return ImageSize( format, type, w, 1, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, 1, rowLength, skipRows, alignment ); } int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) @@ -432,20 +587,21 @@ int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); } +/* XXX this is used elsewhere - should it be exported from glxserver.h? */ int __glXTypeSize(GLenum enm) { switch(enm) { - case GL_BYTE: return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: return sizeof(GLubyte); - case GL_SHORT: return sizeof(GLshort); - case GL_UNSIGNED_SHORT: return sizeof(GLushort); - case GL_INT: return sizeof(GLint); - case GL_UNSIGNED_INT: return sizeof(GLint); - case GL_FLOAT: return sizeof(GLfloat); - case GL_DOUBLE: return sizeof(GLdouble); + case GL_BYTE: return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: return sizeof(GLubyte); + case GL_SHORT: return sizeof(GLshort); + case GL_UNSIGNED_SHORT: return sizeof(GLushort); + case GL_INT: return sizeof(GLint); + case GL_UNSIGNED_INT: return sizeof(GLint); + case GL_FLOAT: return sizeof(GLfloat); + case GL_DOUBLE: return sizeof(GLdouble); default: return -1; } } @@ -478,32 +634,32 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) component = SWAPL( component ); } - switch (component) { - case GL_VERTEX_ARRAY: - case GL_COLOR_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - break; - case GL_NORMAL_ARRAY: - if (numVals != 3) { + switch (component) { + case GL_VERTEX_ARRAY: + case GL_COLOR_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + break; + case GL_NORMAL_ARRAY: + if (numVals != 3) { /* bad size */ - return -1; - } + return -1; + } break; - case GL_INDEX_ARRAY: - if (numVals != 1) { + case GL_INDEX_ARRAY: + if (numVals != 1) { /* bad size */ - return -1; - } - break; - case GL_EDGE_FLAG_ARRAY: - if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) { + return -1; + } + break; + case GL_EDGE_FLAG_ARRAY: + if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) { /* bad size or bad type */ return -1; - } - break; - default: - /* unknown component type */ - return -1; + } + break; + default: + /* unknown component type */ + return -1; } arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype)); @@ -512,7 +668,7 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) } return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) + - (numVertexes * arrayElementSize)); + (numVertexes * arrayElementSize)); } int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap ) @@ -541,7 +697,7 @@ int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap ) skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, 1, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, 1, rowLength, skipRows, alignment ); } int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) @@ -565,5 +721,280 @@ int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); +} + +int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint d = hdr->depth; + GLint imageHeight = hdr->imageHeight; + GLint rowLength = hdr->rowLength; + GLint skipImages = hdr->skipImages; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + GLint nullImage = hdr->nullimage; + + if (swap) { + target = SWAPL( target ); + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + d = SWAPL( d ); + imageHeight = SWAPL( imageHeight ); + rowLength = SWAPL( rowLength ); + skipImages = SWAPL( skipImages ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + if (target == GL_PROXY_TEXTURE_3D || nullImage) { + return 0; + } else { + return __glXImage3DSize( format, type, w, h, d, imageHeight, + rowLength, skipImages, skipRows, + alignment); + } +} + +int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint d = hdr->depth; + GLint imageHeight = hdr->imageHeight; + GLint rowLength = hdr->rowLength; + GLint skipImages = hdr->skipImages; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + + if (swap) { + target = SWAPL( target ); + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + d = SWAPL( d ); + imageHeight = SWAPL( imageHeight ); + rowLength = SWAPL( rowLength ); + skipImages = SWAPL( skipImages ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + if (target == GL_PROXY_TEXTURE_3D) { + return 0; + } else { + return __glXImage3DSize( format, type, w, h, d, imageHeight, + rowLength, skipImages, skipRows, + alignment); + } +} + +int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); +} + +int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint rowLength = hdr->rowLength; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + rowLength = SWAPL( rowLength ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, h, rowLength, skipRows, alignment ); +} + +int __glXConvolutionParameterivSize(GLenum pname) +{ + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + case GL_CONVOLUTION_BORDER_MODE: + return 1; + default: + return -1; + } +} + +int __glXConvolutionParameterfvSize(GLenum pname) +{ + return __glXConvolutionParameterivSize(pname); +} + +int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap ) +{ + GLenum pname = *(GLenum *)(pc + 4); + if (swap) { + pname = SWAPL( pname ); + } + return 4 * __glXConvolutionParameterivSize( pname ); +} + +int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap ) +{ + return __glXConvolutionParameterivReqSize( pc, swap ); +} + +int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLint image1size, image2size; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + /* XXX Should rowLength be used for either or both image? */ + image1size = __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); + image1size = __GLX_PAD(image1size); + image2size = __glXImageSize ( format, type, h, 1, rowLength, 0, alignment ); + return image1size + image2size; + +} + +int __glXColorTableParameterfvSize(GLenum pname) +{ + /* currently, only scale and bias are supported; return RGBA */ + switch(pname) { + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return 0; + } +} + +int __glXColorTableParameterivSize(GLenum pname) +{ + /* fv and iv are the same in this context */ + return __glXColorTableParameterfvSize(pname); +} + +int __glXColorTableReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + switch (target) { + case GL_PROXY_TEXTURE_1D: + case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_3D: + case GL_PROXY_COLOR_TABLE: + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + return 0; + } + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); +} + +int __glXColorSubTableReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint count = hdr->count; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + count = SWAPL( count ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, count, 1, rowLength, 0, alignment ); +} + +int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap ) +{ + GLenum pname = *(GLenum *)(pc + 4); + if (swap) { + pname = SWAPL( pname ); + } + return 4 * __glXColorTableParameterfvSize(pname); +} + +int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap ) +{ + /* no difference between fv and iv versions */ + return __glXColorTableParameterfvReqSize(pc, swap); } diff --git a/xc/programs/Xserver/GL/glx/rensizetab.c b/xc/programs/Xserver/GL/glx/rensizetab.c index 229fa3c30..d27c39ea9 100644 --- a/xc/programs/Xserver/GL/glx/rensizetab.c +++ b/xc/programs/Xserver/GL/glx/rensizetab.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/rensizetab.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #include "glxserver.h" @@ -216,14 +231,2058 @@ __GLXrenderSizeData __glXRenderSizeTable[] = { /* Translatef */ { 16, 0 }, /* Viewport */ { 20, 0 }, /* PolygonOffset */ { 12, 0 }, - /* DrawArrays */ { 16, __glXDrawArraysSize }, + /* no such opcode */ { 0, 0 }, /* Indexubv */ { 8, 0 }, + /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, + /* CopyColorSubTable */ { 24, 0 }, + /* ActiveTextureARB */ { 8, 0 }, + /* MultiTexCoord1dvARB */ { 16, 0 }, + /* MultiTexCoord1fvARB */ { 12, 0 }, + /* MultiTexCoord1ivARB */ { 12, 0 }, + /* MultiTexCoord1svARB */ { 12, 0 }, + /* MultiTexCoord2dvARB */ { 24, 0 }, + /* MultiTexCoord2fvARB */ { 16, 0 }, + /* MultiTexCoord2ivARB */ { 16, 0 }, + /* MultiTexCoord2svARB */ { 12, 0 }, + /* MultiTexCoord3dvARB */ { 32, 0 }, + /* MultiTexCoord3fvARB */ { 20, 0 }, + /* MultiTexCoord3ivARB */ { 20, 0 }, + /* MultiTexCoord3svARB */ { 16, 0 }, + /* MultiTexCoord4dvARB */ { 40, 0 }, + /* MultiTexCoord4fvARB */ { 24, 0 }, + /* MultiTexCoord4ivARB */ { 24, 0 }, + /* MultiTexCoord4svARB */ { 16, 0 }, }; __GLXrenderSizeData __glXRenderSizeTable_EXT[] = { - /* PolygonOffset */ { 12, 0 }, - /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize }, - /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize }, - /* no such opcode */ { 0, 0 }, + /* ColorTable */ { 44, __glXColorTableReqSize }, + /* ColorTableParameterfv */ { 12, __glXColorTableParameterfvReqSize }, + /* ColorTableParameteriv */ { 12, __glXColorTableParameterivReqSize }, + /* CopyColorTable */ { 24, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, @@ -238,11 +2297,32 @@ __GLXrenderSizeData __glXRenderSizeTable_EXT[] = { /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, + /* BlendColor */ { 20, 0 }, + /* BlendEquation */ { 8, 0 }, /* no such opcode */ { 0, 0 }, + /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize }, + /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize }, + /* ConvolutionFilter1D */ { 48, __glXConvolutionFilter1DReqSize }, + /* ConvolutionFilter2D */ { 48, __glXConvolutionFilter2DReqSize }, + /* ConvolutionParameterf */ { 16, 0 }, + /* ConvolutionParameterfv */ { 12, __glXConvolutionParameterfvReqSize }, + /* ConvolutionParameteri */ { 16, 0 }, + /* ConvolutionParameteriv */ { 12, __glXConvolutionParameterivReqSize }, + /* CopyConvolutionFilter1D */ { 24, }, + /* CopyConvolutionFilter2D */ { 28, }, + /* SeparableFilter2D */ { 48, __glXSeparableFilter2DReqSize }, + /* Histogram */ { 20, }, + /* Minmax */ { 16, }, + /* ResetHistogram */ { 8, }, + /* ResetMinmax */ { 8, }, + /* TexImage3D */ { 84, __glXTexImage3DReqSize }, + /* TexSubImage3D */ { 92, __glXTexSubImage3DReqSize }, + /* DrawArrays */ { 16, __glXDrawArraysSize }, /* BindTexture */ { 12, 0 }, /* PrioritizeTextures */ { 8, __glXPrioritizeTexturesReqSize }, /* CopyTexImage1D */ { 32, 0 }, /* CopyTexImage2D */ { 36, 0 }, /* CopyTexSubImage1D */ { 28, 0 }, /* CopyTexSubImage2D */ { 36, 0 }, + /* CopyTexSubImage3D */ { 40, 0 }, }; diff --git a/xc/programs/Xserver/GL/glx/single2.c b/xc/programs/Xserver/GL/glx/single2.c index d62c22a1b..ac4b85398 100644 --- a/xc/programs/Xserver/GL/glx/single2.c +++ b/xc/programs/Xserver/GL/glx/single2.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/single2.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" +#include "GL/glx_ansic.h" int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { @@ -186,7 +202,6 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; - ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -282,10 +297,9 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) __GLXcontext *cx; GLenum name; const char *string; - GLint length; int error; - GLubyte *answer; - char *buf; + char *buf = NULL, *buf1 = NULL; + GLint length = 0; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -297,26 +311,32 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) string = (const char *)glGetString(name); client = cl->client; - if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) { - buf = __glXcombine_strings(string, + /* + ** Restrict extensions to those that are supported by both the + ** implementation and the connection. That is, return the + ** intersection of client, server, and core extension strings. + */ + if (name == GL_EXTENSIONS) { + buf1 = __glXcombine_strings(string, cl->GLClientextensions); - } else { - buf = __glXMalloc(__glXStrlen(string) + 2); - __glXStrcpy(buf, string); + buf = __glXcombine_strings(buf1, + cx->pGlxScreen->GLextensions); + if (buf1 != NULL) { + __glXFree(buf1); + } + string = buf; } - if (!buf) { - length = 0; - __GLX_BEGIN_REPLY(0); - __GLX_PUT_SIZE(0); - } else { - length = __glXStrlen((const char *) buf) + 1; - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); + if (string) { + length = __glXStrlen((const char *) string) + 1; } + __GLX_BEGIN_REPLY(length); + __GLX_PUT_SIZE(length); __GLX_SEND_HEADER(); - WriteToClient(client, length, buf); - __glXFree(buf); + WriteToClient(client, length, (char *) string); + if (buf != NULL) { + __glXFree(buf); + } return Success; } diff --git a/xc/programs/Xserver/GL/glx/single2swap.c b/xc/programs/Xserver/GL/glx/single2swap.c index 3aa1af0f7..c3d67095f 100644 --- a/xc/programs/Xserver/GL/glx/single2swap.c +++ b/xc/programs/Xserver/GL/glx/single2swap.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/single2swap.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" +#include "GL/glx_ansic.h" int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { @@ -251,11 +267,11 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) __GLXcontext *cx; GLenum name; const char *string; - GLint length; __GLX_DECLARE_SWAP_VARIABLES; int error; GLubyte *answer; - char *buf; + char *buf = NULL, *buf1 = NULL; + GLint length = 0; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -269,28 +285,35 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) string = (const char *)glGetString(name); client = cl->client; - if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) { - buf = __glXcombine_strings(string, + /* + ** Restrict extensions to those that are supported by both the + ** implementation and the connection. That is, return the + ** intersection of client, server, and core extension strings. + */ + if (name == GL_EXTENSIONS) { + buf1 = __glXcombine_strings(string, cl->GLClientextensions); - } else { - buf = __glXMalloc(__glXStrlen(string) + 2); - __glXStrcpy(buf, string); + buf = __glXcombine_strings(buf1, + cx->pGlxScreen->GLextensions); + if (buf1 != NULL) { + __glXFree(buf1); + } + string = buf; } - if (!buf) { - length = 0; - __GLX_BEGIN_REPLY(0); - __GLX_PUT_SIZE(0); - } else { - length = __glXStrlen((const char *) buf) + 1; - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); + if (string) { + length = __glXStrlen((const char *) string) + 1; } - + + __GLX_BEGIN_REPLY(length); + __GLX_PUT_SIZE(length); + __GLX_SWAP_REPLY_SIZE(); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); - WriteToClient(client, length, buf); - __glXFree(buf); + WriteToClient(client, length, (char *) string); + if (buf != NULL) { + __glXFree(buf); + } return Success; } diff --git a/xc/programs/Xserver/GL/glx/singlepix.c b/xc/programs/Xserver/GL/glx/singlepix.c index 830bdd50c..82bc3a476 100644 --- a/xc/programs/Xserver/GL/glx/singlepix.c +++ b/xc/programs/Xserver/GL/glx/singlepix.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepix.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlepix.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) { @@ -57,7 +73,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glReadPixels( + glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), @@ -87,7 +103,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; - GLint width=0, height=0; + GLint width=0, height=0, depth=1; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -100,20 +116,23 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) type = *(GLenum *)(pc + 12); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 16); - + glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); + if ( target == GL_TEXTURE_3D) { + glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); + } /* - * The two queries above might fail if we're in a state where queries - * are illegal, but then width and height would still be zero anyway. + * The three queries above might fail if we're in a state where queries + * are illegal, but then width, height, and depth would still be zero anyway. */ - compsize = __glGetTexImage_size(target,level,format,type,width,height); + compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) compsize = 0; - + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glGetTexImage( + glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), @@ -128,6 +147,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; + ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } @@ -147,17 +167,18 @@ int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) if (!cx) { return error; } + pc += __GLX_SINGLE_HDR_SIZE; lsbFirst = *(GLboolean *)(pc + 0); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); - + __glXClearErrorOccured(); - glGetPolygonStipple( + glGetPolygonStipple( (GLubyte *) answer ); - + if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); @@ -169,4 +190,270 @@ int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize, compsize2; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + /* target must be SEPARABLE_2D, however I guess we can let the GL + barf on this one.... */ + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); + + if (compsize < 0) compsize = 0; + if (compsize2 < 0) compsize2 = 0; + compsize = __GLX_PAD(compsize); + compsize2 = __GLX_PAD(compsize2); + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __glXClearErrorOccured(); + glGetSeparableFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer, + answer + compsize, + NULL + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize + compsize2); + ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; + ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize + compsize2); + } + + return Success; +} + +int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + if (target == GL_CONVOLUTION_1D) { + height = 1; + } else { + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + } + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,height,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetConvolutionFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; + ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetHistogram( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetHistogramReply *)&__glXReply)->width = width; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + compsize = __glGetTexImage_size(target,1,format,type,2,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetMinmax( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + target = *(GLenum *)(pc + 0); + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + swapBytes = *(GLboolean *)(pc + 12); + + glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetColorTableReply *)&__glXReply)->width = width; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} diff --git a/xc/programs/Xserver/GL/glx/singlepixswap.c b/xc/programs/Xserver/GL/glx/singlepixswap.c index 39ca57ef4..dedcd38a7 100644 --- a/xc/programs/Xserver/GL/glx/singlepixswap.c +++ b/xc/programs/Xserver/GL/glx/singlepixswap.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES @@ -26,6 +41,7 @@ #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) { @@ -66,7 +82,7 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glReadPixels( + glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), @@ -99,7 +115,7 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; - GLint width=0, height=0; + GLint width=0, height=0, depth=1; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -121,17 +137,20 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); + if ( target == GL_TEXTURE_3D) { + glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); + } /* - * The two queries above might fail if we're in a state where queries - * are illegal, but then width and height would still be zero anyway. + * The three queries above might fail if we're in a state where queries + * are illegal, but then width, height, and depth would still be zero anyway. */ - compsize = __glGetTexImage_size(target,level,format,type,width,height); + compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) compsize = 0; - + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glGetTexImage( + glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), @@ -148,8 +167,10 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); + __GLX_SWAP_INT(&depth); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; + ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } @@ -176,9 +197,9 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); - + __glXClearErrorOccured(); - glGetPolygonStipple( + glGetPolygonStipple( (GLubyte *) answer ); if (__glXErrorOccured()) { @@ -193,3 +214,302 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) } return Success; } + +int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize, compsize2; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + /* target must be SEPARABLE_2D, however I guess we can let the GL + barf on this one.... */ + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); + + if (compsize < 0) compsize = 0; + if (compsize2 < 0) compsize2 = 0; + compsize = __GLX_PAD(compsize); + compsize2 = __GLX_PAD(compsize2); + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __glXClearErrorOccured(); + glGetSeparableFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer, + answer + compsize, + NULL + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize + compsize2); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + __GLX_SWAP_INT(&height); + ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; + ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; + __GLX_SEND_VOID_ARRAY(compsize + compsize2); + } + + return Success; +} + +int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + if (target == GL_CONVOLUTION_2D) { + height = 1; + } else { + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + } + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,height,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetConvolutionFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + __GLX_SWAP_INT(&height); + ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; + ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetHistogram( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + ((xGLXGetHistogramReply *)&__glXReply)->width = width; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + compsize = __glGetTexImage_size(target,1,format,type,2,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetMinmax( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + ((xGLXGetColorTableReply *)&__glXReply)->width = width; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} diff --git a/xc/programs/Xserver/GL/glx/singlesize.c b/xc/programs/Xserver/GL/glx/singlesize.c index 1cff4c3a7..1deeb6d04 100644 --- a/xc/programs/Xserver/GL/glx/singlesize.c +++ b/xc/programs/Xserver/GL/glx/singlesize.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.2 1999/06/14 07:31:35 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlesize.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #include <GL/gl.h> @@ -34,8 +49,8 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) { GLint elements, esize; GLint rowsize, padding; - - if (w < 0 || h < 0) { + + if (w < 0 || h < 0) { return -1; } switch (format) { @@ -55,9 +70,11 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) elements = 2; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; @@ -71,7 +88,7 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) */ switch (type) { case GL_BITMAP: - if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { + if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { rowsize = ((w * elements)+7)/8; padding = rowsize % 4; if (padding) { @@ -85,15 +102,36 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return -1; } @@ -151,11 +189,10 @@ GLint __glGetTexParameterfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_WRAP_S: - return 1; case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: return 1; case GL_TEXTURE_MIN_FILTER: - return 1; case GL_TEXTURE_MAG_FILTER: return 1; case GL_TEXTURE_BORDER_COLOR: @@ -163,7 +200,12 @@ GLint __glGetTexParameterfv_size(GLenum pname) case GL_TEXTURE_PRIORITY: return 1; case GL_TEXTURE_RESIDENT: - return 1; + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; default: return -1; @@ -184,7 +226,7 @@ GLint __glGetLightfv_size(GLenum pname) return 4; case GL_SPECULAR: return 4; - case GL_POSITION: + case GL_POSITION: return 4; case GL_SPOT_DIRECTION: return 3; @@ -236,7 +278,7 @@ static GLint EvalComputeK(GLenum target) } return 0; } - + GLint __glGetMap_size(GLenum target, GLenum query) { GLint k, order=0, majorMinor[2]; @@ -342,7 +384,7 @@ GLint __glGetPixelMap_size(GLenum map) { GLint size; GLenum query; - + switch (map) { case GL_PIXEL_MAP_I_TO_I: query = GL_PIXEL_MAP_I_TO_I_SIZE; @@ -454,9 +496,13 @@ GLint __glGet_size(GLenum sq) case GL_POINT_SIZE: return 1; case GL_POINT_SIZE_RANGE: + /* case GL_SMOOTH_POINT_SIZE_RANGE: */ /* alias */ return 2; case GL_POINT_SIZE_GRANULARITY: + /* case GL_SMOOTH_POINT_SIZE_GRANULARITY: */ /* alias */ return 1; + case GL_ALIASED_POINT_SIZE_RANGE: + return 2; case GL_POINT_SMOOTH: return 1; case GL_LINE_SMOOTH: @@ -464,9 +510,13 @@ GLint __glGet_size(GLenum sq) case GL_LINE_WIDTH: return 1; case GL_LINE_WIDTH_RANGE: + /* case GL_SMOOTH_LINE_WIDTH_RANGE: */ /* alias */ return 2; case GL_LINE_WIDTH_GRANULARITY: + /* case GL_SMOOTH_LINE_WIDTH_GRANULARITY: */ /* alias */ return 1; + case GL_ALIASED_LINE_WIDTH_RANGE: + return 2; case GL_LINE_STIPPLE_PATTERN: return 1; case GL_LINE_STIPPLE_REPEAT: @@ -495,6 +545,8 @@ GLint __glGet_size(GLenum sq) return 1; case GL_LIGHT_MODEL_AMBIENT: return 4; + case GL_LIGHT_MODEL_COLOR_CONTROL: + return 1; case GL_COLOR_MATERIAL: return 1; case GL_COLOR_MATERIAL_FACE: @@ -637,10 +689,14 @@ GLint __glGet_size(GLenum sq) return 1; case GL_PACK_ROW_LENGTH: return 1; + case GL_PACK_IMAGE_HEIGHT: + return 1; case GL_PACK_SKIP_ROWS: return 1; case GL_PACK_SKIP_PIXELS: return 1; + case GL_PACK_SKIP_IMAGES: + return 1; case GL_PACK_ALIGNMENT: return 1; case GL_UNPACK_SWAP_BYTES: @@ -649,10 +705,14 @@ GLint __glGet_size(GLenum sq) return 1; case GL_UNPACK_ROW_LENGTH: return 1; + case GL_UNPACK_IMAGE_HEIGHT: + return 1; case GL_UNPACK_SKIP_ROWS: return 1; case GL_UNPACK_SKIP_PIXELS: return 1; + case GL_UNPACK_SKIP_IMAGES: + return 1; case GL_UNPACK_ALIGNMENT: return 1; case GL_MAP_COLOR: @@ -678,11 +738,11 @@ GLint __glGet_size(GLenum sq) case GL_ZOOM_X: case GL_ZOOM_Y: return 1; - case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: - case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: - case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: - case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: - case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: + case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: + case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: + case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: + case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: + case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: return 1; case GL_MAX_EVAL_ORDER: return 1; @@ -731,17 +791,18 @@ GLint __glGet_size(GLenum sq) return 2; case GL_TEXTURE_1D: case GL_TEXTURE_2D: + case GL_TEXTURE_3D: return 1; case GL_NAME_STACK_DEPTH: return 1; case GL_MAX_VIEWPORT_DIMS: - return 2; + return 2; case GL_DOUBLEBUFFER: - return 1; + return 1; case GL_AUX_BUFFERS: - return 1; + return 1; case GL_STEREO: - return 1; + return 1; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: @@ -774,14 +835,56 @@ GLint __glGet_size(GLenum sq) return 1; case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: return 1; - case GL_BLEND_COLOR_EXT: + case GL_BLEND_COLOR: return 4; - case GL_BLEND_EQUATION_EXT: + case GL_BLEND_EQUATION: + return 1; + case GL_COLOR_MATRIX: + return 16; + case GL_COLOR_MATRIX_STACK_DEPTH: + return 1; + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + case GL_CONVOLUTION_1D: + case GL_CONVOLUTION_2D: + case GL_SEPARABLE_2D: + case GL_HISTOGRAM: + case GL_MINMAX: return 1; case GL_POLYGON_OFFSET_FACTOR: case GL_POLYGON_OFFSET_UNITS: return 1; + case GL_POST_CONVOLUTION_RED_SCALE: + case GL_POST_CONVOLUTION_GREEN_SCALE: + case GL_POST_CONVOLUTION_BLUE_SCALE: + case GL_POST_CONVOLUTION_ALPHA_SCALE: + case GL_POST_CONVOLUTION_RED_BIAS: + case GL_POST_CONVOLUTION_GREEN_BIAS: + case GL_POST_CONVOLUTION_BLUE_BIAS: + case GL_POST_CONVOLUTION_ALPHA_BIAS: + return 1; + case GL_POST_COLOR_MATRIX_RED_SCALE: + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + case GL_POST_COLOR_MATRIX_RED_BIAS: + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + return 1; + case GL_RESCALE_NORMAL: + return 1; + case GL_ACTIVE_TEXTURE_ARB: + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + case GL_MAX_TEXTURE_UNITS_ARB: + return 1; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH: + case GL_MAX_CONVOLUTION_WIDTH: + case GL_MAX_CONVOLUTION_HEIGHT: + return 1; default: return -1; } @@ -812,6 +915,7 @@ GLint __glGetTexLevelParameterfv_size(GLenum pname) switch (pname) { case GL_TEXTURE_WIDTH: case GL_TEXTURE_HEIGHT: + case GL_TEXTURE_DEPTH: case GL_TEXTURE_COMPONENTS: case GL_TEXTURE_BORDER: case GL_TEXTURE_RED_SIZE: @@ -832,17 +936,19 @@ GLint __glGetTexLevelParameteriv_size(GLenum pname) } GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, - GLenum type, GLint width, GLint height) + GLenum type, GLint width, GLint height, GLint depth) { GLint elements, esize; GLint padding, rowsize; switch (format) { case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RED: @@ -863,15 +969,36 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return -1; } @@ -885,5 +1012,95 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, if (padding) { rowsize += 4 - padding; } - return (rowsize * height); + return (rowsize * height * depth); } + +GLint __glGetConvolutionParameteriv_size(GLenum pname) +{ + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + case GL_CONVOLUTION_BORDER_MODE: + case GL_CONVOLUTION_FORMAT: + case GL_CONVOLUTION_WIDTH: + case GL_CONVOLUTION_HEIGHT: + case GL_MAX_CONVOLUTION_WIDTH: + case GL_MAX_CONVOLUTION_HEIGHT: + return 1; + default: + return -1; + } +} + +GLint __glGetConvolutionParameterfv_size(GLenum pname) +{ + return __glGetConvolutionParameteriv_size(pname); +} + + +GLint __glGetHistogramParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_HISTOGRAM_WIDTH: + case GL_HISTOGRAM_FORMAT: + case GL_HISTOGRAM_RED_SIZE: + case GL_HISTOGRAM_GREEN_SIZE: + case GL_HISTOGRAM_BLUE_SIZE: + case GL_HISTOGRAM_ALPHA_SIZE: + case GL_HISTOGRAM_LUMINANCE_SIZE: + case GL_HISTOGRAM_SINK: + return 1; + default: + return -1; + } +} + +GLint __glGetHistogramParameteriv_size(GLenum pname) +{ + return __glGetHistogramParameterfv_size(pname); +} + +GLint __glGetMinmaxParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_MINMAX_FORMAT: + case GL_MINMAX_SINK: + return 1; + default: + return -1; + } +} + +GLint __glGetMinmaxParameteriv_size(GLenum pname) +{ + return __glGetMinmaxParameterfv_size(pname); +} + +GLint __glGetColorTableParameterfv_size(GLenum pname) +{ + switch(pname) { + + case GL_COLOR_TABLE_SCALE: /* return RGBA */ + case GL_COLOR_TABLE_BIAS: + return 4; + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + default: + return 0; + } +} + +GLint __glGetColorTableParameteriv_size(GLenum pname) +{ + return __glGetColorTableParameterfv_size(pname); +} + diff --git a/xc/programs/Xserver/GL/glx/singlesize.h b/xc/programs/Xserver/GL/glx/singlesize.h index 97381639a..4693e5962 100644 --- a/xc/programs/Xserver/GL/glx/singlesize.h +++ b/xc/programs/Xserver/GL/glx/singlesize.h @@ -1,26 +1,41 @@ #ifndef _singlesize_h_ #define _singlesize_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/singlesize.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ extern GLint __glReadPixels_size(GLenum format, GLenum type, @@ -52,7 +67,16 @@ extern GLint __glGetBooleanv_size(GLenum sq); extern GLint __glGetTexLevelParameterfv_size(GLenum pname); extern GLint __glGetTexLevelParameteriv_size(GLenum pname); extern GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, - GLenum type, GLint width, GLint height); + GLenum type, GLint width, GLint height, + GLint depth); +extern GLint __glGetColorTableParameterfv_size(GLenum pname); +extern GLint __glGetColorTableParameteriv_size(GLenum pname); +extern GLint __glGetConvolutionParameterfv_size(GLenum pname); +extern GLint __glGetConvolutionParameteriv_size(GLenum pname); +extern GLint __glGetHistogramParameterfv_size(GLenum pname); +extern GLint __glGetHistogramParameteriv_size(GLenum pname); +extern GLint __glGetMinmaxParameterfv_size(GLenum pname); +extern GLint __glGetMinmaxParameteriv_size(GLenum pname); #endif /* _singlesize_h_ */ diff --git a/xc/programs/Xserver/GL/glx/unpack.h b/xc/programs/Xserver/GL/glx/unpack.h index 80a805aab..971e4b047 100644 --- a/xc/programs/Xserver/GL/glx/unpack.h +++ b/xc/programs/Xserver/GL/glx/unpack.h @@ -1,26 +1,41 @@ #ifndef __GLX_unpack_h__ #define __GLX_unpack_h__ -/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/unpack.h,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define __GLX_PAD(s) (((s)+3) & (GLuint)~3) @@ -41,7 +56,7 @@ #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) #endif -extern void __glXMemInit(); +extern void __glXMemInit(void); extern xGLXSingleReply __glXReply; @@ -134,6 +149,7 @@ extern xGLXSingleReply __glXReply; GLbyte *swapPC; \ GLbyte *swapEnd + #define __GLX_SWAP_INT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ diff --git a/xc/programs/Xserver/GL/glx/xfont.c b/xc/programs/Xserver/GL/glx/xfont.c index 8bf6e8116..e12ae4be1 100644 --- a/xc/programs/Xserver/GL/glx/xfont.c +++ b/xc/programs/Xserver/GL/glx/xfont.c @@ -1,23 +1,38 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/xfont.c,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:24 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/glx/xfont.c,v 1.1.1.3.18.1 2001/02/15 04:14:24 gareth Exp $ */ #define NEED_REPLIES diff --git a/xc/programs/Xserver/GL/include/GL/glx_ansic.h b/xc/programs/Xserver/GL/include/GL/glx_ansic.h index e6ccd3a2f..8744547ce 100644 --- a/xc/programs/Xserver/GL/include/GL/glx_ansic.h +++ b/xc/programs/Xserver/GL/include/GL/glx_ansic.h @@ -1,26 +1,41 @@ #ifndef _glx_ansic_h_ #define _glx_ansic_h_ -/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.3 1999/07/11 08:49:18 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2001/02/15 04:14:25 $ $Revision: 1.1.1.3.18.1 $ +** $Header: /home/ajax/dri-backup/xc/xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.1.1.3.18.1 2001/02/15 04:14:25 gareth Exp $ */ /* @@ -37,18 +52,13 @@ ** tree and all should be taken care of. */ -#ifdef XFree86Server +#ifdef XF86 #include <xf86Version.h> #define XF_Minimum_Version ( (3 * 10) + (9) ) #define XF_Version ( (XF86_VERSION_MAJOR * 10) + (XF86_VERSION_MINOR) ) #endif -#if defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version) -#include "xf86_ansic.h" -#else -#endif - -#if 0 && defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version) +#if XF86 && ( XF_Version >= XF_Minimum_Version) #include "xf86Module.h" @@ -99,6 +109,8 @@ #define __glXStrtok(s, delim) xf86strtok(s, delim) #define __glXStrcspn(s, reject) xf86strcspn(s, reject) #define __glXGetenv(a) xf86getenv(a) +#define __glXAtoi(a) xf86atoi(a) + #ifndef assert #define assert(a) @@ -110,19 +122,6 @@ ** Either not a loadable module, or pre X3.9 */ -/* assert() is named __assert() in the LynxOS libc. We might get - * unresolved externals if we #undef assert and include assert.h - * if assert.h was already included on our way here.... - */ -#if defined(Lynx) && defined(__assert_h) -#undef __assert_h -#endif - -#ifdef assert -#undef assert -#endif - -#include <assert.h> #define GLX_STDOUT stdout #define GLX_STDERR stderr @@ -157,6 +156,7 @@ #define __glXStrtok(s, delim) strtok(s, delim) #define __glXStrcspn(s, reject) strcspn(s, reject) #define __glXGetenv(a) getenv(a) +#define __glXAtoi(a) atoi(a) #endif diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index b818c9b65..ecf3dbdb1 100644 --- a/xc/programs/Xserver/Imakefile +++ b/xc/programs/Xserver/Imakefile @@ -662,7 +662,8 @@ XF86SERVERSYSLIBS = $(FONTLIBS) $(SYSLIBS) $(LIBDL) $(LIBREGEX) #endif XF86SERVEROBJS = $(XF86DRVOBJS) $(XF86IDRVOBJS) XF86SERVERLIBS = $(XF86DRVLIBS) $(XF86IDRVLIBS) $(XF86LIBS) $(XF86LOADERLIB) \ - $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) + $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) \ + $(XF86DDCLIB) #if HasParallelMake MakeMutex($(XF86SERVERSUBDIRS) $(XF86SERVERLIBS) $(XF86SERVERSYSLIBS)) #endif diff --git a/xc/programs/Xserver/hw/kdrive/trident/trident.c b/xc/programs/Xserver/hw/kdrive/trident/trident.c index 6f7e8ae7d..88f797b7f 100644 --- a/xc/programs/Xserver/hw/kdrive/trident/trident.c +++ b/xc/programs/Xserver/hw/kdrive/trident/trident.c @@ -1,6 +1,4 @@ /* - * $Id: trident.c,v 1.1.1.8 2000/11/30 23:14:52 dawes Exp $ - * * Copyright © 1999 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml index 8a67ad8e1..170ba136d 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml @@ -3,16 +3,16 @@ ]> <!-- Created: Mon Feb 28 13:00:00 2000 by brianp@valinux.com --> -<!-- Revised: Fri May 19 09:41:48 2000 by martin@valinux.com --> -<!-- Revised: Tue Aug 22 14:00:00 2000 by brianp@valinux.com --> +<!-- Revised: Sat Jan 6 09:44:18 2001 by martin@valinux.com --> <article> <title>DRI User Guide <author> <htmlurl url="http://www.valinux.com/" name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>15 December 2000 + <date>9 February 2001 +<p> <ident> $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.15 2000/12/12 18:54:29 dawes Exp $ </ident> @@ -23,7 +23,7 @@ <p> <sect1>Copyright <p> - <bf>Copyright © 2000 by VA Linux Systems, Inc. + <bf>Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.</bf> <p> <bf>Permission is granted to make and distribute verbatim copies @@ -44,7 +44,8 @@ 3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Interactive, Incorporated. Matrox is a registered trademark of Matrox Electronic Systems Ltd. - ATI Rage is a registered trademark of ATI Technologies, Inc. + ATI Rage and Radeon are registered trademarks of ATI Technologies, + Inc. All other trademarks mentioned are the property of their respective owners. @@ -94,35 +95,9 @@ Like the SSE optimizations, a runtime check is made to determine if the CPU can execute 3DNow! instructions. - The build environment for both of these new architectures - have a pre-build environment that will correctly build the - DRI drivers and Mesa meaning no extra configuration is necessary - to build the DRI for these architectures. - - <sect2>Alpha Features - <p> - On newer Alpha processors, it should be noted that a - significant performance increase can be seen with the - addition of the -mcpu= command that should be passed to - GCC upon compilation. Dependent of the architecture of the - processor, for example -mcpu=ev6 will build specifically - for the EV6 based AXP's, giving both byte and word alignment - access to the DRI/Mesa drivers. - - Use this as an example of compiling with this extra speed. - In your host.def file that should reside in the xc/config - directory, add the line. - - #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 - - Additional speed improvements to 3D rendering can be achieved - by installing Compaq's Math Libraries (CPML) which can be - obtained from the following URL. - - http://www.support.compaq.com/alpha-tools/software/index.html - - Alpha systems can benefit from several compile-time optimizations - which are described in the DRI Compile Guide. + Alpha-based systems can use Compaq's optimized math library for + improved 3D performance. See the DRI Compilation Guide for + details. <sect1> Graphics Hardware <p> @@ -167,6 +142,11 @@ The PCI versions of these cards also have minimal support. Note that there are Rage 128 Pro boards on the market but they're not yet supported. + <item>ATI Radeon, supported on Intel x86 and AMD: + <itemize> + <item>Radeon SDR AGP + <item>Radeon DDR AGP + </itemize> <item>3Dlabs, supported on Intel x86 and AMD: <itemize> <item>Oxygen GMX 2000 (MX/Gamma based). @@ -246,9 +226,13 @@ Next, the DRI section can be used to restrict access to direct rendering. + A client can only use direct rendering if it has permission to + open the <tt>/dev/dri/card?</tt> file(s). + The permissions on these DRI device files is controlled by the "DRI" + section in the XF86Config file. <p> If you want all of the users on your system to be able to use - direct-rendering, then use a simple DRI section: + direct-rendering, then use a simple DRI section like this: <verb> Section "DRI" Mode 0666 @@ -471,8 +455,70 @@ <sect>General Trouble Shooting <p> This section contains information to help you diagnose general - problems. - See below for additional information for specific hardware. + problems. + See below for additional information for specific hardware. + + <sect1>Bus Mastering +<p> + DMA-based DRI drivers (that's most DRI drivers) cannot function + unless bus mastering is enabled for your graphics card. + By default, some systems don't having bus mastering on. + You should enable it in your BIOS. + <p> + Alternately, you can check the status of bus mastering and change + the setting from within Linux. There may be similar procedures for + other operating systems. + <p> + Run <tt>lspci</tt> (as root) and find the information + describing your graphics adapter. For example: + <P> + + <verb> + 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03) + 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03) + 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02) + 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) + 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) + 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02) + 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08) + 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02) + 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08) + 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01) + </verb> + <p> + The bus, device, and function number comprise the device id, + which is conventionally written in the form bus:dev.func, or + in this case 01:00.0. + <p> + Use the <tt>setpci</tt> command to examine bit two of register 4 for + your graphics card. This will indicate whether or not bus mastering + is enabled. + <p> + <verb> + setpci -s 01:00.0 4.w + </verb> + <p> + A hexidecimal value will be printed. Convert the least significant + digit to binary. For example, if you see 3, that's 0011 in binary + (bit two is 0). If you see 7, that's 0111 in binary (bit two is 1). + In the first example, bus mastering is disabled. It's enabled in + the second example. + <p> + The following shell script will enabled bus mastering for your + graphics card and host bridge. Run it as root. + <verb> + #!/bin/bash + dev=01:00.0 # change as appropriate + echo Enabling bus mastering on device $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + dev=00:00.0 + echo Enabling bus mastering on host bridge $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + </verb> + <p> + You can check if this worked by running the first setpci command again. + <p> + <sect1>The X Server <p> @@ -701,14 +747,22 @@ </verb> <p> - The kernel module for the Voodoo3 is named <tt>tdfx.o</tt> and + The kernel module for 3dfx hardware is named <tt>tdfx.o</tt> and should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> - The DRI 3D driver for the Voodoo3 should be in + The DRI 3D driver for 3dfx hardware should be in <tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>. This will be automatically loaded by libGL.so. <p> + The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. + When running in 32bpp mode an 8-bit stencil buffer and 24-bit + Z (depth) buffer are offered. + When running in 16bpp mode only a 16-bit Z (depth) buffer is + offered and stencil is implemented in software. + <p> + A software-based accumulation buffer is available in both + 16 and 32bpp modes. <sect2>Troubleshooting <p> @@ -726,9 +780,17 @@ the 16 bit/pixel screen mode. Use <tt/xdpyinfo/ to verify that all your visuals are depth 16. Edit your XF86Config file if needed. - <item> + <item> The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for Glide on older 3dfx hardware. + <item> + Different versions of Glide are needed for Voodoo3 and Voodoo5. + See the DRI website's resources page to download the right + version of Glide. + <item> + Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) + but 3D acceleration is not supported in that mode. + 32bpp mode is fully 3D accelerated. </itemize> <sect2>Performance @@ -737,7 +799,7 @@ <item> Normally, buffer swapping in double-buffered applications is synchronized to your monitor's refresh rate. - This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/ + This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERVAL/ environment variable. The value of this variable indicates the maximum number of swap buffer commands can be buffered. @@ -793,97 +855,6 @@ Using <tt/glColorMask(r, g, b, a)/ when r!=g or g!=b. </itemize> <item> - The lowest mipmap level is sometimes miscolored in trilinear- - sampled polygons. - </itemize> - - - <sect1>3dfx Voodoo5 Series -<p> - <sect2>Dependencies -<p> - The Voodoo5 DRI driver requires a special versions of - the 3dfx Glide library, different than that used for Voodoo3 - hardware. - It can be downloaded from the DRI website. -<p> - <sect2>Configuration -<p> - Your XF86Config file's device section must specify the - <tt>tdfx</tt> device: - <verb> - Section "Device" - Identifier "Voodoo5" - VendorName "3dfx" - Driver "tdfx" - EndSection - </verb> - The Screen section should then reference the Voodoo3 device: - <verb> - Section "Screen" - Identifier "Screen 1" - Device "Voodoo5" - Monitor "High Res Monitor" - DefaultDepth 24 - Subsection "Display" - Depth 16 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - Subsection "Display" - Depth 24 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - EndSection - </verb> - <p> - The kernel module for the Voodoo5 is named <tt>tdfx.o</tt> and - should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. - It will be automatically loaded by the Xserver if needed. - <p> - The DRI 3D driver for the Voodoo5 should be in - <tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>. - This will be automatically loaded by libGL.so. - <p> - The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. - When running in 32bpp mode an 8-bit stencil buffer and 24-bit - Z (depth) buffer are offered. - When running in 16bpp mode only a 16-bit Z (depth) buffer is - offered and stencil is implemented in software. - <p> - A software-based accumulation buffer is available in both - 16 and 32bpp modes. - <p> - - <sect2>Troubleshooting -<p> - <itemize> - <item> - The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for - Glide on older 3dfx hardware. - <item> - Different versions of Glide are needed for Voodoo3 and Voodoo5. - See the DRI website's resources page to download the right - version of Glide. - </itemize> - - <sect2>Performance -<p> - <itemize> - <item> - Normally, buffer swapping in double-buffered applications is - synchronized to your monitor's refresh rate. - This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/ - environment variable. - The value of this variable indicates the maximum number of - swap buffer commands can be buffered. - Zero allows maximum frame rate. - <item> - Rendering with 16-bit per texel textures is faster than using - 32-bit per texel textures. The <tt/internalFormat/ parameter - to <tt/glTexImage2D/ can be used to control texel size. - <item> The Voodoo5 driver reverts to software rendering under the same conditions Voodoo3 with three exceptions. First, stencil operations are implemented in hardware when the @@ -892,6 +863,18 @@ hardware. Third, <tt/glColorMask/ is fully supported in hardware when the screen is configured for 32 bits/pixel. + <item> + As of January, 2001 the second VSA-100 chip on the Voodoo5 is + not yet operational. + Therefore, the board isn't being used to its full capacity. + The second VSA-100 chip will allow Scan-Line Interleave (SLI) + mode for full-screen applications and games, potentially doubling + the system's fill rate. + When the second VSA-100 chip is activated + glGetString(GL_RENDERER) will report Voodoo5 instead of Voodoo4. + <item> + The lowest mipmap level is sometimes miscolored in trilinear- + sampled polygons. </itemize> <sect2>Known Problems @@ -901,25 +884,12 @@ The lowest mipmap level is sometimes miscolored in trilinear- sampled polygons (Voodoo3/Banshee). <item> - Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) - but 3D acceleration is not supported in that mode. - 32bpp mode is fully 3D accelerated. - <item> Fog doesn't work with orthographic projections. <item> The accuracy of blending operations on Voodoo4/5 isn't always very good. If you run Glean, you'll find some test failures. <item> - As of October, 2000 the second VSA-100 chip on the Voodoo5 is - not yet operational. - Therefore, the board isn't being used to its full capacity. - The second VSA-100 chip will allow Scan-Line Interleave (SLI) - mode for full-screen applications and games, potentially doubling - the system's fill rate. - When the second VSA-100 chip is activated - glGetString(GL_RENDERER) will report Voodoo5 instead of Voodoo4. - <item> The Glide library cannot be used directly; it's only meant to be used via the tdfx DRI driver. <item> @@ -1133,12 +1103,12 @@ <sect2>Configuration <p> Your XF86Config file's device section must specify the - <tt>r128</tt> device: + <tt>ati</tt> device: <verb> Section "Device" Identifier "Rage128" VendorName "ATI" - Driver "r128" + Driver "ati" EndSection </verb> The Screen section should then reference the Rage 128 device: @@ -1180,8 +1150,67 @@ <sect2>Known Problems <p> - DGA is not yet supported in the ATI Rage 128 X server. This - feature will be added in a future release. + None. + + + <sect1>ATI Radeon + <p> + <sect2>Dependencies + <p> + A Linux kernel with AGP GART support (such as the 2.4.x test + kernels) is needed. + <p> + <sect2>Configuration + <p> + Your XF86Config file's device section must specify the + <tt>ati</tt> device: + <verb> + Section "Device" + Identifier "Radeon" + VendorName "ATI" + Driver "ati" + EndSection + </verb> + The Screen section should then reference the Radeon device: + <verb> + Section "Screen" + Identifier "Screen 1" + Device "Radeon" + Monitor "High Res Monitor" + DefaultDepth 16 + Subsection "Display" + Depth 16 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + Subsection "Display" + Depth 32 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + EndSection + </verb> + <p> + The kernel module for the Radeon is named <tt>radeon.o</tt> and + should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. + It will be automatically loaded by the Xserver if needed. + <p> + The DRI 3D driver for the Radeon should be in + <tt>/usr/X11R6/lib/modules/dri/radeon_dri.so</tt>. + This will be automatically loaded by libGL.so. + <p> + You may also set your screen depth to 32 for 32bpp mode. + <p> + + <sect2>Performance +<p> + While this driver supports many of the features of ATI Radeon + cards, we do not <em/yet/ fully support the card's TCL + features. This work is progressing, but is not yet ready. + + <sect2>Known Problems +<p> + None. <sect1>3DLabs Oxygen GMX 2000 diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml index b61ba636e..830e91736 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml @@ -3,15 +3,16 @@ ]> <!-- Created: Sun Mar 12 13:00:00 2000 by brianp@valinux.com --> -<!-- Revised: Fri May 19 09:36:02 2000 by martin@valinux.com --> -<!-- Revised: Sat Aug 19 14:00:00 2000 by brianp@valinux.com --> +<!-- Revised: Sat Jan 6 10:15:22 2001 by martin@valinux.com --> <article> <title>DRI Compilation Guide <author> <htmlurl url="http://www.valinux.com/" name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>15 December 2000 + <date>11 January 2001 + +<p> <ident> $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.9 2000/12/12 17:48:10 alanh Exp $ @@ -23,7 +24,7 @@ <sect1>Copyright <p> - <bf>Copyright © 2000 by VA Linux Systems, Inc. + <bf>Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.</bf> <p> <bf>Permission is granted to make and distribute verbatim copies @@ -44,7 +45,8 @@ 3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Interactive, Incorporated. Matrox is a registered trademark of Matrox Electronic Systems Ltd. - ATI Rage is a registered trademark of ATI Technologies, Inc. + ATI Rage and Radeon is a registered trademark of ATI Technologies, + Inc. All other trademarks mentioned are the property of their respective owners. @@ -79,7 +81,8 @@ <p> The DRI 3D drivers generally work on systems with Intel or AMD CPUs. - However, there is limited support for Alpha and Sparc. + However, there is limited support for Alpha and PowerPC support is + underway. <p> For 3dfx Voodoo3 hardware, you'll also need: @@ -105,7 +108,7 @@ </itemize> <p> - For ATI Rage 128 hardware, you'll also need: + For ATI Rage 128 and Radeon hardware, you'll also need: <itemize> <item>A recent Linux 2.4.x kernel with AGP support. </itemize> @@ -113,12 +116,11 @@ <sect>Linux Kernel Preparation <p> - The DRI project closely tracks Linux kernel development. - Since the internal Linux data structures change frequently in - the 2.4 development branch it's important to have use the most - recent Linux kernel. - As of this writing (Nov 2000), 2.4.0-test11-pre5 is the most - recent version of Linux which the DRI is synchronized to. + The DRI project closely tracks Linux kernel development. Since + the internal Linux data structures might change in the 2.4 Linux + kernel, it's important to have use the most recent Linux kernel. + As of this writing (Jan 2001), 2.4.0 is the most recent version + of Linux which the DRI is synchronized to. <p> Most of the DRI drivers require AGP support and using Intel Pentium III SSE optimizations also requires an up-to-date Linux @@ -244,7 +246,7 @@ To enable this optimization edit your xc/config/host.def file and add the line: - #define DefaultCCOptions -ansi GccWarningOptions -pipe -mcpu=ev6 + #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 Additional speed improvements to 3D rendering can be achieved by installing Compaq's Math Libraries (CPML) which can be @@ -407,6 +409,7 @@ /* #define GlxBuiltInTdfx YES */ /* #define GlxBuiltInMga YES */ /* #define GlxBuiltInR128 YES */ + /* #define GlxBuiltInRadeon YES */ /* #define DoLoadableServer NO */ #define SharedLibFont NO </verb> @@ -486,6 +489,7 @@ For the 3dfx Voodoo, you should see <em>tdfx.o</em>. For the Matrox G200/G400, you should see <em>mga.o</em>. For the ATI Rage 128, you should see <em>r128.o</em>. + For the ATI Radeon, you should see <em>radeon.o</em>. For the Intel i810, you should see <em>i810.o</em>. <p> If the DRI kernel module(s) failed to build you should verify @@ -515,7 +519,7 @@ <p> To load the appropriate DRI module in your running kernel you can either use ismod and restart your X server or copy the kernel module - to <tt>/lib/modules/2.4.x/kernel/driver/char/drm/</tt> then run + to <tt>/lib/modules/2.4.x/kernel/drivers/char/drm/</tt> then run depmod and restart your X server. <p> Make sure you first unload any older DRI kernel modules that might diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c index babeeeb5c..57eb82299 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c @@ -585,6 +585,8 @@ GLINTDRIScreenInit(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n", pGlint->drmBufs->count); + xf86EnableBusMaster(pGlint->PciTag); + /* tell the generic kernel driver how to handle Gamma DMA */ if (pGlint->irq <= 0) { pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c index 89e21850d..92fbdc925 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c @@ -683,6 +683,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", bufs, I810_DMA_BUF_SZ); + xf86EnableBusMaster(pI810->PciTag); I810InitDma(pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c index fdb5c0bb4..d9c83d9ba 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c @@ -802,7 +802,6 @@ MGANAME(AccelInit)(ScreenPtr pScreen) maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) / (pScrn->displayWidth * PSZ / 8); - #ifdef XF86DRI if ( pMga->directRenderingEnabled ) { MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index 62ee2add7..beee925a7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h @@ -12,6 +12,7 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" +#include "xf86xv.h" #include "tdfxdefs.h" #ifdef XF86DRI @@ -35,16 +36,11 @@ struct _TDFXRec; typedef struct _TDFXRec *TDFXPtr; -#ifdef XF86DRI -#define PIXMAP_CACHE_LINES 750 -#else -#define PIXMAP_CACHE_LINES 2048 -#endif - - #include "tdfx_priv.h" extern void TDFXSwapContextFifo(ScreenPtr pScreen); extern void TDFXLostContext(ScreenPtr pScreen); +extern Bool TDFXSetupSLI(ScrnInfoPtr pScrn, Bool sliEnable, int aaSamples); +extern Bool TDFXDisableSLI(TDFXPtr pTDFX); #ifdef XF86DRI extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); @@ -205,7 +201,19 @@ typedef struct _TDFXRec { * shadow everything and make it happen automatically for every write. */ INT32 sst2DSrcFmtShadow; INT32 sst2DDstFmtShadow; - int pixmapCacheLines; + int pixmapCacheLinesMin; + int pixmapCacheLinesMax; + FBAreaPtr reservedArea; + Bool ShowCache; + Bool OverlayXvideo; + Bool TextureXvideo; + int videoKey; + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + FBLinearPtr overlayBuffer; + FBAreaPtr textureBuffer; + XF86VideoAdaptorPtr overlayAdaptor; + XF86VideoAdaptorPtr textureAdaptor; + ScreenBlockHandlerProcPtr BlockHandler; } TDFXRec; typedef struct { @@ -215,6 +223,15 @@ typedef struct { int TexOwner; } TDFXSAREAPriv; +typedef struct { + RegionRec clip; + CARD32 colorKey; + int filterQuality; + CARD32 videoStatus; + Time offTime; + Time freeTime; +} TDFXPortPrivRec, *TDFXPortPrivPtr; + #define TDFXPTR(p) ((TDFXPtr)((p)->driverPrivate)) #define DRAW_STATE_CLIPPING 0x1 @@ -269,5 +286,3 @@ extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which); #endif - - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c index 896add046..d97363b57 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c @@ -6,6 +6,7 @@ #include "dgaproc.h" #include "tdfx.h" +#include "vgaHW.h" static Bool TDFX_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *, int *, int *); @@ -93,24 +94,20 @@ SECOND_PASS: currentMode->imageHeight = pScrn->virtualY; currentMode->pixmapWidth = currentMode->imageWidth; currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; + currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; + currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; oneMore = FALSE; goto SECOND_PASS; } else { currentMode->bytesPerScanline = ((pScrn->displayWidth * pTDFX->cpp) + 3) & ~3L; currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = pScrn->virtualY; + currentMode->imageHeight = pScrn->virtualY; currentMode->pixmapWidth = currentMode->imageWidth; currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; + currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; + currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; } pMode = pMode->next; @@ -125,25 +122,26 @@ SECOND_PASS: static Bool TDFX_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) { - static int OldDisplayWidth[MAXSCREENS]; + static DisplayModePtr OldModes[MAXSCREENS]; int index = pScrn->pScreen->myNum; TDFXPtr pTDFX = TDFXPTR(pScrn); if (!pMode) { /* restore the original mode */ /* put the ScreenParameters back */ - pScrn->displayWidth = OldDisplayWidth[index]; - TDFXSwitchMode(index, pScrn->currentMode, 0); - pTDFX->DGAactive = FALSE; + if (pTDFX->DGAactive) { + TDFXSwitchMode(index, OldModes[index], 0); + TDFXAdjustFrame(pScrn->pScreen->myNum, 0, 0, 0); + pTDFX->DGAactive = FALSE; + } } else { - if (!pTDFX->DGAactive) { /* save the old parameters */ - OldDisplayWidth[index] = pScrn->displayWidth; - + /* save the old ScreenParameters */ + if (!pTDFX->DGAactive) { + OldModes[index] = pScrn->currentMode; pTDFX->DGAactive = TRUE; } pScrn->displayWidth = pMode->bytesPerScanline / pTDFX->cpp; - TDFXSwitchMode(index, pMode->mode, 0); } @@ -162,9 +160,14 @@ static void TDFX_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { TDFXPtr pTDFX = TDFXPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); TDFXAdjustFrame(pScrn->pScreen->myNum, x, y, flags); - pTDFX->DGAViewportStatus = 0; /* TDFXAdjustFrame loops until finished */ + + while (hwp->readST01(hwp) & 0x08); + while (!(hwp->readST01(hwp) & 0x08)); + + pTDFX->DGAViewportStatus = 0; } static void @@ -189,10 +192,8 @@ TDFX_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; int ydir = (srcy < dsty) ? -1 : 1; - (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, - GXcopy, ~0, -1); - (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, - dstx, dsty, w, h); + (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, dstx, dsty, w, h); } } @@ -224,7 +225,7 @@ TDFX_OpenFramebuffer( *name = NULL; /* no special device */ *mem = (unsigned char*)pTDFX->LinearAddr[0]; *size = pTDFX->FbMapSize; - *offset = 0; + *offset = 0; *flags = DGA_NEED_ROOT; return TRUE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index 8c5831420..f5e7306a2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -31,6 +31,8 @@ static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen); static void TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); +static void TDFXDRITransitionTo2d(ScreenPtr pScreen); +static void TDFXDRITransitionTo3d(ScreenPtr pScreen); static Bool TDFXInitVisualConfigs(ScreenPtr pScreen) @@ -375,6 +377,8 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = TDFXDRIMoveBuffers; pDRIInfo->OpenFullScreen = TDFXDRIOpenFullScreen; pDRIInfo->CloseFullScreen = TDFXDRICloseFullScreen; + pDRIInfo->TransitionTo2d = TDFXDRITransitionTo2d; + pDRIInfo->TransitionTo3d = TDFXDRITransitionTo3d; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) { @@ -704,3 +708,42 @@ TDFXDRICloseFullScreen(ScreenPtr pScreen) return TRUE; } + +static void +TDFXDRITransitionTo2d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + + xf86FreeOffscreenArea(pTDFX->reservedArea); +} + + +static void +TDFXDRITransitionTo3d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + FBAreaPtr pArea; + + if(pTDFX->overlayBuffer) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer); + pTDFX->overlayBuffer = NULL; + } + + if(pTDFX->textureBuffer) { + xf86FreeOffscreenArea(pTDFX->textureBuffer); + pTDFX->textureBuffer = NULL; + } + + xf86PurgeUnlockedOffscreenAreas(pScreen); + + /* this is an ugly hack! isnt there a resize? */ + pArea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + pTDFX->pixmapCacheLinesMin, + pScrn->displayWidth, NULL, NULL, NULL); + pTDFX->reservedArea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + pTDFX->pixmapCacheLinesMax - pTDFX->pixmapCacheLinesMin, + pScrn->displayWidth, NULL, NULL, NULL); + xf86FreeOffscreenArea(pArea); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index a39c9b780..e3c72918d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -89,6 +89,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tdfx.h" #include "miscstruct.h" +#include "dixstruct.h" #include "xf86xv.h" #include "Xv.h" @@ -135,6 +136,8 @@ static void TDFXFreeScreen(int scrnIndex, int flags); static int TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); +static void TDFXBlockHandler(int, pointer, pointer, pointer); + #ifdef DPMSExtension /* Switch to various Display Power Management System levels */ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, @@ -178,14 +181,22 @@ typedef enum { OPTION_NOACCEL, OPTION_SW_CURSOR, OPTION_USE_PIO, - OPTION_NO_SLI + OPTION_SHOWCACHE, + OPTION_VIDEO_KEY, + OPTION_NO_SLI, + OPTION_OVERLAY_XV, + OPTION_TEXTURE_XV } TDFXOpts; static OptionInfoRec TDFXOptions[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_USE_PIO, "UsePIO", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, { OPTION_NO_SLI, "NoSLI", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_OVERLAY_XV, "OverlayXvideo", OPTV_BOOLEAN, {1}, TRUE}, + { OPTION_TEXTURE_XV, "TextureXvideo", OPTV_BOOLEAN, {1}, TRUE}, { -1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -399,7 +410,7 @@ TDFXProbeDDC(ScrnInfoPtr pScrn, int index) #endif { pVbe = VBEInit(NULL,index); - vbeDoEDID(pVbe, NULL); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); } } @@ -949,6 +960,30 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) } } + if (!xf86GetOptValBool(TDFXOptions, OPTION_SHOWCACHE, &(pTDFX->ShowCache))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache %s\n", pTDFX->ShowCache ? "Enabled" : "Disabled"); + } else { + pTDFX->ShowCache = FALSE; + } + + if (xf86GetOptValBool(TDFXOptions, OPTION_OVERLAY_XV, &(pTDFX->OverlayXvideo))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overlay Xvideo Adaptor %s\n", pTDFX->OverlayXvideo ? "Enabled" : "Disabled"); + } else { + pTDFX->OverlayXvideo = TRUE; + } + + if (xf86GetOptValBool(TDFXOptions, OPTION_TEXTURE_XV, &(pTDFX->TextureXvideo))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Texture Xvideo Adaptor %s\n", pTDFX->TextureXvideo ? "Enabled" : "Disabled"); + } else { + pTDFX->TextureXvideo = TRUE; + } + + if (xf86GetOptValInteger(TDFXOptions, OPTION_VIDEO_KEY, &(pTDFX->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pTDFX->videoKey); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key default 0x%x\n", pTDFX->videoKey = 0x1E); + } + if (!xf86ReturnOptValBool(TDFXOptions, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) { TDFXFreeRec(pScrn); @@ -1440,6 +1475,7 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) int hd, hbs, hss, hse, hbe, ht, hskew; Bool dbl; + hd = hbs = hss = hse = hbe = ht = hskew = 0; hwp = VGAHWPTR(pScrn); pTDFX = TDFXPTR(pScrn); @@ -1500,35 +1536,35 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) static void TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - short visualClass) { + VisualPtr pVisual) { TDFXPtr pTDFX; int i, j, index, v, repeat, max; TDFXTRACE("TDFXLoadPalette16 start\n"); pTDFX = TDFXPTR(pScrn); + for (i=0; i<numColors; i++) { index=indices[i]; v=(colors[index/2].red<<16)|(colors[index].green<<8)|colors[index/2].blue; - if (i<numColors-1) max=indices[i+1]<<2; - else max=256; - for (j=index<<2; j<max; j++) { + max=min((index+1)<<2, 256); + for (j = index<<2; j < max; j++) + { repeat=100; do { TDFXWriteLongMMIO(pTDFX, DACADDR, j); } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=j); if (!repeat) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, " - "bypassing CLUT\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, bypassing CLUT\n"); pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS; return; } + repeat=100; do { TDFXWriteLongMMIO(pTDFX, DACDATA, v); } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v); if (!repeat) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, " - "bypassing CLUT\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, bypassing CLUT\n"); pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS; return; } @@ -1538,7 +1574,7 @@ TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, static void TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - short visualClass) { + VisualPtr pVisual) { TDFXPtr pTDFX; int i, index, v, repeat; @@ -1635,11 +1671,8 @@ calcBufferSize(int xres, int yres, Bool tiled, int cpp) } /* calcBufferSize */ static void allocateMemory(ScrnInfoPtr pScrn) { - TDFXPtr pTDFX; - int memRemaining, texSize, fifoSize, screenSizeInTiles; - - pTDFX = TDFXPTR(pScrn); - pTDFX->stride = pScrn->displayWidth*pTDFX->cpp; + TDFXPtr pTDFX = TDFXPTR(pScrn); + int memRemaining, fbSize, cursorSize, fifoSize, screenSizeInTiles; if (pTDFX->cpp!=3) { screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY, @@ -1658,7 +1691,7 @@ static void allocateMemory(ScrnInfoPtr pScrn) { /* it to be on an *odd* page boundary. */ pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF; if ((pTDFX->depthOffset & (0x1 << 12)) == 0) { -#if 0 +#if 1 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Changing depth offset from 0x%08x to 0x%08x\n", pTDFX->depthOffset, @@ -1670,7 +1703,7 @@ static void allocateMemory(ScrnInfoPtr pScrn) { /* to be on an *even* page boundary. */ pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF; if (pTDFX->backOffset & (0x1 << 12)) { -#if 0 +#if 1 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Changing back offset from 0x%08x to 0x%08x\n", pTDFX->backOffset, @@ -1678,52 +1711,59 @@ static void allocateMemory(ScrnInfoPtr pScrn) { #endif pTDFX->backOffset -= (0x1 << 12); } - /* Now, place the front buffer, forcing */ - /* it to be on a page boundary too, just */ - /* for giggles. */ - pTDFX->fbOffset - = (pTDFX->backOffset - (pScrn->virtualY+PIXMAP_CACHE_LINES)*pTDFX->stride) &~ 0xFFF; /* Give the cmd fifo at least */ /* CMDFIFO_PAGES pages, but no more than */ /* 255. */ fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12; + fbSize = (pScrn->virtualY + pTDFX->pixmapCacheLinesMin) * pTDFX->stride; + cursorSize = 4096; /* We give 4096 bytes to the cursor, fifoSize to the */ /* FIFO, and everything to textures. */ /* Bump everything by 64k to move it past VGA memory */ - texSize = (pTDFX->fbOffset - fifoSize - 4096 - 64*1024); - pTDFX->texOffset = pTDFX->fbOffset - texSize + 64*1024; - pTDFX->texSize = texSize; - pTDFX->fifoOffset = 4096+64*1024; + pTDFX->cursorOffset = 64*1024; + pTDFX->fifoOffset = pTDFX->cursorOffset + cursorSize; pTDFX->fifoSize = fifoSize; - pTDFX->cursorOffset = 0+64*1024; -#if 0 + /* Now, place the front buffer, forcing */ + /* it to be on a page boundary too, just */ + /* for giggles. */ + pTDFX->fbOffset = (pTDFX->fifoOffset + pTDFX->fifoSize) &~ 0xFFF; + pTDFX->texOffset = pTDFX->fbOffset + fbSize; + pTDFX->texSize = pTDFX->backOffset - pTDFX->texOffset; + + if (pTDFX->texSize <= 0) { + pTDFX->backOffset = -1; + pTDFX->depthOffset = -1; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Texture Memory available, disabling DRI\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Texture Memory %0.02f MB\n", pTDFX->texSize / 1024.0 / 1024.0); + } + +#if 1 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Cursor Offset: [0x%08X,0x%08X)\n", pTDFX->cursorOffset, - pTDFX->cursorOffset+1024); + pTDFX->cursorOffset + cursorSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fifo Offset: [0x%08X, 0x%08X)\n", pTDFX->fifoOffset, - pTDFX->fifoOffset+fifoSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Texture Offset: [0x%08X, 0x%08X)\n", - pTDFX->texOffset, - pTDFX->texOffset + texSize); + pTDFX->fifoOffset + pTDFX->fifoSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Front Buffer Offset: [0x%08X, 0x%08X)\n", pTDFX->fbOffset, - pTDFX->fbOffset + (pScrn->virtualY+PIXMAP_CHACHE_LINES)*pTDFX->stride); + pTDFX->fbOffset + fbSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Texture Offset: [0x%08X, 0x%08X)\n", + pTDFX->texOffset, + pTDFX->texOffset + pTDFX->texSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BackOffset: [0x%08X, 0x%08X)\n", pTDFX->backOffset, - pTDFX->backOffset+screenSizeInTiles); + pTDFX->backOffset + screenSizeInTiles); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DepthOffset: [0x%08X, 0x%08X)\n", pTDFX->depthOffset, - pTDFX->depthOffset+screenSizeInTiles); + pTDFX->depthOffset + screenSizeInTiles); #endif /* 0/1 */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n", - (float)texSize/1024.0/1024.0); } static Bool @@ -1734,7 +1774,6 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { VisualPtr visual; int maxy; BoxRec MemBox; - RegionRec MemRegion; TDFXTRACE("TDFXScreenInit start\n"); pScrn = xf86Screens[pScreen->myNum]; @@ -1748,6 +1787,10 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { vgaHWGetIOBase(hwp); if (!vgaHWMapMem(pScrn)) return FALSE; + /* we want at least enough pixmap cache to do DVD */ + pTDFX->stride = pScrn->displayWidth*pTDFX->cpp; + pTDFX->pixmapCacheLinesMin = ((720*480*2) + pTDFX->stride - 1) / pTDFX->stride; + allocateMemory(pScrn); #if 0 @@ -1769,13 +1812,30 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { return FALSE; } - maxy=pScrn->virtualY+PIXMAP_CACHE_LINES; - MemBox.y1 = pScrn->virtualY; + pTDFX->pixmapCacheLinesMax = (pTDFX->backOffset - pTDFX->fbOffset) / pTDFX->stride; + if(pTDFX->ChipType < PCI_CHIP_VOODOO5) { + if (pTDFX->pixmapCacheLinesMax > 2048) + pTDFX->pixmapCacheLinesMax = 2048; + } else { + if (pTDFX->pixmapCacheLinesMax > 4095) + pTDFX->pixmapCacheLinesMax = 4095; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%d pixmap cache lines for 2D/video when 3D inactive\n", + pTDFX->pixmapCacheLinesMax); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%d pixmap cache lines for 2D/video when 3D active\n", + pTDFX->pixmapCacheLinesMin); + + /* region the whole memory (framebuffer+pixmapcache) and let + * xf86InitFBManager do the visible region subtraction + */ MemBox.x1 = 0; + MemBox.y1 = 0; MemBox.x2 = pScrn->displayWidth; - MemBox.y2 = maxy; - - pTDFX->maxClip=((pScrn->virtualX+1)&0xFFF) | (((maxy+1)&0xFFF)<<16); + MemBox.y2 = pTDFX->pixmapCacheLinesMax; + pTDFX->maxClip = (MemBox.x2) | (MemBox.y2 << 16); TDFXSave(pScrn); if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -1797,8 +1857,11 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { * is called. fbScreenInit will eventually call into the drivers * InitGLXVisuals call back. */ - if (!pTDFX->NoAccel) - pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen); + if (!pTDFX->NoAccel) { + if ((pTDFX->backOffset != -1) && (pTDFX->depthOffset != -1)) { + pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen); + } + } #endif switch (pScrn->bitsPerPixel) { @@ -1840,13 +1903,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { TDFXDGAInit(pScreen); - REGION_INIT(pScreen, &MemRegion, &MemBox, 1); - if (!xf86InitFBManagerRegion(pScreen, &MemRegion)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to init memory manager\n"); - REGION_UNINIT(pScreen, &MemRegion); - return FALSE; - } - REGION_UNINIT(pScreen, &MemRegion); + xf86InitFBManager(pScreen, &MemBox); if (!pTDFX->NoAccel) { if (!TDFXAccelInit(pScreen)) { @@ -1912,6 +1969,9 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { pTDFX->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = TDFXCloseScreen; + pTDFX->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = TDFXBlockHandler; + if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -1936,6 +1996,10 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { TDFXTRACE("TDFXAdjustFrame start\n"); pScrn = xf86Screens[scrnIndex]; pTDFX = TDFXPTR(pScrn); + + if (pTDFX->ShowCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; + tdfxReg = &pTDFX->ModeReg; tdfxReg->startaddr = pTDFX->fbOffset+y*pTDFX->stride+(x*pTDFX->cpp); TDFXTRACE("TDFXAdjustFrame to x=%d y=%d offset=%d\n", x, y, tdfxReg->startaddr); @@ -1945,14 +2009,15 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { static Bool TDFXEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn; -#ifdef XF86DRI ScreenPtr pScreen; +#ifdef XF86DRI TDFXPtr pTDFX; #endif TDFXTRACE("TDFXEnterVT start\n"); pScrn = xf86Screens[scrnIndex]; - InstallFifo(pScrn); + pScreen = screenInfo.screens[scrnIndex]; + TDFXInitFifo(pScreen); #ifdef XF86DRI pTDFX = TDFXPTR(pScrn); if (pTDFX->directRenderingEnabled) { @@ -2029,9 +2094,22 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pTDFX->scanlineColorExpandBuffers[1]) xfree(pTDFX->scanlineColorExpandBuffers[1]); pTDFX->scanlineColorExpandBuffers[1]=0; + + if (pTDFX->overlayAdaptor) { + xfree(pTDFX->overlayAdaptor->pPortPrivates[0].ptr); + xf86XVFreeVideoAdaptorRec(pTDFX->overlayAdaptor); + pTDFX->overlayAdaptor = NULL; + } + + if (pTDFX->textureAdaptor) { + xfree(pTDFX->textureAdaptor->pPortPrivates[0].ptr); /* FIXME: use loop */ + xf86XVFreeVideoAdaptorRec(pTDFX->textureAdaptor); + pTDFX->textureAdaptor = NULL; + } pScrn->vtSema=FALSE; + pScreen->BlockHandler = pTDFX->BlockHandler; pScreen->CloseScreen = pTDFX->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -2077,7 +2155,7 @@ TDFXBlankScreen(ScrnInfoPtr pScrn, Bool unblank) scrn |= 0x20; /* blank screen */ } - vgaHWSeqReset(hwp, TRUE); + vgaHWSeqReset(hwp, TRUE); hwp->writeSeq(hwp, 0x01, scrn); /* change mode */ vgaHWSeqReset(hwp, FALSE); } @@ -2101,6 +2179,22 @@ TDFXSaveScreen(ScreenPtr pScreen, int mode) return TRUE; } +static void +TDFXBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + + pScreen->BlockHandler = pTDFX->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = TDFXBlockHandler; + + if(pTDFX->VideoTimerCallback) { + (*pTDFX->VideoTimerCallback)(pScrn, currentTime.milliseconds); + } +} + #ifdef DPMSExtension static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c index 58e49d1cf..1e590d546 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.13 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.11 2000/12/01 14:29:00 dawes Exp $ */ #include "xf86.h" @@ -11,13 +11,19 @@ /* Memory layout of card is as follows: - 000000-003fff: Cursor - 001000-xxxxxx: Fifo (Min of CMDFIFO pages) - xxxxxx-420fff: Texture maps - 421000- A-1 : Framebuffer - A - B-1 : Offscreen pixmaps - B - C-1 : Back buffer - C - D-1 : Z buffer + 000000-00ffff: VGA memory + 010000-013fff: Cursor + 011000-xxxxxx: Fifo (Min of CMDFIFO pages) + xxxxxx- A-1 : Front Buffer (framebuffer) + A - B-1 : Pixmap Cache (framebuffer) + B - C-1 : Texture Memory + C - D-1 : Back Buffer + D - E-1 : Depth Buffer + + NB: pixmap cache usually butts right up against texture memory. when + 3d is disabled (via Transition2D) then the pixmap cache is increased + to overlap the texture memory. maximum pixmap cache of 4095 lines on + voodoo5 and 2048 on voodoo3/4 applies. */ void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn) @@ -117,9 +123,9 @@ void TDFXResetFifo(ScrnInfoPtr pScrn) static void TDFXSyncFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int i, cnt; + int i, cnt, resets=0; int stat; - long start_sec, end_sec, dummy; + long start_sec, end_sec, dummy, readptr; TDFXTRACEACCEL("TDFXSyncFifo start\n"); pTDFX=TDFXPTR(pScrn); @@ -127,7 +133,9 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) i=0; cnt=0; start_sec=0; + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); do { + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); stat=TDFXReadLongMMIO(pTDFX, 0); if (stat&SST_BUSY) i=0; else i++; cnt++; @@ -137,7 +145,17 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) } else { getsecs(&end_sec, &dummy); if (end_sec-start_sec>3) { - TDFXResetFifo(pScrn); + dummy=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); + if (dummy==readptr) { + TDFXResetFifo(pScrn); + readptr=dummy; + resets++; + if (resets==3) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Board is not responding.\n"); + return; + } + } start_sec=0; } } @@ -237,24 +255,6 @@ void TDFXSwapContextFifo(ScreenPtr pScreen) pTDFX->fifoSlots = pTDFX->fifoEnd-pTDFX->fifoPtr-8; } -void TDFXLostContext(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn; - TDFXPtr pTDFX; - TDFXSAREAPriv *sPriv; - - pScrn = xf86Screens[pScreen->myNum]; - pTDFX=TDFXPTR(pScrn); - sPriv=(TDFXSAREAPriv*)DRIGetSAREAPrivate(pScreen); - if (!sPriv) return; - if (sPriv->fifoPtr!=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase) || - sPriv->fifoRead!=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase)) { - sPriv->fifoPtr=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase); - sPriv->fifoRead=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase); - sPriv->fifoOwner=DRIGetContext(pScreen); - /* ErrorF("Out FifoPtr=%d FifoRead=%d\n", sPriv->fifoPtr, sPriv->fifoRead); */ - } -} #endif static void diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c index 8480de20a..d63592085 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c @@ -1,85 +1,134 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.5 2000/12/08 21:53:37 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.2 2000/12/02 15:30:57 tsi Exp $ */ -/* Adapted from ../mga/mga_video.c */ +#ifndef XvExtension +void TDFXInitVideo(ScreenPtr pScreen) {} +void TDFXCloseVideo(ScreenPtr pScreen) {} +#else #include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86_ansic.h" -#include "compiler.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#include "xf86fbman.h" -#include "regionstr.h" - #include "tdfx.h" +#include "dixstruct.h" -#include "xf86xv.h" #include "Xv.h" -#include "xaa.h" -#include "xaalocal.h" -#include "dixstruct.h" #include "fourcc.h" +static Atom xvColorKey, xvFilterQuality; + /* These should move into tdfxdefs.h with better names */ -#define YUV_Y_BASE 0xC00000 -#define YUV_U_BASE 0xD00000 -#define YUV_V_BASE 0xE00000 +#define YUV_Y_BASE 0xC00000 +#define YUV_U_BASE 0xD00000 +#define YUV_V_BASE 0xE00000 -#define SST_2D_FORMAT_YUYV 0x8 -#define SST_2D_FORMAT_UYVY 0x9 +#define SST_2D_FORMAT_YUYV 0x8 +#define SST_2D_FORMAT_UYVY 0x9 #define YUVBASEADDR 0x80100 -/* This should move to tdfx.h - * Only one port for now due to need for better memory allocation. */ -#define TDFX_MAX_PORTS 1 - #define YUVSTRIDE 0x80104 +#define VIDPROCCFGMASK 0xa2e3eb6c -#ifndef XvExtension -void TDFXInitVideo(ScreenPtr pScreen) {} -#else +#define OFF_DELAY 250 /* milliseconds */ +#define FREE_DELAY 15000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +#define TDFX_MAX_OVERLAY_PORTS 1 +#define TDFX_MAX_TEXTURE_PORTS 32 + +/* Doesn't matter what screen we use */ +#define DummyScreen screenInfo.screens[0] +/* Needed for attribute atoms */ +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +/* + * PROTOTYPES + */ void TDFXInitVideo(ScreenPtr pScreen); -void TDFXCloseVideo (ScreenPtr pScreen); - -static XF86VideoAdaptorPtr TDFXSetupImageVideo(ScreenPtr); -static int TDFXSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); -static int TDFXGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); - -static void TDFXStopVideo(ScrnInfoPtr, pointer, Bool); -static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, - unsigned int *, unsigned int *, pointer); -static int TDFXPutImage(ScrnInfoPtr, short, short, short, short, short, - short, short, short, int, unsigned char*, short, - short, Bool, RegionPtr, pointer); -#if 0 -/* This isn't done yet, but eventually it will put images to the - * video overlay. */ -static int TDFXPutImageOverlay(ScrnInfoPtr pScrn, short, short, - short, short, short, short, - short, short, int, unsigned char*, - short, short, Bool, RegionPtr , pointer); -#endif - -static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, - unsigned short *, int *, int *); - -/* These function is from tdfx_accel.c */ -extern void TDFXFirstSync(ScrnInfoPtr pScrn); +void TDFXCloseVideo(ScreenPtr pScreen); -static FBAreaPtr -TDFXAllocateOffscreenBuffer (ScrnInfoPtr pScrn, int id, int width, int height); +static FBAreaPtr TDFXAllocateMemoryArea (ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height); +static FBLinearPtr TDFXAllocateMemoryLinear (ScrnInfoPtr pScrn, FBLinearPtr linear, int size); +static void TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time); -static void -TDFXDeallocateOffscreenBuffer (ScrnInfoPtr pScrn, int id); +static XF86VideoAdaptorPtr TDFXSetupImageVideoTexture(ScreenPtr); +static int TDFXSetPortAttributeTexture(ScrnInfoPtr, Atom, INT32, pointer); +static int TDFXGetPortAttributeTexture(ScrnInfoPtr, Atom ,INT32 *, pointer); +static int TDFXPutImageTexture(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static void TDFXStopVideoTexture(ScrnInfoPtr, pointer, Bool); + +static XF86VideoAdaptorPtr TDFXSetupImageVideoOverlay(ScreenPtr); +static int TDFXSetPortAttributeOverlay(ScrnInfoPtr, Atom, INT32, pointer); +static int TDFXGetPortAttributeOverlay(ScrnInfoPtr, Atom ,INT32 *, pointer); +static int TDFXPutImageOverlay(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static void TDFXStopVideoOverlay(ScrnInfoPtr, pointer, Bool); +static void TDFXResetVideoOverlay(ScrnInfoPtr); + +static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); +static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); + +/* + * ADAPTOR INFORMATION + */ + +static XF86VideoEncodingRec OverlayEncoding[] = +{ + { 0, "XV_IMAGE", 2048, 2048, {1, 1} } +}; + +static XF86VideoEncodingRec TextureEncoding[] = +{ + { 0, "XV_IMAGE", 1024, 1024, {1, 1} } +}; + +static XF86VideoFormatRec OverlayFormats[] = +{ + {8, TrueColor}, {8, DirectColor}, {8, PseudoColor}, + {8, GrayScale}, {8, StaticGray}, {8, StaticColor}, + {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, + {15, DirectColor}, {16, DirectColor}, {24, DirectColor} +}; + +static XF86VideoFormatRec TextureFormats[] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +static XF86AttributeRec OverlayAttributes[] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER_QUALITY"} +}; + +static XF86AttributeRec TextureAttributes[] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER_QUALITY"} +}; + +static XF86ImageRec OverlayImages[] = +{ + XVIMAGE_YUY2, XVIMAGE_UYVY, XVIMAGE_YV12, XVIMAGE_I420 +}; + +static XF86ImageRec TextureImages[] = +{ + XVIMAGE_YV12, XVIMAGE_I420 +}; + +/* + * COMMON SETUP FUNCTIONS + */ void TDFXInitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; - XF86VideoAdaptorPtr newAdaptor = NULL; + XF86VideoAdaptorPtr newOverlayAdaptor = NULL; + XF86VideoAdaptorPtr newTextureAdaptor = NULL; TDFXPtr pTDFX = TDFXPTR(pScrn); int num_adaptors; @@ -87,685 +136,997 @@ void TDFXInitVideo(ScreenPtr pScreen) if(pTDFX->cpp == 1) return; - newAdaptor = TDFXSetupImageVideo(pScreen); - - /* Initialize the offscreen buffer */ - pTDFX->offscreenYUVBuf = 0; - + /* Start with the generic adaptors */ num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); - if(newAdaptor) { - if(!num_adaptors) { - num_adaptors = 1; - adaptors = &newAdaptor; - } else { - newAdaptors = /* need to free this someplace */ - xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - memcpy(newAdaptors, adaptors, num_adaptors * - sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } + /* Overlay adaptor */ + if(pTDFX->AccelInfoRec && pTDFX->AccelInfoRec->FillSolidRects) + newOverlayAdaptor = TDFXSetupImageVideoOverlay(pScreen); + + /* Texture adaptor */ + if(pTDFX->AccelInfoRec && pTDFX->AccelInfoRec->FillSolidRects) + newTextureAdaptor = TDFXSetupImageVideoTexture(pScreen); + + /* Add the overlay adaptor to the list */ + if(newOverlayAdaptor) { + newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + if (num_adaptors) memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newOverlayAdaptor; + adaptors = newAdaptors; /* FIXME: leak? */ + num_adaptors++; + } } - if(num_adaptors) - { - xf86XVScreenInit(pScreen, adaptors, num_adaptors); + /* Add the texture adaptor to the list */ + if(newTextureAdaptor) { + newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + if (num_adaptors) memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newTextureAdaptor; + adaptors = newAdaptors; /* FIXME: leak? */ + num_adaptors++; + } } + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + if(newAdaptors) - xfree(newAdaptors); + xfree(newAdaptors); } + void TDFXCloseVideo (ScreenPtr pScreen) { - } -/* client libraries expect an encoding */ -static XF86VideoEncodingRec DummyEncoding[1] = + +static XF86VideoAdaptorPtr +TDFXAllocAdaptor(ScrnInfoPtr pScrn, int numberPorts) { - { /* blit limit */ - 0, - "XV_IMAGE", - 1024, 0, /* Height is a limitation of pixmap space, and filled in later. */ - {1, 1} - } -}; + XF86VideoAdaptorPtr adapt; + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv; + int i; -#define NUM_FORMATS_OVERLAY 3 + if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) + return NULL; -static XF86VideoFormatRec Formats[NUM_FORMATS_OVERLAY] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, -}; + if(!(pPriv = xcalloc(1, sizeof(TDFXPortPrivRec) + numberPorts * sizeof(DevUnion)))) + { + xfree(adapt); + return NULL; + } -/* #define NUM_IMAGES 4*/ -#define NUM_IMAGES 2 + adapt->pPortPrivates = (DevUnion*)(&pPriv[1]); + for(i = 0; i < numberPorts; i++) + adapt->pPortPrivates[i].val = i; -static XF86ImageRec Images[NUM_IMAGES] = -{ - XVIMAGE_YV12, /* YVU planar */ - XVIMAGE_I420 /* YUV planar */ -#if 0 - /* These could be supported (without a temp bufer) using the - * host-to-screen-stretch */ - XVIMAGE_YUY2, /* YUYV packed */ - XVIMAGE_UYVY /* UYVY packed */ -#endif -}; + xvColorKey = MAKE_ATOM("XV_COLORKEY"); /* FIXME: twice, leak */ + xvFilterQuality = MAKE_ATOM("XV_FILTER_QUALITY"); /* FIXME: twice, leak */ + + pPriv->colorKey = pTDFX->videoKey; + pPriv->videoStatus = 0; + pPriv->filterQuality = 1; + + return adapt; +} static XF86VideoAdaptorPtr -TDFXAllocAdaptor(ScrnInfoPtr pScrn) +TDFXSetupImageVideoOverlay(ScreenPtr pScreen) { - DevUnion *devUnions; - int i; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv; XF86VideoAdaptorPtr adapt; - if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) - return NULL; - /* Allocate a TDFX private structure */ - /* There is no need for a TDFX private structure at this time. But a - * DevUnion has to be provided to the core Xv code. */ - if (!(devUnions = xcalloc (1, sizeof (DevUnion) * TDFX_MAX_PORTS))) - { - xfree (adapt); - return NULL; - } - adapt->pPortPrivates = &devUnions[0]; - - /* Fill in some of the DevUnion */ - for (i = 0; i < TDFX_MAX_PORTS; i++) - { - adapt->pPortPrivates[i].val = i; - adapt->pPortPrivates[i].ptr = NULL; /* No private data */ - } - - return adapt; -} + if (!pTDFX->OverlayXvideo) + return NULL; + if(!(adapt = TDFXAllocAdaptor(pScrn, TDFX_MAX_OVERLAY_PORTS))) + return NULL; + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "3dfx Video Overlay"; + adapt->nPorts = TDFX_MAX_OVERLAY_PORTS; + adapt->nEncodings = sizeof(OverlayEncoding) / sizeof(XF86VideoEncodingRec); + adapt->pEncodings = OverlayEncoding; + adapt->nFormats = sizeof(OverlayFormats) / sizeof(XF86VideoFormatRec); + adapt->pFormats = OverlayFormats; + adapt->nAttributes = sizeof(OverlayAttributes) / sizeof(XF86AttributeRec); + adapt->pAttributes = OverlayAttributes; + adapt->nImages = sizeof(OverlayImages) / sizeof(XF86ImageRec); + adapt->pImages = OverlayImages; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = TDFXStopVideoOverlay; + adapt->SetPortAttribute = TDFXSetPortAttributeOverlay; + adapt->GetPortAttribute = TDFXGetPortAttributeOverlay; + adapt->QueryBestSize = TDFXQueryBestSize; + adapt->PutImage = TDFXPutImageOverlay; + adapt->QueryImageAttributes = TDFXQueryImageAttributes; -static XF86VideoAdaptorPtr -TDFXSetupImageVideo(ScreenPtr pScreen) + pPriv = (TDFXPortPrivPtr)(adapt->pPortPrivates[0].ptr); + REGION_INIT(pScreen, &(pPriv->clip), NullBox, 0); + + pTDFX->overlayAdaptor = adapt; + + TDFXResetVideoOverlay(pScrn); + + return adapt; +} + +static XF86VideoAdaptorPtr +TDFXSetupImageVideoTexture(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XF86VideoAdaptorPtr adapt; TDFXPtr pTDFX = TDFXPTR(pScrn); + XF86VideoAdaptorPtr adapt; - DummyEncoding[0].height = pTDFX->pixmapCacheLines; + if (!pTDFX->TextureXvideo) + return NULL; - adapt = TDFXAllocAdaptor(pScrn); + if(!(adapt = TDFXAllocAdaptor(pScrn, TDFX_MAX_TEXTURE_PORTS))) + return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; - /* Add VIDEO_OVERLAID_IMAGES if using the overlay */ adapt->flags = 0; - adapt->name = "3dfx Accelerated Video Engine"; - adapt->nEncodings = 1; - adapt->pEncodings = &DummyEncoding[0]; - adapt->nFormats = NUM_FORMATS_OVERLAY; - adapt->pFormats = Formats; - adapt->nPorts = TDFX_MAX_PORTS; - adapt->nAttributes = 0; - adapt->pAttributes = NULL; - adapt->nImages = NUM_IMAGES; - adapt->pImages = Images; - - /* XXX For now all I'm implementing is PutImage so that programs like OMS - * will work. More will follow as I have time and need. */ + adapt->name = "3dfx Video Texture"; + adapt->nPorts = TDFX_MAX_TEXTURE_PORTS; + adapt->nEncodings = sizeof(TextureEncoding) / sizeof(XF86VideoEncodingRec); + adapt->pEncodings = TextureEncoding; + adapt->nFormats = sizeof(TextureFormats) / sizeof(XF86VideoFormatRec); + adapt->pFormats = TextureFormats; + adapt->nAttributes = sizeof(TextureAttributes) / sizeof(XF86AttributeRec); + adapt->pAttributes = TextureAttributes; + adapt->nImages = sizeof(TextureImages) / sizeof(XF86ImageRec); + adapt->pImages = TextureImages; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; - adapt->StopVideo = TDFXStopVideo; - adapt->SetPortAttribute = TDFXSetPortAttribute; - adapt->GetPortAttribute = TDFXGetPortAttribute; + adapt->StopVideo = TDFXStopVideoTexture; + adapt->SetPortAttribute = TDFXSetPortAttributeTexture; + adapt->GetPortAttribute = TDFXGetPortAttributeTexture; adapt->QueryBestSize = TDFXQueryBestSize; - adapt->PutImage = TDFXPutImage; - /*adapt->PutImage = TDFXPutImageOverlay; */ + adapt->PutImage = TDFXPutImageTexture; adapt->QueryImageAttributes = TDFXQueryImageAttributes; + pTDFX->textureAdaptor = adapt; + return adapt; } -static void -TDFXStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) -{ - if (cleanup) - { - /* Deallocate the offscreen temporary buffer. */ - TDFXDeallocateOffscreenBuffer (pScrn, 0); - } +/* + * MISCELLANEOUS ROUTINES + */ + + +static int +TDFXQueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int size, tmp; + + if(*w > 1024) *w = 1024; + if(*h > 1024) *h = 1024; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; } -static int -TDFXSetPortAttribute (ScrnInfoPtr pScrn, - Atom attribute, - INT32 value, - pointer data) -{ - return BadMatch; +static int +TDFXSetPortAttributeOverlay( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +){ + + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + TDFXPtr pTDFX = TDFXPTR(pScrn); + + if(attribute == xvColorKey) { + pPriv->colorKey = value; + pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); + pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else if(attribute == xvFilterQuality) { + if((value < 0) || (value > 1)) + return BadValue; + pPriv->filterQuality = value; + } else return BadMatch; + + return Success; +} + +static int +TDFXGetPortAttributeOverlay( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + + if(attribute == xvColorKey) { + *value = pPriv->colorKey; + } else if(attribute == xvFilterQuality) { + *value = pPriv->filterQuality; + } else return BadMatch; + + return Success; } static int -TDFXGetPortAttribute(ScrnInfoPtr pScrn, - Atom attribute, - INT32 *value, - pointer data) -{ - return BadMatch; +TDFXSetPortAttributeTexture( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +) { + return Success; } +static int +TDFXGetPortAttributeTexture( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + return Success; +} -static void -TDFXQueryBestSize(ScrnInfoPtr pScrn, - Bool motion, - short vid_w, short vid_h, - short drw_w, short drw_h, - unsigned int *p_w, unsigned int *p_h, - pointer data) -{ - /* No alignment restrictions */ + +static void +TDFXQueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + if(vid_w > drw_w) drw_w = vid_w; + if(vid_h > drw_h) drw_h = vid_h; + *p_w = drw_w; - *p_h = drw_h; + *p_h = drw_h; } - -/* This performs a screen to screen stretch blit. All coordinates are - * in screen memory. This function assumes that the src and dst format - * registers have been setup already. This function does not save - * the registers it trashes. */ static void -TDFXScreenToScreenYUVStretchBlit (ScrnInfoPtr pScrn, - short src_x1, short src_y1, - short src_x2, short src_y2, - short dst_x1, short dst_y1, - short dst_x2, short dst_y2) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); +TDFXCopyData( + unsigned char *src, + unsigned char *dst, + int srcPitch, + int dstPitch, + int h, + int w +){ + while(h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} - /* reformulate the paramaters the way the hardware wants them */ - INT32 - src_x = src_x1 & 0x1FFF, - src_y = src_y1 & 0x1FFF, - dst_x = dst_x1 & 0x1FFF, - dst_y = dst_y1 & 0x1FFF, - src_w = (src_x2 - src_x) & 0x1FFF, - src_h = (src_y2 - src_y) & 0x1FFF, - dst_w = (dst_x2 - dst_x) & 0x1FFF, - dst_h = (dst_y2 - dst_y) & 0x1FFF; - - /* Setup for blit src and dest */ - TDFXMakeRoom(pTDFX, 5); - DECLARE(SSTCP_DSTSIZE|SSTCP_SRCSIZE|SSTCP_DSTXY| - SSTCP_COMMAND|SSTCP_COMMANDEXTRA); - /* We want the blit to wait for vsync. */ - TDFXWriteLong(pTDFX, SST_2D_COMMANDEXTRA, 4); - TDFXWriteLong(pTDFX, SST_2D_SRCSIZE, src_w | (src_h<<16)); - TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, dst_w | (dst_h<<16)); - TDFXWriteLong(pTDFX, SST_2D_DSTXY, dst_x | (dst_y<<16)); - /* XXX find the ROP table and figure out why CC is the right choice. */ - TDFXWriteLong(pTDFX, SST_2D_COMMAND, - (0xCC<<24)|SST_2D_SCRNTOSCRNSTRETCH); - /* Write to the launch area to start the blit */ - TDFXMakeRoom(pTDFX, 1); - DECLARE_LAUNCH (1, 0); - TDFXWriteLong(pTDFX, SST_2D_LAUNCH, src_x | (src_y<<16)); +static void +TDFXCopyMungedData( + unsigned char *src1, + unsigned char *src2, + unsigned char *src3, + unsigned char *dst1, + int srcPitch, + int srcPitch2, + int dstPitch, + int h, + int w +){ + CARD32 *dst; + CARD8 *s1, *s2, *s3; + int i, j; + + w >>= 1; + + for(j = 0; j < h; j++) { + dst = (CARD32*)dst1; + s1 = src1; s2 = src2; s3 = src3; + i = w; + while(i > 4) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); + dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); + dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); + dst += 4; s2 += 4; s3 += 4; s1 += 8; + i -= 4; + } + while(i--) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst++; s2++; s3++; + s1 += 2; + } + + dst1 += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } + } } + +/* + * TEXTURE DRAWING FUNCTIONS + */ + + static void -YUVPlanarToPacked (ScrnInfoPtr pScrn, - short src_x, short src_y, - short src_h, short src_w, - int id, char *buf, - short width, short height, - FBAreaPtr fbarea) +TDFXStopVideoTexture(ScrnInfoPtr pScrn, pointer data, Bool cleanup) { TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; - INT32 y; - void *dst; - char *psrc = buf, - *pdst = 0; - int count = 0; - - /* Register saves */ - INT32 - yuvBaseAddr, - yuvStride; - - /* Save these registers so I can restore them when we are done. */ - yuvBaseAddr = TDFXReadLongMMIO(pTDFX, YUVBASEADDR); - yuvStride = TDFXReadLongMMIO(pTDFX, YUVSTRIDE); - - - dst = 0; - - /* Set yuvBaseAddress register to point to the buffer. */ - TDFXWriteLongMMIO (pTDFX, YUVBASEADDR, pTDFX->fbOffset + - pTDFX->stride * (fbarea->box.y1 + pScrn->virtualY) - + fbarea->box.x1); - /* Set yuvStride register to reflect stride of U and V planes */ - /* There is a subtle issue involved with copying the Y plane. Y is - * sampled at twice the rate of the U and V data, in both - * directions. But when packing their needs to be two Y values for - * each U,V pair. So if src_x is odd we will end up missing on - * of the Y values. To correct for this we will always adjust the src - * x value. This adjust is done both in computing the address of the - * pixels to copy and when determining the amount of pixels to copy. - * Note that care needs to be taken to insure that the offscreen - * temporary buffer is allocated with enough space to hold the possible - * extra column of data. - */ - TDFXWriteLongMMIO (pTDFX, YUVSTRIDE, pTDFX->stride); - psrc = (char*)buf; - - /* psrc points to the base of the Y plane, move out to src_x, src_y */ - psrc += (src_x & ~0x1) + src_y * width; - pdst = (char *)pTDFX->MMIOBase[0] + YUV_Y_BASE; - for (y = 0; y < src_h; y++) - { - memcpy (pdst, psrc, src_w + (src_x & 0x1)); - psrc += width; - /* YUV planar region is always 1024 bytes wide */ - pdst += 1024; - } + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - /* The difference between FOURCC_YV12 and FOURCC_I420 is the order - * that the U and V planes appear in the buffer. But at this point - * I just send the second buffer as V and the third buffer as U. - * Depending on the format, the packing will be different and we - * handle it in the the way we pick the source format for the blit - * later on. */ - - pdst = (char *)pTDFX->MMIOBase[0] + YUV_V_BASE; - psrc = (char*)buf + width * height; - /* psrc now points to the base of the V plane, move out to src_x/2, - * src_y/2 */ - psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); - for (y = 0; y < src_h >> 1; y++) - { - /* YUV planar region is always 1024 bytes wide */ - memcpy (pdst, psrc, src_w >> 1); - psrc += width >> 1; - pdst += 1024; - } - pdst = (char *)pTDFX->MMIOBase[0] + YUV_U_BASE; - psrc = (char*)buf + width * height + (width >> 1) * (height >> 1); - /* psrc now points to the base of the U plane, move out to src_x/2, - * src_y/2 */ - psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); - for (y = 0; y < src_h >> 1; y++) - { - /* YUV planar region is always 1024 bytes wide */ - memcpy (pdst, psrc, src_w >> 1); - psrc += width >> 1; - pdst += 1024; + if (cleanup) { + if(pTDFX->textureBuffer) { + xf86FreeOffscreenArea(pTDFX->textureBuffer); + pTDFX->textureBuffer = NULL; + } } +} - /* Before restoring trashed registers we have to wait for the conversion - * to finish. We aren't using the FIFO for this but the hardware can - * take a little extra time even after we finish all the writes. If we - * restore the registers before it finishes it can store some of the YUV - * data to the wrong place. One particular wrong place is often on top - * of the hardware cursor data. So we wait for the status register - * to go idle. */ - /* XXX Right now wait for the whole chip to go idle. This is more than - * is required. Find out which subsystem is handles the YUV packing and - * wait only on that status bit. */ - count = 0; - do - { - count++; - } while ((TDFXReadLongMMIO(pTDFX, 0) & SST_BUSY) && count < 1000); - - /* Restore trashed registers */ - TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, yuvBaseAddr); - TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, yuvStride); + +static void +TDFXScreenToScreenYUVStretchBlit (ScrnInfoPtr pScrn, + short src_x1, short src_y1, + short src_x2, short src_y2, + short dst_x1, short dst_y1, + short dst_x2, short dst_y2) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + /* reformulate the paramaters the way the hardware wants them */ + INT32 src_x = src_x1 & 0x1FFF; + INT32 src_y = src_y1 & 0x1FFF; + INT32 dst_x = dst_x1 & 0x1FFF; + INT32 dst_y = dst_y1 & 0x1FFF; + INT32 src_w = (src_x2 - src_x1) & 0x1FFF; + INT32 src_h = (src_y2 - src_y1) & 0x1FFF; + INT32 dst_w = (dst_x2 - dst_x1) & 0x1FFF; + INT32 dst_h = (dst_y2 - dst_y1) & 0x1FFF; + /* Setup for blit src and dest */ + TDFXMakeRoom(pTDFX, 4); + DECLARE(SSTCP_DSTSIZE|SSTCP_SRCSIZE|SSTCP_DSTXY|SSTCP_COMMAND/*|SSTCP_COMMANDEXTRA*/); + /* TDFXWriteLong(pTDFX, SST_2D_COMMANDEXTRA, SST_COMMANDEXTRA_VSYNC);*/ + TDFXWriteLong(pTDFX, SST_2D_SRCSIZE, src_w | (src_h<<16)); + TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, dst_w | (dst_h<<16)); + TDFXWriteLong(pTDFX, SST_2D_DSTXY, dst_x | (dst_y<<16)); + TDFXWriteLong(pTDFX, SST_2D_COMMAND, SST_2D_SCRNTOSCRNSTRETCH | 0xCC000000); + /* Write to the launch area to start the blit */ + TDFXMakeRoom(pTDFX, 1); + DECLARE_LAUNCH(1, 0); + TDFXWriteLong(pTDFX, SST_2D_LAUNCH, (src_x<<1) | (src_y<<16)); + /* Wait for it to happen */ + TDFXSendNOPFifo2D(pScrn); } -static int -TDFXPutImage( - ScrnInfoPtr pScrn, - short src_x, short src_y, - short drw_x, short drw_y, - short src_w, short src_h, - short drw_w, short drw_h, - int id, unsigned char* buf, - short width, short height, - Bool sync, - RegionPtr clipBoxes, pointer data - ) + +static void +YUVPlanarToPacked (ScrnInfoPtr pScrn, + short src_x, short src_y, + short src_h, short src_w, + int id, char *buf, + short width, short height, + FBAreaPtr fbarea) { TDFXPtr pTDFX = TDFXPTR(pScrn); + char *psrc, *pdst; + int count; + int baseaddr; + INT32 yuvBaseAddr, yuvStride; + + /* Save these registers so I can restore them when we are done. */ + yuvBaseAddr = TDFXReadLongMMIO(pTDFX, YUVBASEADDR); + yuvStride = TDFXReadLongMMIO(pTDFX, YUVSTRIDE); + + /* Set yuvBaseAddress and yuvStride. */ + baseaddr = pTDFX->fbOffset + pTDFX->cpp * fbarea->box.x1 + pTDFX->stride * fbarea->box.y1; + TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, pTDFX->stride); + TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, baseaddr); + + /* Copy Y plane (twice as much Y as U or V) */ + psrc = (char *)buf; + psrc += (src_x & ~0x1) + src_y * width; + pdst = (char *)pTDFX->MMIOBase[0] + YUV_Y_BASE; + TDFXCopyData(psrc, pdst, width, 1024, src_h, src_w + (src_x & 0x1)); + + /* Copy V plane */ + psrc = (char*)buf + width * height; + psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); + pdst = (char *)pTDFX->MMIOBase[0] + YUV_V_BASE; + TDFXCopyData(psrc, pdst, width >> 1, 1024, src_h >> 1, src_w >> 1); + + /* Copy U plane */ + psrc = (char*)buf + width * height + (width >> 1) * (height >> 1); + psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); + pdst = (char *)pTDFX->MMIOBase[0] + YUV_U_BASE; + TDFXCopyData(psrc, pdst, width >> 1, 1024, src_h >> 1, src_w >> 1); + + /* IDLE until the copy finished, timeout for safety */ + for (count = 0; count < 1000; count++) + if (!((TDFXReadLongMMIO(pTDFX, STATUS) & SST_BUSY))) + break; + + /* Restore trashed registers */ + TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, yuvBaseAddr); + TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, yuvStride); + + /* Wait for it to happen */ + TDFXSendNOPFifo2D(pScrn); +} + +static int +TDFXPutImageTexture( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, + RegionPtr clipBoxes, pointer data + ) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); BoxPtr pbox; int nbox; + int format; + + /* Check the source format */ + if (id == FOURCC_YV12) format = SST_2D_FORMAT_YUYV; + else if (id == FOURCC_UYVY) format = SST_2D_FORMAT_UYVY; + else return BadAlloc; + + /* Get a buffer to store the packed YUV data */ + if (!(pTDFX->textureBuffer = TDFXAllocateMemoryArea(pScrn, pTDFX->textureBuffer, src_w, src_h))) + return BadAlloc; + + /* Pack the YUV data in offscreen memory using YUV framebuffer (0x[CDE]0000) */ + YUVPlanarToPacked (pScrn, src_x, src_y, src_h, src_w, + id, (char *)buf, width, height, + pTDFX->textureBuffer); + + /* Setup source and destination pixel formats (yuv -> rgb) */ + TDFXMakeRoom(pTDFX, 2); + DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); + TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->stride|((pTDFX->cpp+1)<<16)); + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->stride|((format)<<16)); + + /* Blit packed YUV data from offscreen memory, respecting clips */ +#define SRC_X1 (pTDFX->textureBuffer->box.x1) +#define SRC_Y1 (pTDFX->textureBuffer->box.y1) +#define SCALEX(dx) ((int)(((dx) * src_w) / drw_w)) +#define SCALEY(dy) ((int)(((dy) * src_h) / drw_h)) + for (nbox = REGION_NUM_RECTS(clipBoxes), + pbox = REGION_RECTS(clipBoxes); nbox > 0; nbox--, pbox++) + { + TDFXScreenToScreenYUVStretchBlit (pScrn, + SRC_X1 + SCALEX(pbox->x1 - drw_x), + SRC_Y1 + SCALEY(pbox->y1 - drw_y), + SRC_X1 + SCALEX(pbox->x2 - drw_x), + SRC_Y1 + SCALEY(pbox->y2 - drw_y), + pbox->x1, pbox->y1, + pbox->x2, pbox->y2); + } - FBAreaPtr fbarea; + /* Restore the WAX registers we trashed */ + TDFXMakeRoom(pTDFX, 2); + DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); + TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->sst2DDstFmtShadow); + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->sst2DSrcFmtShadow); - /* Make sure we are synced up (this really means, lock and find the - * fifo pointer. */ - TDFXFirstSync (pScrn); + /* Wait for it to happen */ + TDFXSendNOPFifo2D(pScrn); - /* Do the right thing for the given format */ - switch (id) - { - case FOURCC_YV12: - case FOURCC_I420: - /* Get a buffer to use to store the packed YUV data */ - fbarea = TDFXAllocateOffscreenBuffer (pScrn, id, src_w, src_h); - - if (!fbarea) - { - return Success; - } + return Success; +} - YUVPlanarToPacked (pScrn, src_x, src_y, src_h, src_w, - id, (char *)buf, width, height, - fbarea); - /* Don't know what executed last so we need to send a NOP */ - TDFXSendNOP(pScrn); - - /* Setup the dst and src format once, they don't change for all the - * blits. */ - TDFXMakeRoom(pTDFX, 2); - DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); - TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, - pTDFX->stride|((pTDFX->cpp+1)<<16)); - if (id == FOURCC_YV12) - { - /* Packed format is YUYV */ - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, - pTDFX->stride|((SST_2D_FORMAT_YUYV)<<16)); - } - else - { - /* Packed format is UYVY */ - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, - pTDFX->stride|((SST_2D_FORMAT_UYVY)<<16)); - } - /* Traverse the clip boxes */ - nbox = REGION_NUM_RECTS(clipBoxes); - pbox = REGION_RECTS(clipBoxes); - - while (nbox--) - { - /* The destination clip regions come with the clip boxes, but - * the src coordinates have to be computed because we are doing - * a stretch blit. These macros perform that compuation, but - * they could use some work. When testing with still images these - * computations caused some jitter in the resulting output, but - * with actual video playback I haven't noticed any problems. */ -#define SRC_X1 (fbarea->box.x1) -#define SRC_Y1 (fbarea->box.y1 + pScrn->virtualY) -#define SCALEX(dx) ((int)(((dx) * src_w + (drw_w>>1)) / drw_w)) -#define SCALEY(dy) ((int)(((dy) * src_h + (drw_h>>1)) / drw_h)) - - /* Do the screen-to-screen blit clipped to the clip boxes. */ - TDFXScreenToScreenYUVStretchBlit - (pScrn, - SRC_X1 + SCALEX(pbox->x1 - drw_x), - SRC_Y1 + SCALEY(pbox->y1 - drw_y), - SRC_X1 + SCALEX(pbox->x2 - drw_x), - SRC_Y1 + SCALEY(pbox->y2 - drw_y), - /* these destination coordinates come - * right from the clip box. */ - pbox->x1, pbox->y1, - pbox->x2, pbox->y2); - pbox++; - } +/* + * COMMON DRAWING FUNCTIONS + */ - /* Restore the WAX registers we trashed */ - TDFXMakeRoom(pTDFX, 2); - DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); - TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->sst2DDstFmtShadow); - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->sst2DSrcFmtShadow); +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } - /* The rest of the driver won't know what I have done so I do a stall to - * make sure the next command sent will work. */ - TDFXSendNOP(pScrn); - break; - /* XXX What am I supposed to do about the sync flag? */ + return TRUE; +} - } - return Success; +static Bool +TDFXClipVideo( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); + int diff; + + hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); + vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); + + *xa <<= 16; *xb <<= 16; + *ya <<= 16; *yb <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *xa += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *xb -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *ya += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *yb -= diff * vscale; + } + + if(*xa < 0) { + diff = (- *xa + hscale - 1)/ hscale; + dst->x1 += diff; + *xa += diff * hscale; + } + delta = *xb - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *xb -= diff * hscale; + } + if(*xa >= *xb) return FALSE; + + if(*ya < 0) { + diff = (- *ya + vscale - 1)/ vscale; + dst->y1 += diff; + *ya += diff * vscale; + } + delta = *yb - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *yb -= diff * vscale; + } + if(*ya >= *yb) return FALSE; + + if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || + (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + { + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); + } + return TRUE; } -/* This code doesn't work yet. Eventually this should use the video overlay - * instead of the YUV-stretch-blit. The overlay is better because it uses - * bilinear filtering when scaling. */ -#if 0 -static int -TDFXPutImageOverlay( - ScrnInfoPtr pScrn, - short src_x, short src_y, - short drw_x, short drw_y, - short src_w, short src_h, - short drw_w, short drw_h, - int id, unsigned char* buf, - short width, short height, - Bool sync, - RegionPtr clipBoxes, pointer data - ) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); - BoxPtr pbox; - int nbox; +/* + * OVERLAY DRAWING FUNCTIONS + */ - /* Computed Register values */ - INT32 - vidInFormat; - static FBAreaPtr fbarea; +static void +TDFXResetVideoOverlay(ScrnInfoPtr pScrn) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + + /* reset the video */ + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pTDFX->writeLong(pTDFX, RGBMAXDELTA, 0x0080808); + pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); + pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); +} - /* Do the right thing for the given format */ - switch (id) - { - case FOURCC_YV12: - case FOURCC_I420: - - /* Get a buffer to use to store the packed YUV data */ - fbarea = TDFXAllocateOffscreenBuffer (pScrn, id, src_w, src_h); - - if (!fbarea) - return Success; - - YUVPlanarToPacked (pScrn, - src_x, src_y, src_h, src_w, - id, buf, width, height, - fbarea); - - /* Setup the overlay */ - TDFXWriteLongMMIO(pTDFX, VIDOVERLAYSTARTCOORDS, - (drw_x&0x7FF) | ((drw_y & 0x7FF) << 12) - /* XXX Lower 2 bits of X and Y? */); - TDFXWriteLongMMIO(pTDFX, VIDOVERLAYENDSCREENCOORDS, - ((drw_x+drw_w)&0x7FF) | (((drw_y+drw_h)&0x7FF) << 12)); - - /* Set the Video in format */ - vidInFormat = 0; - /* These magic numbers come from the spec on page 151 */ - if (id == FOURCC_YV12) - { - /* Packed format is YUYV */ - vidInFormat = 0x9 << 1; - } - else - { - /* Packed format is UYVY */ - vidInFormat = 0xA << 1; - } +static void +TDFXStopVideoOverlay(ScrnInfoPtr pScrn, pointer data, Bool cleanup) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; - TDFXWriteLongMMIO (pTDFX, VIDINFORMAT, vidInFormat); - TDFXWriteLongMMIO (pTDFX, VIDINSTRIDE, src_w); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - /* Use magenta as the chroma color */ - if (pTDFX->cpp == 2) - { - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMIN, - 0x0000F71F); - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMAX, - 0x0000F71F); + if(cleanup) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); } - else /* (pTDFX->cpp == 3) */ - { - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMIN, - 0x00FF00FF); - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMAX, - 0x00FF00FF); + if(pTDFX->overlayBuffer) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer); + pTDFX->overlayBuffer = NULL; } - - /* Set the src address */ - TDFXWriteLongMMIO (pTDFX, VIDINADDR0, - pTDFX->fbOffset - + pTDFX->stride * (fbarea->box.y1 + pScrn->virtualY) - + fbarea->box.x1); - - /* Traverse the clip boxes */ - nbox = REGION_NUM_RECTS(clipBoxes); - pbox = REGION_RECTS(clipBoxes); - - while (nbox--) - { - pbox++; + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; } - break; + } +} + + +static void +TDFXDisplayVideoOverlay( + ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int pitch, + int left, int right, int top, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + int dudx, dvdy; + + dudx = (src_w << 20) / drw_w; + dvdy = (src_h << 20) / drw_h; + + offset += ((left >> 16) & ~1) << 1; + left = (left & 0x0001ffff) << 3; + + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->ModeReg.vidcfg |= 0x00000320; + + if(drw_w != src_w) pTDFX->ModeReg.vidcfg |= (1 << 14); + if(drw_h != src_h) pTDFX->ModeReg.vidcfg |= (1 << 15); + if(id == FOURCC_UYVY) pTDFX->ModeReg.vidcfg |= (6 << 21); + else pTDFX->ModeReg.vidcfg |= (5 << 21); + if(pScrn->depth == 8) pTDFX->ModeReg.vidcfg |= (1 << 11); + if(pPriv->filterQuality) pTDFX->ModeReg.vidcfg |= (3 << 16); + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + + pTDFX->writeLong(pTDFX, VIDOVERLAYSTARTCOORDS, dstBox->x1 | (dstBox->y1 << 12)); + pTDFX->writeLong(pTDFX, VIDOVERLAYENDSCREENCOORDS, (dstBox->x2 - 1) | ((dstBox->y2 - 1) << 12)); + pTDFX->writeLong(pTDFX, VIDOVERLAYDUDX, dudx); + pTDFX->writeLong(pTDFX, VIDOVERLAYDUDXOFFSETSRCWIDTH, left | (src_w << 20)); + pTDFX->writeLong(pTDFX, VIDOVERLAYDVDY, dvdy); + pTDFX->writeLong(pTDFX, VIDOVERLAYDVDYOFFSET, (top & 0x0000ffff) << 3); + + pTDFX->ModeReg.stride &= 0x0000ffff; + pTDFX->ModeReg.stride |= pitch << 16; + pTDFX->writeLong(pTDFX, VIDDESKTOPOVERLAYSTRIDE, pTDFX->ModeReg.stride); + pTDFX->writeLong(pTDFX, SST_3D_LEFTOVERLAYBUF, offset & ~3); + pTDFX->writeLong(pTDFX, VIDINADDR0, offset & ~3); +} + + +static int +TDFXPutImageOverlay( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool Sync, + RegionPtr clipBoxes, pointer data +){ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + INT32 xa, xb, ya, yb; + unsigned char *dst_start; + int pitch, new_size, offset; + int s2offset = 0, s3offset = 0; + int srcPitch = 0, srcPitch2 = 0; + int dstPitch; + int top, left, npixels, nlines, bpp; + BoxRec dstBox; + CARD32 tmp; + + /* + * s2offset, s3offset - byte offsets into U and V plane of the + * source where copying starts. Y plane is + * done by editing "buf". + * + * offset - byte offset to the first line of the destination. + * + * dst_start - byte address to the first displayed pel. + * + */ + + if(src_w > drw_w) drw_w = src_w; + if(src_h > drw_h) drw_h = src_h; + + /* Clip */ + xa = src_x; + xb = src_x + src_w; + ya = src_y; + yb = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!TDFXClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + bpp = pScrn->bitsPerPixel >> 3; + pitch = bpp * pScrn->displayWidth; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + dstPitch = ((width << 1) + 3) & ~3; + new_size = ((dstPitch * height) + bpp - 1) / bpp; + srcPitch = (width + 3) & ~3; + s2offset = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + dstPitch = ((width << 1) + 3) & ~3; + new_size = ((dstPitch * height) + bpp - 1) / bpp; + srcPitch = (width << 1); + break; } - return Success; + + if(!(pTDFX->overlayBuffer = TDFXAllocateMemoryLinear(pScrn, pTDFX->overlayBuffer, new_size))) + return BadAlloc; + + /* copy data */ + top = ya >> 16; + left = (xa >> 16) & ~1; + npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; + + offset = (pTDFX->overlayBuffer->offset * bpp) + (top * dstPitch) + pTDFX->fbOffset; + dst_start = pTDFX->FbBase + offset; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + dst_start += left << 1; + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if(id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; + TDFXCopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, + buf + s3offset, dst_start, srcPitch, srcPitch2, + dstPitch, nlines, npixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + left <<= 1; + buf += (top * srcPitch) + left; + nlines = ((yb + 0xffff) >> 16) - top; + dst_start += left; + TDFXCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels << 1); + break; + } + + if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey, + GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + TDFXDisplayVideoOverlay(pScrn, id, offset, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + pTDFX->VideoTimerCallback = TDFXVideoTimerCallback; + + return Success; } -#endif static void -TDFXDeallocateOffscreenBuffer (ScrnInfoPtr pScrn, int id) +TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time) { - TDFXPtr pTDFX = TDFXPTR(pScrn); - - /* There is only one buffer so just deallocate it */ - if (pTDFX->offscreenYUVBuf) - xf86FreeOffscreenArea (pTDFX->offscreenYUVBuf); + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + + if(pPriv->videoStatus & TIMER_MASK) { + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < time) { + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = time + FREE_DELAY; + } + } else + if(pPriv->videoStatus & FREE_TIMER) { + if(pPriv->freeTime < time) { + if(pTDFX->overlayBuffer) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer); + pTDFX->overlayBuffer = NULL; + } + pPriv->videoStatus = 0; + pTDFX->VideoTimerCallback = NULL; + } + } + } else /* shouldn't get here */ + pTDFX->VideoTimerCallback = NULL; } + +/* + * MEMORY MANAGEMENT + */ + + static FBAreaPtr -TDFXAllocateOffscreenBuffer (ScrnInfoPtr pScrn, int id, int width, int height) +TDFXAllocateMemoryArea (ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height) { - int myWidth; TDFXPtr pTDFX = TDFXPTR(pScrn); + ScreenPtr pScreen; + FBAreaPtr new_area; - if (!pTDFX) - return NULL; - - /* We tweak the width slightly */ - myWidth = width; - /* We tweak the width slightly */ - myWidth = width; - - /* width is measured in pixels. The pixels in the YUV image are alway - * 8 bit YUV data. But, the xf86 offscreen manager allocates in terms of - * desktop pixels, so we adjust. */ - myWidth = myWidth / pTDFX->cpp; - if (width % pTDFX->cpp) - myWidth++; - - /* If we are putting up a subimage then we need an extra column of data - * if the source width is odd, instead of checkin the width just always - * allocate an extra column. */ - /* XXX is this really necessary? */ - myWidth++; - - if (pTDFX->offscreenYUVBuf != NULL && - myWidth == pTDFX->offscreenYUVBufWidth && - height == pTDFX->offscreenYUVBufHeight) - { - /* we already have a buffer, don't do anything. */ - return pTDFX->offscreenYUVBuf; - } - - /* We have a buffer, but its not the right size so resize it */ - if (pTDFX->offscreenYUVBuf != NULL) - { - if (!xf86ResizeOffscreenArea (pTDFX->offscreenYUVBuf, - myWidth, - height)) - { - return (NULL); - } + if (area) { + if ((area->box.x2 - area->box.x1 >= width) && + (area->box.y2 - area->box.y1 >= height)) + return area; + + if (xf86ResizeOffscreenArea(area, width, height)) + return area; + + xf86FreeOffscreenArea(area); } - else - { - /* Allocate a brand new buffer */ - pTDFX->offscreenYUVBuf = - xf86AllocateOffscreenArea (pScrn->pScreen, - myWidth, - height, - 0, - NULL, NULL, NULL); + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pTDFX->cpp, NULL, NULL, NULL); + + if (!new_area) { + int max_width, max_height; + + xf86QueryLargestOffscreenArea(pScreen, &max_width, &max_height, pTDFX->cpp, 0, PRIORITY_EXTREME); + + if (max_width < width || max_height < height) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pTDFX->cpp, NULL, NULL, NULL); } - /* Return the buffer */ - pTDFX->offscreenYUVBufWidth = myWidth; - pTDFX->offscreenYUVBufHeight = height; - return (pTDFX->offscreenYUVBuf); + return new_area; } -static int -TDFXQueryImageAttributes( - ScrnInfoPtr pScrn, - int id, - unsigned short *w, unsigned short *h, - int *pitches, int *offsets) +static FBLinearPtr +TDFXAllocateMemoryLinear (ScrnInfoPtr pScrn, FBLinearPtr linear, int size) { + ScreenPtr pScreen; + FBLinearPtr new_linear; - int size; - TDFXPtr pTDFX = TDFXPTR(pScrn); + if(linear) { + if(linear->size >= size) + return linear; - /* The Maximum size for 3dfx YUV planar space - * but our temporary buffer has to fit in the pixmap region which - * is the same width as the desktop and pTDFX->pixmapCacheLines - * pixels high. - */ - if(*w > 1024) *w = 1024; - if (*w > pTDFX->stride) *w = pTDFX->stride; - if(*h > pTDFX->pixmapCacheLines) *h = pTDFX->pixmapCacheLines; + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; + xf86FreeOffscreenLinear(linear); + } + pScreen = screenInfo.screens[pScrn->scrnIndex]; - if (offsets) offsets[0] = 0; - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - if (pitches) pitches[0] = *w; - /* Size of Y plane plus the size of U and V planes */ - size = *w * *h; - if (offsets) offsets[1] = size; - size += ((*w >> 1) * (*h >> 1)); - if (offsets) offsets[2] = size; - size += ((*w >> 1) * (*h >> 1)); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) pitches[0] = size; - size *= *h; - break; - } - return size; + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, NULL, NULL, NULL); + + if(!new_linear) { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, PRIORITY_EXTREME); + + if(max_size < size) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, NULL, NULL, NULL); + } + + return new_linear; } #endif /* !XvExtension */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h index c77566b78..a925b22ca 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.9 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.8 2000/12/01 14:29:00 dawes Exp $ */ /* Voodoo Banshee driver version 1.0.1 @@ -47,8 +47,10 @@ #define SST_DESKTOP_CLUT_BYPASS BIT(10) #define SST_HALF_MODE BIT(4) #define SST_CURSOR_EN BIT(27) +#define SST_FBI_BUSY BIT(7) #define SST_BUSY BIT(9) #define SST_RETRACE BIT(6) +#define SST_COMMANDEXTRA_VSYNC BIT(2) #define MEM_TYPE_SGRAM 0 #define MEM_TYPE_SDRAM 1 @@ -198,9 +200,11 @@ #define SST_3D_COMMAND SST_3D_OFFSET+0x120 #define SST_3D_SLICTRL SST_3D_OFFSET+0x20C #define SST_3D_AACTRL SST_3D_OFFSET+0x210 -#define SST_3D_CHIPMASK SST_3D_OFFSET+0x214 +#define SST_3D_LEFTOVERLAYBUF SST_3D_OFFSET+0x250 +#define SST_3D_RIGHTOVERLAYBUF SST_3D_OFFSET+0x254 /* NAPALM REGISTERS */ +#define CFG_PCI_COMMAND 4 #define CFG_MEM0BASE 16 #define CFG_MEM1BASE 20 #define CFG_INIT_ENABLE 64 diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel index 54afeb68e..a39b3cc51 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel @@ -43,13 +43,14 @@ else endif gamma-objs := gamma_drv.o gamma_dma.o -tdfx-objs := tdfx_drv.o tdfx_drm.o +tdfx-objs := tdfx_drv.o tdfx_context.o r128-objs := r128_drv.o r128_cce.o r128_context.o r128_bufs.o \ r128_state.o radeon-objs := radeon_drv.o radeon_cp.o radeon_context.o radeon_bufs.o \ radeon_state.o ffb-objs := ffb_drv.o ffb_context.o -mga-objs := mga_drv.o mga_drm.o mga_dma.o mga_state.o mga_warp.o +mga-objs := mga_drv.o mga_dma.o mga_context.o mga_bufs.o \ + mga_state.o i810-objs := i810_drv.o i810_dma.o i810_context.o i810_bufs.o obj-$(CONFIG_DRM_GAMMA) += gamma.o diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux index 9335b1847..b5aca0a89 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux @@ -47,8 +47,6 @@ # **** End of SMP/MODVERSIONS detection -#MODS= gamma.o tdfx.o r128.o radeon.o -#LIBS= libdrm.a MODS= gamma.o tdfx.o LIBS= @@ -137,9 +135,13 @@ ifeq ($(AGP),1) MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE #DRMOBJS += agpsupport.o MODS += mga.o r128.o radeon.o -#ifeq ($(MACHINE),i386) +ifeq ($(MACHINE),i386) MODS += i810.o -#endif +endif +ifeq ($(MACHINE),i686) +MODS += i810.o +endif + MGAOBJS= mga_drv.o mga_dma.o mga_state.o mga_warp.o MGAHEADERS= mga.h mga_drv.h $(DRMHEADERS) $(DRMTEMPLATES) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h index a238f85cd..470eb0335 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h @@ -181,7 +181,7 @@ typedef enum { _DRM_STAT_DMA, /* DMA */ _DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /* Missed DMA opportunity */ - + /* Add to the *END* of the list */ } drm_stat_type_t; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h index a238f85cd..470eb0335 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h @@ -181,7 +181,7 @@ typedef enum { _DRM_STAT_DMA, /* DMA */ _DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /* Missed DMA opportunity */ - + /* Add to the *END* of the list */ } drm_stat_type_t; |