Compare commits
85 Commits
vulkan-hea
...
mesa_3_1
Author | SHA1 | Date | |
---|---|---|---|
|
b0294cbbfe | ||
|
e2ff9be0b6 | ||
|
16283fea40 | ||
|
82ba9449e1 | ||
|
2377ea9c66 | ||
|
ac3593ada5 | ||
|
d6dd996e56 | ||
|
cee556daea | ||
|
313f225a2e | ||
|
95d565b64c | ||
|
32ea1fdc7e | ||
|
8d52ee9ae1 | ||
|
9a07202f5e | ||
|
0f953d69e5 | ||
|
b3a1034c05 | ||
|
8956d5131d | ||
|
428cf99956 | ||
|
1e5dab20fd | ||
|
aa5251d170 | ||
|
607add71d9 | ||
|
074710629d | ||
|
7f0b5dd69c | ||
|
09b83c889b | ||
|
9c416c235b | ||
|
6ce3f22ae9 | ||
|
32093ccc86 | ||
|
d5ff1d782b | ||
|
2ed8894aca | ||
|
33cd8a5490 | ||
|
dd25e9852a | ||
|
05df9bb6e0 | ||
|
a335bf404f | ||
|
783a67260a | ||
|
e99e126479 | ||
|
98fce32683 | ||
|
9493e540f9 | ||
|
7138d38cc1 | ||
|
9e7f0e1f7c | ||
|
52345bfa1e | ||
|
93070bceca | ||
|
5b90676fc7 | ||
|
92ad030cb7 | ||
|
9afe0e4278 | ||
|
3e63be01d1 | ||
|
c73eedbe96 | ||
|
8c54c4d9f7 | ||
|
33817940c4 | ||
|
7ec2e161ac | ||
|
fc2e8cd0d0 | ||
|
a3ea9edfda | ||
|
7fa9891de2 | ||
|
ddd9410a67 | ||
|
532dde3e99 | ||
|
2a6f393fa7 | ||
|
2d1b9e0402 | ||
|
19c878467f | ||
|
1041d573ff | ||
|
fda834160b | ||
|
7d35435bb6 | ||
|
5c191a62bc | ||
|
eca3b6e47e | ||
|
aa0a8624fb | ||
|
f16a627115 | ||
|
1d39975c4e | ||
|
62d5f4c73e | ||
|
d42cd99c66 | ||
|
03ef882735 | ||
|
19d0fcafb3 | ||
|
cc6e92ff49 | ||
|
463c2b6b77 | ||
|
09c133e16f | ||
|
bb1d3c1ad1 | ||
|
cabb6a91cd | ||
|
c76ac6b644 | ||
|
6842075a09 | ||
|
b1da189fe5 | ||
|
9b635315be | ||
|
702baf4cd3 | ||
|
b27ee886e4 | ||
|
276465cec6 | ||
|
5428538d65 | ||
|
ab5d4d6233 | ||
|
2450ce124b | ||
|
cf22eb77a7 | ||
|
569802cdb1 |
298
Makefile.X11
298
Makefile.X11
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.X11,v 1.12 1999/11/04 03:57:28 gareth Exp $
|
||||
# $Id: Makefile.X11,v 1.12.2.2 1999/12/14 20:54:24 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.1
|
||||
@@ -315,102 +315,102 @@ realclean: clean
|
||||
|
||||
|
||||
DIRECTORY = Mesa-3.1
|
||||
LIB_NAME = MesaLib-3.1beta3
|
||||
DEMO_NAME = MesaDemos-3.1beta3
|
||||
LIB_NAME = MesaLib-3.1
|
||||
DEMO_NAME = MesaDemos-3.1
|
||||
|
||||
|
||||
LIB_FILES = \
|
||||
$(DIRECTORY)/Makefile* \
|
||||
$(DIRECTORY)/Make-config \
|
||||
$(DIRECTORY)/acconfig.h \
|
||||
$(DIRECTORY)/acinclude.m4 \
|
||||
$(DIRECTORY)/aclocal.m4 \
|
||||
$(DIRECTORY)/conf.h.in \
|
||||
$(DIRECTORY)/config.guess \
|
||||
$(DIRECTORY)/config.sub \
|
||||
$(DIRECTORY)/configure \
|
||||
$(DIRECTORY)/configure.in \
|
||||
$(DIRECTORY)/install-sh \
|
||||
$(DIRECTORY)/ltconfig \
|
||||
$(DIRECTORY)/ltmain.sh \
|
||||
$(DIRECTORY)/missing \
|
||||
$(DIRECTORY)/mkinstalldirs \
|
||||
$(DIRECTORY)/stamp-h.in \
|
||||
$(DIRECTORY)/configure \
|
||||
$(DIRECTORY)/docs/CONFIG \
|
||||
$(DIRECTORY)/docs/CONFORM \
|
||||
$(DIRECTORY)/docs/COPYING \
|
||||
$(DIRECTORY)/docs/COPYRIGHT \
|
||||
$(DIRECTORY)/docs/DEVINFO \
|
||||
$(DIRECTORY)/docs/IAFA-PACKAGE \
|
||||
$(DIRECTORY)/docs/INSTALL \
|
||||
$(DIRECTORY)/docs/INSTALL.GNU \
|
||||
$(DIRECTORY)/docs/README \
|
||||
$(DIRECTORY)/docs/README.* \
|
||||
$(DIRECTORY)/docs/RELNOTES \
|
||||
$(DIRECTORY)/docs/VERSIONS \
|
||||
$(DIRECTORY)/docs/*.spec \
|
||||
$(DIRECTORY)/bin/README \
|
||||
$(DIRECTORY)/bin/mklib* \
|
||||
$(DIRECTORY)/*.BAT \
|
||||
$(DIRECTORY)/*.bat \
|
||||
$(DIRECTORY)/descrip.mms \
|
||||
$(DIRECTORY)/mms-config \
|
||||
$(DIRECTORY)/xlib.opt \
|
||||
$(DIRECTORY)/STARTUP.MK \
|
||||
$(DIRECTORY)/mesawin32.mak \
|
||||
$(DIRECTORY)/Names.win \
|
||||
$(DIRECTORY)/win32-openstep.sh \
|
||||
$(DIRECTORY)/*.dja \
|
||||
$(DIRECTORY)/include/GL/Makefile.in \
|
||||
$(DIRECTORY)/include/GL/Makefile.am \
|
||||
$(DIRECTORY)/include/GL/dosmesa.h \
|
||||
$(DIRECTORY)/include/GL/foomesa.h \
|
||||
$(DIRECTORY)/include/GL/fxmesa.h \
|
||||
$(DIRECTORY)/include/GL/ggimesa.h \
|
||||
$(DIRECTORY)/include/GL/gl.h \
|
||||
$(DIRECTORY)/include/GL/gl_mangle.h \
|
||||
$(DIRECTORY)/include/GL/glu.h \
|
||||
$(DIRECTORY)/include/GL/glu_mangle.h \
|
||||
$(DIRECTORY)/include/GL/glx.h \
|
||||
$(DIRECTORY)/include/GL/glx_mangle.h \
|
||||
$(DIRECTORY)/include/GL/mglmesa.h \
|
||||
$(DIRECTORY)/include/GL/osmesa.h \
|
||||
$(DIRECTORY)/include/GL/svgamesa.h \
|
||||
$(DIRECTORY)/include/GL/wmesa.h \
|
||||
$(DIRECTORY)/include/GL/xmesa.h \
|
||||
$(DIRECTORY)/include/GL/xmesa_x.h \
|
||||
$(DIRECTORY)/include/GL/xmesa_xf86.h \
|
||||
$(DIRECTORY)/include/GLView.h \
|
||||
$(DIRECTORY)/include/Makefile.in \
|
||||
$(DIRECTORY)/include/Makefile.am \
|
||||
$(DIRECTORY)/src/Makefile* \
|
||||
$(DIRECTORY)/src/descrip.mms \
|
||||
$(DIRECTORY)/src/mms_depend \
|
||||
$(DIRECTORY)/src/mesa.conf \
|
||||
$(DIRECTORY)/src/*.def \
|
||||
$(DIRECTORY)/src/depend \
|
||||
$(DIRECTORY)/src/*.[chS] \
|
||||
$(DIRECTORY)/src/Allegro/*.[ch] \
|
||||
$(DIRECTORY)/src/BeOS/*.cpp \
|
||||
$(DIRECTORY)/src/D3D/*.cpp \
|
||||
$(DIRECTORY)/src/D3D/*.CPP \
|
||||
$(DIRECTORY)/src/D3D/*.h \
|
||||
$(DIRECTORY)/src/D3D/*.H \
|
||||
$(DIRECTORY)/src/D3D/*.c \
|
||||
$(DIRECTORY)/src/D3D/*.C \
|
||||
$(DIRECTORY)/src/D3D/MAKEFILE \
|
||||
$(DIRECTORY)/src/D3D/*bat \
|
||||
$(DIRECTORY)/src/D3D/*DEF \
|
||||
$(DIRECTORY)/src/DOS/DEPEND.DOS \
|
||||
$(DIRECTORY)/src/DOS/*.c \
|
||||
$(DIRECTORY)/src/FX/Makefile.am \
|
||||
$(DIRECTORY)/src/FX/Makefile.in \
|
||||
$(DIRECTORY)/src/FX/*.[ch] \
|
||||
$(DIRECTORY)/src/FX/*.def \
|
||||
$(DIRECTORY)/src/FX/X86/Makefile.am \
|
||||
$(DIRECTORY)/src/FX/X86/Makefile.in \
|
||||
$(DIRECTORY)/src/FX/X86/*.[Shc] \
|
||||
$(DIRECTORY)/Makefile* \
|
||||
$(DIRECTORY)/Make-config \
|
||||
$(DIRECTORY)/acconfig.h \
|
||||
$(DIRECTORY)/acinclude.m4 \
|
||||
$(DIRECTORY)/aclocal.m4 \
|
||||
$(DIRECTORY)/conf.h.in \
|
||||
$(DIRECTORY)/config.guess \
|
||||
$(DIRECTORY)/config.sub \
|
||||
$(DIRECTORY)/configure \
|
||||
$(DIRECTORY)/configure.in \
|
||||
$(DIRECTORY)/install-sh \
|
||||
$(DIRECTORY)/ltconfig \
|
||||
$(DIRECTORY)/ltmain.sh \
|
||||
$(DIRECTORY)/missing \
|
||||
$(DIRECTORY)/mkinstalldirs \
|
||||
$(DIRECTORY)/stamp-h.in \
|
||||
$(DIRECTORY)/configure \
|
||||
$(DIRECTORY)/docs/CONFIG \
|
||||
$(DIRECTORY)/docs/CONFORM \
|
||||
$(DIRECTORY)/docs/COPYING \
|
||||
$(DIRECTORY)/docs/COPYRIGHT \
|
||||
$(DIRECTORY)/docs/DEVINFO \
|
||||
$(DIRECTORY)/docs/IAFA-PACKAGE \
|
||||
$(DIRECTORY)/docs/INSTALL \
|
||||
$(DIRECTORY)/docs/INSTALL.GNU \
|
||||
$(DIRECTORY)/docs/README \
|
||||
$(DIRECTORY)/docs/README.* \
|
||||
$(DIRECTORY)/docs/RELNOTES \
|
||||
$(DIRECTORY)/docs/VERSIONS \
|
||||
$(DIRECTORY)/docs/*.spec \
|
||||
$(DIRECTORY)/bin/README \
|
||||
$(DIRECTORY)/bin/mklib* \
|
||||
$(DIRECTORY)/*.BAT \
|
||||
$(DIRECTORY)/*.bat \
|
||||
$(DIRECTORY)/descrip.mms \
|
||||
$(DIRECTORY)/mms-config \
|
||||
$(DIRECTORY)/xlib.opt \
|
||||
$(DIRECTORY)/STARTUP.MK \
|
||||
$(DIRECTORY)/mesawin32.mak \
|
||||
$(DIRECTORY)/Names.win \
|
||||
$(DIRECTORY)/win32-openstep.sh \
|
||||
$(DIRECTORY)/*.dja \
|
||||
$(DIRECTORY)/include/GL/Makefile.in \
|
||||
$(DIRECTORY)/include/GL/Makefile.am \
|
||||
$(DIRECTORY)/include/GL/dosmesa.h \
|
||||
$(DIRECTORY)/include/GL/foomesa.h \
|
||||
$(DIRECTORY)/include/GL/fxmesa.h \
|
||||
$(DIRECTORY)/include/GL/ggimesa.h \
|
||||
$(DIRECTORY)/include/GL/gl.h \
|
||||
$(DIRECTORY)/include/GL/gl_mangle.h \
|
||||
$(DIRECTORY)/include/GL/glu.h \
|
||||
$(DIRECTORY)/include/GL/glu_mangle.h \
|
||||
$(DIRECTORY)/include/GL/glx.h \
|
||||
$(DIRECTORY)/include/GL/glx_mangle.h \
|
||||
$(DIRECTORY)/include/GL/mglmesa.h \
|
||||
$(DIRECTORY)/include/GL/osmesa.h \
|
||||
$(DIRECTORY)/include/GL/svgamesa.h \
|
||||
$(DIRECTORY)/include/GL/wmesa.h \
|
||||
$(DIRECTORY)/include/GL/xmesa.h \
|
||||
$(DIRECTORY)/include/GL/xmesa_x.h \
|
||||
$(DIRECTORY)/include/GL/xmesa_xf86.h \
|
||||
$(DIRECTORY)/include/GLView.h \
|
||||
$(DIRECTORY)/include/Makefile.in \
|
||||
$(DIRECTORY)/include/Makefile.am \
|
||||
$(DIRECTORY)/src/Makefile* \
|
||||
$(DIRECTORY)/src/descrip.mms \
|
||||
$(DIRECTORY)/src/mms_depend \
|
||||
$(DIRECTORY)/src/mesa.conf \
|
||||
$(DIRECTORY)/src/*.def \
|
||||
$(DIRECTORY)/src/depend \
|
||||
$(DIRECTORY)/src/*.[chS] \
|
||||
$(DIRECTORY)/src/Allegro/*.[ch] \
|
||||
$(DIRECTORY)/src/BeOS/*.cpp \
|
||||
$(DIRECTORY)/src/D3D/*.cpp \
|
||||
$(DIRECTORY)/src/D3D/*.CPP \
|
||||
$(DIRECTORY)/src/D3D/*.h \
|
||||
$(DIRECTORY)/src/D3D/*.H \
|
||||
$(DIRECTORY)/src/D3D/*.c \
|
||||
$(DIRECTORY)/src/D3D/*.C \
|
||||
$(DIRECTORY)/src/D3D/MAKEFILE \
|
||||
$(DIRECTORY)/src/D3D/*bat \
|
||||
$(DIRECTORY)/src/D3D/*DEF \
|
||||
$(DIRECTORY)/src/DOS/DEPEND.DOS \
|
||||
$(DIRECTORY)/src/DOS/*.c \
|
||||
$(DIRECTORY)/src/FX/Makefile.am \
|
||||
$(DIRECTORY)/src/FX/Makefile.in \
|
||||
$(DIRECTORY)/src/FX/*.[ch] \
|
||||
$(DIRECTORY)/src/FX/*.def \
|
||||
$(DIRECTORY)/src/FX/X86/Makefile.am \
|
||||
$(DIRECTORY)/src/FX/X86/Makefile.in \
|
||||
$(DIRECTORY)/src/FX/X86/*.[Shc] \
|
||||
$(DIRECTORY)/src/GGI/Makefile.am \
|
||||
$(DIRECTORY)/src/GGI/Makefile.in \
|
||||
$(DIRECTORY)/src/GGI/*.[ch] \
|
||||
@@ -430,55 +430,67 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/src/GGI/include/ggi/mesa/Makefile.am \
|
||||
$(DIRECTORY)/src/GGI/include/ggi/mesa/Makefile.in \
|
||||
$(DIRECTORY)/src/GGI/include/ggi/mesa/*.h \
|
||||
$(DIRECTORY)/src/KNOWN_BUGS \
|
||||
$(DIRECTORY)/src/MGL/*.[ch] \
|
||||
$(DIRECTORY)/src/MGL/*.txt \
|
||||
$(DIRECTORY)/src/OSmesa/Makefile.am \
|
||||
$(DIRECTORY)/src/OSmesa/Makefile.in \
|
||||
$(DIRECTORY)/src/OSmesa/*.[ch] \
|
||||
$(DIRECTORY)/src/S3/*.[ch] \
|
||||
$(DIRECTORY)/src/S3/*.def \
|
||||
$(DIRECTORY)/src/S3/*.mak \
|
||||
$(DIRECTORY)/src/S3/*.rc \
|
||||
$(DIRECTORY)/src/SVGA/Makefile.am \
|
||||
$(DIRECTORY)/src/SVGA/Makefile.in \
|
||||
$(DIRECTORY)/src/SVGA/*.[ch] \
|
||||
$(DIRECTORY)/src/Windows/*.[ch] \
|
||||
$(DIRECTORY)/src/Windows/*.def \
|
||||
$(DIRECTORY)/src/X/Makefile.am \
|
||||
$(DIRECTORY)/src/X/Makefile.in \
|
||||
$(DIRECTORY)/src/X/*.[ch] \
|
||||
$(DIRECTORY)/src/X86/*.[ch] \
|
||||
$(DIRECTORY)/src/X86/Makefile.am \
|
||||
$(DIRECTORY)/src/X86/Makefile.in \
|
||||
$(DIRECTORY)/src/X86/*.m4 \
|
||||
$(DIRECTORY)/src/X86/*.S \
|
||||
$(DIRECTORY)/src/*.dja \
|
||||
$(DIRECTORY)/src-glu/README[12] \
|
||||
$(DIRECTORY)/src-glu/Makefile* \
|
||||
$(DIRECTORY)/src-glu/descrip.mms \
|
||||
$(DIRECTORY)/src-glu/mms_depend \
|
||||
$(DIRECTORY)/src-glu/*.def \
|
||||
$(DIRECTORY)/src-glu/*.dja \
|
||||
$(DIRECTORY)/src-glu/depend \
|
||||
$(DIRECTORY)/src-glu/*.[ch] \
|
||||
$(DIRECTORY)/widgets-mesa \
|
||||
$(DIRECTORY)/widgets-sgi \
|
||||
$(DIRECTORY)/util/README \
|
||||
$(DIRECTORY)/util/Makefile.am \
|
||||
$(DIRECTORY)/util/Makefile.in \
|
||||
$(DIRECTORY)/util/*.[ch] \
|
||||
$(DIRECTORY)/util/sampleMakefile \
|
||||
$(DIRECTORY)/BeOS/Makefile \
|
||||
$(DIRECTORY)/BeOS/*.cpp
|
||||
|
||||
# old stuff
|
||||
# $(DIRECTORY)/Win32 \
|
||||
# $(DIRECTORY)/win32
|
||||
|
||||
# $(DIRECTORY)/OpenStep \
|
||||
#
|
||||
#
|
||||
$(DIRECTORY)/src/KNOWN_BUGS \
|
||||
$(DIRECTORY)/src/MGL/*.[ch] \
|
||||
$(DIRECTORY)/src/MGL/*.txt \
|
||||
$(DIRECTORY)/src/OSmesa/Makefile.am \
|
||||
$(DIRECTORY)/src/OSmesa/Makefile.in \
|
||||
$(DIRECTORY)/src/OSmesa/*.[ch] \
|
||||
$(DIRECTORY)/src/S3/*.[ch] \
|
||||
$(DIRECTORY)/src/S3/*.def \
|
||||
$(DIRECTORY)/src/S3/*.mak \
|
||||
$(DIRECTORY)/src/S3/*.rc \
|
||||
$(DIRECTORY)/src/SVGA/Makefile.am \
|
||||
$(DIRECTORY)/src/SVGA/Makefile.in \
|
||||
$(DIRECTORY)/src/SVGA/*.[ch] \
|
||||
$(DIRECTORY)/src/Windows/*.[ch] \
|
||||
$(DIRECTORY)/src/Windows/*.def \
|
||||
$(DIRECTORY)/src/X/Makefile.am \
|
||||
$(DIRECTORY)/src/X/Makefile.in \
|
||||
$(DIRECTORY)/src/X/*.[ch] \
|
||||
$(DIRECTORY)/src/X86/*.[ch] \
|
||||
$(DIRECTORY)/src/X86/Makefile.am \
|
||||
$(DIRECTORY)/src/X86/Makefile.in \
|
||||
$(DIRECTORY)/src/X86/*.m4 \
|
||||
$(DIRECTORY)/src/X86/*.S \
|
||||
$(DIRECTORY)/src/*.dja \
|
||||
$(DIRECTORY)/src-glu/README[12] \
|
||||
$(DIRECTORY)/src-glu/Makefile* \
|
||||
$(DIRECTORY)/src-glu/descrip.mms \
|
||||
$(DIRECTORY)/src-glu/mms_depend \
|
||||
$(DIRECTORY)/src-glu/*.def \
|
||||
$(DIRECTORY)/src-glu/*.dja \
|
||||
$(DIRECTORY)/src-glu/depend \
|
||||
$(DIRECTORY)/src-glu/*.[ch] \
|
||||
$(DIRECTORY)/widgets-mesa \
|
||||
$(DIRECTORY)/widgets-sgi \
|
||||
$(DIRECTORY)/util/README \
|
||||
$(DIRECTORY)/util/Makefile.am \
|
||||
$(DIRECTORY)/util/Makefile.in \
|
||||
$(DIRECTORY)/util/*.[ch] \
|
||||
$(DIRECTORY)/util/sampleMakefile \
|
||||
$(DIRECTORY)/BeOS/Makefile \
|
||||
$(DIRECTORY)/BeOS/*.cpp \
|
||||
$(DIRECTORY)/WIN32/NMAKE.MAK \
|
||||
$(DIRECTORY)/WIN32/NMAKE.MIF \
|
||||
$(DIRECTORY)/WIN32/RES/*rc \
|
||||
$(DIRECTORY)/WIN32/RES/*def \
|
||||
$(DIRECTORY)/WIN32/RULES/lib.* \
|
||||
$(DIRECTORY)/WIN32/RULES/progs.* \
|
||||
$(DIRECTORY)/macos/README \
|
||||
$(DIRECTORY)/macos/gli_api/*.h \
|
||||
$(DIRECTORY)/macos/include-mac/*.h \
|
||||
$(DIRECTORY)/macos/libraries/*.stub \
|
||||
$(DIRECTORY)/macos/libraries/*Stub \
|
||||
$(DIRECTORY)/macos/projects/*.mcp \
|
||||
$(DIRECTORY)/macos/projects/*.exp \
|
||||
$(DIRECTORY)/macos/projects/*.h \
|
||||
$(DIRECTORY)/macos/resources/*.c \
|
||||
$(DIRECTORY)/macos/resources/*.r \
|
||||
$(DIRECTORY)/macos/resources/*.rsrc \
|
||||
$(DIRECTORY)/macos/src-agl/*.exp \
|
||||
$(DIRECTORY)/macos/src-agl/*.[ch] \
|
||||
$(DIRECTORY)/macos/src-gli/*.[ch]
|
||||
|
||||
|
||||
DEMO_FILES = \
|
||||
|
@@ -28,7 +28,7 @@ working. No optimizations have been made at this time.
|
||||
|
||||
Compiling
|
||||
|
||||
Simply cd to the Mesa-3.x directory and type "make beos-r4".
|
||||
In the Mesa-3.x directory type "make -f Makefile.X11 beos-r4".
|
||||
When it finishes the libMesaGL.so and libMesaGLU.so libraries for
|
||||
BeOS will be in the Mesa-3.x/lib/ directory.
|
||||
|
||||
@@ -99,4 +99,4 @@ of February, 1999.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: README.BEOS,v 1.5 1999/03/03 02:34:04 brianp Exp $
|
||||
$Id: README.BEOS,v 1.5.6.1 1999/11/27 01:39:50 brianp Exp $
|
||||
|
@@ -1,9 +1,7 @@
|
||||
|
||||
Mesa 3.0 MITS Information
|
||||
|
||||
|
||||
This software is distributed under the terms of the GNU Library
|
||||
General Public License, see the LICENSE file for details.
|
||||
[The MITS code hasn't been update for Mesa 3.1 and may no longer work]
|
||||
|
||||
|
||||
This document is a preliminary introduction to help you get
|
||||
|
@@ -1,28 +1,35 @@
|
||||
|
||||
Mesa 3.0 Unix/X11 Information
|
||||
Mesa 3.1 Unix/X11 Information
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To compile the library, first type 'make' alone to see the list of system
|
||||
configurations currently supported. If you see your configuration on the
|
||||
list, type 'make <config>'. Most popular Unix/X workstations are currently
|
||||
supported.
|
||||
There are two ways to compile Mesa on Unix/X11 systems:
|
||||
|
||||
1. The old way:
|
||||
First type 'make' alone to see the list of system
|
||||
configurations currently supported. If you see your configuration on the
|
||||
list, type 'make <config>'. Most popular Unix/X workstations are currently
|
||||
supported.
|
||||
|
||||
If your system configuration is not listed by 'make', you'll have to modify
|
||||
the top-level Makefile and Make-config files. There are instructions in
|
||||
each file.
|
||||
|
||||
|
||||
2. The new way:
|
||||
Type './configure' and then 'make'. This uses GNU autoconfig.
|
||||
See docs/INSTALL for more details.
|
||||
|
||||
|
||||
The top-level makefile will execute the makefiles in a number of sub-
|
||||
directories. When finished, the Mesa libraries will be in the Mesa-2.6/lib/
|
||||
directories. When finished, the Mesa libraries will be in the Mesa-3.1/lib/
|
||||
directory. A few GLUT demos in the demos/ directory should be ready to run.
|
||||
|
||||
If you also downloaded and unpacked the demos there should be executables
|
||||
in the "xdemos/", "samples/", and "book/" directories for you to try out.
|
||||
If you only want to compile the contents of one subdirectory you can 'cd'
|
||||
to that directory and type 'make <config>' there.
|
||||
|
||||
If your system configuration is not listed by 'make', you'll have to modify
|
||||
the top-level Makefile and Make-config files. There are instructions in
|
||||
each file.
|
||||
|
||||
If you have compilation problems you should try to fix them and return the
|
||||
patches to the author.
|
||||
@@ -301,4 +308,4 @@ Summary of X-related environment variables:
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: README.X11,v 3.3 1999/09/15 16:39:01 brianp Exp $
|
||||
$Id: README.X11,v 3.3.2.2 1999/12/14 15:12:52 brianp Exp $
|
||||
|
@@ -1,4 +1,4 @@
|
||||
$Id: VERSIONS,v 1.13 1999/09/19 20:09:00 tanner Exp $
|
||||
$Id: VERSIONS,v 1.13.2.5 1999/12/14 07:17:42 brianp Exp $
|
||||
|
||||
|
||||
Mesa Version History
|
||||
@@ -659,3 +659,14 @@ Mesa Version History
|
||||
- New library numbering: libGL.so.1.2.310
|
||||
- New subdirectories: docs/ and bin/
|
||||
- New Makefile-system (autoconf,automake,libtool)
|
||||
|
||||
|
||||
3.1 final December 14, 1999
|
||||
New:
|
||||
- added demos/gloss.c
|
||||
- added xdemos/glxdpyinfo.c
|
||||
- added GLX_ARB_get_proc_address extension
|
||||
Bug fixes:
|
||||
- several vertex array bug fixes
|
||||
- overlapping glCopyPixels with pixel zooming now works
|
||||
- glXUseXFont() bitmaps were vertically shifted by one pixel
|
||||
|
@@ -1,40 +1,27 @@
|
||||
/* $Id: fxmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
|
||||
/* $Id: fxmesa.h,v 1.1.1.1.2.1 1999/11/24 18:38:52 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
* Copyright (C) 1995-1999 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* $Log: fxmesa.h,v $
|
||||
* Revision 1.1 1999/08/19 00:55:40 jtg
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 3.2 1999/01/03 02:46:31 brianp
|
||||
* now using GLAPI and GLAPIENTRY keywords (Ted Jump)
|
||||
*
|
||||
* Revision 3.1 1998/04/01 03:00:28 brianp
|
||||
* updated for v0.24 of 3Dfx/Glide driver
|
||||
*
|
||||
* Revision 3.0 1998/02/20 05:04:45 brianp
|
||||
* initial rev
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
@@ -58,7 +45,7 @@ extern "C" {
|
||||
|
||||
|
||||
#define FXMESA_MAJOR_VERSION 3
|
||||
#define FXMESA_MINOR_VERSION 0
|
||||
#define FXMESA_MINOR_VERSION 1
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -152,7 +152,7 @@ typedef unsigned long COLORREF;
|
||||
# define wglUseFontOutlines wglUseFontOutlinesA
|
||||
# endif /* !UNICODE */
|
||||
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
|
||||
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT
|
||||
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
|
||||
# define WGLAPI __declspec(dllimport)
|
||||
@@ -183,7 +183,7 @@ WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, u
|
||||
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
|
||||
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
|
||||
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
|
||||
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned long,LPPIXELFORMATDESCRIPTOR);
|
||||
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
|
||||
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
|
||||
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
|
||||
# undef WGLAPI
|
||||
@@ -739,7 +739,6 @@ GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: glx.h,v 1.6 1999/11/11 01:27:17 brianp Exp $ */
|
||||
/* $Id: glx.h,v 1.5.2.2 1999/12/10 14:55:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -50,41 +50,38 @@ extern "C" {
|
||||
|
||||
#define GLX_VERSION_1_1 1
|
||||
|
||||
#define GLX_EXTENSION_NAME "GLX"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Tokens for glXChooseVisual and glXGetConfig:
|
||||
*/
|
||||
#define GLX_USE_GL 1
|
||||
#define GLX_BUFFER_SIZE 2
|
||||
#define GLX_LEVEL 3
|
||||
#define GLX_RGBA 4
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_STEREO 6
|
||||
#define GLX_AUX_BUFFERS 7
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
#define GLX_ALPHA_SIZE 11
|
||||
#define GLX_DEPTH_SIZE 12
|
||||
#define GLX_STENCIL_SIZE 13
|
||||
#define GLX_ACCUM_RED_SIZE 14
|
||||
#define GLX_ACCUM_GREEN_SIZE 15
|
||||
#define GLX_ACCUM_BLUE_SIZE 16
|
||||
#define GLX_ACCUM_ALPHA_SIZE 17
|
||||
|
||||
|
||||
/* GLX_EXT_visual_info extension */
|
||||
#define GLX_X_VISUAL_TYPE_EXT 0x22
|
||||
#define GLX_TRANSPARENT_TYPE_EXT 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
|
||||
enum _GLX_CONFIGS {
|
||||
GLX_USE_GL = 1,
|
||||
GLX_BUFFER_SIZE = 2,
|
||||
GLX_LEVEL = 3,
|
||||
GLX_RGBA = 4,
|
||||
GLX_DOUBLEBUFFER = 5,
|
||||
GLX_STEREO = 6,
|
||||
GLX_AUX_BUFFERS = 7,
|
||||
GLX_RED_SIZE = 8,
|
||||
GLX_GREEN_SIZE = 9,
|
||||
GLX_BLUE_SIZE = 10,
|
||||
GLX_ALPHA_SIZE = 11,
|
||||
GLX_DEPTH_SIZE = 12,
|
||||
GLX_STENCIL_SIZE = 13,
|
||||
GLX_ACCUM_RED_SIZE = 14,
|
||||
GLX_ACCUM_GREEN_SIZE = 15,
|
||||
GLX_ACCUM_BLUE_SIZE = 16,
|
||||
GLX_ACCUM_ALPHA_SIZE = 17,
|
||||
|
||||
/* GLX_EXT_visual_info extension */
|
||||
GLX_X_VISUAL_TYPE_EXT = 0x22,
|
||||
GLX_TRANSPARENT_TYPE_EXT = 0x23,
|
||||
GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24,
|
||||
GLX_TRANSPARENT_RED_VALUE_EXT = 0x25,
|
||||
GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26,
|
||||
GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27,
|
||||
GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@@ -125,12 +122,12 @@ extern "C" {
|
||||
* Compile-time extension tests
|
||||
*/
|
||||
#define GLX_EXT_visual_info 1
|
||||
#define GLX_EXT_get_proc_address 1
|
||||
#define GLX_MESA_pixmap_colormap 1
|
||||
#define GLX_MESA_release_buffers 1
|
||||
#define GLX_MESA_copy_sub_buffer 1
|
||||
#define GLX_MESA_set_3dfx_mode 1
|
||||
#define GLX_SGI_video_sync 1
|
||||
#define GLX_ARB_get_proc_address 1
|
||||
|
||||
|
||||
|
||||
@@ -222,6 +219,10 @@ extern int glXWaitVideoSyncSGI(int divisor, int remainder,
|
||||
unsigned int *count);
|
||||
|
||||
|
||||
/* GLX_ARB_get_proc_address */
|
||||
extern void (*glXGetProcAddressARB(const GLubyte *procName))();
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,11 +1,46 @@
|
||||
/* $Id: mesa_wgl.h,v 1.2.2.2 1999/11/22 14:05:15 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 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.
|
||||
*/
|
||||
|
||||
|
||||
/* prototypes for the Mesa WGL functions */
|
||||
/* relocated here so that I could make GLUT get them properly */
|
||||
|
||||
#ifndef GL_H
|
||||
# include <gl/gl.h>
|
||||
#ifndef _mesa_wgl_h_
|
||||
#define _mesa_wgl_h_
|
||||
|
||||
|
||||
#include <gl/gl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning( disable : 4615 ) /* pragma warning : unknown user warning type*/
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
|
||||
#endif
|
||||
@@ -37,10 +72,17 @@ WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, u
|
||||
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
|
||||
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
|
||||
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
|
||||
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,PIXELFORMATDESCRIPTOR *);
|
||||
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
|
||||
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
|
||||
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _mesa_wgl_h_ */
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: osmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
|
||||
/* $Id: osmesa.h,v 1.1.1.1.2.1 1999/11/24 18:39:17 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -27,8 +27,11 @@
|
||||
|
||||
/*
|
||||
* $Log: osmesa.h,v $
|
||||
* Revision 1.1 1999/08/19 00:55:40 jtg
|
||||
* Initial revision
|
||||
* Revision 1.1.1.1.2.1 1999/11/24 18:39:17 brianp
|
||||
* bumped version to 3.1
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 1.4 1999/02/14 03:39:09 brianp
|
||||
* new copyright
|
||||
@@ -86,7 +89,7 @@ extern "C" {
|
||||
|
||||
|
||||
#define OSMESA_MAJOR_VERSION 3
|
||||
#define OSMESA_MINOR_VERSION 0
|
||||
#define OSMESA_MINOR_VERSION 1
|
||||
|
||||
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: svgamesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
|
||||
/* $Id: svgamesa.h,v 1.1.1.1.2.1 1999/11/24 18:40:45 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.0
|
||||
* Version: 3.1
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -23,8 +23,11 @@
|
||||
|
||||
/*
|
||||
* $Log: svgamesa.h,v $
|
||||
* Revision 1.1 1999/08/19 00:55:40 jtg
|
||||
* Initial revision
|
||||
* Revision 1.1.1.1.2.1 1999/11/24 18:40:45 brianp
|
||||
* bumped version to 3.1
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 3.0 1998/02/20 05:07:24 brianp
|
||||
* initial rev
|
||||
@@ -65,7 +68,7 @@
|
||||
|
||||
|
||||
#define SVGAMESA_MAJOR_VERSION 3
|
||||
#define SVGAMESA_MINOR_VERSION 0
|
||||
#define SVGAMESA_MINOR_VERSION 1
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: xmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
|
||||
/* $Id: xmesa.h,v 1.1.1.1.2.2 1999/12/13 21:54:19 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -27,8 +27,14 @@
|
||||
|
||||
/*
|
||||
* $Log: xmesa.h,v $
|
||||
* Revision 1.1 1999/08/19 00:55:40 jtg
|
||||
* Initial revision
|
||||
* Revision 1.1.1.1.2.2 1999/12/13 21:54:19 brianp
|
||||
* applied Daryll's patches
|
||||
*
|
||||
* Revision 1.1.1.1.2.1 1999/11/24 18:41:37 brianp
|
||||
* bumped version to 3.1
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 1.3 1999/02/24 22:43:27 jens
|
||||
* Name changes to get XMesa to compile standalone inside XFree86
|
||||
@@ -96,6 +102,9 @@ extern "C" {
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include "xmesa_x.h"
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#include "dri_mesa.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "GL/gl.h"
|
||||
|
||||
@@ -106,7 +115,7 @@ extern struct Library *XLibBase;
|
||||
|
||||
|
||||
#define XMESA_MAJOR_VERSION 3
|
||||
#define XMESA_MINOR_VERSION 0
|
||||
#define XMESA_MINOR_VERSION 1
|
||||
|
||||
|
||||
|
||||
@@ -131,7 +140,17 @@ typedef struct xmesa_visual *XMesaVisual;
|
||||
|
||||
typedef struct xmesa_buffer *XMesaBuffer;
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
|
||||
/*
|
||||
* Initialize the XMesa driver.
|
||||
*/
|
||||
extern GLboolean XMesaInitDriver( __DRIscreenPrivate *driScrnPriv );
|
||||
|
||||
/*
|
||||
* Reset the XMesa driver when the X server resets.
|
||||
*/
|
||||
extern void XMesaResetDriver( __DRIscreenPrivate *driScrnPriv );
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -179,7 +198,11 @@ extern void XMesaDestroyVisual( XMesaVisual v );
|
||||
* Return: an XMesaContext or NULL if error.
|
||||
*/
|
||||
extern XMesaContext XMesaCreateContext( XMesaVisual v,
|
||||
XMesaContext share_list );
|
||||
XMesaContext share_list
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
|
||||
, __DRIcontextPrivate *driContextPriv
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
@@ -192,7 +215,12 @@ extern void XMesaDestroyContext( XMesaContext c );
|
||||
* Create an XMesaBuffer from an X window.
|
||||
*/
|
||||
extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v,
|
||||
XMesaWindow w );
|
||||
XMesaWindow w
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
|
||||
, __DRIdrawablePrivate *driDrawPriv
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -200,7 +228,12 @@ extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v,
|
||||
*/
|
||||
extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
|
||||
XMesaPixmap p,
|
||||
XMesaColormap cmap );
|
||||
XMesaColormap cmap
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
|
||||
, __DRIdrawablePrivate *driDrawPriv
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -30,7 +30,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* Authors:
|
||||
* Kevin E. Martin <kevin@precisioninsight.com>
|
||||
*
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.1 1999/08/19 00:55:40 jtg Exp $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.1.1.1.2.1 1999/12/13 21:54:19 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XMESA_XF86_H_
|
||||
@@ -52,29 +52,29 @@ typedef DDXPointRec XMesaPoint;
|
||||
typedef xColorItem XMesaColor;
|
||||
|
||||
#define XMesaSetGeneric(__d,__gc,__val,__mask) \
|
||||
{ \
|
||||
do { \
|
||||
CARD32 __v[1]; \
|
||||
(void) __d; \
|
||||
__v[0] = __val; \
|
||||
dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
|
||||
{ \
|
||||
do { \
|
||||
ChangeGCVal __v[1]; \
|
||||
(void) __d; \
|
||||
__v[0].ptr = __pval; \
|
||||
dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaSetDashes(__d,__gc,__do,__dl,__n) \
|
||||
{ \
|
||||
do { \
|
||||
(void) __d; \
|
||||
SetDashes(__gc, __do, __n, (unsigned char *)__dl); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaSetLineAttributes(__d,__gc,__lw,__ls,__cs,__js) \
|
||||
{ \
|
||||
do { \
|
||||
CARD32 __v[4]; \
|
||||
(void) __d; \
|
||||
__v[0] = __lw; \
|
||||
@@ -84,7 +84,7 @@ typedef xColorItem XMesaColor;
|
||||
dixChangeGC(NullClient, __gc, \
|
||||
GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, \
|
||||
__v, NULL); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
|
||||
#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
|
||||
@@ -96,24 +96,24 @@ typedef xColorItem XMesaColor;
|
||||
#define XMesaSetStipple(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCStipple)
|
||||
|
||||
#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
|
||||
{ \
|
||||
do { \
|
||||
XMesaPoint __p[1]; \
|
||||
(void) __d; \
|
||||
__p[0].x = __x; \
|
||||
__p[0].y = __y; \
|
||||
ValidateGC(__b, __gc); \
|
||||
(*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
|
||||
{ \
|
||||
do { \
|
||||
(void) __d; \
|
||||
ValidateGC(__b, __gc); \
|
||||
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaDrawLine(__d,__b,__gc,__x0,__y0,__x1,__y1) \
|
||||
{ \
|
||||
do { \
|
||||
XMesaPoint __p[2]; \
|
||||
(void) __d; \
|
||||
ValidateGC(__b, __gc); \
|
||||
@@ -122,10 +122,10 @@ typedef xColorItem XMesaColor;
|
||||
__p[1].x = __x1; \
|
||||
__p[1].y = __y1; \
|
||||
(*__gc->ops->Polylines)(__b, __gc, CoordModeOrigin, 2, __p); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
|
||||
{ \
|
||||
do { \
|
||||
xRectangle __r[1]; \
|
||||
(void) __d; \
|
||||
ValidateGC(__b, __gc); \
|
||||
@@ -134,10 +134,10 @@ typedef xColorItem XMesaColor;
|
||||
__r[0].width = __w; \
|
||||
__r[0].height = __h; \
|
||||
(*__gc->ops->PolyFillRect)(__b, __gc, 1, __r); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
|
||||
{ \
|
||||
do { \
|
||||
/* Assumes: Images are always in ZPixmap format */ \
|
||||
(void) __d; \
|
||||
if (__sx || __sy) /* The non-trivial case */ \
|
||||
@@ -146,22 +146,22 @@ typedef xColorItem XMesaColor;
|
||||
(*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
|
||||
__x, __y, __w, __h, 0, ZPixmap, \
|
||||
((XMesaImage *)(__i))->data); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
|
||||
{ \
|
||||
do { \
|
||||
(void) __d; \
|
||||
ValidateGC(__db, __gc); \
|
||||
(*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
|
||||
__sx, __sy, __w, __h, __x, __y); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define XMesaFillPolygon(__d,__b,__gc,__p,__n,__s,__m) \
|
||||
{ \
|
||||
do { \
|
||||
(void) __d; \
|
||||
ValidateGC(__b, __gc); \
|
||||
(*__gc->ops->FillPolygon)(__b, __gc, __s, __m, __n, __p); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
|
||||
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
|
||||
@@ -170,10 +170,10 @@ typedef xColorItem XMesaColor;
|
||||
(*__d->DestroyPixmap)(__b)
|
||||
|
||||
#define XMesaFreeGC(__d,__gc) \
|
||||
{ \
|
||||
do { \
|
||||
(void) __d; \
|
||||
FreeScratchGC(__gc); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define GET_COLORMAP_SIZE(__v) __v->visinfo->ColormapEntries
|
||||
#define GET_REDMASK(__v) __v->visinfo->redMask
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: tessdemo.c,v 1.3 1999/11/04 04:00:42 gareth Exp $ */
|
||||
/* $Id: tessdemo.c,v 1.3.2.1 1999/11/16 11:09:09 gareth Exp $ */
|
||||
|
||||
/*
|
||||
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
/*
|
||||
* $Log: tessdemo.c,v $
|
||||
* Revision 1.3.2.1 1999/11/16 11:09:09 gareth
|
||||
* Added combine callback. Converted vertices from ints to floats.
|
||||
*
|
||||
* Revision 1.3 1999/11/04 04:00:42 gareth
|
||||
* Updated demo for new GLU 1.3 tessellation. Added optimized rendering
|
||||
* by saving the output of the tessellation into display lists.
|
||||
@@ -79,20 +82,20 @@ static GLfloat edge_color[3];
|
||||
|
||||
static struct
|
||||
{
|
||||
GLint p[MAX_POINTS][2];
|
||||
GLfloat p[MAX_POINTS][2];
|
||||
GLuint point_cnt;
|
||||
} contours[MAX_CONTOURS];
|
||||
|
||||
static struct
|
||||
{
|
||||
GLsizei no;
|
||||
GLint p[3][2];
|
||||
GLfloat p[3][2];
|
||||
GLclampf color[3][3];
|
||||
} triangles[MAX_TRIANGLES];
|
||||
|
||||
|
||||
|
||||
void GLCALLBACK my_error( GLenum err )
|
||||
void GLCALLBACK error_callback( GLenum err )
|
||||
{
|
||||
int len, i;
|
||||
char const *str;
|
||||
@@ -146,22 +149,22 @@ void GLCALLBACK end_callback()
|
||||
triangles[i].color[0][1],
|
||||
triangles[i].color[0][2] );
|
||||
|
||||
glVertex2i( triangles[i].p[0][0], triangles[i].p[0][1] );
|
||||
glVertex2i( triangles[i].p[1][0], triangles[i].p[1][1] );
|
||||
glVertex2f( triangles[i].p[0][0], triangles[i].p[0][1] );
|
||||
glVertex2f( triangles[i].p[1][0], triangles[i].p[1][1] );
|
||||
|
||||
glColor3f( triangles[i].color[1][0],
|
||||
triangles[i].color[1][1],
|
||||
triangles[i].color[1][2] );
|
||||
|
||||
glVertex2i( triangles[i].p[1][0], triangles[i].p[1][1] );
|
||||
glVertex2i( triangles[i].p[2][0], triangles[i].p[2][1] );
|
||||
glVertex2f( triangles[i].p[1][0], triangles[i].p[1][1] );
|
||||
glVertex2f( triangles[i].p[2][0], triangles[i].p[2][1] );
|
||||
|
||||
glColor3f( triangles[i].color[2][0],
|
||||
triangles[i].color[2][1],
|
||||
triangles[i].color[2][2] );
|
||||
|
||||
glVertex2i( triangles[i].p[2][0], triangles[i].p[2][1] );
|
||||
glVertex2i( triangles[i].p[0][0], triangles[i].p[0][1] );
|
||||
glVertex2f( triangles[i].p[2][0], triangles[i].p[2][1] );
|
||||
glVertex2f( triangles[i].p[0][0], triangles[i].p[0][1] );
|
||||
}
|
||||
|
||||
glEnd();
|
||||
@@ -170,9 +173,9 @@ void GLCALLBACK end_callback()
|
||||
void GLCALLBACK vertex_callback( void *data )
|
||||
{
|
||||
GLsizei no;
|
||||
GLint *p;
|
||||
GLfloat *p;
|
||||
|
||||
p = (GLint *) data;
|
||||
p = (GLfloat *) data;
|
||||
no = triangles[triangle_cnt].no;
|
||||
|
||||
triangles[triangle_cnt].p[no][0] = p[0];
|
||||
@@ -190,6 +193,22 @@ void GLCALLBACK vertex_callback( void *data )
|
||||
}
|
||||
}
|
||||
|
||||
void GLCALLBACK combine_callback( GLdouble coords[3],
|
||||
GLdouble *vertex_data[4],
|
||||
GLfloat weight[4], void **data )
|
||||
{
|
||||
GLfloat *vertex;
|
||||
int i;
|
||||
|
||||
vertex = (GLfloat *) malloc( 2 * sizeof(GLfloat) );
|
||||
|
||||
vertex[0] = (GLfloat) coords[0];
|
||||
vertex[1] = (GLfloat) coords[1];
|
||||
|
||||
*data = vertex;
|
||||
}
|
||||
|
||||
|
||||
void set_screen_wh( GLsizei w, GLsizei h )
|
||||
{
|
||||
width = w;
|
||||
@@ -208,10 +227,11 @@ void tesse( void )
|
||||
|
||||
if ( tobj != NULL )
|
||||
{
|
||||
gluTessCallback( tobj, GLU_BEGIN, glBegin );
|
||||
gluTessCallback( tobj, GLU_VERTEX, glVertex2iv );
|
||||
gluTessCallback( tobj, GLU_END, glEnd );
|
||||
gluTessCallback( tobj, GLU_ERROR, my_error );
|
||||
gluTessCallback( tobj, GLU_TESS_BEGIN, glBegin );
|
||||
gluTessCallback( tobj, GLU_TESS_VERTEX, glVertex2fv );
|
||||
gluTessCallback( tobj, GLU_TESS_END, glEnd );
|
||||
gluTessCallback( tobj, GLU_TESS_ERROR, error_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_COMBINE, combine_callback );
|
||||
|
||||
glNewList( list_start, GL_COMPILE );
|
||||
gluBeginPolygon( tobj );
|
||||
@@ -233,10 +253,10 @@ void tesse( void )
|
||||
gluEndPolygon( tobj );
|
||||
glEndList();
|
||||
|
||||
gluTessCallback( tobj, GLU_BEGIN, begin_callback );
|
||||
gluTessCallback( tobj, GLU_VERTEX, vertex_callback );
|
||||
gluTessCallback( tobj, GLU_END, end_callback );
|
||||
gluTessCallback( tobj, GLU_EDGE_FLAG, edge_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_BEGIN, begin_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_VERTEX, vertex_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_END, end_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, edge_callback );
|
||||
|
||||
glNewList( list_start + 1, GL_COMPILE );
|
||||
gluBeginPolygon( tobj );
|
||||
@@ -267,7 +287,7 @@ void tesse( void )
|
||||
|
||||
void left_down( int x1, int y1 )
|
||||
{
|
||||
GLint P[2];
|
||||
GLfloat P[2];
|
||||
GLuint point_cnt;
|
||||
|
||||
/* translate GLUT into GL coordinates */
|
||||
@@ -284,13 +304,13 @@ void left_down( int x1, int y1 )
|
||||
|
||||
if ( point_cnt )
|
||||
{
|
||||
glVertex2iv( contours[contour_cnt].p[point_cnt-1] );
|
||||
glVertex2iv( P );
|
||||
glVertex2fv( contours[contour_cnt].p[point_cnt-1] );
|
||||
glVertex2fv( P );
|
||||
}
|
||||
else
|
||||
{
|
||||
glVertex2iv( P );
|
||||
glVertex2iv( P );
|
||||
glVertex2fv( P );
|
||||
glVertex2fv( P );
|
||||
}
|
||||
|
||||
glEnd();
|
||||
@@ -311,8 +331,8 @@ void middle_down( int x1, int y1 )
|
||||
{
|
||||
glBegin( GL_LINES );
|
||||
|
||||
glVertex2iv( contours[contour_cnt].p[0] );
|
||||
glVertex2iv( contours[contour_cnt].p[point_cnt-1] );
|
||||
glVertex2fv( contours[contour_cnt].p[0] );
|
||||
glVertex2fv( contours[contour_cnt].p[point_cnt-1] );
|
||||
|
||||
contours[contour_cnt].p[point_cnt][0] = -1;
|
||||
|
||||
@@ -383,24 +403,24 @@ void display( void )
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
glVertex2iv( contours[i].p[0] );
|
||||
glVertex2iv( contours[i].p[0] );
|
||||
glVertex2fv( contours[i].p[0] );
|
||||
glVertex2fv( contours[i].p[0] );
|
||||
break;
|
||||
case 2:
|
||||
glVertex2iv( contours[i].p[0] );
|
||||
glVertex2iv( contours[i].p[1] );
|
||||
glVertex2fv( contours[i].p[0] );
|
||||
glVertex2fv( contours[i].p[1] );
|
||||
break;
|
||||
default:
|
||||
--point_cnt;
|
||||
for ( j = 0 ; j < point_cnt ; j++ )
|
||||
{
|
||||
glVertex2iv( contours[i].p[j] );
|
||||
glVertex2iv( contours[i].p[j+1] );
|
||||
glVertex2fv( contours[i].p[j] );
|
||||
glVertex2fv( contours[i].p[j+1] );
|
||||
}
|
||||
if ( contours[i].p[j+1][0] == -1 )
|
||||
{
|
||||
glVertex2iv( contours[i].p[0] );
|
||||
glVertex2iv( contours[i].p[j] );
|
||||
glVertex2fv( contours[i].p[0] );
|
||||
glVertex2fv( contours[i].p[j] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.X11,v 1.4 1999/11/05 08:01:17 brianp Exp $
|
||||
# $Id: Makefile.X11,v 1.4.2.1 1999/11/12 15:43:25 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.1
|
||||
@@ -16,7 +16,7 @@ GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(XLIBS)
|
||||
|
||||
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
|
||||
|
||||
PROGS = glxdemo glxpixmap offset xdemo glxinfo xfont
|
||||
PROGS = glxdemo glxpixmap offset xdemo glxinfo xfont glxdpyinfo
|
||||
|
||||
|
||||
|
||||
|
1073
progs/xdemos/glxdpyinfo.c
Normal file
1073
progs/xdemos/glxdpyinfo.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ LIBDIR = ../lib
|
||||
|
||||
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
|
||||
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
|
||||
tess_winding.c
|
||||
tess_winding.c tess_clip.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
|
@@ -19,9 +19,12 @@
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
# $Id: Makefile.BeOS-R4,v 1.5 1999/10/03 00:53:38 gareth Exp $
|
||||
# $Id: Makefile.BeOS-R4,v 1.5.2.1 1999/11/15 21:15:43 gareth Exp $
|
||||
|
||||
# $Log: Makefile.BeOS-R4,v $
|
||||
# Revision 1.5.2.1 1999/11/15 21:15:43 gareth
|
||||
# Added new tessellation polygon clipping file tess_clip.c
|
||||
#
|
||||
# Revision 1.5 1999/10/03 00:53:38 gareth
|
||||
# Added tessellation winding rule files.
|
||||
#
|
||||
@@ -59,7 +62,7 @@ LIBDIR = ../lib
|
||||
|
||||
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
|
||||
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
|
||||
tess_winding.c
|
||||
tess_winding.c tess_clip.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.X11,v 1.6 1999/10/03 00:53:38 gareth Exp $
|
||||
# $Id: Makefile.X11,v 1.6.2.1 1999/11/15 21:15:43 gareth Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.1
|
||||
@@ -20,7 +20,7 @@ LIBDIR = ../lib
|
||||
|
||||
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
|
||||
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
|
||||
tess_winding.c
|
||||
tess_winding.c tess_clip.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
|
@@ -16,11 +16,11 @@ CFLAGS = /include=$(INCDIR)/define=(FBIND=1)
|
||||
|
||||
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
|
||||
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
|
||||
tess_winding.c
|
||||
tess_winding.c tess_clip.c
|
||||
|
||||
OBJECTS =glu.obj,mipmap.obj,nurbs.obj,nurbscrv.obj,nurbssrf.obj,nurbsutl.obj,\
|
||||
project.obj,quadric.obj,tess.obj,tess_fist.obj,tess_hash.obj,\
|
||||
tess_heap.obj,tess_winding.obj
|
||||
tess_heap.obj,tess_winding.obj,tess_clip.obj
|
||||
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: glu.c,v 1.16 1999/10/27 09:47:41 brianp Exp $ */
|
||||
/* $Id: glu.c,v 1.16.2.2 1999/11/22 22:18:13 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -23,6 +23,12 @@
|
||||
|
||||
/*
|
||||
* $Log: glu.c,v $
|
||||
* Revision 1.16.2.2 1999/11/22 22:18:13 brianp
|
||||
* removed GLU_EXT_get_proc_address from ext string
|
||||
*
|
||||
* Revision 1.16.2.1 1999/11/19 21:22:07 brianp
|
||||
* replace encounteed with encountered
|
||||
*
|
||||
* Revision 1.16 1999/10/27 09:47:41 brianp
|
||||
* disabled gluGetProcAddressEXT
|
||||
*
|
||||
@@ -304,7 +310,7 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
|
||||
"unconnected trim curves",
|
||||
"unknown knot error",
|
||||
"negative vertex count encountered",
|
||||
"negative byte-stride encounteed",
|
||||
"negative byte-stride encountered",
|
||||
"unknown type descriptor",
|
||||
"null control array or knot vector",
|
||||
"duplicate point on pwlcurve"
|
||||
@@ -367,7 +373,7 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
|
||||
|
||||
const GLubyte* GLAPIENTRY gluGetString( GLenum name )
|
||||
{
|
||||
static char *extensions = "GL_EXT_abgr GLU_EXT_get_proc_address";
|
||||
static char *extensions = "GL_EXT_abgr";
|
||||
static char *version = "1.2 Mesa 3.1";
|
||||
|
||||
switch (name) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: gluP.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
|
||||
/* $Id: gluP.h,v 1.1.1.1.2.1 1999/12/06 05:24:36 joukj Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -23,8 +23,19 @@
|
||||
|
||||
/*
|
||||
* $Log: gluP.h,v $
|
||||
* Revision 1.1 1999/08/19 00:55:42 jtg
|
||||
* Initial revision
|
||||
* Revision 1.1.1.1.2.1 1999/12/06 05:24:36 joukj
|
||||
*
|
||||
* Committing in .
|
||||
*
|
||||
* Updating compilation on VMS
|
||||
*
|
||||
* Modified Files:
|
||||
* Tag: mesa_3_2_dev
|
||||
* Mesa/src-glu/descrip.mms Mesa/src-glu/gluP.h
|
||||
* ----------------------------------------------------------------------
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 1.4 1999/01/03 03:23:15 brianp
|
||||
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
|
||||
@@ -55,6 +66,7 @@
|
||||
#include "GL/gl.h"
|
||||
#include "GL/glu.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifndef MESA
|
||||
/* If we're using the real OpenGL header files... */
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: mipmap.c,v 1.3 1999/11/09 06:16:59 brianp Exp $ */
|
||||
/* $Id: mipmap.c,v 1.3.2.1 1999/12/12 17:23:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
/*
|
||||
* $Log: mipmap.c,v $
|
||||
* Revision 1.3.2.1 1999/12/12 17:23:33 brianp
|
||||
* removed unneeded code in gluBuild1DMipmaps()
|
||||
*
|
||||
* Revision 1.3 1999/11/09 06:16:59 brianp
|
||||
* replace GLint with GLsizei in a gluScaleImage, gluBuild1/2DMipmaps()
|
||||
*
|
||||
@@ -702,12 +705,6 @@ GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
|
||||
|
||||
free( texture );
|
||||
|
||||
/* make sure remaining mipmap levels are removed */
|
||||
for (l=levels;l<max_levels;l++) {
|
||||
glTexImage1D( GL_TEXTURE_1D, l, components, 0, 0,
|
||||
format, GL_UNSIGNED_BYTE, NULL );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
1018
src/glu/mesa/tess.c
1018
src/glu/mesa/tess.c
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* $Id: tess.h,v 1.15 1999/11/05 20:37:14 gareth Exp $ */
|
||||
/* $Id: tess.h,v 1.15.2.6 1999/12/05 17:01:17 gareth Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -56,33 +56,39 @@ extern "C" {
|
||||
struct GLUtesselator
|
||||
{
|
||||
tess_callbacks_t callbacks;
|
||||
GLboolean boundary_only;
|
||||
GLenum winding_rule;
|
||||
GLboolean boundary_only;
|
||||
GLdouble tolerance;
|
||||
tess_plane_t plane;
|
||||
GLuint contour_count;
|
||||
GLenum orientation;
|
||||
void *data;
|
||||
GLint num_contours;
|
||||
tess_contour_t *contours, *last_contour;
|
||||
tess_contour_t *current_contour;
|
||||
GLdouble mins[2], maxs[2];
|
||||
GLuint vertex_count;
|
||||
GLint num_vertices;
|
||||
tess_vertex_t **sorted_vertices;
|
||||
#if 0
|
||||
tess_grid_t *grid; /* Not currently used... */
|
||||
#endif
|
||||
heap_t *ears;
|
||||
hashtable_t *cvc_lists;
|
||||
void *data;
|
||||
GLboolean edge_flag;
|
||||
GLuint label;
|
||||
tess_plane_t plane;
|
||||
GLenum error;
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Tessellation error handler:
|
||||
* Common tessellation functions:
|
||||
*****************************************************************************/
|
||||
extern void tess_error_callback( GLUtesselator *, GLenum );
|
||||
|
||||
extern GLdouble twice_contour_area( tess_contour_t *contour );
|
||||
extern void reverse_contour( tess_contour_t *contour );
|
||||
extern void delete_contour( tess_contour_t **contour );
|
||||
|
||||
extern void contour_dump( tess_contour_t *contour );
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Debugging output:
|
||||
@@ -115,8 +121,8 @@ extern int tess_dbg_level;
|
||||
#define MSG tess_msg
|
||||
#endif /* DEBUG */
|
||||
|
||||
extern INLINE void tess_msg( int level, char *format, ... );
|
||||
extern INLINE void tess_info( char *file, char *line );
|
||||
extern INLINE void tess_msg( GLint level, char *format, ... );
|
||||
extern INLINE void tess_info( char *file, GLint line );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
## BeOS Generic Makefile v2.0 ##
|
||||
|
||||
## Modified by Brian Paul to work with Mesa 3.1
|
||||
|
||||
|
||||
## Fill in this file to specify the project being created, and the referenced
|
||||
@@ -48,9 +47,8 @@ RSRCS=
|
||||
# naming scheme you need to specify the path to the library
|
||||
# and it's name
|
||||
# library: my_lib.a entry: my_lib.a or path/my_lib.a
|
||||
#LIBS= MesaGL MesaGLU be
|
||||
LIBS= GL GLU be
|
||||
|
||||
|
||||
# specify additional paths to directories following the standard
|
||||
# libXXX.so or libXXX.a naming scheme. You can specify full paths
|
||||
# or paths relative to the makefile. The paths included may not
|
||||
|
@@ -129,26 +129,29 @@ __glutXGetLayerVisualInfo(Display * dpy, long lvinfo_mask,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lvinfo_mask & VisualLayerMask)
|
||||
if (lvinfo_mask & VisualLayerMask) {
|
||||
if (overlayInfo == NULL) {
|
||||
if (lvinfo_template->layer != 0)
|
||||
continue;
|
||||
} else if (lvinfo_template->layer != overlayInfo->layer)
|
||||
continue;
|
||||
if (lvinfo_mask & VisualTransparentType)
|
||||
}
|
||||
if (lvinfo_mask & VisualTransparentType) {
|
||||
if (overlayInfo == NULL) {
|
||||
if (lvinfo_template->type != None)
|
||||
continue;
|
||||
} else if (lvinfo_template->type !=
|
||||
overlayInfo->transparent_type)
|
||||
continue;
|
||||
if (lvinfo_mask & VisualTransparentValue)
|
||||
}
|
||||
if (lvinfo_mask & VisualTransparentValue) {
|
||||
if (overlayInfo == NULL)
|
||||
/* Non-overlay visuals have no sense of
|
||||
TransparentValue. */
|
||||
continue;
|
||||
else if (lvinfo_template->value != overlayInfo->value)
|
||||
continue;
|
||||
}
|
||||
layerInfo[count].vinfo = *pVinfo;
|
||||
if (overlayInfo == NULL) {
|
||||
layerInfo[count].layer = 0;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# $Id: Makefile.X11,v 1.7 1999/11/11 01:22:28 brianp Exp $
|
||||
# $Id: Makefile.X11,v 1.6.2.1 1999/11/16 15:25:50 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.3
|
||||
# Version: 3.1
|
||||
# Copyright (C) 1995-1999 Brian Paul
|
||||
|
||||
# Makefile for core library
|
||||
@@ -18,13 +18,13 @@ VPATH = RCS
|
||||
INCDIR = ../include
|
||||
LIBDIR = ../lib
|
||||
|
||||
|
||||
CORE_SOURCES = \
|
||||
glapi.c \
|
||||
glapinoop.c \
|
||||
accum.c \
|
||||
alpha.c \
|
||||
alphabuf.c \
|
||||
api1.c \
|
||||
api2.c \
|
||||
apiext.c \
|
||||
attrib.c \
|
||||
bbox.c \
|
||||
bitmap.c \
|
||||
@@ -37,7 +37,6 @@ CORE_SOURCES = \
|
||||
cva.c \
|
||||
debug_xform.c \
|
||||
depth.c \
|
||||
dispatch.c \
|
||||
dlist.c \
|
||||
drawpix.c \
|
||||
enable.c \
|
||||
@@ -50,19 +49,18 @@ CORE_SOURCES = \
|
||||
glmisc.c \
|
||||
hash.c \
|
||||
image.c \
|
||||
imaging.c \
|
||||
light.c \
|
||||
lines.c \
|
||||
logic.c \
|
||||
masking.c \
|
||||
matrix.c \
|
||||
mem.c \
|
||||
mmath.c \
|
||||
mthreads.c \
|
||||
pb.c \
|
||||
pixel.c \
|
||||
pipeline.c \
|
||||
points.c \
|
||||
pointers.c \
|
||||
polygon.c \
|
||||
quads.c \
|
||||
rastpos.c \
|
||||
@@ -222,7 +220,8 @@ X86/3dnow.o: X86/3dnow.c
|
||||
# @echo "Specify a target configuration"
|
||||
|
||||
clean:
|
||||
-rm *.o *~ */*.o */*~
|
||||
-rm *.o *~ */*.o */*~ *.lo *.la
|
||||
-rm -rf .libs
|
||||
|
||||
targets: $(LIBDIR)/$(GL_LIB)
|
||||
|
||||
|
8
src/mesa/drivers/ggi/default/.cvsignore
Normal file
8
src/mesa/drivers/ggi/default/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
genkgi.conf
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.lo
|
||||
*.o
|
||||
*.la
|
8
src/mesa/drivers/ggi/display/.cvsignore
Normal file
8
src/mesa/drivers/ggi/display/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
fbdev.conf
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.lo
|
||||
*.o
|
||||
*.la
|
7
src/mesa/drivers/ggi/include/.cvsignore
Normal file
7
src/mesa/drivers/ggi/include/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.lo
|
||||
*.o
|
||||
*.la
|
7
src/mesa/drivers/ggi/include/ggi/.cvsignore
Normal file
7
src/mesa/drivers/ggi/include/ggi/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.lo
|
||||
*.o
|
||||
*.la
|
7
src/mesa/drivers/ggi/include/ggi/mesa/.cvsignore
Normal file
7
src/mesa/drivers/ggi/include/ggi/mesa/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.lo
|
||||
*.o
|
||||
*.la
|
@@ -1,24 +1,52 @@
|
||||
/* -*- mode: C; tab-width:8; -*-
|
||||
|
||||
fxapi.c - 3Dfx VooDoo/Mesa interface
|
||||
*/
|
||||
/* -*- mode: C; tab-width:8; -*- */
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/* fxapi.c - 3Dfx VooDoo/Mesa interface */
|
||||
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Function names:
|
||||
* fxMesa.... (The driver API)
|
||||
@@ -820,9 +848,10 @@ void fxsignals()
|
||||
/*
|
||||
* Create a new FX/Mesa context and return a handle to it.
|
||||
*/
|
||||
fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res,
|
||||
GrScreenRefresh_t ref,
|
||||
const GLint attribList[])
|
||||
fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,
|
||||
GrScreenResolution_t res,
|
||||
GrScreenRefresh_t ref,
|
||||
const GLint attribList[])
|
||||
{
|
||||
fxMesaContext fxMesa = NULL;
|
||||
int i,type;
|
||||
@@ -835,7 +864,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res
|
||||
GLint accumSize=0;
|
||||
GLcontext *shareCtx = NULL;
|
||||
GLcontext *ctx = 0;
|
||||
FX_GrContext_t glideContext = 0;
|
||||
/*FX_GrContext_t glideContext = 0;*/
|
||||
char *errorstr;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
@@ -928,24 +957,61 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res
|
||||
fxMesa->verbose=verbose;
|
||||
fxMesa->board=glbCurrentBoard;
|
||||
|
||||
|
||||
fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
|
||||
#if FXMESA_USE_ARGB
|
||||
GR_COLORFORMAT_ARGB,
|
||||
fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
|
||||
GR_COLORFORMAT_ARGB,
|
||||
GR_ORIGIN_LOWER_LEFT,
|
||||
2,aux);
|
||||
#else
|
||||
GR_COLORFORMAT_ABGR,
|
||||
fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
|
||||
GR_COLORFORMAT_ABGR,
|
||||
GR_ORIGIN_LOWER_LEFT,
|
||||
2,aux);
|
||||
#endif
|
||||
GR_ORIGIN_LOWER_LEFT,
|
||||
2,aux);
|
||||
if (!fxMesa->glideContext){
|
||||
errorstr = "grSstWinOpen";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
|
||||
/* Pixel tables are use during pixel read-back */
|
||||
#if FXMESA_USE_ARGB
|
||||
fxInitPixelTables(GL_FALSE); /* Force RGB pixel order */
|
||||
#else
|
||||
if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) {
|
||||
/* jk991130 - GROSS HACK!!! - Voodoo 3s don't use BGR!!
|
||||
* the only way to tell if it's a Voodoo 3 at this stage of the
|
||||
* ballgame (no Glide 3.x for linux *yet*) is to query the # of TMUs
|
||||
* as Voodoo3s have 2 TMUs on board, Banshee has only 1
|
||||
* Thanks to Joseph Kain for that one
|
||||
*/
|
||||
if (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx == 2) {
|
||||
fxInitPixelTables(GL_FALSE); /* use RGB pixel order (Voodoo3) */
|
||||
}
|
||||
else {
|
||||
fxInitPixelTables(GL_TRUE); /* use BGR pixel order on Voodoo1/2 */
|
||||
}
|
||||
}
|
||||
else {
|
||||
fxInitPixelTables(GL_FALSE); /* use RGB pixel order otherwise */
|
||||
}
|
||||
#endif
|
||||
|
||||
fxMesa->width=FX_grSstScreenWidth();
|
||||
fxMesa->height=FX_grSstScreenHeight();
|
||||
|
||||
fxMesa->clipMinX = 0;
|
||||
fxMesa->clipMaxX = fxMesa->width;
|
||||
fxMesa->clipMinY = 0;
|
||||
fxMesa->clipMaxY = fxMesa->height;
|
||||
|
||||
fxMesa->screen_width = fxMesa->width;
|
||||
fxMesa->screen_height = fxMesa->height;
|
||||
fxMesa->x_offset = 0;
|
||||
fxMesa->y_offset = 0;
|
||||
fxMesa->y_delta = 0;
|
||||
|
||||
fxMesa->needClip = 0;
|
||||
|
||||
if(verbose)
|
||||
fprintf(stderr,"Glide screen size: %dx%d\n",
|
||||
(int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight());
|
||||
@@ -1204,7 +1270,7 @@ int GLAPIENTRY fxQueryHardware(void)
|
||||
char buf[80];
|
||||
|
||||
FX_grGlideGetVersion(buf);
|
||||
fprintf(stderr,"Using Glide V%s\n",0);
|
||||
fprintf(stderr,"Using Glide V%s\n","");
|
||||
fprintf(stderr,"Number of boards: %d\n",glbHWConfig.num_sst);
|
||||
|
||||
if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) {
|
||||
|
@@ -1,28 +1,51 @@
|
||||
/* -*- mode: C; tab-width:8; -*-
|
||||
|
||||
fxdd.c - 3Dfx VooDoo Mesa device driver functions
|
||||
*/
|
||||
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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:
|
||||
*
|
||||
* See the file fxapi.c for more informations about authors
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/* fxdd.c - 3Dfx VooDoo Mesa device driver functions */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
#endif
|
||||
@@ -34,6 +57,44 @@
|
||||
#include "enums.h"
|
||||
#include "extensions.h"
|
||||
|
||||
|
||||
/* These lookup table are used to extract RGB values in [0,255] from
|
||||
* 16-bit pixel values.
|
||||
*/
|
||||
GLubyte FX_PixelToR[0x10000];
|
||||
GLubyte FX_PixelToG[0x10000];
|
||||
GLubyte FX_PixelToB[0x10000];
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the FX_PixelTo{RGB} arrays.
|
||||
* Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order.
|
||||
*/
|
||||
void fxInitPixelTables(GLboolean bgrOrder)
|
||||
{
|
||||
GLuint pixel;
|
||||
for (pixel = 0; pixel <= 0xffff; pixel++) {
|
||||
GLuint r, g, b;
|
||||
if (bgrOrder) {
|
||||
r = (pixel & 0x001F) << 3;
|
||||
g = (pixel & 0x07E0) >> 3;
|
||||
b = (pixel & 0xF800) >> 8;
|
||||
}
|
||||
else {
|
||||
r = (pixel & 0xF800) >> 8;
|
||||
g = (pixel & 0x07E0) >> 3;
|
||||
b = (pixel & 0x001F) << 3;
|
||||
}
|
||||
r = r * 255 / 0xF8; /* fill in low-order bits */
|
||||
g = g * 255 / 0xFC;
|
||||
b = b * 255 / 0xF8;
|
||||
FX_PixelToR[pixel] = r;
|
||||
FX_PixelToG[pixel] = g;
|
||||
FX_PixelToB[pixel] = b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** Miscellaneous functions *****/
|
||||
/**********************************************************************/
|
||||
@@ -45,10 +106,11 @@ void fxDDDither(GLcontext *ctx, GLboolean enable)
|
||||
fprintf(stderr,"fxmesa: fxDDDither()\n");
|
||||
}
|
||||
|
||||
if(enable)
|
||||
grDitherMode(GR_DITHER_4x4);
|
||||
else
|
||||
grDitherMode(GR_DITHER_DISABLE);
|
||||
if (enable) {
|
||||
FX_grDitherMode(GR_DITHER_4x4);
|
||||
} else {
|
||||
FX_grDitherMode(GR_DITHER_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,14 +183,14 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
/* clear color and depth buffer */
|
||||
|
||||
if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) {
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
grBufferClear(fxMesa->clearC, fxMesa->clearA,
|
||||
(FxU16)(ctx->Depth.Clear*0xffff));
|
||||
FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
|
||||
(FxU16)(ctx->Depth.Clear*0xffff));
|
||||
}
|
||||
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) {
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
grBufferClear(fxMesa->clearC, fxMesa->clearA,
|
||||
(FxU16)(ctx->Depth.Clear*0xffff));
|
||||
FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
|
||||
(FxU16)(ctx->Depth.Clear*0xffff));
|
||||
}
|
||||
|
||||
newmask=mask & (~(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT));
|
||||
@@ -137,19 +199,20 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
/* clear color buffer */
|
||||
|
||||
if(ctx->Color.ColorMask) {
|
||||
grDepthMask(FXFALSE);
|
||||
FX_grDepthMask(FXFALSE);
|
||||
|
||||
if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) {
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
|
||||
FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
|
||||
}
|
||||
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) {
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
|
||||
FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
|
||||
}
|
||||
|
||||
if(ctx->Depth.Mask)
|
||||
grDepthMask(FXTRUE);
|
||||
if(ctx->Depth.Mask) {
|
||||
FX_grDepthMask(FXTRUE);
|
||||
}
|
||||
}
|
||||
|
||||
newmask=mask & (~(GL_COLOR_BUFFER_BIT));
|
||||
@@ -158,14 +221,14 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
/* clear depth buffer */
|
||||
|
||||
if(ctx->Depth.Mask) {
|
||||
grColorMask(FXFALSE,FXFALSE);
|
||||
grBufferClear(fxMesa->clearC, fxMesa->clearA,
|
||||
(FxU16)(ctx->Depth.Clear*0xffff));
|
||||
FX_grColorMask(FXFALSE,FXFALSE);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
|
||||
(FxU16)(ctx->Depth.Clear*0xffff));
|
||||
|
||||
grColorMask(ctx->Color.ColorMask[RCOMP] ||
|
||||
ctx->Color.ColorMask[GCOMP] ||
|
||||
ctx->Color.ColorMask[BCOMP],
|
||||
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
|
||||
FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
|
||||
ctx->Color.ColorMask[GCOMP] ||
|
||||
ctx->Color.ColorMask[BCOMP],
|
||||
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
|
||||
}
|
||||
|
||||
newmask=mask & (~(GL_DEPTH_BUFFER_BIT));
|
||||
@@ -190,12 +253,12 @@ static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
|
||||
|
||||
if (mode == GL_FRONT_LEFT) {
|
||||
fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
|
||||
grRenderBuffer(fxMesa->currentFB);
|
||||
FX_grRenderBuffer(fxMesa->currentFB);
|
||||
return GL_TRUE;
|
||||
}
|
||||
else if (mode == GL_BACK_LEFT) {
|
||||
fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
|
||||
grRenderBuffer(fxMesa->currentFB);
|
||||
FX_grRenderBuffer(fxMesa->currentFB);
|
||||
return GL_TRUE;
|
||||
}
|
||||
else {
|
||||
@@ -204,6 +267,22 @@ static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
|
||||
}
|
||||
|
||||
|
||||
#ifdef XF86DRI
|
||||
static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py)
|
||||
{
|
||||
int i;
|
||||
|
||||
py=fxMesa->height+fxMesa->y_offset-py;
|
||||
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
|
||||
|
||||
|
||||
static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
|
||||
GLsizei width, GLsizei height,
|
||||
@@ -241,10 +320,16 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
|
||||
ymax=fxMesa->height;
|
||||
}
|
||||
|
||||
xmin+=fxMesa->x_offset;
|
||||
xmax+=fxMesa->x_offset;
|
||||
|
||||
#define ISCLIPPED(rx) ( ((rx)<xmin) || ((rx)>=xmax) )
|
||||
#ifdef XF86DRI
|
||||
#define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) || !inClipRects(fxMesa, rx, ry))
|
||||
#else
|
||||
#define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) )
|
||||
#endif
|
||||
#define DRAWBIT(i) { \
|
||||
if(!ISCLIPPED(x+px)) \
|
||||
if(!ISCLIPPED(x+px, y)) \
|
||||
if( (*pb) & (1<<(i)) ) \
|
||||
(*p)=color; \
|
||||
p++; \
|
||||
@@ -258,7 +343,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
|
||||
scrwidth=fxMesa->width;
|
||||
scrheight=fxMesa->height;
|
||||
|
||||
if((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0))
|
||||
if ((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0))
|
||||
return GL_TRUE;
|
||||
|
||||
pb=bitmap;
|
||||
@@ -269,16 +354,16 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
|
||||
py=0;
|
||||
}
|
||||
|
||||
if(py+height>=scrheight)
|
||||
if (py+height>=scrheight)
|
||||
height-=(py+height)-scrheight;
|
||||
|
||||
info.size=sizeof(info);
|
||||
if(!grLfbLock(GR_LFB_WRITE_ONLY,
|
||||
fxMesa->currentFB,
|
||||
GR_LFBWRITEMODE_565,
|
||||
GR_ORIGIN_UPPER_LEFT,
|
||||
FXFALSE,
|
||||
&info)) {
|
||||
if(!FX_grLfbLock(GR_LFB_WRITE_ONLY,
|
||||
fxMesa->currentFB,
|
||||
GR_LFBWRITEMODE_565,
|
||||
GR_ORIGIN_UPPER_LEFT,
|
||||
FXFALSE,
|
||||
&info)) {
|
||||
#ifndef FX_SILENT
|
||||
fprintf(stderr,"fx Driver: error locking the linear frame buffer\n");
|
||||
#endif
|
||||
@@ -298,13 +383,13 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
|
||||
|
||||
/* This code is a bit slow... */
|
||||
|
||||
for(y=py;y<(py+height);y++) {
|
||||
if (py>ymin) ymin=py;
|
||||
if (py+height<ymax) ymax=py+height;
|
||||
|
||||
if (y>=ymax)
|
||||
break;
|
||||
px+=fxMesa->x_offset;
|
||||
scrheight=fxMesa->height+fxMesa->y_offset;
|
||||
|
||||
if (y<=ymin)
|
||||
continue;
|
||||
for(y=ymin; y<ymax; y++) {
|
||||
|
||||
p=((FxU16 *)info.lfbPtr)+px+((scrheight-y)*stride);
|
||||
|
||||
@@ -315,7 +400,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
|
||||
}
|
||||
}
|
||||
|
||||
grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
|
||||
FX_grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
|
||||
|
||||
#undef ISCLIPPED
|
||||
#undef DRAWBIT
|
||||
@@ -347,8 +432,6 @@ void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
|
||||
{
|
||||
FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
|
||||
ctx->Driver.RenderStart = fxSetupFXUnits;
|
||||
|
||||
FX_CONTEXT(ctx)->wscale = fabs(f)/65535.0f;
|
||||
}
|
||||
|
||||
/* KW: Put the word Mesa in the render string because quakeworld
|
||||
@@ -459,13 +542,13 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
|
||||
fxMesa->unitsState.depthMask =GL_TRUE;
|
||||
fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;
|
||||
|
||||
grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
|
||||
FX_grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
|
||||
if(fxMesa->haveDoubleBuffer) {
|
||||
fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
} else {
|
||||
fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
}
|
||||
|
||||
fxMesa->state = NULL;
|
||||
@@ -481,10 +564,10 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
|
||||
}
|
||||
|
||||
if(fxMesa->haveZBuffer)
|
||||
grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
|
||||
FX_grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
|
||||
|
||||
#if (!FXMESA_USE_ARGB)
|
||||
grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */
|
||||
FX_grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */
|
||||
#endif
|
||||
|
||||
fxMesa->glCtx->Const.MaxTextureLevels=9;
|
||||
@@ -505,7 +588,7 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
|
||||
|
||||
fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
|
||||
|
||||
grGlideGetState((GrState*)fxMesa->state);
|
||||
FX_grGlideGetState((GrState*)fxMesa->state);
|
||||
|
||||
/* XXX Fix me: callback not registered when main VB is created.
|
||||
*/
|
||||
@@ -546,6 +629,12 @@ void fxDDInitExtensions( GLcontext *ctx )
|
||||
gl_extensions_disable( ctx, "GL_ARB_multitexture" );
|
||||
}
|
||||
|
||||
/*
|
||||
This driver may need to move the drawing operations to a different sub
|
||||
window. This modifies the viewport command to add our X,Y offset to all
|
||||
drawn objects that go through the viewport transformation.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
@@ -591,16 +680,19 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
|
||||
/* Not very well written ... */
|
||||
((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) &&
|
||||
((ctx->Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D)))
|
||||
)
|
||||
) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
|
||||
(ctx->Texture.Unit[0].EnvMode==GL_BLEND))
|
||||
(ctx->Texture.Unit[0].EnvMode==GL_BLEND)) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if((ctx->Texture.ReallyEnabled & TEXTURE1_2D) &&
|
||||
(ctx->Texture.Unit[1].EnvMode==GL_BLEND))
|
||||
(ctx->Texture.Unit[1].EnvMode==GL_BLEND)) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
|
||||
@@ -617,8 +709,9 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
|
||||
/* Can't use multipass to blend a multitextured triangle - fall
|
||||
* back to software.
|
||||
*/
|
||||
if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled)
|
||||
if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if ((ctx->Texture.Unit[0].EnvMode!=ctx->Texture.Unit[1].EnvMode) &&
|
||||
(ctx->Texture.Unit[0].EnvMode!=GL_MODULATE) &&
|
||||
@@ -626,7 +719,6 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
|
||||
{
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER)
|
||||
fprintf(stderr, "fxMesa: unsupported multitex env mode\n");
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -635,13 +727,15 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
|
||||
/* Not very well written ... */
|
||||
((ctx->Enabled & TEXTURE0_1D) &&
|
||||
(!(ctx->Enabled & TEXTURE0_2D)))
|
||||
)
|
||||
) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
|
||||
(ctx->Texture.Unit[0].EnvMode==GL_BLEND))
|
||||
(ctx->Texture.Unit[0].EnvMode==GL_BLEND)) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
@@ -680,11 +774,11 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
|
||||
ctx->Driver.LineFunc=fxMesa->LineFunc;
|
||||
ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
|
||||
ctx->Driver.QuadFunc=fxMesa->QuadFunc;
|
||||
} else
|
||||
} else {
|
||||
fxMesa->render_index = FX_FALLBACK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fxSetupDDPointers(GLcontext *ctx)
|
||||
{
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
@@ -748,7 +842,6 @@ void fxSetupDDPointers(GLcontext *ctx)
|
||||
ctx->Driver.CullFace=fxDDCullFace;
|
||||
ctx->Driver.ShadeModel=fxDDShadeModel;
|
||||
ctx->Driver.Enable=fxDDEnable;
|
||||
|
||||
|
||||
ctx->Driver.RegisterVB=fxDDRegisterVB;
|
||||
ctx->Driver.UnregisterVB=fxDDUnregisterVB;
|
||||
@@ -786,3 +879,4 @@ int gl_fx_dummy_function_dd(void)
|
||||
}
|
||||
|
||||
#endif /* FX */
|
||||
|
||||
|
@@ -1,27 +1,51 @@
|
||||
/* -*- mode: C; tab-width:8; -*-
|
||||
|
||||
fxdd.c - 3Dfx VooDoo Mesa span and pixel functions
|
||||
*/
|
||||
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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:
|
||||
*
|
||||
* See the file fxapi.c for more informations about authors
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/* fxdd.c - 3Dfx VooDoo Mesa span and pixel functions */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
#endif
|
||||
@@ -42,6 +66,66 @@
|
||||
|
||||
#if !defined(FXMESA_USE_ARGB)
|
||||
|
||||
|
||||
#if defined(FX_GLIDE3) && defined(XF86DRI)
|
||||
|
||||
static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
|
||||
FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
|
||||
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
|
||||
void *src_data);
|
||||
|
||||
FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
|
||||
FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
|
||||
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
|
||||
void *src_data)
|
||||
{
|
||||
int i, x, w;
|
||||
void *data;
|
||||
|
||||
if (src_width==1 && src_height==1) { /* Easy case writing a point */
|
||||
for (i=0; i<fxMesa->numClipRects; i++) {
|
||||
if ((dst_x>=fxMesa->pClipRects[i].x1) &&
|
||||
(dst_x<fxMesa->pClipRects[i].x2) &&
|
||||
(dst_y>=fxMesa->pClipRects[i].y1) &&
|
||||
(dst_y<fxMesa->pClipRects[i].y2)) {
|
||||
FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format,
|
||||
src_width, src_height, src_stride, src_data);
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
} else if (src_height==1) { /* Writing a span */
|
||||
for (i=0; i<fxMesa->numClipRects; i++) {
|
||||
if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) {
|
||||
if (dst_x<fxMesa->pClipRects[i].x1) {
|
||||
x=fxMesa->pClipRects[i].x1;
|
||||
data=((char*)src_data)+2*(dst_x-x);
|
||||
w=src_width-(x-dst_x);
|
||||
} else {
|
||||
x=dst_x;
|
||||
data=src_data;
|
||||
w=src_width;
|
||||
}
|
||||
if (x+w>fxMesa->pClipRects[i].x2) {
|
||||
w=fxMesa->pClipRects[i].x2-x;
|
||||
}
|
||||
FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, src_height,
|
||||
src_stride, data);
|
||||
}
|
||||
}
|
||||
} else { /* Punt on the case of arbitrary rectangles */
|
||||
return GL_FALSE;
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
||||
FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* KW: Rearranged the args in the call to grLfbWriteRegion().
|
||||
*/
|
||||
#define LFB_WRITE_SPAN_MESA(dst_buffer, \
|
||||
@@ -50,7 +134,7 @@
|
||||
src_width, \
|
||||
src_stride, \
|
||||
src_data) \
|
||||
grLfbWriteRegion(dst_buffer, \
|
||||
writeRegionClipped(fxMesa, dst_buffer, \
|
||||
dst_x, \
|
||||
dst_y, \
|
||||
GR_LFB_SRC_FMT_8888, \
|
||||
@@ -60,7 +144,11 @@
|
||||
src_data) \
|
||||
|
||||
|
||||
#else /* defined(FXMESA_USE_RGBA) */
|
||||
#else /* !defined(FXMESA_USE_RGBA) */
|
||||
|
||||
#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
||||
FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
|
||||
|
||||
|
||||
#define MESACOLOR_TO_ARGB(c) ( \
|
||||
( ((unsigned int)(c[ACOMP]))<<24 ) | \
|
||||
@@ -68,7 +156,7 @@
|
||||
( ((unsigned int)(c[GCOMP]))<<8 ) | \
|
||||
( (unsigned int)(c[BCOMP])) )
|
||||
|
||||
void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
|
||||
inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
|
||||
FxU32 dst_x,
|
||||
FxU32 dst_y,
|
||||
FxU32 src_width,
|
||||
@@ -84,7 +172,7 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
|
||||
{
|
||||
argb[i] = MESACOLOR_TO_ARGB(rgba[i]);
|
||||
}
|
||||
FX_grLfbWriteRegion(dst_buffer,
|
||||
writeRegionClipped( /*fxMesa,*/ NULL, dst_buffer,
|
||||
dst_x,
|
||||
dst_y,
|
||||
GR_LFB_SRC_FMT_8888,
|
||||
@@ -93,8 +181,9 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
|
||||
src_stride,
|
||||
(void*)argb);
|
||||
}
|
||||
|
||||
#endif /* !defined(FXMESA_USE_RGBA) */
|
||||
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/***** Span functions *****/
|
||||
@@ -107,12 +196,13 @@ static void fxDDWriteRGBASpan(const GLcontext *ctx,
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDWriteRGBASpan(...)\n");
|
||||
}
|
||||
|
||||
x+=fxMesa->x_offset;
|
||||
if (mask) {
|
||||
int span=0;
|
||||
|
||||
@@ -143,13 +233,14 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx,
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDWriteRGBSpan()\n");
|
||||
}
|
||||
|
||||
x+=fxMesa->x_offset;
|
||||
if (mask) {
|
||||
int span=0;
|
||||
|
||||
@@ -192,13 +283,14 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
GLuint data[MAX_WIDTH];
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n");
|
||||
}
|
||||
|
||||
x+=fxMesa->x_offset;
|
||||
if (mask) {
|
||||
int span=0;
|
||||
|
||||
@@ -208,7 +300,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
|
||||
++span;
|
||||
} else {
|
||||
if (span > 0) {
|
||||
FX_grLfbWriteRegion( fxMesa->currentFB, x+i-span, bottom-y,
|
||||
writeRegionClipped(fxMesa, fxMesa->currentFB, x+i-span, bottom-y,
|
||||
GR_LFB_SRC_FMT_8888, span, 1, 0,
|
||||
(void *) data );
|
||||
span = 0;
|
||||
@@ -217,7 +309,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
|
||||
}
|
||||
|
||||
if (span > 0)
|
||||
FX_grLfbWriteRegion( fxMesa->currentFB, x+n-span, bottom-y,
|
||||
writeRegionClipped(fxMesa, fxMesa->currentFB, x+n-span, bottom-y,
|
||||
GR_LFB_SRC_FMT_8888, span, 1, 0,
|
||||
(void *) data );
|
||||
} else {
|
||||
@@ -225,7 +317,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
|
||||
data[i]=(GLuint) fxMesa->color;
|
||||
}
|
||||
|
||||
FX_grLfbWriteRegion( fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888,
|
||||
writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888,
|
||||
n, 1, 0, (void *) data );
|
||||
}
|
||||
}
|
||||
@@ -237,7 +329,7 @@ static void fxDDReadRGBASpan(const GLcontext *ctx,
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLushort data[MAX_WIDTH];
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDReadRGBASpan(...)\n");
|
||||
@@ -245,20 +337,16 @@ static void fxDDReadRGBASpan(const GLcontext *ctx,
|
||||
|
||||
assert(n < MAX_WIDTH);
|
||||
|
||||
grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data);
|
||||
for (i=0;i<n;i++) {
|
||||
#if FXMESA_USE_ARGB
|
||||
rgba[i][RCOMP]=(data[i] & 0xF800) >> 8;
|
||||
rgba[i][GCOMP]=(data[i] & 0x07E0) >> 3;
|
||||
rgba[i][BCOMP]=(data[i] & 0x001F) << 3;
|
||||
#else
|
||||
rgba[i][RCOMP]=(data[i] & 0x001f) << 3;
|
||||
rgba[i][GCOMP]=(data[i] & 0x07e0) >> 3;
|
||||
rgba[i][BCOMP]=(data[i] & 0xf800) >> 8;
|
||||
#endif
|
||||
rgba[i][ACOMP]=255;
|
||||
}
|
||||
x+=fxMesa->x_offset;
|
||||
FX_grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data);
|
||||
|
||||
for (i=0;i<n;i++) {
|
||||
GLushort pixel = data[i];
|
||||
rgba[i][RCOMP] = FX_PixelToR[pixel];
|
||||
rgba[i][GCOMP] = FX_PixelToG[pixel];
|
||||
rgba[i][BCOMP] = FX_PixelToB[pixel];
|
||||
rgba[i][ACOMP] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
@@ -271,7 +359,7 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx,
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDWriteRGBAPixels(...)\n");
|
||||
@@ -279,8 +367,8 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx,
|
||||
|
||||
for(i=0;i<n;i++)
|
||||
if(mask[i])
|
||||
LFB_WRITE_SPAN_MESA(fxMesa->currentFB,x[i],bottom-y[i],
|
||||
/*GR_LFB_SRC_FMT_8888,*/1,/*1,*/0,(void *)rgba[i]);
|
||||
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i]+fxMesa->x_offset, bottom-y[i],
|
||||
1, 1, (void *)rgba[i]);
|
||||
}
|
||||
|
||||
static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
|
||||
@@ -289,7 +377,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
|
||||
@@ -297,7 +385,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
|
||||
|
||||
for(i=0;i<n;i++)
|
||||
if(mask[i])
|
||||
FX_grLfbWriteRegion(fxMesa->currentFB,x[i],bottom-y[i],
|
||||
writeRegionClipped(fxMesa, fxMesa->currentFB,x[i]+fxMesa->x_offset,bottom-y[i],
|
||||
GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color);
|
||||
}
|
||||
|
||||
@@ -307,31 +395,25 @@ static void fxDDReadRGBAPixels(const GLcontext *ctx,
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLushort data;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n");
|
||||
}
|
||||
|
||||
for(i=0;i<n;i++)
|
||||
for(i=0;i<n;i++) {
|
||||
if(mask[i]) {
|
||||
grLfbReadRegion(fxMesa->currentFB,x[i],bottom-y[i],1,1,0,&data);
|
||||
#if FXMESA_USE_ARGB
|
||||
rgba[i][RCOMP]=(data & 0xF800) >> 8;
|
||||
rgba[i][GCOMP]=(data & 0x07E0) >> 3;
|
||||
rgba[i][BCOMP]=(data & 0x001F) >> 8;
|
||||
#else
|
||||
rgba[i][RCOMP]=(data & 0x001f) << 3;
|
||||
rgba[i][GCOMP]=(data & 0x07e0) >> 3;
|
||||
rgba[i][BCOMP]=(data & 0xf800) >> 8;
|
||||
#endif
|
||||
/* the alpha value should be read from the auxiliary buffer when required */
|
||||
|
||||
rgba[i][ACOMP]=255;
|
||||
GLushort pixel;
|
||||
FX_grLfbReadRegion(fxMesa->currentFB,x[i],bottom-y[i],1,1,0,&pixel);
|
||||
rgba[i][RCOMP] = FX_PixelToR[pixel];
|
||||
rgba[i][GCOMP] = FX_PixelToG[pixel];
|
||||
rgba[i][BCOMP] = FX_PixelToB[pixel];
|
||||
rgba[i][ACOMP] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/***** Depth functions *****/
|
||||
/************************************************************************/
|
||||
@@ -341,14 +423,15 @@ void fxDDReadDepthSpanFloat(GLcontext *ctx,
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
GLushort data[MAX_WIDTH];
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDReadDepthSpanFloat(...)\n");
|
||||
}
|
||||
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
|
||||
x+=fxMesa->x_offset;
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
|
||||
|
||||
/*
|
||||
convert the read values to float values [0.0 .. 1.0].
|
||||
@@ -361,13 +444,14 @@ void fxDDReadDepthSpanInt(GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y, GLdepth depth[])
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n");
|
||||
}
|
||||
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
|
||||
x+=fxMesa->x_offset;
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
|
||||
}
|
||||
|
||||
GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
|
||||
@@ -380,13 +464,14 @@ GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
|
||||
GLubyte *m=mask;
|
||||
GLuint i;
|
||||
GLuint passed=0;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDDepthTestSpanGeneric(...)\n");
|
||||
}
|
||||
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata);
|
||||
x+=fxMesa->x_offset;
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata);
|
||||
|
||||
/* switch cases ordered from most frequent to less frequent */
|
||||
switch (ctx->Depth.Func) {
|
||||
@@ -578,7 +663,7 @@ GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
|
||||
} /*switch*/
|
||||
|
||||
if(passed)
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata);
|
||||
|
||||
return passed;
|
||||
}
|
||||
@@ -590,7 +675,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
GLdepth zval;
|
||||
GLuint i;
|
||||
GLint bottom=fxMesa->height-1;
|
||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDDepthTestPixelsGeneric(...)\n");
|
||||
@@ -603,10 +688,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] < zval) {
|
||||
/* pass */
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
} else {
|
||||
/* fail */
|
||||
mask[i] = 0;
|
||||
@@ -617,7 +702,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Don't update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] < zval) {
|
||||
/* pass */
|
||||
}
|
||||
@@ -634,10 +719,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] <= zval) {
|
||||
/* pass */
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
} else {
|
||||
/* fail */
|
||||
mask[i] = 0;
|
||||
@@ -648,7 +733,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Don't update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] <= zval) {
|
||||
/* pass */
|
||||
} else {
|
||||
@@ -664,10 +749,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] >= zval) {
|
||||
/* pass */
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
} else {
|
||||
/* fail */
|
||||
mask[i] = 0;
|
||||
@@ -678,7 +763,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Don't update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] >= zval) {
|
||||
/* pass */
|
||||
} else {
|
||||
@@ -694,10 +779,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] > zval) {
|
||||
/* pass */
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
} else {
|
||||
/* fail */
|
||||
mask[i] = 0;
|
||||
@@ -708,7 +793,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Don't update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] > zval) {
|
||||
/* pass */
|
||||
} else {
|
||||
@@ -724,10 +809,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] != zval) {
|
||||
/* pass */
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
} else {
|
||||
/* fail */
|
||||
mask[i] = 0;
|
||||
@@ -738,7 +823,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Don't update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] != zval) {
|
||||
/* pass */
|
||||
}
|
||||
@@ -755,10 +840,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] == zval) {
|
||||
/* pass */
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
} else {
|
||||
/* fail */
|
||||
mask[i] = 0;
|
||||
@@ -769,7 +854,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Don't update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
|
||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
||||
if (z[i] == zval) {
|
||||
/* pass */
|
||||
} else {
|
||||
@@ -785,7 +870,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
||||
/* Update Z buffer */
|
||||
for (i=0; i<n; i++) {
|
||||
if (mask[i]) {
|
||||
FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@@ -1,27 +1,48 @@
|
||||
/* -*- mode: C; tab-width:8; -*-
|
||||
|
||||
fxddtex.c - 3Dfx VooDoo Texture mapping functions
|
||||
*/
|
||||
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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:
|
||||
*
|
||||
* See the file fxapi.c for more informations about authors
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
#endif
|
||||
@@ -30,6 +51,37 @@
|
||||
|
||||
#include "fxdrv.h"
|
||||
|
||||
void fxPrintTextureData(tfxTexInfo *ti)
|
||||
{
|
||||
fprintf(stderr, "Texture Data:\n");
|
||||
if (ti->tObj) {
|
||||
fprintf(stderr, "\tName: %d\n", ti->tObj->Name);
|
||||
fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel);
|
||||
fprintf(stderr, "\tSize: %d x %d\n",
|
||||
ti->tObj->Image[ti->tObj->BaseLevel]->Width,
|
||||
ti->tObj->Image[ti->tObj->BaseLevel]->Height);
|
||||
} else
|
||||
fprintf(stderr, "\tName: UNNAMED\n");
|
||||
fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed);
|
||||
fprintf(stderr, "\tTMU: %d\n", ti->whichTMU);
|
||||
fprintf(stderr, "\t%s\n", (ti->isInTM)?"In TMU":"Not in TMU");
|
||||
if (ti->tm[0])
|
||||
fprintf(stderr, "\tMem0: %x-%x\n", ti->tm[0]->startAddr,
|
||||
ti->tm[0]->endAddr);
|
||||
if (ti->tm[1])
|
||||
fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr,
|
||||
ti->tm[1]->endAddr);
|
||||
fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel);
|
||||
fprintf(stderr, "\tFilters: min %d min %d\n", ti->minFilt, ti->maxFilt);
|
||||
fprintf(stderr, "\tClamps: s %d t %d\n", ti->sClamp, ti->tClamp);
|
||||
fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale);
|
||||
fprintf(stderr, "\tInt Scales: s %d t %d\n",
|
||||
ti->int_sScale/0x800000, ti->int_tScale/0x800000);
|
||||
fprintf(stderr, "\t%s\n", (ti->fixedPalette)?"Fixed palette":"Non fixed palette");
|
||||
fprintf(stderr, "\t%s\n", (ti->validated)?"Validated":"Not validated");
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/*************************** Texture Mapping ****************************/
|
||||
/************************************************************************/
|
||||
@@ -41,7 +93,7 @@ void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj)
|
||||
|
||||
fxTMMoveOutTM(fxMesa,tObj); /* TO DO: SLOW but easy to write */
|
||||
|
||||
ti=(tfxTexInfo *)tObj->DriverData;
|
||||
ti=fxTMGetTexInfo(tObj);
|
||||
ti->validated=GL_FALSE;
|
||||
fxMesa->new_state|=FX_NEW_TEXTURING;
|
||||
ctx->Driver.RenderStart = fxSetupFXUnits;
|
||||
@@ -59,12 +111,12 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
|
||||
}
|
||||
|
||||
ti->validated=GL_FALSE;
|
||||
ti->tmi.isInTM=GL_FALSE;
|
||||
ti->isInTM=GL_FALSE;
|
||||
|
||||
ti->tmi.whichTMU=FX_TMU_NONE;
|
||||
ti->whichTMU=FX_TMU_NONE;
|
||||
|
||||
ti->tmi.tm[FX_TMU0]=NULL;
|
||||
ti->tmi.tm[FX_TMU1]=NULL;
|
||||
ti->tm[FX_TMU0]=NULL;
|
||||
ti->tm[FX_TMU1]=NULL;
|
||||
|
||||
ti->minFilt=GR_TEXTUREFILTER_POINT_SAMPLED;
|
||||
ti->maxFilt=GR_TEXTUREFILTER_BILINEAR;
|
||||
@@ -72,17 +124,12 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
|
||||
ti->sClamp=GR_TEXTURECLAMP_WRAP;
|
||||
ti->tClamp=GR_TEXTURECLAMP_WRAP;
|
||||
|
||||
if(fxMesa->haveTwoTMUs) {
|
||||
ti->mmMode=GR_MIPMAP_NEAREST;
|
||||
ti->LODblend=FXTRUE;
|
||||
} else {
|
||||
ti->mmMode=GR_MIPMAP_NEAREST_DITHER;
|
||||
ti->LODblend=FXFALSE;
|
||||
}
|
||||
ti->mmMode=GR_MIPMAP_NEAREST;
|
||||
ti->LODblend=FXFALSE;
|
||||
|
||||
for(i=0;i<MAX_TEXTURE_LEVELS;i++) {
|
||||
ti->tmi.mipmapLevel[i].used=GL_FALSE;
|
||||
ti->tmi.mipmapLevel[i].data=NULL;
|
||||
ti->mipmapLevel[i].used=GL_FALSE;
|
||||
ti->mipmapLevel[i].data=NULL;
|
||||
}
|
||||
|
||||
return ti;
|
||||
@@ -100,13 +147,14 @@ void fxDDTexBind(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj)
|
||||
if(target!=GL_TEXTURE_2D)
|
||||
return;
|
||||
|
||||
if(!tObj->DriverData)
|
||||
if (!tObj->DriverData) {
|
||||
tObj->DriverData=fxAllocTexObjData(fxMesa);
|
||||
}
|
||||
|
||||
ti=(tfxTexInfo *)tObj->DriverData;
|
||||
ti=fxTMGetTexInfo(tObj);
|
||||
|
||||
fxMesa->texBindNumber++;
|
||||
ti->tmi.lastTimeUsed=fxMesa->texBindNumber;
|
||||
ti->lastTimeUsed=fxMesa->texBindNumber;
|
||||
|
||||
fxMesa->new_state|=FX_NEW_TEXTURING;
|
||||
ctx->Driver.RenderStart = fxSetupFXUnits;
|
||||
@@ -141,10 +189,10 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
if(target!=GL_TEXTURE_2D)
|
||||
return;
|
||||
|
||||
if(!tObj->DriverData)
|
||||
if (!tObj->DriverData)
|
||||
tObj->DriverData=fxAllocTexObjData(fxMesa);
|
||||
|
||||
ti=(tfxTexInfo *)tObj->DriverData;
|
||||
ti=fxTMGetTexInfo(tObj);
|
||||
|
||||
switch(pname) {
|
||||
|
||||
@@ -219,7 +267,6 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
ti->sClamp=GR_TEXTURECLAMP_WRAP;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "BAD CLAMP\n");
|
||||
break;
|
||||
}
|
||||
fxMesa->new_state|=FX_NEW_TEXTURING;
|
||||
@@ -266,7 +313,7 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
|
||||
{
|
||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||
tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
|
||||
tfxTexInfo *ti=fxTMGetTexInfo(tObj);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti);
|
||||
@@ -309,10 +356,10 @@ void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!tObj->DriverData)
|
||||
if (!tObj->DriverData)
|
||||
tObj->DriverData=fxAllocTexObjData(fxMesa);
|
||||
|
||||
ti=(tfxTexInfo *)tObj->DriverData;
|
||||
ti=fxTMGetTexInfo(tObj);
|
||||
|
||||
for(i=0;i<tObj->PaletteSize;i++) {
|
||||
r=tObj->Palette[i*4];
|
||||
@@ -374,13 +421,10 @@ void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state)
|
||||
if((ctx->Texture.Unit[0].Current==ctx->Texture.Unit[0].CurrentD[2]) &&
|
||||
(ctx->Texture.Unit[0].Current!=NULL)) {
|
||||
struct gl_texture_object *tObj=ctx->Texture.Unit[0].Current;
|
||||
tfxTexInfo *ti;
|
||||
|
||||
if(!tObj->DriverData)
|
||||
if (!tObj->DriverData)
|
||||
tObj->DriverData=fxAllocTexObjData(fxMesa);
|
||||
|
||||
ti=(tfxTexInfo *)tObj->DriverData;
|
||||
|
||||
fxTexInvalidate(ctx,tObj);
|
||||
}
|
||||
}
|
||||
@@ -872,10 +916,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
|
||||
|
||||
if(wscale==hscale==1) {
|
||||
int i=0;
|
||||
int lenght=h*w;
|
||||
int length=h*w;
|
||||
unsigned short a,l;
|
||||
|
||||
while(i++<lenght) {
|
||||
while(i++<length) {
|
||||
l=*data++;
|
||||
a=*data++;
|
||||
|
||||
@@ -916,10 +960,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
|
||||
|
||||
if(wscale==hscale==1) {
|
||||
int i=0;
|
||||
int lenght=h*w;
|
||||
int length=h*w;
|
||||
unsigned short r,g,b;
|
||||
|
||||
while(i++<lenght) {
|
||||
while(i++<length) {
|
||||
r=*data++;
|
||||
g=*data++;
|
||||
b=*data++;
|
||||
@@ -966,10 +1010,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
|
||||
|
||||
if(wscale==hscale==1) {
|
||||
int i=0;
|
||||
int lenght=h*w;
|
||||
int length=h*w;
|
||||
unsigned short r,g,b,a;
|
||||
|
||||
while(i++<lenght) {
|
||||
while(i++<length) {
|
||||
r=*data++;
|
||||
g=*data++;
|
||||
b=*data++;
|
||||
@@ -1014,21 +1058,23 @@ void fxDDTexImg(GLcontext *ctx, GLenum target,
|
||||
tfxTexInfo *ti;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: (%d) fxDDTexImg(...,%d,%x,%d,%d...)\n",tObj->Name,
|
||||
target,internalFormat,image->Width,image->Height);
|
||||
fprintf(stderr,
|
||||
"fxmesa: (%d) fxDDTexImg(...,level=%d,target=%d,format=%x,width=%d,height=%d...)\n",
|
||||
tObj->Name, level, target, internalFormat, image->Width,
|
||||
image->Height);
|
||||
}
|
||||
|
||||
if(target!=GL_TEXTURE_2D)
|
||||
return;
|
||||
|
||||
if(!tObj->DriverData)
|
||||
if (!tObj->DriverData)
|
||||
tObj->DriverData=fxAllocTexObjData(fxMesa);
|
||||
|
||||
ti=(tfxTexInfo *)tObj->DriverData;
|
||||
ti=fxTMGetTexInfo(tObj);
|
||||
|
||||
if(fxIsTexSupported(target,internalFormat,image)) {
|
||||
GrTextureFormat_t gldformat;
|
||||
tfxMipMapLevel *mml=&ti->tmi.mipmapLevel[level];
|
||||
tfxMipMapLevel *mml=&ti->mipmapLevel[level];
|
||||
|
||||
fxTexGetFormat(internalFormat,&gldformat,NULL);
|
||||
|
||||
@@ -1039,7 +1085,7 @@ void fxDDTexImg(GLcontext *ctx, GLenum target,
|
||||
fxTexBuildImageMap(image,internalFormat,&(mml->data),
|
||||
&(mml->translated));
|
||||
|
||||
if(ti->validated && ti->tmi.isInTM)
|
||||
if(ti->validated && ti->isInTM)
|
||||
fxTMReloadMipMapLevel(fxMesa,tObj,level);
|
||||
else
|
||||
fxTexInvalidate(ctx,tObj);
|
||||
@@ -1239,18 +1285,20 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target,
|
||||
tfxMipMapLevel *mml;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: (%d) fxDDTexSubImg(...,%d,%x,%d,%d...)\n",tObj->Name,
|
||||
target,internalFormat,image->Width,image->Height);
|
||||
fprintf(stderr,
|
||||
"fxmesa: (%d) fxDDTexSubImg(level=%d,target=%d,format=%x,width=%d,height=%d)\n",
|
||||
tObj->Name, level, target, internalFormat, image->Width,
|
||||
image->Height);
|
||||
}
|
||||
|
||||
if(target!=GL_TEXTURE_2D)
|
||||
return;
|
||||
|
||||
if(!tObj->DriverData)
|
||||
if (!tObj->DriverData)
|
||||
return;
|
||||
|
||||
ti=(tfxTexInfo *)tObj->DriverData;
|
||||
mml=&ti->tmi.mipmapLevel[level];
|
||||
ti=fxTMGetTexInfo(tObj);
|
||||
mml=&ti->mipmapLevel[level];
|
||||
|
||||
fxTexGetFormat(internalFormat,&gldformat,NULL);
|
||||
|
||||
@@ -1278,7 +1326,7 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target,
|
||||
fxTexBuildSubImageMap(image,internalFormat,xoffset,yoffset,
|
||||
width,height,mml->data);
|
||||
|
||||
if(ti->validated && ti->tmi.isInTM)
|
||||
if(ti->validated && ti->isInTM)
|
||||
fxTMReloadSubMipMapLevel(fxMesa,tObj,level,yoffset,height);
|
||||
else
|
||||
fxTexInvalidate(ctx,tObj);
|
||||
|
@@ -1,27 +1,48 @@
|
||||
/* -*- mode: C; tab-width:8; -*-
|
||||
|
||||
fxdrv.h - 3Dfx VooDoo driver types
|
||||
*/
|
||||
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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:
|
||||
*
|
||||
* See the file fxapi.c for more informations about authors
|
||||
* 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 FXDRV_H
|
||||
#define FXDRV_H
|
||||
|
||||
@@ -54,14 +75,18 @@
|
||||
#include "clip.h"
|
||||
#include "vbrender.h"
|
||||
|
||||
#ifdef XF86DRI
|
||||
typedef struct tfxMesaContext *fxMesaContext;
|
||||
#else
|
||||
#include "GL/fxmesa.h"
|
||||
#endif
|
||||
#include "fxglidew.h"
|
||||
/* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of WINGDIAPI/APIENTRY/CALLBACK, */
|
||||
/* these are defined in mesa gl/gl.h - tjump@spgs.com */
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
#if defined(MESA_DEBUG) && 0
|
||||
extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
|
||||
#define grDrawTriangle fx_sanity_triangle
|
||||
#endif
|
||||
@@ -140,17 +165,17 @@ typedef struct {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FX_VB_COLOR(fxm, color) \
|
||||
do { \
|
||||
if (sizeof(GLint) == 4*sizeof(GLubyte)) { \
|
||||
if (fxm->constColor != *(GLuint*)color) { \
|
||||
fxm->constColor = *(GLuint*)color; \
|
||||
grConstantColorValue(FXCOLOR4(color)); \
|
||||
} \
|
||||
} else { \
|
||||
grConstantColorValue(FXCOLOR4(color)); \
|
||||
} \
|
||||
} while (0)
|
||||
#define FX_VB_COLOR(fxm, color) \
|
||||
do { \
|
||||
if (sizeof(GLint) == 4*sizeof(GLubyte)) { \
|
||||
if (fxm->constColor != *(GLuint*)color) { \
|
||||
fxm->constColor = *(GLuint*)color; \
|
||||
FX_grConstantColorValue(FXCOLOR4(color)); \
|
||||
} \
|
||||
} else { \
|
||||
FX_grConstantColorValue(FXCOLOR4(color)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define GOURAUD(x) { \
|
||||
GLubyte *col = VB->ColorPtr->data[(x)]; \
|
||||
@@ -237,16 +262,13 @@ do { \
|
||||
|
||||
typedef void (*tfxRenderVBFunc)(GLcontext *);
|
||||
|
||||
typedef struct tfxTMFreeListNode {
|
||||
struct tfxTMFreeListNode *next;
|
||||
FxU32 startAddress, endAddress;
|
||||
} tfxTMFreeNode;
|
||||
|
||||
typedef struct tfxTMAllocListNode {
|
||||
struct tfxTMAllocListNode *next;
|
||||
FxU32 startAddress, endAddress;
|
||||
struct gl_texture_object *tObj;
|
||||
} tfxTMAllocNode;
|
||||
/*
|
||||
Memory range from startAddr to endAddr-1
|
||||
*/
|
||||
typedef struct MemRange_t {
|
||||
struct MemRange_t *next;
|
||||
FxU32 startAddr, endAddr;
|
||||
} MemRange;
|
||||
|
||||
typedef struct {
|
||||
GLsizei width, height;
|
||||
@@ -256,19 +278,17 @@ typedef struct {
|
||||
GLboolean translated, used;
|
||||
} tfxMipMapLevel;
|
||||
|
||||
typedef struct {
|
||||
typedef struct tfxTexInfo_t {
|
||||
struct tfxTexInfo *next;
|
||||
struct gl_texture_object *tObj;
|
||||
|
||||
GLuint lastTimeUsed;
|
||||
|
||||
FxU32 whichTMU;
|
||||
|
||||
tfxTMAllocNode *tm[FX_NUM_TMU];
|
||||
GLboolean isInTM;
|
||||
|
||||
tfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS];
|
||||
GLboolean isInTM;
|
||||
} tfxTMInfo;
|
||||
|
||||
typedef struct {
|
||||
tfxTMInfo tmi;
|
||||
MemRange *tm[FX_NUM_TMU];
|
||||
|
||||
GLint minLevel, maxLevel;
|
||||
GLint baseLevelInternalFormat;
|
||||
@@ -384,14 +404,27 @@ struct tfxMesaVertexBuffer {
|
||||
|
||||
#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
|
||||
#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
|
||||
#define FX_TEXTURE_DATA(t) ((tfxTexInfo *) ((t)->Current->DriverData))
|
||||
#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current)
|
||||
|
||||
#if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING)
|
||||
#include "tdfx_init.h"
|
||||
#else
|
||||
#define DRI_FX_CONTEXT
|
||||
#define BEGIN_BOARD_LOCK()
|
||||
#define END_BOARD_LOCK()
|
||||
#define BEGIN_CLIP_LOOP()
|
||||
#define END_CLIP_LOOP()
|
||||
#endif
|
||||
|
||||
|
||||
/* These lookup table are used to extract RGB values in [0,255] from
|
||||
* 16-bit pixel values.
|
||||
*/
|
||||
extern GLubyte FX_PixelToR[0x10000];
|
||||
extern GLubyte FX_PixelToG[0x10000];
|
||||
extern GLubyte FX_PixelToB[0x10000];
|
||||
|
||||
|
||||
struct tfxMesaContext {
|
||||
GuTexPalette glbPalette;
|
||||
|
||||
@@ -412,7 +445,6 @@ struct tfxMesaContext {
|
||||
tfxUnitsState unitsState;
|
||||
tfxUnitsState restoreUnitsState; /* saved during multipass */
|
||||
|
||||
|
||||
GLuint tmu_source[FX_NUM_TMU];
|
||||
GLuint tex_dest[MAX_TEXTURE_UNITS];
|
||||
GLuint setupindex;
|
||||
@@ -438,8 +470,8 @@ struct tfxMesaContext {
|
||||
GLint tmuSrc;
|
||||
GLuint lastUnitsMode;
|
||||
GLuint freeTexMem[FX_NUM_TMU];
|
||||
tfxTMFreeNode *tmFree[FX_NUM_TMU];
|
||||
tfxTMAllocNode *tmAlloc[FX_NUM_TMU];
|
||||
MemRange *tmPool;
|
||||
MemRange *tmFree[FX_NUM_TMU];
|
||||
|
||||
GLenum fogTableMode;
|
||||
GLfloat fogDensity;
|
||||
@@ -477,10 +509,19 @@ struct tfxMesaContext {
|
||||
|
||||
FX_GrContext_t glideContext;
|
||||
|
||||
GLfloat wscale;
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
int y_delta;
|
||||
int screen_width;
|
||||
int screen_height;
|
||||
int initDone;
|
||||
int clipMinX;
|
||||
int clipMaxX;
|
||||
int clipMinY;
|
||||
int clipMaxY;
|
||||
int needClip;
|
||||
|
||||
DRI_FX_CONTEXT
|
||||
|
||||
};
|
||||
|
||||
typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
|
||||
@@ -522,6 +563,7 @@ extern void fxSetupDDSpanPointers(GLcontext *);
|
||||
|
||||
extern void fxDDBufferSize(GLcontext *, GLuint *, GLuint *);
|
||||
|
||||
extern void fxPrintTextureData(tfxTexInfo *ti);
|
||||
extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *);
|
||||
extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *,
|
||||
GLint, GLint, const struct gl_texture_image *);
|
||||
@@ -571,6 +613,7 @@ extern void fxDDRenderVBIndirectDirect( struct vertex_buffer *VB );
|
||||
|
||||
extern void fxDDInitExtensions( GLcontext *ctx );
|
||||
|
||||
#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
|
||||
extern void fxTMInit(fxMesaContext ctx);
|
||||
extern void fxTMClose(fxMesaContext ctx);
|
||||
extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
|
||||
@@ -622,4 +665,14 @@ extern void fxDDDoRenderVB( struct vertex_buffer *VB );
|
||||
|
||||
extern int fxDDInitFxMesaContext( fxMesaContext fxMesa );
|
||||
|
||||
|
||||
extern void fxSetScissorValues(GLcontext *ctx);
|
||||
extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
|
||||
struct gl_texture_object *tObj,
|
||||
GLint where);
|
||||
extern void fxSetupTexture_NoLock(GLcontext *ctx);
|
||||
extern void fxSetupTexture(GLcontext *ctx);
|
||||
|
||||
extern void fxInitPixelTables(GLboolean bgrOrder);
|
||||
|
||||
#endif
|
||||
|
@@ -1,28 +1,47 @@
|
||||
/* $Id: fxglidew.c,v 1.3 1999/10/05 19:26:54 miklos Exp $ */
|
||||
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
@@ -36,8 +55,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
FxI32 FX_grGetInteger(FxU32 pname)
|
||||
static FxI32 FX_grGetInteger_NoLock(FxU32 pname)
|
||||
{
|
||||
#if !defined(FX_GLIDE3)
|
||||
switch (pname)
|
||||
@@ -49,7 +67,7 @@ FxI32 FX_grGetInteger(FxU32 pname)
|
||||
case FX_LFB_PIXEL_PIPE:
|
||||
return FXFALSE;
|
||||
case FX_PENDING_BUFFERSWAPS:
|
||||
return grBufferNumPending();
|
||||
return grBufferNumPending();
|
||||
default:
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
|
||||
@@ -74,12 +92,74 @@ FxI32 FX_grGetInteger(FxU32 pname)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
grGet(grname,4,&result);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
FxI32 FX_grGetInteger(FxU32 pname)
|
||||
{
|
||||
int result;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
result=FX_grGetInteger_NoLock(pname);
|
||||
END_BOARD_LOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
|
||||
GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
|
||||
FxBool pixelPipeline, GrLfbInfo_t *info ) {
|
||||
FxBool result;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
result=grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
|
||||
END_BOARD_LOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info) {
|
||||
FxU32 result;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
result=grTexTextureMemRequired(evenOdd, info);
|
||||
END_BOARD_LOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
FxU32 FX_grTexMinAddress(GrChipID_t tmu) {
|
||||
FxU32 result;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
result=grTexMinAddress(tmu);
|
||||
END_BOARD_LOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) {
|
||||
FxU32 result;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
result=grTexMaxAddress(tmu);
|
||||
END_BOARD_LOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
FxBool FX_grSstControl(FxU32 code)
|
||||
{
|
||||
#if defined(FX_GLIDE3)
|
||||
(void) code;
|
||||
return 1; /* OK? */
|
||||
#else
|
||||
FxU32 result;
|
||||
BEGIN_BOARD_LOCK();
|
||||
result = grSstControl(code);
|
||||
END_BOARD_LOCK();
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if defined(FX_GLIDE3)
|
||||
@@ -90,39 +170,33 @@ void FX_grGammaCorrectionValue(float val)
|
||||
/* ToDo */
|
||||
}
|
||||
|
||||
void FX_grSstControl(int par)
|
||||
{
|
||||
(void)par;
|
||||
/* ToDo */
|
||||
}
|
||||
int FX_getFogTableSize(void)
|
||||
{
|
||||
int result;
|
||||
BEGIN_BOARD_LOCK();
|
||||
grGet(GR_FOG_TABLE_ENTRIES,sizeof(int),(void*)&result);
|
||||
END_BOARD_LOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
int FX_getGrStateSize(void)
|
||||
{
|
||||
int result;
|
||||
BEGIN_BOARD_LOCK();
|
||||
grGet(GR_GLIDE_STATE_SIZE,sizeof(int),(void*)&result);
|
||||
|
||||
END_BOARD_LOCK();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
int FX_grBufferNumPending()
|
||||
{
|
||||
int result;
|
||||
grGet(GR_PENDING_BUFFERSWAPS,sizeof(int),(void*)&result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int FX_grSstScreenWidth()
|
||||
{
|
||||
FxI32 result[4];
|
||||
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
|
||||
END_BOARD_LOCK();
|
||||
|
||||
return result[2];
|
||||
}
|
||||
@@ -130,15 +204,19 @@ int FX_grSstScreenWidth()
|
||||
int FX_grSstScreenHeight()
|
||||
{
|
||||
FxI32 result[4];
|
||||
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
|
||||
END_BOARD_LOCK();
|
||||
|
||||
return result[3];
|
||||
}
|
||||
|
||||
void FX_grGlideGetVersion(char *buf)
|
||||
{
|
||||
strcpy(buf,grGetString(GR_VERSION));
|
||||
BEGIN_BOARD_LOCK();
|
||||
strcpy(buf,grGetString(GR_VERSION));
|
||||
END_BOARD_LOCK();
|
||||
}
|
||||
|
||||
void FX_grSstPerfStats(GrSstPerfStats_t *st)
|
||||
@@ -154,74 +232,91 @@ void FX_grSstPerfStats(GrSstPerfStats_t *st)
|
||||
void FX_grAADrawLine(GrVertex *a,GrVertex *b)
|
||||
{
|
||||
/* ToDo */
|
||||
BEGIN_CLIP_LOOP();
|
||||
grDrawLine(a,b);
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
void FX_grAADrawPoint(GrVertex *a)
|
||||
{
|
||||
BEGIN_CLIP_LOOP();
|
||||
grDrawPoint(a);
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
#if FX_USE_PARGB
|
||||
void FX_setupGrVertexLayout(void)
|
||||
{
|
||||
grReset(GR_VERTEX_PARAMETER);
|
||||
BEGIN_BOARD_LOCK();
|
||||
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);
|
||||
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);
|
||||
END_BOARD_LOCK();
|
||||
}
|
||||
#else /* FX_USE_PARGB */
|
||||
void FX_setupGrVertexLayout(void)
|
||||
{
|
||||
grReset(GR_VERTEX_PARAMETER);
|
||||
BEGIN_BOARD_LOCK();
|
||||
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_Z, GR_VERTEX_Z_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);
|
||||
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);
|
||||
END_BOARD_LOCK();
|
||||
}
|
||||
#endif
|
||||
|
||||
void FX_grHints(GrHint_t hintType, FxU32 hintMask)
|
||||
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);
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
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(GrHint_t hintType, FxU32 hintMask) {
|
||||
BEGIN_BOARD_LOCK();
|
||||
FX_grHints_NoLock(hintType, hintMask);
|
||||
END_BOARD_LOCK();
|
||||
}
|
||||
|
||||
int FX_grSstQueryHardware(GrHwConfiguration *config)
|
||||
{
|
||||
int i,j;
|
||||
int numFB;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
grGet(GR_NUM_BOARDS,4,(void*)&(config->num_sst));
|
||||
if (config->num_sst == 0)
|
||||
return 0;
|
||||
@@ -246,9 +341,76 @@ int FX_grSstQueryHardware(GrHwConfiguration *config)
|
||||
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam /= 1024*1024;
|
||||
}
|
||||
}
|
||||
END_BOARD_LOCK();
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int FX_grSstScreenWidth()
|
||||
{
|
||||
int i;
|
||||
BEGIN_BOARD_LOCK();
|
||||
i = grSstScreenWidth();
|
||||
END_BOARD_LOCK();
|
||||
return i;
|
||||
}
|
||||
|
||||
int FX_grSstScreenHeight()
|
||||
{
|
||||
int i;
|
||||
BEGIN_BOARD_LOCK();
|
||||
i = grSstScreenHeight();
|
||||
END_BOARD_LOCK();
|
||||
return i;
|
||||
}
|
||||
|
||||
int FX_grSstQueryHardware(GrHwConfiguration *c)
|
||||
{
|
||||
int i;
|
||||
BEGIN_BOARD_LOCK();
|
||||
i = grSstQueryHardware(c);
|
||||
END_BOARD_LOCK();
|
||||
return i;
|
||||
}
|
||||
|
||||
FX_GrContext_t FX_grSstWinOpen( 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;
|
||||
BEGIN_BOARD_LOCK();
|
||||
i = grSstWinOpen( hWnd,
|
||||
screen_resolution,
|
||||
refresh_rate,
|
||||
color_format,
|
||||
origin_location,
|
||||
nColBuffers,
|
||||
nAuxBuffers );
|
||||
|
||||
#if 0
|
||||
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);
|
||||
#endif
|
||||
END_BOARD_LOCK();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
@@ -1,26 +1,48 @@
|
||||
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 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__
|
||||
|
||||
@@ -201,23 +223,23 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x, y; /* X and Y in screen space */
|
||||
float ooz; /* 65535/Z (used for Z-buffering) */
|
||||
float oow; /* 1/W (used for W-buffering, texturing) */
|
||||
float r, g, b, a; /* R, G, B, A [0..255.0] */
|
||||
float z; /* Z is ignored */
|
||||
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_OOZ_OFFSET 2
|
||||
#define GR_VERTEX_OOW_OFFSET 3
|
||||
#define GR_VERTEX_R_OFFSET 4
|
||||
#define GR_VERTEX_G_OFFSET 5
|
||||
#define GR_VERTEX_B_OFFSET 6
|
||||
#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_Z_OFFSET 8
|
||||
#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
|
||||
@@ -233,29 +255,89 @@ typedef struct
|
||||
* Glide2 functions for Glide3
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
#define FX_grTexDownloadTable(TMU,type,data) grTexDownloadTable(type,data)
|
||||
#define FX_grTexDownloadTable(TMU,type,data) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexDownloadTable(type,data); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0);
|
||||
#define FX_grTexDownloadTable_NoLock(TMU,type,data) \
|
||||
grTexDownloadTable(type, data)
|
||||
#else
|
||||
#define FX_grTexDownloadTable(TMU,type,data) grTexDownloadTable(TMU,type,data)
|
||||
#define FX_grTexDownloadTable(TMU,type,data) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexDownloadTable(TMU,type,data); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0);
|
||||
#define FX_grTexDownloadTable_NoLock grTexDownloadTable
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Flush
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
#define FX_grFlush grFlush
|
||||
#define FX_grFlush() \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grFlush(); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#else
|
||||
#define FX_grFlush grSstIdle
|
||||
#define FX_grFlush() \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grSstIdle(); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define FX_grFinish() \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grFinish(); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Write region: ToDo possible exploit the PixelPipe parameter.
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
||||
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data)
|
||||
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while(0)
|
||||
#else
|
||||
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
||||
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
|
||||
#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read region
|
||||
*/
|
||||
#define FX_grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0);
|
||||
|
||||
/*
|
||||
* Draw triangle
|
||||
*/
|
||||
#define FX_grDrawTriangle(a,b,c) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawTriangle(a,b,c); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* For Lod/LodLog2 conversion.
|
||||
*/
|
||||
@@ -288,12 +370,14 @@ typedef struct
|
||||
#else
|
||||
#define FX_largeLodValue(info) ((int)(info).largeLod)
|
||||
#endif
|
||||
#define FX_largeLodValue_NoLock FX_largeLodValue
|
||||
|
||||
#if defined(FX_GLIDE3)
|
||||
#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
|
||||
#else
|
||||
#define FX_smallLodValue(info) ((int)(info).smallLod)
|
||||
#endif
|
||||
#define FX_smallLodValue_NoLock FX_smallLodValue
|
||||
|
||||
#if defined(FX_GLIDE3)
|
||||
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
|
||||
@@ -304,13 +388,9 @@ typedef struct
|
||||
/*
|
||||
* ScreenWidth/Height stuff.
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
extern int FX_grSstScreenWidth();
|
||||
extern int FX_grSstScreenHeight();
|
||||
#else
|
||||
#define FX_grSstScreenWidth() grSstScreenWidth()
|
||||
#define FX_grSstScreenHeight() grSstScreenHeight()
|
||||
#endif
|
||||
extern int FX_grSstScreenWidth(void);
|
||||
extern int FX_grSstScreenHeight(void);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -319,7 +399,12 @@ typedef struct
|
||||
#if defined(FX_GLIDE3)
|
||||
extern void FX_grGlideGetVersion(char *buf);
|
||||
#else
|
||||
#define FX_grGlideGetVersion grGlideGetVersion
|
||||
#define FX_grGlideGetVersion(b) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grGlideGetVersion(b); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#endif
|
||||
/*
|
||||
* Performance statistics
|
||||
@@ -327,25 +412,33 @@ typedef struct
|
||||
#if defined(FX_GLIDE3)
|
||||
extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
|
||||
#else
|
||||
#define FX_grSstPerfStats grSstPerfStats
|
||||
#define FX_grSstPerfStats(s) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grSstPerfStats(s); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hardware Query
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
extern int FX_grSstQueryHardware(GrHwConfiguration *config);
|
||||
#else
|
||||
#define FX_grSstQueryHardware grSstQueryHardware
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GrHints
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
|
||||
extern void FX_grHints(GrHint_t hintType, FxU32 hintMask);
|
||||
#else
|
||||
#define FX_grHints grHints
|
||||
#define FX_grHints(t,m) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grHints(t, m); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while(0)
|
||||
#define FX_grHints_NoLock grHints
|
||||
#endif
|
||||
/*
|
||||
* Antialiashed line+point drawing.
|
||||
@@ -353,13 +446,23 @@ typedef struct
|
||||
#if defined(FX_GLIDE3)
|
||||
extern void FX_grAADrawLine(GrVertex *a,GrVertex *b);
|
||||
#else
|
||||
#define FX_grAADrawLine grAADrawLine
|
||||
#define FX_grAADrawLine(a,b) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grAADrawLine(a,b); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if defined(FX_GLIDE3)
|
||||
extern void FX_grAADrawPoint(GrVertex *a);
|
||||
#else
|
||||
#define FX_grAADrawPoint grAADrawPoint
|
||||
#define FX_grAADrawPoint(a) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grAADrawPoint(a); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -373,31 +476,345 @@ typedef struct
|
||||
/*
|
||||
* grSstControl stuff
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
extern void FX_grSstControl(int par);
|
||||
#else
|
||||
#define FX_grSstControl grSstControl
|
||||
#endif
|
||||
extern FxBool FX_grSstControl(FxU32 code);
|
||||
|
||||
/*
|
||||
* grGammaCorrectionValue
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
extern void FX_grGammaCorrectionValue(float val);
|
||||
#else
|
||||
#define FX_grGammaCorrectionValue grGammaCorrectionValue
|
||||
#define FX_grGammaCorrectionValue(v) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grGammaCorrectionValue(v) \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WinOpen/Close.
|
||||
*/
|
||||
#if defined(FX_GLIDE3)
|
||||
#define FX_grSstWinOpen(hWnd,screen_resolution,refresh_rate,color_format,origin_location,nColBuffers,nAuxBuffers) \
|
||||
grSstWinOpen(-1,screen_resolution,refresh_rate,color_format,origin_location,nColBuffers,nAuxBuffers)
|
||||
#define FX_grSstWinClose grSstWinClose
|
||||
#define FX_grSstWinClose(w) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grSstWinClose(w); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#else
|
||||
#define FX_grSstWinOpen grSstWinOpen
|
||||
#define FX_grSstWinClose(win) grSstWinClose()
|
||||
#define FX_grSstWinClose(w) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grSstWinClose(); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
extern FX_GrContext_t FX_grSstWinOpen( 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(v1, v2) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawLine(v1, v2); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDrawPoint(p) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawPoint(p); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDitherMode(m) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grDitherMode(m); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grRenderBuffer(b) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grRenderBuffer(b); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grBufferClear(c, a, d) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grBufferClear(c, a, d); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDepthMask(m) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grDepthMask(m); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grColorMask(c, a) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grColorMask(c, a); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
|
||||
GrLfbWriteMode_t writeMode,
|
||||
GrOriginLocation_t origin, FxBool pixelPipeline,
|
||||
GrLfbInfo_t *info );
|
||||
|
||||
#define FX_grLfbUnlock(t, b) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grLfbUnlock(t, b); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grConstantColorValue(v) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grConstantColorValue(v); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grConstantColorValue_NoLock grConstantColorValue
|
||||
|
||||
#define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grAADrawTriangle(a, b, c, ab, bc, ca); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grAlphaBlendFunction(rs, rd, as, ad) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grAlphaBlendFunction(rs, rd, as, ad); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grAlphaCombine(func, fact, loc, oth, inv) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grAlphaCombine(func, fact, loc, oth, inv); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grAlphaCombine_NoLock grAlphaCombine
|
||||
|
||||
#define FX_grAlphaTestFunction(f) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grAlphaTestFunction(f); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grAlphaTestReferenceValue(v) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grAlphaTestReferenceValue(v); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grClipWindow(minx, miny, maxx, maxy) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grClipWindow(minx, miny, maxx, maxy); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grClipWindow_NoLock grClipWindow
|
||||
|
||||
#define FX_grColorCombine(func, fact, loc, oth, inv) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grColorCombine(func, fact, loc, oth, inv); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grColorCombine_NoLock grColorCombine
|
||||
|
||||
#define FX_grCullMode(m) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grCullMode(m); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDepthBiasLevel(lev) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grDepthBiasLevel(lev); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDepthBufferFunction(func) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grDepthBufferFunction(func); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grFogColorValue(c) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grFogColorValue(c); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grFogMode(m) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grFogMode(m); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grFogTable(t) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grFogTable(t); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexClampMode(t, sc, tc) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexClampMode(t, sc, tc); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexClampMode_NoLock grTexClampMode
|
||||
|
||||
#define FX_grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexCombine_NoLock grTexCombine
|
||||
|
||||
#define FX_grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexDownloadMipMapLevel_NoLock grTexDownloadMipMapLevel
|
||||
|
||||
#define FX_grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexFilterMode(t, minf, magf) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexFilterMode(t, minf, magf); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexFilterMode_NoLock grTexFilterMode
|
||||
|
||||
extern FxU32 FX_grTexMinAddress(GrChipID_t tmu);
|
||||
extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu);
|
||||
|
||||
#define FX_grTexMipMapMode(t, m, lod) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexMipMapMode(t, m, lod); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexMipMapMode_NoLock grTexMipMapMode
|
||||
|
||||
#define FX_grTexSource(t, sa, eo, i) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grTexSource(t, sa, eo, i); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grTexSource_NoLock grTexSource
|
||||
|
||||
extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info);
|
||||
#define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired
|
||||
|
||||
#define FX_grGlideGetState(s) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grGlideGetState(s); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDRIBufferSwap(i) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grDRIBufferSwap(i); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grSstSelect(b) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grSstSelect(b); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grSstSelect_NoLock grSstSelect
|
||||
|
||||
#define FX_grGlideSetState(s) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grGlideSetState(s); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDepthBufferMode(m) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grDepthBufferMode(m); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grLfbWriteColorFormat(f) \
|
||||
do { \
|
||||
BEGIN_BOARD_LOCK(); \
|
||||
grLfbWriteColorFormat(f); \
|
||||
END_BOARD_LOCK(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDrawVertexArray(m, c, p) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawVertexArray(m, c, p); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grGlideShutdown() \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grGlideShutdown(); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grGlideInit_NoLock grGlideInit
|
||||
#define FX_grSstWinOpen_NoLock grSstWinOpen
|
||||
|
||||
extern int FX_getFogTableSize(void);
|
||||
extern int FX_getGrStateSize(void);
|
||||
|
||||
#endif /* __FX_GLIDE_WARPER__ */
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,25 +1,53 @@
|
||||
/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 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.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* fxwgl.c - Microsoft wgl functions emulation for
|
||||
* 3Dfx VooDoo/Mesa interface
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* See the file fxapi.c for more informations about authors
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
@@ -243,11 +271,11 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
|
||||
static int moving = 0;
|
||||
if (!moving) {
|
||||
if(fxQueryHardware()!=GR_SSTTYPE_VOODOO) {
|
||||
if(!grSstControl(GR_CONTROL_RESIZE)) {
|
||||
if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
|
||||
moving = 1;
|
||||
SetWindowPos(hwnd, 0, 0, 0, 300, 300, SWP_NOMOVE|SWP_NOZORDER);
|
||||
moving = 0;
|
||||
if(!grSstControl(GR_CONTROL_RESIZE)) {
|
||||
if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
|
||||
/*MessageBox(0,_T("Error changing windowsize"),_T("fxMESA"),MB_OK);*/
|
||||
PostMessage(hWND,WM_CLOSE,0,0);
|
||||
}
|
||||
@@ -255,7 +283,7 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
|
||||
}
|
||||
|
||||
/* Do the clipping in the glide library */
|
||||
grClipWindow(0,0,grSstScreenWidth(),grSstScreenHeight());
|
||||
FX_grClipWindow(0,0,FX_grSstScreenWidth(),FX_grSstScreenHeight());
|
||||
/* And let the new size set in the context */
|
||||
fxMesaUpdateScreenSize(ctx);
|
||||
}
|
||||
@@ -269,21 +297,22 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
|
||||
BOOL fMinimized = (BOOL) HIWORD(wParam);
|
||||
|
||||
if((fActive == WA_INACTIVE) || fMinimized)
|
||||
grSstControl(GR_CONTROL_DEACTIVATE);
|
||||
FX_grSstControl(GR_CONTROL_DEACTIVATE);
|
||||
else
|
||||
grSstControl(GR_CONTROL_ACTIVATE);
|
||||
FX_grSstControl(GR_CONTROL_ACTIVATE);
|
||||
}
|
||||
break;
|
||||
case WM_SHOWWINDOW:
|
||||
break;
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_SYSCHAR:
|
||||
if(gdiWindowHackEna && (VK_RETURN == wParam)) {
|
||||
if(gdiWindowHack) {
|
||||
gdiWindowHack = GL_FALSE;
|
||||
grSstControl(GR_CONTROL_ACTIVATE);
|
||||
FX_grSstControl(GR_CONTROL_ACTIVATE);
|
||||
} else {
|
||||
gdiWindowHack = GL_TRUE;
|
||||
grSstControl(GR_CONTROL_DEACTIVATE);
|
||||
FX_grSstControl(GR_CONTROL_DEACTIVATE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -382,7 +411,7 @@ HGLRC GLAPIENTRY wglCreateContext(HDC hdc)
|
||||
gdiWindowHack = GL_FALSE;
|
||||
else {
|
||||
gdiWindowHack = GL_TRUE;
|
||||
grSstControl(GR_CONTROL_DEACTIVATE);
|
||||
FX_grSstControl(GR_CONTROL_DEACTIVATE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -779,7 +808,7 @@ BOOL GLAPIENTRY wglSwapBuffers(HDC hdc)
|
||||
HDC hdcDIBSection = CreateCompatibleDC(hdcScreen);
|
||||
HBITMAP holdBitmap = (HBITMAP) SelectObject(hdcDIBSection, dibHBM);
|
||||
|
||||
grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
|
||||
FX_grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
|
||||
width, height,
|
||||
width * 2,
|
||||
dibSurfacePtr);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: fakeglx.c,v 1.13 1999/11/11 01:29:28 brianp Exp $ */
|
||||
/* $Id: fakeglx.c,v 1.12.2.4 1999/12/11 09:20:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -45,7 +45,16 @@
|
||||
|
||||
|
||||
|
||||
#include "glxheader.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include "GL/gl.h"
|
||||
#include "GL/xmesa.h"
|
||||
#include "context.h"
|
||||
#include "config.h"
|
||||
@@ -258,7 +267,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
||||
&& (v->gl_visual->StencilBits >= stencil_size || stencil_size == 0)
|
||||
&& (v->gl_visual->AccumBits >= accum_size || accum_size == 0)) {
|
||||
/* now either compare XVisualInfo pointers or visual IDs */
|
||||
if ((!comparePointers && v->vishandle->visualid == vinfo->visualid)
|
||||
if ((!comparePointers && v->visinfo->visualid == vinfo->visualid)
|
||||
|| (comparePointers && v->vishandle == vinfo)) {
|
||||
return v;
|
||||
}
|
||||
@@ -1047,7 +1056,6 @@ Bool Fake_glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx )
|
||||
{
|
||||
if (ctx && drawable) {
|
||||
XMesaBuffer buffer;
|
||||
XMesaContext xmctx = (XMesaContext) ctx;
|
||||
|
||||
if (drawable==MakeCurrent_PrevDrawable && ctx==MakeCurrent_PrevContext) {
|
||||
buffer = MakeCurrent_PrevBuffer;
|
||||
@@ -1057,7 +1065,7 @@ Bool Fake_glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx )
|
||||
}
|
||||
if (!buffer) {
|
||||
/* drawable must be a new window! */
|
||||
buffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, drawable, ctx );
|
||||
buffer = XMesaCreateWindowBuffer2( ctx->xm_visual, drawable, ctx );
|
||||
if (!buffer) {
|
||||
/* Out of memory, or context/drawable depth mismatch */
|
||||
return False;
|
||||
@@ -1422,10 +1430,10 @@ static const char *get_extensions( void )
|
||||
#ifdef FX
|
||||
const char *fx = getenv("MESA_GLX_FX");
|
||||
if (fx && fx[0] != 'd') {
|
||||
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_EXT_get_proc_address GLX_MESA_set_3dfx_mode";
|
||||
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address";
|
||||
}
|
||||
#endif
|
||||
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GL_EXT_get_proc_address";
|
||||
return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address";
|
||||
}
|
||||
|
||||
|
||||
@@ -1510,37 +1518,62 @@ GLboolean Fake_glXSet3DfxModeMESA( GLint mode )
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/*GLfunction Fake_glXGetProcAddress( const GLubyte *procName )*/
|
||||
void (*Fake_glXGetProcAddress( const GLubyte *procName ))()
|
||||
{
|
||||
typedef void (*GLfunction)();
|
||||
typedef void (*gl_function)();
|
||||
struct proc {
|
||||
const char *name;
|
||||
GLfunction address;
|
||||
gl_function address;
|
||||
};
|
||||
static struct proc procTable[] = {
|
||||
{ "glXGetProcAddressEXT", (GLfunction) glXGetProcAddressEXT },
|
||||
{ "glXCreateGLXPixmapMESA", (GLfunction) glXCreateGLXPixmapMESA },
|
||||
{ "glXReleaseBuffersMESA", (GLfunction) glXReleaseBuffersMESA },
|
||||
{ "glXCopySubBufferMESA", (GLfunction) glXCopySubBufferMESA },
|
||||
{ "glXSet3DfxModeMESA", (GLfunction) glXSet3DfxModeMESA },
|
||||
/* NOTE: GLX_SGI_video_sync not implemented in Mesa */
|
||||
/* GLX 1.0 functions */
|
||||
{ "glXChooseVisual", (gl_function) glXChooseVisual },
|
||||
{ "glXCopyContext", (gl_function) glXCopyContext },
|
||||
{ "glXCreateContext", (gl_function) glXCreateContext },
|
||||
{ "glXCreateGLXPixmap", (gl_function) glXCreateGLXPixmap },
|
||||
{ "glXDestroyContext", (gl_function) glXDestroyContext },
|
||||
{ "glXDestroyGLXPixmap", (gl_function) glXDestroyGLXPixmap },
|
||||
{ "glXGetConfig", (gl_function) glXGetConfig },
|
||||
{ "glXGetCurrentContext", (gl_function) glXGetCurrentContext },
|
||||
{ "glXGetCurrentDrawable", (gl_function) glXGetCurrentDrawable },
|
||||
{ "glXIsDirect", (gl_function) glXIsDirect },
|
||||
{ "glXMakeCurrent", (gl_function) glXMakeCurrent },
|
||||
{ "glXQueryExtension", (gl_function) glXQueryExtension },
|
||||
{ "glXQueryVersion", (gl_function) glXQueryVersion },
|
||||
{ "glXSwapBuffers", (gl_function) glXSwapBuffers },
|
||||
{ "glXUseXFont", (gl_function) glXUseXFont },
|
||||
{ "glXWaitGL", (gl_function) glXWaitGL },
|
||||
{ "glXWaitX", (gl_function) glXWaitX },
|
||||
|
||||
/* GLX 1.1 functions */
|
||||
{ "glXGetClientString", (gl_function) glXGetClientString },
|
||||
{ "glXQueryExtensionsString", (gl_function) glXQueryExtensionsString },
|
||||
{ "glXQueryServerString", (gl_function) glXQueryServerString },
|
||||
|
||||
/* Extensions */
|
||||
{ "glXGetProcAddressARB", (gl_function) glXGetProcAddressARB },
|
||||
{ "glXCreateGLXPixmapMESA", (gl_function) glXCreateGLXPixmapMESA },
|
||||
{ "glXReleaseBuffersMESA", (gl_function) glXReleaseBuffersMESA },
|
||||
{ "glXCopySubBufferMESA", (gl_function) glXCopySubBufferMESA },
|
||||
{ "glXSet3DfxModeMESA", (gl_function) glXSet3DfxModeMESA },
|
||||
{ "glXGetVideoSyncSGI", (gl_function) glXGetVideoSyncSGI },
|
||||
{ "glXWaitVideoSyncSGI", (gl_function) glXWaitVideoSyncSGI },
|
||||
|
||||
{ NULL, NULL } /* end of list token */
|
||||
};
|
||||
GLuint i;
|
||||
|
||||
/* First, look for core library functions */
|
||||
GLfunction f = (GLfunction) gl_get_proc_address(procName);
|
||||
gl_function f = (gl_function) gl_get_proc_address(procName);
|
||||
if (f)
|
||||
return f;
|
||||
|
||||
/* Second, look for GLX funtion */
|
||||
for (i = 0; procTable[i].address; i++) {
|
||||
if (strcmp((const char *) procName, procTable[i].name) == 0)
|
||||
return (GLfunction) procTable[i].address;
|
||||
return procTable[i].address;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: glxapi.c,v 1.4 1999/10/27 09:50:10 brianp Exp $ */
|
||||
/* $Id: glxapi.c,v 1.4.2.1 1999/12/10 13:45:39 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -419,8 +419,7 @@ GLboolean glXSet3DfxModeMESA( GLint mode )
|
||||
|
||||
|
||||
|
||||
#if 0 /* spec for this not finalized yet */
|
||||
void (*glXGetProcAddressEXT( const GLubyte *procName ))()
|
||||
void (*glXGetProcAddressARB( const GLubyte *procName ))()
|
||||
{
|
||||
#ifdef REALGLX
|
||||
return NULL;
|
||||
@@ -428,4 +427,4 @@ void (*glXGetProcAddressEXT( const GLubyte *procName ))()
|
||||
return Fake_glXGetProcAddress( procName );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: xfonts.c,v 1.3 1999/11/11 01:29:28 brianp Exp $ */
|
||||
/* $Id: xfonts.c,v 1.2.2.1 1999/12/12 17:03:07 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "GL/xmesa.h"
|
||||
#include "context.h"
|
||||
#include "fakeglx.h"
|
||||
#include "mem.h"
|
||||
#include "macros.h"
|
||||
#include "xmesaP.h"
|
||||
|
||||
/* Some debugging info. */
|
||||
@@ -338,7 +338,8 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase )
|
||||
width = ch->rbearing - ch->lbearing;
|
||||
height = ch->ascent + ch->descent;
|
||||
x0 = - ch->lbearing;
|
||||
y0 = ch->descent - 1;
|
||||
y0 = ch->descent - 0; /* XXX used to subtract 1 here */
|
||||
/* but that caused a conformace failure */
|
||||
dx = ch->width;
|
||||
dy = 0;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# $Id: Makefile.X11,v 1.7 1999/11/11 01:22:28 brianp Exp $
|
||||
# $Id: Makefile.X11,v 1.6.2.1 1999/11/16 15:25:50 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.3
|
||||
# Version: 3.1
|
||||
# Copyright (C) 1995-1999 Brian Paul
|
||||
|
||||
# Makefile for core library
|
||||
@@ -18,13 +18,13 @@ VPATH = RCS
|
||||
INCDIR = ../include
|
||||
LIBDIR = ../lib
|
||||
|
||||
|
||||
CORE_SOURCES = \
|
||||
glapi.c \
|
||||
glapinoop.c \
|
||||
accum.c \
|
||||
alpha.c \
|
||||
alphabuf.c \
|
||||
api1.c \
|
||||
api2.c \
|
||||
apiext.c \
|
||||
attrib.c \
|
||||
bbox.c \
|
||||
bitmap.c \
|
||||
@@ -37,7 +37,6 @@ CORE_SOURCES = \
|
||||
cva.c \
|
||||
debug_xform.c \
|
||||
depth.c \
|
||||
dispatch.c \
|
||||
dlist.c \
|
||||
drawpix.c \
|
||||
enable.c \
|
||||
@@ -50,19 +49,18 @@ CORE_SOURCES = \
|
||||
glmisc.c \
|
||||
hash.c \
|
||||
image.c \
|
||||
imaging.c \
|
||||
light.c \
|
||||
lines.c \
|
||||
logic.c \
|
||||
masking.c \
|
||||
matrix.c \
|
||||
mem.c \
|
||||
mmath.c \
|
||||
mthreads.c \
|
||||
pb.c \
|
||||
pixel.c \
|
||||
pipeline.c \
|
||||
points.c \
|
||||
pointers.c \
|
||||
polygon.c \
|
||||
quads.c \
|
||||
rastpos.c \
|
||||
@@ -222,7 +220,8 @@ X86/3dnow.o: X86/3dnow.c
|
||||
# @echo "Specify a target configuration"
|
||||
|
||||
clean:
|
||||
-rm *.o *~ */*.o */*~
|
||||
-rm *.o *~ */*.o */*~ *.lo *.la
|
||||
-rm -rf .libs
|
||||
|
||||
targets: $(LIBDIR)/$(GL_LIB)
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: accum.c,v 1.11 1999/11/11 01:22:25 brianp Exp $ */
|
||||
/* $Id: accum.c,v 1.10.2.1 1999/11/27 01:35:42 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -25,13 +25,22 @@
|
||||
*/
|
||||
|
||||
|
||||
/* $XFree86: xc/lib/GL/mesa/src/accum.c,v 1.3 1999/04/04 00:20:17 dawes Exp $ */
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "accum.h"
|
||||
#include "context.h"
|
||||
#include "mem.h"
|
||||
#include "macros.h"
|
||||
#include "masking.h"
|
||||
#include "span.h"
|
||||
#include "types.h"
|
||||
@@ -92,10 +101,9 @@ void gl_alloc_accum_buffer( GLcontext *ctx )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
|
||||
void gl_ClearAccum( GLcontext *ctx,
|
||||
GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum");
|
||||
|
||||
ctx->Accum.ClearColor[0] = CLAMP( red, -1.0, 1.0 );
|
||||
@@ -131,10 +139,8 @@ static void rescale_accum( GLcontext *ctx )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_Accum( GLenum op, GLfloat value )
|
||||
void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint xpos, ypos, width, height, width4;
|
||||
GLfloat acc_scale;
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
@@ -338,7 +344,7 @@ _mesa_Accum( GLenum op, GLfloat value )
|
||||
static GLchan multTable[32768];
|
||||
static GLfloat prevMult = 0.0;
|
||||
GLuint j;
|
||||
const GLint max = 256 / mult;
|
||||
const GLint max = (GLint) (256 / mult);
|
||||
if (mult != prevMult) {
|
||||
assert(max <= 32768);
|
||||
for (j = 0; j < max; j++)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: attrib.c,v 1.11 1999/11/11 01:22:25 brianp Exp $ */
|
||||
/* $Id: attrib.c,v 1.10.2.3 1999/12/12 18:30:47 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -25,16 +25,23 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "attrib.h"
|
||||
#include "context.h"
|
||||
#include "glmisc.h"
|
||||
#include "enable.h"
|
||||
#include "enums.h"
|
||||
#include "mem.h"
|
||||
#include "macros.h"
|
||||
#include "simple_list.h"
|
||||
#include "texstate.h"
|
||||
#include "types.h"
|
||||
@@ -85,7 +92,11 @@ static void copy_texobj_state( struct gl_texture_object *dest,
|
||||
dest->P = src->P;
|
||||
dest->M = src->M;
|
||||
dest->MinMagThresh = src->MinMagThresh;
|
||||
dest->Palette = src->Palette;
|
||||
memcpy( dest->Palette, src->Palette,
|
||||
sizeof(GLubyte) * MAX_TEXTURE_PALETTE_SIZE * 4 );
|
||||
dest->PaletteSize = src->PaletteSize;
|
||||
dest->PaletteIntFormat = src->PaletteIntFormat;
|
||||
dest->PaletteFormat = src->PaletteFormat;
|
||||
dest->Complete = src->Complete;
|
||||
dest->SampleFunc = src->SampleFunc;
|
||||
}
|
||||
@@ -417,10 +428,11 @@ void gl_PopAttrib( GLcontext* ctx )
|
||||
GLubyte oldAlphaRef = ctx->Color.AlphaRef;
|
||||
GLenum oldBlendSrc = ctx->Color.BlendSrcRGB;
|
||||
GLenum oldBlendDst = ctx->Color.BlendDstRGB;
|
||||
GLenum oldLogicOp = ctx->Color.LogicOp;
|
||||
MEMCPY( &ctx->Color, attr->data,
|
||||
sizeof(struct gl_colorbuffer_attrib) );
|
||||
if (ctx->Color.DrawBuffer != oldDrawBuffer) {
|
||||
_mesa_DrawBuffer( ctx->Color.DrawBuffer);
|
||||
gl_DrawBuffer(ctx, ctx->Color.DrawBuffer);
|
||||
}
|
||||
if ((ctx->Color.AlphaFunc != oldAlphaFunc ||
|
||||
ctx->Color.AlphaRef != oldAlphaRef) &&
|
||||
@@ -432,6 +444,9 @@ void gl_PopAttrib( GLcontext* ctx )
|
||||
ctx->Driver.BlendFunc)
|
||||
(*ctx->Driver.BlendFunc)( ctx, ctx->Color.BlendSrcRGB,
|
||||
ctx->Color.BlendDstRGB);
|
||||
if (ctx->Color.LogicOp != oldLogicOp &&
|
||||
ctx->Driver.LogicOpcode)
|
||||
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
|
||||
}
|
||||
break;
|
||||
case GL_CURRENT_BIT:
|
||||
@@ -460,7 +475,7 @@ void gl_PopAttrib( GLcontext* ctx )
|
||||
|
||||
#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \
|
||||
if ((VALUE) != (NEWVALUE)) { \
|
||||
_mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \
|
||||
gl_set_enable( ctx, ENUM, (NEWVALUE) ); \
|
||||
}
|
||||
|
||||
TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
|
||||
@@ -470,7 +485,7 @@ void gl_PopAttrib( GLcontext* ctx )
|
||||
GLuint i;
|
||||
for (i=0;i<MAX_CLIP_PLANES;i++) {
|
||||
if (ctx->Transform.ClipEnabled[i] != enable->ClipPlane[i])
|
||||
_mesa_set_enable( ctx, (GLenum) (GL_CLIP_PLANE0 + i), enable->ClipPlane[i] );
|
||||
gl_set_enable( ctx, (GLenum) (GL_CLIP_PLANE0 + i), enable->ClipPlane[i] );
|
||||
}
|
||||
}
|
||||
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, GL_COLOR_MATERIAL);
|
||||
@@ -585,7 +600,7 @@ void gl_PopAttrib( GLcontext* ctx )
|
||||
(*ctx->Driver.Fogfv)( ctx, GL_FOG_INDEX, &index );
|
||||
(*ctx->Driver.Fogfv)( ctx, GL_FOG_COLOR, ctx->Fog.Color );
|
||||
}
|
||||
ctx->Enabled &= ENABLE_FOG;
|
||||
ctx->Enabled &= ~ENABLE_FOG;
|
||||
if (ctx->Fog.Enabled) ctx->Enabled |= ENABLE_FOG;
|
||||
}
|
||||
break;
|
||||
@@ -613,7 +628,13 @@ void gl_PopAttrib( GLcontext* ctx )
|
||||
}
|
||||
(*ctx->Driver.Enable)( ctx, GL_LIGHTING, ctx->Light.Enabled );
|
||||
}
|
||||
ctx->Enabled &= ENABLE_LIGHT;
|
||||
if (ctx->Light.ShadeModel == GL_FLAT)
|
||||
ctx->TriangleCaps |= DD_FLATSHADE;
|
||||
else
|
||||
ctx->TriangleCaps &= ~DD_FLATSHADE;
|
||||
if (ctx->Driver.ShadeModel)
|
||||
(*ctx->Driver.ShadeModel)(ctx, ctx->Light.ShadeModel);
|
||||
ctx->Enabled &= ~ENABLE_LIGHT;
|
||||
if (ctx->Light.Enabled && !is_empty_list(&ctx->Light.EnabledList))
|
||||
ctx->Enabled |= ENABLE_LIGHT;
|
||||
break;
|
||||
@@ -731,8 +752,8 @@ void gl_PopAttrib( GLcontext* ctx )
|
||||
struct gl_viewport_attrib *v =
|
||||
(struct gl_viewport_attrib *)attr->data;
|
||||
|
||||
_mesa_Viewport( v->X, v->Y, v->Width, v->Height );
|
||||
_mesa_DepthRange( v->Near, v->Far );
|
||||
gl_Viewport( ctx, v->X, v->Y, v->Width, v->Height );
|
||||
gl_DepthRange( ctx, v->Near, v->Far );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -846,37 +867,3 @@ void gl_PopClientAttrib( GLcontext *ctx )
|
||||
ctx->NewState = NEW_ALL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_PushAttrib( GLbitfield mask )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
gl_PushAttrib(ctx, mask);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_PopAttrib( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
gl_PopAttrib(ctx);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_PushClientAttrib( GLbitfield mask )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
gl_PushClientAttrib(ctx, mask);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_PopClientAttrib( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
gl_PopClientAttrib(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: clip.c,v 1.5 1999/11/11 01:22:25 brianp Exp $ */
|
||||
/* $Id: clip.c,v 1.4.2.1 1999/11/25 16:51:24 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,10 +25,19 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "clip.h"
|
||||
#include "context.h"
|
||||
#include "macros.h"
|
||||
@@ -42,6 +51,15 @@
|
||||
|
||||
|
||||
|
||||
#define CLIP_RGBA0 0x1
|
||||
#define CLIP_RGBA1 0x2
|
||||
#define CLIP_TEX0 0x4
|
||||
#define CLIP_TEX1 0x8
|
||||
#define CLIP_INDEX0 0x10
|
||||
#define CLIP_INDEX1 0x20
|
||||
#define CLIP_FOG_COORD 0x40
|
||||
|
||||
|
||||
/* Linear interpolation between A and B: */
|
||||
#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) )
|
||||
|
||||
@@ -58,16 +76,7 @@ do { \
|
||||
} while(0)
|
||||
|
||||
|
||||
|
||||
|
||||
#define CLIP_RGBA0 0x1
|
||||
#define CLIP_RGBA1 0x2
|
||||
#define CLIP_TEX0 0x4
|
||||
#define CLIP_TEX1 0x8
|
||||
#define CLIP_INDEX0 0x10
|
||||
#define CLIP_INDEX1 0x20
|
||||
|
||||
static clip_interp_func clip_interp_tab[0x40];
|
||||
static clip_interp_func clip_interp_tab[0x80];
|
||||
|
||||
#define IND 0
|
||||
#define NAME clip_nil
|
||||
@@ -113,6 +122,50 @@ static clip_interp_func clip_interp_tab[0x40];
|
||||
#define NAME clipINDEX0_INDEX1
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_FOG_COORD)
|
||||
#define NAME clip_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_RGBA0|CLIP_FOG_COORD)
|
||||
#define NAME clipRGBA0_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
|
||||
#define NAME clipRGBA0_RGBA1_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
|
||||
#define NAME clipTEX0_RGBA0_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
|
||||
#define NAME clipTEX0_RGBA0_RGBA1_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
|
||||
#define NAME clipTEX1_TEX0_RGBA0_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_TEX0|CLIP_FOG_COORD)
|
||||
#define NAME clipTEX0_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD)
|
||||
#define NAME clipTEX1_TEX0_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
|
||||
#define NAME clipTEX1_TEX0_RGBA0_RGBA1_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_INDEX0|CLIP_FOG_COORD)
|
||||
#define NAME clipINDEX0_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
#define IND (CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD)
|
||||
#define NAME clipINDEX0_INDEX1_FOG
|
||||
#include "interp_tmp.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -122,17 +175,9 @@ static clip_interp_func clip_interp_tab[0x40];
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_ClipPlane( GLenum plane, const GLdouble *eq )
|
||||
void gl_ClipPlane( GLcontext* ctx, GLenum plane, const GLfloat *equation )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint p;
|
||||
GLfloat equation[4];
|
||||
|
||||
equation[0] = eq[0];
|
||||
equation[1] = eq[1];
|
||||
equation[2] = eq[2];
|
||||
equation[3] = eq[3];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane");
|
||||
|
||||
@@ -183,10 +228,8 @@ void gl_update_userclip( GLcontext *ctx )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_GetClipPlane( GLenum plane, GLdouble *equation )
|
||||
void gl_GetClipPlane( GLcontext* ctx, GLenum plane, GLdouble *equation )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint p;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetClipPlane");
|
||||
@@ -353,6 +396,8 @@ void gl_update_clipmask( GLcontext *ctx )
|
||||
mask |= CLIP_INDEX1;
|
||||
}
|
||||
|
||||
if (ctx->FogMode == FOG_FRAGMENT && (ctx->TriangleCaps & DD_CLIP_FOG_COORD))
|
||||
mask |= CLIP_FOG_COORD;
|
||||
|
||||
ctx->ClipInterpFunc = clip_interp_tab[mask];
|
||||
ctx->poly_clip_tab = gl_poly_clip_tab[0];
|
||||
@@ -448,11 +493,22 @@ void gl_init_clip(void)
|
||||
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0] = clipTEX1_TEX0_RGBA0;
|
||||
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1] =
|
||||
clipTEX1_TEX0_RGBA0_RGBA1;
|
||||
|
||||
clip_interp_tab[CLIP_TEX0] = clipTEX0;
|
||||
clip_interp_tab[CLIP_TEX1|CLIP_TEX0] = clipTEX1_TEX0;
|
||||
|
||||
clip_interp_tab[CLIP_INDEX0] = clipINDEX0;
|
||||
clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1] = clipINDEX0_INDEX1;
|
||||
|
||||
clip_interp_tab[CLIP_FOG_COORD] = clip_FOG;
|
||||
clip_interp_tab[CLIP_RGBA0|CLIP_FOG_COORD] = clipRGBA0_FOG;
|
||||
clip_interp_tab[CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipRGBA0_RGBA1_FOG;
|
||||
clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX0_RGBA0_FOG;
|
||||
clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipTEX0_RGBA0_RGBA1_FOG;
|
||||
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX1_TEX0_RGBA0_FOG;
|
||||
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] =
|
||||
clipTEX1_TEX0_RGBA0_RGBA1_FOG;
|
||||
clip_interp_tab[CLIP_TEX0|CLIP_FOG_COORD] = clipTEX0_FOG;
|
||||
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD] = clipTEX1_TEX0_FOG;
|
||||
clip_interp_tab[CLIP_INDEX0|CLIP_FOG_COORD] = clipINDEX0_FOG;
|
||||
clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD] = clipINDEX0_INDEX1_FOG;
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: context.c,v 1.19 1999/11/11 01:22:25 brianp Exp $ */
|
||||
/* $Id: context.c,v 1.18.2.6 1999/12/04 21:13:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,6 +25,8 @@
|
||||
*/
|
||||
|
||||
|
||||
/* $XFree86: xc/lib/GL/mesa/src/context.c,v 1.4 1999/04/04 00:20:21 dawes Exp $ */
|
||||
|
||||
/*
|
||||
* If multi-threading is enabled (-DTHREADS) then each thread has it's
|
||||
* own rendering context. A thread obtains the pointer to its GLcontext
|
||||
@@ -34,34 +36,43 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "accum.h"
|
||||
#include "alphabuf.h"
|
||||
#include "api.h"
|
||||
#include "clip.h"
|
||||
#include "context.h"
|
||||
#include "cva.h"
|
||||
#include "depth.h"
|
||||
#include "dispatch.h"
|
||||
#include "dlist.h"
|
||||
#include "eval.h"
|
||||
#include "enums.h"
|
||||
#include "extensions.h"
|
||||
#include "fog.h"
|
||||
#include "glapi.h"
|
||||
#include "get.h"
|
||||
#include "hash.h"
|
||||
#include "light.h"
|
||||
#include "lines.h"
|
||||
#include "dlist.h"
|
||||
#include "macros.h"
|
||||
#include "matrix.h"
|
||||
#include "mem.h"
|
||||
#include "mmath.h"
|
||||
#include "pb.h"
|
||||
#include "pipeline.h"
|
||||
#include "points.h"
|
||||
#include "pointers.h"
|
||||
#include "quads.h"
|
||||
#include "shade.h"
|
||||
#include "simple_list.h"
|
||||
@@ -85,6 +96,40 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Memory allocation functions. Called via the MALLOC, CALLOC and
|
||||
* FREE macros when DEBUG symbol is defined.
|
||||
* You might want to set breakpoints on these functions or plug in
|
||||
* other memory allocation functions. The Mesa sources should only
|
||||
* use the MALLOC and FREE macros (which could also be overriden).
|
||||
*
|
||||
* XXX these functions should probably go into a new glmemory.c file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Allocate memory (uninitialized)
|
||||
*/
|
||||
void *gl_malloc(size_t bytes)
|
||||
{
|
||||
return malloc(bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate memory and initialize to zero.
|
||||
*/
|
||||
void *gl_calloc(size_t bytes)
|
||||
{
|
||||
return calloc(1, bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free memory
|
||||
*/
|
||||
void gl_free(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** Context and Thread management *****/
|
||||
@@ -113,7 +158,7 @@ static void set_thread_context( GLcontext *ctx ) {
|
||||
#else
|
||||
|
||||
/* One Current Context pointer for all threads in the address space */
|
||||
GLcontext *_mesa_current_context = NULL;
|
||||
GLcontext *CC = NULL;
|
||||
struct immediate *CURRENT_INPUT = NULL;
|
||||
|
||||
#endif /*THREADS*/
|
||||
@@ -534,6 +579,7 @@ static void init_1d_map( struct gl_1d_map *map, int n, const float *initial )
|
||||
for (i=0;i<n;i++)
|
||||
map->Points[i] = initial[i];
|
||||
}
|
||||
map->Retain = GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -552,20 +598,10 @@ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial )
|
||||
for (i=0;i<n;i++)
|
||||
map->Points[i] = initial[i];
|
||||
}
|
||||
map->Retain = GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void init_palette( struct gl_palette *p )
|
||||
{
|
||||
p->Table[0] = 255;
|
||||
p->Table[1] = 255;
|
||||
p->Table[2] = 255;
|
||||
p->Table[3] = 255;
|
||||
p->Size = 1;
|
||||
p->IntFormat = GL_RGBA;
|
||||
p->Format = GL_RGBA;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a gl_context structure to default values.
|
||||
@@ -882,9 +918,9 @@ static void initialize_context( GLcontext *ctx )
|
||||
ctx->Stencil.ZPassFunc = GL_KEEP;
|
||||
ctx->Stencil.ZFailFunc = GL_KEEP;
|
||||
ctx->Stencil.Ref = 0;
|
||||
ctx->Stencil.ValueMask = 0xff;
|
||||
ctx->Stencil.ValueMask = STENCIL_MAX;
|
||||
ctx->Stencil.Clear = 0;
|
||||
ctx->Stencil.WriteMask = 0xff;
|
||||
ctx->Stencil.WriteMask = STENCIL_MAX;
|
||||
|
||||
/* Texture group */
|
||||
ctx->Texture.CurrentUnit = 0; /* multitexture */
|
||||
@@ -894,7 +930,14 @@ static void initialize_context( GLcontext *ctx )
|
||||
for (i=0; i<MAX_TEXTURE_UNITS; i++)
|
||||
init_texture_unit( ctx, i );
|
||||
|
||||
init_palette(&ctx->Texture.Palette);
|
||||
ctx->Texture.SharedPalette = GL_FALSE;
|
||||
ctx->Texture.Palette[0] = 255;
|
||||
ctx->Texture.Palette[1] = 255;
|
||||
ctx->Texture.Palette[2] = 255;
|
||||
ctx->Texture.Palette[3] = 255;
|
||||
ctx->Texture.PaletteSize = 1;
|
||||
ctx->Texture.PaletteIntFormat = GL_RGBA;
|
||||
ctx->Texture.PaletteFormat = GL_RGBA;
|
||||
|
||||
/* Transformation group */
|
||||
ctx->Transform.MatrixMode = GL_MODELVIEW;
|
||||
@@ -1028,6 +1071,7 @@ static void initialize_context( GLcontext *ctx )
|
||||
|
||||
/* For debug/development only */
|
||||
ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
|
||||
ctx->FirstTimeCurrent = GL_TRUE;
|
||||
|
||||
/* Dither disable */
|
||||
ctx->NoDither = getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
|
||||
@@ -1289,10 +1333,12 @@ GLcontext *gl_create_context( GLvisual *visual,
|
||||
ctx->Driver.ReadDepthSpanFloat = gl_read_depth_span_float;
|
||||
ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int;
|
||||
|
||||
|
||||
#ifdef PROFILE
|
||||
init_timings( ctx );
|
||||
#endif
|
||||
|
||||
#ifdef GL_VERSION_1_1
|
||||
if (!alloc_proxy_textures(ctx)) {
|
||||
free_shared_state(ctx, ctx->Shared);
|
||||
FREE(ctx->VB);
|
||||
@@ -1300,11 +1346,10 @@ GLcontext *gl_create_context( GLvisual *visual,
|
||||
FREE(ctx);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* setup API dispatch tables */
|
||||
_mesa_init_exec_table( &ctx->Exec );
|
||||
_mesa_init_dlist_table( &ctx->Save );
|
||||
ctx->CurrentDispatch = &ctx->Exec;
|
||||
gl_init_api_function_pointers( ctx );
|
||||
ctx->API = ctx->Exec; /* GL_EXECUTE is default */
|
||||
|
||||
return ctx;
|
||||
}
|
||||
@@ -1418,8 +1463,8 @@ void gl_destroy_context( GLcontext *ctx )
|
||||
FREE( (void *) ctx );
|
||||
|
||||
#ifndef THREADS
|
||||
if (ctx == _mesa_current_context) {
|
||||
_mesa_current_context = NULL;
|
||||
if (ctx==CC) {
|
||||
CC = NULL;
|
||||
CURRENT_INPUT = NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -1488,42 +1533,52 @@ void gl_destroy_framebuffer( GLframebuffer *buffer )
|
||||
/*
|
||||
* Set the current context, binding the given frame buffer to the context.
|
||||
*/
|
||||
void gl_make_current( GLcontext *newCtx, GLframebuffer *buffer )
|
||||
void gl_make_current( GLcontext *ctx, GLframebuffer *buffer )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(oldCtx);
|
||||
GET_CONTEXT;
|
||||
|
||||
/* Flush the old context
|
||||
*/
|
||||
if (oldCtx) {
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(oldCtx, "gl_make_current");
|
||||
if (CC) {
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(CC, "gl_make_current");
|
||||
}
|
||||
|
||||
#ifdef THREADS
|
||||
/* TODO: unbind old buffer from context? */
|
||||
set_thread_context( newCtx );
|
||||
set_thread_context( ctx );
|
||||
#else
|
||||
if (oldCtx && oldCtx->Buffer) {
|
||||
if (CC && CC->Buffer) {
|
||||
/* unbind frame buffer from context */
|
||||
oldCtx->Buffer = NULL;
|
||||
CC->Buffer = NULL;
|
||||
}
|
||||
_mesa_current_context = newCtx;
|
||||
if (newCtx) {
|
||||
SET_IMMEDIATE(newCtx, newCtx->input);
|
||||
CC = ctx;
|
||||
if (ctx) {
|
||||
SET_IMMEDIATE(ctx, ctx->input);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (newCtx)
|
||||
_glapi_set_dispatch(newCtx->CurrentDispatch);
|
||||
else
|
||||
_glapi_set_dispatch(NULL); /* none current */
|
||||
|
||||
if (MESA_VERBOSE) fprintf(stderr, "gl_make_current()\n");
|
||||
|
||||
if (newCtx && buffer) {
|
||||
/* TODO: check if newCtx and buffer's visual match??? */
|
||||
newCtx->Buffer = buffer; /* Bind the frame buffer to the context */
|
||||
newCtx->NewState = NEW_ALL; /* just to be safe */
|
||||
gl_update_state( newCtx );
|
||||
if (ctx && buffer) {
|
||||
/* TODO: check if ctx and buffer's visual match??? */
|
||||
ctx->Buffer = buffer; /* Bind the frame buffer to the context */
|
||||
ctx->NewState = NEW_ALL; /* just to be safe */
|
||||
gl_update_state( ctx );
|
||||
}
|
||||
|
||||
/* We can use this to help debug user's problems. Tell the to set
|
||||
* the MESA_INFO env variable before running their app. Then the
|
||||
* first time each context is made current we'll print some useful
|
||||
* information.
|
||||
*/
|
||||
if (ctx && ctx->FirstTimeCurrent) {
|
||||
if (getenv("MESA_INFO")) {
|
||||
fprintf(stderr, "Mesa GL_VERSION = %s\n", (char *) gl_GetString(ctx, GL_VERSION));
|
||||
fprintf(stderr, "Mesa GL_RENDERER = %s\n", (char *) gl_GetString(ctx, GL_RENDERER));
|
||||
fprintf(stderr, "Mesa GL_VENDOR = %s\n", (char *) gl_GetString(ctx, GL_VENDOR));
|
||||
fprintf(stderr, "Mesa GL_EXTENSIONS = %s\n", (char *) gl_GetString(ctx, GL_EXTENSIONS));
|
||||
}
|
||||
ctx->FirstTimeCurrent = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1536,7 +1591,7 @@ GLcontext *gl_get_current_context( void )
|
||||
#ifdef THREADS
|
||||
return gl_get_thread_context();
|
||||
#else
|
||||
return _mesa_current_context;
|
||||
return CC;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1620,73 +1675,26 @@ void gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This should be called by device drivers just before they do a
|
||||
* swapbuffers. Any pending rendering commands will be executed.
|
||||
*/
|
||||
void
|
||||
_mesa_swapbuffers(GLcontext *ctx)
|
||||
{
|
||||
FLUSH_VB( ctx, "swap buffers" );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return pointer to this context's current API dispatch table.
|
||||
* It'll either be the immediate-mode execute dispatcher or the
|
||||
* display list compile dispatcher.
|
||||
* Someday a GLS library or OpenGL-like debugger may call this function
|
||||
* to register it's own set of API entry points.
|
||||
* Input: ctx - the context to set API pointers for
|
||||
* api - if NULL, restore original API pointers
|
||||
* else, set API function table to this table.
|
||||
*/
|
||||
struct _glapi_table *
|
||||
_mesa_get_dispatch(GLcontext *ctx)
|
||||
void gl_set_api_table( GLcontext *ctx, const struct gl_api_table *api )
|
||||
{
|
||||
return ctx->CurrentDispatch;
|
||||
if (api) {
|
||||
MEMCPY( &ctx->API, api, sizeof(struct gl_api_table) );
|
||||
}
|
||||
else {
|
||||
MEMCPY( &ctx->API, &ctx->Exec, sizeof(struct gl_api_table) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_ResizeBuffersMESA( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
GLuint buf_width, buf_height;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glResizeBuffersMESA\n");
|
||||
|
||||
/* ask device driver for size of output buffer */
|
||||
(*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );
|
||||
|
||||
/* see if size of device driver's color buffer (window) has changed */
|
||||
if (ctx->Buffer->Width == (GLint) buf_width &&
|
||||
ctx->Buffer->Height == (GLint) buf_height)
|
||||
return;
|
||||
|
||||
ctx->NewState |= NEW_RASTER_OPS; /* to update scissor / window bounds */
|
||||
|
||||
/* save buffer size */
|
||||
ctx->Buffer->Width = buf_width;
|
||||
ctx->Buffer->Height = buf_height;
|
||||
|
||||
/* Reallocate other buffers if needed. */
|
||||
if (ctx->Visual->DepthBits>0) {
|
||||
/* reallocate depth buffer */
|
||||
(*ctx->Driver.AllocDepthBuffer)( ctx );
|
||||
}
|
||||
if (ctx->Visual->StencilBits>0) {
|
||||
/* reallocate stencil buffer */
|
||||
gl_alloc_stencil_buffer( ctx );
|
||||
}
|
||||
if (ctx->Visual->AccumBits>0) {
|
||||
/* reallocate accum buffer */
|
||||
gl_alloc_accum_buffer( ctx );
|
||||
}
|
||||
if (ctx->Visual->SoftwareAlpha) {
|
||||
gl_alloc_alpha_buffers( ctx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** Miscellaneous functions *****/
|
||||
@@ -1809,6 +1817,66 @@ void gl_error( GLcontext *ctx, GLenum error, const char *s )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Execute a glGetError command
|
||||
*/
|
||||
GLenum gl_GetError( GLcontext *ctx )
|
||||
{
|
||||
GLenum e = ctx->ErrorValue;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, "glGetError", (GLenum) 0);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glGetError <-- %s\n", gl_lookup_enum_by_nr(e));
|
||||
|
||||
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void gl_ResizeBuffersMESA( GLcontext *ctx )
|
||||
{
|
||||
GLuint buf_width, buf_height;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glResizeBuffersMESA\n");
|
||||
|
||||
/* ask device driver for size of output buffer */
|
||||
(*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );
|
||||
|
||||
/* see if size of device driver's color buffer (window) has changed */
|
||||
if (ctx->Buffer->Width == (GLint) buf_width &&
|
||||
ctx->Buffer->Height == (GLint) buf_height)
|
||||
return;
|
||||
|
||||
ctx->NewState |= NEW_RASTER_OPS; /* to update scissor / window bounds */
|
||||
|
||||
/* save buffer size */
|
||||
ctx->Buffer->Width = buf_width;
|
||||
ctx->Buffer->Height = buf_height;
|
||||
|
||||
/* Reallocate other buffers if needed. */
|
||||
if (ctx->Visual->DepthBits>0) {
|
||||
/* reallocate depth buffer */
|
||||
(*ctx->Driver.AllocDepthBuffer)( ctx );
|
||||
}
|
||||
if (ctx->Visual->StencilBits>0) {
|
||||
/* reallocate stencil buffer */
|
||||
gl_alloc_stencil_buffer( ctx );
|
||||
}
|
||||
if (ctx->Visual->AccumBits>0) {
|
||||
/* reallocate accum buffer */
|
||||
gl_alloc_accum_buffer( ctx );
|
||||
}
|
||||
if (ctx->Visual->SoftwareAlpha) {
|
||||
gl_alloc_alpha_buffers( ctx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** State update logic *****/
|
||||
/**********************************************************************/
|
||||
@@ -1925,21 +1993,17 @@ static void update_pixel_masking( GLcontext *ctx )
|
||||
static void update_fog_mode( GLcontext *ctx )
|
||||
{
|
||||
int old_mode = ctx->FogMode;
|
||||
ctx->FogMode = FOG_NONE;
|
||||
|
||||
if (ctx->Fog.Enabled) {
|
||||
if (ctx->Texture.Enabled)
|
||||
ctx->FogMode = FOG_FRAGMENT;
|
||||
else if (ctx->Hint.Fog == GL_NICEST)
|
||||
ctx->FogMode = FOG_FRAGMENT;
|
||||
else
|
||||
ctx->FogMode = FOG_VERTEX;
|
||||
ctx->FogMode = FOG_VERTEX;
|
||||
|
||||
if (ctx->Driver.GetParameteri)
|
||||
if ((ctx->Driver.GetParameteri)( ctx, DD_HAVE_HARDWARE_FOG ))
|
||||
ctx->FogMode = FOG_FRAGMENT;
|
||||
}
|
||||
else {
|
||||
ctx->FogMode = FOG_NONE;
|
||||
if (ctx->Texture.Enabled || ctx->Hint.Fog == GL_NICEST)
|
||||
ctx->FogMode = FOG_FRAGMENT;
|
||||
|
||||
if ( ctx->Driver.GetParameteri &&
|
||||
ctx->Driver.GetParameteri( ctx, DD_HAVE_HARDWARE_FOG ) )
|
||||
ctx->FogMode = FOG_FRAGMENT;
|
||||
}
|
||||
|
||||
if (old_mode != ctx->FogMode)
|
||||
@@ -2078,14 +2142,6 @@ void gl_update_state( GLcontext *ctx )
|
||||
ctx->Texture.Unit[1].LastEnvMode = ctx->Texture.Unit[1].EnvMode;
|
||||
}
|
||||
|
||||
if ((ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE)) == 0) {
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_STATE)
|
||||
fprintf(stderr, "update_state: goto finished\n");
|
||||
|
||||
goto finished;
|
||||
}
|
||||
|
||||
if (ctx->NewState & NEW_TEXTURE_MATRIX) {
|
||||
ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
|
||||
|
||||
@@ -2102,7 +2158,7 @@ void gl_update_state( GLcontext *ctx )
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->NewState & NEW_TEXTURING) {
|
||||
if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) {
|
||||
ctx->Texture.NeedNormals = GL_FALSE;
|
||||
gl_update_dirty_texobjs(ctx);
|
||||
ctx->Enabled &= ~(ENABLE_TEXGEN0|ENABLE_TEXGEN1);
|
||||
@@ -2264,7 +2320,7 @@ void gl_update_state( GLcontext *ctx )
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE|
|
||||
if (ctx->NewState & ~(NEW_CLIENT_STATE|
|
||||
NEW_DRIVER_STATE|NEW_USER_CLIP|
|
||||
NEW_POLYGON))
|
||||
gl_update_clipmask(ctx);
|
||||
@@ -2272,6 +2328,7 @@ void gl_update_state( GLcontext *ctx )
|
||||
if (ctx->NewState & (NEW_LIGHTING|
|
||||
NEW_RASTER_OPS|
|
||||
NEW_TEXTURING|
|
||||
NEW_TEXTURE_ENABLE|
|
||||
NEW_TEXTURE_ENV|
|
||||
NEW_POLYGON|
|
||||
NEW_DRVSTATE0|
|
||||
@@ -2367,7 +2424,7 @@ void gl_update_state( GLcontext *ctx )
|
||||
oldnorm = ctx->NeedEyeNormals;
|
||||
|
||||
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
|
||||
ctx->NeedEyeCoords = ((ctx->Fog.Enabled && ctx->Hint.Fog != GL_NICEST) ||
|
||||
ctx->NeedEyeCoords = (ctx->FogMode == FOG_VERTEX ||
|
||||
ctx->Point.Attenuated);
|
||||
ctx->NeedEyeNormals = GL_FALSE;
|
||||
|
||||
@@ -2423,7 +2480,6 @@ void gl_update_state( GLcontext *ctx )
|
||||
gl_update_normal_transform( ctx );
|
||||
}
|
||||
|
||||
finished:
|
||||
gl_update_pipelines(ctx);
|
||||
ctx->NewState = 0;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: dd.h,v 1.4 1999/10/21 12:46:27 brianp Exp $ */
|
||||
/* $Id: dd.h,v 1.4.2.1 1999/12/12 18:30:47 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -659,6 +659,7 @@ struct dd_function_table {
|
||||
void (*Lightfv)(GLcontext *ctx, GLenum light,
|
||||
GLenum pname, const GLfloat *params, GLint nparams );
|
||||
void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
|
||||
void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
|
||||
void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
|
||||
void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
|
||||
void (*ShadeModel)(GLcontext *ctx, GLenum mode);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: drawpix.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */
|
||||
/* $Id: drawpix.c,v 1.5.2.1 1999/11/26 16:28:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,10 +25,19 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "drawpix.h"
|
||||
#include "feedback.h"
|
||||
@@ -44,16 +53,23 @@
|
||||
|
||||
|
||||
|
||||
/* TODO: apply texture mapping to fragments */
|
||||
|
||||
|
||||
/*
|
||||
* Try to do a fast and simple RGB(a) glDrawPixels.
|
||||
* Try to do a fast glDrawPixels. Conditions include:
|
||||
* not using a display list
|
||||
* simple pixel unpacking
|
||||
* no raster ops
|
||||
* etc....
|
||||
* Return: GL_TRUE if success, GL_FALSE if slow path must be used instead
|
||||
*/
|
||||
static GLboolean
|
||||
simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height, GLenum format, GLenum type,
|
||||
const GLvoid *pixels )
|
||||
GLboolean gl_direct_DrawPixels( GLcontext *ctx,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels )
|
||||
{
|
||||
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
|
||||
GLubyte rgb[MAX_WIDTH][3];
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
|
||||
@@ -71,10 +87,12 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
|
||||
}
|
||||
|
||||
/* see if device driver can do the drawpix */
|
||||
if (ctx->Driver.DrawPixels
|
||||
&& (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type,
|
||||
unpack, pixels)) {
|
||||
return GL_TRUE;
|
||||
if (ctx->Driver.DrawPixels) {
|
||||
GLint x = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
|
||||
GLint y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
|
||||
if ((*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type,
|
||||
unpack, pixels))
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
if ((ctx->RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0
|
||||
@@ -88,8 +106,8 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
|
||||
&& !unpack->SwapBytes
|
||||
&& !unpack->LsbFirst) {
|
||||
|
||||
GLint destX = x;
|
||||
GLint destY = y;
|
||||
GLint destX = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
|
||||
GLint destY = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
|
||||
GLint drawWidth = width; /* actual width drawn */
|
||||
GLint drawHeight = height; /* actual height drawn */
|
||||
GLint skipPixels = unpack->SkipPixels;
|
||||
@@ -346,9 +364,10 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* can't do a simple draw, have to use slow path */
|
||||
return GL_FALSE;
|
||||
else {
|
||||
/* can't do direct render, have to use slow path */
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -356,43 +375,99 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
|
||||
/*
|
||||
* Do glDrawPixels of index pixels.
|
||||
*/
|
||||
static void
|
||||
draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum type, const GLvoid *pixels )
|
||||
static void draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
const struct gl_image *image )
|
||||
{
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
GLint width, height, widthInBytes;
|
||||
const GLint desty = y;
|
||||
GLint row, drawWidth;
|
||||
GLint i, j;
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
|
||||
drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
|
||||
assert(image);
|
||||
assert(image->Format == GL_COLOR_INDEX);
|
||||
|
||||
width = image->Width;
|
||||
height = image->Height;
|
||||
if (image->Type == GL_BITMAP)
|
||||
widthInBytes = (width + 7) / 8;
|
||||
else
|
||||
widthInBytes = width;
|
||||
|
||||
/* Fragment depth values */
|
||||
if (ctx->Depth.Test) {
|
||||
if (ctx->Depth.Test || ctx->Fog.Enabled) {
|
||||
GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
|
||||
GLint i;
|
||||
for (i = 0; i < drawWidth; i++) {
|
||||
for (i=0;i<width;i++) {
|
||||
zspan[i] = zval;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* General solution
|
||||
*/
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
GLuint indexes[MAX_WIDTH];
|
||||
const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack,
|
||||
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
|
||||
_mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, indexes,
|
||||
type, source, &ctx->Unpack, GL_TRUE);
|
||||
if (zoom) {
|
||||
gl_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, indexes, desty);
|
||||
/* process the image row by row */
|
||||
for (i=0;i<height;i++,y++) {
|
||||
GLuint ispan[MAX_WIDTH];
|
||||
|
||||
/* convert to uints */
|
||||
switch (image->Type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
{
|
||||
GLubyte *src = (GLubyte *) image->Data + i * width;
|
||||
for (j=0;j<width;j++) {
|
||||
ispan[j] = (GLuint) *src++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
{
|
||||
GLfloat *src = (GLfloat *) image->Data + i * width;
|
||||
for (j=0;j<width;j++) {
|
||||
ispan[j] = (GLuint) (GLint) *src++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_BITMAP:
|
||||
{
|
||||
GLubyte *src = (GLubyte *) image->Data + i * widthInBytes;
|
||||
for (j=0;j<width;j++) {
|
||||
ispan[j] = ( src[j >> 3] >> (7 - (j & 0x7)) ) & 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gl_problem( ctx, "draw_index_pixels type" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* apply shift and offset */
|
||||
if (ctx->Pixel.IndexOffset || ctx->Pixel.IndexShift) {
|
||||
gl_shift_and_offset_ci( ctx, width, ispan );
|
||||
}
|
||||
|
||||
if (ctx->Visual->RGBAflag) {
|
||||
/* Convert index to RGBA and write to frame buffer */
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
gl_map_ci_to_rgba( ctx, width, ispan, rgba );
|
||||
if (zoom) {
|
||||
gl_write_zoomed_rgba_span( ctx, width, x, y, zspan,
|
||||
(const GLubyte (*)[4])rgba, desty );
|
||||
}
|
||||
else {
|
||||
gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP );
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_write_index_span(ctx, drawWidth, x, y, zspan, indexes, GL_BITMAP);
|
||||
/* optionally apply index map then write to frame buffer */
|
||||
if (ctx->Pixel.MapColorFlag) {
|
||||
gl_map_ci(ctx, width, ispan);
|
||||
}
|
||||
if (zoom) {
|
||||
gl_write_zoomed_index_span( ctx, width, x, y, zspan, ispan, desty );
|
||||
}
|
||||
else {
|
||||
gl_write_index_span( ctx, width, x, y, zspan, ispan, GL_BITMAP );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -401,44 +476,83 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
* Do glDrawPixels of stencil image. The image datatype may either
|
||||
* be GLubyte or GLbitmap.
|
||||
*/
|
||||
static void
|
||||
draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum type, const GLvoid *pixels )
|
||||
static void draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
const struct gl_image *image )
|
||||
{
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
GLint widthInBytes, width, height;
|
||||
const GLint desty = y;
|
||||
GLint row, drawWidth;
|
||||
GLint i;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
|
||||
if (type != GL_BYTE &&
|
||||
type != GL_UNSIGNED_BYTE &&
|
||||
type != GL_SHORT &&
|
||||
type != GL_UNSIGNED_SHORT &&
|
||||
type != GL_INT &&
|
||||
type != GL_UNSIGNED_INT &&
|
||||
type != GL_FLOAT &&
|
||||
type != GL_BITMAP) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glDrawPixels(stencil type)");
|
||||
if (image->Type != GL_BYTE &&
|
||||
image->Type != GL_UNSIGNED_BYTE &&
|
||||
image->Type != GL_SHORT &&
|
||||
image->Type != GL_UNSIGNED_SHORT &&
|
||||
image->Type != GL_INT &&
|
||||
image->Type != GL_UNSIGNED_INT &&
|
||||
image->Type != GL_FLOAT &&
|
||||
image->Type != GL_BITMAP) {
|
||||
gl_error( ctx, GL_INVALID_OPERATION, "glDrawPixels(stencil type)");
|
||||
return;
|
||||
}
|
||||
|
||||
drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
|
||||
assert(image);
|
||||
assert(image->Format == GL_STENCIL_INDEX);
|
||||
assert(image->Type == GL_UNSIGNED_BYTE || image->Type == GL_BITMAP);
|
||||
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
GLstencil values[MAX_WIDTH];
|
||||
GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte))
|
||||
? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
|
||||
const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack,
|
||||
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
|
||||
_mesa_unpack_index_span(ctx, drawWidth, destType, values,
|
||||
type, source, &ctx->Unpack, GL_TRUE);
|
||||
if (image->Type == GL_UNSIGNED_BYTE)
|
||||
widthInBytes = image->Width;
|
||||
else
|
||||
widthInBytes = (image->Width + 7) / 8;
|
||||
width = image->Width;
|
||||
height = image->Height;
|
||||
|
||||
if (zoom) {
|
||||
gl_write_zoomed_stencil_span( ctx, (GLuint) drawWidth, x, y,
|
||||
values, desty );
|
||||
/* process the image row by row */
|
||||
for (i=0;i<height;i++,y++) {
|
||||
GLstencil *src = (GLstencil*)image->Data + i * widthInBytes;
|
||||
GLstencil *stencilValues;
|
||||
GLstencil stencilCopy[MAX_WIDTH];
|
||||
|
||||
if (image->Type == GL_BITMAP) {
|
||||
/* convert bitmap data to GLubyte (0 or 1) data */
|
||||
GLint j;
|
||||
for (j = 0; j < width; j++) {
|
||||
stencilCopy[j] = ( src[j >> 3] >> (7 - (j & 0x7)) ) & 1;
|
||||
}
|
||||
src = stencilCopy;
|
||||
}
|
||||
|
||||
if (ctx->Pixel.IndexOffset || ctx->Pixel.IndexShift
|
||||
|| ctx->Pixel.MapStencilFlag) {
|
||||
|
||||
/* make copy of stencil values */
|
||||
if (src != stencilCopy)
|
||||
MEMCPY( stencilCopy, src, width * sizeof(GLstencil));
|
||||
|
||||
/* apply shift and offset */
|
||||
if (ctx->Pixel.IndexOffset || ctx->Pixel.IndexShift) {
|
||||
gl_shift_and_offset_stencil( ctx, width, stencilCopy );
|
||||
}
|
||||
|
||||
/* mapping */
|
||||
if (ctx->Pixel.MapStencilFlag) {
|
||||
gl_map_stencil( ctx, width, stencilCopy );
|
||||
}
|
||||
|
||||
stencilValues = stencilCopy;
|
||||
}
|
||||
else {
|
||||
gl_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values );
|
||||
/* use stencil values in-place */
|
||||
stencilValues = src;
|
||||
}
|
||||
|
||||
/* write stencil values to stencil buffer */
|
||||
if (zoom) {
|
||||
gl_write_zoomed_stencil_span( ctx, (GLuint) width, x, y,
|
||||
stencilValues, desty );
|
||||
}
|
||||
else {
|
||||
gl_write_stencil_span( ctx, (GLuint) width, x, y, stencilValues );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -448,37 +562,30 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
/*
|
||||
* Do a glDrawPixels of depth values.
|
||||
*/
|
||||
static void
|
||||
draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum type, const GLvoid *pixels )
|
||||
static void draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
const struct gl_image *image )
|
||||
{
|
||||
const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
GLint width, height;
|
||||
const GLint desty = y;
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
GLuint ispan[MAX_WIDTH];
|
||||
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
|
||||
const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
|
||||
if (type != GL_UNSIGNED_BYTE
|
||||
&& type != GL_UNSIGNED_BYTE
|
||||
&& type != GL_UNSIGNED_SHORT
|
||||
&& type != GL_UNSIGNED_SHORT
|
||||
&& type != GL_UNSIGNED_INT
|
||||
&& type != GL_UNSIGNED_INT
|
||||
&& type != GL_FLOAT) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glDrawPixels(type)");
|
||||
return;
|
||||
}
|
||||
assert(image);
|
||||
assert(image->Format == GL_DEPTH_COMPONENT);
|
||||
|
||||
/* Colors or indexes */
|
||||
width = image->Width;
|
||||
height = image->Height;
|
||||
|
||||
/* Color or index */
|
||||
if (ctx->Visual->RGBAflag) {
|
||||
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);
|
||||
GLint i;
|
||||
for (i = 0; i < drawWidth; i++) {
|
||||
for (i=0; i<width; i++) {
|
||||
rgba[i][RCOMP] = r;
|
||||
rgba[i][GCOMP] = g;
|
||||
rgba[i][BCOMP] = b;
|
||||
@@ -487,36 +594,34 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
}
|
||||
else {
|
||||
GLint i;
|
||||
for (i = 0; i < drawWidth; i++) {
|
||||
for (i=0;i<width;i++) {
|
||||
ispan[i] = ctx->Current.RasterIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort)
|
||||
if (image->Type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort)
|
||||
&& !bias_or_scale && !zoom && ctx->Visual->RGBAflag) {
|
||||
/* Special case: directly write 16-bit depth values */
|
||||
GLint row;
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack,
|
||||
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
|
||||
GLint j;
|
||||
for (j=0;j<height;j++,y++) {
|
||||
GLdepth *zptr = (GLdepth *) image->Data + j * width;
|
||||
gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP );
|
||||
}
|
||||
}
|
||||
else if (type==GL_UNSIGNED_INT && sizeof(GLdepth)==sizeof(GLuint)
|
||||
else if (image->Type==GL_UNSIGNED_INT && sizeof(GLdepth)==sizeof(GLuint)
|
||||
&& !bias_or_scale && !zoom && ctx->Visual->RGBAflag) {
|
||||
/* Special case: directly write 32-bit depth values */
|
||||
GLint i, row;
|
||||
GLint i, j;
|
||||
/* Compute shift value to scale 32-bit uints down to depth values. */
|
||||
GLuint shift = 0;
|
||||
GLuint max = MAX_DEPTH;
|
||||
while ((max & 0x80000000) == 0) {
|
||||
while ((max&0x80000000)==0) {
|
||||
max = max << 1;
|
||||
shift++;
|
||||
}
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
for (j=0;j<height;j++,y++) {
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack,
|
||||
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
|
||||
GLuint *zptr = (GLuint *) image->Data + j * width;
|
||||
for (i=0;i<width;i++) {
|
||||
zspan[i] = zptr[i] >> shift;
|
||||
}
|
||||
@@ -524,30 +629,72 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* General case */
|
||||
GLint row;
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
/* General case (slower) */
|
||||
GLint i, j;
|
||||
|
||||
/* process image row by row */
|
||||
for (i=0;i<height;i++,y++) {
|
||||
GLfloat depth[MAX_WIDTH];
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack,
|
||||
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
|
||||
_mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src,
|
||||
&ctx->Unpack, GL_TRUE );
|
||||
|
||||
switch (image->Type) {
|
||||
case GL_UNSIGNED_SHORT:
|
||||
{
|
||||
GLushort *src = (GLushort *) image->Data + i * width;
|
||||
for (j=0;j<width;j++) {
|
||||
depth[j] = USHORT_TO_FLOAT( *src++ );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
{
|
||||
GLuint *src = (GLuint *) image->Data + i * width;
|
||||
for (j=0;j<width;j++) {
|
||||
depth[j] = UINT_TO_FLOAT( *src++ );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
{
|
||||
GLfloat *src = (GLfloat *) image->Data + i * width;
|
||||
for (j=0;j<width;j++) {
|
||||
depth[j] = *src++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gl_problem(ctx, "Bad type in draw_depth_pixels");
|
||||
return;
|
||||
}
|
||||
|
||||
/* apply depth scale and bias */
|
||||
if (ctx->Pixel.DepthScale!=1.0 || ctx->Pixel.DepthBias!=0.0) {
|
||||
for (j=0;j<width;j++) {
|
||||
depth[j] = depth[j] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
|
||||
}
|
||||
}
|
||||
|
||||
/* clamp depth values to [0,1] and convert from floats to integers */
|
||||
for (j=0;j<width;j++) {
|
||||
zspan[j] = (GLdepth) (CLAMP( depth[j], 0.0F, 1.0F ) * DEPTH_SCALE);
|
||||
}
|
||||
|
||||
if (ctx->Visual->RGBAflag) {
|
||||
if (zoom) {
|
||||
gl_write_zoomed_rgba_span(ctx, width, x, y, zspan,
|
||||
(const GLubyte (*)[4])rgba, desty);
|
||||
gl_write_zoomed_rgba_span( ctx, width, x, y, zspan,
|
||||
(const GLubyte (*)[4])rgba, desty );
|
||||
}
|
||||
else {
|
||||
gl_write_rgba_span(ctx, width, x, y, zspan, rgba, GL_BITMAP);
|
||||
gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (zoom) {
|
||||
gl_write_zoomed_index_span(ctx, width, x, y, zspan,
|
||||
ispan, GL_BITMAP);
|
||||
gl_write_zoomed_index_span( ctx, width, x, y, zspan,
|
||||
ispan, GL_BITMAP );
|
||||
}
|
||||
else {
|
||||
gl_write_index_span(ctx, width, x, y, zspan, ispan, GL_BITMAP);
|
||||
gl_write_index_span( ctx, width, x, y, zspan, ispan, GL_BITMAP );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,71 +703,184 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Simple unpacking parameters: */
|
||||
static struct gl_pixelstore_attrib NoUnpack = {
|
||||
1, /* Alignment */
|
||||
0, /* RowLength */
|
||||
0, /* SkipPixels */
|
||||
0, /* SkipRows */
|
||||
0, /* ImageHeight */
|
||||
0, /* SkipImages */
|
||||
GL_FALSE, /* SwapBytes */
|
||||
GL_FALSE /* LsbFirst */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Do glDrawPixels of RGBA pixels.
|
||||
*/
|
||||
static void
|
||||
draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const GLvoid *pixels )
|
||||
static void draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
const struct gl_image *image )
|
||||
{
|
||||
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
GLint width, height;
|
||||
GLint i, j;
|
||||
const GLint desty = y;
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
GLboolean quickDraw;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
|
||||
assert(image);
|
||||
|
||||
/* Try an optimized glDrawPixels first */
|
||||
if (simple_DrawPixels(ctx, x, y, width, height, format, type, pixels))
|
||||
if (gl_direct_DrawPixels(ctx, &NoUnpack, image->Width, image->Height,
|
||||
image->Format, image->Type, image->Data ))
|
||||
return;
|
||||
|
||||
width = image->Width;
|
||||
height = image->Height;
|
||||
|
||||
/* Fragment depth values */
|
||||
if (ctx->Depth.Test) {
|
||||
if (ctx->Depth.Test || ctx->Fog.Enabled) {
|
||||
/* fill in array of z values */
|
||||
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
|
||||
GLint i;
|
||||
for (i=0;i<width;i++) {
|
||||
zspan[i] = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ctx->RasterMask == 0 && !zoom
|
||||
&& x >= 0 && y >= 0
|
||||
&& x + width <= ctx->Buffer->Width
|
||||
&& y + height <= ctx->Buffer->Height) {
|
||||
if (ctx->RasterMask==0 && !zoom && x>=0 && y>=0
|
||||
&& x+width<=ctx->Buffer->Width && y+height<=ctx->Buffer->Height) {
|
||||
quickDraw = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
quickDraw = GL_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* General solution
|
||||
*/
|
||||
{
|
||||
/* General solution */
|
||||
GLboolean r_flag, g_flag, b_flag, a_flag, l_flag;
|
||||
GLuint components;
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
GLint row;
|
||||
if (width > MAX_WIDTH)
|
||||
width = MAX_WIDTH;
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
const GLvoid *source = gl_pixel_addr_in_image(unpack,
|
||||
pixels, width, height, format, type, 0, row, 0);
|
||||
_mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba,
|
||||
format, type, source, unpack, GL_TRUE);
|
||||
GLfloat rf[MAX_WIDTH];
|
||||
GLfloat gf[MAX_WIDTH];
|
||||
GLfloat bf[MAX_WIDTH];
|
||||
DEFARRAY(GLfloat,af,MAX_WIDTH);
|
||||
CHECKARRAY(af,return);
|
||||
|
||||
r_flag = g_flag = b_flag = a_flag = l_flag = GL_FALSE;
|
||||
switch (image->Format) {
|
||||
case GL_RED:
|
||||
r_flag = GL_TRUE;
|
||||
components = 1;
|
||||
break;
|
||||
case GL_GREEN:
|
||||
g_flag = GL_TRUE;
|
||||
components = 1;
|
||||
break;
|
||||
case GL_BLUE:
|
||||
b_flag = GL_TRUE;
|
||||
components = 1;
|
||||
break;
|
||||
case GL_ALPHA:
|
||||
a_flag = GL_TRUE;
|
||||
components = 1;
|
||||
break;
|
||||
case GL_RGB:
|
||||
r_flag = g_flag = b_flag = GL_TRUE;
|
||||
components = 3;
|
||||
break;
|
||||
case GL_LUMINANCE:
|
||||
l_flag = GL_TRUE;
|
||||
components = 1;
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
l_flag = a_flag = GL_TRUE;
|
||||
components = 2;
|
||||
break;
|
||||
case GL_RGBA:
|
||||
r_flag = g_flag = b_flag = a_flag = GL_TRUE;
|
||||
components = 4;
|
||||
break;
|
||||
default:
|
||||
gl_problem(ctx, "Bad type in draw_rgba_pixels");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* process the image row by row */
|
||||
for (i=0;i<height;i++,y++) {
|
||||
/* convert to floats */
|
||||
switch (image->Type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
{
|
||||
GLubyte *src = (GLubyte *) image->Data + i * width * components;
|
||||
for (j=0;j<width;j++) {
|
||||
if (l_flag) {
|
||||
rf[j] = gf[j] = bf[j] = UBYTE_TO_FLOAT(*src++);
|
||||
}
|
||||
else {
|
||||
rf[j] = r_flag ? UBYTE_TO_FLOAT(*src++) : 0.0;
|
||||
gf[j] = g_flag ? UBYTE_TO_FLOAT(*src++) : 0.0;
|
||||
bf[j] = b_flag ? UBYTE_TO_FLOAT(*src++) : 0.0;
|
||||
}
|
||||
af[j] = a_flag ? UBYTE_TO_FLOAT(*src++) : 1.0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
{
|
||||
GLfloat *src = (GLfloat *) image->Data + i * width * components;
|
||||
for (j=0;j<width;j++) {
|
||||
if (l_flag) {
|
||||
rf[j] = gf[j] = bf[j] = *src++;
|
||||
}
|
||||
else {
|
||||
rf[j] = r_flag ? *src++ : 0.0;
|
||||
gf[j] = g_flag ? *src++ : 0.0;
|
||||
bf[j] = b_flag ? *src++ : 0.0;
|
||||
}
|
||||
af[j] = a_flag ? *src++ : 1.0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gl_problem( ctx, "draw_rgba_pixels type" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* apply scale and bias */
|
||||
if (ctx->Pixel.ScaleOrBiasRGBA) {
|
||||
gl_scale_and_bias_color(ctx, width, rf, gf, bf, af);
|
||||
}
|
||||
|
||||
/* apply pixel mappings */
|
||||
if (ctx->Pixel.MapColorFlag) {
|
||||
gl_map_color(ctx, width, rf, gf, bf, af);
|
||||
}
|
||||
|
||||
/* convert to integers */
|
||||
for (j=0;j<width;j++) {
|
||||
rgba[j][RCOMP] = (GLint) (rf[j] * 255.0F);
|
||||
rgba[j][GCOMP] = (GLint) (gf[j] * 255.0F);
|
||||
rgba[j][BCOMP] = (GLint) (bf[j] * 255.0F);
|
||||
rgba[j][ACOMP] = (GLint) (af[j] * 255.0F);
|
||||
}
|
||||
|
||||
/* write to frame buffer */
|
||||
if (quickDraw) {
|
||||
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
|
||||
(CONST GLubyte (*)[]) rgba, NULL);
|
||||
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
|
||||
(const GLubyte (*)[4])rgba, NULL);
|
||||
}
|
||||
else if (zoom) {
|
||||
gl_write_zoomed_rgba_span( ctx, width, x, y, zspan,
|
||||
(CONST GLubyte (*)[]) rgba, desty );
|
||||
(const GLubyte (*)[4])rgba, desty );
|
||||
}
|
||||
else {
|
||||
gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, rgba, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
cleanup:
|
||||
UNDEFARRAY(af);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,50 +889,45 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
||||
/*
|
||||
* Execute glDrawPixels
|
||||
*/
|
||||
void
|
||||
_mesa_DrawPixels( GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const GLvoid *pixels )
|
||||
void gl_DrawPixels( GLcontext* ctx, struct gl_image *image )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawPixels");
|
||||
|
||||
|
||||
if (gl_image_error_test( ctx, image, "glDrawPixels" ))
|
||||
return;
|
||||
|
||||
if (ctx->RenderMode==GL_RENDER) {
|
||||
GLint x, y;
|
||||
if (!pixels || !ctx->Current.RasterPosValid) {
|
||||
if (!ctx->Current.RasterPosValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
x = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
|
||||
y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
|
||||
|
||||
switch (format) {
|
||||
switch (image->Format) {
|
||||
case GL_COLOR_INDEX:
|
||||
draw_index_pixels( ctx, x, y, image );
|
||||
break;
|
||||
case GL_STENCIL_INDEX:
|
||||
draw_stencil_pixels( ctx, x, y, width, height, type, pixels );
|
||||
draw_stencil_pixels( ctx, x, y, image );
|
||||
break;
|
||||
case GL_DEPTH_COMPONENT:
|
||||
draw_depth_pixels( ctx, x, y, width, height, type, pixels );
|
||||
break;
|
||||
case GL_COLOR_INDEX:
|
||||
if (ctx->Visual->RGBAflag)
|
||||
draw_index_pixels(ctx, x, y, width, height, type, pixels);
|
||||
else
|
||||
draw_rgba_pixels(ctx, x,y, width, height, format, type, pixels);
|
||||
draw_depth_pixels( ctx, x, y, image );
|
||||
break;
|
||||
case GL_RED:
|
||||
case GL_GREEN:
|
||||
case GL_BLUE:
|
||||
case GL_ALPHA:
|
||||
case GL_RGB:
|
||||
case GL_LUMINANCE:
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
case GL_RGB:
|
||||
case GL_BGR:
|
||||
case GL_RGBA:
|
||||
case GL_BGRA:
|
||||
case GL_ABGR_EXT:
|
||||
draw_rgba_pixels(ctx, x, y, width, height, format, type, pixels);
|
||||
draw_rgba_pixels( ctx, x, y, image );
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" );
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glDrawPixels" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: extensions.c,v 1.11 1999/11/11 01:22:26 brianp Exp $ */
|
||||
/* $Id: extensions.c,v 1.10.2.3 1999/12/12 18:30:47 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,16 +25,15 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#ifndef XFree86Server
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "extensions.h"
|
||||
#include "mem.h"
|
||||
#include "simple_list.h"
|
||||
#include "types.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define MAX_EXT_NAMELEN 80
|
||||
@@ -62,7 +61,7 @@ static struct { int enabled; const char *name; } default_extensions[] = {
|
||||
{ DEFAULT_ON, "GL_EXT_texture3D" },
|
||||
{ ALWAYS_ENABLED, "GL_MESA_window_pos" },
|
||||
{ ALWAYS_ENABLED, "GL_MESA_resize_buffers" },
|
||||
{ ALWAYS_ENABLED, "GL_EXT_shared_texture_palette" },
|
||||
{ DEFAULT_ON, "GL_EXT_shared_texture_palette" },
|
||||
{ ALWAYS_ENABLED, "GL_EXT_rescale_normal" },
|
||||
{ ALWAYS_ENABLED, "GL_EXT_abgr" },
|
||||
{ ALWAYS_ENABLED, "GL_SGIS_texture_edge_clamp" },
|
||||
@@ -72,8 +71,13 @@ static struct { int enabled; const char *name; } default_extensions[] = {
|
||||
{ ALWAYS_ENABLED, "GL_NV_texgen_reflection" },
|
||||
{ DEFAULT_ON, "GL_PGI_misc_hints" },
|
||||
{ DEFAULT_ON, "GL_EXT_compiled_vertex_array" },
|
||||
{ DEFAULT_OFF, "GL_EXT_vertex_array_set" },
|
||||
{ DEFAULT_ON, "GL_EXT_clip_volume_hint" },
|
||||
|
||||
/* These obviously won't make it before 3.3:
|
||||
*/
|
||||
{ DEFAULT_OFF, "GL_EXT_vertex_array_set" },
|
||||
{ DEFAULT_OFF, "GL_EXT_texture_env" },
|
||||
{ DEFAULT_OFF, "GL_EXT_fog_coord" },
|
||||
};
|
||||
|
||||
|
||||
@@ -133,6 +137,24 @@ int gl_extensions_disable( GLcontext *ctx, const char *name )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Test if the named extension is enabled in this context.
|
||||
*/
|
||||
GLboolean gl_extension_is_enabled( GLcontext *ctx, const char *name)
|
||||
{
|
||||
struct extension *i;
|
||||
foreach( i, ctx->Extensions.ext_list )
|
||||
if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) {
|
||||
if (i->enabled)
|
||||
return GL_TRUE;
|
||||
else
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
void gl_extensions_dtr( GLcontext *ctx )
|
||||
{
|
||||
struct extension *i, *nexti;
|
||||
@@ -218,43 +240,409 @@ void (*gl_get_proc_address( const GLubyte *procName ))()
|
||||
gl_function address;
|
||||
};
|
||||
static struct proc procTable[] = {
|
||||
/* OpenGL 1.0 functions */
|
||||
{ "glAccum", (gl_function) glAccum },
|
||||
{ "glAlphaFunc", (gl_function) glAlphaFunc },
|
||||
{ "glBegin", (gl_function) glBegin },
|
||||
{ "glBitmap", (gl_function) glBitmap },
|
||||
{ "glAccum", (gl_function) glAccum },
|
||||
{ "glAlphaFunc", (gl_function) glAlphaFunc },
|
||||
{ "glBegin", (gl_function) glBegin },
|
||||
{ "glBitmap", (gl_function) glBitmap },
|
||||
{ "glBlendFunc", (gl_function) glBlendFunc },
|
||||
{ "glCallList", (gl_function) glCallList },
|
||||
{ "glCallLists", (gl_function) glCallLists },
|
||||
{ "glClear", (gl_function) glClear },
|
||||
{ "glClearAccum", (gl_function) glClearAccum },
|
||||
{ "glClearColor", (gl_function) glClearColor },
|
||||
{ "glClearDepth", (gl_function) glClearDepth },
|
||||
{ "glClearIndex", (gl_function) glClearIndex },
|
||||
{ "glClearStencil", (gl_function) glClearStencil },
|
||||
{ "glClipPlane", (gl_function) glClipPlane },
|
||||
{ "glColor3b", (gl_function) glColor3b },
|
||||
{ "glColor3bv", (gl_function) glColor3bv },
|
||||
{ "glColor3d", (gl_function) glColor3d },
|
||||
{ "glColor3dv", (gl_function) glColor3dv },
|
||||
{ "glColor3f", (gl_function) glColor3f },
|
||||
{ "glColor3fv", (gl_function) glColor3fv },
|
||||
{ "glColor3i", (gl_function) glColor3i },
|
||||
{ "glColor3iv", (gl_function) glColor3iv },
|
||||
{ "glColor3s", (gl_function) glColor3s },
|
||||
{ "glColor3sv", (gl_function) glColor3sv },
|
||||
{ "glColor3ub", (gl_function) glColor3ub },
|
||||
{ "glColor3ubv", (gl_function) glColor3ubv },
|
||||
{ "glColor3ui", (gl_function) glColor3ui },
|
||||
{ "glColor3uiv", (gl_function) glColor3uiv },
|
||||
{ "glColor3us", (gl_function) glColor3us },
|
||||
{ "glColor3usv", (gl_function) glColor3usv },
|
||||
{ "glColor4b", (gl_function) glColor4b },
|
||||
{ "glColor4bv", (gl_function) glColor4bv },
|
||||
{ "glColor4d", (gl_function) glColor4d },
|
||||
{ "glColor4dv", (gl_function) glColor4dv },
|
||||
{ "glColor4f", (gl_function) glColor4f },
|
||||
{ "glColor4fv", (gl_function) glColor4fv },
|
||||
{ "glColor4i", (gl_function) glColor4i },
|
||||
{ "glColor4iv", (gl_function) glColor4iv },
|
||||
{ "glColor4s", (gl_function) glColor4s },
|
||||
{ "glColor4sv", (gl_function) glColor4sv },
|
||||
{ "glColor4ub", (gl_function) glColor4ub },
|
||||
{ "glColor4ubv", (gl_function) glColor4ubv },
|
||||
{ "glColor4ui", (gl_function) glColor4ui },
|
||||
{ "glColor4uiv", (gl_function) glColor4uiv },
|
||||
{ "glColor4us", (gl_function) glColor4us },
|
||||
{ "glColor4usv", (gl_function) glColor4usv },
|
||||
{ "glColorMask", (gl_function) glColorMask },
|
||||
{ "glColorMaterial", (gl_function) glColorMaterial },
|
||||
{ "glCopyPixels", (gl_function) glCopyPixels },
|
||||
{ "glCullFace", (gl_function) glCullFace },
|
||||
{ "glDeleteLists", (gl_function) glDeleteLists },
|
||||
{ "glDepthFunc", (gl_function) glDepthFunc },
|
||||
{ "glDepthMask", (gl_function) glDepthMask },
|
||||
{ "glDepthRange", (gl_function) glDepthRange },
|
||||
{ "glDisable", (gl_function) glDisable },
|
||||
{ "glDrawBuffer", (gl_function) glDrawBuffer },
|
||||
{ "glDrawPixels", (gl_function) glDrawPixels },
|
||||
{ "glEdgeFlag", (gl_function) glEdgeFlag },
|
||||
{ "glEdgeFlagv", (gl_function) glEdgeFlagv },
|
||||
{ "glEnable", (gl_function) glEnable },
|
||||
{ "glEnd", (gl_function) glEnd },
|
||||
{ "glEndList", (gl_function) glEndList },
|
||||
{ "glEvalCoord1d", (gl_function) glEvalCoord1d },
|
||||
{ "glEvalCoord1dv", (gl_function) glEvalCoord1dv },
|
||||
{ "glEvalCoord1f", (gl_function) glEvalCoord1f },
|
||||
{ "glEvalCoord1fv", (gl_function) glEvalCoord1fv },
|
||||
{ "glEvalCoord2d", (gl_function) glEvalCoord2d },
|
||||
{ "glEvalCoord2dv", (gl_function) glEvalCoord2dv },
|
||||
{ "glEvalCoord2f", (gl_function) glEvalCoord2f },
|
||||
{ "glEvalCoord2fv", (gl_function) glEvalCoord2fv },
|
||||
{ "glEvalMesh1", (gl_function) glEvalMesh1 },
|
||||
{ "glEvalMesh2", (gl_function) glEvalMesh2 },
|
||||
{ "glEvalPoint1", (gl_function) glEvalPoint1 },
|
||||
{ "glEvalPoint2", (gl_function) glEvalPoint2 },
|
||||
{ "glFeedbackBuffer", (gl_function) glFeedbackBuffer },
|
||||
{ "glFinish", (gl_function) glFinish },
|
||||
{ "glFlush", (gl_function) glFlush },
|
||||
{ "glFogf", (gl_function) glFogf },
|
||||
{ "glFogfv", (gl_function) glFogfv },
|
||||
{ "glFogi", (gl_function) glFogi },
|
||||
{ "glFogiv", (gl_function) glFogiv },
|
||||
{ "glFrontFace", (gl_function) glFrontFace },
|
||||
{ "glFrustum", (gl_function) glFrustum },
|
||||
{ "glGenLists", (gl_function) glGenLists },
|
||||
{ "glGetBooleanv", (gl_function) glGetBooleanv },
|
||||
{ "glGetClipPlane", (gl_function) glGetClipPlane },
|
||||
{ "glGetDoublev", (gl_function) glGetDoublev },
|
||||
{ "glGetError", (gl_function) glGetError },
|
||||
{ "glGetFloatv", (gl_function) glGetFloatv },
|
||||
{ "glGetIntegerv", (gl_function) glGetIntegerv },
|
||||
{ "glGetLightfv", (gl_function) glGetLightfv },
|
||||
{ "glGetLightiv", (gl_function) glGetLightiv },
|
||||
{ "glGetMapdv", (gl_function) glGetMapdv },
|
||||
{ "glGetMapfv", (gl_function) glGetMapfv },
|
||||
{ "glGetMapiv", (gl_function) glGetMapiv },
|
||||
{ "glGetMaterialfv", (gl_function) glGetMaterialfv },
|
||||
{ "glGetMaterialiv", (gl_function) glGetMaterialiv },
|
||||
{ "glGetPixelMapfv", (gl_function) glGetPixelMapfv },
|
||||
{ "glGetPixelMapuiv", (gl_function) glGetPixelMapuiv },
|
||||
{ "glGetPixelMapusv", (gl_function) glGetPixelMapusv },
|
||||
{ "glGetPolygonStipple", (gl_function) glGetPolygonStipple },
|
||||
{ "glGetString", (gl_function) glGetString },
|
||||
{ "glGetTexEnvfv", (gl_function) glGetTexEnvfv },
|
||||
{ "glGetTexEnviv", (gl_function) glGetTexEnviv },
|
||||
{ "glGetTexGendv", (gl_function) glGetTexGendv },
|
||||
{ "glGetTexGenfv", (gl_function) glGetTexGenfv },
|
||||
{ "glGetTexGeniv", (gl_function) glGetTexGeniv },
|
||||
{ "glGetTexImage", (gl_function) glGetTexImage },
|
||||
{ "glGetTexLevelParameterfv", (gl_function) glGetTexLevelParameterfv },
|
||||
{ "glGetTexLevelParameteriv", (gl_function) glGetTexLevelParameteriv },
|
||||
{ "glGetTexParameterfv", (gl_function) glGetTexParameterfv },
|
||||
{ "glGetTexParameteriv", (gl_function) glGetTexParameteriv },
|
||||
{ "glHint", (gl_function) glHint },
|
||||
{ "glIndexMask", (gl_function) glIndexMask },
|
||||
{ "glIndexd", (gl_function) glIndexd },
|
||||
{ "glIndexdv", (gl_function) glIndexdv },
|
||||
{ "glIndexf", (gl_function) glIndexf },
|
||||
{ "glIndexfv", (gl_function) glIndexfv },
|
||||
{ "glIndexi", (gl_function) glIndexi },
|
||||
{ "glIndexiv", (gl_function) glIndexiv },
|
||||
{ "glIndexs", (gl_function) glIndexs },
|
||||
{ "glIndexsv", (gl_function) glIndexsv },
|
||||
{ "glInitNames", (gl_function) glInitNames },
|
||||
{ "glIsEnabled", (gl_function) glIsEnabled },
|
||||
{ "glIsList", (gl_function) glIsList },
|
||||
{ "glLightModelf", (gl_function) glLightModelf },
|
||||
{ "glLightModelfv", (gl_function) glLightModelfv },
|
||||
{ "glLightModeli", (gl_function) glLightModeli },
|
||||
{ "glLightModeliv", (gl_function) glLightModeliv },
|
||||
{ "glLightf", (gl_function) glLightf },
|
||||
{ "glLightfv", (gl_function) glLightfv },
|
||||
{ "glLighti", (gl_function) glLighti },
|
||||
{ "glLightiv", (gl_function) glLightiv },
|
||||
{ "glLineStipple", (gl_function) glLineStipple },
|
||||
{ "glLineWidth", (gl_function) glLineWidth },
|
||||
{ "glListBase", (gl_function) glListBase },
|
||||
{ "glLoadIdentity", (gl_function) glLoadIdentity },
|
||||
{ "glLoadMatrixd", (gl_function) glLoadMatrixd },
|
||||
{ "glLoadMatrixf", (gl_function) glLoadMatrixf },
|
||||
{ "glLoadName", (gl_function) glLoadName },
|
||||
{ "glLogicOp", (gl_function) glLogicOp },
|
||||
{ "glMap1d", (gl_function) glMap1d },
|
||||
{ "glMap1f", (gl_function) glMap1f },
|
||||
{ "glMap2d", (gl_function) glMap2d },
|
||||
{ "glMap2f", (gl_function) glMap2f },
|
||||
{ "glMapGrid1d", (gl_function) glMapGrid1d },
|
||||
{ "glMapGrid1f", (gl_function) glMapGrid1f },
|
||||
{ "glMapGrid2d", (gl_function) glMapGrid2d },
|
||||
{ "glMapGrid2f", (gl_function) glMapGrid2f },
|
||||
{ "glMaterialf", (gl_function) glMaterialf },
|
||||
{ "glMaterialfv", (gl_function) glMaterialfv },
|
||||
{ "glMateriali", (gl_function) glMateriali },
|
||||
{ "glMaterialiv", (gl_function) glMaterialiv },
|
||||
{ "glMatrixMode", (gl_function) glMatrixMode },
|
||||
{ "glMultMatrixd", (gl_function) glMultMatrixd },
|
||||
{ "glMultMatrixf", (gl_function) glMultMatrixf },
|
||||
{ "glNewList", (gl_function) glNewList },
|
||||
{ "glNormal3b", (gl_function) glNormal3b },
|
||||
{ "glNormal3bv", (gl_function) glNormal3bv },
|
||||
{ "glNormal3d", (gl_function) glNormal3d },
|
||||
{ "glNormal3dv", (gl_function) glNormal3dv },
|
||||
{ "glNormal3f", (gl_function) glNormal3f },
|
||||
{ "glNormal3fv", (gl_function) glNormal3fv },
|
||||
{ "glNormal3i", (gl_function) glNormal3i },
|
||||
{ "glNormal3iv", (gl_function) glNormal3iv },
|
||||
{ "glNormal3s", (gl_function) glNormal3s },
|
||||
{ "glNormal3sv", (gl_function) glNormal3sv },
|
||||
{ "glOrtho", (gl_function) glOrtho },
|
||||
{ "glPassThrough", (gl_function) glPassThrough },
|
||||
{ "glPixelMapfv", (gl_function) glPixelMapfv },
|
||||
{ "glPixelMapuiv", (gl_function) glPixelMapuiv },
|
||||
{ "glPixelMapusv", (gl_function) glPixelMapusv },
|
||||
{ "glPixelStoref", (gl_function) glPixelStoref },
|
||||
{ "glPixelStorei", (gl_function) glPixelStorei },
|
||||
{ "glPixelTransferf", (gl_function) glPixelTransferf },
|
||||
{ "glPixelTransferi", (gl_function) glPixelTransferi },
|
||||
{ "glPixelZoom", (gl_function) glPixelZoom },
|
||||
{ "glPointSize", (gl_function) glPointSize },
|
||||
{ "glPolygonMode", (gl_function) glPolygonMode },
|
||||
{ "glPolygonOffset", (gl_function) glPolygonOffset },
|
||||
{ "glPolygonStipple", (gl_function) glPolygonStipple },
|
||||
{ "glPopAttrib", (gl_function) glPopAttrib },
|
||||
{ "glPopMatrix", (gl_function) glPopMatrix },
|
||||
{ "glPopName", (gl_function) glPopName },
|
||||
{ "glPushAttrib", (gl_function) glPushAttrib },
|
||||
{ "glPushMatrix", (gl_function) glPushMatrix },
|
||||
{ "glPushName", (gl_function) glPushName },
|
||||
{ "glRasterPos2d", (gl_function) glRasterPos2d },
|
||||
{ "glRasterPos2dv", (gl_function) glRasterPos2dv },
|
||||
{ "glRasterPos2f", (gl_function) glRasterPos2f },
|
||||
{ "glRasterPos2fv", (gl_function) glRasterPos2fv },
|
||||
{ "glRasterPos2i", (gl_function) glRasterPos2i },
|
||||
{ "glRasterPos2iv", (gl_function) glRasterPos2iv },
|
||||
{ "glRasterPos2s", (gl_function) glRasterPos2s },
|
||||
{ "glRasterPos2sv", (gl_function) glRasterPos2sv },
|
||||
{ "glRasterPos3d", (gl_function) glRasterPos3d },
|
||||
{ "glRasterPos3dv", (gl_function) glRasterPos3dv },
|
||||
{ "glRasterPos3f", (gl_function) glRasterPos3f },
|
||||
{ "glRasterPos3fv", (gl_function) glRasterPos3fv },
|
||||
{ "glRasterPos3i", (gl_function) glRasterPos3i },
|
||||
{ "glRasterPos3iv", (gl_function) glRasterPos3iv },
|
||||
{ "glRasterPos3s", (gl_function) glRasterPos3s },
|
||||
{ "glRasterPos3sv", (gl_function) glRasterPos3sv },
|
||||
{ "glRasterPos4d", (gl_function) glRasterPos4d },
|
||||
{ "glRasterPos4dv", (gl_function) glRasterPos4dv },
|
||||
{ "glRasterPos4f", (gl_function) glRasterPos4f },
|
||||
{ "glRasterPos4fv", (gl_function) glRasterPos4fv },
|
||||
{ "glRasterPos4i", (gl_function) glRasterPos4i },
|
||||
{ "glRasterPos4iv", (gl_function) glRasterPos4iv },
|
||||
{ "glRasterPos4s", (gl_function) glRasterPos4s },
|
||||
{ "glRasterPos4sv", (gl_function) glRasterPos4sv },
|
||||
{ "glReadBuffer", (gl_function) glReadBuffer },
|
||||
{ "glReadPixels", (gl_function) glReadPixels },
|
||||
{ "glRectd", (gl_function) glRectd },
|
||||
{ "glRectdv", (gl_function) glRectdv },
|
||||
{ "glRectf", (gl_function) glRectf },
|
||||
{ "glRectfv", (gl_function) glRectfv },
|
||||
{ "glRecti", (gl_function) glRecti },
|
||||
{ "glRectiv", (gl_function) glRectiv },
|
||||
{ "glRects", (gl_function) glRects },
|
||||
{ "glRectsv", (gl_function) glRectsv },
|
||||
{ "glRenderMode", (gl_function) glRenderMode },
|
||||
{ "glRotated", (gl_function) glRotated },
|
||||
{ "glRotatef", (gl_function) glRotatef },
|
||||
{ "glScaled", (gl_function) glScaled },
|
||||
{ "glScalef", (gl_function) glScalef },
|
||||
{ "glScissor", (gl_function) glScissor },
|
||||
{ "glSelectBuffer", (gl_function) glSelectBuffer },
|
||||
{ "glShadeModel", (gl_function) glShadeModel },
|
||||
{ "glStencilFunc", (gl_function) glStencilFunc },
|
||||
{ "glStencilMask", (gl_function) glStencilMask },
|
||||
{ "glStencilOp", (gl_function) glStencilOp },
|
||||
{ "glTexCoord1d", (gl_function) glTexCoord1d },
|
||||
{ "glTexCoord1dv", (gl_function) glTexCoord1dv },
|
||||
{ "glTexCoord1f", (gl_function) glTexCoord1f },
|
||||
{ "glTexCoord1fv", (gl_function) glTexCoord1fv },
|
||||
{ "glTexCoord1i", (gl_function) glTexCoord1i },
|
||||
{ "glTexCoord1iv", (gl_function) glTexCoord1iv },
|
||||
{ "glTexCoord1s", (gl_function) glTexCoord1s },
|
||||
{ "glTexCoord1sv", (gl_function) glTexCoord1sv },
|
||||
{ "glTexCoord2d", (gl_function) glTexCoord2d },
|
||||
{ "glTexCoord2dv", (gl_function) glTexCoord2dv },
|
||||
{ "glTexCoord2f", (gl_function) glTexCoord2f },
|
||||
{ "glTexCoord2fv", (gl_function) glTexCoord2fv },
|
||||
{ "glTexCoord2i", (gl_function) glTexCoord2i },
|
||||
{ "glTexCoord2iv", (gl_function) glTexCoord2iv },
|
||||
{ "glTexCoord2s", (gl_function) glTexCoord2s },
|
||||
{ "glTexCoord2sv", (gl_function) glTexCoord2sv },
|
||||
{ "glTexCoord3d", (gl_function) glTexCoord3d },
|
||||
{ "glTexCoord3dv", (gl_function) glTexCoord3dv },
|
||||
{ "glTexCoord3f", (gl_function) glTexCoord3f },
|
||||
{ "glTexCoord3fv", (gl_function) glTexCoord3fv },
|
||||
{ "glTexCoord3i", (gl_function) glTexCoord3i },
|
||||
{ "glTexCoord3iv", (gl_function) glTexCoord3iv },
|
||||
{ "glTexCoord3s", (gl_function) glTexCoord3s },
|
||||
{ "glTexCoord3sv", (gl_function) glTexCoord3sv },
|
||||
{ "glTexCoord4d", (gl_function) glTexCoord4d },
|
||||
{ "glTexCoord4dv", (gl_function) glTexCoord4dv },
|
||||
{ "glTexCoord4f", (gl_function) glTexCoord4f },
|
||||
{ "glTexCoord4fv", (gl_function) glTexCoord4fv },
|
||||
{ "glTexCoord4i", (gl_function) glTexCoord4i },
|
||||
{ "glTexCoord4iv", (gl_function) glTexCoord4iv },
|
||||
{ "glTexCoord4s", (gl_function) glTexCoord4s },
|
||||
{ "glTexCoord4sv", (gl_function) glTexCoord4sv },
|
||||
{ "glTexEnvf", (gl_function) glTexEnvf },
|
||||
{ "glTexEnvfv", (gl_function) glTexEnvfv },
|
||||
{ "glTexEnvi", (gl_function) glTexEnvi },
|
||||
{ "glTexEnviv", (gl_function) glTexEnviv },
|
||||
{ "glTexGend", (gl_function) glTexGend },
|
||||
{ "glTexGendv", (gl_function) glTexGendv },
|
||||
{ "glTexGenf", (gl_function) glTexGenf },
|
||||
{ "glTexGenfv", (gl_function) glTexGenfv },
|
||||
{ "glTexGeni", (gl_function) glTexGeni },
|
||||
{ "glTexGeniv", (gl_function) glTexGeniv },
|
||||
{ "glTexImage1D", (gl_function) glTexImage1D },
|
||||
{ "glTexImage2D", (gl_function) glTexImage2D },
|
||||
{ "glTexParameterf", (gl_function) glTexParameterf },
|
||||
{ "glTexParameterfv", (gl_function) glTexParameterfv },
|
||||
{ "glTexParameteri", (gl_function) glTexParameteri },
|
||||
{ "glTexParameteriv", (gl_function) glTexParameteriv },
|
||||
{ "glTranslated", (gl_function) glTranslated },
|
||||
{ "glTranslatef", (gl_function) glTranslatef },
|
||||
{ "glVertex2d", (gl_function) glVertex2d },
|
||||
{ "glVertex2dv", (gl_function) glVertex2dv },
|
||||
{ "glVertex2f", (gl_function) glVertex2f },
|
||||
{ "glVertex2fv", (gl_function) glVertex2fv },
|
||||
{ "glVertex2i", (gl_function) glVertex2i },
|
||||
{ "glVertex2iv", (gl_function) glVertex2iv },
|
||||
{ "glVertex2s", (gl_function) glVertex2s },
|
||||
{ "glVertex2sv", (gl_function) glVertex2sv },
|
||||
{ "glVertex3d", (gl_function) glVertex3d },
|
||||
{ "glVertex3dv", (gl_function) glVertex3dv },
|
||||
{ "glVertex3f", (gl_function) glVertex3f },
|
||||
{ "glVertex3fv", (gl_function) glVertex3fv },
|
||||
{ "glVertex3i", (gl_function) glVertex3i },
|
||||
{ "glVertex3iv", (gl_function) glVertex3iv },
|
||||
{ "glVertex3s", (gl_function) glVertex3s },
|
||||
{ "glVertex3sv", (gl_function) glVertex3sv },
|
||||
{ "glVertex4d", (gl_function) glVertex4d },
|
||||
{ "glVertex4dv", (gl_function) glVertex4dv },
|
||||
{ "glVertex4f", (gl_function) glVertex4f },
|
||||
{ "glVertex4fv", (gl_function) glVertex4fv },
|
||||
{ "glVertex4i", (gl_function) glVertex4i },
|
||||
{ "glVertex4iv", (gl_function) glVertex4iv },
|
||||
{ "glVertex4s", (gl_function) glVertex4s },
|
||||
{ "glVertex4sv", (gl_function) glVertex4sv },
|
||||
{ "glViewport", (gl_function) glViewport },
|
||||
|
||||
/* OpenGL 1.1 functions */
|
||||
{ "glEnableClientState", (gl_function) glEnableClientState },
|
||||
{ "glDisableClientState", (gl_function) glDisableClientState },
|
||||
{ "glPushClientAttrib", (gl_function) glPushClientAttrib },
|
||||
{ "glPopClientAttrib", (gl_function) glPopClientAttrib },
|
||||
{ "glIndexub", (gl_function) glIndexub },
|
||||
{ "glIndexubv", (gl_function) glIndexubv },
|
||||
{ "glVertexPointer", (gl_function) glVertexPointer },
|
||||
{ "glNormalPointer", (gl_function) glNormalPointer },
|
||||
{ "glColorPointer", (gl_function) glColorPointer },
|
||||
{ "glIndexPointer", (gl_function) glIndexPointer },
|
||||
{ "glTexCoordPointer", (gl_function) glTexCoordPointer },
|
||||
{ "glEdgeFlagPointer", (gl_function) glEdgeFlagPointer },
|
||||
{ "glGetPointerv", (gl_function) glGetPointerv },
|
||||
{ "glArrayElement", (gl_function) glArrayElement },
|
||||
{ "glDrawArrays", (gl_function) glDrawArrays },
|
||||
{ "glDrawElements", (gl_function) glDrawElements },
|
||||
{ "glInterleavedArrays", (gl_function) glInterleavedArrays },
|
||||
{ "glGenTextures", (gl_function) glGenTextures },
|
||||
{ "glDeleteTextures", (gl_function) glDeleteTextures },
|
||||
{ "glBindTexture", (gl_function) glBindTexture },
|
||||
{ "glPrioritizeTextures", (gl_function) glPrioritizeTextures },
|
||||
{ "glAreTexturesResident", (gl_function) glAreTexturesResident },
|
||||
{ "glIsTexture", (gl_function) glIsTexture },
|
||||
{ "glTexSubImage1D", (gl_function) glTexSubImage1D },
|
||||
{ "glTexSubImage2D", (gl_function) glTexSubImage2D },
|
||||
{ "glArrayElement", (gl_function) glArrayElement },
|
||||
{ "glBindTexture", (gl_function) glBindTexture },
|
||||
{ "glColorPointer", (gl_function) glColorPointer },
|
||||
{ "glCopyTexImage1D", (gl_function) glCopyTexImage1D },
|
||||
{ "glCopyTexImage2D", (gl_function) glCopyTexImage2D },
|
||||
{ "glCopyTexSubImage1D", (gl_function) glCopyTexSubImage1D },
|
||||
{ "glCopyTexSubImage2D", (gl_function) glCopyTexSubImage2D },
|
||||
{ "glDeleteTextures", (gl_function) glDeleteTextures },
|
||||
{ "glDisableClientState", (gl_function) glDisableClientState },
|
||||
{ "glDrawArrays", (gl_function) glDrawArrays },
|
||||
{ "glDrawElements", (gl_function) glDrawElements },
|
||||
{ "glEdgeFlagPointer", (gl_function) glEdgeFlagPointer },
|
||||
{ "glEnableClientState", (gl_function) glEnableClientState },
|
||||
{ "glGenTextures", (gl_function) glGenTextures },
|
||||
{ "glGetPointerv", (gl_function) glGetPointerv },
|
||||
{ "glIndexPointer", (gl_function) glIndexPointer },
|
||||
{ "glIndexub", (gl_function) glIndexub },
|
||||
{ "glIndexubv", (gl_function) glIndexubv },
|
||||
{ "glInterleavedArrays", (gl_function) glInterleavedArrays },
|
||||
{ "glIsTexture", (gl_function) glIsTexture },
|
||||
{ "glNormalPointer", (gl_function) glNormalPointer },
|
||||
{ "glPopClientAttrib", (gl_function) glPopClientAttrib },
|
||||
{ "glPrioritizeTextures", (gl_function) glPrioritizeTextures },
|
||||
{ "glPushClientAttrib", (gl_function) glPushClientAttrib },
|
||||
{ "glTexCoordPointer", (gl_function) glTexCoordPointer },
|
||||
{ "glTexSubImage1D", (gl_function) glTexSubImage1D },
|
||||
{ "glTexSubImage2D", (gl_function) glTexSubImage2D },
|
||||
{ "glVertexPointer", (gl_function) glVertexPointer },
|
||||
|
||||
/* OpenGL 1.2 functions */
|
||||
{ "glCopyTexSubImage3D", (gl_function) glCopyTexSubImage3D },
|
||||
{ "glDrawRangeElements", (gl_function) glDrawRangeElements },
|
||||
{ "glTexImage3D", (gl_function) glTexImage3D },
|
||||
{ "glTexSubImage3D", (gl_function) glTexSubImage3D },
|
||||
{ "glCopyTexSubImage3D", (gl_function) glCopyTexSubImage3D },
|
||||
/* NOTE: 1.2 imaging subset functions not implemented in Mesa */
|
||||
|
||||
/* ARB_imaging functions */
|
||||
{ "glBlendColor", (gl_function) glBlendColor },
|
||||
{ "glBlendEquation", (gl_function) glBlendEquation },
|
||||
{ "glColorSubTable", (gl_function) glColorSubTable },
|
||||
{ "glColorTable", (gl_function) glColorTable },
|
||||
{ "glColorTableParameterfv", (gl_function) glColorTableParameterfv },
|
||||
{ "glColorTableParameteriv", (gl_function) glColorTableParameteriv },
|
||||
{ "glConvolutionFilter1D", (gl_function) glConvolutionFilter1D },
|
||||
{ "glConvolutionFilter2D", (gl_function) glConvolutionFilter2D },
|
||||
{ "glConvolutionParameterf", (gl_function) glConvolutionParameterf },
|
||||
{ "glConvolutionParameterfv", (gl_function) glConvolutionParameterfv },
|
||||
{ "glConvolutionParameteri", (gl_function) glConvolutionParameteri },
|
||||
{ "glConvolutionParameteriv", (gl_function) glConvolutionParameteriv },
|
||||
{ "glCopyColorSubTable", (gl_function) glCopyColorSubTable },
|
||||
{ "glCopyColorTable", (gl_function) glCopyColorTable },
|
||||
{ "glCopyConvolutionFilter1D", (gl_function) glCopyConvolutionFilter1D },
|
||||
{ "glCopyConvolutionFilter2D", (gl_function) glCopyConvolutionFilter2D },
|
||||
{ "glGetColorTable", (gl_function) glGetColorTable },
|
||||
{ "glGetColorTableParameterfv", (gl_function) glGetColorTableParameterfv },
|
||||
{ "glGetColorTableParameteriv", (gl_function) glGetColorTableParameteriv },
|
||||
{ "glGetConvolutionFilter", (gl_function) glGetConvolutionFilter },
|
||||
{ "glGetConvolutionParameterfv", (gl_function) glGetConvolutionParameterfv },
|
||||
{ "glGetConvolutionParameteriv", (gl_function) glGetConvolutionParameteriv },
|
||||
{ "glGetHistogram", (gl_function) glGetHistogram },
|
||||
{ "glGetHistogramParameterfv", (gl_function) glGetHistogramParameterfv },
|
||||
{ "glGetHistogramParameteriv", (gl_function) glGetHistogramParameteriv },
|
||||
{ "glGetMinmax", (gl_function) glGetMinmax },
|
||||
{ "glGetMinmaxParameterfv", (gl_function) glGetMinmaxParameterfv },
|
||||
{ "glGetMinmaxParameteriv", (gl_function) glGetMinmaxParameteriv },
|
||||
{ "glGetSeparableFilter", (gl_function) glGetSeparableFilter },
|
||||
{ "glHistogram", (gl_function) glHistogram },
|
||||
{ "glMinmax", (gl_function) glMinmax },
|
||||
{ "glResetHistogram", (gl_function) glResetHistogram },
|
||||
{ "glResetMinmax", (gl_function) glResetMinmax },
|
||||
{ "glSeparableFilter2D", (gl_function) glSeparableFilter2D },
|
||||
|
||||
/* GL_EXT_paletted_texture */
|
||||
{ "glColorTableEXT", (gl_function) glColorTableEXT },
|
||||
{ "glColorSubTableEXT", (gl_function) glColorSubTableEXT },
|
||||
{ "glGetColorTableEXT", (gl_function) glGetColorTableEXT },
|
||||
{ "glGetColorTableParameterfvEXT", (gl_function) glGetColorTableParameterfvEXT },
|
||||
{ "glGetColorTableParameterivEXT", (gl_function) glGetColorTableParameterivEXT },
|
||||
|
||||
/* GL_EXT_compiled_vertex_array */
|
||||
{ "glLockArraysEXT", (gl_function) glLockArraysEXT },
|
||||
{ "glUnlockArraysEXT", (gl_function) glUnlockArraysEXT },
|
||||
|
||||
/* GL_EXT_point_parameters */
|
||||
{ "glPointParameterfEXT", (gl_function) glPointParameterfEXT },
|
||||
{ "glPointParameterfvEXT", (gl_function) glPointParameterfvEXT },
|
||||
|
||||
/* GL_EXT_polygon_offset */
|
||||
{ "glPolygonOffsetEXT", (gl_function) glPolygonOffsetEXT },
|
||||
|
||||
/* GL_EXT_blend_minmax */
|
||||
{ "glBlendEquationEXT", (gl_function) glBlendEquationEXT },
|
||||
@@ -262,9 +650,6 @@ void (*gl_get_proc_address( const GLubyte *procName ))()
|
||||
/* GL_EXT_blend_color */
|
||||
{ "glBlendColorEXT", (gl_function) glBlendColorEXT },
|
||||
|
||||
/* GL_EXT_polygon_offset */
|
||||
{ "glPolygonOffsetEXT", (gl_function) glPolygonOffsetEXT },
|
||||
|
||||
/* GL_EXT_vertex_arrays */
|
||||
{ "glVertexPointerEXT", (gl_function) glVertexPointerEXT },
|
||||
{ "glNormalPointerEXT", (gl_function) glNormalPointerEXT },
|
||||
@@ -289,13 +674,6 @@ void (*gl_get_proc_address( const GLubyte *procName ))()
|
||||
{ "glTexSubImage3DEXT", (gl_function) glTexSubImage3DEXT },
|
||||
{ "glCopyTexSubImage3DEXT", (gl_function) glCopyTexSubImage3DEXT },
|
||||
|
||||
/* GL_EXT_color_table */
|
||||
{ "glColorTableEXT", (gl_function) glColorTableEXT },
|
||||
{ "glColorSubTableEXT", (gl_function) glColorSubTableEXT },
|
||||
{ "glGetColorTableEXT", (gl_function) glGetColorTableEXT },
|
||||
{ "glGetColorTableParameterfvEXT", (gl_function) glGetColorTableParameterfvEXT },
|
||||
{ "glGetColorTableParameterivEXT", (gl_function) glGetColorTableParameterivEXT },
|
||||
|
||||
/* GL_ARB_multitexture */
|
||||
{ "glActiveTextureARB", (gl_function) glActiveTextureARB },
|
||||
{ "glClientActiveTextureARB", (gl_function) glClientActiveTextureARB },
|
||||
@@ -332,10 +710,6 @@ void (*gl_get_proc_address( const GLubyte *procName ))()
|
||||
{ "glMultiTexCoord4sARB", (gl_function) glMultiTexCoord4sARB },
|
||||
{ "glMultiTexCoord4svARB", (gl_function) glMultiTexCoord4svARB },
|
||||
|
||||
/* GL_EXT_point_parameters */
|
||||
{ "glPointParameterfEXT", (gl_function) glPointParameterfEXT },
|
||||
{ "glPointParameterfvEXT", (gl_function) glPointParameterfvEXT },
|
||||
|
||||
/* GL_INGR_blend_func_separate */
|
||||
{ "glBlendFuncSeparateINGR", (gl_function) glBlendFuncSeparateINGR },
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: extensions.h,v 1.5 1999/10/16 11:30:27 brianp Exp $ */
|
||||
/* $Id: extensions.h,v 1.5.2.1 1999/11/20 13:13:50 miklos Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -39,7 +39,7 @@
|
||||
*/
|
||||
extern int gl_extensions_add( struct gl_context *ctx, int state,
|
||||
const char *name, void (*notify)( void ) );
|
||||
|
||||
extern GLboolean gl_extension_is_enabled( GLcontext *ctx, const char *name);
|
||||
extern int gl_extensions_enable( struct gl_context *ctx, const char *name );
|
||||
extern int gl_extensions_disable( struct gl_context *ctx, const char *name );
|
||||
extern void gl_extensions_dtr( struct gl_context *ctx );
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: fog.c,v 1.4 1999/11/11 01:22:26 brianp Exp $ */
|
||||
/* $Id: fog.c,v 1.3.2.1 1999/11/25 16:51:24 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,64 +25,29 @@
|
||||
*/
|
||||
|
||||
|
||||
/* $XFree86: xc/lib/GL/mesa/src/fog.c,v 1.4 1999/04/04 00:20:24 dawes Exp $ */
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "fog.h"
|
||||
#include "macros.h"
|
||||
#include "mmath.h"
|
||||
#include "types.h"
|
||||
#include "xform.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_Fogf(GLenum pname, GLfloat param)
|
||||
void gl_Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
_mesa_Fogfv(pname, ¶m);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Fogi(GLenum pname, GLint param )
|
||||
{
|
||||
GLfloat fparam = (GLfloat) param;
|
||||
_mesa_Fogfv(pname, &fparam);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Fogiv(GLenum pname, const GLint *params )
|
||||
{
|
||||
GLfloat p[4];
|
||||
switch (pname) {
|
||||
case GL_FOG_MODE:
|
||||
case GL_FOG_DENSITY:
|
||||
case GL_FOG_START:
|
||||
case GL_FOG_END:
|
||||
case GL_FOG_INDEX:
|
||||
p[0] = (GLfloat) *params;
|
||||
break;
|
||||
case GL_FOG_COLOR:
|
||||
p[0] = INT_TO_FLOAT( params[0] );
|
||||
p[1] = INT_TO_FLOAT( params[1] );
|
||||
p[2] = INT_TO_FLOAT( params[2] );
|
||||
p[3] = INT_TO_FLOAT( params[3] );
|
||||
break;
|
||||
default:
|
||||
/* Error will be caught later in gl_Fogfv */
|
||||
;
|
||||
}
|
||||
_mesa_Fogfv(pname, p);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Fogfv( GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLenum m;
|
||||
|
||||
switch (pname) {
|
||||
@@ -106,23 +71,9 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
|
||||
}
|
||||
break;
|
||||
case GL_FOG_START:
|
||||
#if 0
|
||||
/* Prior to OpenGL 1.1, this was an error */
|
||||
if (*params<0.0F) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_START)" );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ctx->Fog.Start = *params;
|
||||
break;
|
||||
case GL_FOG_END:
|
||||
#if 0
|
||||
/* Prior to OpenGL 1.1, this was an error */
|
||||
if (*params<0.0F) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_END)" );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ctx->Fog.End = *params;
|
||||
break;
|
||||
case GL_FOG_INDEX:
|
||||
@@ -150,9 +101,13 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
|
||||
typedef void (*fog_func)( struct vertex_buffer *VB, GLuint side,
|
||||
GLubyte flag );
|
||||
|
||||
typedef void (*fog_coord_func)( struct vertex_buffer *VB,
|
||||
const GLvector4f *from,
|
||||
GLubyte flag );
|
||||
|
||||
static fog_func fog_ci_tab[2];
|
||||
static fog_func fog_rgba_tab[2];
|
||||
static fog_coord_func make_fog_coord_tab[2];
|
||||
|
||||
/*
|
||||
* Compute the fogged color for an array of vertices.
|
||||
@@ -206,6 +161,70 @@ void gl_fog_vertices( struct vertex_buffer *VB )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void check_fog_coords( GLcontext *ctx, struct gl_pipeline_stage *d )
|
||||
{
|
||||
d->type = 0;
|
||||
|
||||
if (ctx->FogMode==FOG_FRAGMENT)
|
||||
{
|
||||
d->type = PIPE_IMMEDIATE|PIPE_PRECALC;
|
||||
d->inputs = VERT_OBJ_ANY;
|
||||
d->outputs = VERT_FOG_COORD;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_make_fog_coords( struct vertex_buffer *VB )
|
||||
{
|
||||
GLcontext *ctx = VB->ctx;
|
||||
|
||||
/* If full eye coords weren't required, just calculate the eye Z
|
||||
* values.
|
||||
*/
|
||||
if (!ctx->NeedEyeCoords) {
|
||||
GLfloat *m = ctx->ModelView.m;
|
||||
GLfloat plane[4];
|
||||
|
||||
plane[0] = m[2];
|
||||
plane[1] = m[6];
|
||||
plane[2] = m[10];
|
||||
plane[3] = m[14];
|
||||
|
||||
gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye,
|
||||
2, /* fill z coordinates */
|
||||
VB->ObjPtr,
|
||||
plane,
|
||||
0 );
|
||||
|
||||
make_fog_coord_tab[0]( VB, &VB->Eye, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
make_fog_coord_tab[0]( VB, VB->EyePtr, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Drivers that want fog coordinates in VB->Spec[0] alpha, can substitute this
|
||||
* stage for the default PIPE_OP_FOG pipeline stage.
|
||||
*/
|
||||
struct gl_pipeline_stage gl_fog_coord_stage = {
|
||||
"build fog coordinates",
|
||||
PIPE_OP_FOG,
|
||||
PIPE_PRECALC|PIPE_IMMEDIATE,
|
||||
0,
|
||||
NEW_FOG,
|
||||
NEW_LIGHTING|NEW_RASTER_OPS|NEW_FOG|NEW_MODELVIEW,
|
||||
0, 0,
|
||||
0, 0, 0,
|
||||
check_fog_coords,
|
||||
gl_make_fog_coords
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Apply fog to an array of RGBA pixels.
|
||||
* Input: n - number of pixels
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: fog.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */
|
||||
/* $Id: fog.h,v 1.1.1.1.2.1 1999/11/25 16:51:24 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef FOG_H
|
||||
#define FOG_H
|
||||
|
||||
@@ -32,21 +33,7 @@
|
||||
#include "types.h"
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_Fogf(GLenum pname, GLfloat param);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_Fogi(GLenum pname, GLint param );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_Fogfv(GLenum pname, const GLfloat *params );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_Fogiv(GLenum pname, const GLint *params );
|
||||
|
||||
extern void gl_Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *params );
|
||||
|
||||
|
||||
extern void gl_fog_vertices( struct vertex_buffer *VB );
|
||||
@@ -58,7 +45,11 @@ extern void gl_fog_rgba_pixels( const GLcontext *ctx,
|
||||
extern void gl_fog_ci_pixels( const GLcontext *ctx,
|
||||
GLuint n, const GLdepth z[], GLuint indx[] );
|
||||
|
||||
extern void gl_make_fog_coords( struct vertex_buffer *VB );
|
||||
|
||||
extern struct gl_pipeline_stage gl_fog_coord_stage;
|
||||
|
||||
extern void gl_init_fog( void );
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: get.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */
|
||||
/* $Id: get.c,v 1.5.2.1 1999/12/13 21:58:42 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,10 +25,18 @@
|
||||
*/
|
||||
|
||||
|
||||
/* $XFree86: xc/lib/GL/mesa/src/get.c,v 1.3 1999/04/04 00:20:25 dawes Exp $ */
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "enable.h"
|
||||
#include "enums.h"
|
||||
@@ -58,10 +66,8 @@
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
||||
void gl_GetBooleanv( GLcontext *ctx, GLenum pname, GLboolean *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
@@ -742,13 +748,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
||||
*params = INT_TO_BOOL(0); /* TODO */
|
||||
break;
|
||||
case GL_TEXTURE_1D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_1D );
|
||||
*params = gl_IsEnabled( ctx, GL_TEXTURE_1D );
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_2D );
|
||||
*params = gl_IsEnabled( ctx, GL_TEXTURE_2D );
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_3D );
|
||||
*params = gl_IsEnabled( ctx, GL_TEXTURE_3D );
|
||||
break;
|
||||
case GL_TEXTURE_BINDING_1D:
|
||||
*params = INT_TO_BOOL(textureUnit->CurrentD[1]->Name);
|
||||
@@ -972,10 +978,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetDoublev( GLenum pname, GLdouble *params )
|
||||
void gl_GetDoublev( GLcontext *ctx, GLenum pname, GLdouble *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
@@ -1656,13 +1660,13 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
||||
*params = 0.0; /* TODO */
|
||||
break;
|
||||
case GL_TEXTURE_1D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0 : 0.0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_1D) ? 1.0 : 0.0;
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0 : 0.0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_2D) ? 1.0 : 0.0;
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_3D) ? 1.0 : 0.0;
|
||||
break;
|
||||
case GL_TEXTURE_BINDING_1D:
|
||||
*params = (GLdouble) textureUnit->CurrentD[1]->Name;
|
||||
@@ -1889,10 +1893,8 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||
void gl_GetFloatv( GLcontext *ctx, GLenum pname, GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
@@ -2570,13 +2572,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||
*params = 0.0F; /* TODO */
|
||||
break;
|
||||
case GL_TEXTURE_1D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0 : 0.0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_1D) ? 1.0 : 0.0;
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0 : 0.0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_2D) ? 1.0 : 0.0;
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_3D) ? 1.0 : 0.0;
|
||||
break;
|
||||
case GL_TEXTURE_BINDING_1D:
|
||||
*params = (GLfloat) textureUnit->CurrentD[1]->Name;
|
||||
@@ -2800,10 +2802,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||
void gl_GetIntegerv( GLcontext *ctx, GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
@@ -3485,13 +3485,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||
*params = 0; /* TODO */
|
||||
break;
|
||||
case GL_TEXTURE_1D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1 : 0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_1D) ? 1 : 0;
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1 : 0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_2D) ? 1 : 0;
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1 : 0;
|
||||
*params = gl_IsEnabled(ctx, GL_TEXTURE_3D) ? 1 : 0;
|
||||
break;
|
||||
case GL_TEXTURE_BINDING_1D:
|
||||
*params = textureUnit->CurrentD[1]->Name;
|
||||
@@ -3725,10 +3725,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetPointerv( GLenum pname, GLvoid **params )
|
||||
void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
/*GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;*/
|
||||
|
||||
@@ -3768,13 +3766,11 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
|
||||
|
||||
|
||||
|
||||
const GLubyte *
|
||||
_mesa_GetString( GLenum name )
|
||||
const GLubyte *gl_GetString( GLcontext *ctx, GLenum name )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
static char result[1000];
|
||||
static char *vendor = "Brian Paul";
|
||||
static char *version = "1.2 Mesa 3.3 beta";
|
||||
static char *version = "1.2 Mesa 3.1";
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0);
|
||||
|
||||
@@ -3815,24 +3811,3 @@ _mesa_GetString( GLenum name )
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Execute a glGetError command
|
||||
*/
|
||||
GLenum
|
||||
_mesa_GetError( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
GLenum e = ctx->ErrorValue;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, "glGetError", (GLenum) 0);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glGetError <-- %s\n", gl_lookup_enum_by_nr(e));
|
||||
|
||||
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
|
||||
return e;
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: light.c,v 1.9 1999/11/11 01:22:27 brianp Exp $ */
|
||||
/* $Id: light.c,v 1.8.2.1 1999/11/22 19:01:39 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,16 +25,27 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#include <float.h>
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "enums.h"
|
||||
#include "light.h"
|
||||
#include "macros.h"
|
||||
#include "matrix.h"
|
||||
#include "mem.h"
|
||||
#include "mmath.h"
|
||||
#include "simple_list.h"
|
||||
#include "types.h"
|
||||
@@ -44,20 +55,21 @@
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_ShadeModel( GLenum mode )
|
||||
void gl_ShadeModel( GLcontext *ctx, GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glShadeModel");
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode));
|
||||
|
||||
if (mode == GL_FLAT || mode == GL_SMOOTH) {
|
||||
if (ctx->Light.ShadeModel!=mode) {
|
||||
ctx->Light.ShadeModel = mode;
|
||||
ctx->TriangleCaps ^= DD_FLATSHADE;
|
||||
ctx->NewState |= NEW_RASTER_OPS;
|
||||
if (ctx->Light.ShadeModel != mode) {
|
||||
ctx->Light.ShadeModel = mode;
|
||||
if (ctx->Light.ShadeModel == GL_FLAT)
|
||||
ctx->TriangleCaps |= DD_FLATSHADE;
|
||||
else
|
||||
ctx->TriangleCaps &= ~DD_FLATSHADE;
|
||||
ctx->NewState |= NEW_RASTER_OPS;
|
||||
if (ctx->Driver.ShadeModel)
|
||||
(*ctx->Driver.ShadeModel)( ctx, mode );
|
||||
}
|
||||
@@ -69,25 +81,19 @@ _mesa_ShadeModel( GLenum mode )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
|
||||
void gl_Lightfv( GLcontext *ctx,
|
||||
GLenum light, GLenum pname, const GLfloat *params,
|
||||
GLint nparams )
|
||||
{
|
||||
_mesa_Lightfv( light, pname, ¶m );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint l;
|
||||
GLint nParams;
|
||||
|
||||
(void) nparams;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLight");
|
||||
|
||||
l = (GLint) (light - GL_LIGHT0);
|
||||
|
||||
if (l < 0 || l >= MAX_LIGHTS) {
|
||||
if (l<0 || l>=MAX_LIGHTS) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glLight" );
|
||||
return;
|
||||
}
|
||||
@@ -95,22 +101,18 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
switch (pname) {
|
||||
case GL_AMBIENT:
|
||||
COPY_4V( ctx->Light.Light[l].Ambient, params );
|
||||
nParams = 4;
|
||||
break;
|
||||
case GL_DIFFUSE:
|
||||
COPY_4V( ctx->Light.Light[l].Diffuse, params );
|
||||
nParams = 4;
|
||||
break;
|
||||
case GL_SPECULAR:
|
||||
COPY_4V( ctx->Light.Light[l].Specular, params );
|
||||
nParams = 4;
|
||||
break;
|
||||
case GL_POSITION:
|
||||
/* transform position by ModelView matrix */
|
||||
TRANSFORM_POINT( ctx->Light.Light[l].EyePosition,
|
||||
ctx->ModelView.m,
|
||||
params );
|
||||
nParams = 4;
|
||||
break;
|
||||
case GL_SPOT_DIRECTION:
|
||||
/* transform direction by inverse modelview */
|
||||
@@ -120,7 +122,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
TRANSFORM_NORMAL( ctx->Light.Light[l].EyeDirection,
|
||||
params,
|
||||
ctx->ModelView.inv );
|
||||
nParams = 3;
|
||||
break;
|
||||
case GL_SPOT_EXPONENT:
|
||||
if (params[0]<0.0 || params[0]>128.0) {
|
||||
@@ -131,7 +132,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
ctx->Light.Light[l].SpotExponent = params[0];
|
||||
gl_compute_spot_exp_table( &ctx->Light.Light[l] );
|
||||
}
|
||||
nParams = 1;
|
||||
break;
|
||||
case GL_SPOT_CUTOFF:
|
||||
if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) {
|
||||
@@ -142,7 +142,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
ctx->Light.Light[l].CosCutoff = cos(params[0]*DEG2RAD);
|
||||
if (ctx->Light.Light[l].CosCutoff < 0)
|
||||
ctx->Light.Light[l].CosCutoff = 0;
|
||||
nParams = 1;
|
||||
break;
|
||||
case GL_CONSTANT_ATTENUATION:
|
||||
if (params[0]<0.0) {
|
||||
@@ -150,7 +149,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
return;
|
||||
}
|
||||
ctx->Light.Light[l].ConstantAttenuation = params[0];
|
||||
nParams = 1;
|
||||
break;
|
||||
case GL_LINEAR_ATTENUATION:
|
||||
if (params[0]<0.0) {
|
||||
@@ -158,7 +156,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
return;
|
||||
}
|
||||
ctx->Light.Light[l].LinearAttenuation = params[0];
|
||||
nParams = 1;
|
||||
break;
|
||||
case GL_QUADRATIC_ATTENUATION:
|
||||
if (params[0]<0.0) {
|
||||
@@ -166,73 +163,23 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
return;
|
||||
}
|
||||
ctx->Light.Light[l].QuadraticAttenuation = params[0];
|
||||
nParams = 1;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glLight" );
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctx->Driver.Lightfv)
|
||||
ctx->Driver.Lightfv( ctx, light, pname, params, nParams );
|
||||
ctx->Driver.Lightfv( ctx, light, pname, params, nparams );
|
||||
|
||||
ctx->NewState |= NEW_LIGHTING;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Lighti( GLenum light, GLenum pname, GLint param )
|
||||
|
||||
void gl_GetLightfv( GLcontext *ctx,
|
||||
GLenum light, GLenum pname, GLfloat *params )
|
||||
{
|
||||
_mesa_Lightiv( light, pname, ¶m );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params )
|
||||
{
|
||||
GLfloat fparam[4];
|
||||
|
||||
switch (pname) {
|
||||
case GL_AMBIENT:
|
||||
case GL_DIFFUSE:
|
||||
case GL_SPECULAR:
|
||||
fparam[0] = INT_TO_FLOAT( params[0] );
|
||||
fparam[1] = INT_TO_FLOAT( params[1] );
|
||||
fparam[2] = INT_TO_FLOAT( params[2] );
|
||||
fparam[3] = INT_TO_FLOAT( params[3] );
|
||||
break;
|
||||
case GL_POSITION:
|
||||
fparam[0] = (GLfloat) params[0];
|
||||
fparam[1] = (GLfloat) params[1];
|
||||
fparam[2] = (GLfloat) params[2];
|
||||
fparam[3] = (GLfloat) params[3];
|
||||
break;
|
||||
case GL_SPOT_DIRECTION:
|
||||
fparam[0] = (GLfloat) params[0];
|
||||
fparam[1] = (GLfloat) params[1];
|
||||
fparam[2] = (GLfloat) params[2];
|
||||
break;
|
||||
case GL_SPOT_EXPONENT:
|
||||
case GL_SPOT_CUTOFF:
|
||||
case GL_CONSTANT_ATTENUATION:
|
||||
case GL_LINEAR_ATTENUATION:
|
||||
case GL_QUADRATIC_ATTENUATION:
|
||||
fparam[0] = (GLfloat) params[0];
|
||||
break;
|
||||
default:
|
||||
/* error will be caught later in gl_Lightfv */
|
||||
;
|
||||
}
|
||||
|
||||
_mesa_Lightfv( light, pname, fparam );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint l = (GLint) (light - GL_LIGHT0);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
|
||||
@@ -281,10 +228,8 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
|
||||
void gl_GetLightiv( GLcontext *ctx, GLenum light, GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint l = (GLint) (light - GL_LIGHT0);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
|
||||
@@ -352,11 +297,9 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
void
|
||||
_mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
||||
void gl_LightModelfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModelfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModel");
|
||||
|
||||
switch (pname) {
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
@@ -400,46 +343,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_LightModeliv( GLenum pname, const GLint *params )
|
||||
{
|
||||
GLfloat fparam[4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModeliv");
|
||||
|
||||
switch (pname) {
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
fparam[0] = INT_TO_FLOAT( params[0] );
|
||||
fparam[1] = INT_TO_FLOAT( params[1] );
|
||||
fparam[2] = INT_TO_FLOAT( params[2] );
|
||||
fparam[3] = INT_TO_FLOAT( params[3] );
|
||||
break;
|
||||
case GL_LIGHT_MODEL_LOCAL_VIEWER:
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
||||
fparam[0] = (GLfloat) params[0];
|
||||
break;
|
||||
default:
|
||||
/* Error will be caught later in gl_LightModelfv */
|
||||
;
|
||||
}
|
||||
_mesa_LightModelfv( pname, fparam );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_LightModeli( GLenum pname, GLint param )
|
||||
{
|
||||
_mesa_LightModeliv( pname, ¶m );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_LightModelf( GLenum pname, GLfloat param )
|
||||
{
|
||||
_mesa_LightModelfv( pname, ¶m );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********** MATERIAL **********/
|
||||
@@ -665,11 +568,11 @@ void gl_update_color_material( GLcontext *ctx,
|
||||
GLfloat tmp[4], color[4];
|
||||
|
||||
UBYTE_RGBA_TO_FLOAT_RGBA( color, rgba );
|
||||
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
|
||||
fprintf(stderr, "gl_update_color_material, mask %x\n", bitmask);
|
||||
|
||||
|
||||
|
||||
if (bitmask & FRONT_AMBIENT_BIT) {
|
||||
struct gl_material *mat = &ctx->Light.Material[0];
|
||||
SUB_3V( tmp, color, mat->Ambient );
|
||||
@@ -772,10 +675,8 @@ void gl_update_color_material( GLcontext *ctx,
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_ColorMaterial( GLenum face, GLenum mode )
|
||||
void gl_ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint bitmask;
|
||||
GLuint legal = (FRONT_EMISSION_BIT | BACK_EMISSION_BIT |
|
||||
FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT |
|
||||
@@ -803,21 +704,12 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_Materialf( GLenum face, GLenum pname, GLfloat param )
|
||||
{
|
||||
_mesa_Materialfv( face, pname, ¶m );
|
||||
}
|
||||
|
||||
|
||||
/* KW: This is now called directly (ie by name) from the glMaterial*
|
||||
* API functions.
|
||||
*/
|
||||
void
|
||||
_mesa_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
|
||||
void gl_Materialfv( GLcontext *ctx,
|
||||
GLenum face, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct immediate *IM;
|
||||
struct gl_material *mat;
|
||||
GLuint bitmask;
|
||||
@@ -843,7 +735,6 @@ _mesa_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
|
||||
IM->MaterialMask[count] = 0;
|
||||
}
|
||||
|
||||
|
||||
IM->MaterialMask[count] |= bitmask;
|
||||
mat = IM->Material[count];
|
||||
|
||||
@@ -892,48 +783,11 @@ _mesa_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Materiali(GLenum face, GLenum pname, GLint param )
|
||||
|
||||
|
||||
void gl_GetMaterialfv( GLcontext *ctx,
|
||||
GLenum face, GLenum pname, GLfloat *params )
|
||||
{
|
||||
_mesa_Materialiv(face, pname, ¶m);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Materialiv(GLenum face, GLenum pname, const GLint *params )
|
||||
{
|
||||
GLfloat fparam[4];
|
||||
switch (pname) {
|
||||
case GL_AMBIENT:
|
||||
case GL_DIFFUSE:
|
||||
case GL_SPECULAR:
|
||||
case GL_EMISSION:
|
||||
case GL_AMBIENT_AND_DIFFUSE:
|
||||
fparam[0] = INT_TO_FLOAT( params[0] );
|
||||
fparam[1] = INT_TO_FLOAT( params[1] );
|
||||
fparam[2] = INT_TO_FLOAT( params[2] );
|
||||
fparam[3] = INT_TO_FLOAT( params[3] );
|
||||
break;
|
||||
case GL_SHININESS:
|
||||
fparam[0] = (GLfloat) params[0];
|
||||
break;
|
||||
case GL_COLOR_INDEXES:
|
||||
fparam[0] = (GLfloat) params[0];
|
||||
fparam[1] = (GLfloat) params[1];
|
||||
fparam[2] = (GLfloat) params[2];
|
||||
break;
|
||||
default:
|
||||
/* Error will be caught later in gl_Materialfv */
|
||||
;
|
||||
}
|
||||
_mesa_Materialfv(face, pname, fparam);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint f;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialfv");
|
||||
@@ -976,10 +830,9 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
|
||||
void gl_GetMaterialiv( GLcontext *ctx,
|
||||
GLenum face, GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint f;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialiv");
|
||||
@@ -1268,7 +1121,7 @@ void gl_update_lighting( GLcontext *ctx )
|
||||
void gl_compute_light_positions( GLcontext *ctx )
|
||||
{
|
||||
struct gl_light *light;
|
||||
|
||||
|
||||
if (ctx->Light.NeedVertices && !ctx->Light.Model.LocalViewer) {
|
||||
GLfloat eye_z[3] = { 0, 0, 1 };
|
||||
if (!ctx->NeedEyeCoords) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: lines.c,v 1.6 1999/11/11 01:22:27 brianp Exp $ */
|
||||
/* $Id: lines.c,v 1.5.2.1 1999/11/25 16:51:24 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,10 +25,17 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "depth.h"
|
||||
#include "feedback.h"
|
||||
@@ -43,10 +50,8 @@
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_LineWidth( GLfloat width )
|
||||
void gl_LineWidth( GLcontext *ctx, GLfloat width )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
if (width<=0.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
|
||||
return;
|
||||
@@ -63,10 +68,8 @@ _mesa_LineWidth( GLfloat width )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_LineStipple( GLint factor, GLushort pattern )
|
||||
void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple");
|
||||
ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
|
||||
ctx->Line.StipplePattern = pattern;
|
||||
@@ -1024,8 +1027,7 @@ void gl_set_line_function( GLcontext *ctx )
|
||||
else {
|
||||
if (ctx->Light.ShadeModel==GL_SMOOTH) {
|
||||
/* Width==1, non-stippled, smooth-shaded */
|
||||
if (ctx->Depth.Test
|
||||
|| (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
|
||||
if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
|
||||
if (rgbmode)
|
||||
ctx->Driver.LineFunc = smooth_rgba_z_line;
|
||||
else
|
||||
@@ -1040,8 +1042,7 @@ void gl_set_line_function( GLcontext *ctx )
|
||||
}
|
||||
else {
|
||||
/* Width==1, non-stippled, flat-shaded */
|
||||
if (ctx->Depth.Test
|
||||
|| (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
|
||||
if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
|
||||
if (rgbmode)
|
||||
ctx->Driver.LineFunc = flat_rgba_z_line;
|
||||
else
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: stencil.c,v 1.9 1999/11/11 01:22:27 brianp Exp $ */
|
||||
/* $Id: stencil.c,v 1.8.2.1 1999/12/04 21:15:31 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,12 +25,19 @@
|
||||
*/
|
||||
|
||||
|
||||
/* $XFree86: xc/lib/GL/mesa/src/stencil.c,v 1.3 1999/04/04 00:20:32 dawes Exp $ */
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "mem.h"
|
||||
#include "macros.h"
|
||||
#include "pb.h"
|
||||
#include "stencil.h"
|
||||
#include "types.h"
|
||||
@@ -38,15 +45,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if STENCIL_BITS==8
|
||||
# define STENCIL_MAX 0xff
|
||||
#elif STENCIL_BITS==16
|
||||
# define STENCIL_MAX 0xffff
|
||||
#else
|
||||
illegal number of stencil bits
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Return the address of a stencil buffer value given the window coords:
|
||||
@@ -54,10 +52,8 @@
|
||||
#define STENCIL_ADDRESS(X,Y) (ctx->Buffer->Stencil + ctx->Buffer->Width * (Y) + (X))
|
||||
|
||||
|
||||
void
|
||||
_mesa_ClearStencil( GLint s )
|
||||
void gl_ClearStencil( GLcontext *ctx, GLint s )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearStencil");
|
||||
ctx->Stencil.Clear = (GLstencil) s;
|
||||
|
||||
@@ -68,10 +64,8 @@ _mesa_ClearStencil( GLint s )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
|
||||
void gl_StencilFunc( GLcontext *ctx, GLenum func, GLint ref, GLuint mask )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint maxref;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilFunc");
|
||||
@@ -103,10 +97,8 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_StencilMask( GLuint mask )
|
||||
void gl_StencilMask( GLcontext *ctx, GLuint mask )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilMask");
|
||||
ctx->Stencil.WriteMask = (GLstencil) mask;
|
||||
|
||||
@@ -117,10 +109,8 @@ _mesa_StencilMask( GLuint mask )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
|
||||
void gl_StencilOp( GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp");
|
||||
switch (fail) {
|
||||
case GL_KEEP:
|
||||
@@ -178,19 +168,14 @@ _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
|
||||
/* Stencil Logic:
|
||||
|
||||
IF stencil test fails THEN
|
||||
Apply fail-op to stencil value
|
||||
Don't write the pixel (RGBA,Z)
|
||||
Execute FailOp
|
||||
ELSE
|
||||
Write the pixel
|
||||
ENDIF
|
||||
|
||||
Perform Depth Test
|
||||
|
||||
IF depth test passes OR no depth buffer THEN
|
||||
Execute ZPass
|
||||
Write the pixel
|
||||
ELSE
|
||||
Execute ZFail
|
||||
IF doing depth test && depth test fails THEN
|
||||
Apply zfail-op to stencil value
|
||||
Write RGBA and Z to appropriate buffers
|
||||
ELSE
|
||||
Apply zpass-op to stencil value
|
||||
ENDIF
|
||||
|
||||
*/
|
||||
@@ -199,21 +184,19 @@ ENDIF
|
||||
|
||||
|
||||
/*
|
||||
* Apply the given stencil operator for each pixel in the span whose
|
||||
* mask flag is set.
|
||||
* Apply the given stencil operator to the array of stencil values.
|
||||
* Don't touch stencil[i] if mask[i] is zero.
|
||||
* Input: n - number of pixels in the span
|
||||
* x, y - location of leftmost pixel in the span
|
||||
* oper - the stencil buffer operator
|
||||
* stencil - array of stencil values
|
||||
* mask - array [n] of flag: 1=apply operator, 0=don't apply operator
|
||||
*/
|
||||
static void apply_stencil_op_to_span( GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLenum oper, GLubyte mask[] )
|
||||
static void apply_stencil_op( GLcontext *ctx, GLenum oper,
|
||||
GLuint n, GLstencil stencil[], GLubyte mask[] )
|
||||
{
|
||||
const GLstencil ref = ctx->Stencil.Ref;
|
||||
const GLstencil wrtmask = ctx->Stencil.WriteMask;
|
||||
const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask);
|
||||
GLstencil *stencil = STENCIL_ADDRESS( x, y );
|
||||
GLuint i;
|
||||
|
||||
switch (oper) {
|
||||
@@ -352,7 +335,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gl_problem(ctx, "Bad stencilop in apply_stencil_op_to_span");
|
||||
gl_problem(ctx, "Bad stencil op in apply_stencil_op");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +510,9 @@ GLint gl_stencil_span( GLcontext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.FailFunc, fail );
|
||||
if (ctx->Stencil.FailFunc != GL_KEEP) {
|
||||
apply_stencil_op( ctx, ctx->Stencil.FailFunc, n, stencil, fail );
|
||||
}
|
||||
|
||||
return (allfail) ? 0 : 1;
|
||||
}
|
||||
@@ -547,11 +532,13 @@ void gl_depth_stencil_span( GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y, const GLdepth z[],
|
||||
GLubyte mask[] )
|
||||
{
|
||||
GLstencil *stencil = STENCIL_ADDRESS(x, y);
|
||||
|
||||
if (ctx->Depth.Test==GL_FALSE) {
|
||||
/*
|
||||
* No depth buffer, just apply zpass stencil function to active pixels.
|
||||
*/
|
||||
apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.ZPassFunc, mask );
|
||||
apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, mask );
|
||||
}
|
||||
else {
|
||||
/*
|
||||
@@ -560,31 +547,36 @@ void gl_depth_stencil_span( GLcontext *ctx,
|
||||
GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH];
|
||||
GLuint i;
|
||||
|
||||
/* init pass and fail masks to zero, copy mask[] to oldmask[] */
|
||||
for (i=0;i<n;i++) {
|
||||
passmask[i] = failmask[i] = 0;
|
||||
oldmask[i] = mask[i];
|
||||
}
|
||||
/* save the current mask bits */
|
||||
MEMCPY(oldmask, mask, n * sizeof(GLubyte));
|
||||
|
||||
/* apply the depth test */
|
||||
if (ctx->Driver.DepthTestSpan)
|
||||
(*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask );
|
||||
|
||||
/* set the stencil pass/fail flags according to result of depth test */
|
||||
/* Set the stencil pass/fail flags according to result of depth testing.
|
||||
* if oldmask[i] == 0 then
|
||||
* Don't touch the stencil value
|
||||
* else if oldmask[i] and newmask[i] then
|
||||
* Depth test passed
|
||||
* else
|
||||
* assert(oldmask[i] && !newmask[i])
|
||||
* Depth test failed
|
||||
* endif
|
||||
*/
|
||||
for (i=0;i<n;i++) {
|
||||
if (oldmask[i]) {
|
||||
if (mask[i]) {
|
||||
passmask[i] = 1;
|
||||
}
|
||||
else {
|
||||
failmask[i] = 1;
|
||||
}
|
||||
}
|
||||
ASSERT(mask[i] == 0 || mask[i] == 1);
|
||||
passmask[i] = oldmask[i] & mask[i];
|
||||
failmask[i] = oldmask[i] & (mask[i] ^ 1);
|
||||
}
|
||||
|
||||
/* apply the pass and fail operations */
|
||||
apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.ZFailFunc, failmask );
|
||||
apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.ZPassFunc, passmask );
|
||||
if (ctx->Stencil.ZFailFunc != GL_KEEP) {
|
||||
apply_stencil_op( ctx, ctx->Stencil.ZFailFunc, n, stencil, failmask );
|
||||
}
|
||||
if (ctx->Stencil.ZPassFunc != GL_KEEP) {
|
||||
apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, passmask );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -964,26 +956,27 @@ void gl_depth_stencil_pixels( GLcontext *ctx,
|
||||
GLubyte passmask[PB_SIZE], failmask[PB_SIZE], oldmask[PB_SIZE];
|
||||
GLuint i;
|
||||
|
||||
/* init pass and fail masks to zero */
|
||||
for (i=0;i<n;i++) {
|
||||
passmask[i] = failmask[i] = 0;
|
||||
oldmask[i] = mask[i];
|
||||
}
|
||||
/* save the current mask bits */
|
||||
MEMCPY(oldmask, mask, n * sizeof(GLubyte));
|
||||
|
||||
/* apply the depth test */
|
||||
if (ctx->Driver.DepthTestPixels)
|
||||
(*ctx->Driver.DepthTestPixels)( ctx, n, x, y, z, mask );
|
||||
|
||||
/* set the stencil pass/fail flags according to result of depth test */
|
||||
/* Set the stencil pass/fail flags according to result of depth testing.
|
||||
* if oldmask[i] == 0 then
|
||||
* Don't touch the stencil value
|
||||
* else if oldmask[i] and newmask[i] then
|
||||
* Depth test passed
|
||||
* else
|
||||
* assert(oldmask[i] && !newmask[i])
|
||||
* Depth test failed
|
||||
* endif
|
||||
*/
|
||||
for (i=0;i<n;i++) {
|
||||
if (oldmask[i]) {
|
||||
if (mask[i]) {
|
||||
passmask[i] = 1;
|
||||
}
|
||||
else {
|
||||
failmask[i] = 1;
|
||||
}
|
||||
}
|
||||
ASSERT(mask[i] == 0 || mask[i] == 1);
|
||||
passmask[i] = oldmask[i] & mask[i];
|
||||
failmask[i] = oldmask[i] & (mask[i] ^ 1);
|
||||
}
|
||||
|
||||
/* apply the pass and fail operations */
|
||||
@@ -1062,7 +1055,7 @@ void gl_alloc_stencil_buffer( GLcontext *ctx )
|
||||
ctx->Buffer->Stencil = (GLstencil *) MALLOC(buffersize * sizeof(GLstencil));
|
||||
if (!ctx->Buffer->Stencil) {
|
||||
/* out of memory */
|
||||
_mesa_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE );
|
||||
gl_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE );
|
||||
gl_error( ctx, GL_OUT_OF_MEMORY, "gl_alloc_stencil_buffer" );
|
||||
}
|
||||
}
|
||||
@@ -1083,30 +1076,63 @@ void gl_clear_stencil_buffer( GLcontext *ctx )
|
||||
|
||||
if (ctx->Scissor.Enabled) {
|
||||
/* clear scissor region only */
|
||||
GLint y;
|
||||
GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
|
||||
for (y=ctx->Buffer->Ymin; y<=ctx->Buffer->Ymax; y++) {
|
||||
GLstencil *ptr = STENCIL_ADDRESS( ctx->Buffer->Xmin, y );
|
||||
const GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
|
||||
if (ctx->Stencil.WriteMask != STENCIL_MAX) {
|
||||
/* must apply mask to the clear */
|
||||
GLint y;
|
||||
for (y=ctx->Buffer->Ymin; y<=ctx->Buffer->Ymax; y++) {
|
||||
GLstencil *ptr = STENCIL_ADDRESS( ctx->Buffer->Xmin, y );
|
||||
GLint x;
|
||||
const GLstencil mask = ctx->Stencil.WriteMask;
|
||||
const GLstencil invMask = ~mask;
|
||||
const GLstencil clearVal = (ctx->Stencil.Clear & mask);
|
||||
for (x = 0; x < width; x++) {
|
||||
ptr[x] = (ptr[x] & invMask) | clearVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* no masking */
|
||||
GLint y;
|
||||
for (y=ctx->Buffer->Ymin; y<=ctx->Buffer->Ymax; y++) {
|
||||
GLstencil *ptr = STENCIL_ADDRESS( ctx->Buffer->Xmin, y );
|
||||
#if STENCIL_BITS==8
|
||||
MEMSET( ptr, ctx->Stencil.Clear, width * sizeof(GLstencil) );
|
||||
MEMSET( ptr, ctx->Stencil.Clear, width * sizeof(GLstencil) );
|
||||
#else
|
||||
GLint x;
|
||||
for (x = 0; x < width; x++)
|
||||
ptr[x] = ctx->Stencil.Clear;
|
||||
GLint x;
|
||||
for (x = 0; x < width; x++)
|
||||
ptr[x] = ctx->Stencil.Clear;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* clear whole stencil buffer */
|
||||
if (ctx->Stencil.WriteMask != STENCIL_MAX) {
|
||||
/* must apply mask to the clear */
|
||||
const GLuint n = ctx->Buffer->Width * ctx->Buffer->Height;
|
||||
GLstencil *buffer = ctx->Buffer->Stencil;
|
||||
const GLstencil mask = ctx->Stencil.WriteMask;
|
||||
const GLstencil invMask = ~mask;
|
||||
const GLstencil clearVal = (ctx->Stencil.Clear & mask);
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
buffer[i] = (buffer[i] & invMask) | clearVal;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* clear whole buffer without masking */
|
||||
const GLuint n = ctx->Buffer->Width * ctx->Buffer->Height;
|
||||
GLstencil *buffer = ctx->Buffer->Stencil;
|
||||
|
||||
#if STENCIL_BITS==8
|
||||
MEMSET( ctx->Buffer->Stencil, ctx->Stencil.Clear,
|
||||
ctx->Buffer->Width * ctx->Buffer->Height * sizeof(GLstencil) );
|
||||
MEMSET(buffer, ctx->Stencil.Clear, n * sizeof(GLstencil) );
|
||||
#else
|
||||
GLuint i;
|
||||
GLuint pixels = ctx->Buffer->Width * ctx->Buffer->Height;
|
||||
GLstencil *buffer = ctx->Buffer->Stencil;
|
||||
for (i = 0; i < pixels; i++)
|
||||
ptr[i] = ctx->Stencil.Clear;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
buffer[i] = ctx->Stencil.Clear;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: texobj.c,v 1.8 1999/11/11 01:22:28 brianp Exp $ */
|
||||
/* $Id: texobj.c,v 1.7.2.1 1999/12/01 21:07:26 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -23,16 +23,25 @@
|
||||
* 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/texobj.c,v 1.3 1999/04/04 00:20:32 dawes Exp $ */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "enums.h"
|
||||
#include "hash.h"
|
||||
#include "mem.h"
|
||||
#include "macros.h"
|
||||
#include "teximage.h"
|
||||
#include "texstate.h"
|
||||
#include "texobj.h"
|
||||
@@ -56,7 +65,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
|
||||
{
|
||||
struct gl_texture_object *obj;
|
||||
|
||||
assert(dimensions <= 3);
|
||||
ASSERT(dimensions <= 3);
|
||||
|
||||
obj = (struct gl_texture_object *)
|
||||
calloc(1,sizeof(struct gl_texture_object));
|
||||
@@ -74,13 +83,13 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
|
||||
obj->BaseLevel = 0;
|
||||
obj->MaxLevel = 1000;
|
||||
obj->MinMagThresh = 0.0F;
|
||||
obj->Palette.Table[0] = 255;
|
||||
obj->Palette.Table[1] = 255;
|
||||
obj->Palette.Table[2] = 255;
|
||||
obj->Palette.Table[3] = 255;
|
||||
obj->Palette.Size = 1;
|
||||
obj->Palette.IntFormat = GL_RGBA;
|
||||
obj->Palette.Format = GL_RGBA;
|
||||
obj->Palette[0] = 255;
|
||||
obj->Palette[1] = 255;
|
||||
obj->Palette[2] = 255;
|
||||
obj->Palette[3] = 255;
|
||||
obj->PaletteSize = 1;
|
||||
obj->PaletteIntFormat = GL_RGBA;
|
||||
obj->PaletteFormat = GL_RGBA;
|
||||
|
||||
/* insert into linked list */
|
||||
if (shared) {
|
||||
@@ -325,10 +334,8 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur
|
||||
/*
|
||||
* Execute glGenTextures
|
||||
*/
|
||||
void
|
||||
_mesa_GenTextures( GLsizei n, GLuint *texName )
|
||||
void gl_GenTextures( GLcontext *ctx, GLsizei n, GLuint *texName )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint first;
|
||||
GLint i;
|
||||
|
||||
@@ -358,10 +365,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName )
|
||||
/*
|
||||
* Execute glDeleteTextures
|
||||
*/
|
||||
void
|
||||
_mesa_DeleteTextures( GLsizei n, const GLuint *texName)
|
||||
void gl_DeleteTextures( GLcontext *ctx, GLsizei n, const GLuint *texName)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures");
|
||||
@@ -404,10 +409,8 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName)
|
||||
/*
|
||||
* Execute glBindTexture
|
||||
*/
|
||||
void
|
||||
_mesa_BindTexture( GLenum target, GLuint texName )
|
||||
void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = ctx->Texture.CurrentUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
|
||||
struct gl_texture_object *oldTexObj;
|
||||
@@ -420,14 +423,21 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture");
|
||||
|
||||
dim = (GLuint) (target - GL_TEXTURE_1D);
|
||||
|
||||
if (dim < 0 || dim > 2) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" );
|
||||
return;
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
dim = 1;
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
dim = 2;
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
dim = 3;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
|
||||
return;
|
||||
}
|
||||
|
||||
dim++;
|
||||
oldTexObj = texUnit->CurrentD[dim];
|
||||
|
||||
if (oldTexObj->Name == texName)
|
||||
@@ -444,6 +454,7 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
||||
|
||||
if (newTexObj->Dimensions != dim) {
|
||||
if (newTexObj->Dimensions) {
|
||||
/* the named texture object's dimensions don't match the target */
|
||||
gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" );
|
||||
return;
|
||||
}
|
||||
@@ -498,11 +509,10 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
||||
/*
|
||||
* Execute glPrioritizeTextures
|
||||
*/
|
||||
void
|
||||
_mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
|
||||
const GLclampf *priorities )
|
||||
void gl_PrioritizeTextures( GLcontext *ctx,
|
||||
GLsizei n, const GLuint *texName,
|
||||
const GLclampf *priorities )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures");
|
||||
@@ -531,11 +541,10 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
|
||||
/*
|
||||
* Execute glAreTexturesResident
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_AreTexturesResident( GLsizei n, const GLuint *texName,
|
||||
GLboolean *residences )
|
||||
GLboolean gl_AreTexturesResident( GLcontext *ctx, GLsizei n,
|
||||
const GLuint *texName,
|
||||
GLboolean *residences )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLboolean resident = GL_TRUE;
|
||||
GLint i;
|
||||
|
||||
@@ -574,10 +583,8 @@ _mesa_AreTexturesResident( GLsizei n, const GLuint *texName,
|
||||
/*
|
||||
* Execute glIsTexture
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_IsTexture( GLuint texture )
|
||||
GLboolean gl_IsTexture( GLcontext *ctx, GLuint texture )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
|
||||
GL_FALSE);
|
||||
if (texture>0 && HashLookup(ctx->Shared->TexObjects, texture)) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: texstate.c,v 1.5 1999/11/11 01:22:28 brianp Exp $ */
|
||||
/* $Id: texstate.c,v 1.4.2.2 1999/11/22 13:54:02 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.1
|
||||
*
|
||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -25,12 +25,19 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "enums.h"
|
||||
#include "extensions.h"
|
||||
#include "macros.h"
|
||||
#include "matrix.h"
|
||||
#include "texobj.h"
|
||||
@@ -60,10 +67,9 @@
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
|
||||
void gl_TexEnvfv( GLcontext *ctx,
|
||||
GLenum target, GLenum pname, const GLfloat *param )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv");
|
||||
@@ -88,9 +94,8 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
|
||||
case GL_BLEND:
|
||||
case GL_DECAL:
|
||||
case GL_REPLACE:
|
||||
/* A small optimization for drivers */
|
||||
if (texUnit->EnvMode == mode)
|
||||
return;
|
||||
return; /* no change */
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glTexEnv: old mode %s, new mode %s\n",
|
||||
@@ -123,40 +128,12 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
|
||||
|
||||
|
||||
|
||||
void gl_GetTexEnvfv( GLcontext *ctx,
|
||||
GLenum target, GLenum pname, GLfloat *params )
|
||||
{
|
||||
_mesa_TexEnvfv( target, pname, ¶m );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
|
||||
{
|
||||
GLfloat p[4];
|
||||
p[0] = (GLfloat) param;
|
||||
p[1] = p[2] = p[3] = 0.0;
|
||||
_mesa_TexEnvfv( target, pname, p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
|
||||
{
|
||||
GLfloat p[4];
|
||||
p[0] = INT_TO_FLOAT( param[0] );
|
||||
p[1] = INT_TO_FLOAT( param[1] );
|
||||
p[2] = INT_TO_FLOAT( param[2] );
|
||||
p[3] = INT_TO_FLOAT( param[3] );
|
||||
_mesa_TexEnvfv( target, pname, p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
if (target!=GL_TEXTURE_ENV) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
|
||||
@@ -175,10 +152,9 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
|
||||
void gl_GetTexEnviv( GLcontext *ctx,
|
||||
GLenum target, GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
if (target!=GL_TEXTURE_ENV) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
|
||||
@@ -207,17 +183,9 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
|
||||
void gl_TexParameterfv( GLcontext *ctx,
|
||||
GLenum target, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
_mesa_TexParameterfv(target, pname, ¶m);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
GLenum eparam = (GLenum) (GLint) params[0];
|
||||
struct gl_texture_object *texObj;
|
||||
@@ -362,41 +330,20 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexParameteri( GLenum target, GLenum pname, const GLint param )
|
||||
{
|
||||
GLfloat fparam[4];
|
||||
fparam[0] = (GLfloat) param;
|
||||
fparam[1] = fparam[2] = fparam[3] = 0.0;
|
||||
_mesa_TexParameterfv(target, pname, fparam);
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
|
||||
{
|
||||
GLfloat fparam[4];
|
||||
fparam[0] = (GLfloat) params[0];
|
||||
fparam[1] = fparam[2] = fparam[3] = 0.0;
|
||||
_mesa_TexParameterfv(target, pname, fparam);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
|
||||
GLenum pname, GLfloat *params )
|
||||
void gl_GetTexLevelParameterfv( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum pname, GLfloat *params )
|
||||
{
|
||||
GLint iparam;
|
||||
_mesa_GetTexLevelParameteriv( target, level, pname, &iparam );
|
||||
gl_GetTexLevelParameteriv( ctx, target, level, pname, &iparam );
|
||||
*params = (GLfloat) iparam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
||||
GLenum pname, GLint *params )
|
||||
void gl_GetTexLevelParameteriv( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
const struct gl_texture_image *img = NULL;
|
||||
GLuint dimensions;
|
||||
@@ -501,10 +448,10 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
|
||||
|
||||
void gl_GetTexParameterfv( GLcontext *ctx,
|
||||
GLenum target, GLenum pname, GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
struct gl_texture_object *obj;
|
||||
|
||||
@@ -569,10 +516,9 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
|
||||
void gl_GetTexParameteriv( GLcontext *ctx,
|
||||
GLenum target, GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
struct gl_texture_object *obj;
|
||||
|
||||
@@ -651,10 +597,9 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
||||
void gl_TexGenfv( GLcontext *ctx,
|
||||
GLenum coord, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexGenfv");
|
||||
@@ -665,7 +610,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
||||
gl_lookup_enum_by_nr(pname),
|
||||
*(int *)params);
|
||||
|
||||
switch (coord) {
|
||||
switch( coord ) {
|
||||
case GL_S:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
GLenum mode = (GLenum) (GLint) *params;
|
||||
@@ -851,57 +796,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
|
||||
|
||||
void gl_GetTexGendv( GLcontext *ctx,
|
||||
GLenum coord, GLenum pname, GLdouble *params )
|
||||
{
|
||||
GLfloat p[4];
|
||||
p[0] = params[0];
|
||||
p[1] = params[1];
|
||||
p[2] = params[2];
|
||||
p[3] = params[3];
|
||||
_mesa_TexGenfv(coord, pname, p);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
|
||||
{
|
||||
GLfloat p = (GLfloat) param;
|
||||
_mesa_TexGenfv( coord, pname, &p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
|
||||
{
|
||||
GLfloat p[4];
|
||||
p[0] = params[0];
|
||||
p[1] = params[1];
|
||||
p[2] = params[2];
|
||||
p[3] = params[3];
|
||||
_mesa_TexGenfv( coord, pname, p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
|
||||
{
|
||||
_mesa_TexGenfv(coord, pname, ¶m);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
|
||||
{
|
||||
_mesa_TexGeniv( coord, pname, ¶m );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
|
||||
@@ -976,10 +874,9 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
|
||||
void gl_GetTexGenfv( GLcontext *ctx,
|
||||
GLenum coord, GLenum pname, GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
|
||||
@@ -1054,10 +951,9 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
|
||||
void gl_GetTexGeniv( GLcontext *ctx,
|
||||
GLenum coord, GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
|
||||
@@ -1087,7 +983,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
|
||||
break;
|
||||
case GL_T:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
params[0] = texUnit->GenModeT;
|
||||
params[0] = (GLint) texUnit->GenModeT;
|
||||
}
|
||||
else if (pname==GL_OBJECT_PLANE) {
|
||||
params[0] = (GLint) texUnit->ObjectPlaneT[0];
|
||||
@@ -1108,7 +1004,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
|
||||
break;
|
||||
case GL_R:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
params[0] = texUnit->GenModeR;
|
||||
params[0] = (GLint) texUnit->GenModeR;
|
||||
}
|
||||
else if (pname==GL_OBJECT_PLANE) {
|
||||
params[0] = (GLint) texUnit->ObjectPlaneR[0];
|
||||
@@ -1129,7 +1025,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
|
||||
break;
|
||||
case GL_Q:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
params[0] = texUnit->GenModeQ;
|
||||
params[0] = (GLint) texUnit->GenModeQ;
|
||||
}
|
||||
else if (pname==GL_OBJECT_PLANE) {
|
||||
params[0] = (GLint) texUnit->ObjectPlaneQ[0];
|
||||
@@ -1142,7 +1038,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
|
||||
params[1] = (GLint) texUnit->EyePlaneQ[1];
|
||||
params[2] = (GLint) texUnit->EyePlaneQ[2];
|
||||
params[3] = (GLint) texUnit->EyePlaneQ[3];
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
|
||||
return;
|
||||
@@ -1156,10 +1052,8 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
|
||||
|
||||
|
||||
/* GL_ARB_multitexture */
|
||||
void
|
||||
_mesa_ActiveTextureARB( GLenum target )
|
||||
void gl_ActiveTexture( GLcontext *ctx, GLenum target )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint maxUnits = ctx->Const.MaxTextureUnits;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END( ctx, "glActiveTextureARB" );
|
||||
@@ -1183,10 +1077,8 @@ _mesa_ActiveTextureARB( GLenum target )
|
||||
|
||||
|
||||
/* GL_ARB_multitexture */
|
||||
void
|
||||
_mesa_ClientActiveTextureARB( GLenum target )
|
||||
void gl_ClientActiveTexture( GLcontext *ctx, GLenum target )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint maxUnits = ctx->Const.MaxTextureUnits;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END( ctx, "glClientActiveTextureARB" );
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: varray.c,v 1.14 1999/11/11 01:22:28 brianp Exp $ */
|
||||
/* $Id: varray.c,v 1.13.2.3 1999/12/01 12:18:47 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -27,8 +27,15 @@
|
||||
#ifdef PC_HEADER
|
||||
#include "all.h"
|
||||
#else
|
||||
#include "glheader.h"
|
||||
#ifndef XFree86Server
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#else
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#include "context.h"
|
||||
#include "api.h"
|
||||
#include "cva.h"
|
||||
#include "enable.h"
|
||||
#include "enums.h"
|
||||
@@ -47,14 +54,24 @@
|
||||
#include "vbindirect.h"
|
||||
#include "vbxform.h"
|
||||
#include "xform.h"
|
||||
#ifdef XFree86Server
|
||||
#include "GL/xf86glx.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) && !defined(GLX_USE_DLOPEN)
|
||||
#define NEED_MESA_FUNCS_WRAPPED
|
||||
#include "mesa_api.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
void GLAPIENTRY glVertexPointer(CTX_ARG GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *ptr )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLcontext *ctx;
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
if (size<2 || size>4) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" );
|
||||
@@ -103,10 +120,13 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
|
||||
void GLAPIENTRY glNormalPointer(CTX_ARG GLenum type, GLsizei stride,
|
||||
const GLvoid *ptr )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLcontext *ctx;
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
if (stride<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" );
|
||||
@@ -152,11 +172,13 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
void GLAPIENTRY glColorPointer(CTX_ARG GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *ptr )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
GLcontext *ctx;
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
if (size<3 || size>4) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
|
||||
return;
|
||||
@@ -215,10 +237,13 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
void GLAPIENTRY glIndexPointer(CTX_ARG GLenum type, GLsizei stride,
|
||||
const GLvoid *ptr )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLcontext *ctx;
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
if (stride<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" );
|
||||
@@ -259,12 +284,16 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
void GLAPIENTRY glTexCoordPointer(CTX_ARG GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *ptr )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint texUnit;
|
||||
|
||||
GLcontext *ctx;
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
texUnit = ctx->Array.ActiveTexture;
|
||||
|
||||
if (size<1 || size>4) {
|
||||
@@ -317,11 +346,14 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_EdgeFlagPointer(GLsizei stride, const void *vptr)
|
||||
void GLAPIENTRY glEdgeFlagPointer(CTX_ARG GLsizei stride, const void *vptr )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
const GLboolean *ptr = (GLboolean *)vptr;
|
||||
|
||||
GLcontext *ctx;
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
if (stride<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" );
|
||||
@@ -438,42 +470,8 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM,
|
||||
|
||||
|
||||
|
||||
/* Enough funny business going on in here it might be quicker to use a
|
||||
* function pointer.
|
||||
*/
|
||||
#define ARRAY_ELT( IM, i ) \
|
||||
{ \
|
||||
GLuint count = IM->Count; \
|
||||
IM->Elt[count] = i; \
|
||||
IM->Flag[count] = ((IM->Flag[count] & IM->ArrayAndFlags) | \
|
||||
VERT_ELT); \
|
||||
IM->FlushElt |= IM->ArrayEltFlush; \
|
||||
IM->Count = count += IM->ArrayIncr; \
|
||||
if (count == VB_MAX) \
|
||||
IM->maybe_transform_vb( IM ); \
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_ArrayElement( GLint i )
|
||||
void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
|
||||
{
|
||||
GET_IMMEDIATE;
|
||||
ARRAY_ELT( IM, i );
|
||||
}
|
||||
|
||||
|
||||
void gl_ArrayElement( GLcontext *CC, GLint i )
|
||||
{
|
||||
struct immediate *im = CC->input;
|
||||
ARRAY_ELT( im, i );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct vertex_buffer *VB = ctx->VB;
|
||||
GLint i;
|
||||
|
||||
@@ -505,14 +503,23 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
* rendering to keep it turned on.
|
||||
*/
|
||||
relock = ctx->CompileCVAFlag;
|
||||
ctx->CompileCVAFlag = 0;
|
||||
|
||||
if (!elt->pipeline_valid || relock)
|
||||
if (relock) {
|
||||
ctx->CompileCVAFlag = 0;
|
||||
elt->pipeline_valid = 0;
|
||||
}
|
||||
|
||||
if (!elt->pipeline_valid)
|
||||
gl_build_immediate_pipeline( ctx );
|
||||
|
||||
required = elt->inputs;
|
||||
fallback = (elt->inputs & ~ctx->Array.Summary);
|
||||
|
||||
/* The translate function doesn't do anything about size. It
|
||||
* just ensures that type and stride come out right.
|
||||
*/
|
||||
IM->v.Obj.size = ctx->Array.Vertex.Size;
|
||||
|
||||
if (required & VERT_RGBA)
|
||||
{
|
||||
Color = &ctx->Array.Color;
|
||||
@@ -585,7 +592,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
VB->NextPrimitive = IM->NextPrimitive;
|
||||
VB->MaterialMask = IM->MaterialMask;
|
||||
VB->Material = IM->Material;
|
||||
VB->BoundsPtr = 0;
|
||||
VB->BoundsPtr = 0;
|
||||
|
||||
while (remaining > 0) {
|
||||
GLint vbspace = VB_MAX - VB_START;
|
||||
@@ -669,6 +676,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
|
||||
VB->NextPrimitive[VB->CopyStart] = VB->Count;
|
||||
VB->Primitive[VB->CopyStart] = mode;
|
||||
ctx->Array.Flag[count] |= VERT_END_VB;
|
||||
|
||||
/* Transform and render.
|
||||
*/
|
||||
@@ -682,7 +690,12 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
remaining -= n;
|
||||
}
|
||||
|
||||
ctx->CompileCVAFlag = relock;
|
||||
gl_reset_input( ctx );
|
||||
|
||||
if (relock) {
|
||||
ctx->CompileCVAFlag = relock;
|
||||
elt->pipeline_valid = 0;
|
||||
}
|
||||
}
|
||||
else if (ctx->Array.Vertex.Enabled)
|
||||
{
|
||||
@@ -783,13 +796,16 @@ static GLuint natural_stride[0x10] =
|
||||
0 /* f */
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
|
||||
void GLAPIENTRY glDrawElements(CTX_ARG GLenum mode, GLsizei count,
|
||||
GLenum type, const GLvoid *indices )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLcontext *ctx;
|
||||
struct gl_cva *cva;
|
||||
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
cva = &ctx->CVA;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawElements");
|
||||
|
||||
@@ -899,10 +915,10 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
||||
void GLAPIENTRY glInterleavedArrays(CTX_ARG GLenum format, GLsizei stride,
|
||||
const GLvoid *pointer )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLcontext *ctx;
|
||||
GLboolean tflag, cflag, nflag; /* enable/disable flags */
|
||||
GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */
|
||||
|
||||
@@ -912,6 +928,11 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
||||
GLint c, f;
|
||||
GLint coordUnitSave;
|
||||
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
|
||||
f = sizeof(GLfloat);
|
||||
c = f * ((4*sizeof(GLubyte) + (f-1)) / f);
|
||||
|
||||
@@ -1035,8 +1056,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
||||
stride = defstride;
|
||||
}
|
||||
|
||||
_mesa_DisableClientState( GL_EDGE_FLAG_ARRAY );
|
||||
_mesa_DisableClientState( GL_INDEX_ARRAY );
|
||||
gl_DisableClientState( ctx, GL_EDGE_FLAG_ARRAY );
|
||||
gl_DisableClientState( ctx, GL_INDEX_ARRAY );
|
||||
|
||||
/* Texcoords */
|
||||
coordUnitSave = ctx->Array.ActiveTexture;
|
||||
@@ -1044,61 +1065,63 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
||||
GLint i;
|
||||
GLint factor = ctx->Array.TexCoordInterleaveFactor;
|
||||
for (i = 0; i < factor; i++) {
|
||||
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
_mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
glTexCoordPointer( tcomps, GL_FLOAT, stride,
|
||||
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
gl_EnableClientState( ctx, GL_TEXTURE_COORD_ARRAY );
|
||||
glTexCoordPointer(CTX_PRM tcomps, GL_FLOAT, stride,
|
||||
(GLubyte *) pointer + i * coffset );
|
||||
}
|
||||
for (i = factor; i < ctx->Const.MaxTextureUnits; i++) {
|
||||
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
gl_DisableClientState( ctx, GL_TEXTURE_COORD_ARRAY );
|
||||
}
|
||||
}
|
||||
else {
|
||||
GLint i;
|
||||
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
|
||||
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
gl_DisableClientState( ctx, GL_TEXTURE_COORD_ARRAY );
|
||||
}
|
||||
}
|
||||
/* Restore texture coordinate unit index */
|
||||
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) );
|
||||
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) );
|
||||
|
||||
|
||||
/* Color */
|
||||
if (cflag) {
|
||||
_mesa_EnableClientState( GL_COLOR_ARRAY );
|
||||
glColorPointer( ccomps, ctype, stride,
|
||||
gl_EnableClientState( ctx, GL_COLOR_ARRAY );
|
||||
glColorPointer(CTX_PRM ccomps, ctype, stride,
|
||||
(GLubyte*) pointer + coffset );
|
||||
}
|
||||
else {
|
||||
_mesa_DisableClientState( GL_COLOR_ARRAY );
|
||||
gl_DisableClientState( ctx, GL_COLOR_ARRAY );
|
||||
}
|
||||
|
||||
|
||||
/* Normals */
|
||||
if (nflag) {
|
||||
_mesa_EnableClientState( GL_NORMAL_ARRAY );
|
||||
glNormalPointer( GL_FLOAT, stride,
|
||||
gl_EnableClientState( ctx, GL_NORMAL_ARRAY );
|
||||
glNormalPointer(CTX_PRM GL_FLOAT, stride,
|
||||
(GLubyte*) pointer + noffset );
|
||||
}
|
||||
else {
|
||||
_mesa_DisableClientState( GL_NORMAL_ARRAY );
|
||||
gl_DisableClientState( ctx, GL_NORMAL_ARRAY );
|
||||
}
|
||||
|
||||
_mesa_EnableClientState( GL_VERTEX_ARRAY );
|
||||
glVertexPointer( vcomps, GL_FLOAT, stride,
|
||||
gl_EnableClientState( ctx, GL_VERTEX_ARRAY );
|
||||
glVertexPointer(CTX_PRM vcomps, GL_FLOAT, stride,
|
||||
(GLubyte *) pointer + voffset );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_DrawRangeElements(GLenum mode, GLuint start,
|
||||
GLuint end, GLsizei count,
|
||||
GLenum type, const GLvoid *indices)
|
||||
void GLAPIENTRY glDrawRangeElements(CTX_ARG GLenum mode, GLuint start,
|
||||
GLuint end, GLsizei count,
|
||||
GLenum type, const GLvoid *indices )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLcontext *ctx;
|
||||
GET_CONTEXT;
|
||||
CHECK_CONTEXT;
|
||||
ctx = CC;
|
||||
|
||||
if (end < start) {
|
||||
gl_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements( end < start )");
|
||||
@@ -1106,11 +1129,11 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start,
|
||||
}
|
||||
|
||||
if (!ctx->Array.LockCount && 2*count > (GLint) 3*(end-start)) {
|
||||
glLockArraysEXT( start, end );
|
||||
glDrawElements( mode, count, type, indices );
|
||||
glUnlockArraysEXT();
|
||||
glLockArraysEXT(CTX_PRM start, end );
|
||||
glDrawElements(CTX_PRM mode, count, type, indices );
|
||||
glUnlockArraysEXT(CTX_VPRM );
|
||||
} else {
|
||||
glDrawElements( mode, count, type, indices );
|
||||
glDrawElements(CTX_PRM mode, count, type, indices );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1464,7 +1464,7 @@
|
||||
#else
|
||||
#define P_ARG1(a) a
|
||||
#define P_ARG2(a, b) a, b
|
||||
#define P_ARG3(a, b) a, b, c
|
||||
#define P_ARG3(a, b, c) a, b, c
|
||||
#endif
|
||||
|
||||
/* MMX */
|
||||
@@ -1570,22 +1570,22 @@
|
||||
#define CMPPS(a, b, c) cmpps P_ARG3(a, b, c)
|
||||
#define CMPSS(a, b, c) cmpss P_ARG3(a, b, c)
|
||||
*/
|
||||
#define CMPEQPS(a, b) cmpeqps P_ARG3(a, b)
|
||||
#define CMPLTPS(a, b) cmpltps P_ARG3(a, b)
|
||||
#define CMPLEPS(a, b) cmpleps P_ARG3(a, b)
|
||||
#define CMPUNORDPS(a, b) cmpunordps P_ARG3(a, b)
|
||||
#define CMPNEQPS(a, b) cmpneqps P_ARG3(a, b)
|
||||
#define CMPNLTPS(a, b) cmpnltps P_ARG3(a, b)
|
||||
#define CMPNLEPS(a, b) cmpnleps P_ARG3(a, b)
|
||||
#define CMPORDPS(a, b) cmpordps P_ARG3(a, b)
|
||||
#define CMPEQSS(a, b) cmpeqss P_ARG3(a, b)
|
||||
#define CMPLTSS(a, b) cmpltss P_ARG3(a, b)
|
||||
#define CMPLESS(a, b) cmpless P_ARG3(a, b)
|
||||
#define CMPUNORDSS(a, b) cmpunordss P_ARG3(a, b)
|
||||
#define CMPNEQSS(a, b) cmpneqss P_ARG3(a, b)
|
||||
#define CMPNLTSS(a, b) cmpnltss P_ARG3(a, b)
|
||||
#define CMPNLESS(a, b) cmpnless P_ARG3(a, b)
|
||||
#define CMPORDSS(a, b) cmpordss P_ARG3(a, b)
|
||||
#define CMPEQPS(a, b) cmpeqps P_ARG2(a, b)
|
||||
#define CMPLTPS(a, b) cmpltps P_ARG2(a, b)
|
||||
#define CMPLEPS(a, b) cmpleps P_ARG2(a, b)
|
||||
#define CMPUNORDPS(a, b) cmpunordps P_ARG2(a, b)
|
||||
#define CMPNEQPS(a, b) cmpneqps P_ARG2(a, b)
|
||||
#define CMPNLTPS(a, b) cmpnltps P_ARG2(a, b)
|
||||
#define CMPNLEPS(a, b) cmpnleps P_ARG2(a, b)
|
||||
#define CMPORDPS(a, b) cmpordps P_ARG2(a, b)
|
||||
#define CMPEQSS(a, b) cmpeqss P_ARG2(a, b)
|
||||
#define CMPLTSS(a, b) cmpltss P_ARG2(a, b)
|
||||
#define CMPLESS(a, b) cmpless P_ARG2(a, b)
|
||||
#define CMPUNORDSS(a, b) cmpunordss P_ARG2(a, b)
|
||||
#define CMPNEQSS(a, b) cmpneqss P_ARG2(a, b)
|
||||
#define CMPNLTSS(a, b) cmpnltss P_ARG2(a, b)
|
||||
#define CMPNLESS(a, b) cmpnless P_ARG2(a, b)
|
||||
#define CMPORDSS(a, b) cmpordss P_ARG2(a, b)
|
||||
#define COMISS(a, b) comiss P_ARG2(a, b)
|
||||
#define CVTPI2PS(a, b) cvtpi2ps P_ARG2(a, b)
|
||||
#define CVTPS2PI(a, b) cvtps2pi P_ARG2(a, b)
|
||||
|
@@ -37,6 +37,12 @@
|
||||
|
||||
int gl_x86_cpu_features = 0;
|
||||
|
||||
static void message(const char *msg)
|
||||
{
|
||||
if (getenv("MESA_DEBUG"))
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
}
|
||||
|
||||
|
||||
void gl_init_all_x86_asm (void)
|
||||
{
|
||||
@@ -48,7 +54,7 @@ void gl_init_all_x86_asm (void)
|
||||
gl_x86_cpu_features = 0;
|
||||
|
||||
if (gl_x86_cpu_features & GL_CPU_GenuineIntel) {
|
||||
fprintf (stderr, "GenuineIntel cpu detected.\n");
|
||||
message("GenuineIntel cpu detected.");
|
||||
}
|
||||
|
||||
if (gl_x86_cpu_features) {
|
||||
@@ -59,7 +65,7 @@ void gl_init_all_x86_asm (void)
|
||||
if (gl_x86_cpu_features & GL_CPU_MMX) {
|
||||
char *s = getenv( "MESA_NO_MMX" );
|
||||
if (s == NULL) {
|
||||
fprintf (stderr, "MMX cpu detected.\n");
|
||||
message("MMX cpu detected.");
|
||||
} else {
|
||||
gl_x86_cpu_features &= (~GL_CPU_MMX);
|
||||
}
|
||||
@@ -71,7 +77,7 @@ void gl_init_all_x86_asm (void)
|
||||
if (gl_x86_cpu_features & GL_CPU_3Dnow) {
|
||||
char *s = getenv( "MESA_NO_3DNOW" );
|
||||
if (s == NULL) {
|
||||
fprintf (stderr, "3Dnow cpu detected.\n");
|
||||
message("3Dnow cpu detected.");
|
||||
gl_init_3dnow_asm_transforms ();
|
||||
} else {
|
||||
gl_x86_cpu_features &= (~GL_CPU_3Dnow);
|
||||
|
Reference in New Issue
Block a user