Compare commits

..

113 Commits

Author SHA1 Message Date
Brian Paul
6faeeb59ba BeOS update 2003-03-30 16:07:16 +00:00
Brian Paul
0670bb52e2 enable 1.4 extensions 2003-03-30 15:48:48 +00:00
Brian Paul
42ed7b78c3 DOS updates from Daniel Borca 2003-03-29 16:11:21 +00:00
Brian Paul
c44e5d39a5 fix an assertion (Heath Feather) 2003-03-28 22:01:08 +00:00
Brian Paul
af709ec217 disable 3Dnow normal transformation code until it's fixed 2003-03-28 15:42:50 +00:00
Brian Paul
c6c35a0d7e version tweak 2003-03-27 18:35:55 +00:00
Brian Paul
4ccebff103 added autoconf bug fixes, set March 30 for release date 2003-03-27 18:32:40 +00:00
Brian Paul
0a89996605 5.0.1 version bumps 2003-03-27 17:57:18 +00:00
Brian Paul
3bff7aed0e added ColorMask fix 2003-03-27 17:53:23 +00:00
Brian Paul
605b7859c2 fixed ColorMask problem for front-buffer rendering 2003-03-27 17:50:26 +00:00
Brian Paul
bc0359a076 vertex program EXP fix 2003-03-25 00:01:45 +00:00
Brian Paul
6677a919f1 add 2, not 4, in _mesa_get_compressed_formats() 2003-03-24 20:00:36 +00:00
Brian Paul
b099d2137e fix GL_COLOR_MATERIAL bug 2003-03-21 13:18:16 +00:00
Brian Paul
b58c0dec59 DJGPP tweaks 2003-03-11 15:34:29 +00:00
Brian Paul
9935d3434d fix/improve glAreTextures/ProgramsResident (Jose Fonseca) 2003-03-10 00:29:17 +00:00
Brian Paul
b28cbbf5a4 DOS update (Daniel Borca) 2003-03-08 18:27:18 +00:00
Brian Paul
a5213e2cac fix a warning when GLchan==GLfloat 2003-03-04 19:24:20 +00:00
Brian Paul
e62a6bdb3a include macros.h for CLAMP 2003-03-04 19:23:52 +00:00
Brian Paul
7709bd06f2 better error messages (Leif Delgass) 2003-03-03 15:39:38 +00:00
Brian Paul
4b3f54ecb1 added glFinish with comment 2003-03-03 03:14:55 +00:00
Brian Paul
3a55d83d21 added extern "C" for C++ 2003-03-02 19:38:44 +00:00
Brian Paul
6899598be8 removed extra _mesa_memset16() prototype 2003-03-02 19:35:51 +00:00
Brian Paul
88db8b061b remove some MESA_DEBUG stuff 2003-03-02 19:31:48 +00:00
Karl Schultz
8b0f7c5ab7 fix compilation error on Windows. 2003-02-28 18:03:45 +00:00
Brian Paul
683dba1164 minimal support for GL_ATI_texture_env_combine3, merge with DRI trunk 2003-02-28 16:28:11 +00:00
Brian Paul
4965446dbd fix GLchan==GLfloat bug in solve_plane_chan (bug 694546) 2003-02-28 15:47:56 +00:00
Brian Paul
9c3b611b85 fix GLchan==GLfloat bug in solve_plane_chan (bug 694546) 2003-02-28 15:09:27 +00:00
Brian Paul
48f8949cd2 fix a cast (bug 694546) 2003-02-27 23:38:23 +00:00
Brian Paul
cd4fc963a4 fix bug 694461 2003-02-27 18:16:12 +00:00
Brian Paul
c24d9b330e fix float color interpolation (bug 694461) 2003-02-27 18:14:54 +00:00
Brian Paul
62968d677c fixed AA line/triangle Z value issue 2003-02-21 21:01:57 +00:00
Brian Paul
5e4a96980e use IROUND to convert depth values from float to int (bug 690728) 2003-02-21 21:01:14 +00:00
Brian Paul
6397f53174 added bug fix 689964 2003-02-21 00:19:59 +00:00
Brian Paul
3de75f6f68 fix zoom/clipping bug 689964 2003-02-21 00:17:48 +00:00
Brian Paul
d1f324a779 updated DOS files for tarball 2003-02-20 15:52:59 +00:00
Brian Paul
3442cd9a9f latest DOS updates (Daniel Borca) 2003-02-20 15:41:34 +00:00
Brian Paul
324616ed83 bug 686811 fix 2003-02-17 15:42:30 +00:00
Brian Paul
6c59c0b9ec fixed bad zoomed.zStep assignment (bug 687811) 2003-02-17 15:41:33 +00:00
Brian Paul
2ccb06cb4e version number bumps, clarify src-glu vs si-glu 2003-02-13 15:58:56 +00:00
Brian Paul
7b1b099af3 replace APIENTRY with GLUTAPIENTRY to be consistant with glut.h 2003-02-12 23:57:43 +00:00
Brian Paul
6accaacbed added OS/2 includes 2003-02-12 16:04:45 +00:00
Brian Paul
30beb26dbb added rules for making bz2 files and md5 checksums 2003-02-08 22:09:25 +00:00
Brian Paul
735a8aee5a Fix FABSF on NeXT. Disable SPARC normal xform code 2003-02-08 15:44:37 +00:00
Brian Paul
764b1d5455 disable normal xform code - see bug 673938 2003-02-08 15:43:27 +00:00
Brian Paul
b87a9089da fix assertion in transfer_teximage() (Laurent Desnogues) 2003-02-06 13:50:38 +00:00
Brian Paul
69a4ff186a replace | with & (Laurent Desnogues) 2003-02-06 13:47:32 +00:00
Brian Paul
d16d5fb06a silence warnings 2003-02-06 13:47:04 +00:00
Brian Paul
8fee42cd6f read/write files, not stdio (Daniel Borca) 2003-02-04 12:33:37 +00:00
Brian Paul
34af895a99 DOS updates (Daniel Borca) 2003-02-04 02:38:52 +00:00
Brian Paul
4c5745b081 new files (Daniel Borca) 2003-02-04 02:37:06 +00:00
Brian Paul
dd2f83fb0e not needed (Daniel Borca) 2003-02-04 02:36:25 +00:00
Brian Paul
379c151989 use ARB flavor of window_pos extension 2003-02-04 02:34:42 +00:00
Brian Paul
379412994f latest bug fixes, updates 2003-02-04 02:31:13 +00:00
Brian Paul
c5e6bd00be updated with new functions (Bill Hoffman) 2003-02-04 02:29:45 +00:00
Karl Schultz
bf490e3ae5 Check only LEFT bits for clearing alpha buffer. (Evgeny Kotsuba) 2003-01-30 15:48:53 +00:00
Brian Paul
984f7e5324 fix reported 3Dnow bug in _mesa_normal_tab (Felix Kuhling) 2003-01-30 14:30:36 +00:00
Brian Paul
7a23c68f35 fix prefetch bug (Felix Kuhling) 2003-01-28 22:41:49 +00:00
Brian Paul
cb2eaf84a3 updated version test 2003-01-28 15:31:49 +00:00
Brian Paul
8829f949f8 some casts (Evgeny Kotsuba) 2003-01-28 00:10:31 +00:00
Brian Paul
015c4787d7 remove bad assertion, fix minor bug in _mesa_lookup_rgba() 2003-01-26 14:35:17 +00:00
Brian Paul
19c628d279 new texture enums (Leif Delgass) 2003-01-25 01:21:07 +00:00
Brian Paul
50bfa18670 renamed dither-related preprocessor symbols (bug 536406) 2003-01-24 15:33:00 +00:00
Brian Paul
57f9dc808a fix typo 2003-01-22 00:43:35 +00:00
Brian Paul
ef2d42b144 glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3. 2003-01-22 00:42:09 +00:00
Brian Paul
e3aa4c1d98 added missing break (Leif Delgass) 2003-01-21 23:57:52 +00:00
Brian Paul
d7facf95f8 added bug 669080 fix 2003-01-16 15:27:23 +00:00
Brian Paul
3543b12519 update CurrentStack in glActiveTexture if needed (bug 669080) 2003-01-16 15:21:35 +00:00
Alan Hourihane
cfdb6711f8 fix framebuffer width/height checking when window has not yet been realized. 2003-01-16 14:50:34 +00:00
Karl Schultz
283eab087b Fix SourceForge bug 664908. wglDescribePixelFormat should return the
number of valid PFD's if the PFD pointer is NULL, without checking
the validity of the other parameters.
2003-01-15 00:37:12 +00:00
Brian Paul
9c04e1c1d9 OSMesa16 updates (Eric Plante) 2003-01-14 02:57:30 +00:00
Brian Paul
16a832fa89 fog stride bug fix (Michel Danzer) 2003-01-13 15:48:55 +00:00
Brian Paul
5b8c98abee fix fog stride bugs (Michel Danzer) 2003-01-13 15:47:07 +00:00
Brian Paul
8126d169ec remove ADD_L altogether 2003-01-09 23:43:19 +00:00
Brian Paul
27a2f9fdfd s/16/32/ (Josh Vanderhoof) 2003-01-09 18:03:46 +00:00
Brian Paul
ad6514aac0 added SSE bug fix 2003-01-09 14:57:43 +00:00
Brian Paul
de0c25a481 moved ADD_L instruction (Linus Torvalds) 2003-01-09 14:56:04 +00:00
Brian Paul
a77151fb44 added font-related symbols 2003-01-09 14:37:07 +00:00
Brian Paul
df27002ac9 fix some float/ubyte mistakes (Daniel Borca) 2003-01-08 21:33:40 +00:00
Brian Paul
7e07dfb604 added bug 659012 fix 2003-01-08 16:49:06 +00:00
Brian Paul
76cb735d0c move t->Image[i]->Format test (bug 659012) 2003-01-08 16:48:22 +00:00
Brian Paul
530ce7f0ed added glRotate bug fix 2003-01-08 16:44:13 +00:00
Brian Paul
d856a056d3 fix typo in rotation code (bug 659677) 2003-01-08 16:43:15 +00:00
Brian Paul
7e7415fbab bug 659020 fix 2003-01-08 16:24:42 +00:00
Brian Paul
789d79e882 fix glCopyTexSubImage2D error checking (bug 661907) 2003-01-08 16:23:09 +00:00
Alan Hourihane
0e4e3606a3 Check that ActiveTextureARB doesn't overflow MaxTextureUnits 2002-12-30 19:20:11 +00:00
Brian Paul
b53092916f bump version to 5.0.1, added new DOS files 2002-12-19 15:17:56 +00:00
Brian Paul
92b132b966 DOS updates 2002-12-19 15:16:25 +00:00
Brian Paul
a5eb3c6a37 obsolete 2002-12-19 15:15:42 +00:00
Brian Paul
050268971b added DOS updates 2002-12-18 15:15:27 +00:00
Brian Paul
dbdc9e92b5 DOS updates from Daniel Borca. 2002-12-18 15:14:38 +00:00
Brian Paul
ca3d8e4605 5.0.1 release notes 2002-12-18 15:13:08 +00:00
Brian Paul
fc16876967 bump version string to 5.0.1 2002-12-18 15:10:53 +00:00
Keith Whitwell
83666eb33f Add mechanism to destroy mutexes. Important on OS's where mutex initialization
allocates memory (like FreeBSD).
2002-12-12 13:02:41 +00:00
Keith Whitwell
adbf94ca38 Don't crash if End received without a Begin... 2002-12-05 11:49:08 +00:00
Brian Paul
7b3a50acf1 fix bad _mesa_printf() calls (mesa bug 646753) 2002-12-04 14:24:23 +00:00
Brian Paul
4396dd1a3b latest 5.0.1 updates 2002-12-03 03:18:19 +00:00
Brian Paul
8f5f0fd6f8 updated to use ARB extensions 2002-12-03 03:13:08 +00:00
Brian Paul
ce733f495e added GL_DEPTH_COMPONENT to two assertions 2002-12-03 00:06:09 +00:00
Brian Paul
b0e246bf9a declar vsnprintf for OS/2 and VMS (Evgeny Kotsuba) 2002-12-01 13:59:51 +00:00
Brian Paul
7ffbdc48b6 added const to casts 2002-11-30 17:17:44 +00:00
Brian Paul
bd77908248 remove GLUTAPIENTRY from __glutCloseDownGameMode 2002-11-30 17:05:00 +00:00
Brian Paul
b319c105ea latest bug fixes, changes 2002-11-28 15:53:06 +00:00
Brian Paul
a987857ca5 use polygon offset to avoid multi-pass Z-fighting artifacts 2002-11-28 15:52:11 +00:00
Brian Paul
b6af31d4c6 added missing call to _mesa_write_mono_alpha_span() 2002-11-26 03:00:13 +00:00
Brian Paul
3cfadcf097 fixed bad clear value 2002-11-26 02:58:51 +00:00
Brian Paul
10174c5efd added missing ctx parameter to _tnl_flush_immediate() calls 2002-11-25 20:27:55 +00:00
Brian Paul
f24e9c8ad7 set default texcoords for glBitmap/glDrawPixels 2002-11-25 20:27:08 +00:00
Brian Paul
8f47c7f0df added missing breaks 2002-11-25 15:53:16 +00:00
Keith Whitwell
dce96e2450 Flush IM if very small number of verts left -- prevent copy errors 2002-11-25 13:50:27 +00:00
Brian Paul
c264409c46 added Fake_glXGetAGPOffsetMESA 2002-11-22 21:51:01 +00:00
Brian Paul
83df49f95d removed glfbdevtest and miniglxtest 2002-11-22 00:20:22 +00:00
Brian Paul
ffb4ef6929 first 5.0.1 bug fix: auto mipmap generation and cube maps 2002-11-20 21:41:15 +00:00
Brian Paul
1f7aeedf55 fixed cube texture auto-mipmap generation bug (641363) 2002-11-20 21:39:18 +00:00
326 changed files with 10792 additions and 60928 deletions

View File

@@ -1,13 +1,13 @@
# $Id: Make-config,v 1.67 2002/11/12 02:49:14 brianp Exp $
# $Id: Make-config,v 1.67.2.1 2003/03/27 18:35:55 brianp Exp $
MESA_MAJOR=5
MESA_MINOR=0
MESA_TINY=0
MESA_TINY=1
VERSION=$(MESA_MAJOR).$(MESA_MINOR)
# Mesa 3-D graphics library
#
# Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
# Copyright (C) 1999-2003 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"),

View File

@@ -1,9 +1,9 @@
# $Id: Makefile.X11,v 1.69 2002/11/13 15:33:51 brianp Exp $
# $Id: Makefile.X11,v 1.69.2.4 2003/03/11 15:34:29 brianp Exp $
# Mesa 3-D graphics library
# Version: 5.0
# Version: 5.0.1
#
# Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
# Copyright (C) 1999-2003 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"),
@@ -330,10 +330,10 @@ realclean: clean
cd samples && $(MAKE) -f Makefile.X11 realclean || true
DIRECTORY = Mesa-5.0
LIB_NAME = MesaLib-5.0
DEMO_NAME = MesaDemos-5.0
GLU_NAME = MesaGLU-5.0
DIRECTORY = Mesa-5.0.1
LIB_NAME = MesaLib-5.0.1
DEMO_NAME = MesaDemos-5.0.1
GLU_NAME = MesaGLU-5.0.1
GLUT_NAME = GLUT-3.7
@@ -429,7 +429,7 @@ LIB_FILES = \
$(DIRECTORY)/src/windml/man3/*.3 \
$(DIRECTORY)/src/windml/man3/*.html \
$(DIRECTORY)/src/DOS/*.[chS] \
$(DIRECTORY)/src/DOS/vesa/*.[ch] \
$(DIRECTORY)/src/DOS/mga/*.[ch] \
$(DIRECTORY)/src/BeOS/*.cpp \
$(DIRECTORY)/src/FX/Makefile.am \
$(DIRECTORY)/src/FX/Makefile.in \
@@ -486,6 +486,7 @@ LIB_FILES = \
$(DIRECTORY)/si-glu/Makefile.in \
$(DIRECTORY)/si-glu/Makefile.X11 \
$(DIRECTORY)/si-glu/Makefile.win \
$(DIRECTORY)/si-glu/Makefile.DJ \
$(DIRECTORY)/si-glu/glu.def \
$(DIRECTORY)/si-glu/dummy.cc \
$(DIRECTORY)/si-glu/descrip.mms \
@@ -705,33 +706,31 @@ OBSOLETE_GLUT_FILES = \
$(DIRECTORY)/src-glut.beos/*.h
lib_tar:
lib_gz:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \
gzip $(LIB_NAME).tar ; \
mv $(LIB_NAME).tar.gz $(DIRECTORY)
demo_tar:
demo_gz:
cd .. ; \
tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \
gzip $(DEMO_NAME).tar ; \
mv $(DEMO_NAME).tar.gz $(DIRECTORY)
glu_tar:
lib_bz2:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(GLU_NAME).tar $(GLU_FILES) ; \
gzip $(GLU_NAME).tar ; \
mv $(GLU_NAME).tar.gz $(DIRECTORY)
tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \
bzip2 $(LIB_NAME).tar ; \
mv $(LIB_NAME).tar.bz2 $(DIRECTORY)
glut_tar:
cp Makefile.X11 Makefile ; \
demo_bz2:
cd .. ; \
tar -cvf $(GLUT_NAME).tar $(GLUT_FILES) ; \
gzip $(GLUT_NAME).tar ; \
mv $(GLUT_NAME).tar.gz $(DIRECTORY)
tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \
bzip2 $(DEMO_NAME).tar ; \
mv $(DEMO_NAME).tar.bz2 $(DIRECTORY)
lib_zip:
-rm $(LIB_NAME).zip ; \
@@ -746,20 +745,29 @@ demo_zip:
zip -r $(DEMO_NAME).zip $(DEMO_FILES) ; \
mv $(DEMO_NAME).zip $(DIRECTORY)
md5:
@-md5sum $(LIB_NAME).tar.gz
@-md5sum $(LIB_NAME).tar.bz2
@-md5sum $(LIB_NAME).zip
@-md5sum $(DEMO_NAME).tar.gz
@-md5sum $(DEMO_NAME).tar.bz2
@-md5sum $(DEMO_NAME).zip
# Everything for new Mesa release:
tarballs: lib_gz demo_gz lib_bz2 demo_bz2 lib_zip demo_zip md5
SRC_FILES = \
RELNOTES \
src/Makefile* \
src/depend \
src/*.[chS] \
src/*/*.[ch] \
include/GL/*.h
# not used
glu_gz:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(GLU_NAME).tar $(GLU_FILES) ; \
gzip $(GLU_NAME).tar ; \
mv $(GLU_NAME).tar.gz $(DIRECTORY)
srctar:
tar -cvf src.tar $(SRC_FILES) ; \
gzip src.tar
srctar.zip:
-rm src.zip
zip -r src.zip $(SRC_FILES) ; \
glut_gz:
cp Makefile.X11 Makefile ; \
cd .. ; \
tar -cvf $(GLUT_NAME).tar $(GLUT_FILES) ; \
gzip $(GLUT_NAME).tar ; \
mv $(GLUT_NAME).tar.gz $(DIRECTORY)

View File

@@ -1,12 +1,12 @@
Mesa 4.1 DOS/DJGPP Port v1.2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mesa 5.0.1 DOS/DJGPP Port v1.3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Description:
~~~~~~~~~~~~
Well, guess what... this is the DOS port of Mesa 4.1, for DJGPP fans... Whoa!
Well, guess what... this is the DOS port of Mesa 5.0.1, for DJGPP fans... Whoa!
The driver has its origins in ddsample.c, written by Brian Paul and found by me
in Mesa 3.4.2.
@@ -32,20 +32,24 @@ Available options:
Environment variables:
CPU optimize for the given processor.
default = k6
BIG_OPT=1 crazy optimizations; not very useful, though...
default = no
GLIDE absolute path to Glide library; used with FX.
GLU=[src|si] specify GLU directory; can be `src' (src-glu = Mesa)
or `si' (si-glu = SGI's GLU -- requires GNU/C++).
default = src
GLIDE path to Glide3 SDK include files; used with FX.
default = $(TOP)/include/glide3
FX=1 build for 3dfx Glide3; use it if you have the Glide
SDK (designed for your platform), and, of course, a
3dfx card... Note that this disables compilation of
actual DMesa code, as Glide does all the stuff!
FX=1 build for 3dfx Glide3. Note that this disables
compilation of most DMesa code and requires fxMesa.
As a consequence, you'll need the DJGPP Glide3
library to build any application.
default = no
MATROX=1 build for Matrox Millennium I (MGA2064W) cards.
This is experimental and not intensively tested.
default = no
HAVE_X86=1 optimize for i386.
default = no
HAVE_MMX=1 MMX instructions; use only if you assembler/compiler
supports MMX instruction set; backwards compatibility
with older processors is still preserved.
HAVE_MMX=1 allow MMX specializations, provided your assembler
supports MMX instruction set. However, the true CPU
capabilities are checked at run-time to avoid crashes.
default = no
HAVE_SSE=1 (see HAVE_MMX)
default = no
@@ -65,8 +69,9 @@ Available options:
Tested on:
CPU: K6-2 (CXT) @500(412.5) MHz
Mainboard: ViA Apollo VP2/97 w/ 128 MB SDRAM
Video card: PowerColor Evil King3 (Voodoo3 3000) w/ 16384 kB SDRAM
DJGPP: djdev 2.04 + gcc v3.2 + make v3.79.1
Video card: PowerColor EvilKing3 (Voodoo3 3000 PCI) w/ 16 MB SDRAM
DJGPP: djdev 2.04 + gcc v3.2.2 + make v3.79.1
OS: DOS and Win9x
@@ -80,124 +85,135 @@ FAQ:
A) You need LFN support.
A) When compiling for Glide (FX=1), pay attention to Glide path.
2. Dynamic modules
Q) Libraries built OK, but linker complains about `vsnprintf' every time I
compile some demo.
A) Upgrade to DJGPP 2.04.
A) Add `vsnprintf.c' to the CORE_SOURCES in `src/Makefile.DJ' (untested!).
A) The following hack should be safe in 90% of the cases, but if anything
goes wrong, don't come back to me crying. Anyway, patch `src/imports.c'
with the following line:
#define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg)
Q) What are you mumbling about dynamic modules?
A) You must have the DXE2 package (available on SimTel.Net, courtesy of
Andrew Zabolotny) installed in order to build the dynamic modules.
Q) `make' complains about DXE3 or something, yet it builds the libraries.
A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest
DJGPP distro, or download the separate package from my web page. Read the
DXE3 documentation on how to use them. Hint: build your export object
file; then link it with your application. For example:
dxe3res -o dxe3tbl.c gl.dxe glu.dxe glut.dxe
gcc -o dxe3tbl.o -c dxe3tbl.c
gcc -o OUT.exe dxe3tbl.o IN.c -liglut -liglu -ligl -ldl
Q) I have DXE2, but I couldn't build the `dxe2gen.exe'.
Q) I built `dxe2gen.exe', but it doesn't do the job right.
A) There is a patched version on my web page.
2. Using Mesa for DJGPP
Q) DXE2 modules give me headaches...
A) The DXE2 modules are not compulsory. The static libraries are still built
and you can use them in the old-fashioned, classic way... and learn to
live with your ~2MB executable size. For example:
gcc -o OUT.exe IN.c -lglut -lglu -lgl
Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better...
A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky (the
Glide port is on my web page). If you have a Matrox Millennium I card,
you just MIGHT be lucky... If you haven't, sorry; everything is done in
software. Suggestions?
Q) Okay, DXE2 modules are built. How can I use them?
A) Build your export object file; then link it with your application.
For example:
dxe2res -o dmesadxe.c gl.dxe glu.dxe glut.dxe
gcc -o dmesadxe.o dmesadxe.c
gcc -o OUT.exe dmesadxe.o IN.c -liglut -liglu -ligl -ldl
Q) What is that `dxe2res.exe' thing?
A) That is an utility that generates the export file for a given set of
modules. If you can't find it in the DXE2 package, you must be looking at
the wrong archive :)
3. Using Mesa for DJGPP
Q) Does this build work in Win9x?
A) Yes.
Q) Does it work under NT (W2k, XP) core?
A) Uh... probably not!
Q) I tried to set refresh rate w/ DMesa, but without success.
A) Refresh rate control works only for VESA 3.0. If you were compiling for
Glide, see Glide info. If not, sorry!
Q) I made a simple application and it does nothing. It exits right away. Not
even a blank screen.
A) The current version supports only RGB[A] modes, for it made no sense to
me to endorse color-index (aka palette) modes.
A) Single-buffered is not allowed at all. Until I can find a way to use
*REAL* hardware acceleration, it won't get implemented.
A) Another weird "feature" is that buffer width must be multiple of 4 (I'm a
A) The pure software drivers (VESA/VGA) support only double-buffered modes.
A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a
lazy programmer and I found that the easiest way to keep buffer handling
at peak performance ;-).
Q) My demo doesn't display text. I know I used the glut font routines!
Q) My demo doesn't display text. I know I used the GLUT font routines!
A) Then you probably use GLUT as a DXE. Well, there is no direct access to
variables due to the way DXE works. Read the documentation. The author of
GLUT took this into account for _WIN32 DLL's only; I don't want to modify
his headers. The only workaround is to link GLUT the old way :-(
Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much
better...
A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky. The
Glide port is on my web page. If you haven't, sorry; everything is done
in software. Suggestions?
Q) I have a super/mega/ultra monitor and all you can do is 60Hz? My eyes are
leaking from the orbits...
A) If you were compiling for Glide, see Glide info. If not, be aware that
refresh rate control works only for VESA 3.0. The environment variable
DMESA_REFRESH sets the default screen refresh. For example:
set DMESA_REFRESH=75
Q) The GLUT is incomplete.
A) See below.
libGLUT (the toolkit):
~~~~~~~~~~~~~~~~~~~~~~
Well, this "skeletal" GLUT implementation is not mine. Thanks should go to
Bernhard Tschirren, Mark Kilgard, Brian Paul and probably others (or probably
not ;-). I only changed it to be self-standing (Allegro-free). The keyboard,
mouse and timer drivers were inspired from an old project of mine (D3Xl) and
fixed with many Allegro "infusions"; I deeply thank to Shawn Hargreaves et co.
Well, this "skeletal" GLUT implementation was taken from AllegGL project and
heavily changed. Thanks should go to Bernhard Tschirren, Mark Kilgard, Brian
Paul and probably others (or probably not ;-). GLUT functionality will be
extended only on an "as needed" basis.
My keyboard driver used only scancodes, but since GLUT requires ASCII values
for keys, I borrowed the translation tables (and maybe more) from Allegro.
Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users) will shut down the GLUT
engine unconditionally: it will raise SIGINT, which in turn will call the
destructors (let's hope), thus cleaning up your/my mess ;-) NB: since the
DJGPP guys ensured signal handlers won't go beyond program's space (and since
dynamic modules shall) the SIGINT can't be hooked (well, it can, but it is
useless), therefore you must live with the 'Exiting due to signal SIGINT'
message...
GLUT talks to hardware via PC_HW package which was put together from various
pieces I wrote long time ago. It consists from the keyboard, mouse and timer
drivers.
The mouse driver is far from complete (lack of positioning, drawing, etc),
but is enough to make almost all the demos work.
My keyboard driver used only scancodes; as GLUT requires ASCII values for keys,
I borrowed the translation tables (and maybe more) from Allegro -- many thanks
to Shawn Hargreaves et co. Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users)
will shut down the GLUT engine unconditionally: it will raise SIGINT, which in
turn will (hopefully) call the destructors, thus cleaning up your/my mess ;-)
NB: since the DJGPP guys ensured signal handlers won't go beyond program's
space (and since dynamic modules shall) the SIGINT can't be hooked (well, it
can, but it is useless), therefore you must live with the 'Exiting due to
signal SIGINT' message...
The mouse driver is far from complete (lack of drawing, etc), but is enough to
make almost all the demos work. Supports the CuteMouse WheelAPI.
The timer is pretty versatile for it supports multiple timers with different
frequencies. It may not be the most accurate timer in the known universe, but
I think it's OK. Take this example: you have timer A with a very high rate,
and then you have timer B with very low rate compared to A; now, A ticks OK,
but timer B will probably loose precision!
frequencies. While not being the most accurate timer in the known universe, I
think it's OK. Take this example: you have timer A with a very high rate, and
then you have timer B with very low rate compared to A; now, A ticks OK, but
timer B will probably loose precision!
As an addition, stdout and stderr are redirected and dumped upon exit. This
means that printf can be safely called during graphics, but all messages come
in bulk! A bit of a hack, I know, but I think it's better than to miss them
at all. "Borrowed" from RHIDE (Robert Hoehne) or SETEDIT (Salvador Eduardo
Tropea)... I'm not sure.
means that `printf' can be safely called during graphics. A bit of a hack, I
know, because all messages come in bulk, but I think it's better than nothing.
"Borrowed" from LIBRHUTI (Robert Hoehne).
Window creating defaults: 640x480x16 at (0,0), 8-bit stencil, 16-bit accum.
However, the video mode is chosen in such a way that first window will fit.
Window creating defaults: 300x300x16 at (0,0), 16-bit depth, 16-bit accum,
8-bit stencil. However, the video mode is chosen in such a way that first
window will fit. If you need high resolution with small windows, set initial
position far to the right (or way down); then you can move them back to any
position right before the main loop.
The following environment variables can customize GLUT behaviour:
DMESA_GLUT_REFRESH - set vertical screen refresh rate (VESA3)
DMESA_GLUT_BPP - set default bits per pixel (VGA needs 8)
GLUT_FPS - print frames/second statistics to stderr
History:
~~~~~~~~
v1.0 mar-2002 initial release
v1.0 (mar-2002)
initial release
v1.1 sep-2002 + added 3dfx Glide3 support
+ added refresh rate control
+ added fonts in glut
* lots of minor changes
v1.1 (sep-2002)
+ added 3dfx Glide3 support
+ added refresh rate control
+ added fonts in GLUT
* lots of minor changes
v1.2 nov-2002 * synced w/ Mesa-4.1
- removed dmesadxe.h
v1.2 (nov-2002)
* synced w/ Mesa-4.1
- removed dmesadxe.h
v1.3 (mar-2003)
+ enabled OpenGL 1.4 support
+ added MMX clear/blit routines
+ enabled SGI's GLU compilation
+ added samples makefile
+ added new GLUT functions
+ added color-index modes
+ added Matrox Millennium MGA2064W driver
+ added 8bit FakeColor (thanks to Neil Funk)
+ added VGA support (to keep Ben Decker happy)
! fixed some compilation errors (reported by Chan Kar Heng)
* optimized driver for faster callback access... yeah, right :)
* overhauled virtual buffer and internal video drivers
* better fxMesa integration
* revamped GLUT
* switched to DXE3

46
docs/RELNOTES-5.0.1 Normal file
View File

@@ -0,0 +1,46 @@
Mesa 5.0.1 release notes
March 30, 2003
Introduction
------------
Mesa uses an even/odd version number scheme like the Linux kernel.
Even-numbered versions (such as 5.0.x) designate stable releases.
Odd-numbered versions (such as 4.1.x) designate new developmental releases.
Mesa 5.0.1 just fixes bugs found since the 5.0 release. See the VERSIONS
file for details.
Device Driver Status
--------------------
A number of Mesa's software drivers haven't been actively maintained for
some time. We rely on volunteers to maintain many of these drivers.
Here's the current status of all included drivers:
Driver Status
---------------------- ---------------------
XMesa (Xlib) implements OpenGL 1.4
OSMesa (off-screen) implements OpenGL 1.4
FX (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA implements OpenGL 1.3
Wind River UGL implements OpenGL 1.3
Windows/Win32 implements OpenGL 1.4
DJGPP implements OpenGL 1.4
GGI implements OpenGL 1.3
BeOS implements OpenGL 1.4
Allegro needs updating
D3D needs updating
Note: supporting OpenGL 1.4 (vs. 1.3 or 1.2) usually only requires that the
driver call the _mesa_enable_1_4_extensions() function.
----------------------------------------------------------------------
$Id: RELNOTES-5.0.1,v 1.1.2.4 2003/03/30 16:07:16 brianp Exp $

View File

@@ -1,4 +1,4 @@
$Id: VERSIONS,v 1.118 2002/11/13 15:33:50 brianp Exp $
$Id: VERSIONS,v 1.118.2.25 2003/03/29 16:11:22 brianp Exp $
Mesa Version History
@@ -1080,3 +1080,41 @@ Mesa Version History
- fixed one-bit error in point/line fragment Z calculation
- fixed potential segfault in fakeglx code
- fixed color overflow problem in DOT3 texture env mode
5.0.1 March 30, 2003
New:
- DOS driver updates from Daniel Borca
- updated GL/gl_mangle.h file (Bill Hoffman)
Bug fixes:
- auto mipmap generation for cube maps was broken (bug 641363)
- writing/clearing software alpha channels was unreliable
- minor compilation fixes for OS/2 (Evgeny Kotsuba)
- fixed some bad assertions found with shadowtex demo
- fixed error checking bug in glCopyTexSubImage2D (bug 659020)
- glRotate(angle, -x, 0, 0) was incorrect (bug 659677)
- fixed potential segfault in texture object validation (bug 659012)
- fixed some bogus code in _mesa_test_os_sse_exception_support (Linus)
- fix fog stride bug in tnl code for h/w drivers (Michel Danzer)
- fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080)
- glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3
- fixed compilation problem on Solaris7/x86 (bug 536406)
- fixed prefetch bug in 3DNow! code (Felix Kuhling)
- fixed NeXT build problem (FABSF macro)
- glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811)
- zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964)
- AA line and triangle Z values are now rounded, not truncated
- fixed color interpolation bug when GLchan==GLfloat (bug 694461)
- glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca)
- fixed a minor GL_COLOR_MATERIAL bug
- NV vertex program EXP instruction was broken
- glColorMask misbehaved with X window / pixmap rendering
- fix autoconf/libtool GLU C++ linker problem on Linux (a total hack)
- attempt to fix GGI compilation problem when MesaDemos not present
- NV vertex program ARL-relative fetches didn't work
Changes:
- use glPolygonOffset in gloss demo to avoid z-fighting artifacts
- updated winpos and pointblast demos to use ARB extensions
- disable SPARC normal transformation code (bug 673938)
- GLU fixes for OS/2 (Evgeny Kotsuba)

View File

@@ -42,6 +42,7 @@ Be warned, some of these files may be very out of date.
<H1>Release Notes</H1>
<UL>
<LI><A HREF="RELNOTES-5.0.1">RELNOTES-5.0.1</A>
<LI><A HREF="RELNOTES-5.0">RELNOTES-5.0</A>
<LI><A HREF="RELNOTES-4.1">RELNOTES-4.1</A>
<LI><A HREF="RELNOTES-4.0.3">RELNOTES-4.0.3</A>

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +0,0 @@
*.tag
array_cache
core
math
miniglx
radeon_subset
swrast
swrast_setup
tnl
tnl_dd

View File

@@ -6,4 +6,4 @@ See http://www.doxygen.org/ for more info.
Either run 'make' (Unix) or 'doxy.bat' (Windows) to run doxygen
and generate souce code documentation.
Then, load doxy/core/index.html into your web browser.
Then, load doxy/core.index.html into your web browser.

View File

@@ -4,10 +4,10 @@
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa array_cache"
PROJECT_NUMBER =
OUTPUT_DIRECTORY =
PROJECT_NUMBER = 4.1
OUTPUT_DIRECTORY = .
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
@@ -38,14 +38,14 @@ GENERATE_BUGLIST = YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_FOR_C = YES
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT =
WARN_LOGFILE =
#---------------------------------------------------------------------------

View File

@@ -4,12 +4,12 @@
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa Core"
PROJECT_NUMBER =
PROJECT_NUMBER = 4.1
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
@@ -19,7 +19,7 @@ ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
INTERNAL_DOCS = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
@@ -38,21 +38,21 @@ GENERATE_BUGLIST = YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_FOR_C = YES
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/
FILE_PATTERNS = *.c *.h
FILE_PATTERNS = *.h *.c
RECURSIVE = NO
EXCLUDE = ../src/glapitemp.h ../src/glapioffsets.h
EXCLUDE_PATTERNS =
@@ -65,16 +65,16 @@ FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
IGNORE_PREFIX = _
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
@@ -149,7 +149,7 @@ TAGFILES = tnl_dd.tag=../tnl_dd \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
miniglx.tag=../miniglx
array_cache.tag=array_cache
GENERATE_TAGFILE = core.tag
ALLEXTERNALS = NO
PERL_PATH =

View File

@@ -1,14 +1,12 @@
<html><head><title>Mesa Source Code Documentation</title>
<html><head><title>Mesa API docs</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body><center>
<a href="../core/index.html">Mesa Core</a>&nbsp;
<a href="../miniglx/index.html">MiniGLX</a>&nbsp;
<a href="../array_cache/index.html">array_cache</a>&nbsp;
<a href="../core/index.html">core</a>&nbsp;
<a href="../math/index.html">math</a>&nbsp;
<a href="../swrast/index.html">swrast</a>&nbsp;
<a href="../swrast_setup/index.html">swrast_setup</a>&nbsp;
<a href="../tnl/index.html">tnl</a>&nbsp;
<a href="../tnl_dd/index.html">tnl_dd</a>&nbsp;
<a href="../radeon_subset/index.html">radeon_subset</a>&nbsp;
</center>

View File

@@ -5,7 +5,6 @@ default:
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen miniglx.doxy
doxygen core.doxy
echo "Building again, to resolve tags"
doxygen tnl_dd.doxy
@@ -14,11 +13,9 @@ default:
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen miniglx.doxy
doxygen radeon_subset.doxy
clean:
rm -rf array_cache core math swrast swrast_setup tnl_dd tnl miniglx radeon_subset
rm -rf array_cache core math swrast swrast_setup tnl_dd tnl
rm -rf *.tag

View File

@@ -3,13 +3,13 @@
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa math module"
PROJECT_NUMBER =
PROJECT_NAME = "Mesa math"
PROJECT_NUMBER = 4.1
OUTPUT_DIRECTORY = .
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
@@ -73,7 +73,7 @@ REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------

View File

@@ -1,184 +0,0 @@
# Doxyfile 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "MiniGLX"
PROJECT_NUMBER =
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = NO
SHOW_INCLUDE_FILES = NO
JAVADOC_AUTOBRIEF = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_FORMAT =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/miniglx/ ../include/GL/miniglx.h
FILE_PATTERNS = *.h *.c
RECURSIVE = NO
EXCLUDE = ../src/miniglx/glapi.c
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = miniglx
HTML_HEADER = header.html
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT =
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT =
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT =
MAN_EXTENSION =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH = ../include/
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES = core.tag=../core \
tnl_dd.tag=../tnl_dd \
array_cache.tag=../array_cache \
math.tag=../math \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
GENERATE_TAGFILE = miniglx.tag
ALLEXTERNALS = NO
PERL_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
TEMPLATE_RELATIONS = YES
HIDE_UNDOC_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME =
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH =
EXT_DOC_PATHS =

View File

@@ -1,208 +0,0 @@
# Doxyfile 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Radeon Subset Driver"
PROJECT_NUMBER =
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = NO
SHOW_INCLUDE_FILES = NO
JAVADOC_AUTOBRIEF = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_FORMAT =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = \
../src/drv/common/mm.c \
../src/drv/common/mm.h \
../src/drv/radeon/radeon_context.c \
../src/drv/radeon/radeon_context.h \
../src/drv/radeon/radeon_ioctl.c \
../src/drv/radeon/radeon_ioctl.h \
../src/drv/radeon/radeon_lock.c \
../src/drv/radeon/radeon_lock.h \
../src/drv/radeon/radeon_screen.c \
../src/drv/radeon/radeon_screen.h \
../src/drv/radeon/radeon_state.c \
../src/drv/radeon/radeon_state.h \
../src/drv/radeon/radeon_state_init.c \
../src/drv/radeon/radeon_subset.h \
../src/drv/radeon/radeon_subset_bitmap.c \
../src/drv/radeon/radeon_subset_readpix.c \
../src/drv/radeon/radeon_subset_select.c \
../src/drv/radeon/radeon_subset_tex.c \
../src/drv/radeon/radeon_subset_vtx.c \
../src/drv/radeon/radeon_tcl.h \
../src/drv/radeon/radeon_tex.h \
../src/drv/radeon/radeon_vtxfmt.h \
../src/drv/radeon/server
FILE_PATTERNS = *.h *.c
RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = radeon_subset
HTML_HEADER = header.html
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT =
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT =
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT =
MAN_EXTENSION =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH = ../include/
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES = core.tag=../core \
tnl_dd.tag=../tnl_dd \
array_cache.tag=../array_cache \
math.tag=../math \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
miniglx.tag=../miniglx \
array_cache.tag=array_cache
GENERATE_TAGFILE = radeon_subset.tag
ALLEXTERNALS = NO
PERL_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
TEMPLATE_RELATIONS = YES
HIDE_UNDOC_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME =
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH =
EXT_DOC_PATHS =

View File

@@ -3,8 +3,8 @@
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa Software Rasterization (swrast)"
PROJECT_NUMBER =
PROJECT_NAME = "Mesa swrast"
PROJECT_NUMBER = 4.1
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
@@ -19,7 +19,7 @@ ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
INTERNAL_DOCS = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
@@ -38,21 +38,22 @@ GENERATE_BUGLIST = YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_FOR_C = NO
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/swrast/
FILE_PATTERNS = *.c *.h
FILE_PATTERNS = *.c \
*.h
RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
@@ -135,7 +136,7 @@ ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH = ../include/
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
@@ -155,7 +156,7 @@ PERL_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
CLASS_DIAGRAMS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES

View File

@@ -4,7 +4,7 @@
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa swrast_setup"
PROJECT_NUMBER =
PROJECT_NUMBER = 4.1
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES

View File

@@ -3,8 +3,8 @@
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa Transform and Lighting (tnl)"
PROJECT_NUMBER =
PROJECT_NAME = "Mesa tnl"
PROJECT_NUMBER = 4.1
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES

View File

@@ -4,7 +4,7 @@
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa tnl_dd"
PROJECT_NUMBER =
PROJECT_NUMBER = 4.1
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
@@ -52,7 +52,7 @@ WARN_LOGFILE =
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/tnl_dd/
FILE_PATTERNS = *.c *.h
FILE_PATTERNS = *.h
RECURSIVE = YES
EXCLUDE =
EXCLUDE_PATTERNS =

View File

@@ -23,7 +23,7 @@
*/
/*
* DOS/DJGPP device driver v1.2 for Mesa 4.1
* DOS/DJGPP device driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -37,6 +37,17 @@
#define DMESA_MAJOR_VERSION 5
#define DMESA_MINOR_VERSION 0
/* Sample Usage:
*
* 1. Call DMesaCreateVisual() to initialize graphics.
* 2. Call DMesaCreateContext() to create a DMesa rendering context.
* 3. Call DMesaCreateBuffer() to define the window.
* 4. Call DMesaMakeCurrent() to bind the DMesaBuffer to a DMesaContext.
* 5. Make gl* calls to render your graphics.
* 6. Use DMesaSwapBuffers() when double buffering to swap front/back buffers.
* 7. Before exiting, destroy DMesaBuffer, DMesaContext and DMesaVisual.
*/
typedef struct dmesa_context *DMesaContext;
typedef struct dmesa_visual *DMesaVisual;
typedef struct dmesa_buffer *DMesaBuffer;
@@ -45,32 +56,89 @@ typedef struct dmesa_buffer *DMesaBuffer;
extern "C" {
#endif
DMesaVisual DMesaCreateVisual (GLint width, GLint height,
GLint colDepth,
GLboolean dbFlag,
GLint depthSize,
GLint stencilSize,
GLint accumSize);
/*
* Create a new Visual and set graphics mode.
*/
DMesaVisual DMesaCreateVisual (GLint width, /* X res */
GLint height, /* Y res */
GLint colDepth, /* BPP */
GLint refresh, /* refresh rate: 0=default */
GLboolean dbFlag, /* double-buffered */
GLboolean rgbFlag, /* RGB mode */
GLboolean alphaFlag,/* alpha buffer requested */
GLint depthSize, /* requested bits/depth */
GLint stencilSize, /* requested bits/stencil */
GLint accumSize); /* requested bits/accum */
/*
* Destroy Visual and restore screen.
*/
void DMesaDestroyVisual (DMesaVisual v);
/*
* Create a new Context for rendering.
*/
DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share);
/*
* Destroy Context.
*/
void DMesaDestroyContext (DMesaContext c);
/*
* Return a handle to the current context.
*/
DMesaContext DMesaGetCurrentContext (void);
/*
* Create a new Buffer (window).
*/
DMesaBuffer DMesaCreateBuffer (DMesaVisual visual,
GLint xpos, GLint ypos,
GLint width, GLint height);
/*
* Destroy Buffer.
*/
void DMesaDestroyBuffer (DMesaBuffer b);
DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share);
void DMesaDestroyContext (DMesaContext c);
GLboolean DMesaViewport (DMesaBuffer b,
GLint xpos, GLint ypos,
GLint width, GLint height);
/*
* Swap the front and back buffers for the given Buffer.
* No action is taken if the buffer is not double buffered.
*/
void DMesaSwapBuffers (DMesaBuffer b);
/*
* Bind Buffer to Context and make the Context the current one.
*/
GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b);
void DMesaSwapBuffers (DMesaBuffer b);
/*
* Move/Resize current Buffer.
*/
GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos);
GLboolean DMesaResizeBuffer (GLint width, GLint height);
/*
* Set palette index, using normalized values.
*/
void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue);
/*
* DMesa state retrieval.
*/
#define DMESA_GET_SCREEN_SIZE 0x0100
#define DMESA_GET_DRIVER_CAPS 0x0200
#define DMESA_DRIVER_SWDB_BIT 0x1 /* software double-buffered */
#define DMESA_DRIVER_LLWO_BIT 0x2 /* lower-left window origin */
int DMesaGetIntegerv (GLenum pname, GLint *params);
#ifdef __cplusplus
}

View File

@@ -1,10 +1,10 @@
/* $Id: gl.h,v 1.72 2002/10/17 19:39:31 kschultz Exp $ */
/* $Id: gl.h,v 1.72.2.1 2003/02/28 16:29:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.1
* Version: 5.0.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2003 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"),
@@ -2646,6 +2646,13 @@ GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid
#endif /* GL_APPLE_ycbcr_422 */
#ifndef GL_ATI_texture_env_combine3
#define GL_ATI_texture_env_combine3 1
#define GL_MODULATE_ADD_ATI 0x8744
#define GL_MODULATE_SIGNED_ADD_ATI 0x8745
#define GL_MODULATE_SUBTRACT_ATI 0x8746
#endif
/**********************************************************************
* Begin system-specific stuff

View File

@@ -1,15 +1,14 @@
#if 0 /* $Id: gl_mangle.h,v 1.11 2002/01/18 14:55:40 brianp Exp $ */
# DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN KORN SHELL and save the output
# This file is used to create GL function protypes and aliases for the function names
#if 0 /* $Id: gl_mangle.h,v 1.11.4.1 2003/02/04 02:29:45 brianp Exp $ */
#define GL_MANGLE_C1 "DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN SHELL (/bin/sh) and save the output"
#define GL_MANGLE_C2 "This file is used to create GL function protypes and aliases for the function names"
files="gl.h glext.h"
#get regeneration header - copy everything in this file above the "REGENERATE_TO_END" line
#define GL_MANGLE_C3 "get regeneration header - copy everything in this file above the 'REGENERATE_TO_END' line"
awk '!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0
echo "\n"
#get aliases
echo ""
#define GL_MANGLE_C4 get aliases
grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1 MANGLE(\1)/' | sort | uniq
echo "\n#endif /* GL_MANGLE_H */"
echo ""
echo "#endif /* GL_MANGLE_H */"
exit
#endif /* REGENERATION */
@@ -34,8 +33,8 @@
/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */
#define glAccum MANGLE(Accum)
#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT)
#define glActiveTexture MANGLE(ActiveTexture)
#define glActiveTextureARB MANGLE(ActiveTextureARB)
#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI)
@@ -52,11 +51,13 @@
#define glAsyncMarkerSGIX MANGLE(AsyncMarkerSGIX)
#define glBegin MANGLE(Begin)
#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI)
#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV)
#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT)
#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI)
#define glBindLightParameterEXT MANGLE(BindLightParameterEXT)
#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT)
#define glBindParameterEXT MANGLE(BindParameterEXT)
#define glBindProgramARB MANGLE(BindProgramARB)
#define glBindProgramNV MANGLE(BindProgramNV)
#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT)
#define glBindTexture MANGLE(BindTexture)
@@ -80,6 +81,7 @@
#define glBlendEquation MANGLE(BlendEquation)
#define glBlendEquationEXT MANGLE(BlendEquationEXT)
#define glBlendFunc MANGLE(BlendFunc)
#define glBlendFuncSeparate MANGLE(BlendFuncSeparate)
#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT)
#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR)
#define glCallList MANGLE(CallList)
@@ -92,7 +94,7 @@
#define glClearStencil MANGLE(ClearStencil)
#define glClientActiveTexture MANGLE(ClientActiveTexture)
#define glClientActiveTextureARB MANGLE(ClientActiveTextureARB)
#define glClientActiveVertexStream MANGLE(ClientActiveVertexStream)
#define glClientActiveVertexStreamATI MANGLE(ClientActiveVertexStreamATI)
#define glClipPlane MANGLE(ClipPlane)
#define glColor3b MANGLE(Color3b)
#define glColor3bv MANGLE(Color3bv)
@@ -214,6 +216,8 @@
#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI)
#define glDeleteLists MANGLE(DeleteLists)
#define glDeleteObjectBufferATI MANGLE(DeleteObjectBufferATI)
#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV)
#define glDeleteProgramsARB MANGLE(DeleteProgramsARB)
#define glDeleteProgramsNV MANGLE(DeleteProgramsNV)
#define glDeleteTextures MANGLE(DeleteTextures)
#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT)
@@ -226,11 +230,15 @@
#define glDisableClientState MANGLE(DisableClientState)
#define glDisableTraceMESA MANGLE(DisableTraceMESA)
#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT)
#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB)
#define glDrawArrays MANGLE(DrawArrays)
#define glDrawArraysEXT MANGLE(DrawArraysEXT)
#define glDrawBuffer MANGLE(DrawBuffer)
#define glDrawElementArrayATI MANGLE(DrawElementArrayATI)
#define glDrawElements MANGLE(DrawElements)
#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN)
#define glDrawPixels MANGLE(DrawPixels)
#define glDrawRangeElementArrayATI MANGLE(DrawRangeElementArrayATI)
#define glDrawRangeElements MANGLE(DrawRangeElements)
#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT)
#define glEdgeFlag MANGLE(EdgeFlag)
@@ -238,13 +246,16 @@
#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT)
#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM)
#define glEdgeFlagv MANGLE(EdgeFlagv)
#define glElementPointerATI MANGLE(ElementPointerATI)
#define glEnable MANGLE(Enable)
#define glEnableClientState MANGLE(EnableClientState)
#define glEnableTraceMESA MANGLE(EnableTraceMESA)
#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT)
#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB)
#define glEnd MANGLE(End)
#define glEndFragmentShaderATI MANGLE(EndFragmentShaderATI)
#define glEndList MANGLE(EndList)
#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV)
#define glEndTraceMESA MANGLE(EndTraceMESA)
#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT)
#define glEvalCoord1d MANGLE(EvalCoord1d)
@@ -271,11 +282,16 @@
#define glFlush MANGLE(Flush)
#define glFlushRasterSGIX MANGLE(FlushRasterSGIX)
#define glFlushVertexArrayRangeNV MANGLE(FlushVertexArrayRangeNV)
#define glFogCoordPointer MANGLE(FogCoordPointer)
#define glFogCoordPointerEXT MANGLE(FogCoordPointerEXT)
#define glFogCoordPointerListIBM MANGLE(FogCoordPointerListIBM)
#define glFogCoordd MANGLE(FogCoordd)
#define glFogCoorddEXT MANGLE(FogCoorddEXT)
#define glFogCoorddv MANGLE(FogCoorddv)
#define glFogCoorddvEXT MANGLE(FogCoorddvEXT)
#define glFogCoordf MANGLE(FogCoordf)
#define glFogCoordfEXT MANGLE(FogCoordfEXT)
#define glFogCoordfv MANGLE(FogCoordfv)
#define glFogCoordfvEXT MANGLE(FogCoordfvEXT)
#define glFogFuncSGIS MANGLE(FogFuncSGIS)
#define glFogf MANGLE(Fogf)
@@ -302,6 +318,8 @@
#define glGenFencesNV MANGLE(GenFencesNV)
#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI)
#define glGenLists MANGLE(GenLists)
#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV)
#define glGenProgramsARB MANGLE(GenProgramsARB)
#define glGenProgramsNV MANGLE(GenProgramsNV)
#define glGenSymbolsEXT MANGLE(GenSymbolsEXT)
#define glGenTextures MANGLE(GenTextures)
@@ -383,6 +401,8 @@
#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT)
#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI)
#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI)
#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV)
#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV)
#define glGetPixelMapfv MANGLE(GetPixelMapfv)
#define glGetPixelMapuiv MANGLE(GetPixelMapuiv)
#define glGetPixelMapusv MANGLE(GetPixelMapusv)
@@ -391,9 +411,15 @@
#define glGetPointerv MANGLE(GetPointerv)
#define glGetPointervEXT MANGLE(GetPointervEXT)
#define glGetPolygonStipple MANGLE(GetPolygonStipple)
#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB)
#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB)
#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB)
#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB)
#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV)
#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV)
#define glGetProgramStringARB MANGLE(GetProgramStringARB)
#define glGetProgramStringNV MANGLE(GetProgramStringNV)
#define glGetProgramivARB MANGLE(GetProgramivARB)
#define glGetProgramivNV MANGLE(GetProgramivNV)
#define glGetSeparableFilter MANGLE(GetSeparableFilter)
#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT)
@@ -419,9 +445,13 @@
#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT)
#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT)
#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT)
#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB)
#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV)
#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB)
#define glGetVertexAttribdvNV MANGLE(GetVertexAttribdvNV)
#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB)
#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV)
#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB)
#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV)
#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN)
#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN)
@@ -465,6 +495,8 @@
#define glIsFenceNV MANGLE(IsFenceNV)
#define glIsList MANGLE(IsList)
#define glIsObjectBufferATI MANGLE(IsObjectBufferATI)
#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV)
#define glIsProgramARB MANGLE(IsProgramARB)
#define glIsProgramNV MANGLE(IsProgramNV)
#define glIsTexture MANGLE(IsTexture)
#define glIsTextureEXT MANGLE(IsTextureEXT)
@@ -525,7 +557,9 @@
#define glMultTransposeMatrixdARB MANGLE(MultTransposeMatrixdARB)
#define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf)
#define glMultTransposeMatrixfARB MANGLE(MultTransposeMatrixfARB)
#define glMultiDrawArrays MANGLE(MultiDrawArrays)
#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT)
#define glMultiDrawElements MANGLE(MultiDrawElements)
#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT)
#define glMultiModeDrawArraysIBM MANGLE(MultiModeDrawArraysIBM)
#define glMultiModeDrawElementsIBM MANGLE(MultiModeDrawElementsIBM)
@@ -612,16 +646,16 @@
#define glNormalPointerEXT MANGLE(NormalPointerEXT)
#define glNormalPointerListIBM MANGLE(NormalPointerListIBM)
#define glNormalPointervINTEL MANGLE(NormalPointervINTEL)
#define glNormalStream3b MANGLE(NormalStream3b)
#define glNormalStream3bv MANGLE(NormalStream3bv)
#define glNormalStream3d MANGLE(NormalStream3d)
#define glNormalStream3dv MANGLE(NormalStream3dv)
#define glNormalStream3f MANGLE(NormalStream3f)
#define glNormalStream3fv MANGLE(NormalStream3fv)
#define glNormalStream3i MANGLE(NormalStream3i)
#define glNormalStream3iv MANGLE(NormalStream3iv)
#define glNormalStream3s MANGLE(NormalStream3s)
#define glNormalStream3sv MANGLE(NormalStream3sv)
#define glNormalStream3bATI MANGLE(NormalStream3bATI)
#define glNormalStream3bvATI MANGLE(NormalStream3bvATI)
#define glNormalStream3dATI MANGLE(NormalStream3dATI)
#define glNormalStream3dvATI MANGLE(NormalStream3dvATI)
#define glNormalStream3fATI MANGLE(NormalStream3fATI)
#define glNormalStream3fvATI MANGLE(NormalStream3fvATI)
#define glNormalStream3iATI MANGLE(NormalStream3iATI)
#define glNormalStream3ivATI MANGLE(NormalStream3ivATI)
#define glNormalStream3sATI MANGLE(NormalStream3sATI)
#define glNormalStream3svATI MANGLE(NormalStream3svATI)
#define glOrtho MANGLE(Ortho)
#define glPNTrianglesfATI MANGLE(PNTrianglesfATI)
#define glPNTrianglesiATI MANGLE(PNTrianglesiATI)
@@ -644,12 +678,18 @@
#define glPixelTransformParameteriEXT MANGLE(PixelTransformParameteriEXT)
#define glPixelTransformParameterivEXT MANGLE(PixelTransformParameterivEXT)
#define glPixelZoom MANGLE(PixelZoom)
#define glPointParameterf MANGLE(PointParameterf)
#define glPointParameterfARB MANGLE(PointParameterfARB)
#define glPointParameterfEXT MANGLE(PointParameterfEXT)
#define glPointParameterfSGIS MANGLE(PointParameterfSGIS)
#define glPointParameterfv MANGLE(PointParameterfv)
#define glPointParameterfvARB MANGLE(PointParameterfvARB)
#define glPointParameterfvEXT MANGLE(PointParameterfvEXT)
#define glPointParameterfvSGIS MANGLE(PointParameterfvSGIS)
#define glPointParameteri MANGLE(PointParameteri)
#define glPointParameteriNV MANGLE(PointParameteriNV)
#define glPointParameteriv MANGLE(PointParameteriv)
#define glPointParameterivNV MANGLE(PointParameterivNV)
#define glPointSize MANGLE(PointSize)
#define glPollAsyncSGIX MANGLE(PollAsyncSGIX)
#define glPollInstrumentsSGIX MANGLE(PollInstrumentsSGIX)
@@ -663,12 +703,21 @@
#define glPopName MANGLE(PopName)
#define glPrioritizeTextures MANGLE(PrioritizeTextures)
#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT)
#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB)
#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB)
#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB)
#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB)
#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB)
#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB)
#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB)
#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB)
#define glProgramParameter4dNV MANGLE(ProgramParameter4dNV)
#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV)
#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV)
#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV)
#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV)
#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV)
#define glProgramStringARB MANGLE(ProgramStringARB)
#define glPushAttrib MANGLE(PushAttrib)
#define glPushClientAttrib MANGLE(PushClientAttrib)
#define glPushMatrix MANGLE(PushMatrix)
@@ -746,28 +795,44 @@
#define glSampleMapATI MANGLE(SampleMapATI)
#define glSampleMaskEXT MANGLE(SampleMaskEXT)
#define glSampleMaskSGIS MANGLE(SampleMaskSGIS)
#define glSamplePass MANGLE(SamplePass)
#define glSamplePatternEXT MANGLE(SamplePatternEXT)
#define glSamplePatternSGIS MANGLE(SamplePatternSGIS)
#define glScaled MANGLE(Scaled)
#define glScalef MANGLE(Scalef)
#define glScissor MANGLE(Scissor)
#define glSecondaryColor3b MANGLE(SecondaryColor3b)
#define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT)
#define glSecondaryColor3bv MANGLE(SecondaryColor3bv)
#define glSecondaryColor3bvEXT MANGLE(SecondaryColor3bvEXT)
#define glSecondaryColor3d MANGLE(SecondaryColor3d)
#define glSecondaryColor3dEXT MANGLE(SecondaryColor3dEXT)
#define glSecondaryColor3dv MANGLE(SecondaryColor3dv)
#define glSecondaryColor3dvEXT MANGLE(SecondaryColor3dvEXT)
#define glSecondaryColor3f MANGLE(SecondaryColor3f)
#define glSecondaryColor3fEXT MANGLE(SecondaryColor3fEXT)
#define glSecondaryColor3fv MANGLE(SecondaryColor3fv)
#define glSecondaryColor3fvEXT MANGLE(SecondaryColor3fvEXT)
#define glSecondaryColor3i MANGLE(SecondaryColor3i)
#define glSecondaryColor3iEXT MANGLE(SecondaryColor3iEXT)
#define glSecondaryColor3iv MANGLE(SecondaryColor3iv)
#define glSecondaryColor3ivEXT MANGLE(SecondaryColor3ivEXT)
#define glSecondaryColor3s MANGLE(SecondaryColor3s)
#define glSecondaryColor3sEXT MANGLE(SecondaryColor3sEXT)
#define glSecondaryColor3sv MANGLE(SecondaryColor3sv)
#define glSecondaryColor3svEXT MANGLE(SecondaryColor3svEXT)
#define glSecondaryColor3ub MANGLE(SecondaryColor3ub)
#define glSecondaryColor3ubEXT MANGLE(SecondaryColor3ubEXT)
#define glSecondaryColor3ubv MANGLE(SecondaryColor3ubv)
#define glSecondaryColor3ubvEXT MANGLE(SecondaryColor3ubvEXT)
#define glSecondaryColor3ui MANGLE(SecondaryColor3ui)
#define glSecondaryColor3uiEXT MANGLE(SecondaryColor3uiEXT)
#define glSecondaryColor3uiv MANGLE(SecondaryColor3uiv)
#define glSecondaryColor3uivEXT MANGLE(SecondaryColor3uivEXT)
#define glSecondaryColor3us MANGLE(SecondaryColor3us)
#define glSecondaryColor3usEXT MANGLE(SecondaryColor3usEXT)
#define glSecondaryColor3usv MANGLE(SecondaryColor3usv)
#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT)
#define glSecondaryColorPointer MANGLE(SecondaryColorPointer)
#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT)
#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM)
#define glSelectBuffer MANGLE(SelectBuffer)
@@ -935,32 +1000,69 @@
#define glVertex4s MANGLE(Vertex4s)
#define glVertex4sv MANGLE(Vertex4sv)
#define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV)
#define glVertexAttrib1dARB MANGLE(VertexAttrib1dARB)
#define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV)
#define glVertexAttrib1dvARB MANGLE(VertexAttrib1dvARB)
#define glVertexAttrib1dvNV MANGLE(VertexAttrib1dvNV)
#define glVertexAttrib1fARB MANGLE(VertexAttrib1fARB)
#define glVertexAttrib1fNV MANGLE(VertexAttrib1fNV)
#define glVertexAttrib1fvARB MANGLE(VertexAttrib1fvARB)
#define glVertexAttrib1fvNV MANGLE(VertexAttrib1fvNV)
#define glVertexAttrib1sARB MANGLE(VertexAttrib1sARB)
#define glVertexAttrib1sNV MANGLE(VertexAttrib1sNV)
#define glVertexAttrib1svARB MANGLE(VertexAttrib1svARB)
#define glVertexAttrib1svNV MANGLE(VertexAttrib1svNV)
#define glVertexAttrib2dARB MANGLE(VertexAttrib2dARB)
#define glVertexAttrib2dNV MANGLE(VertexAttrib2dNV)
#define glVertexAttrib2dvARB MANGLE(VertexAttrib2dvARB)
#define glVertexAttrib2dvNV MANGLE(VertexAttrib2dvNV)
#define glVertexAttrib2fARB MANGLE(VertexAttrib2fARB)
#define glVertexAttrib2fNV MANGLE(VertexAttrib2fNV)
#define glVertexAttrib2fvARB MANGLE(VertexAttrib2fvARB)
#define glVertexAttrib2fvNV MANGLE(VertexAttrib2fvNV)
#define glVertexAttrib2sARB MANGLE(VertexAttrib2sARB)
#define glVertexAttrib2sNV MANGLE(VertexAttrib2sNV)
#define glVertexAttrib2svARB MANGLE(VertexAttrib2svARB)
#define glVertexAttrib2svNV MANGLE(VertexAttrib2svNV)
#define glVertexAttrib3dARB MANGLE(VertexAttrib3dARB)
#define glVertexAttrib3dNV MANGLE(VertexAttrib3dNV)
#define glVertexAttrib3dvARB MANGLE(VertexAttrib3dvARB)
#define glVertexAttrib3dvNV MANGLE(VertexAttrib3dvNV)
#define glVertexAttrib3fARB MANGLE(VertexAttrib3fARB)
#define glVertexAttrib3fNV MANGLE(VertexAttrib3fNV)
#define glVertexAttrib3fvARB MANGLE(VertexAttrib3fvARB)
#define glVertexAttrib3fvNV MANGLE(VertexAttrib3fvNV)
#define glVertexAttrib3sARB MANGLE(VertexAttrib3sARB)
#define glVertexAttrib3sNV MANGLE(VertexAttrib3sNV)
#define glVertexAttrib3svARB MANGLE(VertexAttrib3svARB)
#define glVertexAttrib3svNV MANGLE(VertexAttrib3svNV)
#define glVertexAttrib4NbvARB MANGLE(VertexAttrib4NbvARB)
#define glVertexAttrib4NivARB MANGLE(VertexAttrib4NivARB)
#define glVertexAttrib4NsvARB MANGLE(VertexAttrib4NsvARB)
#define glVertexAttrib4NubARB MANGLE(VertexAttrib4NubARB)
#define glVertexAttrib4NubvARB MANGLE(VertexAttrib4NubvARB)
#define glVertexAttrib4NuivARB MANGLE(VertexAttrib4NuivARB)
#define glVertexAttrib4NusvARB MANGLE(VertexAttrib4NusvARB)
#define glVertexAttrib4bvARB MANGLE(VertexAttrib4bvARB)
#define glVertexAttrib4dARB MANGLE(VertexAttrib4dARB)
#define glVertexAttrib4dNV MANGLE(VertexAttrib4dNV)
#define glVertexAttrib4dvARB MANGLE(VertexAttrib4dvARB)
#define glVertexAttrib4dvNV MANGLE(VertexAttrib4dvNV)
#define glVertexAttrib4fARB MANGLE(VertexAttrib4fARB)
#define glVertexAttrib4fNV MANGLE(VertexAttrib4fNV)
#define glVertexAttrib4fvARB MANGLE(VertexAttrib4fvARB)
#define glVertexAttrib4fvNV MANGLE(VertexAttrib4fvNV)
#define glVertexAttrib4ivARB MANGLE(VertexAttrib4ivARB)
#define glVertexAttrib4sARB MANGLE(VertexAttrib4sARB)
#define glVertexAttrib4sNV MANGLE(VertexAttrib4sNV)
#define glVertexAttrib4svARB MANGLE(VertexAttrib4svARB)
#define glVertexAttrib4svNV MANGLE(VertexAttrib4svNV)
#define glVertexAttrib4ubNV MANGLE(VertexAttrib4ubNV)
#define glVertexAttrib4ubvARB MANGLE(VertexAttrib4ubvARB)
#define glVertexAttrib4ubvNV MANGLE(VertexAttrib4ubvNV)
#define glVertexAttrib4uivARB MANGLE(VertexAttrib4uivARB)
#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB)
#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB)
#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV)
#define glVertexAttribs1dvNV MANGLE(VertexAttribs1dvNV)
#define glVertexAttribs1fvNV MANGLE(VertexAttribs1fvNV)
@@ -976,44 +1078,44 @@
#define glVertexAttribs4svNV MANGLE(VertexAttribs4svNV)
#define glVertexAttribs4ubvNV MANGLE(VertexAttribs4ubvNV)
#define glVertexBlendARB MANGLE(VertexBlendARB)
#define glVertexBlendEnvf MANGLE(VertexBlendEnvf)
#define glVertexBlendEnvi MANGLE(VertexBlendEnvi)
#define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI)
#define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI)
#define glVertexPointer MANGLE(VertexPointer)
#define glVertexPointerEXT MANGLE(VertexPointerEXT)
#define glVertexPointerListIBM MANGLE(VertexPointerListIBM)
#define glVertexPointervINTEL MANGLE(VertexPointervINTEL)
#define glVertexStream1d MANGLE(VertexStream1d)
#define glVertexStream1dv MANGLE(VertexStream1dv)
#define glVertexStream1f MANGLE(VertexStream1f)
#define glVertexStream1fv MANGLE(VertexStream1fv)
#define glVertexStream1i MANGLE(VertexStream1i)
#define glVertexStream1iv MANGLE(VertexStream1iv)
#define glVertexStream1s MANGLE(VertexStream1s)
#define glVertexStream1sv MANGLE(VertexStream1sv)
#define glVertexStream2d MANGLE(VertexStream2d)
#define glVertexStream2dv MANGLE(VertexStream2dv)
#define glVertexStream2f MANGLE(VertexStream2f)
#define glVertexStream2fv MANGLE(VertexStream2fv)
#define glVertexStream2i MANGLE(VertexStream2i)
#define glVertexStream2iv MANGLE(VertexStream2iv)
#define glVertexStream2s MANGLE(VertexStream2s)
#define glVertexStream2sv MANGLE(VertexStream2sv)
#define glVertexStream3d MANGLE(VertexStream3d)
#define glVertexStream3dv MANGLE(VertexStream3dv)
#define glVertexStream3f MANGLE(VertexStream3f)
#define glVertexStream3fv MANGLE(VertexStream3fv)
#define glVertexStream3i MANGLE(VertexStream3i)
#define glVertexStream3iv MANGLE(VertexStream3iv)
#define glVertexStream3s MANGLE(VertexStream3s)
#define glVertexStream3sv MANGLE(VertexStream3sv)
#define glVertexStream4d MANGLE(VertexStream4d)
#define glVertexStream4dv MANGLE(VertexStream4dv)
#define glVertexStream4f MANGLE(VertexStream4f)
#define glVertexStream4fv MANGLE(VertexStream4fv)
#define glVertexStream4i MANGLE(VertexStream4i)
#define glVertexStream4iv MANGLE(VertexStream4iv)
#define glVertexStream4s MANGLE(VertexStream4s)
#define glVertexStream4sv MANGLE(VertexStream4sv)
#define glVertexStream1dATI MANGLE(VertexStream1dATI)
#define glVertexStream1dvATI MANGLE(VertexStream1dvATI)
#define glVertexStream1fATI MANGLE(VertexStream1fATI)
#define glVertexStream1fvATI MANGLE(VertexStream1fvATI)
#define glVertexStream1iATI MANGLE(VertexStream1iATI)
#define glVertexStream1ivATI MANGLE(VertexStream1ivATI)
#define glVertexStream1sATI MANGLE(VertexStream1sATI)
#define glVertexStream1svATI MANGLE(VertexStream1svATI)
#define glVertexStream2dATI MANGLE(VertexStream2dATI)
#define glVertexStream2dvATI MANGLE(VertexStream2dvATI)
#define glVertexStream2fATI MANGLE(VertexStream2fATI)
#define glVertexStream2fvATI MANGLE(VertexStream2fvATI)
#define glVertexStream2iATI MANGLE(VertexStream2iATI)
#define glVertexStream2ivATI MANGLE(VertexStream2ivATI)
#define glVertexStream2sATI MANGLE(VertexStream2sATI)
#define glVertexStream2svATI MANGLE(VertexStream2svATI)
#define glVertexStream3dATI MANGLE(VertexStream3dATI)
#define glVertexStream3dvATI MANGLE(VertexStream3dvATI)
#define glVertexStream3fATI MANGLE(VertexStream3fATI)
#define glVertexStream3fvATI MANGLE(VertexStream3fvATI)
#define glVertexStream3iATI MANGLE(VertexStream3iATI)
#define glVertexStream3ivATI MANGLE(VertexStream3ivATI)
#define glVertexStream3sATI MANGLE(VertexStream3sATI)
#define glVertexStream3svATI MANGLE(VertexStream3svATI)
#define glVertexStream4dATI MANGLE(VertexStream4dATI)
#define glVertexStream4dvATI MANGLE(VertexStream4dvATI)
#define glVertexStream4fATI MANGLE(VertexStream4fATI)
#define glVertexStream4fvATI MANGLE(VertexStream4fvATI)
#define glVertexStream4iATI MANGLE(VertexStream4iATI)
#define glVertexStream4ivATI MANGLE(VertexStream4ivATI)
#define glVertexStream4sATI MANGLE(VertexStream4sATI)
#define glVertexStream4svATI MANGLE(VertexStream4svATI)
#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT)
#define glVertexWeightfEXT MANGLE(VertexWeightfEXT)
#define glVertexWeightfvEXT MANGLE(VertexWeightfvEXT)
@@ -1027,21 +1129,53 @@
#define glWeightubvARB MANGLE(WeightubvARB)
#define glWeightuivARB MANGLE(WeightuivARB)
#define glWeightusvARB MANGLE(WeightusvARB)
#define glWindowPos2d MANGLE(WindowPos2d)
#define glWindowPos2dARB MANGLE(WindowPos2dARB)
#define glWindowPos2dMESA MANGLE(WindowPos2dMESA)
#define glWindowPos2dv MANGLE(WindowPos2dv)
#define glWindowPos2dvARB MANGLE(WindowPos2dvARB)
#define glWindowPos2dvMESA MANGLE(WindowPos2dvMESA)
#define glWindowPos2f MANGLE(WindowPos2f)
#define glWindowPos2fARB MANGLE(WindowPos2fARB)
#define glWindowPos2fMESA MANGLE(WindowPos2fMESA)
#define glWindowPos2fv MANGLE(WindowPos2fv)
#define glWindowPos2fvARB MANGLE(WindowPos2fvARB)
#define glWindowPos2fvMESA MANGLE(WindowPos2fvMESA)
#define glWindowPos2i MANGLE(WindowPos2i)
#define glWindowPos2iARB MANGLE(WindowPos2iARB)
#define glWindowPos2iMESA MANGLE(WindowPos2iMESA)
#define glWindowPos2iv MANGLE(WindowPos2iv)
#define glWindowPos2ivARB MANGLE(WindowPos2ivARB)
#define glWindowPos2ivMESA MANGLE(WindowPos2ivMESA)
#define glWindowPos2s MANGLE(WindowPos2s)
#define glWindowPos2sARB MANGLE(WindowPos2sARB)
#define glWindowPos2sMESA MANGLE(WindowPos2sMESA)
#define glWindowPos2sv MANGLE(WindowPos2sv)
#define glWindowPos2svARB MANGLE(WindowPos2svARB)
#define glWindowPos2svMESA MANGLE(WindowPos2svMESA)
#define glWindowPos3d MANGLE(WindowPos3d)
#define glWindowPos3dARB MANGLE(WindowPos3dARB)
#define glWindowPos3dMESA MANGLE(WindowPos3dMESA)
#define glWindowPos3dv MANGLE(WindowPos3dv)
#define glWindowPos3dvARB MANGLE(WindowPos3dvARB)
#define glWindowPos3dvMESA MANGLE(WindowPos3dvMESA)
#define glWindowPos3f MANGLE(WindowPos3f)
#define glWindowPos3fARB MANGLE(WindowPos3fARB)
#define glWindowPos3fMESA MANGLE(WindowPos3fMESA)
#define glWindowPos3fv MANGLE(WindowPos3fv)
#define glWindowPos3fvARB MANGLE(WindowPos3fvARB)
#define glWindowPos3fvMESA MANGLE(WindowPos3fvMESA)
#define glWindowPos3i MANGLE(WindowPos3i)
#define glWindowPos3iARB MANGLE(WindowPos3iARB)
#define glWindowPos3iMESA MANGLE(WindowPos3iMESA)
#define glWindowPos3iv MANGLE(WindowPos3iv)
#define glWindowPos3ivARB MANGLE(WindowPos3ivARB)
#define glWindowPos3ivMESA MANGLE(WindowPos3ivMESA)
#define glWindowPos3s MANGLE(WindowPos3s)
#define glWindowPos3sARB MANGLE(WindowPos3sARB)
#define glWindowPos3sMESA MANGLE(WindowPos3sMESA)
#define glWindowPos3sv MANGLE(WindowPos3sv)
#define glWindowPos3svARB MANGLE(WindowPos3svARB)
#define glWindowPos3svMESA MANGLE(WindowPos3svMESA)
#define glWindowPos4dMESA MANGLE(WindowPos4dMESA)
#define glWindowPos4dvMESA MANGLE(WindowPos4dvMESA)
@@ -1052,5 +1186,4 @@
#define glWindowPos4sMESA MANGLE(WindowPos4sMESA)
#define glWindowPos4svMESA MANGLE(WindowPos4svMESA)
#define glWriteMaskEXT MANGLE(WriteMaskEXT)
#endif /* GL_MANGLE_H */

View File

@@ -1,4 +1,4 @@
/* $Id: glx.h,v 1.38.4.1 2003/02/23 19:37:15 keithw Exp $ */
/* $Id: glx.h,v 1.38 2002/10/14 13:52:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -295,7 +295,7 @@ extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
/* GLX 1.4 and later */
extern void (*glXGetProcAddress(const GLubyte *procname))( void );
extern void (*glXGetProcAddress(const GLubyte *procname))();
#ifndef GLX_GLXEXT_LEGACY

View File

@@ -260,6 +260,9 @@ extern "C" {
#ifndef GLX_MESA_release_buffers
#endif
#ifndef GLX_MESA_agp_offset
#endif
#ifndef GLX_MESA_set_3dfx_mode
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
@@ -568,6 +571,14 @@ extern Bool glXSet3DfxModeMESA (int);
typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
#endif
#ifndef GLX_MESA_agp_offset
#define GLX_MESA_agp_offset 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern GLuint glXGetAGPOffsetMESA (const GLvoid *);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef GLuint ( * PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *);
#endif
#ifndef GLX_SGIX_visual_select_group
#define GLX_SGIX_visual_select_group 1
#endif

View File

@@ -58,12 +58,12 @@ typedef struct __GLinterfaceRec __GLinterface;
** and used by the "operating system".
*/
/**
* Mode and limit information for a context. This information is
* kept around in the context so that values can be used during
* command execution, and for returning information about the
* context to the application.
*/
/*
** Mode and limit information for a context. This information is
** kept around in the context so that values can be used during
** command execution, and for returning information about the
** context to the application.
*/
typedef struct __GLcontextModesRec {
GLboolean rgbMode;
GLboolean colorIndexMode;

View File

@@ -1,25 +0,0 @@
PROGS = gears \
glinfo \
texobj \
bounce \
terrain
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
# make executable from .c file:
.c: $(LIB_DEP)
gcc -I../include -I../util -g $< -L../lib -lglut -lGL -lm -o $@
default: $(PROGS)
clean:
-rm *.o *~

View File

@@ -1,4 +1,4 @@
/* $Id: bounce.c,v 1.3.8.1 2003/02/23 19:25:07 keithw Exp $ */
/* $Id: bounce.c,v 1.3 2000/08/16 20:36:34 brianp Exp $ */
/*
* Bouncing ball demo.
@@ -33,8 +33,8 @@ GLfloat Xmin = -4.0, Xmax = 4.0;
GLfloat Ymin = -3.8, Ymax = 4.0;
GLfloat G = -0.1;
static void
draw_ball(void)
static GLuint
make_ball(void)
{
GLuint list;
GLfloat a, b;
@@ -43,9 +43,9 @@ draw_ball(void)
GLuint color;
GLfloat x, y, z;
/* list = glGenLists(1); */
list = glGenLists(1);
/* glNewList(list, GL_COMPILE); */
glNewList(list, GL_COMPILE);
color = 0;
for (a = -90.0; a + da <= 90.0; a += da) {
@@ -54,10 +54,10 @@ draw_ball(void)
for (b = 0.0; b <= 360.0; b += db) {
if (color) {
/* glIndexi(RED); */
glIndexi(RED);
glColor3f(1, 0, 0);
} else {
/* glIndexi(WHITE); */
glIndexi(WHITE);
glColor3f(1, 1, 1);
}
@@ -77,12 +77,11 @@ draw_ball(void)
}
/* glEndList(); */
glEndList();
/* return list; */
return list;
}
static void
reshape(int width, int height)
{
@@ -111,7 +110,7 @@ draw(void)
glClear(GL_COLOR_BUFFER_BIT);
/* glIndexi(CYAN); */
glIndexi(CYAN);
glColor3f(0, 1, 1);
glBegin(GL_LINES);
for (i = -5; i <= 5; i++) {
@@ -139,8 +138,7 @@ draw(void)
glRotatef(90.0, 1.0, 0.0, 0.0);
glRotatef(Zrot, 0.0, 0.0, 1.0);
/* glCallList(Ball); */
draw_ball();
glCallList(Ball);
glPopMatrix();
@@ -200,7 +198,7 @@ int main(int argc, char *argv[])
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Bounce");
/* Ball = make_ball(); */
Ball = make_ball();
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glDisable(GL_DITHER);

View File

@@ -1,4 +1,4 @@
/* $Id: gears.c,v 1.6.12.1 2003/02/23 19:25:07 keithw Exp $ */
/* $Id: gears.c,v 1.6 2000/04/06 02:22:59 brianp Exp $ */
/*
* 3-D gear wheels. This program is in the public domain.
@@ -59,7 +59,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
glShadeModel(GL_FLAT);
/* glNormal3f(0.0, 0.0, 1.0); */
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
@@ -87,7 +87,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
}
glEnd();
/* glNormal3f(0.0, 0.0, -1.0); */
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
@@ -127,18 +127,18 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
len = sqrt(u * u + v * v);
u /= len;
v /= len;
/* glNormal3f(v, -u, 0.0); */
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
/* glNormal3f(cos(angle), sin(angle), 0.0); */
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
/* glNormal3f(v, -u, 0.0); */
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
/* glNormal3f(cos(angle), sin(angle), 0.0); */
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
@@ -149,11 +149,10 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glColor3f( .5, .5, .5 );
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
/* glNormal3f(-cos(angle), -sin(angle), 0.0); */
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
@@ -168,11 +167,6 @@ static GLfloat angle = 0.0;
static void
draw(void)
{
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
glClearColor( 1,0,1,1 );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
@@ -183,23 +177,19 @@ draw(void)
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glColor3fv( red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glColor3fv( green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glColor3fv( blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
@@ -294,15 +284,37 @@ static void
init(int argc, char *argv[])
{
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
GLint i;
/* glLightfv(GL_LIGHT0, GL_POSITION, pos); */
glEnable(GL_CULL_FACE);
/* glEnable(GL_LIGHTING); */
/* glEnable(GL_LIGHT0); */
/* glEnable(GL_DEPTH_TEST); */
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* glEnable(GL_NORMALIZE); */
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
for ( i=1; i<argc; i++ ) {
if (strcmp(argv[i], "-info")==0) {
@@ -333,7 +345,7 @@ int main(int argc, char *argv[])
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(900, 900);
glutInitWindowSize(300, 300);
glutCreateWindow("Gears");
init(argc, argv);

View File

@@ -1,4 +1,4 @@
/* $Id: gloss.c,v 1.6 2000/12/24 22:53:54 pesco Exp $ */
/* $Id: gloss.c,v 1.6.6.1 2002/11/28 15:52:11 brianp Exp $ */
/*
* Specular reflection demo. The specular highlight is modulated by
@@ -85,9 +85,9 @@ static void Display( void )
glCallList(Object);
/* Second pass: specular lighting with reflection texture */
glEnable(GL_POLYGON_OFFSET_FILL);
glBlendFunc(GL_ONE, GL_ONE); /* add */
glEnable(GL_BLEND);
glDepthFunc(GL_LEQUAL);
glMaterialfv(GL_FRONT, GL_DIFFUSE, Black);
glMaterialfv(GL_FRONT, GL_SPECULAR, White);
if (DoSpecTexture) {
@@ -102,6 +102,7 @@ static void Display( void )
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_BLEND);
glDisable(GL_POLYGON_OFFSET_FILL);
glPopMatrix();
@@ -341,6 +342,8 @@ static void Init( int argc, char *argv[] )
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glPolygonOffset( -1, -1 );
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));

View File

@@ -1,4 +1,4 @@
/* $Id: isosurf.c,v 1.15.4.1 2003/02/23 21:04:25 keithw Exp $ */
/* $Id: isosurf.c,v 1.15 2002/10/18 17:47:35 kschultz Exp $ */
/*
* Display an isosurface of 3-D wind speed volume.
@@ -484,7 +484,7 @@ static void draw_surface( unsigned int with_state )
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]);
glBegin( GL_TRIANGLES );
for (k = 0 ; k < nr ; k++) {
glColor3fv( &compressed_data[tri_indices[i+k]][3] );
glNormal3fv( &compressed_data[tri_indices[i+k]][3] );
glVertex3fv( &compressed_data[tri_indices[i+k]][0] );
}
glEnd();
@@ -492,7 +492,7 @@ static void draw_surface( unsigned int with_state )
} else {
glBegin( GL_TRIANGLES );
for (i = 0 ; i < num_tri_verts ; i++) {
glColor3fv( &compressed_data[tri_indices[i]][3] );
glNormal3fv( &compressed_data[tri_indices[i]][3] );
glVertex3fv( &compressed_data[tri_indices[i]][0] );
}
glEnd();
@@ -506,7 +506,7 @@ static void draw_surface( unsigned int with_state )
*/
glBegin( GL_POINTS );
for ( i = 0 ; i < numuniq ; i++ ) {
glColor3fv( &compressed_data[i][3] );
glNormal3fv( &compressed_data[i][3] );
glVertex3fv( &compressed_data[i][0] );
}
glEnd();
@@ -515,7 +515,7 @@ static void draw_surface( unsigned int with_state )
case (GLVERTEX|STRIPS):
glBegin( GL_TRIANGLE_STRIP );
for (i=0;i<numverts;i++) {
glColor3fv( &data[i][0] );
glNormal3fv( &data[i][3] );
glVertex3fv( &data[i][0] );
}
glEnd();
@@ -595,24 +595,24 @@ static void InitMaterials(void)
static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0};
static float lmodel_twoside[] = {GL_FALSE};
/* glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); */
/* glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); */
/* glLightfv(GL_LIGHT0, GL_POSITION, position0); */
/* glEnable(GL_LIGHT0); */
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, position0);
glEnable(GL_LIGHT0);
/* glLightfv(GL_LIGHT1, GL_AMBIENT, ambient); */
/* glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); */
/* glLightfv(GL_LIGHT1, GL_POSITION, position1); */
/* glEnable(GL_LIGHT1); */
glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT1, GL_POSITION, position1);
glEnable(GL_LIGHT1);
/* glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); */
/* glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside); */
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
/* glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess); */
/* glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular); */
/* glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse); */
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse);
/* glPolygonStipple (halftone); */
glPolygonStipple (halftone);
}
@@ -736,6 +736,65 @@ static void ModeMenu(int m)
print_flags("primitive", state & PRIMITIVE_MASK);
print_flags("render style", state & RENDER_STYLE_MASK);
if ((state & PRIMITIVE_MASK) != STRIPS &&
((state & RENDER_STYLE_MASK) == DRAW_ELTS ||
(state & RENDER_STYLE_MASK) == ARRAY_ELT ||
(state & PRIMITIVE_MASK) == POINTS))
{
fprintf(stderr, "enabling small arrays\n");
/* Rendering any primitive with draw-element/array-element
* --> Can't do strips here as ordering has been lost in
* compaction process...
*/
glVertexPointerEXT( 3, GL_FLOAT, sizeof(data[0]), numuniq,
compressed_data );
glNormalPointerEXT( GL_FLOAT, sizeof(data[0]), numuniq,
&compressed_data[0][3]);
#ifdef GL_EXT_compiled_vertex_array
if (allowed & LOCKED) {
if (state & LOCKED) {
glLockArraysEXT( 0, numuniq );
} else {
glUnlockArraysEXT();
}
}
#endif
}
else if ((state & PRIMITIVE_MASK) == TRIANGLES &&
(state & RENDER_STYLE_MASK) == DRAW_ARRAYS) {
fprintf(stderr, "enabling big arrays\n");
/* Only get here for TRIANGLES and drawarrays
*/
glVertexPointerEXT( 3, GL_FLOAT, sizeof(data[0]), (numverts-2) * 3,
expanded_data );
glNormalPointerEXT( GL_FLOAT, sizeof(data[0]), (numverts-2) * 3,
&expanded_data[0][3]);
#ifdef GL_EXT_compiled_vertex_array
if (allowed & LOCKED) {
if (state & LOCKED) {
glLockArraysEXT( 0, (numverts-2)*3 );
} else {
glUnlockArraysEXT();
}
}
#endif
}
else {
fprintf(stderr, "enabling normal arrays\n");
glVertexPointerEXT( 3, GL_FLOAT, sizeof(data[0]), numverts, data );
glNormalPointerEXT( GL_FLOAT, sizeof(data[0]), numverts, &data[0][3]);
#ifdef GL_EXT_compiled_vertex_array
if (allowed & LOCKED) {
if (state & LOCKED) {
glLockArraysEXT( 0, numverts );
} else {
glUnlockArraysEXT();
}
}
#endif
}
}
#endif
@@ -768,9 +827,9 @@ static void Init(int argc, char *argv[])
plane[3] = 0.0;
glClearColor(0.0, 0.0, 1.0, 0.0);
/* glEnable( GL_DEPTH_TEST ); */
/* glEnable( GL_VERTEX_ARRAY_EXT ); */
/* glEnable( GL_NORMAL_ARRAY_EXT ); */
glEnable( GL_DEPTH_TEST );
glEnable( GL_VERTEX_ARRAY_EXT );
glEnable( GL_NORMAL_ARRAY_EXT );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -778,24 +837,24 @@ static void Init(int argc, char *argv[])
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* glClipPlane(GL_CLIP_PLANE0, plane); */
glClipPlane(GL_CLIP_PLANE0, plane);
InitMaterials();
set_matrix();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
/* glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); */
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
/* glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); */
/* glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); */
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
/* Green fog is easy to see */
/* glFogi(GL_FOG_MODE,GL_EXP2); */
/* glFogfv(GL_FOG_COLOR,fogColor); */
/* glFogf(GL_FOG_DENSITY,0.15); */
/* glHint(GL_FOG_HINT,GL_DONT_CARE); */
glFogi(GL_FOG_MODE,GL_EXP2);
glFogfv(GL_FOG_COLOR,fogColor);
glFogf(GL_FOG_DENSITY,0.15);
glHint(GL_FOG_HINT,GL_DONT_CARE);
{
static int firsttime = 1;
@@ -813,7 +872,7 @@ static void Init(int argc, char *argv[])
}
ModeMenu(SHADE_SMOOTH|
UNLIT|
LIT|
POINT_FILTER|
NO_USER_CLIP|
NO_MATERIALS|
@@ -1062,9 +1121,6 @@ int main(int argc, char **argv)
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Display);
/* Benchmark(5,0); */
/* Benchmark(5,0); */
/* Benchmark(5,0); */
glutMainLoop();
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: osdemo.c,v 1.9 2002/07/12 15:54:19 brianp Exp $ */
/* $Id: osdemo.c,v 1.9.4.1 2003/03/03 03:14:55 brianp Exp $ */
/*
* Demo of off-screen Mesa rendering
@@ -139,6 +139,11 @@ static void render_image( void )
glPopMatrix();
/* This is very important!!!
* Make sure buffered commands are finished!!!
*/
glFinish();
Frames++;
if (perf) {
GLint t = glutGet(GLUT_ELAPSED_TIME);

View File

@@ -18,7 +18,7 @@
#ifdef _WIN32
#include <windows.h>
#endif
#define GL_GLEXT_LEGACY
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
/* Some <math.h> files do not define M_PI... */
@@ -264,15 +264,15 @@ menu(int option)
case 0:
makePointList();
break;
#if GL_EXT_point_parameters
#if GL_ARB_point_parameters
case 1:
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, constant);
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant);
break;
case 2:
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, linear);
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear);
break;
case 3:
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad);
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
break;
#endif
case 4:
@@ -281,12 +281,12 @@ menu(int option)
case 5:
blend = 0;
break;
#if GL_EXT_point_parameters
#if GL_ARB_point_parameters
case 6:
glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 1.0);
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
break;
case 7:
glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 10.0);
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 10.0);
break;
#endif
case 8:
@@ -468,8 +468,8 @@ main(int argc, char **argv)
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize(8.0);
#if GL_EXT_point_parameters
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad);
#if GL_ARB_point_parameters
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
#endif
glMatrixMode(GL_PROJECTION);
gluPerspective( /* field of view in degree */ 40.0,

View File

@@ -51,7 +51,7 @@ static GLfloat terraincolor[256 * 256][3];
static int win = 0;
static int fog = 0;
static int fog = 1;
static int bfcull = 1;
static int usetex = 1;
static int poutline = 0;
@@ -105,21 +105,6 @@ calcposobs(void)
obs[1] = 0.0;
}
static void
perspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{
GLdouble xmin, xmax, ymin, ymax;
ymax = zNear * tan(fovy * M_PI / 360.0);
ymin = -ymax;
xmin = ymin * aspect;
xmax = ymax * aspect;
/* don't call glFrustum() because of error semantics (covglu) */
glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}
static void
reshape(int width, int height)
{
@@ -128,7 +113,7 @@ reshape(int width, int height)
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
perspective(50.0, ((GLfloat) width / (GLfloat) height),
gluPerspective(50.0, ((GLfloat) width / (GLfloat) height),
lenghtXmnt * stepYmnt * 0.01, lenghtXmnt * stepYmnt * 0.7);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -224,25 +209,13 @@ printstring(void *font, char *string)
glutBitmapCharacter(font, string[i]);
}
static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
glBegin( GL_QUADS );
glVertex2f( x1, y1 );
glVertex2f( x2, y1 );
glVertex2f( x2, y2 );
glVertex2f( x1, y2 );
glEnd();
}
static void
printhelp(void)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0, 0.0, 0.0, 0.5);
_subset_Rectf(40, 40, 600, 440);
glRecti(40, 40, 600, 440);
glDisable(GL_BLEND);
glColor3f(1.0, 0.0, 0.0);
@@ -378,87 +351,6 @@ dojoy(void)
#endif
}
static void
lookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
GLfloat centerx, GLfloat centery, GLfloat centerz,
GLfloat upx, GLfloat upy, GLfloat upz)
{
GLfloat m[16];
GLfloat x[3], y[3], z[3];
GLfloat mag;
/* Make rotation matrix */
/* Z vector */
z[0] = eyex - centerx;
z[1] = eyey - centery;
z[2] = eyez - centerz;
mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
if (mag) { /* mpichler, 19950515 */
z[0] /= mag;
z[1] /= mag;
z[2] /= mag;
}
/* Y vector */
y[0] = upx;
y[1] = upy;
y[2] = upz;
/* X vector = Y cross Z */
x[0] = y[1] * z[2] - y[2] * z[1];
x[1] = -y[0] * z[2] + y[2] * z[0];
x[2] = y[0] * z[1] - y[1] * z[0];
/* Recompute Y = Z cross X */
y[0] = z[1] * x[2] - z[2] * x[1];
y[1] = -z[0] * x[2] + z[2] * x[0];
y[2] = z[0] * x[1] - z[1] * x[0];
/* mpichler, 19950515 */
/* cross product gives area of parallelogram, which is < 1.0 for
* non-perpendicular unit-length vectors; so normalize x, y here
*/
mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
if (mag) {
x[0] /= mag;
x[1] /= mag;
x[2] /= mag;
}
mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
if (mag) {
y[0] /= mag;
y[1] /= mag;
y[2] /= mag;
}
#define M(row,col) m[col*4+row]
M(0, 0) = x[0];
M(0, 1) = x[1];
M(0, 2) = x[2];
M(0, 3) = 0.0;
M(1, 0) = y[0];
M(1, 1) = y[1];
M(1, 2) = y[2];
M(1, 3) = 0.0;
M(2, 0) = z[0];
M(2, 1) = z[1];
M(2, 2) = z[2];
M(2, 3) = 0.0;
M(3, 0) = 0.0;
M(3, 1) = 0.0;
M(3, 2) = 0.0;
M(3, 3) = 1.0;
#undef M
glMultMatrixf(m);
/* Translate Eye to Origin */
glTranslatef(-eyex, -eyey, -eyez);
}
static void
drawscene(void)
{
@@ -467,24 +359,24 @@ drawscene(void)
dojoy();
glShadeModel(GL_SMOOTH);
/* glEnable(GL_DEPTH_TEST); */
glEnable(GL_DEPTH_TEST);
if (usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
/* if (fog) */
/* glEnable(GL_FOG); */
/* else */
/* glDisable(GL_FOG); */
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
calcposobs();
lookAt(obs[0], obs[1], obs[2],
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 1.0, 0.0);
@@ -492,8 +384,8 @@ drawscene(void)
glPopMatrix();
glDisable(GL_TEXTURE_2D);
/* glDisable(GL_DEPTH_TEST); */
/* glDisable(GL_FOG); */
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);
@@ -657,7 +549,7 @@ calccolor(GLfloat height, GLfloat c[3])
static void
loadpic(void)
{
GLubyte bufferter[256 * 256], terrainpic[256 * 256][4];
GLubyte bufferter[256 * 256], terrainpic[256 * 256];
FILE *FilePic;
int i, tmp;
GLenum gluerr;
@@ -673,28 +565,25 @@ loadpic(void)
terrain[i] = (bufferter[i] * (heightMnt / 255.0f));
calccolor((GLfloat) bufferter[i], terraincolor[i]);
tmp = (((int) bufferter[i]) + 96);
terrainpic[i][0] = (tmp > 255) ? 255 : tmp;
terrainpic[i][1] = (tmp > 255) ? 255 : tmp;
terrainpic[i][2] = (tmp > 255) ? 255 : tmp;
terrainpic[i][0] = 255;
terrainpic[i] = (tmp > 255) ? 255 : tmp;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, 256, 256, GL_RGBA,
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 1, 256, 256, GL_LUMINANCE,
GL_UNSIGNED_BYTE,
(GLvoid *) (&terrainpic[0][0])))) {
(GLvoid *) (&terrainpic[0])))) {
fprintf(stderr, "GLULib%s\n", (char *) gluErrorString(gluerr));
exit(-1);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
}
@@ -704,21 +593,21 @@ init(void)
float fogcolor[4] = { 0.6, 0.7, 0.7, 1.0 };
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
/* glClearDepth(1.0); */
/* glDepthFunc(GL_LEQUAL); */
glClearDepth(1.0);
glDepthFunc(GL_LEQUAL);
glShadeModel(GL_SMOOTH);
/* glEnable(GL_DEPTH_TEST); */
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* glEnable(GL_FOG); */
/* glFogi(GL_FOG_MODE, GL_EXP2); */
/* glFogfv(GL_FOG_COLOR, fogcolor); */
/* glFogf(GL_FOG_DENSITY, 0.0007); */
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.0007);
#ifdef FX
/* glHint(GL_FOG_HINT, GL_NICEST); */
glHint(GL_FOG_HINT, GL_NICEST);
#endif
reshape(scrwidth, scrheight);

View File

@@ -1,4 +1,4 @@
/* $Id: texobj.c,v 1.6.6.1 2003/02/23 19:25:07 keithw Exp $ */
/* $Id: texobj.c,v 1.6 2002/01/04 21:05:57 brianp Exp $ */
/*
* Example of using the 1.1 texture object functions.
@@ -17,7 +17,7 @@ static GLuint Window = 0;
static GLuint TexObj[2];
static GLfloat Angle = 0.0f;
static GLboolean UseObj = GL_TRUE;
static GLboolean UseObj = GL_FALSE;
#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2)
@@ -34,7 +34,7 @@ static GLboolean UseObj = GL_TRUE;
static void draw( void )
{
/* glDepthFunc(GL_EQUAL); */
glDepthFunc(GL_EQUAL);
/* glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );*/
glClear( GL_COLOR_BUFFER_BIT );
@@ -147,7 +147,7 @@ static void init( void )
0, 0, 2, 2, 2, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
GLubyte tex[64][4];
GLubyte tex[64][3];
GLint i, j;
@@ -156,7 +156,7 @@ static void init( void )
/* Setup texturing */
glEnable( GL_TEXTURE_2D );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
/* glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ); */
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST );
/* generate texture object IDs */
@@ -174,7 +174,7 @@ static void init( void )
if (UseObj) {
#ifdef TEXTURE_OBJECT
glBindTexture( GL_TEXTURE_2D, TexObj[0] );
/* assert(glIsTexture(TexObj[0])); */
assert(glIsTexture(TexObj[0]));
#endif
}
else {
@@ -190,12 +190,11 @@ static void init( void )
else {
tex[p][0] = 255; tex[p][1] = 255; tex[p][2] = 255;
}
tex[p][3] = 255;
}
}
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, tex );
glTexImage2D( GL_TEXTURE_2D, 0, 3, width, height, 0,
GL_RGB, GL_UNSIGNED_BYTE, tex );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
@@ -209,9 +208,9 @@ static void init( void )
if (UseObj) {
#ifdef TEXTURE_OBJECT
glBindTexture( GL_TEXTURE_2D, TexObj[1] );
/* assert(glIsTexture(TexObj[1])); */
assert(glIsTexture(TexObj[1]));
#endif
/* assert(!glIsTexture(TexObj[1] + 999)); */
assert(!glIsTexture(TexObj[1] + 999));
}
else {
glNewList( TexObj[1], GL_COMPILE );
@@ -228,8 +227,8 @@ static void init( void )
}
}
}
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, tex );
glTexImage2D( GL_TEXTURE_2D, 0, 3, width, height, 0,
GL_RGB, GL_UNSIGNED_BYTE, tex );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );

View File

@@ -498,7 +498,7 @@ main(int ac, char **av)
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
/* glEnable(GL_FOG); */
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);

View File

@@ -1,4 +1,4 @@
/* $Id: winpos.c,v 1.5 2002/04/22 16:03:37 brianp Exp $ */
/* $Id: winpos.c,v 1.5.4.2 2003/02/28 18:03:45 kschultz Exp $ */
/*
* Example of how to use the GL_MESA_window_pos extension.
@@ -12,7 +12,7 @@
#ifdef _WIN32
#include <windows.h>
#endif
#define GL_GLEXT_LEGACY
#define GL_GLEXT_PROTOTYPES
#include "GL/glut.h"
#include "readtex.c" /* a hack, I know */
@@ -30,18 +30,13 @@ static GLubyte *Image;
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
typedef void (APIENTRY * PFNWINDOWPOSFUNC)(GLfloat x, GLfloat y);
static PFNWINDOWPOSFUNC WindowPosFunc;
static void draw( void )
{
GLfloat angle;
char *extensions;
extensions = (char *) glGetString( GL_EXTENSIONS );
if (strstr( extensions, "GL_MESA_window_pos")==NULL) {
printf("Sorry, GL_MESA_window_pos extension not available.\n");
return;
}
glClear( GL_COLOR_BUFFER_BIT );
@@ -50,16 +45,14 @@ static void draw( void )
GLfloat y = 50.0 + 200.0 * sin( angle * M_PI / 180.0 );
/* Don't need to worry about the modelview or projection matrices!!! */
#ifdef GL_MESA_window_pos
glWindowPos2fMESA( x, y );
#endif
(*WindowPosFunc)( x, y );
glDrawPixels( ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image );
}
glFinish();
}
static void key( unsigned char key, int x, int y )
{
(void) x;
@@ -71,7 +64,6 @@ static void key( unsigned char key, int x, int y )
}
/* new window size or exposure */
static void reshape( int width, int height )
{
@@ -81,6 +73,24 @@ static void reshape( int width, int height )
static void init( void )
{
#ifdef GL_ARB_window_pos
if (glutExtensionSupported("GL_ARB_window_pos")) {
printf("Using GL_ARB_window_pos\n");
WindowPosFunc = &glWindowPos2fARB;
}
else
#elif defined(GL_ARB_window_pos)
if (glutExtensionSupported("GL_MESA_window_pos")) {
printf("Using GL_MESA_window_pos\n");
WindowPosFunc = &glWindowPos2fMESA;
}
else
#endif
{
printf("Sorry, GL_ARB/MESA_window_pos extension not available.\n");
exit(1);
}
Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", IMAGE_FILE);
@@ -90,7 +100,6 @@ static void init( void )
}
int main( int argc, char *argv[] )
{
glutInitWindowPosition(0, 0);

View File

@@ -1,28 +0,0 @@
PROGS = prim \
star \
line \
point \
depth \
tri \
bitmap1 \
bitmap2
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
# make executable from .c file:
.c: $(LIB_DEP)
gcc -I../include -g $< -L../lib -lglut -lGL -lm -o $@
default: $(PROGS)
clean:
-rm *.o *~

View File

@@ -1,36 +1,86 @@
# $Id: Makefile.DJ,v 1.1 1999/08/19 00:55:41 jtg Exp $
# Makefile for sample programs for MS-DOS with DJGPP
##### MACROS #####
INCDIR = ../include
GL_LIBS = ../lib/dosglut.a ../lib/dosglub.a ../lib/dosmesa.a
LIB_DEP = $(GL_LIBS)
PROGS = accum bitmap1 bitmap2 blendeq blendxor copy depth \
eval fog font line logo nurb olympic \
point prim quad select shape \
sphere star stencil stretch texture \
tri wave
##### RULES #####
.c: $(LIB_DEP)
gcc -I$(INCDIR) $(CFLAGS) $< $(LIB_DEP) -o $@
##### TARGETS #####
default: $(PROGS)
clean:
del *.
realclean: clean
del *.exe
# Mesa 3-D graphics library
# Version: 4.0
#
# 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.
# DOS/DJGPP samples makefile v1.3 for Mesa
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@yahoo.com
# Web : http://www.geocities.com/dborca
#
# Available options:
#
# Environment variables:
# CPU optimize for the given processor.
# default = k6
# GLIDE path to Glide3 SDK library files; used with FX.
# default = $(TOP)/lib/glide3
# FX=1 build for 3dfx Glide3. Note that this disables
# compilation of most DMesa code and requires fxMesa.
# As a consequence, you'll need the DJGPP Glide3
# library to build any application.
# default = no
# DXE=1 use DXE modules. The resolution object file must be
# present in the `lib' directory in order to use this
# option (see README.DJ for details).
# default = no
#
# Targets:
# <file.exe> build a specific file
#
.PHONY : all
.SUFFIXES : .c .o .exe
TOP = ..
CPU ?= k6
GLIDE ?= $(TOP)/lib/glide3
CC = gcc
CFLAGS = -Wall -W -pedantic
CFLAGS += -O2 -ffast-math -mcpu=$(CPU)
CFLAGS += -I$(TOP)/include
LD = gxx
LDFLAGS = -s -L$(TOP)/lib
ifeq ($(DXE),1)
DXE3TABLE = $(TOP)/lib/dxe3tbl.o
LDLIBS += -liglut -liglu -ligl -ldl
else
LDLIBS = -lglut -lglu -lgl
ifeq ($(FX),1)
LDFLAGS += -L$(GLIDE)
LDLIBS += -lglid3
endif
endif
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.o.exe:
$(LD) -o $@ $(LDFLAGS) $(DXE3TABLE) $< $(LDLIBS)
all:
$(error Must specify <filename.exe> to build)

View File

@@ -104,7 +104,7 @@ static void Init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
/* glClearIndex(0.0); */
glClearIndex(0.0);
}
static void Reshape(int width, int height)
@@ -140,14 +140,14 @@ static void Draw(void)
mapIA[0] = 1.0;
mapIA[1] = 1.0;
/* glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 2, mapIR); */
/* glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 2, mapI); */
/* glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 2, mapI); */
/* glPixelMapfv(GL_PIXEL_MAP_I_TO_A, 2, mapIA); */
/* glPixelTransferi(GL_MAP_COLOR, GL_TRUE); */
glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 2, mapIR);
glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 2, mapI);
glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 2, mapI);
glPixelMapfv(GL_PIXEL_MAP_I_TO_A, 2, mapIA);
glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
SetColor(COLOR_WHITE);
glRasterPos2fv(boxA);
glRasterPos3fv(boxA);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 24);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 8);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 2);
@@ -162,28 +162,28 @@ static void Draw(void)
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
SetColor(COLOR_WHITE);
glRasterPos2fv(boxB);
glRasterPos3fv(boxB);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
OpenGL_bits1);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
OpenGL_bits2);
SetColor(COLOR_YELLOW);
glRasterPos2fv(boxC);
glRasterPos3fv(boxC);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
OpenGL_bits1);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
OpenGL_bits2);
SetColor(COLOR_CYAN);
glRasterPos2fv(boxD);
glRasterPos3fv(boxD);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
OpenGL_bits1);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
OpenGL_bits2);
SetColor(COLOR_RED);
glRasterPos2fv(boxE);
glRasterPos3fv(boxE);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
OpenGL_bits1);
glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,

View File

@@ -620,19 +620,19 @@ static void Init(void)
GLint i;
glClearColor(0.0, 0.0, 0.0, 0.0);
/* glClearIndex(0.0); */
glClearIndex(0.0);
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
for (i = 0; i < 7; i++) {
/* exp_lists[i] = glGenLists(1); */
/* glNewList(exp_lists[i], GL_COMPILE); */
/* glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]); */
/* glEndList(); */
exp_lists[i] = glGenLists(1);
glNewList(exp_lists[i], GL_COMPILE);
glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]);
glEndList();
}
abuse = GL_FALSE;
useLists = GL_FALSE;
useLists = GL_TRUE;
}
static void Reshape(int width, int height)
@@ -696,10 +696,10 @@ static void Draw(void)
SetColor(COLOR_RED);
break;
}
glRasterPos2i((j*3)%5, (j*3)%8);
glRasterPos3i((j*3)%5, (j*3)%8, 0);
if (useLists) {
/* glCallList(exp_lists[i]); */
glCallList(exp_lists[i]);
} else {
glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]);
}
@@ -714,9 +714,9 @@ static void Draw(void)
for (j = 0; j < 40; j++) {
SetColor(COLOR_BLACK);
glRasterPos2i((j*3)%5, (j*3)%8);
glRasterPos3i((j*3)%5, (j*3)%8, 0);
if (useLists) {
/* glCallList(exp_lists[i]); */
glCallList(exp_lists[i]);
} else {
glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]);
}

View File

@@ -147,7 +147,7 @@ static void Draw(void)
glVertex3fv(pntB);
glEnd();
/* glPointSize(1); */
glPointSize(1);
SetColor(COLOR_GREEN);
glBegin(GL_POINTS);

View File

@@ -151,7 +151,7 @@ static void Draw(void)
glDisable(GL_POINT_SMOOTH);
}
/* glPointSize(size); */
glPointSize(size);
if (mode) {
(rgb) ? glColor3f(1.0, 0.0, 0.0) : glIndexf(CI_ANTI_ALIAS_RED);
} else {
@@ -164,7 +164,7 @@ static void Draw(void)
glDisable(GL_POINT_SMOOTH);
glDisable(GL_BLEND);
/* glPointSize(1); */
glPointSize(1);
SetColor(COLOR_GREEN);
glBegin(GL_POINTS);
glVertex3fv(point);

View File

@@ -52,27 +52,27 @@ static void Reshape(int width, int height)
windH = (GLint)height;
}
static void RotateRestoreColorMask( int rotate )
static void RotateColorMask(void)
{
static GLint rotation = 0;
if (rotate) rotation = (rotation + 1) & 0x3;
rotation = (rotation + 1) & 0x3;
switch (rotation) {
case 0:
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
/* glIndexMask( 0xff ); */
glIndexMask( 0xff );
break;
case 1:
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
/* glIndexMask(0xFE); */
glIndexMask(0xFE);
break;
case 2:
glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
/* glIndexMask(0xFD); */
glIndexMask(0xFD);
break;
case 3:
glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE);
/* glIndexMask(0xFB); */
glIndexMask(0xFB);
break;
}
}
@@ -90,7 +90,7 @@ static void Key(unsigned char key, int x, int y)
mode2 = !mode2;
break;
case '3':
RotateRestoreColorMask( 1 );
RotateColorMask();
break;
default:
return;
@@ -344,7 +344,7 @@ static void Rect(void)
{
SetColor(COLOR_GREEN);
/* glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4); */
glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4);
}
static void PolygonFunc(void)
@@ -445,16 +445,15 @@ static void Draw(void)
glViewport(0, 0, windW, windH);
glDisable(GL_SCISSOR_TEST);
/* glPushAttrib(GL_COLOR_BUFFER_BIT); */
glPushAttrib(GL_COLOR_BUFFER_BIT);
glColorMask(1, 1, 1, 1);
/* glIndexMask(~0); */
glIndexMask(~0);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* glPopAttrib(); */
RotateRestoreColorMask( 0 );
glPopAttrib();
if (mode1) {
glShadeModel(GL_SMOOTH);
@@ -462,11 +461,11 @@ static void Draw(void)
glShadeModel(GL_FLAT);
}
/* if (mode2) { */
/* glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); */
/* } else { */
/* glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); */
/* } */
if (mode2) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
} else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
Viewport(0, 0); Point();
Viewport(0, 1); Lines();
@@ -479,13 +478,10 @@ static void Draw(void)
Viewport(1, 2); Triangles();
Viewport(1, 3); TriangleStrip();
Viewport(2, 0); Rect();
Viewport(2, 1); PolygonFunc();
Viewport(2, 2); Quads();
Viewport(2, 3); QuadStrip();
if (0) {
}
glFlush();

View File

@@ -256,18 +256,30 @@ int main(int argc, char **argv)
{
int width, height;
GLubyte *data;
char buff[32];
int n;
FILE *fo;
if (argc != 2)
if (argc != 3)
{
fprintf(stderr, "usage: %s <filename>\n", argv[0]);
fprintf(stderr, "usage: %s <infile.rgb> <outfile.p6>\n", argv[0]);
return 1;
}
data = read_rgb_texture(argv[1], &width, &height);
printf("P6\n%d %d\n255\n", width, height);
fwrite(data, width * 3, height, stdout);
n = sprintf(buff, "P6\n%d %d\n255\n", width, height);
/* [dBorca] avoid LF to CRLF conversion */
if ((fo = fopen(argv[2], "wb")) == NULL) {
fprintf(stderr, "Cannot open output file!\n");
exit(1);
}
fwrite(buff, n, 1, fo);
fwrite(data, width * 3, height, fo);
fclose(fo);
return 0;
}

View File

@@ -279,11 +279,11 @@ static void Draw(void)
if (showVerticies) {
(rgb) ? glColor3fv(RGBMap[COLOR_RED]) : glIndexf(color1);
/* glRectf(p0[0]-2, p0[1]-2, p0[0]+2, p0[1]+2); */
glRectf(p0[0]-2, p0[1]-2, p0[0]+2, p0[1]+2);
(rgb) ? glColor3fv(RGBMap[COLOR_GREEN]) : glIndexf(color2);
/* glRectf(p1[0]-2, p1[1]-2, p1[0]+2, p1[1]+2); */
glRectf(p1[0]-2, p1[1]-2, p1[0]+2, p1[1]+2);
(rgb) ? glColor3fv(RGBMap[COLOR_BLUE]) : glIndexf(color3);
/* glRectf(p2[0]-2, p2[1]-2, p2[0]+2, p2[1]+2); */
glRectf(p2[0]-2, p2[1]-2, p2[0]+2, p2[1]+2);
}
glPopMatrix();
@@ -306,7 +306,7 @@ static void Draw(void)
glScalef(zoom, zoom, zoom);
glRotatef(zRotation, 0,0,1);
/* glPointSize(10); */
glPointSize(10);
glLineWidth(5);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_STIPPLE);
@@ -322,7 +322,7 @@ static void Draw(void)
glVertex3fv(p2);
EndPrim();
/* glPointSize(1); */
glPointSize(1);
glLineWidth(1);
glDisable(GL_POINT_SMOOTH);
glDisable(GL_LINE_STIPPLE);

View File

@@ -6,9 +6,26 @@
CC = gcc
CFLAGS = -g -I../include
LIBS = -L../lib -lGL -lglut -lm
LIBS = -L../lib -lglut -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXext -lm
PROGS = miniglxtest miniglxsample manytex
PROGS = antialias \
cva \
dinoshade \
fogcoord \
getprocaddress \
manytex \
multipal \
projtex \
seccolor \
sharedtex \
stencilwrap \
texline \
texwrap \
vptest1 \
vptest2 \
vptest3 \
vptorus \
vpwarpmesh
##### RULES #####
@@ -28,3 +45,10 @@ clean:
rm -f $(PROGS)
rm -f *.o
# auto code generation
getprocaddress: getprocaddress.c getproclist.h
getproclist.h: ../bin/APIspec getprocaddress.c getprocaddress.py
python getprocaddress.py > getproclist.h

View File

@@ -1,4 +1,4 @@
/* $Id: cva.c,v 1.4 2002/01/16 01:03:25 kschultz Exp $ */
/* $Id: cva.c,v 1.4.4.1 2003/01/28 15:31:49 brianp Exp $ */
/*
* Trivial CVA test, good for testing driver fastpaths (especially
@@ -133,7 +133,9 @@ int main( int argc, char **argv )
*/
string = (char *) glGetString( GL_VERSION );
if ( (!strstr( string, "1.2" ))&&(!strstr(string,"1.3"))) {
if ( !strstr(string, "1.2") &&
!strstr(string, "1.3") &&
!strstr(string, "1.4")) {
fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" );
exit( -1 );
}

View File

@@ -1,478 +0,0 @@
/* $Id: glfbdevtest.c,v 1.1.4.5 2002/11/27 00:26:59 brianp Exp $ */
/*
* Test the GLFBDev interface. Only tested with radeonfb driver!!!!
*/
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <linux/fb.h>
#include <linux/kd.h>
#include <linux/vt.h>
#include <GL/glut.h>
#include "GL/glfbdev.h"
#define DEFAULT_DEPTH 8
static struct fb_fix_screeninfo FixedInfo;
static struct fb_var_screeninfo VarInfo, OrigVarInfo;
static int DesiredDepth = 0;
static int OriginalVT = -1;
static int ConsoleFD = -1;
static int FrameBufferFD = -1;
static caddr_t FrameBuffer = (caddr_t) -1;
static caddr_t MMIOAddress = (caddr_t) -1;
static void
print_fixed_info(const struct fb_fix_screeninfo *fixed, const char *s)
{
static const char *visuals[] = {
"MONO01", "MONO10", "TRUECOLOR", "PSEUDOCOLOR",
"DIRECTCOLOR", "STATIC_PSEUDOCOLOR"
};
printf("%s info -----------------------\n", s);
printf("id = %16s\n", fixed->id);
printf("smem_start = 0x%x\n", fixed->smem_start);
printf("smem_len = %d (0x%x)\n", fixed->smem_len, fixed->smem_len);
printf("type = 0x%x\n", fixed->type);
printf("type_aux = 0x%x\n", fixed->type_aux);
printf("visual = 0x%x (%s)\n", fixed->visual, visuals[fixed->visual]);
printf("xpanstep = %d\n", fixed->xpanstep);
printf("ypanstep = %d\n", fixed->ypanstep);
printf("ywrapstep = %d\n", fixed->ywrapstep);
printf("line_length = %d\n", fixed->line_length);
printf("mmio_start = 0x%x\n", fixed->mmio_start);
printf("mmio_len = %d (0x%x)\n", fixed->mmio_len, fixed->mmio_len);
printf("accel = 0x%x\n", fixed->accel);
}
static void
print_var_info(const struct fb_var_screeninfo *var, const char *s)
{
printf("%s info -----------------------\n", s);
printf("xres = %d\n", var->xres);
printf("yres = %d\n", var->yres);
printf("xres_virtual = %d\n", var->xres_virtual);
printf("yres_virtual = %d\n", var->yres_virtual);
printf("xoffset = %d\n", var->xoffset);
printf("yoffset = %d\n", var->yoffset);
printf("bits_per_pixel = %d\n", var->bits_per_pixel);
printf("grayscale = %d\n", var->grayscale);
printf("red.offset = %d length = %d msb_right = %d\n",
var->red.offset, var->red.length, var->red.msb_right);
printf("green.offset = %d length = %d msb_right = %d\n",
var->green.offset, var->green.length, var->green.msb_right);
printf("blue.offset = %d length = %d msb_right = %d\n",
var->blue.offset, var->blue.length, var->blue.msb_right);
printf("transp.offset = %d length = %d msb_right = %d\n",
var->transp.offset, var->transp.length, var->transp.msb_right);
printf("nonstd = %d\n", var->nonstd);
printf("activate = %d\n", var->activate);
printf("height = %d mm\n", var->height);
printf("width = %d mm\n", var->width);
printf("accel_flags = 0x%x\n", var->accel_flags);
printf("pixclock = %d\n", var->pixclock);
printf("left_margin = %d\n", var->left_margin);
printf("right_margin = %d\n", var->right_margin);
printf("upper_margin = %d\n", var->upper_margin);
printf("lower_margin = %d\n", var->lower_margin);
printf("hsync_len = %d\n", var->hsync_len);
printf("vsync_len = %d\n", var->vsync_len);
printf("sync = %d\n", var->sync);
printf("vmode = %d\n", var->vmode);
}
static void
signal_handler(int signumber)
{
signal(signumber, SIG_IGN); /* prevent recursion! */
fprintf(stderr, "error: got signal %d (exiting)\n", signumber);
exit(1);
}
static void
initialize_fbdev( void )
{
char ttystr[1000];
int fd, vtnumber, ttyfd;
int sz;
if (geteuid()) {
fprintf(stderr, "error: you need to be root\n");
exit(1);
}
#if 1
/* open the framebuffer device */
FrameBufferFD = open("/dev/fb0", O_RDWR);
if (FrameBufferFD < 0) {
fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
exit(1);
}
#endif
/* open /dev/tty0 and get the vt number */
if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
fprintf(stderr, "error opening /dev/tty0\n");
exit(1);
}
if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) {
fprintf(stderr, "error: couldn't get a free vt\n");
exit(1);
}
close(fd);
/* open the console tty */
sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */
ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0);
if (ConsoleFD < 0) {
fprintf(stderr, "error couldn't open console fd\n");
exit(1);
}
/* save current vt number */
{
struct vt_stat vts;
if (ioctl(ConsoleFD, VT_GETSTATE, &vts) == 0)
OriginalVT = vts.v_active;
}
/* disconnect from controlling tty */
ttyfd = open("/dev/tty", O_RDWR);
if (ttyfd >= 0) {
ioctl(ttyfd, TIOCNOTTY, 0);
close(ttyfd);
}
/* some magic to restore the vt when we exit */
{
struct vt_mode vt;
if (ioctl(ConsoleFD, VT_ACTIVATE, vtnumber) != 0)
printf("ioctl VT_ACTIVATE: %s\n", strerror(errno));
if (ioctl(ConsoleFD, VT_WAITACTIVE, vtnumber) != 0)
printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno));
if (ioctl(ConsoleFD, VT_GETMODE, &vt) < 0) {
fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno));
exit(1);
}
vt.mode = VT_PROCESS;
vt.relsig = SIGUSR1;
vt.acqsig = SIGUSR1;
if (ioctl(ConsoleFD, VT_SETMODE, &vt) < 0) {
fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n",
strerror(errno));
exit(1);
}
}
/* go into graphics mode */
if (ioctl(ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) {
fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n",
strerror(errno));
exit(1);
}
#if 0
/* open the framebuffer device */
FrameBufferFD = open("/dev/fb0", O_RDWR);
if (FrameBufferFD < 0) {
fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
exit(1);
}
#endif
/* Get the fixed screen info */
if (ioctl(FrameBufferFD, FBIOGET_FSCREENINFO, &FixedInfo)) {
fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
strerror(errno));
exit(1);
}
print_fixed_info(&FixedInfo, "Fixed");
/* get the variable screen info */
if (ioctl(FrameBufferFD, FBIOGET_VSCREENINFO, &OrigVarInfo)) {
fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
strerror(errno));
exit(1);
}
print_var_info(&OrigVarInfo, "Orig Var");
/* operate on a copy */
VarInfo = OrigVarInfo;
/* set the depth, resolution, etc */
DesiredDepth = 32;
if (DesiredDepth)
VarInfo.bits_per_pixel = DesiredDepth;
if (VarInfo.bits_per_pixel == 16) {
VarInfo.red.offset = 11;
VarInfo.green.offset = 5;
VarInfo.blue.offset = 0;
VarInfo.red.length = 5;
VarInfo.green.length = 6;
VarInfo.blue.length = 5;
VarInfo.transp.offset = 0;
VarInfo.transp.length = 0;
}
else if (VarInfo.bits_per_pixel == 32) {
VarInfo.red.offset = 16;
VarInfo.green.offset = 8;
VarInfo.blue.offset = 0;
VarInfo.transp.offset = 24;
VarInfo.red.length = 8;
VarInfo.green.length = 8;
VarInfo.blue.length = 8;
VarInfo.transp.length = 8;
}
/* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
VarInfo.xres_virtual = VarInfo.xres = 1280;
VarInfo.yres_virtual = VarInfo.yres = 1024;
VarInfo.pixclock = 7408;
VarInfo.left_margin = 248;
VarInfo.right_margin = 16;
VarInfo.upper_margin = 38;
VarInfo.lower_margin = 1;
VarInfo.hsync_len = 144;
VarInfo.vsync_len = 3;
VarInfo.xoffset = 0;
VarInfo.yoffset = 0;
VarInfo.nonstd = 0;
VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */
/* set new variable screen info */
if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &VarInfo)) {
fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
strerror(errno));
exit(1);
}
print_var_info(&VarInfo, "New Var");
if (FixedInfo.visual != FB_VISUAL_TRUECOLOR &&
FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) {
fprintf(stderr, "non-TRUE/DIRECT-COLOR visuals (0x%x) not supported by this demo.\n", FixedInfo.visual);
exit(1);
}
/* initialize colormap */
if (FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
struct fb_cmap cmap;
unsigned short red[256], green[256], blue[256];
int i;
/* we're assuming 256 entries here */
printf("initializing directcolor colormap\n");
cmap.start = 0;
cmap.len = 256;
cmap.red = red;
cmap.green = green;
cmap.blue = blue;
cmap.transp = NULL;
for (i = 0; i < cmap.len; i++) {
red[i] = green[i] = blue[i] = (i << 8) | i;
}
if (ioctl(FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) {
fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
}
}
/*
* fbdev says the frame buffer is at offset zero, and the mmio region
* is immediately after.
*/
/* mmap the framebuffer into our address space */
FrameBuffer = (caddr_t) mmap(0, /* start */
FixedInfo.smem_len, /* bytes */
PROT_READ | PROT_WRITE, /* prot */
MAP_SHARED, /* flags */
FrameBufferFD, /* fd */
0 /* offset */);
if (FrameBuffer == (caddr_t) - 1) {
fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
strerror(errno));
exit(1);
}
printf("FrameBuffer = %p\n", FrameBuffer);
#if 1
/* mmap the MMIO region into our address space */
MMIOAddress = (caddr_t) mmap(0, /* start */
FixedInfo.mmio_len, /* bytes */
PROT_READ | PROT_WRITE, /* prot */
MAP_SHARED, /* flags */
FrameBufferFD, /* fd */
FixedInfo.smem_len /* offset */);
if (MMIOAddress == (caddr_t) - 1) {
fprintf(stderr, "error: unable to mmap mmio region: %s\n",
strerror(errno));
}
printf("MMIOAddress = %p\n", MMIOAddress);
/* try out some simple MMIO register reads */
if (1)
{
typedef unsigned int CARD32;
typedef unsigned char CARD8;
#define RADEON_CONFIG_MEMSIZE 0x00f8
#define RADEON_MEM_SDRAM_MODE_REG 0x0158
#define MMIO_IN32(base, offset) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
#define INREG(addr) MMIO_IN32(MMIOAddress, addr)
int sz, type;
const char *typeStr[] = {"SDR", "DDR", "64-bit SDR"};
sz = INREG(RADEON_CONFIG_MEMSIZE);
type = INREG(RADEON_MEM_SDRAM_MODE_REG);
printf("RADEON_CONFIG_MEMSIZE = %d (%d MB)\n", sz, sz / 1024 / 1024);
printf("RADEON_MEM_SDRAM_MODE_REG >> 30 = %d (%s)\n",
type >> 30, typeStr[type>>30]);
}
#endif
}
static void
shutdown_fbdev( void )
{
struct vt_mode VT;
printf("cleaning up...\n");
/* restore original variable screen info */
if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &OrigVarInfo)) {
fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
strerror(errno));
exit(1);
}
munmap(MMIOAddress, FixedInfo.mmio_len);
munmap(FrameBuffer, FixedInfo.smem_len);
close(FrameBufferFD);
/* restore text mode */
ioctl(ConsoleFD, KDSETMODE, KD_TEXT);
/* set vt */
if (ioctl(ConsoleFD, VT_GETMODE, &VT) != -1) {
VT.mode = VT_AUTO;
ioctl(ConsoleFD, VT_SETMODE, &VT);
}
/* restore original vt */
if (OriginalVT >= 0) {
ioctl(ConsoleFD, VT_ACTIVATE, OriginalVT);
OriginalVT = -1;
}
close(ConsoleFD);
}
static void
gltest( void )
{
static const int attribs[] = {
GLFBDEV_DOUBLE_BUFFER,
GLFBDEV_DEPTH_SIZE, 16,
GLFBDEV_NONE
};
GLFBDevContextPtr ctx;
GLFBDevBufferPtr buf;
GLFBDevVisualPtr vis;
int bytes, r, g, b, a;
float ang;
printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
/* framebuffer size */
bytes = VarInfo.xres_virtual * VarInfo.yres_virtual * VarInfo.bits_per_pixel / 8;
vis = glFBDevCreateVisual( &FixedInfo, &VarInfo, attribs );
assert(vis);
buf = glFBDevCreateBuffer( &FixedInfo, &VarInfo, vis, FrameBuffer, NULL, bytes );
assert(buf);
ctx = glFBDevCreateContext( vis, NULL );
assert(buf);
b = glFBDevMakeCurrent( ctx, buf, buf );
assert(b);
/*printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));*/
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
glGetIntegerv(GL_ALPHA_BITS, &a);
printf("RED_BITS=%d GREEN_BITS=%d BLUE_BITS=%d ALPHA_BITS=%d\n",
r, g, b, a);
glClearColor(0.5, 0.5, 1.0, 0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1, 1, -1, 1, 2, 30);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -15);
glViewport(0, 0, VarInfo.xres_virtual, VarInfo.yres_virtual);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
for (ang = 0; ang <= 180; ang += 15) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(ang, 1, 0, 0);
glutSolidTorus(1, 3, 40, 20);
glPopMatrix();
glFBDevSwapBuffers(buf);
}
/* clean up */
b = glFBDevMakeCurrent( NULL, NULL, NULL);
assert(b);
glFBDevDestroyContext(ctx);
glFBDevDestroyBuffer(buf);
glFBDevDestroyVisual(vis);
}
int
main( int argc, char *argv[] )
{
signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
signal(SIGSEGV, signal_handler); /* catch segfaults */
initialize_fbdev();
gltest();
shutdown_fbdev();
return 0;
}

View File

@@ -1,125 +0,0 @@
#define USE_MINIGLX 1 /* 1 = use Mini GLX, 0 = use Xlib/GLX */
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#if USE_MINIGLX
#include <GL/miniglx.h>
#else
#include <GL/glx.h>
#include <X11/Xlib.h>
#endif
static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
glBegin( GL_QUADS );
glVertex2f( x1, y1 );
glVertex2f( x2, y1 );
glVertex2f( x2, y2 );
glVertex2f( x1, y2 );
glEnd();
}
/*
* Create a simple double-buffered RGBA window.
*/
static Window
MakeWindow(Display * dpy, unsigned int width, unsigned int height)
{
int visAttributes[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
None
};
XSetWindowAttributes attr;
unsigned long attrMask;
Window root;
Window win;
GLXContext ctx;
XVisualInfo *visinfo;
root = RootWindow(dpy, 0);
/* Choose GLX visual / pixel format */
visinfo = glXChooseVisual(dpy, 0, visAttributes);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}
/* Create the window */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attrMask = CWBackPixel | CWBorderPixel | CWColormap;
win = XCreateWindow(dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, attrMask, &attr);
if (!win) {
printf("Error: XCreateWindow failed\n");
exit(1);
}
/* Display the window */
XMapWindow(dpy, win);
/* Create GLX rendering context */
ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
}
/* Bind the rendering context and window */
glXMakeCurrent(dpy, win, ctx);
return win;
}
/*
* Draw a few frames of a rotating square.
*/
static void
DrawFrames(Display * dpy, Window win)
{
int angle;
glShadeModel(GL_FLAT);
glClearColor(0.5, 0.5, 0.5, 1.0);
for (angle = 0; angle < 360; angle += 10) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 0.0);
glPushMatrix();
glRotatef(angle, 0, 0, 1);
_subset_Rectf(-0.8, -0.8, 0.8, 0.8);
glPopMatrix();
glXSwapBuffers(dpy, win);
sleep(1);
}
}
int
main(int argc, char *argv[])
{
Display *dpy;
Window win;
dpy = XOpenDisplay(NULL);
if (!dpy) {
printf("Error: XOpenDisplay failed\n");
return 1;
}
win = MakeWindow(dpy, 300, 300);
DrawFrames(dpy, win);
return 0;
}

View File

@@ -1,197 +0,0 @@
/* $Id: miniglxtest.c,v 1.1.4.7 2003/02/21 22:18:24 keithw Exp $ */
/*
* Test the mini GLX interface.
*/
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#define USE_MINI_GLX 1
#if USE_MINI_GLX
#include <GL/miniglx.h>
#else
#include <GL/glx.h>
#endif
#define FRONTBUFFER 1
#define NR 6
#define DO_SLEEPS 1
#define NR_DISPLAYS 2
GLXContext ctx;
static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
glBegin( GL_QUADS );
glVertex2f( x1, y1 );
glVertex2f( x2, y1 );
glVertex2f( x2, y2 );
glVertex2f( x1, y2 );
glEnd();
}
static void redraw( Display *dpy, Window w, int rot )
{
printf("Redraw event\n");
#if FRONTBUFFER
glDrawBuffer( GL_FRONT );
#else
/* glDrawBuffer( GL_BACK ); */
#endif
glClearColor( rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX,
1);
glClear( GL_COLOR_BUFFER_BIT );
#if 1
glColor3f( rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX );
glPushMatrix();
glRotatef(rot, 0, 0, 1);
glScalef(.5, .5, .5);
_subset_Rectf( -1, -1, 1, 1 );
glPopMatrix();
#endif
#if FRONTBUFFER
glFlush();
#else
glXSwapBuffers( dpy, w );
#endif
glFinish();
}
static Window make_rgb_db_window( Display *dpy,
unsigned int width, unsigned int height )
{
int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
#if !FRONT_BUFFER
GLX_DOUBLEBUFFER,
#endif
None };
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visinfo;
scrnum = 0;
root = RootWindow( dpy, scrnum );
visinfo = glXChooseVisual( dpy, scrnum, attrib );
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}
ctx = glXCreateContext( dpy, visinfo, NULL, True );
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );
if (!win) {
printf("Error: XCreateWindow failed\n");
exit(1);
}
glXMakeCurrent( dpy, win, ctx );
return win;
}
static void event_loop( Display *dpy, Window win )
{
int i;
printf("Hang on... drawing %d frames\n", NR);
for (i = 0; i < NR; i++) {
redraw( dpy, win, i*10 );
if (DO_SLEEPS) {
printf("sleep(1)\n");
sleep(1);
}
}
}
int foo( )
{
Display *dpy;
Window win;
dpy = XOpenDisplay(NULL);
if (!dpy) {
printf("Error: XOpenDisplay failed\n");
return 1;
}
win = make_rgb_db_window( dpy, 800, 600);
srand(getpid());
glShadeModel( GL_FLAT );
glClearColor( 0.5, 0.5, 0.5, 1.0 );
XMapWindow( dpy, win );
#if !USE_MINI_GLX
{
XEvent e;
while (1) {
XNextEvent( dpy, &e );
if (e.type == MapNotify && e.xmap.window == win) {
break;
}
}
}
#endif
event_loop( dpy, win );
glXDestroyContext( dpy, ctx );
XDestroyWindow( dpy, win );
XCloseDisplay( dpy );
return 0;
}
int main()
{
int i;
for (i = 0 ; i < NR_DISPLAYS ; i++) {
if (foo() != 0)
break;
}
return 0;
}

View File

@@ -1,4 +1,4 @@
/* $Id: texwrap.c,v 1.4 2002/10/18 17:47:36 kschultz Exp $ */
/* $Id: texwrap.c,v 1.4.2.1 2003/02/04 02:34:42 brianp Exp $ */
/*
* Test texture wrap modes.
@@ -119,7 +119,7 @@ static void Display( void )
#if 0
/* draw texture as image */
glDisable(GL_TEXTURE_2D);
glWindowPos2iMESA(1, 1);
glWindowPos2iARB(1, 1);
glDrawPixels(6, 6, GL_RGBA, GL_UNSIGNED_BYTE, (void *) TexImage);
#endif
@@ -183,7 +183,7 @@ static void Display( void )
offset = 0;
for (i = 0; i < modes[i].mode != 0; i++) {
if ( modes[i].supported ) {
glWindowPos2iMESA( offset * 150 + 10, 5 + ((offset & 1) * 15) );
glWindowPos2iARB( offset * 150 + 10, 5 + ((offset & 1) * 15) );
PrintString(modes[i].name);
offset++;
}

View File

@@ -1,35 +0,0 @@
# Simple makefile for compiling test programs on Linux
# These programs aren't intended to be included with the normal
# distro. They're not too interesting but they're good for testing.
CC = gcc
CFLAGS = -g -I../include
LIBS = -L../lib -lGL -lm
PROGS = glxgears
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
.c:
$(CC) $(CFLAGS) $< $(LIBS) -o $@
##### TARGETS #####
default: $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o

View File

@@ -33,16 +33,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/gl.h>
#define USE_MINI_GLX 1
#if USE_MINI_GLX
#include <GL/miniglx.h>
#else
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <GL/gl.h>
#include <GL/glx.h>
#endif
#define BENCHMARK
@@ -352,18 +346,13 @@ make_window( Display *dpy, const char *name,
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask
#if !USE_MINI_GLX
| KeyPressMask
#endif
;
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );
#if !USE_MINI_GLX
/* set hints and properties */
{
XSizeHints sizehints;
@@ -376,7 +365,6 @@ make_window( Display *dpy, const char *name,
XSetStandardProperties(dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#endif
ctx = glXCreateContext( dpy, visinfo, NULL, True );
if (!ctx) {
@@ -394,12 +382,7 @@ make_window( Display *dpy, const char *name,
static void
event_loop(Display *dpy, Window win)
{
#if USE_MINI_GLX
reshape(300, 300);
#endif
while (1) {
#if !USE_MINI_GLX
while (XPending(dpy) > 0) {
XEvent event;
XNextEvent(dpy, &event);
@@ -438,7 +421,6 @@ event_loop(Display *dpy, Window win)
}
}
}
#endif
/* next frame */
angle += 2.0;

View File

@@ -1,37 +0,0 @@
# $Id: Makefile,v 1.1.2.2 2003/03/04 17:29:55 keithw Exp $
# Mesa 3-D graphics library
# Version: 5.0
# Copyright (C) 1995-2002 Brian Paul
MESA = ../..
default: dri.a
include $(MESA)/Makefile.include
INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions -I$(MESA)/include -I. -I..
DEFINES =
C_SOURCES = dri_glx.c \
dri_util.c \
xf86drm.c \
xf86drmHash.c \
xf86drmRandom.c \
xf86drmSL.c
ASM_SOURCES =
OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o)
##### TARGETS #####
dri.a: $(OBJECTS) Makefile
rm -f $@ && ar rcv $@ $(OBJECTS) && ranlib $@
##### DEPENDENCIES #####
-include $(C_SOURCES:.c=.d)

View File

@@ -1,472 +0,0 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/* $XFree86: xc/lib/GL/dri/dri_glx.c,v 1.10 2001/08/27 17:40:57 dawes Exp $ */
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Brian Paul <brian@precisioninsight.com>
*
*/
#include <unistd.h>
#include <X11/Xlibint.h>
#include <X11/extensions/Xext.h>
#include "extutil.h"
#include "glxclient.h"
#include "xf86dri.h"
#include "sarea.h"
#include <stdio.h>
#include <dlfcn.h>
#include "dri_glx.h"
#include <sys/types.h>
#include <stdarg.h>
#ifdef BUILT_IN_DRI_DRIVER
extern void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config);
#else /* BUILT_IN_DRI_DRIVER */
#ifndef DEFAULT_DRIVER_DIR
/* this is normally defined in the Imakefile */
#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
#endif
static __DRIdriver *Drivers = NULL;
/*
* printf wrappers
*/
static void InfoMessageF(const char *f, ...)
{
va_list args;
const char *env;
if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
fprintf(stderr, "libGL: ");
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
}
}
static void ErrorMessageF(const char *f, ...)
{
va_list args;
if (getenv("LIBGL_DEBUG")) {
fprintf(stderr, "libGL error: ");
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
}
}
/*
* We'll save a pointer to this function when we couldn't find a
* direct rendering driver for a given screen.
*/
static void *DummyCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config)
{
(void) dpy;
(void) scrn;
(void) psc;
(void) numConfigs;
(void) config;
return NULL;
}
/*
* Extract the ith directory path out of a colon-separated list of
* paths.
* Input:
* index - index of path to extract (starting at zero)
* paths - the colon-separated list of paths
* dirLen - max length of result to store in <dir>
* Output:
* dir - the extracted directory path, dir[0] will be zero when
* extraction fails.
*/
static void ExtractDir(int index, const char *paths, int dirLen, char *dir)
{
int i, len;
const char *start, *end;
/* find ith colon */
start = paths;
i = 0;
while (i < index) {
if (*start == ':') {
i++;
start++;
}
else if (*start == 0) {
/* end of string and couldn't find ith colon */
dir[0] = 0;
return;
}
else {
start++;
}
}
while (*start == ':')
start++;
/* find next colon, or end of string */
end = start + 1;
while (*end != ':' && *end != 0) {
end++;
}
/* copy string between <start> and <end> into result string */
len = end - start;
if (len > dirLen - 1)
len = dirLen - 1;
strncpy(dir, start, len);
dir[len] = 0;
}
/*
* Try to dlopen() the named driver. This function adds the
* "_dri.so" suffix to the driver name and searches the
* directories specified by the LIBGL_DRIVERS_PATH env var
* in order to find the driver.
* Input:
* driverName - a name like "tdfx", "i810", "mga", etc.
* Return:
* handle from dlopen, or NULL if driver file not found.
*/
static __DRIdriver *OpenDriver(const char *driverName)
{
char *libPaths = NULL;
int i;
__DRIdriver *driver;
/* First, search Drivers list to see if we've already opened this driver */
for (driver = Drivers; driver; driver = driver->next) {
if (strcmp(driver->name, driverName) == 0) {
/* found it */
return driver;
}
}
if (geteuid() == getuid()) {
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
libPaths = getenv("LIBGL_DRIVERS_PATH");
if (!libPaths)
libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */
}
if (!libPaths)
libPaths = DEFAULT_DRIVER_DIR;
for (i = 0; ; i++) {
char libDir[1000], realDriverName[200];
void *handle;
ExtractDir(i, libPaths, 1000, libDir);
if (!libDir[0])
break; /* ran out of paths to search */
snprintf(realDriverName, 200, "%s/%s_dri.so", libDir, driverName);
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
if (handle) {
/* allocate __DRIdriver struct */
driver = (__DRIdriver *) Xmalloc(sizeof(__DRIdriver));
if (!driver)
return NULL; /* out of memory! */
/* init the struct */
driver->name = __glXstrdup(driverName);
if (!driver->name) {
Xfree(driver);
return NULL; /* out of memory! */
}
driver->createScreenFunc = (CreateScreenFunc)
dlsym(handle, "__driCreateScreen");
if (!driver->createScreenFunc) {
/* If the driver doesn't have this symbol then something's
* really, really wrong.
*/
ErrorMessageF("__driCreateScreen() not defined in %s_dri.so!\n",
driverName);
Xfree(driver);
dlclose(handle);
continue;
}
driver->registerExtensionsFunc = (RegisterExtensionsFunc)
dlsym(handle, "__driRegisterExtensions");
driver->handle = handle;
/* put at head of linked list */
driver->next = Drivers;
Drivers = driver;
return driver;
}
else {
ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
}
}
ErrorMessageF("unable to find driver: %s_dri.so\n", driverName);
return NULL;
}
/*
* Given a display pointer and screen number, determine the name of
* the DRI driver for the screen. (I.e. "r128", "tdfx", etc).
* Return True for success, False for failure.
*/
static Bool GetDriverName(Display *dpy, int scrNum, char **driverName)
{
int directCapable;
Bool b;
int driverMajor, driverMinor, driverPatch;
*driverName = NULL;
if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) {
ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed");
return False;
}
if (!directCapable) {
ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false");
return False;
}
b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor,
&driverPatch, driverName);
if (!b) {
ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum);
return False;
}
InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
driverMajor, driverMinor, driverPatch, *driverName, scrNum);
return True;
}
/*
* Given a display pointer and screen number, return a __DRIdriver handle.
* Return NULL if anything goes wrong.
*/
__DRIdriver *driGetDriver(Display *dpy, int scrNum)
{
char *driverName;
if (GetDriverName(dpy, scrNum, &driverName)) {
return OpenDriver(driverName);
}
return NULL;
}
#endif /* BUILT_IN_DRI_DRIVER */
/* This function isn't currently used.
*/
static void driDestroyDisplay(Display *dpy, void *private)
{
__DRIdisplayPrivate *pdpyp = (__DRIdisplayPrivate *)private;
if (pdpyp) {
const int numScreens = ScreenCount(dpy);
int i;
for (i = 0; i < numScreens; i++) {
if (pdpyp->libraryHandles[i])
dlclose(pdpyp->libraryHandles[i]);
}
Xfree(pdpyp->libraryHandles);
Xfree(pdpyp);
}
}
/*
* Allocate, initialize and return a __DRIdisplayPrivate object.
* This is called from __glXInitialize() when we are given a new
* display pointer.
*/
void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp)
{
const int numScreens = ScreenCount(dpy);
__DRIdisplayPrivate *pdpyp;
int eventBase, errorBase;
int major, minor, patch;
int scrn;
/* Initialize these fields to NULL in case we fail.
* If we don't do this we may later get segfaults trying to free random
* addresses when the display is closed.
*/
pdisp->private = NULL;
pdisp->destroyDisplay = NULL;
pdisp->createScreen = NULL;
if (!XF86DRIQueryExtension(dpy, &eventBase, &errorBase)) {
return NULL;
}
if (!XF86DRIQueryVersion(dpy, &major, &minor, &patch)) {
return NULL;
}
pdpyp = (__DRIdisplayPrivate *)Xmalloc(sizeof(__DRIdisplayPrivate));
if (!pdpyp) {
return NULL;
}
pdpyp->driMajor = major;
pdpyp->driMinor = minor;
pdpyp->driPatch = patch;
pdisp->destroyDisplay = driDestroyDisplay;
/* allocate array of pointers to createScreen funcs */
pdisp->createScreen = (CreateScreenFunc *) Xmalloc(numScreens * sizeof(void *));
if (!pdisp->createScreen) {
XFree(pdpyp);
return NULL;
}
/* allocate array of library handles */
pdpyp->libraryHandles = (void **) Xmalloc(numScreens * sizeof(void*));
if (!pdpyp->libraryHandles) {
Xfree(pdisp->createScreen);
XFree(pdpyp);
return NULL;
}
#ifdef BUILT_IN_DRI_DRIVER
/* we'll statically bind to the built-in __driCreateScreen function */
for (scrn = 0; scrn < numScreens; scrn++) {
pdisp->createScreen[scrn] = __driCreateScreen;
pdpyp->libraryHandles[scrn] = NULL;
}
#else
/* dynamically discover DRI drivers for all screens, saving each
* driver's "__driCreateScreen" function pointer. That's the bootstrap
* entrypoint for all DRI drivers.
*/
__glXRegisterExtensions();
for (scrn = 0; scrn < numScreens; scrn++) {
__DRIdriver *driver = driGetDriver(dpy, scrn);
if (driver) {
pdisp->createScreen[scrn] = driver->createScreenFunc;
pdpyp->libraryHandles[scrn] = driver->handle;
}
else {
pdisp->createScreen[scrn] = DummyCreateScreen;
pdpyp->libraryHandles[scrn] = NULL;
}
}
#endif
return (void *)pdpyp;
}
/*
** Here we'll query the DRI driver for each screen and let each
** driver register its GL extension functions. We only have to
** do this once.
**
** In older versions of libGL (prior to October 2002) we _always_
** called this function during libGL start-up. Now, we only call
** it from glXGetProcAddress() as a last resort.
**
** Two key things changed along the way:
** 1. _glapi_get_proc_address() now generates new dispatch stub functions
** anytime it gets an unknown "gl*" function name. I.e. we always return
** a valid function address and later patch it up to use the correct
** dispatch offset.
** 2. The GL API dispatch table is a fixed size (with plenty of extra slots).
** This means we don't have to register all new functions before we create
** the first dispatch table.
*/
void
__glXRegisterExtensions(void)
{
#ifndef BUILT_IN_DRI_DRIVER
static GLboolean alreadyCalled = GL_FALSE;
int displayNum, maxDisplays;
if (alreadyCalled)
return;
alreadyCalled = GL_TRUE;
if (getenv("LIBGL_MULTIHEAD")) {
/* we'd like to always take this path but doing so causes a second
* or more of delay while the XOpenDisplay() function times out.
*/
maxDisplays = 10; /* infinity, really */
}
else {
/* just open the :0 display */
maxDisplays = 1;
}
for (displayNum = 0; displayNum < maxDisplays; displayNum++) {
char displayName[200];
Display *dpy;
snprintf(displayName, 199, ":%d.0", displayNum);
dpy = XOpenDisplay(displayName);
if (dpy) {
const int numScreens = ScreenCount(dpy);
int screenNum;
for (screenNum = 0; screenNum < numScreens; screenNum++) {
__DRIdriver *driver = driGetDriver(dpy, screenNum);
if (driver && driver->registerExtensionsFunc) {
(*driver->registerExtensionsFunc)();
}
}
XCloseDisplay(dpy);
}
else {
break;
}
}
#endif
}

View File

@@ -1,59 +0,0 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Brian Paul <brian@precisioninsight.com>
*
*/
#ifndef _DRI_GLX_H_
#define _DRI_GLX_H_
struct __DRIdisplayPrivateRec {
/*
** XFree86-DRI version information
*/
int driMajor;
int driMinor;
int driPatch;
/*
** Array of library handles [indexed by screen number]
*/
void **libraryHandles;
};
typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate;
typedef struct __DRIscreenPrivateRec __DRIscreenPrivate;
typedef struct __DRIvisualPrivateRec __DRIvisualPrivate;
typedef struct __DRIcontextPrivateRec __DRIcontextPrivate;
typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate;
#endif /* _DRI_GLX_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,375 +0,0 @@
/* $XFree86$ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Brian Paul <brian@precisioninsight.com>
*/
/*
* This module acts as glue between GLX and the actual hardware driver.
* A DRI driver doesn't really _have_ to use any of this - it's optional.
* But, some useful stuff is done here that otherwise would have to be
* duplicated in most drivers.
*
* Basically, these utility functions take care of some of the dirty details
* of screen initialization, context creation, context binding, DRM setup,
* etc.
*
* These functions are compiled into each DRI driver so libGL.so knows
* nothing about them.
*
* Look for more comments in the dri_util.c file.
*/
#ifndef _DRI_UTIL_H_
#define _DRI_UTIL_H_
#define CAPI /* XXX this should be globally defined somewhere */
#include "glxclient.h" /* for GLXDrawable */
#include "xf86dri.h" /* for XF86DRIClipRectPtr */
#include "sarea.h" /* for XF86DRISAREAPtr */
#include "GL/internal/glcore.h" /* for __GLcontextModes */
typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate;
typedef struct __DRIscreenPrivateRec __DRIscreenPrivate;
typedef struct __DRIcontextPrivateRec __DRIcontextPrivate;
typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate;
#define DRI_VALIDATE_DRAWABLE_INFO_ONCE(pDrawPriv) \
do { \
if (*(pDrawPriv->pStamp) != pDrawPriv->lastStamp) { \
__driUtilUpdateDrawableInfo(pDrawPriv); \
} \
} while (0)
#define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp) \
do { \
while (*(pdp->pStamp) != pdp->lastStamp) { \
DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, \
pdp->driContextPriv->hHWContext); \
\
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
\
DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, \
pdp->driContextPriv->hHWContext); \
} \
} while (0)
/* Each DRI driver must have one of these structs with all the pointers
* set to appropriate functions within the driver.
* When glXCreateContext is called, for example, it'll call a helper
* function dri_util.c which in turn will jump through the CreateContext
* pointer in this structure.
*/
struct __DriverAPIRec {
GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv);
void (*DestroyScreen)(__DRIscreenPrivate *driScrnPriv);
GLboolean (*CreateContext)(const __GLcontextModes *glVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate);
void (*DestroyContext)(__DRIcontextPrivate *driContextPriv);
GLboolean (*CreateBuffer)(__DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *glVis,
GLboolean pixmapBuffer);
void (*DestroyBuffer)(__DRIdrawablePrivate *driDrawPriv);
void (*SwapBuffers)(__DRIdrawablePrivate *driDrawPriv);
GLboolean (*MakeCurrent)(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv);
GLboolean (*UnbindContext)(__DRIcontextPrivate *driContextPriv);
GLboolean (*OpenFullScreen)(__DRIcontextPrivate *driContextPriv);
GLboolean (*CloseFullScreen)(__DRIcontextPrivate *driContextPriv);
};
struct __DRIdrawablePrivateRec {
/*
** Kernel drawable handle (not currently used).
*/
drmDrawable hHWDrawable;
/*
** Driver's private drawable information. This structure is opaque.
*/
void *driverPrivate;
/*
** X's drawable ID associated with this private drawable.
*/
GLXDrawable draw;
/*
** Reference count for number of context's currently bound to this
** drawable. Once the refcount reaches 0, the drawable can be
** destroyed. This behavior will change with GLX 1.3.
*/
int refcount;
/*
** Index of this drawable's information in the SAREA.
*/
unsigned int index;
/*
** Pointer to the "drawable has changed ID" stamp in the SAREA.
*/
unsigned int *pStamp;
/*
** Last value of the stamp. If this differs from the value stored
** at *pStamp, then the drawable information has been modified by
** the X server, and the drawable information (below) should be
** retrieved from the X server.
*/
unsigned int lastStamp;
/*
** Drawable information used in software fallbacks.
*/
int x;
int y;
int w;
int h;
int numClipRects;
XF86DRIClipRectPtr pClipRects;
/*
** Information about the back and depthbuffer where different
** from above.
*/
int backX;
int backY;
int backClipRectType;
int numBackClipRects;
XF86DRIClipRectPtr pBackClipRects;
/*
** Pointer to context to which this drawable is currently bound.
*/
__DRIcontextPrivate *driContextPriv;
/*
** Pointer to screen on which this drawable was created.
*/
__DRIscreenPrivate *driScreenPriv;
/*
** Basically just need these for when the locking code needs to call
** __driUtilUpdateDrawableInfo() which calls XF86DRIGetDrawableInfo().
*/
Display *display;
int screen;
/*
** Called via glXSwapBuffers().
*/
void (*swapBuffers)( __DRIdrawablePrivate *dPriv );
};
struct __DRIcontextPrivateRec {
/*
** Kernel context handle used to access the device lock.
*/
XID contextID;
/*
** Kernel context handle used to access the device lock.
*/
drmContext hHWContext;
/*
** Device driver's private context data. This structure is opaque.
*/
void *driverPrivate;
/*
** This context's display pointer.
*/
Display *display;
/*
** Pointer to drawable currently bound to this context.
*/
__DRIdrawablePrivate *driDrawablePriv;
/*
** Pointer to screen on which this context was created.
*/
__DRIscreenPrivate *driScreenPriv;
};
struct __DRIscreenPrivateRec {
/*
** Display for this screen
*/
Display *display;
/*
** Current screen's number
*/
int myNum;
/*
** Callback functions into the hardware-specific DRI driver code.
*/
struct __DriverAPIRec DriverAPI;
/*
** DDX / 2D driver version information.
*/
int ddxMajor;
int ddxMinor;
int ddxPatch;
/*
** DRI X extension version information.
*/
int driMajor;
int driMinor;
int driPatch;
/*
** DRM (kernel module) version information.
*/
int drmMajor;
int drmMinor;
int drmPatch;
/*
** ID used when the client sets the drawable lock. The X server
** uses this value to detect if the client has died while holding
** the drawable lock.
*/
int drawLockID;
/*
** File descriptor returned when the kernel device driver is opened.
** It is used to:
** - authenticate client to kernel
** - map the frame buffer, SAREA, etc.
** - close the kernel device driver
*/
int fd;
/*
** SAREA pointer used to access:
** - the device lock
** - the device-independent per-drawable and per-context(?) information
*/
XF86DRISAREAPtr pSAREA;
/*
** Direct frame buffer access information used for software
** fallbacks.
*/
unsigned char *pFB;
int fbSize;
int fbOrigin;
int fbStride;
int fbWidth;
int fbHeight;
int fbBPP;
/*
** Device-dependent private information (stored in the SAREA). This
** data is accessed by the client driver only.
*/
void *pDevPriv;
int devPrivSize;
/*
** Dummy context to which drawables are bound when not bound to any
** other context. A dummy hHWContext is created for this context,
** and is used by the GL core when a HW lock is required but the
** drawable is not currently bound (e.g., potentially during a
** SwapBuffers request). The dummy context is created when the
** first "real" context is created on this screen.
*/
__DRIcontextPrivate dummyContextPriv;
/*
** Hash table to hold the drawable information for this screen.
*/
void *drawHash;
/*
** Device-dependent private information (not stored in the SAREA).
** This pointer is never touched by the DRI layer.
*/
void *private;
/* If we're in full screen mode (via DRIOpenFullScreen), this points
to the drawable that was bound. Otherwise, this is NULL. */
__DRIdrawablePrivate *fullscreen;
/*
** Number of visuals (configs) for this screen, and a pointer to them.
*/
int numConfigs;
__GLXvisualConfig *configs;
};
extern void
__driUtilMessage(const char *f, ...);
extern void
__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp);
extern __DRIscreenPrivate *
__driUtilCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config,
const struct __DriverAPIRec *driverAPI);
/* This must be implemented in each driver */
extern void *
__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config);
/* This is optionally implemented in each driver */
extern void
__driRegisterExtensions( void );
#endif /* _DRI_UTIL_H_ */

View File

@@ -1,474 +0,0 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Rickard E. (Rik) Faith <faith@valinux.com>
*
* Acknowledgements:
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
*
*/
#ifndef _DRM_H_
#define _DRM_H_
#if defined(__linux__)
#include <linux/config.h>
#include <asm/ioctl.h> /* For _IO* macros */
#define DRM_IOCTL_NR(n) _IOC_NR(n)
#define DRM_IOC_VOID _IOC_NONE
#define DRM_IOC_READ _IOC_READ
#define DRM_IOC_WRITE _IOC_WRITE
#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#if defined(__FreeBSD__) && defined(XFree86Server)
/* Prevent name collision when including sys/ioccom.h */
#undef ioctl
#include <sys/ioccom.h>
#define ioctl(a,b,c) xf86ioctl(a,b,c)
#else
#include <sys/ioccom.h>
#endif /* __FreeBSD__ && xf86ioctl */
#define DRM_IOCTL_NR(n) ((n) & 0xff)
#define DRM_IOC_VOID IOC_VOID
#define DRM_IOC_READ IOC_OUT
#define DRM_IOC_WRITE IOC_IN
#define DRM_IOC_READWRITE IOC_INOUT
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
#endif
#define XFREE86_VERSION(major,minor,patch,snap) \
((major << 16) | (minor << 8) | patch)
#ifndef CONFIG_XFREE86_VERSION
#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0)
#endif
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
#define DRM_PROC_DEVICES "/proc/devices"
#define DRM_PROC_MISC "/proc/misc"
#define DRM_PROC_DRM "/proc/drm"
#define DRM_DEV_DRM "/dev/drm"
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#define DRM_DEV_UID 0
#define DRM_DEV_GID 0
#endif
#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
#define DRM_MAJOR 226
#define DRM_MAX_MINOR 15
#endif
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */
#define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */
#define DRM_RAM_PERCENT 10 /* How much system ram can we lock? */
#define _DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */
#define _DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */
#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD)
#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT)
#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
typedef unsigned long drm_handle_t;
typedef unsigned int drm_context_t;
typedef unsigned int drm_drawable_t;
typedef unsigned int drm_magic_t;
/* Warning: If you change this structure, make sure you change
* XF86DRIClipRectRec in the server as well */
/* KW: Actually it's illegal to change either for
* backwards-compatibility reasons.
*/
typedef struct drm_clip_rect {
unsigned short x1;
unsigned short y1;
unsigned short x2;
unsigned short y2;
} drm_clip_rect_t;
typedef struct drm_tex_region {
unsigned char next;
unsigned char prev;
unsigned char in_use;
unsigned char padding;
unsigned int age;
} drm_tex_region_t;
typedef struct drm_version {
int version_major; /* Major version */
int version_minor; /* Minor version */
int version_patchlevel;/* Patch level */
size_t name_len; /* Length of name buffer */
char *name; /* Name of driver */
size_t date_len; /* Length of date buffer */
char *date; /* User-space buffer to hold date */
size_t desc_len; /* Length of desc buffer */
char *desc; /* User-space buffer to hold desc */
} drm_version_t;
typedef struct drm_unique {
size_t unique_len; /* Length of unique */
char *unique; /* Unique name for driver instantiation */
} drm_unique_t;
typedef struct drm_list {
int count; /* Length of user-space structures */
drm_version_t *version;
} drm_list_t;
typedef struct drm_block {
int unused;
} drm_block_t;
typedef struct drm_control {
enum {
DRM_ADD_COMMAND,
DRM_RM_COMMAND,
DRM_INST_HANDLER,
DRM_UNINST_HANDLER
} func;
int irq;
} drm_control_t;
typedef enum drm_map_type {
_DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */
_DRM_REGISTERS = 1, /* no caching, no core dump */
_DRM_SHM = 2, /* shared, cached */
_DRM_AGP = 3, /* AGP/GART */
_DRM_SCATTER_GATHER = 4 /* Scatter/gather memory for PCI DMA */
} drm_map_type_t;
typedef enum drm_map_flags {
_DRM_RESTRICTED = 0x01, /* Cannot be mapped to user-virtual */
_DRM_READ_ONLY = 0x02,
_DRM_LOCKED = 0x04, /* shared, cached, locked */
_DRM_KERNEL = 0x08, /* kernel requires access */
_DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */
_DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */
_DRM_REMOVABLE = 0x40 /* Removable mapping */
} drm_map_flags_t;
typedef struct drm_ctx_priv_map {
unsigned int ctx_id; /* Context requesting private mapping */
void *handle; /* Handle of map */
} drm_ctx_priv_map_t;
typedef struct drm_map {
unsigned long offset; /* Requested physical address (0 for SAREA)*/
unsigned long size; /* Requested physical size (bytes) */
drm_map_type_t type; /* Type of memory to map */
drm_map_flags_t flags; /* Flags */
void *handle; /* User-space: "Handle" to pass to mmap */
/* Kernel-space: kernel-virtual address */
int mtrr; /* MTRR slot used */
/* Private data */
} drm_map_t;
typedef struct drm_client {
int idx; /* Which client desired? */
int auth; /* Is client authenticated? */
unsigned long pid; /* Process id */
unsigned long uid; /* User id */
unsigned long magic; /* Magic */
unsigned long iocs; /* Ioctl count */
} drm_client_t;
typedef enum {
_DRM_STAT_LOCK,
_DRM_STAT_OPENS,
_DRM_STAT_CLOSES,
_DRM_STAT_IOCTLS,
_DRM_STAT_LOCKS,
_DRM_STAT_UNLOCKS,
_DRM_STAT_VALUE, /* Generic value */
_DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */
_DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */
_DRM_STAT_IRQ, /* IRQ */
_DRM_STAT_PRIMARY, /* Primary DMA bytes */
_DRM_STAT_SECONDARY, /* Secondary DMA bytes */
_DRM_STAT_DMA, /* DMA */
_DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */
_DRM_STAT_MISSED /* Missed DMA opportunity */
/* Add to the *END* of the list */
} drm_stat_type_t;
typedef struct drm_stats {
unsigned long count;
struct {
unsigned long value;
drm_stat_type_t type;
} data[15];
} drm_stats_t;
typedef enum drm_lock_flags {
_DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */
_DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */
_DRM_LOCK_FLUSH = 0x04, /* Flush this context's DMA queue first */
_DRM_LOCK_FLUSH_ALL = 0x08, /* Flush all DMA queues first */
/* These *HALT* flags aren't supported yet
-- they will be used to support the
full-screen DGA-like mode. */
_DRM_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues */
_DRM_HALT_CUR_QUEUES = 0x20 /* Halt all current queues */
} drm_lock_flags_t;
typedef struct drm_lock {
int context;
drm_lock_flags_t flags;
} drm_lock_t;
typedef enum drm_dma_flags { /* These values *MUST* match xf86drm.h */
/* Flags for DMA buffer dispatch */
_DRM_DMA_BLOCK = 0x01, /* Block until buffer dispatched.
Note, the buffer may not yet have
been processed by the hardware --
getting a hardware lock with the
hardware quiescent will ensure
that the buffer has been
processed. */
_DRM_DMA_WHILE_LOCKED = 0x02, /* Dispatch while lock held */
_DRM_DMA_PRIORITY = 0x04, /* High priority dispatch */
/* Flags for DMA buffer request */
_DRM_DMA_WAIT = 0x10, /* Wait for free buffers */
_DRM_DMA_SMALLER_OK = 0x20, /* Smaller-than-requested buffers ok */
_DRM_DMA_LARGER_OK = 0x40 /* Larger-than-requested buffers ok */
} drm_dma_flags_t;
typedef struct drm_buf_desc {
int count; /* Number of buffers of this size */
int size; /* Size in bytes */
int low_mark; /* Low water mark */
int high_mark; /* High water mark */
enum {
_DRM_PAGE_ALIGN = 0x01, /* Align on page boundaries for DMA */
_DRM_AGP_BUFFER = 0x02, /* Buffer is in agp space */
_DRM_SG_BUFFER = 0x04 /* Scatter/gather memory buffer */
} flags;
unsigned long agp_start; /* Start address of where the agp buffers
* are in the agp aperture */
} drm_buf_desc_t;
typedef struct drm_buf_info {
int count; /* Entries in list */
drm_buf_desc_t *list;
} drm_buf_info_t;
typedef struct drm_buf_free {
int count;
int *list;
} drm_buf_free_t;
typedef struct drm_buf_pub {
int idx; /* Index into master buflist */
int total; /* Buffer size */
int used; /* Amount of buffer in use (for DMA) */
void *address; /* Address of buffer */
} drm_buf_pub_t;
typedef struct drm_buf_map {
int count; /* Length of buflist */
void *virtual; /* Mmaped area in user-virtual */
drm_buf_pub_t *list; /* Buffer information */
} drm_buf_map_t;
typedef struct drm_dma {
/* Indices here refer to the offset into
buflist in drm_buf_get_t. */
int context; /* Context handle */
int send_count; /* Number of buffers to send */
int *send_indices; /* List of handles to buffers */
int *send_sizes; /* Lengths of data to send */
drm_dma_flags_t flags; /* Flags */
int request_count; /* Number of buffers requested */
int request_size; /* Desired size for buffers */
int *request_indices; /* Buffer information */
int *request_sizes;
int granted_count; /* Number of buffers granted */
} drm_dma_t;
typedef enum {
_DRM_CONTEXT_PRESERVED = 0x01,
_DRM_CONTEXT_2DONLY = 0x02
} drm_ctx_flags_t;
typedef struct drm_ctx {
drm_context_t handle;
drm_ctx_flags_t flags;
} drm_ctx_t;
typedef struct drm_ctx_res {
int count;
drm_ctx_t *contexts;
} drm_ctx_res_t;
typedef struct drm_draw {
drm_drawable_t handle;
} drm_draw_t;
typedef struct drm_auth {
drm_magic_t magic;
} drm_auth_t;
typedef struct drm_irq_busid {
int irq;
int busnum;
int devnum;
int funcnum;
} drm_irq_busid_t;
typedef enum {
_DRM_VBLANK_ABSOLUTE = 0x0, /* Wait for specific vblank sequence number */
_DRM_VBLANK_RELATIVE = 0x1, /* Wait for given number of vblanks */
_DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */
} drm_vblank_seq_type_t;
#define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL
struct drm_wait_vblank_request {
drm_vblank_seq_type_t type;
unsigned int sequence;
unsigned long signal;
};
struct drm_wait_vblank_reply {
drm_vblank_seq_type_t type;
unsigned int sequence;
long tval_sec;
long tval_usec;
};
typedef union drm_wait_vblank {
struct drm_wait_vblank_request request;
struct drm_wait_vblank_reply reply;
} drm_wait_vblank_t;
typedef struct drm_agp_mode {
unsigned long mode;
} drm_agp_mode_t;
/* For drm_agp_alloc -- allocated a buffer */
typedef struct drm_agp_buffer {
unsigned long size; /* In bytes -- will round to page boundary */
unsigned long handle; /* Used for BIND/UNBIND ioctls */
unsigned long type; /* Type of memory to allocate */
unsigned long physical; /* Physical used by i810 */
} drm_agp_buffer_t;
/* For drm_agp_bind */
typedef struct drm_agp_binding {
unsigned long handle; /* From drm_agp_buffer */
unsigned long offset; /* In bytes -- will round to page boundary */
} drm_agp_binding_t;
typedef struct drm_agp_info {
int agp_version_major;
int agp_version_minor;
unsigned long mode;
unsigned long aperture_base; /* physical address */
unsigned long aperture_size; /* bytes */
unsigned long memory_allowed; /* bytes */
unsigned long memory_used;
/* PCI information */
unsigned short id_vendor;
unsigned short id_device;
} drm_agp_info_t;
typedef struct drm_scatter_gather {
unsigned long size; /* In bytes -- will round to page boundary */
unsigned long handle; /* Used for mapping / unmapping */
} drm_scatter_gather_t;
#define DRM_IOCTL_BASE 'd'
#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)
#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type)
#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)
#define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t)
#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t)
#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t)
#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t)
#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t)
#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t)
#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t)
#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t)
#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t)
#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, drm_block_t)
#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, drm_block_t)
#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, drm_control_t)
#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, drm_map_t)
#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, drm_buf_desc_t)
#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, drm_buf_desc_t)
#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm_buf_info_t)
#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t)
#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t)
#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t)
#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t)
#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t)
#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t)
#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t)
#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t)
#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, drm_ctx_t)
#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, drm_ctx_t)
#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, drm_ctx_t)
#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, drm_ctx_res_t)
#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, drm_draw_t)
#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, drm_draw_t)
#define DRM_IOCTL_DMA DRM_IOWR(0x29, drm_dma_t)
#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, drm_lock_t)
#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t)
#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t)
#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t)
#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t)
#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
#define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t)
#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t)
#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t)
/* Device specfic ioctls should only be in their respective headers
* The device specific ioctl range is 0x40 to 0x79. */
#define DRM_COMMAND_BASE 0x40
#endif

View File

@@ -1,224 +0,0 @@
/*
* $Xorg: extutil.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP 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.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
* Author: Jim Fulton, MIT The Open Group
*
* Xlib Extension-Writing Utilities
*
* This package contains utilities for writing the client API for various
* protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
* ARE SUBJECT TO CHANGE!
*/
/* $XFree86: xc/include/extensions/extutil.h,v 1.9 2001/12/14 19:53:28 dawes Exp $ */
#ifndef _EXTUTIL_H_
#define _EXTUTIL_H_
#include <X11/extensions/Xext.h>
/*
* We need to keep a list of open displays since the Xlib display list isn't
* public. We also have to per-display info in a separate block since it isn't
* stored directly in the Display structure.
*/
typedef struct _XExtDisplayInfo {
struct _XExtDisplayInfo *next; /* keep a linked list */
Display *display; /* which display this is */
XExtCodes *codes; /* the extension protocol codes */
XPointer data; /* extra data for extension to use */
} XExtDisplayInfo;
typedef struct _XExtensionInfo {
XExtDisplayInfo *head; /* start of list */
XExtDisplayInfo *cur; /* most recently used */
int ndisplays; /* number of displays */
} XExtensionInfo;
typedef struct _XExtensionHooks {
int (*create_gc)(
#if NeedNestedPrototypes
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
#endif
);
int (*copy_gc)(
#if NeedNestedPrototypes
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
#endif
);
int (*flush_gc)(
#if NeedNestedPrototypes
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
#endif
);
int (*free_gc)(
#if NeedNestedPrototypes
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
#endif
);
int (*create_font)(
#if NeedNestedPrototypes
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
#endif
);
int (*free_font)(
#if NeedNestedPrototypes
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
#endif
);
int (*close_display)(
#if NeedNestedPrototypes
Display* /* display */,
XExtCodes* /* codes */
#endif
);
Bool (*wire_to_event)(
#if NeedNestedPrototypes
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
#endif
);
Status (*event_to_wire)(
#if NeedNestedPrototypes
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
#endif
);
int (*error)(
#if NeedNestedPrototypes
Display* /* display */,
xError* /* err */,
XExtCodes* /* codes */,
int* /* ret_code */
#endif
);
char *(*error_string)(
#if NeedNestedPrototypes
Display* /* display */,
int /* code */,
XExtCodes* /* codes */,
char* /* buffer */,
int /* nbytes */
#endif
);
} XExtensionHooks;
extern XExtensionInfo *XextCreateExtension(
#if NeedFunctionPrototypes
void
#endif
);
extern void XextDestroyExtension(
#if NeedFunctionPrototypes
XExtensionInfo* /* info */
#endif
);
extern XExtDisplayInfo *XextAddDisplay(
#if NeedFunctionPrototypes
XExtensionInfo* /* extinfo */,
Display* /* dpy */,
char* /* ext_name */,
XExtensionHooks* /* hooks */,
int /* nevents */,
XPointer /* data */
#endif
);
extern int XextRemoveDisplay(
#if NeedFunctionPrototypes
XExtensionInfo* /* extinfo */,
Display* /* dpy */
#endif
);
extern XExtDisplayInfo *XextFindDisplay(
#if NeedFunctionPrototypes
XExtensionInfo* /* extinfo */,
Display* /* dpy */
#endif
);
#define XextHasExtension(i) ((i) && ((i)->codes))
#define XextCheckExtension(dpy,i,name,val) \
if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
#define XextSimpleCheckExtension(dpy,i,name) \
if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
/*
* helper macros to generate code that is common to all extensions; caller
* should prefix it with static if extension source is in one file; this
* could be a utility function, but have to stack 6 unused arguments for
* something that is called many, many times would be bad.
*/
#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
XExtDisplayInfo *proc (Display *dpy) \
{ \
XExtDisplayInfo *dpyinfo; \
if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
return dpyinfo; \
}
#define XEXT_FIND_DISPLAY_PROTO(proc) \
XExtDisplayInfo *proc(Display *dpy)
#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
int proc (Display *dpy, XExtCodes *codes) \
{ \
return XextRemoveDisplay (extinfo, dpy); \
}
#define XEXT_CLOSE_DISPLAY_PROTO(proc) \
int proc(Display *dpy, XExtCodes *codes)
#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
{ \
code -= codes->first_error; \
if (code >= 0 && code < nerr) { \
char tmp[256]; \
sprintf (tmp, "%s.%d", extname, code); \
XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
return buf; \
} \
return (char *)0; \
}
#define XEXT_ERROR_STRING_PROTO(proc) \
char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
#endif

View File

@@ -1,678 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.14 2002/02/22 21:32:53 dawes Exp $ */
/*
* Direct rendering support added by Precision Insight, Inc.
*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
*/
#ifndef _GLX_client_h_
#define _GLX_client_h_
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/Xproto.h>
#include <X11/Xlibint.h>
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <string.h>
#include <stdlib.h>
#include "GL/glxint.h"
#include "GL/glxproto.h"
#include "glapitable.h"
#ifdef NEED_GL_FUNCS_WRAPPED
#include "indirect.h"
#endif
#ifdef XTHREADS
#include "Xthreads.h"
#endif
#ifdef GLX_BUILT_IN_XMESA
#include "realglx.h" /* just silences prototype warnings */
#endif
#define GLX_MAJOR_VERSION 1 /* current version numbers */
#define GLX_MINOR_VERSION 2
#define __GL_BOOLEAN_ARRAY (GL_BYTE - 1)
#define __GLX_MAX_TEXTURE_UNITS 32
typedef struct __GLXcontextRec __GLXcontext;
typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
typedef struct _glapi_table __GLapi;
/************************************************************************/
/*
** The following structures define the interface between the GLX client
** side library and the DRI (direct rendering infrastructure).
*/
typedef struct __DRIdisplayRec __DRIdisplay;
typedef struct __DRIscreenRec __DRIscreen;
typedef struct __DRIcontextRec __DRIcontext;
typedef struct __DRIdrawableRec __DRIdrawable;
typedef struct __DRIdriverRec __DRIdriver;
extern __DRIscreen *__glXFindDRIScreen(Display *dpy, int scrn);
/*
** Display dependent methods. This structure is initialized during the
** driCreateDisplay() call.
*/
struct __DRIdisplayRec {
/*
** Method to destroy the private DRI display data.
*/
void (*destroyDisplay)(Display *dpy, void *displayPrivate);
/*
** Methods to create the private DRI screen data and initialize the
** screen dependent methods.
** This is an array [indexed by screen number] of function pointers.
*/
void *(**createScreen)(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config);
/*
** Opaque pointer to private per display direct rendering data.
** NULL if direct rendering is not supported on this display. Never
** dereferenced in libGL.
*/
void *private;
};
/*
** Screen dependent methods. This structure is initialized during the
** (*createScreen)() call.
*/
struct __DRIscreenRec {
/*
** Method to destroy the private DRI screen data.
*/
void (*destroyScreen)(Display *dpy, int scrn, void *screenPrivate);
/*
** Method to create the private DRI context data and initialize the
** context dependent methods.
*/
void *(*createContext)(Display *dpy, XVisualInfo *vis, void *sharedPrivate,
__DRIcontext *pctx);
/*
** Method to create the private DRI drawable data and initialize the
** drawable dependent methods.
*/
void *(*createDrawable)(Display *dpy, int scrn, GLXDrawable draw,
VisualID vid, __DRIdrawable *pdraw);
/*
** Method to return a pointer to the DRI drawable data.
*/
__DRIdrawable *(*getDrawable)(Display *dpy, GLXDrawable draw,
void *drawablePrivate);
/*
** XXX in the future, implement this:
void *(*createPBuffer)(Display *dpy, int scrn, GLXPbuffer pbuffer,
GLXFBConfig config, __DRIdrawable *pdraw);
**/
/*
** Opaque pointer to private per screen direct rendering data. NULL
** if direct rendering is not supported on this screen. Never
** dereferenced in libGL.
*/
void *private;
};
/*
** Context dependent methods. This structure is initialized during the
** (*createContext)() call.
*/
struct __DRIcontextRec {
/*
** Method to destroy the private DRI context data.
*/
void (*destroyContext)(Display *dpy, int scrn, void *contextPrivate);
/*
** Method to bind a DRI drawable to a DRI graphics context.
** XXX in the future, also pass a 'read' GLXDrawable for
** glXMakeCurrentReadSGI() and GLX 1.3's glXMakeContextCurrent().
*/
Bool (*bindContext)(Display *dpy, int scrn, GLXDrawable draw,
GLXContext gc);
/*
** Method to unbind a DRI drawable to a DRI graphics context.
*/
Bool (*unbindContext)(Display *dpy, int scrn, GLXDrawable draw,
GLXContext gc, int will_rebind);
/*
** Opaque pointer to private per context direct rendering data.
** NULL if direct rendering is not supported on the display or
** screen used to create this context. Never dereferenced in libGL.
*/
void *private;
};
/*
** Drawable dependent methods. This structure is initialized during the
** (*createDrawable)() call. createDrawable() is not called by libGL at
** this time. It's currently used via the dri_util.c utility code instead.
*/
struct __DRIdrawableRec {
/*
** Method to destroy the private DRI drawable data.
*/
void (*destroyDrawable)(Display *dpy, void *drawablePrivate);
/*
** Method to swap the front and back buffers.
*/
void (*swapBuffers)(Display *dpy, void *drawablePrivate);
/*
** Opaque pointer to private per drawable direct rendering data.
** NULL if direct rendering is not supported on the display or
** screen used to create this drawable. Never dereferenced in libGL.
*/
void *private;
};
typedef void *(*CreateScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config);
typedef void *(*RegisterExtensionsFunc)(void);
/*
** We keep a linked list of these structures, one per DRI device driver.
*/
struct __DRIdriverRec {
const char *name;
void *handle;
CreateScreenFunc createScreenFunc;
RegisterExtensionsFunc registerExtensionsFunc;
struct __DRIdriverRec *next;
};
/*
** Function to create and DRI display data and initialize the display
** dependent methods.
*/
extern void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp);
extern __DRIdriver *driGetDriver(Display *dpy, int scrNum);
extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
/************************************************************************/
#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
typedef struct __GLXpixelStoreModeRec {
GLboolean swapEndian;
GLboolean lsbFirst;
GLuint rowLength;
GLuint imageHeight;
GLuint imageDepth;
GLuint skipRows;
GLuint skipPixels;
GLuint skipImages;
GLuint alignment;
} __GLXpixelStoreMode;
typedef struct __GLXvertexArrayPointerStateRec {
GLboolean enable;
void (*proc)(const void *);
const GLubyte *ptr;
GLsizei skip;
GLint size;
GLenum type;
GLsizei stride;
} __GLXvertexArrayPointerState;
typedef struct __GLXvertArrayStateRec {
__GLXvertexArrayPointerState vertex;
__GLXvertexArrayPointerState normal;
__GLXvertexArrayPointerState color;
__GLXvertexArrayPointerState index;
__GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS];
__GLXvertexArrayPointerState edgeFlag;
GLint maxElementsVertices;
GLint maxElementsIndices;
GLint activeTexture;
} __GLXvertArrayState;
typedef struct __GLXattributeRec {
GLuint mask;
/*
** Pixel storage state. Most of the pixel store mode state is kept
** here and used by the client code to manage the packing and
** unpacking of data sent to/received from the server.
*/
__GLXpixelStoreMode storePack, storeUnpack;
/*
** Vertex Array storage state. The vertex array component
** state is stored here and is used to manage the packing of
** DrawArrays data sent to the server.
*/
__GLXvertArrayState vertArray;
} __GLXattribute;
typedef struct __GLXattributeMachineRec {
__GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
__GLXattribute **stackPointer;
} __GLXattributeMachine;
/*
** GLX state that needs to be kept on the client. One of these records
** exist for each context that has been made current by this client.
*/
struct __GLXcontextRec {
/*
** Drawing command buffer. Drawing commands are packed into this
** buffer before being sent as a single GLX protocol request. The
** buffer is sent when it overflows or is flushed by
** __glXFlushRenderBuffer. "pc" is the next location in the buffer
** to be filled. "limit" is described above in the buffer slop
** discussion.
**
** Commands that require large amounts of data to be transfered will
** also use this buffer to hold a header that describes the large
** command.
**
** These must be the first 6 fields since they are static initialized
** in the dummy context in glxext.c
*/
GLubyte *buf;
GLubyte *pc;
GLubyte *limit;
GLubyte *bufEnd;
GLint bufSize;
/*
** The XID of this rendering context. When the context is created a
** new XID is allocated. This is set to None when the context is
** destroyed but is still current to some thread. In this case the
** context will be freed on next MakeCurrent.
*/
XID xid;
/*
** The XID of the shareList context.
*/
XID share_xid;
/*
** Visual id.
*/
VisualID vid;
/*
** screen number.
*/
GLint screen;
/*
** GL_TRUE if the context was created with ImportContext, which
** means the server-side context was created by another X client.
*/
GLboolean imported;
/*
** The context tag returned by MakeCurrent when this context is made
** current. This tag is used to identify the context that a thread has
** current so that proper server context management can be done. It is
** used for all context specific commands (i.e., Render, RenderLarge,
** WaitX, WaitGL, UseXFont, and MakeCurrent (for the old context)).
*/
GLXContextTag currentContextTag;
/*
** The rendering mode is kept on the client as well as the server.
** When glRenderMode() is called, the buffer associated with the
** previous rendering mode (feedback or select) is filled.
*/
GLenum renderMode;
GLfloat *feedbackBuf;
GLuint *selectBuf;
/*
** This is GL_TRUE if the pixel unpack modes are such that an image
** can be unpacked from the clients memory by just copying. It may
** still be true that the server will have to do some work. This
** just promises that a straight copy will fetch the correct bytes.
*/
GLboolean fastImageUnpack;
/*
** Fill newImage with the unpacked form of oldImage getting it
** ready for transport to the server.
*/
void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
GLenum, const GLvoid*, GLubyte*, GLubyte*);
/*
** Client side attribs.
*/
__GLXattribute state;
__GLXattributeMachine attributes;
/*
** Client side error code. This is set when client side gl API
** routines need to set an error because of a bad enumerant or
** running out of memory, etc.
*/
GLenum error;
/*
** Whether this context does direct rendering.
*/
Bool isDirect;
/*
** dpy of current display for this context. Will be NULL if not
** current to any display, or if this is the "dummy context".
*/
Display *currentDpy;
/*
** The current drawable for this context. Will be None if this
** context is not current to any drawable.
*/
GLXDrawable currentDrawable;
/*
** Constant strings that describe the server implementation
** These pertain to GL attributes, not to be confused with
** GLX versioning attributes.
*/
GLubyte *vendor;
GLubyte *renderer;
GLubyte *version;
GLubyte *extensions;
/* Record the dpy this context was created on for later freeing */
Display *createDpy;
/*
** Maximum small render command size. This is the smaller of 64k and
** the size of the above buffer.
*/
GLint maxSmallRenderCommandSize;
/*
** Major opcode for the extension. Copied here so a lookup isn't
** needed.
*/
GLint majorOpcode;
/*
** Per context direct rendering interface functions and data.
*/
__DRIcontext driContext;
};
#define __glXSetError(gc,code) \
if (!(gc)->error) { \
(gc)->error = code; \
}
extern void __glFreeAttributeState(__GLXcontext *);
/************************************************************************/
/*
** The size of the largest drawing command known to the implementation
** that will use the GLXRender glx command. In this case it is
** glPolygonStipple.
*/
#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
/*
** To keep the implementation fast, the code uses a "limit" pointer
** to determine when the drawing command buffer is too full to hold
** another fixed size command. This constant defines the amount of
** space that must always be available in the drawing command buffer
** at all times for the implementation to work. It is important that
** the number be just large enough, but not so large as to reduce the
** efficacy of the buffer. The "+32" is just to keep the code working
** in case somebody counts wrong.
*/
#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
/*
** This implementation uses a smaller threshold for switching
** to the RenderLarge protocol than the protcol requires so that
** large copies don't occur.
*/
#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
/*
** One of these records exists per screen of the display. It contains
** a pointer to the config data for that screen (if the screen supports GL).
*/
typedef struct __GLXscreenConfigsRec {
__GLXvisualConfig *configs;
int numConfigs;
const char *serverGLXexts;
char *effectiveGLXexts;
/*
** Per screen direct rendering interface functions and data.
*/
__DRIscreen driScreen;
} __GLXscreenConfigs;
/*
** Per display private data. One of these records exists for each display
** that is using the OpenGL (GLX) extension.
*/
struct __GLXdisplayPrivateRec {
/*
** Back pointer to the display
*/
Display *dpy;
/*
** The majorOpcode is common to all connections to the same server.
** It is also copied into the context structure.
*/
int majorOpcode;
/*
** Major and minor version returned by the server during initialization.
*/
int majorVersion, minorVersion;
/* Storage for the servers GLX vendor and versions strings. These
** are the same for all screens on this display. These fields will
** be filled in on demand.
*/
char *serverGLXvendor;
char *serverGLXversion;
/*
** Configurations of visuals for all screens on this display.
** Also, per screen data which now includes the server GLX_EXTENSION
** string.
*/
__GLXscreenConfigs *screenConfigs;
/*
** Per display direct rendering interface functions and data.
*/
__DRIdisplay driDisplay;
};
void __glXFreeContext(__GLXcontext*);
extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*);
extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
const GLvoid *, GLint);
/* Initialize the GLX extension for dpy */
extern __GLXdisplayPrivate *__glXInitialize(Display*);
/* Query drivers for dynamically registered extensions */
extern void __glXRegisterExtensions(void);
/* Functions for extending the GLX API: */
extern void *__glXRegisterGLXFunction(const char *funcName, void *funcAddr);
extern void __glXRegisterGLXExtensionString(const char *extName);
/************************************************************************/
extern int __glXDebug;
/* This is per-thread storage in an MT environment */
#if defined(XTHREADS)
extern __GLXcontext *__glXGetCurrentContext(void);
extern void __glXSetCurrentContext(__GLXcontext *c);
#else
extern __GLXcontext *__glXcurrentContext;
#define __glXGetCurrentContext() __glXcurrentContext
#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
#endif
/*
** Global lock for all threads in this address space using the GLX
** extension
*/
#if defined(XTHREADS)
extern xmutex_rec __glXmutex;
#define __glXLock() xmutex_lock(&__glXmutex)
#define __glXUnlock() xmutex_unlock(&__glXmutex)
#else
#define __glXLock()
#define __glXUnlock()
#endif
/*
** Setup for a command. Initialize the extension for dpy if necessary.
*/
extern CARD8 __glXSetupForCommand(Display *dpy);
/************************************************************************/
/*
** Data conversion and packing support.
*/
/* Return the size, in bytes, of some pixel data */
extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum);
/* Return the k value for a given map target */
extern GLint __glEvalComputeK(GLenum);
/*
** Fill the transport buffer with the data from the users buffer,
** applying some of the pixel store modes (unpack modes) to the data
** first. As a side effect of this call, the "modes" field is
** updated to contain the modes needed by the server to decode the
** sent data.
*/
extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
GLenum, const GLvoid*, GLubyte*, GLubyte*);
/* Copy map data with a stride into a packed buffer */
extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
const GLfloat *, GLfloat *);
extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
const GLdouble *, GLdouble *);
/*
** Empty an image out of the reply buffer into the clients memory applying
** the pack modes to pack back into the clients requested format.
*/
extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
GLenum, const GLubyte *, GLvoid *);
/*
** Allocate and Initialize Vertex Array client state
*/
extern void __glXInitVertexArrayState(__GLXcontext*);
/*
** Inform the Server of the major and minor numbers and of the client
** libraries extension string.
*/
extern void __glXClientInfo ( Display *dpy, int opcode );
/************************************************************************/
/*
** Declarations that should be in Xlib
*/
#ifdef __GL_USE_OUR_PROTOTYPES
extern void _XFlush(Display*);
extern Status _XReply(Display*, xReply*, int, Bool);
extern void _XRead(Display*, void*, long);
extern void _XSend(Display*, const void*, long);
#endif
/*
** GLX_BUILT_IN_XMESA controls whether libGL has a built-in verions of
** Mesa that can render to non-GLX displays.
*/
#ifdef GLX_BUILT_IN_XMESA
#define GLX_PREFIX(function) _real_##function
#else
#define GLX_PREFIX(function) function
#endif
extern char *__glXstrdup(const char *str);
extern int __glXGetInternalVersion(void);
extern Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
#endif /* !__GLX_client_h__ */

View File

@@ -1,80 +0,0 @@
/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.10 2001/10/04 18:28:20 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Jens Owen <jens@tungstengraphics.com>
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
#ifndef _SAREA_H_
#define _SAREA_H_
#include "xf86drm.h"
/* SAREA area needs to be at least a page */
#if defined(__alpha__)
#define SAREA_MAX 0x2000
#elif defined(__ia64__)
#define SAREA_MAX 0x10000 /* 64kB */
#else
/* Intel 830M driver needs at least 8k SAREA */
#define SAREA_MAX 0x2000
#endif
#define SAREA_MAX_DRAWABLES 256
#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
typedef struct _XF86DRISAREADrawable {
unsigned int stamp;
unsigned int flags;
} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr;
typedef struct _XF86DRISAREAFrame {
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
unsigned int fullscreen;
} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr;
typedef struct _XF86DRISAREA {
/* first thing is always the drm locking structure */
drmLock lock;
/* NOT_DONE: Use readers/writer lock for drawable_lock */
drmLock drawable_lock;
XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES];
XF86DRISAREAFrameRec frame;
drmContext dummy_context;
} XF86DRISAREARec, *XF86DRISAREAPtr;
#endif

View File

@@ -1,227 +0,0 @@
/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Jens Owen <jens@tungstengraphics.com>
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
#ifndef _XF86DRI_H_
#define _XF86DRI_H_
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
#define X_XF86DRIQueryVersion 0
#define X_XF86DRIQueryDirectRenderingCapable 1
#define X_XF86DRIOpenConnection 2
#define X_XF86DRICloseConnection 3
#define X_XF86DRIGetClientDriverName 4
#define X_XF86DRICreateContext 5
#define X_XF86DRIDestroyContext 6
#define X_XF86DRICreateDrawable 7
#define X_XF86DRIDestroyDrawable 8
#define X_XF86DRIGetDrawableInfo 9
#define X_XF86DRIGetDeviceInfo 10
#define X_XF86DRIAuthConnection 11
#define X_XF86DRIOpenFullScreen 12
#define X_XF86DRICloseFullScreen 13
#define XF86DRINumberEvents 0
#define XF86DRIClientNotLocal 0
#define XF86DRIOperationNotSupported 1
#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
/* Warning : Do not change XF86DRIClipRect without changing the kernel
* structure! */
typedef struct _XF86DRIClipRect {
unsigned short x1; /* Upper left: inclusive */
unsigned short y1;
unsigned short x2; /* Lower right: exclusive */
unsigned short y2;
} XF86DRIClipRectRec, *XF86DRIClipRectPtr;
#ifndef _XF86DRI_SERVER_
_XFUNCPROTOBEGIN
Bool XF86DRIQueryExtension(
#if NeedFunctionPrototypes
Display* /* dpy */,
int* /* event_base */,
int* /* error_base */
#endif
);
Bool XF86DRIQueryVersion(
#if NeedFunctionPrototypes
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */,
int* /* patchVersion */
#endif
);
Bool XF86DRIQueryDirectRenderingCapable(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
Bool* /* isCapable */
#endif
);
Bool XF86DRIOpenConnection(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
drmHandlePtr /* hSAREA */,
char** /* busIDString */
#endif
);
Bool XF86DRIAuthConnection(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
drmMagic /* magic */
#endif
);
Bool XF86DRICloseConnection(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */
#endif
);
Bool XF86DRIGetClientDriverName(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
int* /* ddxDriverMajorVersion */,
int* /* ddxDriverMinorVersion */,
int* /* ddxDriverPatchVersion */,
char** /* clientDriverName */
#endif
);
Bool XF86DRICreateContext(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
Visual* /* visual */,
XID* /* ptr to returned context id */,
drmContextPtr /* hHWContext */
#endif
);
Bool XF86DRIDestroyContext(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
XID /* context id */
#endif
);
Bool XF86DRICreateDrawable(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
Drawable /* drawable */,
drmDrawablePtr /* hHWDrawable */
#endif
);
Bool XF86DRIDestroyDrawable(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
Drawable /* drawable */
#endif
);
Bool XF86DRIGetDrawableInfo(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
Drawable /* drawable */,
unsigned int* /* index */,
unsigned int* /* stamp */,
int* /* X */,
int* /* Y */,
int* /* W */,
int* /* H */,
int* /* numClipRects */,
XF86DRIClipRectPtr*,/* pClipRects */
int* /* backX */,
int* /* backY */,
int* /* numBackClipRects */,
XF86DRIClipRectPtr* /* pBackClipRects */
#endif
);
Bool XF86DRIGetDeviceInfo(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
drmHandlePtr /* hFrameBuffer */,
int* /* fbOrigin */,
int* /* fbSize */,
int* /* fbStride */,
int* /* devPrivateSize */,
void** /* pDevPrivate */
#endif
);
Bool XF86DRIOpenFullScreen(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
Drawable /* drawable */
#endif
);
Bool XF86DRICloseFullScreen(
#if NeedFunctionPrototypes
Display* /* dpy */,
int /* screen */,
Drawable /* drawable */
#endif
);
_XFUNCPROTOEND
#endif /* _XF86DRI_SERVER_ */
#endif /* _XF86DRI_H_ */

View File

@@ -1,343 +0,0 @@
/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.9 2001/03/21 16:01:08 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Jens Owen <jens@tungstengraphics.com>
* Rickard E. (Rik) Fiath <faith@valinux.com>
*
*/
#ifndef _XF86DRISTR_H_
#define _XF86DRISTR_H_
#include "xf86dri.h"
#define XF86DRINAME "XFree86-DRI"
/* The DRI version number. This was originally set to be the same of the
* XFree86 version number. However, this version is really indepedent of
* the XFree86 version.
*
* Version History:
* 4.0.0: Original
* 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
* 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
*/
#define XF86DRI_MAJOR_VERSION 4
#define XF86DRI_MINOR_VERSION 1
#define XF86DRI_PATCH_VERSION 0
typedef struct _XF86DRIQueryVersion {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIQueryVersion */
CARD16 length B16;
} xXF86DRIQueryVersionReq;
#define sz_xXF86DRIQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of DRI protocol */
CARD16 minorVersion B16; /* minor version of DRI protocol */
CARD32 patchVersion B32; /* patch version of DRI protocol */
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86DRIQueryVersionReply;
#define sz_xXF86DRIQueryVersionReply 32
typedef struct _XF86DRIQueryDirectRenderingCapable {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
CARD16 length B16;
CARD32 screen B32;
} xXF86DRIQueryDirectRenderingCapableReq;
#define sz_xXF86DRIQueryDirectRenderingCapableReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
BOOL isCapable;
BOOL pad2;
BOOL pad3;
BOOL pad4;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
CARD32 pad8 B32;
CARD32 pad9 B32;
} xXF86DRIQueryDirectRenderingCapableReply;
#define sz_xXF86DRIQueryDirectRenderingCapableReply 32
typedef struct _XF86DRIOpenConnection {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIOpenConnection */
CARD16 length B16;
CARD32 screen B32;
} xXF86DRIOpenConnectionReq;
#define sz_xXF86DRIOpenConnectionReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 hSAREALow B32;
CARD32 hSAREAHigh B32;
CARD32 busIdStringLength B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
CARD32 pad8 B32;
} xXF86DRIOpenConnectionReply;
#define sz_xXF86DRIOpenConnectionReply 32
typedef struct _XF86DRIAuthConnection {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICloseConnection */
CARD16 length B16;
CARD32 screen B32;
CARD32 magic B32;
} xXF86DRIAuthConnectionReq;
#define sz_xXF86DRIAuthConnectionReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 authenticated B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86DRIAuthConnectionReply;
#define zx_xXF86DRIAuthConnectionReply 32
typedef struct _XF86DRICloseConnection {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICloseConnection */
CARD16 length B16;
CARD32 screen B32;
} xXF86DRICloseConnectionReq;
#define sz_xXF86DRICloseConnectionReq 8
typedef struct _XF86DRIGetClientDriverName {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIGetClientDriverName */
CARD16 length B16;
CARD32 screen B32;
} xXF86DRIGetClientDriverNameReq;
#define sz_xXF86DRIGetClientDriverNameReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 ddxDriverMajorVersion B32;
CARD32 ddxDriverMinorVersion B32;
CARD32 ddxDriverPatchVersion B32;
CARD32 clientDriverNameLength B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86DRIGetClientDriverNameReply;
#define sz_xXF86DRIGetClientDriverNameReply 32
typedef struct _XF86DRICreateContext {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICreateContext */
CARD16 length B16;
CARD32 screen B32;
CARD32 visual B32;
CARD32 context B32;
} xXF86DRICreateContextReq;
#define sz_xXF86DRICreateContextReq 16
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 hHWContext B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86DRICreateContextReply;
#define sz_xXF86DRICreateContextReply 32
typedef struct _XF86DRIDestroyContext {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIDestroyContext */
CARD16 length B16;
CARD32 screen B32;
CARD32 context B32;
} xXF86DRIDestroyContextReq;
#define sz_xXF86DRIDestroyContextReq 12
typedef struct _XF86DRICreateDrawable {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICreateDrawable */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
} xXF86DRICreateDrawableReq;
#define sz_xXF86DRICreateDrawableReq 12
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 hHWDrawable B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86DRICreateDrawableReply;
#define sz_xXF86DRICreateDrawableReply 32
typedef struct _XF86DRIDestroyDrawable {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIDestroyDrawable */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
} xXF86DRIDestroyDrawableReq;
#define sz_xXF86DRIDestroyDrawableReq 12
typedef struct _XF86DRIGetDrawableInfo {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIGetDrawableInfo */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
} xXF86DRIGetDrawableInfoReq;
#define sz_xXF86DRIGetDrawableInfoReq 12
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 drawableTableIndex B32;
CARD32 drawableTableStamp B32;
INT16 drawableX B16;
INT16 drawableY B16;
INT16 drawableWidth B16;
INT16 drawableHeight B16;
CARD32 numClipRects B32;
INT16 backX B16;
INT16 backY B16;
CARD32 numBackClipRects B32;
} xXF86DRIGetDrawableInfoReply;
#define sz_xXF86DRIGetDrawableInfoReply 36
typedef struct _XF86DRIGetDeviceInfo {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIGetDeviceInfo */
CARD16 length B16;
CARD32 screen B32;
} xXF86DRIGetDeviceInfoReq;
#define sz_xXF86DRIGetDeviceInfoReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 hFrameBufferLow B32;
CARD32 hFrameBufferHigh B32;
CARD32 framebufferOrigin B32;
CARD32 framebufferSize B32;
CARD32 framebufferStride B32;
CARD32 devPrivateSize B32;
} xXF86DRIGetDeviceInfoReply;
#define sz_xXF86DRIGetDeviceInfoReply 32
typedef struct _XF86DRIOpenFullScreen {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIOpenFullScreen */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
} xXF86DRIOpenFullScreenReq;
#define sz_xXF86DRIOpenFullScreenReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 isFullScreen B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86DRIOpenFullScreenReply;
#define sz_xXF86DRIOpenFullScreenReply 32
typedef struct _XF86DRICloseFullScreen {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICloseFullScreen */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
} xXF86DRICloseFullScreenReq;
#define sz_xXF86DRICloseFullScreenReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXF86DRICloseFullScreenReply;
#define sz_xXF86DRICloseFullScreenReply 32
#endif /* _XF86DRISTR_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,607 +0,0 @@
/* xf86drm.h -- OS-independent header for DRM user-level library interface
* Created: Tue Jan 5 08:17:23 1999 by faith@precisioninsight.com
*
* Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
*
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.17 2002/10/16 01:26:48 dawes Exp $
*
*/
#ifndef _XF86DRM_H_
#define _XF86DRM_H_
/* Defaults, if nothing set in xf86config */
#define DRM_DEV_UID 0
#define DRM_DEV_GID 0
/* Default /dev/dri directory permissions 0755 */
#define DRM_DEV_DIRMODE \
(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#define DRM_DIR_NAME "/dev/dri"
#define DRM_DEV_NAME "%s/card%d"
#define DRM_PROC_NAME "/proc/dri/" /* For backware Linux compatibility */
#define DRM_ERR_NO_DEVICE (-1001)
#define DRM_ERR_NO_ACCESS (-1002)
#define DRM_ERR_NOT_ROOT (-1003)
#define DRM_ERR_INVALID (-1004)
#define DRM_ERR_NO_FD (-1005)
typedef unsigned long drmHandle, *drmHandlePtr; /* To mapped regions */
typedef unsigned int drmSize, *drmSizePtr; /* For mapped regions */
typedef void *drmAddress, **drmAddressPtr; /* For mapped regions */
typedef unsigned int drmContext, *drmContextPtr; /* GLXContext handle */
typedef unsigned int drmDrawable, *drmDrawablePtr; /* Unused */
typedef unsigned int drmMagic, *drmMagicPtr; /* Magic for auth */
typedef struct _drmVersion {
int version_major; /* Major version */
int version_minor; /* Minor version */
int version_patchlevel; /* Patch level */
int name_len; /* Length of name buffer */
char *name; /* Name of driver */
int date_len; /* Length of date buffer */
char *date; /* User-space buffer to hold date */
int desc_len; /* Length of desc buffer */
char *desc; /* User-space buffer to hold desc */
} drmVersion, *drmVersionPtr;
typedef struct _drmStats {
unsigned long count; /* Number of data */
struct {
unsigned long value; /* Value from kernel */
const char *long_format; /* Suggested format for long_name */
const char *long_name; /* Long name for value */
const char *rate_format; /* Suggested format for rate_name */
const char *rate_name; /* Short name for value per second */
int isvalue; /* True if value (vs. counter) */
const char *mult_names; /* Multiplier names (e.g., "KGM") */
int mult; /* Multiplier value (e.g., 1024) */
int verbose; /* Suggest only in verbose output */
} data[15];
} drmStatsT;
/* All of these enums *MUST* match with the
kernel implementation -- so do *NOT*
change them! (The drmlib implementation
will just copy the flags instead of
translating them.) */
typedef enum {
DRM_FRAME_BUFFER = 0, /* WC, no caching, no core dump */
DRM_REGISTERS = 1, /* no caching, no core dump */
DRM_SHM = 2, /* shared, cached */
DRM_AGP = 3, /* AGP/GART */
DRM_SCATTER_GATHER = 4 /* PCI scatter/gather */
} drmMapType;
typedef enum {
DRM_RESTRICTED = 0x0001, /* Cannot be mapped to client-virtual */
DRM_READ_ONLY = 0x0002, /* Read-only in client-virtual */
DRM_LOCKED = 0x0004, /* Physical pages locked */
DRM_KERNEL = 0x0008, /* Kernel requires access */
DRM_WRITE_COMBINING = 0x0010, /* Use write-combining, if available */
DRM_CONTAINS_LOCK = 0x0020, /* SHM page that contains lock */
DRM_REMOVABLE = 0x0040 /* Removable mapping */
} drmMapFlags;
typedef enum { /* These values *MUST* match drm.h */
/* Flags for DMA buffer dispatch */
DRM_DMA_BLOCK = 0x01, /* Block until buffer dispatched. Note,
the buffer may not yet have been
processed by the hardware -- getting a
hardware lock with the hardware
quiescent will ensure that the buffer
has been processed. */
DRM_DMA_WHILE_LOCKED = 0x02, /* Dispatch while lock held */
DRM_DMA_PRIORITY = 0x04, /* High priority dispatch */
/* Flags for DMA buffer request */
DRM_DMA_WAIT = 0x10, /* Wait for free buffers */
DRM_DMA_SMALLER_OK = 0x20, /* Smaller-than-requested buffers ok */
DRM_DMA_LARGER_OK = 0x40 /* Larger-than-requested buffers ok */
} drmDMAFlags;
typedef enum {
DRM_PAGE_ALIGN = 0x01,
DRM_AGP_BUFFER = 0x02,
DRM_SG_BUFFER = 0x04
} drmBufDescFlags;
typedef enum {
DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */
DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */
DRM_LOCK_FLUSH = 0x04, /* Flush this context's DMA queue first */
DRM_LOCK_FLUSH_ALL = 0x08, /* Flush all DMA queues first */
/* These *HALT* flags aren't supported yet
-- they will be used to support the
full-screen DGA-like mode. */
DRM_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues */
DRM_HALT_CUR_QUEUES = 0x20 /* Halt all current queues */
} drmLockFlags;
typedef enum {
DRM_CONTEXT_PRESERVED = 0x01, /* This context is preserved and
never swapped. */
DRM_CONTEXT_2DONLY = 0x02 /* This context is for 2D rendering only. */
} drmContextFlags, *drmContextFlagsPtr;
typedef struct _drmBufDesc {
int count; /* Number of buffers of this size */
int size; /* Size in bytes */
int low_mark; /* Low water mark */
int high_mark; /* High water mark */
} drmBufDesc, *drmBufDescPtr;
typedef struct _drmBufInfo {
int count; /* Number of buffers described in list */
drmBufDescPtr list; /* List of buffer descriptions */
} drmBufInfo, *drmBufInfoPtr;
typedef struct _drmBuf {
int idx; /* Index into master buflist */
int total; /* Buffer size */
int used; /* Amount of buffer in use (for DMA) */
drmAddress address; /* Address */
} drmBuf, *drmBufPtr;
typedef struct _drmBufMap {
int count; /* Number of buffers mapped */
drmBufPtr list; /* Buffers */
} drmBufMap, *drmBufMapPtr;
typedef struct _drmLock {
volatile unsigned int lock;
char padding[60];
/* This is big enough for most current (and future?) architectures:
DEC Alpha: 32 bytes
Intel Merced: ?
Intel P5/PPro/PII/PIII: 32 bytes
Intel StrongARM: 32 bytes
Intel i386/i486: 16 bytes
MIPS: 32 bytes (?)
Motorola 68k: 16 bytes
Motorola PowerPC: 32 bytes
Sun SPARC: 32 bytes
*/
} drmLock, *drmLockPtr;
typedef struct _drmDMAReq {
/* Indices here refer to the offset into
list in drmBufInfo */
drmContext context; /* Context handle */
int send_count; /* Number of buffers to send */
int *send_list; /* List of handles to buffers */
int *send_sizes; /* Lengths of data to send, in bytes */
drmDMAFlags flags; /* Flags */
int request_count; /* Number of buffers requested */
int request_size; /* Desired size of buffers requested */
int *request_list; /* Buffer information */
int *request_sizes; /* Minimum acceptable sizes */
int granted_count; /* Number of buffers granted at this size */
} drmDMAReq, *drmDMAReqPtr;
typedef struct _drmRegion {
drmHandle handle;
unsigned int offset;
drmSize size;
drmAddress map;
} drmRegion, *drmRegionPtr;
typedef struct _drmTextureRegion {
unsigned char next;
unsigned char prev;
unsigned char in_use;
unsigned char padding; /* Explicitly pad this out */
unsigned int age;
} drmTextureRegion, *drmTextureRegionPtr;
typedef struct _drmClipRect {
unsigned short x1; /* Upper left: inclusive */
unsigned short y1;
unsigned short x2; /* Lower right: exclusive */
unsigned short y2;
} drmClipRect, *drmClipRectPtr;
typedef enum {
DRM_VBLANK_ABSOLUTE = 0x0, /* Wait for specific vblank sequence number */
DRM_VBLANK_RELATIVE = 0x1, /* Wait for given number of vblanks */
DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */
} drmVBlankSeqType;
typedef struct _drmVBlankReq {
drmVBlankSeqType type;
unsigned int sequence;
unsigned long signal;
} drmVBlankReq, *drmVBlankReqPtr;
typedef struct _drmVBlankReply {
drmVBlankSeqType type;
unsigned int sequence;
long tval_sec;
long tval_usec;
} drmVBlankReply, *drmVBlankReplyPtr;
typedef union _drmVBlank {
drmVBlankReq request;
drmVBlankReply reply;
} drmVBlank, *drmVBlankPtr;
#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock)
#define DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */
#define DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */
#if __GNUC__ >= 2
# if defined(__i386) || defined(__x86_64__)
/* Reflect changes here to drmP.h */
#define DRM_CAS(lock,old,new,__ret) \
do { \
int __dummy; /* Can't mark eax as clobbered */ \
__asm__ __volatile__( \
"lock ; cmpxchg %4,%1\n\t" \
"setnz %0" \
: "=d" (__ret), \
"=m" (__drm_dummy_lock(lock)), \
"=a" (__dummy) \
: "2" (old), \
"r" (new)); \
} while (0)
#elif defined(__alpha__)
#define DRM_CAS(lock, old, new, ret) \
do { \
int old32; \
int cur32; \
__asm__ __volatile__( \
" mb\n" \
" zap %4, 0xF0, %0\n" \
" ldl_l %1, %2\n" \
" zap %1, 0xF0, %1\n" \
" cmpeq %0, %1, %1\n" \
" beq %1, 1f\n" \
" bis %5, %5, %1\n" \
" stl_c %1, %2\n" \
"1: xor %1, 1, %1\n" \
" stl %1, %3" \
: "+r" (old32), \
"+&r" (cur32), \
"=m" (__drm_dummy_lock(lock)),\
"=m" (ret) \
: "r" (old), \
"r" (new)); \
} while(0)
#elif defined(__sparc__)
#define DRM_CAS(lock,old,new,__ret) \
do { register unsigned int __old __asm("o0"); \
register unsigned int __new __asm("o1"); \
register volatile unsigned int *__lock __asm("o2"); \
__old = old; \
__new = new; \
__lock = (volatile unsigned int *)lock; \
__asm__ __volatile__( \
/*"cas [%2], %3, %0"*/ \
".word 0xd3e29008\n\t" \
/*"membar #StoreStore | #StoreLoad"*/ \
".word 0x8143e00a" \
: "=&r" (__new) \
: "0" (__new), \
"r" (__lock), \
"r" (__old) \
: "memory"); \
__ret = (__new != __old); \
} while(0)
#elif defined(__ia64__)
#if 0
/* this currently generates bad code (missing stop bits)... */
#include <ia64intrin.h>
#define DRM_CAS(lock,old,new,__ret) \
do { \
__ret = (__sync_val_compare_and_swap(&__drm_dummy_lock(lock), \
(old), (new)) \
!= (old)); \
} while (0)
#else
#define DRM_CAS(lock,old,new,__ret) \
do { \
unsigned int __result, __old = (old); \
__asm__ __volatile__( \
"mf\n" \
"mov ar.ccv=%2\n" \
";;\n" \
"cmpxchg4.acq %0=%1,%3,ar.ccv" \
: "=r" (__result), "=m" (__drm_dummy_lock(lock)) \
: "r" (__old), "r" (new) \
: "memory"); \
__ret = (__result) != (__old); \
} while (0)
#endif
#elif defined(__powerpc__)
#define DRM_CAS(lock,old,new,__ret) \
do { \
__asm__ __volatile__( \
"sync;" \
"0: lwarx %0,0,%1;" \
" xor. %0,%3,%0;" \
" bne 1f;" \
" stwcx. %2,0,%1;" \
" bne- 0b;" \
"1: " \
"sync;" \
: "=&r"(__ret) \
: "r"(lock), "r"(new), "r"(old) \
: "cr0", "memory"); \
} while (0)
#endif /* architecture */
#endif /* __GNUC__ >= 2 */
#ifndef DRM_CAS
#define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */
#endif
#if defined(__alpha__) || defined(__powerpc__)
#define DRM_CAS_RESULT(_result) int _result
#else
#define DRM_CAS_RESULT(_result) char _result
#endif
#define DRM_LIGHT_LOCK(fd,lock,context) \
do { \
DRM_CAS_RESULT(__ret); \
DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \
if (__ret) drmGetLock(fd,context,0); \
} while(0)
/* This one counts fast locks -- for
benchmarking only. */
#define DRM_LIGHT_LOCK_COUNT(fd,lock,context,count) \
do { \
DRM_CAS_RESULT(__ret); \
DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \
if (__ret) drmGetLock(fd,context,0); \
else ++count; \
} while(0)
#define DRM_LOCK(fd,lock,context,flags) \
do { \
if (flags) drmGetLock(fd,context,flags); \
else DRM_LIGHT_LOCK(fd,lock,context); \
} while(0)
#define DRM_UNLOCK(fd,lock,context) \
do { \
DRM_CAS_RESULT(__ret); \
DRM_CAS(lock,DRM_LOCK_HELD|context,context,__ret); \
if (__ret) drmUnlock(fd,context); \
} while(0)
/* Simple spin locks */
#define DRM_SPINLOCK(spin,val) \
do { \
DRM_CAS_RESULT(__ret); \
do { \
DRM_CAS(spin,0,val,__ret); \
if (__ret) while ((spin)->lock); \
} while (__ret); \
} while(0)
#define DRM_SPINLOCK_TAKE(spin,val) \
do { \
DRM_CAS_RESULT(__ret); \
int cur; \
do { \
cur = (*spin).lock; \
DRM_CAS(spin,cur,val,__ret); \
} while (__ret); \
} while(0)
#define DRM_SPINLOCK_COUNT(spin,val,count,__ret) \
do { \
int __i; \
__ret = 1; \
for (__i = 0; __ret && __i < count; __i++) { \
DRM_CAS(spin,0,val,__ret); \
if (__ret) for (;__i < count && (spin)->lock; __i++); \
} \
} while(0)
#define DRM_SPINUNLOCK(spin,val) \
do { \
DRM_CAS_RESULT(__ret); \
if ((*spin).lock == val) { /* else server stole lock */ \
do { \
DRM_CAS(spin,val,0,__ret); \
} while (__ret); \
} \
} while(0)
/* General user-level programmer's API: unprivileged */
extern int drmAvailable(void);
extern int drmOpen(const char *name, const char *busid);
extern int drmClose(int fd);
extern drmVersionPtr drmGetVersion(int fd);
extern drmVersionPtr drmGetLibVersion(int fd);
extern void drmFreeVersion(drmVersionPtr);
extern int drmGetMagic(int fd, drmMagicPtr magic);
extern char *drmGetBusid(int fd);
extern int drmGetInterruptFromBusID(int fd, int busnum, int devnum,
int funcnum);
extern int drmGetMap(int fd, int idx, drmHandle *offset,
drmSize *size, drmMapType *type,
drmMapFlags *flags, drmHandle *handle,
int *mtrr);
extern int drmGetClient(int fd, int idx, int *auth, int *pid,
int *uid, unsigned long *magic,
unsigned long *iocs);
extern int drmGetStats(int fd, drmStatsT *stats);
extern int drmCommandNone(int fd, unsigned long drmCommandIndex);
extern int drmCommandRead(int fd, unsigned long drmCommandIndex,
void *data, unsigned long size);
extern int drmCommandWrite(int fd, unsigned long drmCommandIndex,
void *data, unsigned long size);
extern int drmCommandWriteRead(int fd, unsigned long drmCommandIndex,
void *data, unsigned long size);
/* General user-level programmer's API: X server (root) only */
extern void drmFreeBusid(const char *busid);
extern int drmSetBusid(int fd, const char *busid);
extern int drmAuthMagic(int fd, drmMagic magic);
extern int drmAddMap(int fd,
drmHandle offset,
drmSize size,
drmMapType type,
drmMapFlags flags,
drmHandlePtr handle);
extern int drmRmMap(int fd, drmHandle handle);
extern int drmAddContextPrivateMapping(int fd, drmContext ctx_id,
drmHandle handle);
extern int drmAddBufs(int fd, int count, int size,
drmBufDescFlags flags,
int agp_offset);
extern int drmMarkBufs(int fd, double low, double high);
extern int drmCreateContext(int fd, drmContextPtr handle);
extern int drmSetContextFlags(int fd, drmContext context,
drmContextFlags flags);
extern int drmGetContextFlags(int fd, drmContext context,
drmContextFlagsPtr flags);
extern int drmAddContextTag(int fd, drmContext context, void *tag);
extern int drmDelContextTag(int fd, drmContext context);
extern void *drmGetContextTag(int fd, drmContext context);
extern drmContextPtr drmGetReservedContextList(int fd, int *count);
extern void drmFreeReservedContextList(drmContextPtr);
extern int drmSwitchToContext(int fd, drmContext context);
extern int drmDestroyContext(int fd, drmContext handle);
extern int drmCreateDrawable(int fd, drmDrawablePtr handle);
extern int drmDestroyDrawable(int fd, drmDrawable handle);
extern int drmCtlInstHandler(int fd, int irq);
extern int drmCtlUninstHandler(int fd);
extern int drmInstallSIGIOHandler(int fd,
void (*f)(int fd,
void *oldctx,
void *newctx));
extern int drmRemoveSIGIOHandler(int fd);
/* General user-level programmer's API: authenticated client and/or X */
extern int drmMap(int fd,
drmHandle handle,
drmSize size,
drmAddressPtr address);
extern int drmUnmap(drmAddress address, drmSize size);
extern drmBufInfoPtr drmGetBufInfo(int fd);
extern drmBufMapPtr drmMapBufs(int fd);
extern int drmUnmapBufs(drmBufMapPtr bufs);
extern int drmDMA(int fd, drmDMAReqPtr request);
extern int drmFreeBufs(int fd, int count, int *list);
extern int drmGetLock(int fd,
drmContext context,
drmLockFlags flags);
extern int drmUnlock(int fd, drmContext context);
extern int drmFinish(int fd, int context, drmLockFlags flags);
extern int drmGetContextPrivateMapping(int fd, drmContext ctx_id,
drmHandlePtr handle);
/* AGP/GART support: X server (root) only */
extern int drmAgpAcquire(int fd);
extern int drmAgpRelease(int fd);
extern int drmAgpEnable(int fd, unsigned long mode);
extern int drmAgpAlloc(int fd, unsigned long size,
unsigned long type, unsigned long *address,
unsigned long *handle);
extern int drmAgpFree(int fd, unsigned long handle);
extern int drmAgpBind(int fd, unsigned long handle,
unsigned long offset);
extern int drmAgpUnbind(int fd, unsigned long handle);
/* AGP/GART info: authenticated client and/or X */
extern int drmAgpVersionMajor(int fd);
extern int drmAgpVersionMinor(int fd);
extern unsigned long drmAgpGetMode(int fd);
extern unsigned long drmAgpBase(int fd); /* Physical location */
extern unsigned long drmAgpSize(int fd); /* Bytes */
extern unsigned long drmAgpMemoryUsed(int fd);
extern unsigned long drmAgpMemoryAvail(int fd);
extern unsigned int drmAgpVendorId(int fd);
extern unsigned int drmAgpDeviceId(int fd);
/* PCI scatter/gather support: X server (root) only */
extern int drmScatterGatherAlloc(int fd, unsigned long size,
unsigned long *handle);
extern int drmScatterGatherFree(int fd, unsigned long handle);
extern int drmWaitVBlank(int fd, drmVBlankPtr vbl);
/* Support routines */
extern int drmError(int err, const char *label);
extern void *drmMalloc(int size);
extern void drmFree(void *pt);
/* Hash table routines */
extern void *drmHashCreate(void);
extern int drmHashDestroy(void *t);
extern int drmHashLookup(void *t, unsigned long key, void **value);
extern int drmHashInsert(void *t, unsigned long key, void *value);
extern int drmHashDelete(void *t, unsigned long key);
extern int drmHashFirst(void *t, unsigned long *key, void **value);
extern int drmHashNext(void *t, unsigned long *key, void **value);
/* PRNG routines */
extern void *drmRandomCreate(unsigned long seed);
extern int drmRandomDestroy(void *state);
extern unsigned long drmRandom(void *state);
extern double drmRandomDouble(void *state);
/* Skip list routines */
extern void *drmSLCreate(void);
extern int drmSLDestroy(void *l);
extern int drmSLLookup(void *l, unsigned long key, void **value);
extern int drmSLInsert(void *l, unsigned long key, void *value);
extern int drmSLDelete(void *l, unsigned long key);
extern int drmSLNext(void *l, unsigned long *key, void **value);
extern int drmSLFirst(void *l, unsigned long *key, void **value);
extern void drmSLDump(void *l);
extern int drmSLLookupNeighbors(void *l, unsigned long key,
unsigned long *prev_key, void **prev_value,
unsigned long *next_key, void **next_value);
#endif

View File

@@ -1,435 +0,0 @@
/* xf86drmHash.c -- Small hash table support for integer -> integer mapping
* Created: Sun Apr 18 09:35:45 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
*
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $
*
* DESCRIPTION
*
* This file contains a straightforward implementation of a fixed-sized
* hash table using self-organizing linked lists [Knuth73, pp. 398-399] for
* collision resolution. There are two potentially interesting things
* about this implementation:
*
* 1) The table is power-of-two sized. Prime sized tables are more
* traditional, but do not have a significant advantage over power-of-two
* sized table, especially when double hashing is not used for collision
* resolution.
*
* 2) The hash computation uses a table of random integers [Hanson97,
* pp. 39-41].
*
* FUTURE ENHANCEMENTS
*
* With a table size of 512, the current implementation is sufficient for a
* few hundred keys. Since this is well above the expected size of the
* tables for which this implementation was designed, the implementation of
* dynamic hash tables was postponed until the need arises. A common (and
* naive) approach to dynamic hash table implementation simply creates a
* new hash table when necessary, rehashes all the data into the new table,
* and destroys the old table. The approach in [Larson88] is superior in
* two ways: 1) only a portion of the table is expanded when needed,
* distributing the expansion cost over several insertions, and 2) portions
* of the table can be locked, enabling a scalable thread-safe
* implementation.
*
* REFERENCES
*
* [Hanson97] David R. Hanson. C Interfaces and Implementations:
* Techniques for Creating Reusable Software. Reading, Massachusetts:
* Addison-Wesley, 1997.
*
* [Knuth73] Donald E. Knuth. The Art of Computer Programming. Volume 3:
* Sorting and Searching. Reading, Massachusetts: Addison-Wesley, 1973.
*
* [Larson88] Per-Ake Larson. "Dynamic Hash Tables". CACM 31(4), April
* 1988, pp. 446-457.
*
*/
#define HASH_MAIN 0
#if HASH_MAIN
# include <stdio.h>
# include <stdlib.h>
#else
# include "xf86drm.h"
# ifdef XFree86LOADER
# include "xf86.h"
# include "xf86_ansic.h"
# else
# include <stdio.h>
# include <stdlib.h>
# endif
#endif
#define N(x) drm##x
#define HASH_MAGIC 0xdeadbeef
#define HASH_DEBUG 0
#define HASH_SIZE 512 /* Good for about 100 entries */
/* If you change this value, you probably
have to change the HashHash hashing
function! */
#if HASH_MAIN
#define HASH_ALLOC malloc
#define HASH_FREE free
#define HASH_RANDOM_DECL
#define HASH_RANDOM_INIT(seed) srandom(seed)
#define HASH_RANDOM random()
#else
#define HASH_ALLOC drmMalloc
#define HASH_FREE drmFree
#define HASH_RANDOM_DECL void *state
#define HASH_RANDOM_INIT(seed) state = drmRandomCreate(seed)
#define HASH_RANDOM drmRandom(state)
#endif
typedef struct HashBucket {
unsigned long key;
void *value;
struct HashBucket *next;
} HashBucket, *HashBucketPtr;
typedef struct HashTable {
unsigned long magic;
unsigned long entries;
unsigned long hits; /* At top of linked list */
unsigned long partials; /* Not at top of linked list */
unsigned long misses; /* Not in table */
HashBucketPtr buckets[HASH_SIZE];
int p0;
HashBucketPtr p1;
} HashTable, *HashTablePtr;
#if HASH_MAIN
extern void *N(HashCreate)(void);
extern int N(HashDestroy)(void *t);
extern int N(HashLookup)(void *t, unsigned long key, unsigned long *value);
extern int N(HashInsert)(void *t, unsigned long key, unsigned long value);
extern int N(HashDelete)(void *t, unsigned long key);
#endif
static unsigned long HashHash(unsigned long key)
{
unsigned long hash = 0;
unsigned long tmp = key;
static int init = 0;
static unsigned long scatter[256];
int i;
if (!init) {
HASH_RANDOM_DECL;
HASH_RANDOM_INIT(37);
for (i = 0; i < 256; i++) scatter[i] = HASH_RANDOM;
++init;
}
while (tmp) {
hash = (hash << 1) + scatter[tmp & 0xff];
tmp >>= 8;
}
hash %= HASH_SIZE;
#if HASH_DEBUG
printf( "Hash(%d) = %d\n", key, hash);
#endif
return hash;
}
void *N(HashCreate)(void)
{
HashTablePtr table;
int i;
table = HASH_ALLOC(sizeof(*table));
if (!table) return NULL;
table->magic = HASH_MAGIC;
table->entries = 0;
table->hits = 0;
table->partials = 0;
table->misses = 0;
for (i = 0; i < HASH_SIZE; i++) table->buckets[i] = NULL;
return table;
}
int N(HashDestroy)(void *t)
{
HashTablePtr table = (HashTablePtr)t;
HashBucketPtr bucket;
HashBucketPtr next;
int i;
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
for (i = 0; i < HASH_SIZE; i++) {
for (bucket = table->buckets[i]; bucket;) {
next = bucket->next;
HASH_FREE(bucket);
bucket = next;
}
}
HASH_FREE(table);
return 0;
}
/* Find the bucket and organize the list so that this bucket is at the
top. */
static HashBucketPtr HashFind(HashTablePtr table,
unsigned long key, unsigned long *h)
{
unsigned long hash = HashHash(key);
HashBucketPtr prev = NULL;
HashBucketPtr bucket;
if (h) *h = hash;
for (bucket = table->buckets[hash]; bucket; bucket = bucket->next) {
if (bucket->key == key) {
if (prev) {
/* Organize */
prev->next = bucket->next;
bucket->next = table->buckets[hash];
table->buckets[hash] = bucket;
++table->partials;
} else {
++table->hits;
}
return bucket;
}
prev = bucket;
}
++table->misses;
return NULL;
}
int N(HashLookup)(void *t, unsigned long key, void **value)
{
HashTablePtr table = (HashTablePtr)t;
HashBucketPtr bucket;
if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */
bucket = HashFind(table, key, NULL);
if (!bucket) return 1; /* Not found */
*value = bucket->value;
return 0; /* Found */
}
int N(HashInsert)(void *t, unsigned long key, void *value)
{
HashTablePtr table = (HashTablePtr)t;
HashBucketPtr bucket;
unsigned long hash;
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
if (HashFind(table, key, &hash)) return 1; /* Already in table */
bucket = HASH_ALLOC(sizeof(*bucket));
if (!bucket) return -1; /* Error */
bucket->key = key;
bucket->value = value;
bucket->next = table->buckets[hash];
table->buckets[hash] = bucket;
#if HASH_DEBUG
printf("Inserted %d at %d/%p\n", key, hash, bucket);
#endif
return 0; /* Added to table */
}
int N(HashDelete)(void *t, unsigned long key)
{
HashTablePtr table = (HashTablePtr)t;
unsigned long hash;
HashBucketPtr bucket;
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
bucket = HashFind(table, key, &hash);
if (!bucket) return 1; /* Not found */
table->buckets[hash] = bucket->next;
HASH_FREE(bucket);
return 0;
}
int N(HashNext)(void *t, unsigned long *key, void **value)
{
HashTablePtr table = (HashTablePtr)t;
for (; table->p0 < HASH_SIZE;
++table->p0, table->p1 = table->buckets[table->p0]) {
if (table->p1) {
*key = table->p1->key;
*value = table->p1->value;
table->p1 = table->p1->next;
return 1;
}
}
return 0;
}
int N(HashFirst)(void *t, unsigned long *key, void **value)
{
HashTablePtr table = (HashTablePtr)t;
if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
table->p0 = 0;
table->p1 = table->buckets[0];
return N(HashNext)(table, key, value);
}
#if HASH_MAIN
#define DIST_LIMIT 10
static int dist[DIST_LIMIT];
static void clear_dist(void) {
int i;
for (i = 0; i < DIST_LIMIT; i++) dist[i] = 0;
}
static int count_entries(HashBucketPtr bucket)
{
int count = 0;
for (; bucket; bucket = bucket->next) ++count;
return count;
}
static void update_dist(int count)
{
if (count >= DIST_LIMIT) ++dist[DIST_LIMIT-1];
else ++dist[count];
}
static void compute_dist(HashTablePtr table)
{
int i;
HashBucketPtr bucket;
printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n",
table->entries, table->hits, table->partials, table->misses);
clear_dist();
for (i = 0; i < HASH_SIZE; i++) {
bucket = table->buckets[i];
update_dist(count_entries(bucket));
}
for (i = 0; i < DIST_LIMIT; i++) {
if (i != DIST_LIMIT-1) printf("%5d %10d\n", i, dist[i]);
else printf("other %10d\n", dist[i]);
}
}
static void check_table(HashTablePtr table,
unsigned long key, unsigned long value)
{
unsigned long retval = 0;
int retcode = N(HashLookup)(table, key, &retval);
switch (retcode) {
case -1:
printf("Bad magic = 0x%08lx:"
" key = %lu, expected = %lu, returned = %lu\n",
table->magic, key, value, retval);
break;
case 1:
printf("Not found: key = %lu, expected = %lu returned = %lu\n",
key, value, retval);
break;
case 0:
if (value != retval)
printf("Bad value: key = %lu, expected = %lu, returned = %lu\n",
key, value, retval);
break;
default:
printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n",
retcode, key, value, retval);
break;
}
}
int main(void)
{
HashTablePtr table;
int i;
printf("\n***** 256 consecutive integers ****\n");
table = N(HashCreate)();
for (i = 0; i < 256; i++) N(HashInsert)(table, i, i);
for (i = 0; i < 256; i++) check_table(table, i, i);
for (i = 256; i >= 0; i--) check_table(table, i, i);
compute_dist(table);
N(HashDestroy)(table);
printf("\n***** 1024 consecutive integers ****\n");
table = N(HashCreate)();
for (i = 0; i < 1024; i++) N(HashInsert)(table, i, i);
for (i = 0; i < 1024; i++) check_table(table, i, i);
for (i = 1024; i >= 0; i--) check_table(table, i, i);
compute_dist(table);
N(HashDestroy)(table);
printf("\n***** 1024 consecutive page addresses (4k pages) ****\n");
table = N(HashCreate)();
for (i = 0; i < 1024; i++) N(HashInsert)(table, i*4096, i);
for (i = 0; i < 1024; i++) check_table(table, i*4096, i);
for (i = 1024; i >= 0; i--) check_table(table, i*4096, i);
compute_dist(table);
N(HashDestroy)(table);
printf("\n***** 1024 random integers ****\n");
table = N(HashCreate)();
srandom(0xbeefbeef);
for (i = 0; i < 1024; i++) N(HashInsert)(table, random(), i);
srandom(0xbeefbeef);
for (i = 0; i < 1024; i++) check_table(table, random(), i);
srandom(0xbeefbeef);
for (i = 0; i < 1024; i++) check_table(table, random(), i);
compute_dist(table);
N(HashDestroy)(table);
printf("\n***** 5000 random integers ****\n");
table = N(HashCreate)();
srandom(0xbeefbeef);
for (i = 0; i < 5000; i++) N(HashInsert)(table, random(), i);
srandom(0xbeefbeef);
for (i = 0; i < 5000; i++) check_table(table, random(), i);
srandom(0xbeefbeef);
for (i = 0; i < 5000; i++) check_table(table, random(), i);
compute_dist(table);
N(HashDestroy)(table);
return 0;
}
#endif

View File

@@ -1,219 +0,0 @@
/* xf86drmRandom.c -- "Minimal Standard" PRNG Implementation
* Created: Mon Apr 19 08:28:13 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
*
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRandom.c,v 1.4 2000/06/17 00:03:34 martin Exp $
*
* DESCRIPTION
*
* This file contains a simple, straightforward implementation of the Park
* & Miller "Minimal Standard" PRNG [PM88, PMS93], which is a Lehmer
* multiplicative linear congruential generator (MLCG) with a period of
* 2^31-1.
*
* This implementation is intended to provide a reliable, portable PRNG
* that is suitable for testing a hash table implementation and for
* implementing skip lists.
*
* FUTURE ENHANCEMENTS
*
* If initial seeds are not selected randomly, two instances of the PRNG
* can be correlated. [Knuth81, pp. 32-33] describes a shuffling technique
* that can eliminate this problem.
*
* If PRNGs are used for simulation, the period of the current
* implementation may be too short. [LE88] discusses methods of combining
* MLCGs to produce much longer periods, and suggests some alternative
* values for A and M. [LE90 and Sch92] also provide information on
* long-period PRNGs.
*
* REFERENCES
*
* [Knuth81] Donald E. Knuth. The Art of Computer Programming. Volume 2:
* Seminumerical Algorithms. Reading, Massachusetts: Addison-Wesley, 1981.
*
* [LE88] Pierre L'Ecuyer. "Efficient and Portable Combined Random Number
* Generators". CACM 31(6), June 1988, pp. 742-774.
*
* [LE90] Pierre L'Ecuyer. "Random Numbers for Simulation". CACM 33(10,
* October 1990, pp. 85-97.
*
* [PM88] Stephen K. Park and Keith W. Miller. "Random Number Generators:
* Good Ones are Hard to Find". CACM 31(10), October 1988, pp. 1192-1201.
*
* [Sch92] Bruce Schneier. "Pseudo-Ransom Sequence Generator for 32-Bit
* CPUs". Dr. Dobb's Journal 17(2), February 1992, pp. 34, 37-38, 40.
*
* [PMS93] Stephen K. Park, Keith W. Miller, and Paul K. Stockmeyer. In
* "Technical Correspondence: Remarks on Choosing and Implementing Random
* Number Generators". CACM 36(7), July 1993, pp. 105-110.
*
*/
#define RANDOM_MAIN 0
#if RANDOM_MAIN
# include <stdio.h>
# include <stdlib.h>
#else
# include "xf86drm.h"
# ifdef XFree86LOADER
# include "xf86.h"
# include "xf86_ansic.h"
# else
# include <stdio.h>
# include <stdlib.h>
# endif
#endif
#define N(x) drm##x
#define RANDOM_MAGIC 0xfeedbeef
#define RANDOM_DEBUG 0
#if RANDOM_MAIN
#define RANDOM_ALLOC malloc
#define RANDOM_FREE free
#else
#define RANDOM_ALLOC drmMalloc
#define RANDOM_FREE drmFree
#endif
typedef struct RandomState {
unsigned long magic;
unsigned long a;
unsigned long m;
unsigned long q; /* m div a */
unsigned long r; /* m mod a */
unsigned long check;
long seed;
} RandomState;
#if RANDOM_MAIN
extern void *N(RandomCreate)(unsigned long seed);
extern int N(RandomDestroy)(void *state);
extern unsigned long N(Random)(void *state);
extern double N(RandomDouble)(void *state);
#endif
void *N(RandomCreate)(unsigned long seed)
{
RandomState *state;
state = RANDOM_ALLOC(sizeof(*state));
if (!state) return NULL;
state->magic = RANDOM_MAGIC;
#if 0
/* Park & Miller, October 1988 */
state->a = 16807;
state->m = 2147483647;
state->check = 1043618065; /* After 10000 iterations */
#else
/* Park, Miller, and Stockmeyer, July 1993 */
state->a = 48271;
state->m = 2147483647;
state->check = 399268537; /* After 10000 iterations */
#endif
state->q = state->m / state->a;
state->r = state->m % state->a;
state->seed = seed;
/* Check for illegal boundary conditions,
and choose closest legal value. */
if (state->seed <= 0) state->seed = 1;
if (state->seed >= state->m) state->seed = state->m - 1;
return state;
}
int N(RandomDestroy)(void *state)
{
RANDOM_FREE(state);
return 0;
}
unsigned long N(Random)(void *state)
{
RandomState *s = (RandomState *)state;
long hi;
long lo;
hi = s->seed / s->q;
lo = s->seed % s->q;
s->seed = s->a * lo - s->r * hi;
if (s->seed <= 0) s->seed += s->m;
return s->seed;
}
double N(RandomDouble)(void *state)
{
RandomState *s = (RandomState *)state;
return (double)N(Random)(state)/(double)s->m;
}
#if RANDOM_MAIN
static void check_period(long seed)
{
unsigned long count = 0;
unsigned long initial;
void *state;
state = N(RandomCreate)(seed);
initial = N(Random)(state);
++count;
while (initial != N(Random)(state)) {
if (!++count) break;
}
printf("With seed of %10ld, period = %10lu (0x%08lx)\n",
seed, count, count);
N(RandomDestroy)(state);
}
int main(void)
{
RandomState *state;
int i;
unsigned long rand;
state = N(RandomCreate)(1);
for (i = 0; i < 10000; i++) {
rand = N(Random)(state);
}
printf("After 10000 iterations: %lu (%lu expected): %s\n",
rand, state->check,
rand - state->check ? "*INCORRECT*" : "CORRECT");
N(RandomDestroy)(state);
printf("Checking periods...\n");
check_period(1);
check_period(2);
check_period(31415926);
return 0;
}
#endif

View File

@@ -1,490 +0,0 @@
/* xf86drmSL.c -- Skip list support
* Created: Mon May 10 09:28:13 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
*
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSL.c,v 1.3 2000/06/17 00:03:34 martin Exp $
*
* DESCRIPTION
*
* This file contains a straightforward skip list implementation.n
*
* FUTURE ENHANCEMENTS
*
* REFERENCES
*
* [Pugh90] William Pugh. Skip Lists: A Probabilistic Alternative to
* Balanced Trees. CACM 33(6), June 1990, pp. 668-676.
*
*/
#define SL_MAIN 0
#if SL_MAIN
# include <stdio.h>
# include <stdlib.h>
# include <sys/time.h>
#else
# include "xf86drm.h"
# ifdef XFree86LOADER
# include "xf86.h"
# include "xf86_ansic.h"
# else
# include <stdio.h>
# include <stdlib.h>
# endif
#endif
#define N(x) drm##x
#define SL_LIST_MAGIC 0xfacade00LU
#define SL_ENTRY_MAGIC 0x00fab1edLU
#define SL_FREED_MAGIC 0xdecea5edLU
#define SL_MAX_LEVEL 16
#define SL_DEBUG 0
#define SL_RANDOM_SEED 0xc01055a1LU
#if SL_MAIN
#define SL_ALLOC malloc
#define SL_FREE free
#define SL_RANDOM_DECL static int state = 0;
#define SL_RANDOM_INIT(seed) if (!state) { srandom(seed); ++state; }
#define SL_RANDOM random()
#else
#define SL_ALLOC drmMalloc
#define SL_FREE drmFree
#define SL_RANDOM_DECL static void *state = NULL
#define SL_RANDOM_INIT(seed) if (!state) state = drmRandomCreate(seed)
#define SL_RANDOM drmRandom(state)
#endif
typedef struct SLEntry {
unsigned long magic; /* SL_ENTRY_MAGIC */
unsigned long key;
void *value;
int levels;
struct SLEntry *forward[1]; /* variable sized array */
} SLEntry, *SLEntryPtr;
typedef struct SkipList {
unsigned long magic; /* SL_LIST_MAGIC */
int level;
int count;
SLEntryPtr head;
SLEntryPtr p0; /* Position for iteration */
} SkipList, *SkipListPtr;
#if SL_MAIN
extern void *N(SLCreate)(void);
extern int N(SLDestroy)(void *l);
extern int N(SLLookup)(void *l, unsigned long key, void **value);
extern int N(SLInsert)(void *l, unsigned long key, void *value);
extern int N(SLDelete)(void *l, unsigned long key);
extern int N(SLNext)(void *l, unsigned long *key, void **value);
extern int N(SLFirst)(void *l, unsigned long *key, void **value);
extern void N(SLDump)(void *l);
extern int N(SLLookupNeighbors)(void *l, unsigned long key,
unsigned long *prev_key, void **prev_value,
unsigned long *next_key, void **next_value);
#endif
static SLEntryPtr SLCreateEntry(int max_level, unsigned long key, void *value)
{
SLEntryPtr entry;
if (max_level < 0 || max_level > SL_MAX_LEVEL) max_level = SL_MAX_LEVEL;
entry = SL_ALLOC(sizeof(*entry)
+ (max_level + 1) * sizeof(entry->forward[0]));
if (!entry) return NULL;
entry->magic = SL_ENTRY_MAGIC;
entry->key = key;
entry->value = value;
entry->levels = max_level + 1;
return entry;
}
static int SLRandomLevel(void)
{
int level = 1;
SL_RANDOM_DECL;
SL_RANDOM_INIT(SL_RANDOM_SEED);
while ((SL_RANDOM & 0x01) && level < SL_MAX_LEVEL) ++level;
return level;
}
void *N(SLCreate)(void)
{
SkipListPtr list;
int i;
list = SL_ALLOC(sizeof(*list));
if (!list) return NULL;
list->magic = SL_LIST_MAGIC;
list->level = 0;
list->head = SLCreateEntry(SL_MAX_LEVEL, 0, NULL);
list->count = 0;
for (i = 0; i <= SL_MAX_LEVEL; i++) list->head->forward[i] = NULL;
return list;
}
int N(SLDestroy)(void *l)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr entry;
SLEntryPtr next;
if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
for (entry = list->head; entry; entry = next) {
if (entry->magic != SL_ENTRY_MAGIC) return -1; /* Bad magic */
next = entry->forward[0];
entry->magic = SL_FREED_MAGIC;
SL_FREE(entry);
}
list->magic = SL_FREED_MAGIC;
SL_FREE(list);
return 0;
}
static SLEntryPtr SLLocate(void *l, unsigned long key, SLEntryPtr *update)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr entry;
int i;
if (list->magic != SL_LIST_MAGIC) return NULL;
for (i = list->level, entry = list->head; i >= 0; i--) {
while (entry->forward[i] && entry->forward[i]->key < key)
entry = entry->forward[i];
update[i] = entry;
}
return entry->forward[0];
}
int N(SLInsert)(void *l, unsigned long key, void *value)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr entry;
SLEntryPtr update[SL_MAX_LEVEL + 1];
int level;
int i;
if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
entry = SLLocate(list, key, update);
if (entry && entry->key == key) return 1; /* Already in list */
level = SLRandomLevel();
if (level > list->level) {
level = ++list->level;
update[level] = list->head;
}
entry = SLCreateEntry(level, key, value);
/* Fix up forward pointers */
for (i = 0; i <= level; i++) {
entry->forward[i] = update[i]->forward[i];
update[i]->forward[i] = entry;
}
++list->count;
return 0; /* Added to table */
}
int N(SLDelete)(void *l, unsigned long key)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr update[SL_MAX_LEVEL + 1];
SLEntryPtr entry;
int i;
if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
entry = SLLocate(list, key, update);
if (!entry || entry->key != key) return 1; /* Not found */
/* Fix up forward pointers */
for (i = 0; i <= list->level; i++) {
if (update[i]->forward[i] == entry)
update[i]->forward[i] = entry->forward[i];
}
entry->magic = SL_FREED_MAGIC;
SL_FREE(entry);
while (list->level && !list->head->forward[list->level]) --list->level;
--list->count;
return 0;
}
int N(SLLookup)(void *l, unsigned long key, void **value)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr update[SL_MAX_LEVEL + 1];
SLEntryPtr entry;
entry = SLLocate(list, key, update);
if (entry && entry->key == key) {
*value = entry;
return 0;
}
*value = NULL;
return -1;
}
int N(SLLookupNeighbors)(void *l, unsigned long key,
unsigned long *prev_key, void **prev_value,
unsigned long *next_key, void **next_value)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr update[SL_MAX_LEVEL + 1];
SLEntryPtr entry;
int retcode = 0;
entry = SLLocate(list, key, update);
*prev_key = *next_key = key;
*prev_value = *next_value = NULL;
if (update[0]) {
*prev_key = update[0]->key;
*prev_value = update[0]->value;
++retcode;
if (update[0]->forward[0]) {
*next_key = update[0]->forward[0]->key;
*next_value = update[0]->forward[0]->value;
++retcode;
}
}
return retcode;
}
int N(SLNext)(void *l, unsigned long *key, void **value)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr entry;
if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
entry = list->p0;
if (entry) {
list->p0 = entry->forward[0];
*key = entry->key;
*value = entry->value;
return 1;
}
list->p0 = NULL;
return 0;
}
int N(SLFirst)(void *l, unsigned long *key, void **value)
{
SkipListPtr list = (SkipListPtr)l;
if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
list->p0 = list->head->forward[0];
return N(SLNext)(list, key, value);
}
/* Dump internal data structures for debugging. */
void N(SLDump)(void *l)
{
SkipListPtr list = (SkipListPtr)l;
SLEntryPtr entry;
int i;
if (list->magic != SL_LIST_MAGIC) {
printf("Bad magic: 0x%08lx (expected 0x%08lx)\n",
list->magic, SL_LIST_MAGIC);
return;
}
printf("Level = %d, count = %d\n", list->level, list->count);
for (entry = list->head; entry; entry = entry->forward[0]) {
if (entry->magic != SL_ENTRY_MAGIC) {
printf("Bad magic: 0x%08lx (expected 0x%08lx)\n",
list->magic, SL_ENTRY_MAGIC);
}
printf("\nEntry %p <0x%08lx, %p> has %2d levels\n",
entry, entry->key, entry->value, entry->levels);
for (i = 0; i < entry->levels; i++) {
if (entry->forward[i]) {
printf(" %2d: %p <0x%08lx, %p>\n",
i,
entry->forward[i],
entry->forward[i]->key,
entry->forward[i]->value);
} else {
printf(" %2d: %p\n", i, entry->forward[i]);
}
}
}
}
#if SL_MAIN
static void print(SkipListPtr list)
{
unsigned long key;
void *value;
if (N(SLFirst)(list, &key, &value)) {
do {
printf("key = %5lu, value = %p\n", key, value);
} while (N(SLNext)(list, &key, &value));
}
}
static double do_time(int size, int iter)
{
SkipListPtr list;
int i, j;
unsigned long keys[1000000];
unsigned long previous;
unsigned long key;
void *value;
struct timeval start, stop;
double usec;
SL_RANDOM_DECL;
SL_RANDOM_INIT(12345);
list = N(SLCreate)();
for (i = 0; i < size; i++) {
keys[i] = SL_RANDOM;
N(SLInsert)(list, keys[i], NULL);
}
previous = 0;
if (N(SLFirst)(list, &key, &value)) {
do {
if (key <= previous) {
printf( "%lu !< %lu\n", previous, key);
}
previous = key;
} while (N(SLNext)(list, &key, &value));
}
gettimeofday(&start, NULL);
for (j = 0; j < iter; j++) {
for (i = 0; i < size; i++) {
if (N(SLLookup)(list, keys[i], &value))
printf("Error %lu %d\n", keys[i], i);
}
}
gettimeofday(&stop, NULL);
usec = (double)(stop.tv_sec * 1000000 + stop.tv_usec
- start.tv_sec * 1000000 - start.tv_usec) / (size * iter);
printf("%0.2f microseconds for list length %d\n", usec, size);
N(SLDestroy)(list);
return usec;
}
static void print_neighbors(void *list, unsigned long key)
{
unsigned long prev_key = 0;
unsigned long next_key = 0;
void *prev_value;
void *next_value;
int retval;
retval = drmSLLookupNeighbors(list, key,
&prev_key, &prev_value,
&next_key, &next_value);
printf("Neighbors of %5lu: %d %5lu %5lu\n",
key, retval, prev_key, next_key);
}
int main(void)
{
SkipListPtr list;
double usec, usec2, usec3, usec4;
list = N(SLCreate)();
printf( "list at %p\n", list);
print(list);
printf("\n==============================\n\n");
N(SLInsert)(list, 123, NULL);
N(SLInsert)(list, 213, NULL);
N(SLInsert)(list, 50, NULL);
print(list);
printf("\n==============================\n\n");
print_neighbors(list, 0);
print_neighbors(list, 50);
print_neighbors(list, 51);
print_neighbors(list, 123);
print_neighbors(list, 200);
print_neighbors(list, 213);
print_neighbors(list, 256);
printf("\n==============================\n\n");
N(SLDelete)(list, 50);
print(list);
printf("\n==============================\n\n");
N(SLDump)(list);
N(SLDestroy)(list);
printf("\n==============================\n\n");
usec = do_time(100, 10000);
usec2 = do_time(1000, 500);
printf("Table size increased by %0.2f, search time increased by %0.2f\n",
1000.0/100.0, usec2 / usec);
usec3 = do_time(10000, 50);
printf("Table size increased by %0.2f, search time increased by %0.2f\n",
10000.0/100.0, usec3 / usec);
usec4 = do_time(100000, 4);
printf("Table size increased by %0.2f, search time increased by %0.2f\n",
100000.0/100.0, usec4 / usec);
return 0;
}
#endif

View File

@@ -20,7 +20,7 @@
# 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.
# DOS/DJGPP glu makefile v1.1 for Mesa 4.0
# DOS/DJGPP glu makefile v1.3 for Mesa
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@yahoo.com
@@ -52,14 +52,16 @@ CC = gcc
CFLAGS += -I$(TOP)/include
AR = ar
ARFLAGS = ru
ARFLAGS = rus
ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
RM = del
CORE_SOURCES = \
glu.c \
mipmap.c \
@@ -78,7 +80,7 @@ SOURCES = $(CORE_SOURCES)
OBJECTS = $(SOURCES:.c=.o)
.c.o:
$(CC) -o $@ -c $(CFLAGS) $<
$(CC) -o $@ $(CFLAGS) -c $<
all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)
@@ -86,14 +88,13 @@ $(LIBDIR)/$(GLU_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS)
$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
ifeq ($(DXE2GEN),)
$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)
$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLU_DXE))
else
-dxe2gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) $(OBJECTS) -E djgpp_ -E glu -D "Mesa DJGPP GLU" -U
-dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E _glu -P gl.dxe -U $(OBJECTS)
endif
clean:
-$(RM) $(subst /,\,*.o)
-$(call UNLINK,*.o)
-include depend

188
src/glu/sgi/Makefile.DJ Normal file
View File

@@ -0,0 +1,188 @@
# Mesa 3-D graphics library
# Version: 4.0
#
# 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.
# DOS/DJGPP glu makefile v1.3 for Mesa
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@yahoo.com
# Web : http://www.geocities.com/dborca
#
# Available options:
#
# Environment variables:
# CFLAGS
#
# Targets:
# all: build GLU
# clean: remove object files
#
.PHONY: all clean
TOP = ..
LIBDIR = $(TOP)/lib
GLU_LIB = libglu.a
GLU_DXE = glu.dxe
GLU_IMP = libiglu.a
CC = gcc
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude
CXX = gpp
CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
AR = ar
ARFLAGS = rus
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
C_SOURCES = \
libutil/error.c \
libutil/glue.c \
libutil/mipmap.c \
libutil/project.c \
libutil/quad.c \
libutil/registry.c \
libtess/dict.c \
libtess/geom.c \
libtess/memalloc.c \
libtess/mesh.c \
libtess/normal.c \
libtess/priorityq.c \
libtess/render.c \
libtess/sweep.c \
libtess/tess.c \
libtess/tessmono.c
CC_SOURCES = \
libnurbs/interface/bezierEval.cc \
libnurbs/interface/bezierPatch.cc \
libnurbs/interface/bezierPatchMesh.cc \
libnurbs/interface/glcurveval.cc \
libnurbs/interface/glinterface.cc \
libnurbs/interface/glrenderer.cc \
libnurbs/interface/glsurfeval.cc \
libnurbs/interface/incurveeval.cc \
libnurbs/interface/insurfeval.cc \
libnurbs/internals/arc.cc \
libnurbs/internals/arcsorter.cc \
libnurbs/internals/arctess.cc \
libnurbs/internals/backend.cc \
libnurbs/internals/basiccrveval.cc \
libnurbs/internals/basicsurfeval.cc \
libnurbs/internals/bin.cc \
libnurbs/internals/bufpool.cc \
libnurbs/internals/cachingeval.cc \
libnurbs/internals/ccw.cc \
libnurbs/internals/coveandtiler.cc \
libnurbs/internals/curve.cc \
libnurbs/internals/curvelist.cc \
libnurbs/internals/curvesub.cc \
libnurbs/internals/dataTransform.cc \
libnurbs/internals/displaylist.cc \
libnurbs/internals/flist.cc \
libnurbs/internals/flistsorter.cc \
libnurbs/internals/hull.cc \
libnurbs/internals/intersect.cc \
libnurbs/internals/knotvector.cc \
libnurbs/internals/mapdesc.cc \
libnurbs/internals/mapdescv.cc \
libnurbs/internals/maplist.cc \
libnurbs/internals/mesher.cc \
libnurbs/internals/monoTriangulationBackend.cc \
libnurbs/internals/monotonizer.cc \
libnurbs/internals/mycode.cc \
libnurbs/internals/nurbsinterfac.cc \
libnurbs/internals/nurbstess.cc \
libnurbs/internals/patch.cc \
libnurbs/internals/patchlist.cc \
libnurbs/internals/quilt.cc \
libnurbs/internals/reader.cc \
libnurbs/internals/renderhints.cc \
libnurbs/internals/slicer.cc \
libnurbs/internals/sorter.cc \
libnurbs/internals/splitarcs.cc \
libnurbs/internals/subdivider.cc \
libnurbs/internals/tobezier.cc \
libnurbs/internals/trimline.cc \
libnurbs/internals/trimregion.cc \
libnurbs/internals/trimvertpool.cc \
libnurbs/internals/uarray.cc \
libnurbs/internals/varray.cc \
libnurbs/nurbtess/directedLine.cc \
libnurbs/nurbtess/gridWrap.cc \
libnurbs/nurbtess/monoChain.cc \
libnurbs/nurbtess/monoPolyPart.cc \
libnurbs/nurbtess/monoTriangulation.cc \
libnurbs/nurbtess/partitionX.cc \
libnurbs/nurbtess/partitionY.cc \
libnurbs/nurbtess/polyDBG.cc \
libnurbs/nurbtess/polyUtil.cc \
libnurbs/nurbtess/primitiveStream.cc \
libnurbs/nurbtess/quicksort.cc \
libnurbs/nurbtess/rectBlock.cc \
libnurbs/nurbtess/sampleComp.cc \
libnurbs/nurbtess/sampleCompBot.cc \
libnurbs/nurbtess/sampleCompRight.cc \
libnurbs/nurbtess/sampleCompTop.cc \
libnurbs/nurbtess/sampleMonoPoly.cc \
libnurbs/nurbtess/sampledLine.cc \
libnurbs/nurbtess/searchTree.cc
SOURCES = $(C_SOURCES) $(CC_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.cc.o:
$(CXX) -o $@ $(CXXFLAGS) -c $<
all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)
$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS)
$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLU_DXE))
else
-dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU/SGI DJGPP" -E _glu -P gl.dxe -U $(OBJECTS)
endif
clean:
-$(call UNLINK,libutil/*.o)
-$(call UNLINK,libtess/*.o)
-$(call UNLINK,libnurbs/interface/*.o)
-$(call UNLINK,libnurbs/internals/*.o)
-$(call UNLINK,libnurbs/nurbtess/*.o)
-include depend

View File

@@ -1,7 +1,7 @@
/*
** gluos.h - operating system dependencies for GLU
**
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.4 2002/10/04 15:58:33 kschultz Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.4.4.1 2003/02/12 16:04:45 brianp Exp $
*/
#ifdef __VMS
#ifdef __cplusplus
@@ -37,6 +37,13 @@
#pragma comment(linker, "/OPT:NOWIN98")
#endif
#elif defined(__OS2__)
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#define WINGDIAPI
#else
/* Disable Microsoft-specific keywords */

View File

@@ -20,7 +20,7 @@
# 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.
# DOS/DJGPP glut makefile v1.1 for Mesa 4.0
# DOS/DJGPP glut makefile v1.3 for Mesa
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@yahoo.com
@@ -33,14 +33,7 @@
# Environment variables:
# CFLAGS
#
# GLIDE absolute path to Glide SDK; used with FX.
# default = $(TOP)/include/glide3
# FX=1 build for 3dfx Glide3; use it if you have the glide
# SDK (designed for your platform), and, of course, a
# 3dfx card... Note that this disables compilation of
# actual DMesa code, as Glide does all the stuff!
# default = no
# MARK absolute path to original GLUT.
# MKGLUT absolute path to original GLUT.
# default = $(TOP)/src-glut
#
# Targets:
@@ -54,38 +47,35 @@
TOP = ..
GLIDE ?= $(TOP)/include/glide3
MARK ?= $(TOP)/src-glut
MKGLUT ?= $(TOP)/src-glut
LIBDIR = $(TOP)/lib
GLUT_LIB = libglut.a
GLUT_DXE = glut.dxe
GLUT_IMP = libiglut.a
CC = gcc
CFLAGS += -I$(TOP)/include -I$(MARK)
ifdef FX
CFLAGS += -D__DOS__ -I$(GLIDE) -DFX -DFX_GLIDE3 -DFXMESA_USE_ARGB
endif
CFLAGS += -I- -I$(TOP)/include -I. -I$(MKGLUT) -IPC_HW
AR = ar
ARFLAGS = ru
ARFLAGS = rus
ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
RM = del
CORE_SOURCES = \
bitmap.c \
callback.c \
color.c \
globals.c \
extens.c \
init.c \
menu.c \
models.c \
mouse.c \
overlay.c \
state.c \
teapot.c \
window.c
PC_HW_SOURCES = \
@@ -95,25 +85,34 @@ PC_HW_SOURCES = \
PC_HW/pc_timer.c \
PC_HW/pc_irq.S
MARK_SOURCES = \
$(MARK)/glut_8x13.c \
$(MARK)/glut_9x15.c \
$(MARK)/glut_hel10.c \
$(MARK)/glut_hel12.c \
$(MARK)/glut_hel18.c \
$(MARK)/glut_tr10.c \
$(MARK)/glut_tr24.c
MKGLUT_SOURCES = \
$(MKGLUT)/glut_bitmap.c \
$(MKGLUT)/glut_bwidth.c \
$(MKGLUT)/glut_stroke.c \
$(MKGLUT)/glut_swidth.c \
$(MKGLUT)/glut_shapes.c \
$(MKGLUT)/glut_teapot.c \
$(MKGLUT)/glut_8x13.c \
$(MKGLUT)/glut_9x15.c \
$(MKGLUT)/glut_hel10.c \
$(MKGLUT)/glut_hel12.c \
$(MKGLUT)/glut_hel18.c \
$(MKGLUT)/glut_tr10.c \
$(MKGLUT)/glut_tr24.c \
$(MKGLUT)/glut_roman.c \
$(MKGLUT)/glut_mroman.c \
$(MKGLUT)/glut_util.c
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MARK_SOURCES)
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MKGLUT_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.c.o:
$(CC) -o $@ -c $(CFLAGS) $<
$(CC) -o $@ $(CFLAGS) -c $<
.S.o:
$(CC) -o $@ -c $(CFLAGS) $<
$(CC) -o $@ $(CFLAGS) -c $<
.s.o:
$(CC) -o $@ -c $(CFLAGS) -x assembler-with-cpp $<
$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP)
@@ -121,16 +120,15 @@ $(LIBDIR)/$(GLUT_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS)
$(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
ifeq ($(DXE2GEN),)
$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)
$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLUT_DXE))
else
-dxe2gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) $(OBJECTS) -E djgpp_ -E glut -D "Mesa DJGPP GLUT" -U
-dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -P glu.dxe -U $(OBJECTS)
endif
clean:
-$(RM) $(subst /,\,*.o)
-$(RM) $(subst /,\,PC_HW/*.o)
-$(RM) $(subst /,\,$(MARK)/*.o)
-$(call UNLINK,*.o)
-$(call UNLINK,PC_HW/*.o)
-$(call UNLINK,$(MKGLUT)/*.o)
-include depend

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.2 for DOS/DJGPP
* PC/HW routine collection v1.3 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -73,21 +73,22 @@ void *pc_malloc (size_t size)
/*
* standard redirection
*/
static int h_out, h_outbak, h_err, h_errbak;
static char outname[L_tmpnam];
static int h_out, h_outbak;
static char errname[L_tmpnam];
static int h_err, h_errbak;
int pc_open_stdout (void)
{
if ((h_out=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) {
if ((h_outbak=dup(1)) != -1) {
fflush(stdout);
if (dup2(h_out, 1) != -1) {
return 0;
}
close(h_outbak);
}
close(h_out);
tmpnam(outname);
if ((h_out=open(outname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) {
h_outbak = dup(STDOUT_FILENO);
fflush(stdout);
dup2(h_out, STDOUT_FILENO);
}
return (h_out = -1);
return h_out;
}
void pc_close_stdout (void)
@@ -95,35 +96,32 @@ void pc_close_stdout (void)
FILE *f;
char *line = alloca(512);
if (h_out >= 0) {
dup2(h_outbak, 1);
if (h_out > 0) {
dup2(h_outbak, STDOUT_FILENO);
close(h_out);
close(h_outbak);
if ((f=fdopen(h_out, "r")) != NULL) {
fseek(f, 0, SEEK_SET);
while (fgets(line, 512, f)) {
fputs(line, stdout);
}
fclose(f);
} else {
close(h_out);
f = fopen(outname, "rt");
while (fgets(line, 512, f)) {
fputs(line, stdout);
}
fclose(f);
remove(outname);
}
}
int pc_open_stderr (void)
{
if ((h_err=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) {
if ((h_errbak=dup(2)) != -1) {
fflush(stderr);
if (dup2(h_err, 2) != -1) {
return 0;
}
close(h_errbak);
}
close(h_err);
tmpnam(errname);
if ((h_err=open(errname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) {
h_errbak = dup(STDERR_FILENO);
fflush(stderr);
dup2(h_err, STDERR_FILENO);
}
return (h_err = -1);
return h_err;
}
void pc_close_stderr (void)
@@ -131,18 +129,17 @@ void pc_close_stderr (void)
FILE *f;
char *line = alloca(512);
if (h_err >= 0) {
dup2(h_errbak, 2);
if (h_err > 0) {
dup2(h_errbak, STDERR_FILENO);
close(h_err);
close(h_errbak);
if ((f=fdopen(h_err, "r")) != NULL) {
fseek(f, 0, SEEK_SET);
while (fgets(line, 512, f)) {
fputs(line, stderr);
}
fclose(f);
} else {
close(h_err);
f = fopen(errname, "rt");
while (fgets(line, 512, f)) {
fputs(line, stderr);
}
fclose(f);
remove(errname);
}
}

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.2 for DOS/DJGPP
* PC/HW routine collection v1.3 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -25,7 +25,7 @@
typedef void (*VFUNC) (void);
typedef void (*PFUNC) (void *);
typedef void (*MFUNC) (int x, int y, int b);
typedef void (*MFUNC) (int x, int y, int z, int b);
/*
* atexit
@@ -39,6 +39,7 @@ int pc_clexit (VFUNC f);
#define ENDOFUNC(x) static void x##_end() { }
#define LOCKFUNC(x) _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x)
#define LOCKDATA(x) _go32_dpmi_lock_data((void *)&x, sizeof(x))
#define LOCKBUFF(x, l) _go32_dpmi_lock_data((void *)x, l)
void *pc_malloc (size_t size);
@@ -194,6 +195,7 @@ void pc_remove_keyb (void);
int pc_keypressed (void);
int pc_readkey (void);
int pc_keydown (int code);
int pc_keyshifts (void);
/*
* timer
@@ -209,10 +211,8 @@ void pc_remove_mouse (void);
MFUNC pc_install_mouse_handler (MFUNC handler);
void pc_mouse_area (int x1, int y1, int x2, int y2);
void pc_mouse_speed (int xspeed, int yspeed);
int pc_query_mouse (int *x, int *y);
void pc_show_mouse (void);
void pc_scare_mouse (void);
void pc_unscare_mouse (void);
int pc_query_mouse (int *x, int *y, int *z);
void pc_warp_mouse (int x, int y);
/*
* standard redirection

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.0 for DOS/DJGPP
* PC/HW routine collection v1.3 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -74,6 +74,9 @@ _pc_install_irq:
addl %edx, %eax
movl %eax, IRQ_STACK(%edi)
movl ___djgpp_ds_alias, %eax
movl %eax, IRQ_STACK+4(%edi)
movl %ss:12(%ebp), %eax
movl %eax, IRQ_HOOK(%edi)
@@ -131,8 +134,7 @@ __irq_wrapper_##x: ; \
pushl %gs ; \
movl %ss, %ebx ; \
movl %esp, %esi ; \
movl %cs:___djgpp_ds_alias, %ss ; \
movl %cs:__irq_stack_##x, %esp ; \
lss %cs:__irq_stack_##x, %esp ; \
pushl %ss ; \
pushl %ss ; \
popl %es ; \
@@ -160,7 +162,7 @@ __irq_old_##x: ; \
__irq_hook_##x: ; \
.long 0 ; \
__irq_stack_##x: ; \
.long 0
.long 0, 0
WRAPPER(0);
WRAPPER(1);

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.1 for DOS/DJGPP
* PC/HW routine collection v1.3 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -357,20 +357,6 @@ static void handle_code (int scancode, int keycode)
in_a_terrupt--;
} ENDOFUNC(handle_code)
static __inline void satisfy (void)
{
__asm("\n\
inb $0x61, %%al \n\
movb %%al, %%ah \n\
orb $0x80, %%al \n\
outb %%al, $0x61 \n\
xchgb %%al, %%ah \n\
outb %%al, $0x61 \n\
movb $0x20, %%al \n\
outb %%al, $0x20 \n\
":::"%eax");
}
static int keyboard ()
{
unsigned char temp, scancode;
@@ -410,7 +396,16 @@ static int keyboard ()
":::"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
}
satisfy();
__asm("\n\
inb $0x61, %%al \n\
movb %%al, %%ah \n\
orb $0x80, %%al \n\
outb %%al, $0x61 \n\
xchgb %%al, %%ah \n\
outb %%al, $0x61 \n\
movb $0x20, %%al \n\
outb %%al, $0x20 \n\
":::"%eax");
return 0;
} ENDOFUNC(keyboard)
@@ -425,8 +420,9 @@ int pc_readkey (void)
if (keyboard_installed) {
int key;
do {
} while (key_buffer.start==key_buffer.end);
while (key_buffer.start==key_buffer.end) {
__dpmi_yield();
}
DISABLE();
key = key_buffer.key[key_buffer.start++];
@@ -445,6 +441,11 @@ int pc_keydown (int code)
return pc_key[code];
}
int pc_keyshifts (void)
{
return key_shifts;
}
void pc_remove_keyb (void)
{
if (keyboard_installed) {

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.2 for DOS/DJGPP
* PC/HW routine collection v1.3 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -8,11 +8,15 @@
#include <dpmi.h>
#include <sys/exceptn.h>
#include <sys/segments.h>
#include "pc_hw.h"
#define PC_CUTE_WHEEL 1 /* CuteMouse WheelAPI */
#define MOUSE_STACK_SIZE 16384
#define CLEAR_MICKEYS() \
@@ -21,20 +25,23 @@
ox = oy = 0; \
} while (0)
extern void mouse_wrapper (void);
extern void mouse_wrapper_end (void);
extern void mouse_wrap (void);
extern int mouse_wrap_end[];
static MFUNC mouse_func;
static void *mouse_stack;
static long mouse_callback;
static __dpmi_regs mouse_regs;
static volatile int pc_mouse_x, pc_mouse_y, pc_mouse_b;
static volatile struct {
volatile int x, y, z, b;
} pc_mouse;
static int minx = 0;
static int maxx = 319;
static int miny = 0;
static int maxy = 199;
static int minz = 0;
static int maxz = 255;
static int sx = 2;
static int sy = 2;
@@ -43,27 +50,34 @@ static int emulat3 = FALSE;
static int ox, oy;
static void mouse (__dpmi_regs *r)
{
int nx = (signed short)r->x.si / sx;
int ny = (signed short)r->x.di / sy;
int dx = nx - ox;
int dy = ny - oy;
#if PC_CUTE_WHEEL
int dz = (signed char)r->h.bh;
#endif
ox = nx;
oy = ny;
pc_mouse_b = r->x.bx;
pc_mouse_x = MID(minx, pc_mouse_x + dx, maxx);
pc_mouse_y = MID(miny, pc_mouse_y + dy, maxy);
pc_mouse.b = r->h.bl;
pc_mouse.x = MID(minx, pc_mouse.x + dx, maxx);
pc_mouse.y = MID(miny, pc_mouse.y + dy, maxy);
#if PC_CUTE_WHEEL
pc_mouse.z = MID(minz, pc_mouse.z + dz, maxz);
#endif
if (emulat3) {
if ((pc_mouse_b&3)==3) {
pc_mouse_b = 4;
if ((pc_mouse.b&3)==3) {
pc_mouse.b = 4;
}
}
if (mouse_func) {
mouse_func(pc_mouse_x, pc_mouse_y, pc_mouse_b);
mouse_func(pc_mouse.x, pc_mouse.y, pc_mouse.z, pc_mouse.b);
}
} ENDOFUNC(mouse)
@@ -83,7 +97,7 @@ void pc_remove_mouse (void)
mouse_callback = 0;
free((void *)((unsigned long)mouse_stack-MOUSE_STACK_SIZE));
free((void *)(mouse_wrap_end[0] - MOUSE_STACK_SIZE));
}
}
@@ -109,26 +123,26 @@ int pc_install_mouse (void)
/* lock wrapper */
LOCKDATA(mouse_func);
LOCKDATA(mouse_stack);
LOCKDATA(mouse_callback);
LOCKDATA(mouse_regs);
LOCKDATA(pc_mouse_x);
LOCKDATA(pc_mouse_y);
LOCKDATA(pc_mouse_b);
LOCKDATA(pc_mouse);
LOCKDATA(minx);
LOCKDATA(maxx);
LOCKDATA(miny);
LOCKDATA(maxy);
LOCKDATA(minz);
LOCKDATA(maxz);
LOCKDATA(sx);
LOCKDATA(sy);
LOCKDATA(emulat3);
LOCKDATA(ox);
LOCKDATA(oy);
LOCKFUNC(mouse);
LOCKFUNC(mouse_wrapper);
LOCKFUNC(mouse_wrap);
mouse_wrap_end[1] = __djgpp_ds_alias;
/* grab a locked stack */
if ((mouse_stack=pc_malloc(MOUSE_STACK_SIZE))==NULL) {
if ((mouse_wrap_end[0] = (int)pc_malloc(MOUSE_STACK_SIZE)) == NULL) {
return 0;
}
@@ -150,19 +164,23 @@ int pc_install_mouse (void)
movl %%ecx, %0 \n\
0: \n\
":"=g"(mouse_callback)
:"S" (mouse_wrapper), "D"(&mouse_regs)
:"S" (mouse_wrap), "D"(&mouse_regs)
:"%eax", "%ecx", "%edx");
if (!mouse_callback) {
free(mouse_stack);
free((void *)mouse_wrap_end[0]);
return 0;
}
/* adjust stack */
mouse_stack = (void *)((unsigned long)mouse_stack + MOUSE_STACK_SIZE);
mouse_wrap_end[0] += MOUSE_STACK_SIZE;
/* install the handler */
mouse_regs.x.ax = 0x000c;
mouse_regs.x.cx = 0x007f;
#if PC_CUTE_WHEEL
mouse_regs.x.cx = 0x7f | 0x80;
#else
mouse_regs.x.cx = 0x7f;
#endif
mouse_regs.x.dx = mouse_callback&0xffff;
mouse_regs.x.es = mouse_callback>>16;
__dpmi_int(0x33, &mouse_regs);
@@ -205,54 +223,56 @@ void pc_mouse_speed (int xspeed, int yspeed)
ENABLE();
}
int pc_query_mouse (int *x, int *y)
int pc_query_mouse (int *x, int *y, int *z)
{
*x = pc_mouse_x;
*y = pc_mouse_y;
return pc_mouse_b;
*x = pc_mouse.x;
*y = pc_mouse.y;
*z = pc_mouse.z;
return pc_mouse.b;
}
void pc_show_mouse (void)
void pc_warp_mouse (int x, int y)
{
/* not implemented */
}
void pc_scare_mouse (void)
{
/* not implemented */
}
void pc_unscare_mouse (void)
{
/* not implemented */
CLEAR_MICKEYS();
pc_mouse.x = MID(minx, x, maxx);
pc_mouse.y = MID(miny, y, maxy);
if (mouse_func) {
mouse_func(pc_mouse.x, pc_mouse.y, pc_mouse.z, pc_mouse.b);
}
}
/* Hack alert:
* `mouse_wrap_end' actually holds the
* address of stack in a safe data selector.
*/
__asm("\n\
.text \n\
.balign 4 \n\
.global _mouse_wrapper \n\
_mouse_wrapper: \n\
cld \n\
lodsl \n\
movl %eax, %es:42(%edi) \n\
addw $4, %es:46(%edi) \n\
pushl %es \n\
movl %ss, %ebx \n\
movl %esp, %esi \n\
movl %cs:___djgpp_ds_alias, %ss \n\
movl %cs:_mouse_stack, %esp \n\
pushl %ss \n\
pushl %ss \n\
popl %es \n\
popl %ds \n\
movl ___djgpp_dos_sel, %fs \n\
pushl %fs \n\
popl %gs \n\
pushl %edi \n\
call _mouse \n\
popl %edi \n\
movl %ebx, %ss \n\
movl %esi, %esp \n\
popl %es \n\
iret \n\
.balign 4 \n\
.global _mouse_wrapper_end \n\
_mouse_wrapper_end:");
.text \n\
.p2align 5,,31 \n\
.global _mouse_wrap \n\
_mouse_wrap: \n\
cld \n\
lodsl \n\
movl %eax, %es:42(%edi) \n\
addw $4, %es:46(%edi) \n\
pushl %es \n\
movl %ss, %ebx \n\
movl %esp, %esi \n\
lss %cs:_mouse_wrap_end, %esp\n\
pushl %ss \n\
pushl %ss \n\
popl %es \n\
popl %ds \n\
movl ___djgpp_dos_sel, %fs \n\
pushl %fs \n\
popl %gs \n\
pushl %edi \n\
call _mouse \n\
popl %edi \n\
movl %ebx, %ss \n\
movl %esi, %esp \n\
popl %es \n\
iret \n\
.global _mouse_wrap_end \n\
_mouse_wrap_end:.long 0, 0");

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.0 for DOS/DJGPP
* PC/HW routine collection v1.3 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,7 +27,7 @@ typedef struct {
volatile void *parm;
} TIMER;
TIMER timer_main, timer_func[MAX_TIMERS];
static TIMER timer_main, timer_func[MAX_TIMERS];
static int timer ()
{

View File

@@ -1,56 +0,0 @@
/* Copyright (c) Mark J. Kilgard, 1994. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
#include "glutbitmap.h"
void APIENTRY
glutBitmapCharacter(GLUTbitmapFont font, int c)
{
const BitmapCharRec *ch;
BitmapFontPtr fontinfo;
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
#if defined(_WIN32)
fontinfo = (BitmapFontPtr) __glutFont(font);
#else
fontinfo = (BitmapFontPtr) font;
#endif
if (c < fontinfo->first ||
c >= fontinfo->first + fontinfo->num_chars)
return;
ch = fontinfo->ch[c - fontinfo->first];
if (ch) {
/* Save current modes. */
glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
/* Little endian machines (DEC Alpha for example) could
benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE
instead of GL_FALSE, but this would require changing the
generated bitmaps too. */
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
ch->advance, 0, ch->bitmap);
/* Restore saved modes. */
glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
}
}

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,126 +27,138 @@
*/
#include "GL/glut.h"
#include "internal.h"
#include "glutint.h"
void APIENTRY glutDisplayFunc (void (GLUTCALLBACK *func) (void))
GLUTidleCB g_idle_func = NULL;
void APIENTRY glutDisplayFunc (GLUTdisplayCB func)
{
display_func = func;
g_curwin->display = func;
}
void APIENTRY glutReshapeFunc (void (GLUTCALLBACK *func) (int width, int height))
void APIENTRY glutReshapeFunc (GLUTreshapeCB func)
{
reshape_func = func;
g_curwin->reshape = func;
}
void APIENTRY glutKeyboardFunc (void (GLUTCALLBACK *func) (unsigned char key, int x, int y))
void APIENTRY glutKeyboardFunc (GLUTkeyboardCB func)
{
keyboard_func = func;
g_curwin->keyboard = func;
}
void APIENTRY glutMouseFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y))
void APIENTRY glutMouseFunc (GLUTmouseCB func)
{
mouse_func = func;
g_curwin->mouse = func;
}
void APIENTRY glutMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
void APIENTRY glutMotionFunc (GLUTmotionCB func)
{
motion_func = func;
g_curwin->motion = func;
}
void APIENTRY glutPassiveMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
void APIENTRY glutPassiveMotionFunc (GLUTpassiveCB func)
{
passive_motion_func = func;
g_curwin->passive = func;
}
void APIENTRY glutEntryFunc (void (GLUTCALLBACK *func) (int state))
void APIENTRY glutEntryFunc (GLUTentryCB func)
{
entry_func = func;
g_curwin->entry = func;
}
void APIENTRY glutVisibilityFunc (void (GLUTCALLBACK *func) (int state))
void APIENTRY glutVisibilityFunc (GLUTvisibilityCB func)
{
visibility_func = func;
g_curwin->visibility = func;
}
void APIENTRY glutIdleFunc (void (GLUTCALLBACK *func) (void))
{
idle_func = func;
}
void APIENTRY glutTimerFunc (unsigned int millis, void (GLUTCALLBACK *func) (int value), int value)
void APIENTRY glutWindowStatusFunc (GLUTwindowStatusCB func)
{
}
void APIENTRY glutMenuStateFunc (void (GLUTCALLBACK *func) (int state))
void APIENTRY glutIdleFunc (GLUTidleCB func)
{
menu_state_func = func;
g_idle_func = func;
}
void APIENTRY glutSpecialFunc (void (GLUTCALLBACK *func) (int key, int x, int y))
{
special_func = func;
}
void APIENTRY glutSpaceballMotionFunc (void (GLUTCALLBACK *func) (int x, int y, int z))
void APIENTRY glutTimerFunc (unsigned int millis, GLUTtimerCB func, int value)
{
}
void APIENTRY glutSpaceballRotateFunc (void (GLUTCALLBACK *func) (int x, int y, int z))
void APIENTRY glutSpecialFunc (GLUTspecialCB func)
{
g_curwin->special = func;
}
void APIENTRY glutSpaceballMotionFunc (GLUTspaceMotionCB func)
{
}
void APIENTRY glutSpaceballButtonFunc (void (GLUTCALLBACK *func) (int button, int state))
void APIENTRY glutSpaceballRotateFunc (GLUTspaceRotateCB func)
{
}
void APIENTRY glutButtonBoxFunc (void (GLUTCALLBACK *func) (int button, int state))
void APIENTRY glutSpaceballButtonFunc (GLUTspaceButtonCB func)
{
}
void APIENTRY glutDialsFunc (void (GLUTCALLBACK *func) (int dial, int value))
void APIENTRY glutDialsFunc (GLUTdialsCB func)
{
}
void APIENTRY glutTabletMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
void APIENTRY glutButtonBoxFunc (GLUTbuttonBoxCB func)
{
}
void APIENTRY glutTabletButtonFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y))
void APIENTRY glutTabletMotionFunc (GLUTtabletMotionCB func)
{
}
void APIENTRY glutMenuStatusFunc (void (GLUTCALLBACK *func) (int status, int x, int y))
void APIENTRY glutTabletButtonFunc (GLUTtabletButtonCB func)
{
}
void APIENTRY glutOverlayDisplayFunc (void (GLUTCALLBACK *func) (void))
{
}
void APIENTRY glutWindowStatusFunc (void (GLUTCALLBACK *func) (int state))
void APIENTRY glutJoystickFunc (GLUTjoystickCB func, int interval)
{
}

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,20 +27,33 @@
*/
#include "GL/glut.h"
#include "glutint.h"
#include "GL/dmesa.h"
#define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i)))
void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue)
{
if (g_display_mode & GLUT_INDEX) {
if ((ndx >= 0) && (ndx < (256 - RESERVED_COLORS))) {
DMesaSetCI(ndx, CLAMP(red), CLAMP(green), CLAMP(blue));
}
}
}
GLfloat APIENTRY glutGetColor (int ndx, int component)
{
return 0.0;
}
void APIENTRY glutCopyColormap (int win)
{
}

View File

@@ -1,86 +1,63 @@
/*
* Mesa 3-D graphics library
* Version: 3.4
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#include "GL/glut.h"
int APIENTRY glutCreateMenu (void (GLUTCALLBACK *func) (int))
{
return 0;
}
void APIENTRY glutDestroyMenu (int menu)
{
}
int APIENTRY glutGetMenu (void)
{
return 0;
}
void APIENTRY glutSetMenu (int menu)
{
}
void APIENTRY glutAddMenuEntry (const char *label, int value)
{
}
void APIENTRY glutAddSubMenu (const char *label, int submenu)
{
}
void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value)
{
}
void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu)
{
}
void APIENTRY glutRemoveMenuItem (int item)
{
}
void APIENTRY glutAttachMenu (int button)
{
}
void APIENTRY glutDetachMenu (int button)
{
}
/*
* Mesa 3-D graphics library
* Version: 3.4
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#include <string.h>
#include "GL/glut.h"
int APIENTRY glutExtensionSupported (const char *extension)
{
static const GLubyte *extensions = NULL;
const GLubyte *last, *where;
/* Extension names should not have spaces. */
if (strchr(extension, ' ') || *extension == '\0') {
return GL_FALSE;
}
/* Not my problem if you don't have a valid OpenGL context */
if (!extensions) {
extensions = glGetString(GL_EXTENSIONS);
}
/* Take care of sub-strings etc. */
for (last = extensions;;) {
if ((where = (GLubyte *)strstr((const char *)last, extension)) == NULL) {
return GL_FALSE;
}
last = where + strlen(extension);
if (where == extensions || *(where - 1) == ' ') {
if (*last == ' ' || *last == '\0') {
return GL_TRUE;
}
}
}
}

View File

@@ -1,61 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 3.4
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#include "GL/glut.h"
#include "internal.h"
GLenum g_display_mode = 0;
GLuint g_width = DEFAULT_WIDTH;
GLuint g_height = DEFAULT_HEIGHT;
GLint g_mouse = GL_FALSE;
GLboolean g_redisplay = GL_FALSE;
GLint g_xpos = 0;
GLint g_ypos = 0;
void (GLUTCALLBACK *display_func) (void) = NULL;
void (GLUTCALLBACK *reshape_func) (int width, int height) = NULL;
void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y) = NULL;
void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = NULL;
void (GLUTCALLBACK *motion_func) (int x, int y) = NULL;
void (GLUTCALLBACK *passive_motion_func) (int x, int y) = NULL;
void (GLUTCALLBACK *entry_func) (int state) = NULL;
void (GLUTCALLBACK *visibility_func) (int state) = NULL;
void (GLUTCALLBACK *idle_func) (void) = NULL;
void (GLUTCALLBACK *menu_state_func) (int state) = NULL;
void (GLUTCALLBACK *special_func) (int key, int x, int y) = NULL;
void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z) = NULL;
void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z) = NULL;
void (GLUTCALLBACK *spaceball_button_func) (int button, int state) = NULL;
void (GLUTCALLBACK *button_box_func) (int button, int state) = NULL;
void (GLUTCALLBACK *dials_func) (int dial, int value) = NULL;
void (GLUTCALLBACK *tablet_motion_func) (int x, int y) = NULL;
void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = NULL;
void (GLUTCALLBACK *menu_status_func) (int status, int x, int y) = NULL;
void (GLUTCALLBACK *overlay_display_func) (void) = NULL;
void (GLUTCALLBACK *window_status_func) (int state) = NULL;

150
src/glut/dos/glutint.h Normal file
View File

@@ -0,0 +1,150 @@
/*
* Mesa 3-D graphics library
* Version: 4.0
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#ifndef __glutint_h__
#define __glutint_h__
#include <GL/glut.h>
#include "GL/dmesa.h"
/* GLUT function types */
typedef void (GLUTCALLBACK *GLUTdisplayCB) (void);
typedef void (GLUTCALLBACK *GLUTreshapeCB) (int, int);
typedef void (GLUTCALLBACK *GLUTkeyboardCB) (unsigned char, int, int);
typedef void (GLUTCALLBACK *GLUTmouseCB) (int, int, int, int);
typedef void (GLUTCALLBACK *GLUTmotionCB) (int, int);
typedef void (GLUTCALLBACK *GLUTpassiveCB) (int, int);
typedef void (GLUTCALLBACK *GLUTentryCB) (int);
typedef void (GLUTCALLBACK *GLUTvisibilityCB) (int);
typedef void (GLUTCALLBACK *GLUTwindowStatusCB) (int);
typedef void (GLUTCALLBACK *GLUTidleCB) (void);
typedef void (GLUTCALLBACK *GLUTtimerCB) (int);
typedef void (GLUTCALLBACK *GLUTmenuStateCB) (int); /* DEPRECATED. */
typedef void (GLUTCALLBACK *GLUTmenuStatusCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTselectCB) (int);
typedef void (GLUTCALLBACK *GLUTspecialCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTspaceMotionCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTspaceRotateCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTspaceButtonCB) (int, int);
typedef void (GLUTCALLBACK *GLUTdialsCB) (int, int);
typedef void (GLUTCALLBACK *GLUTbuttonBoxCB) (int, int);
typedef void (GLUTCALLBACK *GLUTtabletMotionCB) (int, int);
typedef void (GLUTCALLBACK *GLUTtabletButtonCB) (int, int, int, int);
typedef void (GLUTCALLBACK *GLUTjoystickCB) (unsigned int, int, int, int);
typedef struct GLUTwindow {
int num; /* window id */
DMesaBuffer buffer;
int show_mouse;
/* GLUT settable or visible window state. */
int xpos;
int ypos;
int width; /* window width in pixels */
int height; /* window height in pixels */
/* Per-window callbacks. */
GLUTdisplayCB display; /* redraw */
GLUTreshapeCB reshape; /* resize (width,height) */
GLUTmouseCB mouse; /* mouse (button,state,x,y) */
GLUTmotionCB motion; /* motion (x,y) */
GLUTpassiveCB passive; /* passive motion (x,y) */
GLUTentryCB entry; /* window entry/exit (state) */
GLUTkeyboardCB keyboard; /* keyboard (ASCII,x,y) */
GLUTkeyboardCB keyboardUp; /* keyboard up (ASCII,x,y) */
GLUTwindowStatusCB windowStatus; /* window status */
GLUTvisibilityCB visibility; /* visibility */
GLUTspecialCB special; /* special key */
GLUTspecialCB specialUp; /* special up key */
GLUTbuttonBoxCB buttonBox; /* button box */
GLUTdialsCB dials; /* dials */
GLUTspaceMotionCB spaceMotion; /* Spaceball motion */
GLUTspaceRotateCB spaceRotate; /* Spaceball rotate */
GLUTspaceButtonCB spaceButton; /* Spaceball button */
GLUTtabletMotionCB tabletMotion; /* tablet motion */
GLUTtabletButtonCB tabletButton; /* tablet button */
GLUTjoystickCB joystick; /* joystick */
} GLUTwindow;
extern GLUTidleCB g_idle_func;
extern GLUTmenuStatusCB g_menu_status_func;
extern GLboolean g_redisplay;
extern GLuint g_bpp; /* HW: bits per pixel */
extern GLuint g_refresh; /* HW: vertical refresh rate */
extern GLuint g_screen_w, g_screen_h; /* HW: physical screen size */
extern GLint g_driver_caps;
extern GLuint g_fps;
extern GLuint g_display_mode; /* display bits */
extern int g_init_x, g_init_y; /* initial window position */
extern GLuint g_init_w, g_init_h; /* initial window size */
extern int g_mouse; /* non-zero if mouse installed */
extern int g_mouse_x, g_mouse_y; /* mouse coords, relative to current win */
extern GLUTwindow *g_curwin; /* current window */
extern char *__glutProgramName; /* program name */
extern void __glutInitMouse (void);
/* private routines from glut_util.c */
extern char * __glutStrdup(const char *string);
extern void __glutWarning(char *format,...);
extern void __glutFatalError(char *format,...);
extern void __glutFatalUsage(char *format,...);
/* hmmm... */
#include "pc_hw/pc_hw.h"
#define MAX_WINDOWS 2
#define DEFAULT_WIDTH 300
#define DEFAULT_HEIGHT 300
#define DEFAULT_BPP 16
#define DEPTH_SIZE 16
#define STENCIL_SIZE 8
#define ACCUM_SIZE 16
#define RESERVED_COLORS 0
#endif /* __glutint_h__ */

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,39 +27,86 @@
*/
#include "GL/glut.h"
#include "internal.h"
#include <string.h>
#include "glutint.h"
void APIENTRY glutInit (int *argcp, char **argv)
GLboolean g_redisplay = GL_FALSE;
GLuint g_bpp = DEFAULT_BPP;
GLuint g_refresh = 0;
GLuint g_screen_w, g_screen_h;
GLint g_driver_caps;
GLuint g_fps = 0;
GLuint g_display_mode = 0;
int g_init_x = 0, g_init_y = 0;
GLuint g_init_w = DEFAULT_WIDTH, g_init_h = DEFAULT_HEIGHT;
char *__glutProgramName = NULL;
void APIENTRY glutInit (int *argc, char **argv)
{
char *str;
const char *env;
if ((env = getenv("DMESA_GLUT_BPP")) != NULL) {
g_bpp = atoi(env);
}
if ((env = getenv("DMESA_GLUT_REFRESH")) != NULL) {
g_refresh = atoi(env);
}
/* Determine program name. */
str = strrchr(argv[0], '/');
if (str == NULL) {
str = argv[0];
} else {
str++;
}
__glutProgramName = __glutStrdup(str);
/* check if GLUT_FPS env var is set */
if ((env = getenv("GLUT_FPS")) != NULL) {
if ((g_fps = atoi(env)) <= 0) {
g_fps = 5000; /* 5000 milliseconds */
}
}
/* Initialize timer */
glutGet(GLUT_ELAPSED_TIME);
}
void APIENTRY glutInitDisplayMode (unsigned int mode)
{
g_display_mode = mode;
pc_install_keyb();
g_mouse = pc_install_mouse();
}
void APIENTRY glutInitWindowPosition (int x, int y)
{
g_xpos = x;
g_ypos = y;
g_init_x = x;
g_init_y = y;
}
void APIENTRY glutInitWindowSize (int width, int height)
{
g_width = width;
g_height = height;
g_init_w = width;
g_init_h = height;
}
void APIENTRY glutMainLoop (void)
{
GLboolean idle;
@@ -67,94 +114,141 @@ void APIENTRY glutMainLoop (void)
static int old_mouse_y = 0;
static int old_mouse_b = 0;
{
GLint screen_size[2];
DMesaGetIntegerv(DMESA_GET_SCREEN_SIZE, screen_size);
g_screen_w = screen_size[0];
g_screen_h = screen_size[1];
DMesaGetIntegerv(DMESA_GET_DRIVER_CAPS, &g_driver_caps);
}
pc_install_keyb();
__glutInitMouse();
glutPostRedisplay();
if (reshape_func) reshape_func(g_width, g_height);
if (visibility_func) visibility_func(GLUT_VISIBLE);
if (g_mouse) pc_show_mouse();
if (g_curwin->reshape) {
g_curwin->reshape(g_curwin->width, g_curwin->height);
}
if (g_curwin->visibility) {
g_curwin->visibility(GLUT_VISIBLE);
}
while (GL_TRUE) {
idle = GL_TRUE;
if (g_redisplay && display_func) {
if (g_redisplay && g_curwin->display) {
idle = GL_FALSE;
g_redisplay = GL_FALSE;
if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_scare_mouse();
display_func();
if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_unscare_mouse();
}
if (pc_keypressed()) {
int key;
idle = GL_FALSE;
key = pc_readkey();
switch (key>>16) {
case KEY_F1: if (special_func) special_func(GLUT_KEY_F1, 0, 0); break;
case KEY_F2: if (special_func) special_func(GLUT_KEY_F2, 0, 0); break;
case KEY_F3: if (special_func) special_func(GLUT_KEY_F3, 0, 0); break;
case KEY_F4: if (special_func) special_func(GLUT_KEY_F4, 0, 0); break;
case KEY_F5: if (special_func) special_func(GLUT_KEY_F5, 0, 0); break;
case KEY_F6: if (special_func) special_func(GLUT_KEY_F6, 0, 0); break;
case KEY_F7: if (special_func) special_func(GLUT_KEY_F7, 0, 0); break;
case KEY_F8: if (special_func) special_func(GLUT_KEY_F8, 0, 0); break;
case KEY_F9: if (special_func) special_func(GLUT_KEY_F9, 0, 0); break;
case KEY_F10: if (special_func) special_func(GLUT_KEY_F10, 0, 0); break;
case KEY_F11: if (special_func) special_func(GLUT_KEY_F11, 0, 0); break;
case KEY_F12: if (special_func) special_func(GLUT_KEY_F12, 0, 0); break;
case KEY_LEFT: if (special_func) special_func(GLUT_KEY_LEFT, 0, 0); break;
case KEY_UP: if (special_func) special_func(GLUT_KEY_UP, 0, 0); break;
case KEY_RIGHT: if (special_func) special_func(GLUT_KEY_RIGHT, 0, 0); break;
case KEY_DOWN: if (special_func) special_func(GLUT_KEY_DOWN, 0, 0); break;
case KEY_PGUP: if (special_func) special_func(GLUT_KEY_PAGE_UP, 0, 0); break;
case KEY_PGDN: if (special_func) special_func(GLUT_KEY_PAGE_DOWN, 0, 0); break;
case KEY_HOME: if (special_func) special_func(GLUT_KEY_HOME, 0, 0); break;
case KEY_END: if (special_func) special_func(GLUT_KEY_END, 0, 0); break;
case KEY_INSERT: if (special_func) special_func(GLUT_KEY_INSERT, 0, 0); break;
default: if (keyboard_func) keyboard_func(key & 0xFF, 0, 0);
if (g_curwin->show_mouse && !(g_display_mode & GLUT_DOUBLE)) {
/* XXX scare mouse */
g_curwin->display();
/* XXX unscare mouse */
} else {
g_curwin->display();
}
}
if (g_mouse) {
int mouse_x;
int mouse_y;
int mouse_z;
int mouse_b;
mouse_b = pc_query_mouse(&mouse_x, &mouse_y);
if (motion_func && ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y))) {
/* query mouse */
mouse_b = pc_query_mouse(&mouse_x, &mouse_y, &mouse_z);
/* relative to window coordinates */
g_mouse_x = mouse_x - g_curwin->xpos;
g_mouse_y = mouse_y - g_curwin->ypos;
/* mouse was moved? */
if ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y)) {
idle = GL_FALSE;
old_mouse_x = mouse_x;
old_mouse_y = mouse_y;
motion_func(old_mouse_x, old_mouse_y);
if (mouse_b) {
/* any button pressed */
if (g_curwin->motion) {
g_curwin->motion(g_mouse_x, g_mouse_y);
}
} else {
/* no button pressed */
if (g_curwin->passive) {
g_curwin->passive(g_mouse_x, g_mouse_y);
}
}
}
if (mouse_func && (mouse_b != old_mouse_b)) {
int new_mouse_b = mouse_b;
if ((old_mouse_b & 1) && !(new_mouse_b & 1))
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, mouse_x, mouse_y);
else if (!(old_mouse_b & 1) && (new_mouse_b & 1))
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
if ((old_mouse_b & 2) && !(new_mouse_b & 2))
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, mouse_x, mouse_y);
else if (!(old_mouse_b & 2) && (new_mouse_b & 2))
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
if ((old_mouse_b & 4) && !(new_mouse_b & 4))
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, mouse_x, mouse_y);
else if (!(old_mouse_b & 3) && (new_mouse_b & 4))
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
/* button state changed? */
if (mouse_b != old_mouse_b) {
GLUTmouseCB mouse_func;
if ((mouse_func = g_curwin->mouse)) {
if ((old_mouse_b & 1) && !(mouse_b & 1))
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
else if (!(old_mouse_b & 1) && (mouse_b & 1))
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
if ((old_mouse_b & 2) && !(mouse_b & 2))
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
else if (!(old_mouse_b & 2) && (mouse_b & 2))
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
if ((old_mouse_b & 4) && !(mouse_b & 4))
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
else if (!(old_mouse_b & 3) && (mouse_b & 4))
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
}
idle = GL_FALSE;
old_mouse_b = new_mouse_b;
old_mouse_b = mouse_b;
}
}
if (idle && idle_func)
idle_func();
if (pc_keypressed()) {
int key;
int glut_key;
idle = GL_FALSE;
key = pc_readkey();
switch (key>>16) {
case KEY_F1: glut_key = GLUT_KEY_F1; goto special;
case KEY_F2: glut_key = GLUT_KEY_F2; goto special;
case KEY_F3: glut_key = GLUT_KEY_F3; goto special;
case KEY_F4: glut_key = GLUT_KEY_F4; goto special;
case KEY_F5: glut_key = GLUT_KEY_F5; goto special;
case KEY_F6: glut_key = GLUT_KEY_F6; goto special;
case KEY_F7: glut_key = GLUT_KEY_F7; goto special;
case KEY_F8: glut_key = GLUT_KEY_F8; goto special;
case KEY_F9: glut_key = GLUT_KEY_F9; goto special;
case KEY_F10: glut_key = GLUT_KEY_F10; goto special;
case KEY_F11: glut_key = GLUT_KEY_F11; goto special;
case KEY_F12: glut_key = GLUT_KEY_F12; goto special;
case KEY_LEFT: glut_key = GLUT_KEY_LEFT; goto special;
case KEY_UP: glut_key = GLUT_KEY_UP; goto special;
case KEY_RIGHT: glut_key = GLUT_KEY_RIGHT; goto special;
case KEY_DOWN: glut_key = GLUT_KEY_DOWN; goto special;
case KEY_PGUP: glut_key = GLUT_KEY_PAGE_UP; goto special;
case KEY_PGDN: glut_key = GLUT_KEY_PAGE_DOWN; goto special;
case KEY_HOME: glut_key = GLUT_KEY_HOME; goto special;
case KEY_END: glut_key = GLUT_KEY_END; goto special;
case KEY_INSERT: glut_key = GLUT_KEY_INSERT; goto special;
special:
if (g_curwin->special) {
g_curwin->special(glut_key, g_mouse_x, g_mouse_y);
}
break;
default:
if (g_curwin->keyboard) {
g_curwin->keyboard(key & 0xFF, g_mouse_x, g_mouse_y);
}
}
}
if (idle && g_idle_func)
g_idle_func();
}
}

View File

@@ -1,78 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 4.0
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#ifndef INTERNAL_H_included
#define INTERNAL_H_included
#include "GL/glut.h"
#include "pc_hw/pc_hw.h"
#define MAX_WINDOWS 4
#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 480
#define DEFAULT_BPP 16
#define DEPTH_SIZE 16
#define STENCIL_SIZE 8
#define ACCUM_SIZE 16
extern GLenum g_display_mode;
extern GLuint g_width;
extern GLuint g_height;
extern GLint g_mouse;
extern GLboolean g_redisplay;
extern GLint g_xpos;
extern GLint g_ypos;
extern void (GLUTCALLBACK *display_func) (void);
extern void (GLUTCALLBACK *reshape_func) (int width, int height);
extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y);
extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y);
extern void (GLUTCALLBACK *motion_func) (int x, int y);
extern void (GLUTCALLBACK *passive_motion_func) (int x, int y);
extern void (GLUTCALLBACK *entry_func) (int state);
extern void (GLUTCALLBACK *visibility_func) (int state);
extern void (GLUTCALLBACK *idle_func) (void);
extern void (GLUTCALLBACK *menu_state_func) (int state);
extern void (GLUTCALLBACK *special_func) (int key, int x, int y);
extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z);
extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z);
extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state);
extern void (GLUTCALLBACK *button_box_func) (int button, int state);
extern void (GLUTCALLBACK *dials_func) (int dial, int value);
extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y);
extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y);
extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y);
extern void (GLUTCALLBACK *overlay_display_func) (void);
extern void (GLUTCALLBACK *window_status_func) (int state);
#endif

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,60 +27,90 @@
*/
#include "GL/glut.h"
#include "glutint.h"
int APIENTRY glutCreateMenu (void (GLUTCALLBACK *func) (int))
GLUTmenuStatusCB g_menu_status_func = NULL;
void APIENTRY glutMenuStateFunc (GLUTmenuStateCB func)
{
g_menu_status_func = (GLUTmenuStatusCB)func;
}
void APIENTRY glutMenuStatusFunc (GLUTmenuStatusCB func)
{
g_menu_status_func = func;
}
int APIENTRY glutCreateMenu (GLUTselectCB func)
{
return 0;
}
void APIENTRY glutDestroyMenu (int menu)
{
}
int APIENTRY glutGetMenu (void)
{
return 0;
}
void APIENTRY glutSetMenu (int menu)
{
}
void APIENTRY glutAddMenuEntry (const char *label, int value)
{
}
void APIENTRY glutAddSubMenu (const char *label, int submenu)
{
}
void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value)
{
}
void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu)
{
}
void APIENTRY glutRemoveMenuItem (int item)
{
}
void APIENTRY glutAttachMenu (int button)
{
}
void APIENTRY glutDetachMenu (int button)
{
}

View File

@@ -1,598 +0,0 @@
/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
/**
(c) Copyright 1993, Silicon Graphics, Inc.
ALL RIGHTS RESERVED
Permission to use, copy, modify, and distribute this software
for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that
both the copyright notice and this permission notice appear in
supporting documentation, and that the name of Silicon
Graphics, Inc. not be used in advertising or publicity
pertaining to distribution of the software without specific,
written prior permission.
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
PERFORMANCE OF THIS SOFTWARE.
US Government Users Restricted Rights
Use, duplication, or disclosure by the Government is subject to
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
(c)(1)(ii) of the Rights in Technical Data and Computer
Software clause at DFARS 252.227-7013 and/or in similar or
successor clauses in the FAR or the DOD or NASA FAR
Supplement. Unpublished-- rights reserved under the copyright
laws of the United States. Contractor/manufacturer is Silicon
Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
94039-7311.
OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
#include <math.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "GL/glut.h"
/* Some <math.h> files do not define M_PI... */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
static GLUquadricObj *quadObj;
#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); }
static void
initQuadObj(void)
{
quadObj = gluNewQuadric();
/* if (!quadObj)
__glutFatalError("out of memory."); */
}
/* CENTRY */
void APIENTRY
glutWireSphere(GLdouble radius, GLint slices, GLint stacks)
{
QUAD_OBJ_INIT();
gluQuadricDrawStyle(quadObj, GLU_LINE);
gluQuadricNormals(quadObj, GLU_SMOOTH);
/* If we ever changed/used the texture or orientation state
of quadObj, we'd need to change it to the defaults here
with gluQuadricTexture and/or gluQuadricOrientation. */
gluSphere(quadObj, radius, slices, stacks);
}
void APIENTRY
glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)
{
QUAD_OBJ_INIT();
gluQuadricDrawStyle(quadObj, GLU_FILL);
gluQuadricNormals(quadObj, GLU_SMOOTH);
/* If we ever changed/used the texture or orientation state
of quadObj, we'd need to change it to the defaults here
with gluQuadricTexture and/or gluQuadricOrientation. */
gluSphere(quadObj, radius, slices, stacks);
}
void APIENTRY
glutWireCone(GLdouble base, GLdouble height,
GLint slices, GLint stacks)
{
QUAD_OBJ_INIT();
gluQuadricDrawStyle(quadObj, GLU_LINE);
gluQuadricNormals(quadObj, GLU_SMOOTH);
/* If we ever changed/used the texture or orientation state
of quadObj, we'd need to change it to the defaults here
with gluQuadricTexture and/or gluQuadricOrientation. */
gluCylinder(quadObj, base, 0.0, height, slices, stacks);
}
void APIENTRY
glutSolidCone(GLdouble base, GLdouble height,
GLint slices, GLint stacks)
{
QUAD_OBJ_INIT();
gluQuadricDrawStyle(quadObj, GLU_FILL);
gluQuadricNormals(quadObj, GLU_SMOOTH);
/* If we ever changed/used the texture or orientation state
of quadObj, we'd need to change it to the defaults here
with gluQuadricTexture and/or gluQuadricOrientation. */
gluCylinder(quadObj, base, 0.0, height, slices, stacks);
}
/* ENDCENTRY */
static void
drawBox(GLfloat size, GLenum type)
{
static GLfloat n[6][3] =
{
{-1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{1.0, 0.0, 0.0},
{0.0, -1.0, 0.0},
{0.0, 0.0, 1.0},
{0.0, 0.0, -1.0}
};
static GLint faces[6][4] =
{
{0, 1, 2, 3},
{3, 2, 6, 7},
{7, 6, 5, 4},
{4, 5, 1, 0},
{5, 6, 2, 1},
{7, 4, 0, 3}
};
GLfloat v[8][3];
GLint i;
v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2;
v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2;
v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2;
v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2;
v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2;
v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2;
for (i = 5; i >= 0; i--) {
glBegin(type);
glNormal3fv(&n[i][0]);
glVertex3fv(&v[faces[i][0]][0]);
glVertex3fv(&v[faces[i][1]][0]);
glVertex3fv(&v[faces[i][2]][0]);
glVertex3fv(&v[faces[i][3]][0]);
glEnd();
}
}
/* CENTRY */
void APIENTRY
glutWireCube(GLdouble size)
{
drawBox(size, GL_LINE_LOOP);
}
void APIENTRY
glutSolidCube(GLdouble size)
{
drawBox(size, GL_QUADS);
}
/* ENDCENTRY */
static void
doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings)
{
int i, j;
GLfloat theta, phi, theta1;
GLfloat cosTheta, sinTheta;
GLfloat cosTheta1, sinTheta1;
GLfloat ringDelta, sideDelta;
ringDelta = 2.0 * M_PI / rings;
sideDelta = 2.0 * M_PI / nsides;
theta = 0.0;
cosTheta = 1.0;
sinTheta = 0.0;
for (i = rings - 1; i >= 0; i--) {
theta1 = theta + ringDelta;
cosTheta1 = cos(theta1);
sinTheta1 = sin(theta1);
glBegin(GL_QUAD_STRIP);
phi = 0.0;
for (j = nsides; j >= 0; j--) {
GLfloat cosPhi, sinPhi, dist;
phi += sideDelta;
cosPhi = cos(phi);
sinPhi = sin(phi);
dist = R + r * cosPhi;
glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
}
glEnd();
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
}
/* CENTRY */
void APIENTRY
glutWireTorus(GLdouble innerRadius, GLdouble outerRadius,
GLint nsides, GLint rings)
{
glPushAttrib(GL_POLYGON_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
doughnut(innerRadius, outerRadius, nsides, rings);
glPopAttrib();
}
void APIENTRY
glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius,
GLint nsides, GLint rings)
{
doughnut(innerRadius, outerRadius, nsides, rings);
}
/* ENDCENTRY */
static GLfloat dodec[20][3];
static void
initDodecahedron(void)
{
GLfloat alpha, beta;
alpha = sqrt(2.0 / (3.0 + sqrt(5.0)));
beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) -
2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0))));
/* *INDENT-OFF* */
dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta;
dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta;
dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1;
dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1;
dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1;
dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1;
dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1;
dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1;
dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1;
dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1;
dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0;
dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0;
dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0;
dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0;
dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta;
dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta;
dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha;
dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha;
dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha;
dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha;
/* *INDENT-ON* */
}
#define DIFF3(_a,_b,_c) { \
(_c)[0] = (_a)[0] - (_b)[0]; \
(_c)[1] = (_a)[1] - (_b)[1]; \
(_c)[2] = (_a)[2] - (_b)[2]; \
}
static void
crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3])
{
GLfloat p[3]; /* in case prod == v1 or v2 */
p[0] = v1[1] * v2[2] - v2[1] * v1[2];
p[1] = v1[2] * v2[0] - v2[2] * v1[0];
p[2] = v1[0] * v2[1] - v2[0] * v1[1];
prod[0] = p[0];
prod[1] = p[1];
prod[2] = p[2];
}
static void
normalize(GLfloat v[3])
{
GLfloat d;
d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
if (d == 0.0) {
// __glutWarning("normalize: zero length vector");
v[0] = d = 1.0;
}
d = 1 / d;
v[0] *= d;
v[1] *= d;
v[2] *= d;
}
static void
pentagon(int a, int b, int c, int d, int e, GLenum shadeType)
{
GLfloat n0[3], d1[3], d2[3];
DIFF3(dodec[a], dodec[b], d1);
DIFF3(dodec[b], dodec[c], d2);
crossprod(d1, d2, n0);
normalize(n0);
glBegin(shadeType);
glNormal3fv(n0);
glVertex3fv(&dodec[a][0]);
glVertex3fv(&dodec[b][0]);
glVertex3fv(&dodec[c][0]);
glVertex3fv(&dodec[d][0]);
glVertex3fv(&dodec[e][0]);
glEnd();
}
static void
dodecahedron(GLenum type)
{
static int inited = 0;
if (inited == 0) {
inited = 1;
initDodecahedron();
}
pentagon(0, 1, 9, 16, 5, type);
pentagon(1, 0, 3, 18, 7, type);
pentagon(1, 7, 11, 10, 9, type);
pentagon(11, 7, 18, 19, 6, type);
pentagon(8, 17, 16, 9, 10, type);
pentagon(2, 14, 15, 6, 19, type);
pentagon(2, 13, 12, 4, 14, type);
pentagon(2, 19, 18, 3, 13, type);
pentagon(3, 0, 5, 12, 13, type);
pentagon(6, 15, 8, 10, 11, type);
pentagon(4, 17, 8, 15, 14, type);
pentagon(4, 12, 5, 16, 17, type);
}
/* CENTRY */
void APIENTRY
glutWireDodecahedron(void)
{
dodecahedron(GL_LINE_LOOP);
}
void APIENTRY
glutSolidDodecahedron(void)
{
dodecahedron(GL_TRIANGLE_FAN);
}
/* ENDCENTRY */
static void
recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3,
GLenum shadeType)
{
GLfloat q0[3], q1[3];
DIFF3(n1, n2, q0);
DIFF3(n2, n3, q1);
crossprod(q0, q1, q1);
normalize(q1);
glBegin(shadeType);
glNormal3fv(q1);
glVertex3fv(n1);
glVertex3fv(n2);
glVertex3fv(n3);
glEnd();
}
static void
subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2,
GLenum shadeType)
{
int depth;
GLfloat w0[3], w1[3], w2[3];
GLfloat l;
int i, j, k, n;
depth = 1;
for (i = 0; i < depth; i++) {
for (j = 0; i + j < depth; j++) {
k = depth - i - j;
for (n = 0; n < 3; n++) {
w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth;
w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n])
/ depth;
w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n])
/ depth;
}
l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]);
w0[0] /= l;
w0[1] /= l;
w0[2] /= l;
l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]);
w1[0] /= l;
w1[1] /= l;
w1[2] /= l;
l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]);
w2[0] /= l;
w2[1] /= l;
w2[2] /= l;
recorditem(w1, w0, w2, shadeType);
}
}
}
static void
drawtriangle(int i, GLfloat data[][3], int ndx[][3],
GLenum shadeType)
{
GLfloat *x0, *x1, *x2;
x0 = data[ndx[i][0]];
x1 = data[ndx[i][1]];
x2 = data[ndx[i][2]];
subdivide(x0, x1, x2, shadeType);
}
/* octahedron data: The octahedron produced is centered at the
origin and has radius 1.0 */
static GLfloat odata[6][3] =
{
{1.0, 0.0, 0.0},
{-1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, -1.0, 0.0},
{0.0, 0.0, 1.0},
{0.0, 0.0, -1.0}
};
static int ondex[8][3] =
{
{0, 4, 2},
{1, 2, 4},
{0, 3, 4},
{1, 4, 3},
{0, 2, 5},
{1, 5, 2},
{0, 5, 3},
{1, 3, 5}
};
static void
octahedron(GLenum shadeType)
{
int i;
for (i = 7; i >= 0; i--) {
drawtriangle(i, odata, ondex, shadeType);
}
}
/* CENTRY */
void APIENTRY
glutWireOctahedron(void)
{
octahedron(GL_LINE_LOOP);
}
void APIENTRY
glutSolidOctahedron(void)
{
octahedron(GL_TRIANGLES);
}
/* ENDCENTRY */
/* icosahedron data: These numbers are rigged to make an
icosahedron of radius 1.0 */
#define X .525731112119133606
#define Z .850650808352039932
static GLfloat idata[12][3] =
{
{-X, 0, Z},
{X, 0, Z},
{-X, 0, -Z},
{X, 0, -Z},
{0, Z, X},
{0, Z, -X},
{0, -Z, X},
{0, -Z, -X},
{Z, X, 0},
{-Z, X, 0},
{Z, -X, 0},
{-Z, -X, 0}
};
static int index[20][3] =
{
{0, 4, 1},
{0, 9, 4},
{9, 5, 4},
{4, 5, 8},
{4, 8, 1},
{8, 10, 1},
{8, 3, 10},
{5, 3, 8},
{5, 2, 3},
{2, 7, 3},
{7, 10, 3},
{7, 6, 10},
{7, 11, 6},
{11, 0, 6},
{0, 1, 6},
{6, 1, 10},
{9, 0, 11},
{9, 11, 2},
{9, 2, 5},
{7, 2, 11},
};
static void
icosahedron(GLenum shadeType)
{
int i;
for (i = 19; i >= 0; i--) {
drawtriangle(i, idata, index, shadeType);
}
}
/* CENTRY */
void APIENTRY
glutWireIcosahedron(void)
{
icosahedron(GL_LINE_LOOP);
}
void APIENTRY
glutSolidIcosahedron(void)
{
icosahedron(GL_TRIANGLES);
}
/* ENDCENTRY */
/* tetrahedron data: */
#define T 1.73205080756887729
static GLfloat tdata[4][3] =
{
{T, T, T},
{T, -T, -T},
{-T, T, -T},
{-T, -T, T}
};
static int tndex[4][3] =
{
{0, 1, 3},
{2, 1, 0},
{3, 2, 0},
{1, 2, 3}
};
static void
tetrahedron(GLenum shadeType)
{
int i;
for (i = 3; i >= 0; i--)
drawtriangle(i, tdata, tndex, shadeType);
}
/* CENTRY */
void APIENTRY
glutWireTetrahedron(void)
{
tetrahedron(GL_LINE_LOOP);
}
void APIENTRY
glutSolidTetrahedron(void)
{
tetrahedron(GL_TRIANGLES);
}
/* ENDCENTRY */

View File

@@ -1,60 +1,60 @@
/*
* Mesa 3-D graphics library
* Version: 3.4
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#include "GL/glut.h"
void APIENTRY glutEstablishOverlay (void)
{
}
void APIENTRY glutRemoveOverlay (void)
{
}
void APIENTRY glutUseLayer (GLenum layer)
{
}
void APIENTRY glutPostOverlayRedisplay (void)
{
}
void APIENTRY glutShowOverlay (void)
{
}
void APIENTRY glutHideOverlay (void)
{
}
/*
* Mesa 3-D graphics library
* Version: 3.4
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#include "glutint.h"
int g_mouse;
int g_mouse_x = 0, g_mouse_y = 0;
void __glutInitMouse (void)
{
if ((g_mouse = pc_install_mouse())) {
pc_mouse_area(g_curwin->xpos, g_curwin->ypos, g_curwin->xpos + g_curwin->width - 1, g_curwin->ypos + g_curwin->height - 1);
g_curwin->show_mouse = (g_curwin->mouse || g_curwin->motion || g_curwin->passive);
}
}
void APIENTRY glutSetCursor (int cursor)
{
/* XXX completely futile until full mouse support (maybe never) */
}
void APIENTRY glutWarpPointer (int x, int y)
{
pc_warp_mouse(x, y);
}

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,7 +27,33 @@
*/
#include "GL/glut.h"
#include "glutint.h"
int APIENTRY glutLayerGet (GLenum info)
{
switch (info) {
case GLUT_OVERLAY_POSSIBLE:
case GLUT_HAS_OVERLAY:
return GL_FALSE;
case GLUT_LAYER_IN_USE:
return GLUT_NORMAL;
case GLUT_NORMAL_DAMAGED:
return GL_FALSE;
case GLUT_OVERLAY_DAMAGED:
case GLUT_TRANSPARENT_INDEX:
default:
return -1;
}
}
void APIENTRY glutOverlayDisplayFunc (GLUTdisplayCB func)
{
}
void APIENTRY glutEstablishOverlay (void)
@@ -35,26 +61,31 @@ void APIENTRY glutEstablishOverlay (void)
}
void APIENTRY glutRemoveOverlay (void)
{
}
void APIENTRY glutUseLayer (GLenum layer)
{
}
void APIENTRY glutPostOverlayRedisplay (void)
{
}
void APIENTRY glutShowOverlay (void)
{
}
void APIENTRY glutHideOverlay (void)
{
}

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,16 +27,19 @@
*/
#include "GL/glut.h"
#include "internal.h"
#include "glutint.h"
#define FREQUENCY 100
static int timer_installed;
static volatile int ticks;
static void ticks_timer (void *p)
{
(void)p;
@@ -48,23 +51,92 @@ static void ticks_timer (void *p)
int APIENTRY glutGet (GLenum type)
{
switch (type) {
case GLUT_WINDOW_X:
return g_curwin->xpos;
case GLUT_WINDOW_Y:
return g_curwin->ypos;
case GLUT_WINDOW_WIDTH:
return g_curwin->width;
case GLUT_WINDOW_HEIGHT:
return g_curwin->height;
case GLUT_WINDOW_STENCIL_SIZE:
return STENCIL_SIZE;
case GLUT_WINDOW_DEPTH_SIZE:
return DEPTH_SIZE;
case GLUT_WINDOW_RGBA:
return 1;
return !(g_display_mode & GLUT_INDEX);
case GLUT_WINDOW_COLORMAP_SIZE:
return (g_display_mode & GLUT_INDEX) ? (256 - RESERVED_COLORS) : 0;
case GLUT_SCREEN_WIDTH:
return g_screen_w;
case GLUT_SCREEN_HEIGHT:
return g_screen_h;
case GLUT_INIT_WINDOW_X:
return g_init_x;
case GLUT_INIT_WINDOW_Y:
return g_init_y;
case GLUT_INIT_WINDOW_WIDTH:
return g_init_w;
case GLUT_INIT_WINDOW_HEIGHT:
return g_init_h;
case GLUT_INIT_DISPLAY_MODE:
return g_display_mode;
case GLUT_ELAPSED_TIME:
if (!timer_installed) {
timer_installed = !timer_installed;
timer_installed = GL_TRUE;
LOCKDATA(ticks);
LOCKFUNC(ticks_timer);
pc_install_int(ticks_timer, NULL, FREQUENCY);
}
return ticks*1000/FREQUENCY;
default:
return 0;
return -1;
}
}
int APIENTRY glutDeviceGet (GLenum type)
{
return 0;
switch (type) {
case GLUT_HAS_KEYBOARD:
return GL_TRUE;
case GLUT_HAS_MOUSE:
return (g_mouse != 0);
case GLUT_NUM_MOUSE_BUTTONS:
return g_mouse;
case GLUT_HAS_SPACEBALL:
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
case GLUT_HAS_TABLET:
return GL_FALSE;
case GLUT_NUM_SPACEBALL_BUTTONS:
case GLUT_NUM_BUTTON_BOX_BUTTONS:
case GLUT_NUM_DIALS:
case GLUT_NUM_TABLET_BUTTONS:
return 0;
default:
return -1;
}
}
int APIENTRY glutGetModifiers (void)
{
int mod = 0;
int shifts = pc_keyshifts();
if (shifts & (KB_SHIFT_FLAG | KB_CAPSLOCK_FLAG)) {
mod |= GLUT_ACTIVE_SHIFT;
}
if (shifts & KB_ALT_FLAG) {
mod |= GLUT_ACTIVE_ALT;
}
if (shifts & KB_CTRL_FLAG) {
mod |= GLUT_ACTIVE_CTRL;
}
return mod;
}

View File

@@ -1,212 +0,0 @@
/* Copyright (c) Mark J. Kilgard, 1994. */
/**
(c) Copyright 1993, Silicon Graphics, Inc.
ALL RIGHTS RESERVED
Permission to use, copy, modify, and distribute this software
for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that
both the copyright notice and this permission notice appear in
supporting documentation, and that the name of Silicon
Graphics, Inc. not be used in advertising or publicity
pertaining to distribution of the software without specific,
written prior permission.
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
PERFORMANCE OF THIS SOFTWARE.
US Government Users Restricted Rights
Use, duplication, or disclosure by the Government is subject to
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
(c)(1)(ii) of the Rights in Technical Data and Computer
Software clause at DFARS 252.227-7013 and/or in similar or
successor clauses in the FAR or the DOD or NASA FAR
Supplement. Unpublished-- rights reserved under the copyright
laws of the United States. Contractor/manufacturer is Silicon
Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
94039-7311.
OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
#include <GL/gl.h>
#include <GL/glu.h>
#include "GL/glut.h"
/* Rim, body, lid, and bottom data must be reflected in x and
y; handle and spout data across the y axis only. */
static int patchdata[][16] =
{
/* rim */
{102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15},
/* body */
{12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27},
{24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40},
/* lid */
{96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101,
101, 0, 1, 2, 3,},
{0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112,
113, 114, 115, 116, 117},
/* bottom */
{118, 118, 118, 118, 124, 122, 119, 121, 123, 126,
125, 120, 40, 39, 38, 37},
/* handle */
{41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56},
{53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
28, 65, 66, 67},
/* spout */
{68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83},
{80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95}
};
/* *INDENT-OFF* */
static float cpdata[][3] =
{
{0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0,
-0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125},
{0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375,
0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375,
2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84,
2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875},
{1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75,
1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35},
{0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2,
0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12,
0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225},
{1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225},
{1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0,
-1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5,
-0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3,
2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0,
2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0,
2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8},
{-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3,
-0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3,
1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2,
-0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0,
1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0,
0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66,
0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1},
{2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7,
-0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0,
2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375},
{3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475},
{3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4},
{2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0,
3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8,
3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4,
-0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0,
2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4,
2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3,
2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4},
{0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425,
-0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425,
0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075},
{0.84, -1.5, 0.075}
};
static float tex[2][2][2] =
{
{ {0, 0},
{1, 0}},
{ {0, 1},
{1, 1}}
};
/* *INDENT-ON* */
static void
teapot(GLint grid, GLdouble scale, GLenum type)
{
float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
long i, j, k, l;
glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_MAP2_TEXTURE_COORD_2);
glPushMatrix();
glRotatef(270.0, 1.0, 0.0, 0.0);
glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale);
glTranslatef(0.0, 0.0, -1.5);
for (i = 0; i < 10; i++) {
for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) {
for (l = 0; l < 3; l++) {
p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
if (l == 1)
q[j][k][l] *= -1.0;
if (i < 6) {
r[j][k][l] =
cpdata[patchdata[i][j * 4 + (3 - k)]][l];
if (l == 0)
r[j][k][l] *= -1.0;
s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
if (l == 0)
s[j][k][l] *= -1.0;
if (l == 1)
s[j][k][l] *= -1.0;
}
}
}
}
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
&tex[0][0][0]);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
&p[0][0][0]);
glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0);
glEvalMesh2(type, 0, grid, 0, grid);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
&q[0][0][0]);
glEvalMesh2(type, 0, grid, 0, grid);
if (i < 6) {
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
&r[0][0][0]);
glEvalMesh2(type, 0, grid, 0, grid);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
&s[0][0][0]);
glEvalMesh2(type, 0, grid, 0, grid);
}
}
glPopMatrix();
glPopAttrib();
}
/* CENTRY */
void APIENTRY
glutSolidTeapot(GLdouble scale)
{
teapot(7, scale, GL_FILL);
}
void APIENTRY
glutWireTeapot(GLdouble scale)
{
teapot(10, scale, GL_LINE);
}
/* ENDCENTRY */

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.2 for Mesa 4.1
* DOS/DJGPP glut driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -27,27 +27,19 @@
*/
#include "GL/glut.h"
#ifndef FX
#include <stdio.h>
#include "glutint.h"
#include "GL/dmesa.h"
#else
#include "GL/fxmesa.h"
#endif
#include "internal.h"
static int window;
GLUTwindow *g_curwin;
static GLuint swaptime, swapcount;
#ifndef FX
static DMesaVisual visual = NULL;
static DMesaContext context = NULL;
static DMesaBuffer buffer[MAX_WINDOWS];
#else
static void *visual = NULL;
static fxMesaContext context = NULL;
static int fx_attrib[32];
#endif
static GLUTwindow *windows[MAX_WINDOWS];
@@ -55,15 +47,11 @@ static void clean (void)
{
int i;
for (i=0; i<MAX_WINDOWS; i++) {
glutDestroyWindow(i+1);
for (i=1; i<=MAX_WINDOWS; i++) {
glutDestroyWindow(i);
}
#ifndef FX
if (context) DMesaDestroyContext(context);
if (visual) DMesaDestroyVisual(visual);
#else
if (context) fxMesaDestroyContext(context);
#endif
pc_close_stdout();
pc_close_stderr();
@@ -74,187 +62,199 @@ static void clean (void)
int APIENTRY glutCreateWindow (const char *title)
{
int i;
int m8width = (g_init_w + 7) & ~7;
if (!visual) {
int screen_w = DEFAULT_WIDTH;
int screen_h = DEFAULT_HEIGHT;
if ((g_width<=640) && (g_height<=480)) {
screen_w = 640;
screen_h = 480;
} else if ((g_width<=800) && (g_height<=600)) {
screen_w = 800;
screen_h = 600;
} else if ((g_width<=1024) && (g_height<=768)) {
screen_w = 1024;
screen_h = 768;
}
#ifndef FX
if ((visual=DMesaCreateVisual(screen_w, screen_h, DEFAULT_BPP,
if ((visual=DMesaCreateVisual(g_init_x + m8width, g_init_y + g_init_h, g_bpp, g_refresh,
g_display_mode & GLUT_DOUBLE,
!(g_display_mode & GLUT_INDEX),
g_display_mode & GLUT_ALPHA,
g_display_mode & GLUT_DEPTH ?DEPTH_SIZE :0,
g_display_mode & GLUT_STENCIL?STENCIL_SIZE:0,
g_display_mode & GLUT_ACCUM ?ACCUM_SIZE :0))==NULL) {
return 0;
}
if ((context=DMesaCreateContext(visual, NULL))==NULL) {
DMesaDestroyVisual(visual);
return 0;
}
#else
i = 0;
if (g_display_mode & GLUT_DOUBLE) fx_attrib[i++] = FXMESA_DOUBLEBUFFER;
if (g_display_mode & GLUT_DEPTH) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = DEPTH_SIZE; }
if (g_display_mode & GLUT_STENCIL) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = STENCIL_SIZE; }
if (g_display_mode & GLUT_ACCUM) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = ACCUM_SIZE; }
fx_attrib[i] = FXMESA_NONE;
if ((context=fxMesaCreateBestContext(-1, screen_w, screen_h, fx_attrib))==NULL) {
return 0;
}
visual = context;
#endif
pc_open_stdout();
pc_open_stderr();
pc_atexit(clean);
}
#ifndef FX
for (i=0; i<MAX_WINDOWS; i++) {
if (!buffer[i]) {
if (windows[i] == NULL) {
DMesaBuffer b;
if ((b=DMesaCreateBuffer(visual, g_xpos, g_ypos, g_width, g_height))==NULL) {
GLUTwindow *w;
if ((w=(GLUTwindow *)calloc(1, sizeof(GLUTwindow))) == NULL) {
return 0;
}
if ((b=DMesaCreateBuffer(visual, g_init_x, g_init_y, m8width, g_init_h))==NULL) {
free(w);
return 0;
}
if (!DMesaMakeCurrent(context, b)) {
DMesaDestroyBuffer(b);
free(w);
return 0;
}
if (g_mouse) {
pc_mouse_area(g_xpos, g_ypos, g_xpos + g_width - 1, g_ypos + g_height - 1);
}
buffer[window = i] = b;
return i+1;
g_curwin = windows[i] = w;
w->num = ++i;
w->xpos = g_init_x;
w->ypos = g_init_y;
w->width = m8width;
w->height = g_init_h;
w->buffer = b;
return i;
}
}
return 0;
#else
fxMesaMakeCurrent(context);
return 1;
#endif
}
int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height)
{
return GL_FALSE;
}
void APIENTRY glutDestroyWindow (int win)
{
#ifndef FX
if (buffer[win-1]) {
DMesaDestroyBuffer(buffer[win-1]);
buffer[win-1] = NULL;
if (windows[--win]) {
DMesaDestroyBuffer(windows[win]->buffer);
free(windows[win]);
windows[win] = NULL;
}
#endif
}
void APIENTRY glutPostRedisplay (void)
{
g_redisplay = GL_TRUE;
}
void APIENTRY glutSwapBuffers (void)
{
if (g_mouse) pc_scare_mouse();
#ifndef FX
DMesaSwapBuffers(buffer[window]);
#else
fxMesaSwapBuffers();
#endif
if (g_mouse) pc_unscare_mouse();
if (g_curwin->show_mouse) {
/* XXX scare mouse */
DMesaSwapBuffers(g_curwin->buffer);
/* XXX unscare mouse */
} else {
DMesaSwapBuffers(g_curwin->buffer);
}
if (g_fps) {
GLint t = glutGet(GLUT_ELAPSED_TIME);
swapcount++;
if (swaptime == 0)
swaptime = t;
else if (t - swaptime > g_fps) {
double time = 0.001 * (t - swaptime);
double fps = (double)swapcount / time;
fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n", swapcount, time, fps);
swaptime = t;
swapcount = 0;
}
}
}
int APIENTRY glutGetWindow (void)
{
return window + 1;
return g_curwin->num;
}
void APIENTRY glutSetWindow (int win)
{
window = win - 1;
g_curwin = windows[win - 1];
}
void APIENTRY glutSetWindowTitle (const char *title)
{
}
void APIENTRY glutSetIconTitle (const char *title)
{
}
void APIENTRY glutPositionWindow (int x, int y)
{
#ifndef FX
if (DMesaViewport(buffer[window], x, y, g_width, g_height)) {
g_xpos = x;
g_ypos = y;
if (DMesaMoveBuffer(x, y)) {
g_curwin->xpos = x;
g_curwin->ypos = y;
}
#endif
}
void APIENTRY glutReshapeWindow (int width, int height)
{
#ifndef FX
if (DMesaViewport(buffer[window], g_xpos, g_ypos, width, height)) {
g_width = width;
g_height = height;
if (reshape_func) {
reshape_func(width, height);
{
if (DMesaResizeBuffer(width, height)) {
g_curwin->width = width;
g_curwin->height = height;
if (g_curwin->reshape) {
g_curwin->reshape(width, height);
} else {
glViewport(0, 0, width, height);
}
}
#endif
}
void APIENTRY glutFullScreen (void)
{
}
void APIENTRY glutPopWindow (void)
{
}
void APIENTRY glutPushWindow (void)
{
}
void APIENTRY glutIconifyWindow (void)
{
}
void APIENTRY glutShowWindow (void)
{
}
void APIENTRY glutHideWindow (void)
{
}

View File

@@ -121,6 +121,11 @@ EXPORTS
glutWireTeapot
glutWireTetrahedron
glutWireTorus
glutStrokeRoman
glutBitmap9By15
glutBitmapHelvetica10
glutBitmapHelvetica18
glutBitmapTimesRoman24
; __glutSetFCB
; __glutGetFCB

View File

@@ -8,7 +8,7 @@
#include "glutint.h"
#include "glutbitmap.h"
void APIENTRY
void GLUTAPIENTRY
glutBitmapCharacter(GLUTbitmapFont font, int c)
{
const BitmapCharRec *ch;

View File

@@ -9,7 +9,7 @@
#include "glutbitmap.h"
/* CENTRY */
int APIENTRY
int GLUTAPIENTRY
glutBitmapWidth(GLUTbitmapFont font, int c)
{
BitmapFontPtr fontinfo;
@@ -30,7 +30,7 @@ glutBitmapWidth(GLUTbitmapFont font, int c)
return 0;
}
int APIENTRY
int GLUTAPIENTRY
glutBitmapLength(GLUTbitmapFont font, const unsigned char *string)
{
int c, length;

View File

@@ -11,7 +11,7 @@
#define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i)))
/* CENTRY */
void APIENTRY
void GLUTAPIENTRY
glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue)
{
GLUTcolormap *cmap, *newcmap;
@@ -126,7 +126,7 @@ glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue)
XStoreColor(__glutDisplay, cmap->cmap, &color);
}
GLfloat APIENTRY
GLfloat GLUTAPIENTRY
glutGetColor(int ndx, int comp)
{
GLUTcolormap *colormap;
@@ -161,7 +161,7 @@ glutGetColor(int ndx, int comp)
return colormap->cells[ndx].component[comp];
}
void APIENTRY
void GLUTAPIENTRY
glutCopyColormap(int winnum)
{
GLUTwindow *window = __glutWindowList[winnum - 1];

View File

@@ -180,7 +180,7 @@ __glutSetCursor(GLUTwindow *window)
}
/* CENTRY */
void APIENTRY
void GLUTAPIENTRY
glutSetCursor(int cursor)
{
#ifdef _WIN32

Some files were not shown because too many files have changed in this diff Show More