Compare commits
	
		
			55 Commits
		
	
	
		
			mesa-25.0.
			...
			vtx-0-2-24
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					027fdb8bbd | ||
| 
						 | 
					3a7c3b02a3 | ||
| 
						 | 
					3ec97611d2 | ||
| 
						 | 
					f2f09abce4 | ||
| 
						 | 
					93320957f2 | ||
| 
						 | 
					374a09c4f7 | ||
| 
						 | 
					1302fd3b25 | ||
| 
						 | 
					5198950cde | ||
| 
						 | 
					88d66b7208 | ||
| 
						 | 
					701208d259 | ||
| 
						 | 
					dfd3c9c40f | ||
| 
						 | 
					cef9471ab2 | ||
| 
						 | 
					8d8bb0679c | ||
| 
						 | 
					5affcd3cbb | ||
| 
						 | 
					86ac3e3c2d | ||
| 
						 | 
					5c2d467e6d | ||
| 
						 | 
					c00a1c4622 | ||
| 
						 | 
					dad38213e7 | ||
| 
						 | 
					9cbad64314 | ||
| 
						 | 
					f0bf8c0ed1 | ||
| 
						 | 
					6b692dc06c | ||
| 
						 | 
					be3c25458b | ||
| 
						 | 
					a384b0c5eb | ||
| 
						 | 
					acfa4d46a4 | ||
| 
						 | 
					df3b1eb5bc | ||
| 
						 | 
					34a9e4adaf | ||
| 
						 | 
					34f6df8b6d | ||
| 
						 | 
					5fc6940aca | ||
| 
						 | 
					c9c27a6efd | ||
| 
						 | 
					79a49e30a1 | ||
| 
						 | 
					f1582dbe52 | ||
| 
						 | 
					4fc77f884c | ||
| 
						 | 
					398f8d10a2 | ||
| 
						 | 
					5b9ad341a0 | ||
| 
						 | 
					fcd68a2b30 | ||
| 
						 | 
					f1bbe8d0a5 | ||
| 
						 | 
					3c0cfda46b | ||
| 
						 | 
					5d80efc35e | ||
| 
						 | 
					e01f56b3a8 | ||
| 
						 | 
					30cd200068 | ||
| 
						 | 
					e55c545d4a | ||
| 
						 | 
					b101554d16 | ||
| 
						 | 
					1b8c209523 | ||
| 
						 | 
					d46adad5cd | ||
| 
						 | 
					bfc37379cc | ||
| 
						 | 
					0c390fec04 | ||
| 
						 | 
					d5c9fd383b | ||
| 
						 | 
					8ae69294ad | ||
| 
						 | 
					46330d3aa7 | ||
| 
						 | 
					c91f7ad52b | ||
| 
						 | 
					5b40d6924c | ||
| 
						 | 
					27b4c2d675 | ||
| 
						 | 
					051a8141d1 | ||
| 
						 | 
					9b6d6988c4 | ||
| 
						 | 
					967fa00a7f | 
							
								
								
									
										28
									
								
								Make-config
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								Make-config
									
									
									
									
									
								
							@@ -33,6 +33,7 @@ VERSION=$(MESA_MAJOR).$(MESA_MINOR)
 | 
			
		||||
# ASM_SOURCES    optional list of assembly language files to assemble
 | 
			
		||||
# MAKELIB        the script or command to make a library file
 | 
			
		||||
#                XXX MAKELIB is obsolete; edit bin/mklib to support new systems
 | 
			
		||||
# MKLIB_OPTIONS  extra options to pass to the mklib script (like -arch)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
aix:
 | 
			
		||||
@@ -527,10 +528,10 @@ linux-glide:
 | 
			
		||||
	"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DFX -DPTHREADS -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include" \
 | 
			
		||||
	"CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE" \
 | 
			
		||||
	"GLUT_CFLAGS = -fexceptions" \
 | 
			
		||||
	"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -L/usr/local/glide/lib -lglide2x" \
 | 
			
		||||
	"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -L/usr/local/glide/lib -lglide3x" \
 | 
			
		||||
	"GLU_LIB_DEPS = -L$(TOP)/lib -lGL -lm" \
 | 
			
		||||
	"GLUT_LIB_DEPS = -L$(TOP)/lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
 | 
			
		||||
	"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide2x -lglut -lGLU -lGL"
 | 
			
		||||
	"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide3x -lglut -lGLU -lGL"
 | 
			
		||||
 | 
			
		||||
linux-x86-glide:
 | 
			
		||||
	$(MAKE) $(MFLAGS) -f Makefile.X11 targets \
 | 
			
		||||
@@ -544,7 +545,7 @@ linux-x86-glide:
 | 
			
		||||
	"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -funroll-loops -fomit-frame-pointer -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DUSE_XSHM -DFX -DPTHREADS -I/usr/X11R6/include -I/usr/include/glide -I/usr/local/glide/include -I/usr/src/mesa-glx/src/FX/X86" \
 | 
			
		||||
	"CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -funroll-loops -fomit-frame-pointer -D_SVID_SOURCE -D_BSD_SOURCE" \
 | 
			
		||||
	"GLUT_CFLAGS = -fexceptions" \
 | 
			
		||||
	"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -L/usr/local/glide/lib -lglide2x -lm -lpthread" \
 | 
			
		||||
	"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -L/usr/local/glide/lib -lglide3x -lm -lpthread" \
 | 
			
		||||
	"GLU_LIB_DEPS = -L$(TOP)/lib -lGL -lm" \
 | 
			
		||||
	"GLUT_LIB_DEPS = -L$(TOP)/lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
 | 
			
		||||
	"GLW_LIB_DEPS = -L$(TOP)/lib -lGL -L/usr/X11R6/lib -lXt -lX11" \
 | 
			
		||||
@@ -678,12 +679,24 @@ linux-osmesa16:
 | 
			
		||||
	"OSMESA16_LIB = libOSMesa16.so" \
 | 
			
		||||
	"CC = gcc" \
 | 
			
		||||
	"CXX = g++" \
 | 
			
		||||
	"CFLAGS = -O3 -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
 | 
			
		||||
	"CXXFLAGS = -O3 -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE" \
 | 
			
		||||
	"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
 | 
			
		||||
	"CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE" \
 | 
			
		||||
	"GLUT_CFLAGS = -fexceptions" \
 | 
			
		||||
	"GL_LIB_DEPS = -lm -lpthread" \
 | 
			
		||||
	"APP_LIB_DEPS = -lOSMesa16 -lGL"
 | 
			
		||||
 | 
			
		||||
linux-osmesa16-static:
 | 
			
		||||
	$(MAKE) $(MFLAGS) -f Makefile.OSMesa16 targets \
 | 
			
		||||
	"OSMESA16_LIB = libOSMesa16.a" \
 | 
			
		||||
	"CC = gcc" \
 | 
			
		||||
	"CXX = g++" \
 | 
			
		||||
	"CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
 | 
			
		||||
	"CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE" \
 | 
			
		||||
	"GLUT_CFLAGS = -fexceptions" \
 | 
			
		||||
	"GL_LIB_DEPS = -lm -lpthread" \
 | 
			
		||||
	"MAKELIB_FLAGS = -static" \
 | 
			
		||||
	"APP_LIB_DEPS = -lOSMesa16 -lGL"
 | 
			
		||||
 | 
			
		||||
# 32-bit/channel Mesa using OSMesa driver
 | 
			
		||||
linux-osmesa32:
 | 
			
		||||
	$(MAKE) $(MFLAGS) -f Makefile.OSMesa16 targets \
 | 
			
		||||
@@ -700,6 +713,7 @@ linux-osmesa32:
 | 
			
		||||
# change -g to -O3 for non-debug
 | 
			
		||||
linux-solo:
 | 
			
		||||
	$(MAKE) $(MFLAGS) -f Makefile.X11 targets \
 | 
			
		||||
	"SOLO = true" \
 | 
			
		||||
	"LIBMESA = mesa.a" \
 | 
			
		||||
	"GLU_LIB = libGLU.so" \
 | 
			
		||||
	"GLUT_LIB = libglut.so" \
 | 
			
		||||
@@ -708,7 +722,7 @@ linux-solo:
 | 
			
		||||
	"CFLAGS = -g -std=c99 -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE" \
 | 
			
		||||
	"CXXFLAGS = -g -std=c99 -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE" \
 | 
			
		||||
	"GLUT_CFLAGS = -fexceptions" \
 | 
			
		||||
	"GL_LIB_DEPS = -lm -lpthread" \
 | 
			
		||||
	"GL_LIB_DEPS = -lm -lpthread -lexpat" \
 | 
			
		||||
	"GLU_LIB_DEPS = -L$(TOP)/lib -lGL -lm  -Wl,-rpath,$(TOP)/lib" \
 | 
			
		||||
	"GLUT_LIB_DEPS = -L$(TOP)/lib -lGLU -lGL -lm  -Wl,-rpath,$(TOP)/lib" \
 | 
			
		||||
	"APP_LIB_DEPS = -L$(TOP)/lib -lglut -lGLU -lGL -lm  -lpthread -Wl,-rpath,$(TOP)/lib" 
 | 
			
		||||
@@ -1078,5 +1092,5 @@ linux-glide-debug:
 | 
			
		||||
	"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DFX -DDEBUG -I/usr/local/glide/include -I/usr/include/glide" \
 | 
			
		||||
	"CXXFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG" \
 | 
			
		||||
	"GLUT_CFLAGS = -fexceptions" \
 | 
			
		||||
	"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide2x -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lvga -lm -lpthread"
 | 
			
		||||
	"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide3x -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lvga -lm -lpthread"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										361
									
								
								Makefile.X11
									
									
									
									
									
								
							
							
						
						
									
										361
									
								
								Makefile.X11
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
# $Id: Makefile.X11,v 1.90 2003/10/03 14:03:14 brianp Exp $
 | 
			
		||||
# $Id: Makefile.X11,v 1.89.2.1 2003/11/24 12:01:39 keithw Exp $
 | 
			
		||||
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.1
 | 
			
		||||
@@ -33,69 +33,70 @@ SHELL = /bin/sh
 | 
			
		||||
 | 
			
		||||
default:
 | 
			
		||||
	@echo "Type one of the following:"
 | 
			
		||||
	@echo "  make aix                  for IBM RS/6000 with AIX"
 | 
			
		||||
	@echo "  make aix-sl               for IBM RS/6000, make shared libs"
 | 
			
		||||
	@echo "  make beos-r4              for BeOS R4"
 | 
			
		||||
	@echo "  make cygnus               for Win95/NT using Cygnus-Win32"
 | 
			
		||||
	@echo "  make cygnus-linux         for Win95/NT using Cygnus-Win32 under Linux"
 | 
			
		||||
	@echo "  make darwin               for Darwin - Mac OS X"
 | 
			
		||||
	@echo "  make freebsd              for FreeBSD systems with GCC"
 | 
			
		||||
	@echo "  make freebsd-386          for FreeBSD systems with GCC, w/ Intel assembly"
 | 
			
		||||
	@echo "  make gcc-sl               for a generic system with GCC for shared libs"
 | 
			
		||||
	@echo "  make hpux9                for HP systems with HPUX 9.x"
 | 
			
		||||
	@echo "  make hpux9-sl             for HP systems with HPUX 9.x, make shared libs"
 | 
			
		||||
	@echo "  make hpux9-gcc            for HP systems with HPUX 9.x using GCC"
 | 
			
		||||
	@echo "  make hpux9-gcc-sl         for HP systems with HPUX 9.x, GCC, make shared libs"
 | 
			
		||||
	@echo "  make hpux10               for HP systems with HPUX 10.x and 11.x"
 | 
			
		||||
	@echo "  make hpux10-sl            for HP systems with HPUX 10.x and 11.x, shared libs"
 | 
			
		||||
	@echo "  make hpux10-gcc           for HP systems with HPUX 10.x w/ GCC"
 | 
			
		||||
	@echo "  make hpux10-gcc-sl        for HP systems with HPUX 10.x w/ GCC, shared libs"
 | 
			
		||||
	@echo "  make irix6-o32            for SGI systems with IRIX 6.x, make o32-bit libs"
 | 
			
		||||
	@echo "  make irix6-o32-dso        for SGI systems with IRIX 6.x, make o32-bit DSOs"
 | 
			
		||||
	@echo "  make irix6-n32            for SGI systems with IRIX 6.x, make n32-bit libs"
 | 
			
		||||
	@echo "  make irix6-n32-dso        for SGI systems with IRIX 6.x, make n32-bit DSOs"
 | 
			
		||||
	@echo "  make irix6-gcc-n32-sl     for SGI systems with IRIX 6.x, GCC, make n32 DSOs"
 | 
			
		||||
	@echo "  make irix6-64             for SGI systems with IRIX 6.x, make 64-bit libs"
 | 
			
		||||
	@echo "  make irix6-64-dso         for SGI systems with IRIX 6.x, make 64-bit DSOs"
 | 
			
		||||
	@echo "  make aix                   for IBM RS/6000 with AIX"
 | 
			
		||||
	@echo "  make aix-sl                for IBM RS/6000, make shared libs"
 | 
			
		||||
	@echo "  make beos-r4               for BeOS R4"
 | 
			
		||||
	@echo "  make cygnus                for Win95/NT using Cygnus-Win32"
 | 
			
		||||
	@echo "  make cygnus-linux          for Win95/NT using Cygnus-Win32 under Linux"
 | 
			
		||||
	@echo "  make darwin                for Darwin - Mac OS X"
 | 
			
		||||
	@echo "  make freebsd               for FreeBSD systems with GCC"
 | 
			
		||||
	@echo "  make freebsd-386           for FreeBSD systems with GCC, w/ Intel assembly"
 | 
			
		||||
	@echo "  make gcc-sl                for a generic system with GCC for shared libs"
 | 
			
		||||
	@echo "  make hpux9                 for HP systems with HPUX 9.x"
 | 
			
		||||
	@echo "  make hpux9-sl              for HP systems with HPUX 9.x, make shared libs"
 | 
			
		||||
	@echo "  make hpux9-gcc             for HP systems with HPUX 9.x using GCC"
 | 
			
		||||
	@echo "  make hpux9-gcc-sl          for HP systems with HPUX 9.x, GCC, make shared libs"
 | 
			
		||||
	@echo "  make hpux10                for HP systems with HPUX 10.x and 11.x"
 | 
			
		||||
	@echo "  make hpux10-sl             for HP systems with HPUX 10.x and 11.x, shared libs"
 | 
			
		||||
	@echo "  make hpux10-gcc            for HP systems with HPUX 10.x w/ GCC"
 | 
			
		||||
	@echo "  make hpux10-gcc-sl         for HP systems with HPUX 10.x w/ GCC, shared libs"
 | 
			
		||||
	@echo "  make irix6-o32             for SGI systems with IRIX 6.x, make o32-bit libs"
 | 
			
		||||
	@echo "  make irix6-o32-dso         for SGI systems with IRIX 6.x, make o32-bit DSOs"
 | 
			
		||||
	@echo "  make irix6-n32             for SGI systems with IRIX 6.x, make n32-bit libs"
 | 
			
		||||
	@echo "  make irix6-n32-dso         for SGI systems with IRIX 6.x, make n32-bit DSOs"
 | 
			
		||||
	@echo "  make irix6-gcc-n32-sl      for SGI systems with IRIX 6.x, GCC, make n32 DSOs"
 | 
			
		||||
	@echo "  make irix6-64              for SGI systems with IRIX 6.x, make 64-bit libs"
 | 
			
		||||
	@echo "  make irix6-64-dso          for SGI systems with IRIX 6.x, make 64-bit DSOs"
 | 
			
		||||
 | 
			
		||||
	@echo "  make linux                for Linux"
 | 
			
		||||
	@echo "  make linux-x86            for Linux with x86 optimizations"
 | 
			
		||||
	@echo "  make linux-ggi            for Linux with libggi driver"
 | 
			
		||||
	@echo "  make linux-x86-ggi        for Linux with libggi driver and x86 optimizations"
 | 
			
		||||
	@echo "  make linux-glide          for Linux with 3Dfx Glide driver"
 | 
			
		||||
	@echo "  make linux-x86-glide      for Linux with 3Dfx Glide driver and x86 opts"
 | 
			
		||||
	@echo "  make linux-alpha          for Linux with Alpha optimizations"
 | 
			
		||||
	@echo "  make linux-alpha-static   for Linux with Alpha opts, make static libs"
 | 
			
		||||
	@echo "  make linux-ppc            for Linux with PowerPC opts"
 | 
			
		||||
	@echo "  make linux-ppc-static     for Linux with PowerPC opts, make static libs"
 | 
			
		||||
	@echo "  make linux-sparc          for Linux with Sparc optimzations"
 | 
			
		||||
	@echo "  make linux-sparc5         for Linux with Sparc5 optimizations"
 | 
			
		||||
	@echo "  make linux-sparc-ultra    for Linux with UltraSparc optimizations"
 | 
			
		||||
	@echo "  make linux-osmesa16       for 16-bit/channel OSMesa"
 | 
			
		||||
	@echo "  make linux-osmesa32       for 32-bit/channel OSMesa"
 | 
			
		||||
	@echo "  make linux-solo           for Linux standalone with dri drivers"
 | 
			
		||||
	@echo "  make linux-icc            for Linux with the Intel C/C++ compiler"
 | 
			
		||||
	@echo "  make lynxos               for LynxOS systems with GCC"
 | 
			
		||||
	@echo "  make mklinux              for Linux on Power Macintosh"
 | 
			
		||||
	@echo "  make netbsd               for NetBSD 1.0 systems with GCC"
 | 
			
		||||
	@echo "  make openbsd              for OpenBSD systems"
 | 
			
		||||
	@echo "  make openstep             for OpenStep/MacOSX Server systems"
 | 
			
		||||
	@echo "  make osf1                 for DEC Alpha systems with OSF/1"
 | 
			
		||||
	@echo "  make qnx                  for QNX V4 systems with Watcom compiler"
 | 
			
		||||
	@echo "  make solaris-x86          for PCs with Solaris"
 | 
			
		||||
	@echo "  make solaris-x86-gcc      for PCs with Solaris using GCC"
 | 
			
		||||
	@echo "  make sunos4               for Suns with SunOS 4.x"
 | 
			
		||||
	@echo "  make sunos4-sl            for Suns with SunOS 4.x, make shared libs"
 | 
			
		||||
	@echo "  make sunos4-gcc           for Suns with SunOS 4.x and GCC"
 | 
			
		||||
	@echo "  make sunos4-gcc-sl        for Suns with SunOS 4.x, GCC, make shared libs"
 | 
			
		||||
	@echo "  make sunos5               for Suns with SunOS 5.x"
 | 
			
		||||
	@echo "  make sunos5-smp           for Suns with SunOS 5.x, SMP optimization"
 | 
			
		||||
	@echo "  make sunos5-gcc           for Suns with SunOS 5.x and GCC"
 | 
			
		||||
	@echo "  make ultrix-gcc           for DEC systems with Ultrix and GCC"
 | 
			
		||||
	@echo "  make unixware             for PCs running UnixWare"
 | 
			
		||||
	@echo "  make unixware-shared      for PCs running UnixWare, shared libs"
 | 
			
		||||
	@echo "  make clean                remove .o files"
 | 
			
		||||
	@echo "  make realclean            remove .o, library and executable files"
 | 
			
		||||
	@echo "  make linux                 for Linux"
 | 
			
		||||
	@echo "  make linux-x86             for Linux with x86 optimizations"
 | 
			
		||||
	@echo "  make linux-ggi             for Linux with libggi driver"
 | 
			
		||||
	@echo "  make linux-x86-ggi         for Linux with libggi driver and x86 optimizations"
 | 
			
		||||
	@echo "  make linux-glide           for Linux with 3Dfx Glide driver"
 | 
			
		||||
	@echo "  make linux-x86-glide       for Linux with 3Dfx Glide driver and x86 opts"
 | 
			
		||||
	@echo "  make linux-alpha           for Linux with Alpha optimizations"
 | 
			
		||||
	@echo "  make linux-alpha-static    for Linux with Alpha opts, make static libs"
 | 
			
		||||
	@echo "  make linux-ppc             for Linux with PowerPC opts"
 | 
			
		||||
	@echo "  make linux-ppc-static      for Linux with PowerPC opts, make static libs"
 | 
			
		||||
	@echo "  make linux-sparc           for Linux with Sparc optimzations"
 | 
			
		||||
	@echo "  make linux-sparc5          for Linux with Sparc5 optimizations"
 | 
			
		||||
	@echo "  make linux-sparc-ultra     for Linux with UltraSparc optimizations"
 | 
			
		||||
	@echo "  make linux-osmesa16        for 16-bit/channel OSMesa"
 | 
			
		||||
	@echo "  make linux-osmesa16-static for 16-bit/channel OSMesa, make static libs"
 | 
			
		||||
	@echo "  make linux-osmesa32        for 32-bit/channel OSMesa"
 | 
			
		||||
	@echo "  make linux-solo            for Linux standalone with dri drivers"
 | 
			
		||||
	@echo "  make linux-icc             for Linux with the Intel C/C++ compiler"
 | 
			
		||||
	@echo "  make lynxos                for LynxOS systems with GCC"
 | 
			
		||||
	@echo "  make mklinux               for Linux on Power Macintosh"
 | 
			
		||||
	@echo "  make netbsd                for NetBSD 1.0 systems with GCC"
 | 
			
		||||
	@echo "  make openbsd               for OpenBSD systems"
 | 
			
		||||
	@echo "  make openstep              for OpenStep/MacOSX Server systems"
 | 
			
		||||
	@echo "  make osf1                  for DEC Alpha systems with OSF/1"
 | 
			
		||||
	@echo "  make qnx                   for QNX V4 systems with Watcom compiler"
 | 
			
		||||
	@echo "  make solaris-x86           for PCs with Solaris"
 | 
			
		||||
	@echo "  make solaris-x86-gcc       for PCs with Solaris using GCC"
 | 
			
		||||
	@echo "  make sunos4                for Suns with SunOS 4.x"
 | 
			
		||||
	@echo "  make sunos4-sl             for Suns with SunOS 4.x, make shared libs"
 | 
			
		||||
	@echo "  make sunos4-gcc            for Suns with SunOS 4.x and GCC"
 | 
			
		||||
	@echo "  make sunos4-gcc-sl         for Suns with SunOS 4.x, GCC, make shared libs"
 | 
			
		||||
	@echo "  make sunos5                for Suns with SunOS 5.x"
 | 
			
		||||
	@echo "  make sunos5-smp            for Suns with SunOS 5.x, SMP optimization"
 | 
			
		||||
	@echo "  make sunos5-gcc            for Suns with SunOS 5.x and GCC"
 | 
			
		||||
	@echo "  make ultrix-gcc            for DEC systems with Ultrix and GCC"
 | 
			
		||||
	@echo "  make unixware              for PCs running UnixWare"
 | 
			
		||||
	@echo "  make unixware-shared       for PCs running UnixWare, shared libs"
 | 
			
		||||
	@echo "  make clean                 remove .o files"
 | 
			
		||||
	@echo "  make realclean             remove .o, library and executable files"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -224,11 +225,11 @@ linux-ggi-install linux-x86-ggi-install:
 | 
			
		||||
#	echo ".include $(DESTDIR)/etc/ggi/ggimesa.conf" >> $(DESTDIR)/etc/ggi/libggi.conf ; \
 | 
			
		||||
#	fi
 | 
			
		||||
 | 
			
		||||
linux-osmesa16 linux-osmesa32:
 | 
			
		||||
linux-osmesa16 linux-osmesa16-static linux-osmesa32:
 | 
			
		||||
	-mkdir lib
 | 
			
		||||
	if [ -d src ] ; then touch src/depend ; fi
 | 
			
		||||
	if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.OSMesa16 $@ ; fi
 | 
			
		||||
	
 | 
			
		||||
	if [ -d src/mesa ] ; then touch src/mesa/depend ; fi
 | 
			
		||||
	if [ -d src/mesa ] ; then cd src/mesa ; $(MAKE) -f Makefile.OSMesa16 $@ ; fi
 | 
			
		||||
 | 
			
		||||
linux-solo:
 | 
			
		||||
	-mkdir lib
 | 
			
		||||
	if [ -d src/mesa     ] ; then touch src/mesa/depend     ; fi
 | 
			
		||||
@@ -347,6 +348,10 @@ GLUT_NAME = GLUT-3.7
 | 
			
		||||
LIB_FILES =	\
 | 
			
		||||
	$(DIRECTORY)/Makefile*						\
 | 
			
		||||
	$(DIRECTORY)/Make-config					\
 | 
			
		||||
	$(DIRECTORY)/descrip.mms					\
 | 
			
		||||
	$(DIRECTORY)/mms-config.					\
 | 
			
		||||
	$(DIRECTORY)/Mesa.dsw						\
 | 
			
		||||
	$(DIRECTORY)/bin/mklib*						\
 | 
			
		||||
	$(DIRECTORY)/docs/*.html					\
 | 
			
		||||
	$(DIRECTORY)/docs/COPYING					\
 | 
			
		||||
	$(DIRECTORY)/docs/INSTALL.GNU					\
 | 
			
		||||
@@ -354,14 +359,7 @@ LIB_FILES =	\
 | 
			
		||||
	$(DIRECTORY)/docs/RELNOTES*					\
 | 
			
		||||
	$(DIRECTORY)/docs/VERSIONS					\
 | 
			
		||||
	$(DIRECTORY)/docs/*.spec					\
 | 
			
		||||
	$(DIRECTORY)/bin/README						\
 | 
			
		||||
	$(DIRECTORY)/bin/mklib*						\
 | 
			
		||||
	$(DIRECTORY)/descrip.mms					\
 | 
			
		||||
	$(DIRECTORY)/mms-config						\
 | 
			
		||||
	$(DIRECTORY)/xlib.opt						\
 | 
			
		||||
	$(DIRECTORY)/include/GL/internal/glcore.h			\
 | 
			
		||||
	$(DIRECTORY)/include/GL/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/include/GL/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/include/GL/dmesa.h					\
 | 
			
		||||
	$(DIRECTORY)/include/GL/amesa.h					\
 | 
			
		||||
	$(DIRECTORY)/include/GL/fxmesa.h				\
 | 
			
		||||
@@ -384,135 +382,86 @@ LIB_FILES =	\
 | 
			
		||||
	$(DIRECTORY)/include/GL/xmesa.h					\
 | 
			
		||||
	$(DIRECTORY)/include/GL/xmesa_x.h				\
 | 
			
		||||
	$(DIRECTORY)/include/GL/xmesa_xf86.h				\
 | 
			
		||||
	$(DIRECTORY)/include/GLView.h					\
 | 
			
		||||
	$(DIRECTORY)/include/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/include/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/Makefile*					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/descrip.mms					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/mesa.conf						\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/*.def						\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/depend						\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/*.[chS]						\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/array_cache/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/array_cache/Makefile*				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/math/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/math/Makefile*					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast/Makefile*					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast_setup/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast_setup/Makefile*				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl/Makefile*					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl_dd/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windml/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windml/tornado/*.c			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windml/tornado/*.cdf			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windml/man3/*.3				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windml/man3/*.html			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/dos/*.[chS]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/dos/mga/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/beos/*.cpp				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/*.def				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/X86/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/X86/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/X86/*.[Shc]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/ggimesa.conf.in			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/default/*.c				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/default/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/default/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/default/genkgi.conf.in		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/display/*.c				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/display/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/display/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/Makefile.am		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/Makefile.in		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/Makefile.am		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/Makefile.in		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h			\
 | 
			
		||||
  	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/sparc/*.[chS]					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/sparc/Makefile.am					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/sparc/Makefile.in					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/svga/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/svga/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/svga/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windows/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windows/*.def				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/x11/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/x11/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/x11/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/x86/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/x86/Makefile.am					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/x86/Makefile.in					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/x86/*.S						\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.am					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.in					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.X11					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.win					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.DJ					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/glu.def					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/dummy.cc					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/descrip.mms					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/mesaglu.opt					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/include/gluos.h				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/include/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/include/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.h				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.cc			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.h				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.cc			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.h				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.cc				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/Makefile.am			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/Makefile.in			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/README					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/alg-outline				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/libtess_la_SOURCES			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libutil/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libutil/libutil_la_SOURCES			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libutil/Makefile.am				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libutil/Makefile.in				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/README[12]					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/Makefile*					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/descrip.mms					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/mms_depend					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/*.def						\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/depend					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/glw/*.[ch]						\
 | 
			
		||||
	$(DIRECTORY)/src/glw/Makefile*						\
 | 
			
		||||
	$(DIRECTORY)/src/glw/README						\
 | 
			
		||||
	$(DIRECTORY)/progs/util/README						\
 | 
			
		||||
	$(DIRECTORY)/progs/util/Makefile.am					\
 | 
			
		||||
	$(DIRECTORY)/progs/util/Makefile.in					\
 | 
			
		||||
	$(DIRECTORY)/progs/util/*.[ch]						\
 | 
			
		||||
	$(DIRECTORY)/progs/util/sampleMakefile					\
 | 
			
		||||
	$(DIRECTORY)/vms/analyze_map.com					\
 | 
			
		||||
	$(DIRECTORY)/vms/xlib.opt						\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/descrip.mms				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/depend					\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/main/*.[chS]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/main/main.dsp				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/glapi/*.[chS]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/glapi/glapi.dsp				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/array_cache/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/array_cache/array_cache.dsp		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/math/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/math/math.dsp				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast/swrast.dsp				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast_setup/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast_setup/swrast_setup.dsp		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl/tnl.dsp				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl_dd/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/common/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/dos/*.[chS]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/dos/mga/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/beos/*.cpp			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/glide/*.def			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/ggimesa.conf.in		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/default/*.c			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/default/genkgi.conf.in	\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/display/*.c			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.dsp			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/svga/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windows/*/*.def			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/windows/*/*.dsp			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/drivers/x11/*.[ch]			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/sparc/*.[chS]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/x86/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/x86/*.S					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.X11				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.win				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.DJ				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/cc*.txt				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/glu.def				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/glu.dsp				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/dummy.cc				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/descrip.mms				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/mesaglu.opt				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/include/gluos.h			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.h			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.cc		\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.h			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.cc		\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.h			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.cc			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/README				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/alg-outline			\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libtess/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/libutil/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/README[12]				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/Makefile*				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/descrip.mms				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/mms_depend				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/*.def					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/depend				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/mesa/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/glw/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/src/glw/Makefile*					\
 | 
			
		||||
	$(DIRECTORY)/src/glw/README					\
 | 
			
		||||
	$(DIRECTORY)/progs/util/README					\
 | 
			
		||||
	$(DIRECTORY)/progs/util/*.[ch]					\
 | 
			
		||||
	$(DIRECTORY)/progs/util/sampleMakefile				\
 | 
			
		||||
	$(DIRECTORY)/vms/analyze_map.com				\
 | 
			
		||||
	$(DIRECTORY)/vms/xlib.opt					\
 | 
			
		||||
	$(DIRECTORY)/vms/xlib_share.opt
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -524,10 +473,11 @@ DEMO_FILES =	\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx/*def			\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx/descrip.mms		\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx/mms_depend		\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx/glut.dsp		\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx/*.[ch]		\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx.dos/*.[ch]		\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx.dos/Makefile.DJ	\
 | 
			
		||||
	$(DIRECTORY)/src/glut/glx.dos/PC_HW/*.[chS]	\
 | 
			
		||||
	$(DIRECTORY)/src/glut/dos/*.[ch]		\
 | 
			
		||||
	$(DIRECTORY)/src/glut/dos/Makefile.DJ		\
 | 
			
		||||
	$(DIRECTORY)/src/glut/dos/PC_HW/*.[chS]		\
 | 
			
		||||
	$(DIRECTORY)/progs/images/*			\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/Makefile*		\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/descrip.mms		\
 | 
			
		||||
@@ -535,6 +485,7 @@ DEMO_FILES =	\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/*.cxx			\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/*.dat			\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/README			\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/Windows/*		\
 | 
			
		||||
	$(DIRECTORY)/progs/xdemos/Makefile*		\
 | 
			
		||||
	$(DIRECTORY)/progs/xdemos/descrip.mms		\
 | 
			
		||||
	$(DIRECTORY)/progs/xdemos/*.[chf]		\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										87
									
								
								Makefile.wfx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								Makefile.wfx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.1
 | 
			
		||||
#
 | 
			
		||||
# 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"),
 | 
			
		||||
# 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.
 | 
			
		||||
 | 
			
		||||
# Win32/FX makefile for Mesa
 | 
			
		||||
#
 | 
			
		||||
#  Copyright (c) 2003 - Hiroshi Morii
 | 
			
		||||
#  Email : koolsmoky@users.sourceforge.net
 | 
			
		||||
#  URL   : http://www.3dfxzone.it/koolsmoky
 | 
			
		||||
 | 
			
		||||
# Debug build                : nmake -f Makefile.wfx debug
 | 
			
		||||
# Optimized build            : nmake -f Makefile.wfx
 | 
			
		||||
# Remove objects             : nmake -f Makefile.wfx clean
 | 
			
		||||
# Remove files in bin, lib   : nmake -f Makefile.wfx clobber
 | 
			
		||||
# Remove all generated files : nmake -f Makefile.wfx realclean
 | 
			
		||||
 | 
			
		||||
# Build the libs
 | 
			
		||||
SUBDIRS	  = src\mesa.dir
 | 
			
		||||
DBGBUILD  = $(SUBDIRS:.dir=.debug)
 | 
			
		||||
CLEAN	  = $(SUBDIRS:.dir=.clean)
 | 
			
		||||
CLOBBER	  = $(SUBDIRS:.dir=.clobber)
 | 
			
		||||
REALCLEAN = $(SUBDIRS:.dir=.realclean)
 | 
			
		||||
LIBDIR    = lib
 | 
			
		||||
 | 
			
		||||
# default rule
 | 
			
		||||
default	  : $(LIBDIR) $(SUBDIRS)
 | 
			
		||||
 | 
			
		||||
# debug build rules
 | 
			
		||||
debug     : $(LIBDIR) $(DBGBUILD)
 | 
			
		||||
 | 
			
		||||
# cleanup rules
 | 
			
		||||
clean	  : $(CLEAN)
 | 
			
		||||
clobber	  : $(CLOBBER)
 | 
			
		||||
realclean : $(REALCLEAN)
 | 
			
		||||
 | 
			
		||||
# inference rules
 | 
			
		||||
$(LIBDIR):
 | 
			
		||||
	@echo.
 | 
			
		||||
	@mkdir $(LIBDIR)
 | 
			
		||||
 | 
			
		||||
$(SUBDIRS):
 | 
			
		||||
	@echo.
 | 
			
		||||
	@cd $*
 | 
			
		||||
	@nmake -f Makefile.wfx
 | 
			
		||||
	@cd ..
 | 
			
		||||
 | 
			
		||||
$(DBGBUILD):
 | 
			
		||||
	@echo.
 | 
			
		||||
	@cd $*
 | 
			
		||||
	@nmake -f Makefile.wfx DEBUG=1
 | 
			
		||||
	@cd ..
 | 
			
		||||
 | 
			
		||||
$(CLEAN):
 | 
			
		||||
	@echo.
 | 
			
		||||
	@cd $*
 | 
			
		||||
	@nmake -f Makefile.wfx clean
 | 
			
		||||
	@cd ..
 | 
			
		||||
 | 
			
		||||
$(CLOBBER):
 | 
			
		||||
	@echo.
 | 
			
		||||
	@cd $*
 | 
			
		||||
	@nmake -f Makefile.wfx clobber
 | 
			
		||||
	@cd ..
 | 
			
		||||
 | 
			
		||||
$(REALCLEAN):
 | 
			
		||||
	@echo.
 | 
			
		||||
	@cd $*
 | 
			
		||||
	@nmake -f Makefile.wfx realclean
 | 
			
		||||
	@cd ..
 | 
			
		||||
							
								
								
									
										60
									
								
								bin/mklib
									
									
									
									
									
								
							
							
						
						
									
										60
									
								
								bin/mklib
									
									
									
									
									
								
							@@ -110,29 +110,40 @@ case $ARCH in
 | 
			
		||||
 | 
			
		||||
    'Linux')
 | 
			
		||||
	LIBNAME="lib${LIBNAME}"     # prefix with "lib"
 | 
			
		||||
	OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
 | 
			
		||||
	VERSION="${MAJOR}.${MINOR}.${PATCH}"
 | 
			
		||||
 | 
			
		||||
	echo "mklib: Making Linux shared library: " ${LIBNAME}.so.${VERSION}
 | 
			
		||||
        if [ $STATIC = 1 ] ; then
 | 
			
		||||
            echo "mklib: Making Linux static library: " ${LIBNAME}.a
 | 
			
		||||
            LINK="ar"
 | 
			
		||||
            OPTS="-ruv"
 | 
			
		||||
            # make lib
 | 
			
		||||
            ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
 | 
			
		||||
            # finish up
 | 
			
		||||
            FINAL_LIBS="${LIBNAME}.a"
 | 
			
		||||
        else
 | 
			
		||||
            OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
 | 
			
		||||
            VERSION="${MAJOR}.${MINOR}.${PATCH}"
 | 
			
		||||
 | 
			
		||||
	if [ $CPLUSPLUS = 1 ] ; then
 | 
			
		||||
	    LINK="g++"
 | 
			
		||||
	else
 | 
			
		||||
	    LINK="gcc"
 | 
			
		||||
	fi
 | 
			
		||||
            echo "mklib: Making Linux shared library: " ${LIBNAME}.so.${VERSION}
 | 
			
		||||
 | 
			
		||||
	# rm any old libs
 | 
			
		||||
	rm -f ${LIBNAME}.so.${VERSION}
 | 
			
		||||
	rm -f ${LIBNAME}.so.${MAJOR}
 | 
			
		||||
	rm -f ${LIBNAME}.so
 | 
			
		||||
            if [ $CPLUSPLUS = 1 ] ; then
 | 
			
		||||
                LINK="g++"
 | 
			
		||||
            else
 | 
			
		||||
                LINK="gcc"
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
	# make lib
 | 
			
		||||
	${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
 | 
			
		||||
	# make usual symlinks
 | 
			
		||||
	ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
 | 
			
		||||
	ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
 | 
			
		||||
	# finish up
 | 
			
		||||
	FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
 | 
			
		||||
            # rm any old libs
 | 
			
		||||
            rm -f ${LIBNAME}.so.${VERSION}
 | 
			
		||||
            rm -f ${LIBNAME}.so.${MAJOR}
 | 
			
		||||
            rm -f ${LIBNAME}.so
 | 
			
		||||
 | 
			
		||||
            # make lib
 | 
			
		||||
            ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
 | 
			
		||||
            # make usual symlinks
 | 
			
		||||
            ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
 | 
			
		||||
            ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
 | 
			
		||||
            # finish up
 | 
			
		||||
            FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
 | 
			
		||||
        fi
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
    'SunOS')
 | 
			
		||||
@@ -302,6 +313,13 @@ case $ARCH in
 | 
			
		||||
	FINAL_LIBS=${LIBNAME}
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
    'MorphOS')
 | 
			
		||||
	LIBNAME="lib${LIBNAME}.a"
 | 
			
		||||
	echo "mklib: Making MorphOS library: " ${LIBNAME}
 | 
			
		||||
	ppc-morphos-ar rc ${LIBNAME} ${OBJECTS}
 | 
			
		||||
	FINAL_LIBS="${LIBNAME}"
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
    'example')
 | 
			
		||||
	# If you're adding support for a new architecture, you can
 | 
			
		||||
	# start with this:
 | 
			
		||||
@@ -317,7 +335,9 @@ case $ARCH in
 | 
			
		||||
	echo "mklib: WARNING: please update the bin/mklib script!"
 | 
			
		||||
	# XXX this is a total hack for Mesa - remove someday
 | 
			
		||||
	# fall-back to an old mklib.* script
 | 
			
		||||
	${MAKELIB} "lib${LIBNAME}.a" ${MAJOR} ${MINOR} ${PATCH} ${OBJECTS}
 | 
			
		||||
	LIBNAME="lib${LIBNAME}.a"
 | 
			
		||||
	${TOP}/${MAKELIB} "lib${LIBNAME}.a" ${MAJOR} ${MINOR} ${PATCH} ${OBJECTS}
 | 
			
		||||
	FINAL_LIBS="${LIBNAME}"
 | 
			
		||||
	;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,65 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Mesa-5.1 release notes:
 | 
			
		||||
-----------------------
 | 
			
		||||
 | 
			
		||||
1) Glide2 support has been ceased; in order to keep Voodoo Graphics
 | 
			
		||||
   and Voodoo Rush compatibility, please visit the Glide SourceForge
 | 
			
		||||
   and help us to fix Glide3 for those cards.
 | 
			
		||||
2) The current release is a WIP; among other things, the Linux build works
 | 
			
		||||
   only to some extent. Any help will be appreciated.
 | 
			
		||||
3) Glide3 can be found at http://sourceforge.net/projects/glide/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Known supported HW/OS:
 | 
			
		||||
----------------------
 | 
			
		||||
 | 
			
		||||
Voodoo^2, Voodoo Banshee, Voodoo3, Voodoo4, Voodoo5
 | 
			
		||||
DOS (DJGPP), Windows9x/2k (MinGW/MSVC), Linux
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
How to compile:
 | 
			
		||||
---------------
 | 
			
		||||
 | 
			
		||||
DJGPP/MinGW/MSVC:
 | 
			
		||||
   Place the Glide3 SDK in the top Mesa directory:
 | 
			
		||||
	$(MESA)/glide3/include/*.h
 | 
			
		||||
	$(MESA)/glide3/lib/
 | 
			
		||||
   Required headers:
 | 
			
		||||
	3dfx.h, g3ext.h, glide.h, glidesys.h, glideutl.h, sst1vid.h
 | 
			
		||||
   Required libraries:
 | 
			
		||||
	OS specific
 | 
			
		||||
   Type:
 | 
			
		||||
	make -f Makefile.DJ HAVE_MMX=1 HAVE_3DNOW=1 FX=1
 | 
			
		||||
	or
 | 
			
		||||
	make -f Makefile.mgw HAVE_MMX=1 HAVE_3DNOW=1 FX=1
 | 
			
		||||
	or
 | 
			
		||||
	nmake -f Makefile.wfx
 | 
			
		||||
   Look into the corresponding makefiles for further information.
 | 
			
		||||
 | 
			
		||||
Linux:
 | 
			
		||||
   Place the Glide3 SDK in /usr/local/glide
 | 
			
		||||
   Type:
 | 
			
		||||
	make linux-glide
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Contact:
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
Daniel Borca <dborca@users.sourceforge.net>
 | 
			
		||||
Hiroshi Morii <koolsmoky@users.sourceforge.net>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
The info below this line is outdated. You have been warned...
 | 
			
		||||
*************************************************************
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Info for Mesa 4.1
 | 
			
		||||
-----------------
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -209,11 +209,12 @@ v1.3 (mar-2003)
 | 
			
		||||
	* revamped GLUT
 | 
			
		||||
	* switched to DXE3
 | 
			
		||||
 | 
			
		||||
v1.4 (oct-2003)
 | 
			
		||||
v1.4 (nov-2003)
 | 
			
		||||
	+ enabled GLUT fonts with DXE
 | 
			
		||||
	+ truly added multi-window support in GLUT (for Adrian Woodward)
 | 
			
		||||
	* accomodated makefiles with the new sourcetree
 | 
			
		||||
	* fixed some ALPHA issues
 | 
			
		||||
	* minor changes to PC_HW/timer interface
 | 
			
		||||
	x hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,12 @@ Details and Notes
 | 
			
		||||
- No assembly code is compiled or assembled.  Again, this may need
 | 
			
		||||
  some work to turn it back on or use it again.
 | 
			
		||||
 | 
			
		||||
- To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
 | 
			
		||||
  to the project settings.  You will also need to edit src/mesa.def to change
 | 
			
		||||
  all the gl* symbols to mgl*.  Because this is easy to do with a global
 | 
			
		||||
  replace operation in a text editor, no additional mangled version of mesa.def
 | 
			
		||||
  is maintained or shipped.
 | 
			
		||||
 | 
			
		||||
If you have a Windows-related build problem or question, it is
 | 
			
		||||
probably better to direct it to me (kschultz@users.sourceforge.net),
 | 
			
		||||
rather than directly to the other Mesa developers.  I will help you
 | 
			
		||||
 
 | 
			
		||||
@@ -1164,10 +1164,17 @@ Mesa Version History
 | 
			
		||||
	- less memory used for display lists and vertex buffers
 | 
			
		||||
	- demo of per-pixel lighting with a fragment program (demos/fplight.c)
 | 
			
		||||
	- new version (18) of glext.h header
 | 
			
		||||
	- new spriteblast.c demo of GL_ARB_point_sprite
 | 
			
		||||
    Bug fixes:
 | 
			
		||||
	- really enable OpenGL 1.4 features in DOS driver.
 | 
			
		||||
	- fixed issues in glDrawPixels and glCopyPixels for very wide images
 | 
			
		||||
	- glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint
 | 
			
		||||
	- fixed some texgen bugs reported by Daniel Borca
 | 
			
		||||
	- fixed wglMakeCurrent(NULL, NULL) bug (#835861)
 | 
			
		||||
	- fixed glTexSubImage3D z-offset bug (Cedric Gautier)
 | 
			
		||||
	- fixed RGBA blend enable bug (Ville Syrjala)
 | 
			
		||||
	- glAccum is supposed to be a no-op in selection/feedback mode
 | 
			
		||||
	- fixed texgen bug #597589 (John Popplewell)
 | 
			
		||||
    Changes:
 | 
			
		||||
	- dropped API trace feature (src/Trace/)
 | 
			
		||||
	- documentation overhaul.  merged with website content.  more html.
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ available. Here are the basic instructions for Unix systems:
 | 
			
		||||
	login</code>
 | 
			
		||||
	</li><li>Just hit return at the <code>CVS password:</code> prompt.
 | 
			
		||||
	</li><li>Then checkout mesa: <code>cvs -z3 -d:pserver:anonymous@cvs.mesa3d.sourceforge.net:/cvsroot/mesa3d
 | 
			
		||||
	co Mesa</code>
 | 
			
		||||
	co Mesa-newtree</code>
 | 
			
		||||
</li></ol>
 | 
			
		||||
 | 
			
		||||
<p>To update your Mesa CVS source to the latest CVS source:
 | 
			
		||||
@@ -34,4 +34,4 @@ available. Here are the basic instructions for Unix systems:
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
</html>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,26 @@
 | 
			
		||||
<H1>News</H1>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<H2>November 12, 2003</H2>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
New Mesa 5.0.2 tarballs have been uploaded to SourceForge which fix a
 | 
			
		||||
number of automake/libtool problems.
 | 
			
		||||
</p>
 | 
			
		||||
<p>
 | 
			
		||||
The new MD5 checksums are:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
a9dcf3ff9ad1b7d6ce73a0df7cff8b5b  MesaLib-5.0.2.tar.gz
 | 
			
		||||
7b4bf9261657c2fca03796d4955e6f50  MesaLib-5.0.2.tar.bz2
 | 
			
		||||
79c141bddcbad557647535d02194f346  MesaLib-5.0.2.zip
 | 
			
		||||
952d9dc823dd818981d1a648d7b2668a  MesaDemos-5.0.2.tar.gz
 | 
			
		||||
b81fafff90995025d2f25ea02b786642  MesaDemos-5.0.2.tar.bz2
 | 
			
		||||
a21be975589e8a2d1871b6bb7874fffa  MesaDemos-5.0.2.zip
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>September 5, 2003</h2>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
@@ -39,18 +59,6 @@ Mesa 5.0.2 has been released.  This is a stable, bug-fix release.
 | 
			
		||||
    Changes:
 | 
			
		||||
	- build GLUT with -fexceptions so C++ apps propogate exceptions
 | 
			
		||||
</pre>
 | 
			
		||||
<p>
 | 
			
		||||
MD5 checksums follow:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
2deb4176e7a06a0477ae31cadd55444b  MesaLib-5.0.2.tar.gz
 | 
			
		||||
dc147598ebdff4312260a7f79b3c5c9c  MesaLib-5.0.2.tar.bz2
 | 
			
		||||
1eb0fa7079131efef574e3bda328b8c8  MesaLib-5.0.2.zip
 | 
			
		||||
e0dc86e9417620e794968641403604d4  MesaDemos-5.0.2.tar.gz
 | 
			
		||||
a71afaeddd0b567423f88085576850d3  MesaDemos-5.0.2.tar.bz2
 | 
			
		||||
32fbf1925cf45f548468ddda96087828  MesaDemos-5.0.2.zip
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -673,6 +681,6 @@ source code</a>.</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<hr>
 | 
			
		||||
$Id: news.html,v 3.7 2003/09/05 13:39:39 brianp Exp $
 | 
			
		||||
$Id: news.html,v 3.7.2.1 2003/11/24 12:01:42 keithw Exp $
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * FXMesa - 3Dfx Glide driver for Mesa.  Contributed by David Bucciarelli
 | 
			
		||||
 *
 | 
			
		||||
 * NOTE: This version requires Glide 2.3 or later.
 | 
			
		||||
 * NOTE: This version requires Glide3 (http://sourceforge.net/projects/glide)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2261,6 +2261,16 @@ typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC)(GLuint id, GLenum pname,
 | 
			
		||||
#endif /* GL_ARB_occlusion_query */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* XXX temporary until glext.h is updated! */
 | 
			
		||||
#ifndef GL_ARB_point_sprite
 | 
			
		||||
#define GL_ARB_point_sprite 1
 | 
			
		||||
 | 
			
		||||
#define GL_POINT_SPRITE_ARB                0x8861
 | 
			
		||||
#define GL_COORD_REPLACE_ARB               0x8862
 | 
			
		||||
 | 
			
		||||
#endif /* GL_ARB_point_sprite */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef GL_MESA_program_debug
 | 
			
		||||
#define GL_MESA_program_debug 1
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,10 @@
 | 
			
		||||
#define GLAPIENTRY
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef GLAPIENTRYP
 | 
			
		||||
#define GLAPIENTRYP GLAPIENTRY *
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef GLAPI
 | 
			
		||||
#define GLAPI
 | 
			
		||||
#endif
 | 
			
		||||
@@ -266,7 +270,7 @@ typedef GLUtesselator GLUtriangulatorObj;
 | 
			
		||||
#define GLU_TESS_MAX_COORD 1.0e150
 | 
			
		||||
 | 
			
		||||
/* Internal convenience typedefs */
 | 
			
		||||
typedef void (GLAPIENTRY *_GLUfuncptr)();
 | 
			
		||||
typedef void (GLAPIENTRYP _GLUfuncptr)();
 | 
			
		||||
 | 
			
		||||
GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
 | 
			
		||||
GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
 | 
			
		||||
 
 | 
			
		||||
@@ -80,5 +80,7 @@
 | 
			
		||||
#define gluBuild3DMipmaps mgluBuild3DMipmaps
 | 
			
		||||
#define gluCheckExtension mgluCheckExtension
 | 
			
		||||
#define gluUnProject4 mgluUnProject4
 | 
			
		||||
#define gluNurbsCallbackData mgluNurbsCallbackData
 | 
			
		||||
#define gluNurbsCallbackDataEXT mgluNurbsCallbackDataEXT
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -648,7 +648,7 @@ GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned in
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* GLUT color index sub-API. */
 | 
			
		||||
GLUTAPI void GLUTAPIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
 | 
			
		||||
GLUTAPI void GLUTAPIENTRY glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue);
 | 
			
		||||
GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
 | 
			
		||||
GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,6 @@
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
#define GL_GLEXT_LEGACY
 | 
			
		||||
#include <GL/glut.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -34,8 +34,6 @@ static GLboolean UseObj = GL_FALSE;
 | 
			
		||||
 | 
			
		||||
static void draw( void )
 | 
			
		||||
{
 | 
			
		||||
   glDepthFunc(GL_EQUAL);
 | 
			
		||||
   /*   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );*/
 | 
			
		||||
   glClear( GL_COLOR_BUFFER_BIT );
 | 
			
		||||
 | 
			
		||||
   glColor3f( 1.0, 1.0, 1.0 );
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ CC = mingw32-gcc
 | 
			
		||||
CFLAGS = -Wall -W -pedantic
 | 
			
		||||
CFLAGS += -O2 -ffast-math -mcpu=$(CPU)
 | 
			
		||||
CFLAGS += -I$(TOP)/include -I../util
 | 
			
		||||
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
 | 
			
		||||
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK -D_STDCALL_SUPPORTED
 | 
			
		||||
CFLAGS += -D_WINDEF_ -D_WINGDI_
 | 
			
		||||
 | 
			
		||||
LD = mingw32-g++
 | 
			
		||||
 
 | 
			
		||||
@@ -159,12 +159,48 @@ static void SpecialKey( int key, int x, int y )
 | 
			
		||||
static void MakeObject1(struct object *obj)
 | 
			
		||||
{
 | 
			
		||||
   GLfloat *v, *c;
 | 
			
		||||
   void *p;
 | 
			
		||||
   int i;
 | 
			
		||||
   GLubyte buffer[500];
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < 500; i++)
 | 
			
		||||
      buffer[i] = i & 0xff;
 | 
			
		||||
 | 
			
		||||
   glGenBuffersARB(1, &obj->BufferID);
 | 
			
		||||
   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
 | 
			
		||||
   glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, NULL, GL_STATIC_DRAW_ARB);
 | 
			
		||||
   glBufferDataARB(GL_ARRAY_BUFFER_ARB, 500, buffer, GL_STATIC_DRAW_ARB);
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < 500; i++)
 | 
			
		||||
      buffer[i] = 0;
 | 
			
		||||
 | 
			
		||||
   glGetBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 500, buffer);
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < 500; i++)
 | 
			
		||||
      assert(buffer[i] == (i & 0xff));
 | 
			
		||||
 | 
			
		||||
   glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i);
 | 
			
		||||
   assert(!i);
 | 
			
		||||
 | 
			
		||||
   glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i);
 | 
			
		||||
 | 
			
		||||
   v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
 | 
			
		||||
 | 
			
		||||
   /* do some sanity tests */
 | 
			
		||||
   glGetBufferPointervARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAP_POINTER_ARB, &p);
 | 
			
		||||
   assert(p == v);
 | 
			
		||||
 | 
			
		||||
   glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &i);
 | 
			
		||||
   assert(i == 500);
 | 
			
		||||
 | 
			
		||||
   glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i);
 | 
			
		||||
   assert(i == GL_STATIC_DRAW_ARB);
 | 
			
		||||
 | 
			
		||||
   glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_ACCESS_ARB, &i);
 | 
			
		||||
   assert(i == GL_WRITE_ONLY_ARB);
 | 
			
		||||
 | 
			
		||||
   glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i);
 | 
			
		||||
   assert(i);
 | 
			
		||||
 | 
			
		||||
   /* Make rectangle */
 | 
			
		||||
   v[0] = -1;  v[1] = -1;  v[2] = 0;
 | 
			
		||||
   v[3] =  1;  v[4] = -1;  v[5] = 0;
 | 
			
		||||
@@ -181,6 +217,12 @@ static void MakeObject1(struct object *obj)
 | 
			
		||||
   obj->NumElements = 0;
 | 
			
		||||
 | 
			
		||||
   glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
 | 
			
		||||
 | 
			
		||||
   glGetBufferPointervARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAP_POINTER_ARB, &p);
 | 
			
		||||
   assert(!p);
 | 
			
		||||
 | 
			
		||||
   glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i);
 | 
			
		||||
   assert(!i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -212,20 +254,18 @@ static void MakeObject2(struct object *obj)
 | 
			
		||||
 | 
			
		||||
static void MakeObject3(struct object *obj)
 | 
			
		||||
{
 | 
			
		||||
   GLfloat vertexData[1000];
 | 
			
		||||
   GLfloat *v, *c;
 | 
			
		||||
   GLuint *i;
 | 
			
		||||
 | 
			
		||||
   glGenBuffersARB(1, &obj->BufferID);
 | 
			
		||||
   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
 | 
			
		||||
   glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, NULL, GL_STATIC_DRAW_ARB);
 | 
			
		||||
   v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
 | 
			
		||||
   int bytes;
 | 
			
		||||
 | 
			
		||||
   /* Make rectangle */
 | 
			
		||||
   v = vertexData;
 | 
			
		||||
   v[0] = -1;  v[1] = -0.5;  v[2] = 0;
 | 
			
		||||
   v[3] =  1;  v[4] = -0.5;  v[5] = 0;
 | 
			
		||||
   v[6] =  1;  v[7] =  0.5;  v[8] = 0;
 | 
			
		||||
   v[9] = -1;  v[10] = 0.5;  v[11] = 0;
 | 
			
		||||
   c = v + 12;
 | 
			
		||||
   c = vertexData + 12;
 | 
			
		||||
   c[0] = 0;  c[1] = 0;  c[2] = 1;
 | 
			
		||||
   c[3] = 0;  c[4] = 0;  c[5] = 1;
 | 
			
		||||
   c[6] = 0;  c[7] = 1;  c[8] = 1;
 | 
			
		||||
@@ -234,7 +274,12 @@ static void MakeObject3(struct object *obj)
 | 
			
		||||
   obj->VertexOffset = 0;
 | 
			
		||||
   obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts;
 | 
			
		||||
 | 
			
		||||
   glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
 | 
			
		||||
   bytes = obj->NumVerts * (3 + 3) * sizeof(GLfloat);
 | 
			
		||||
 | 
			
		||||
   /* Don't use glMap/UnmapBuffer for this object */
 | 
			
		||||
   glGenBuffersARB(1, &obj->BufferID);
 | 
			
		||||
   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
 | 
			
		||||
   glBufferDataARB(GL_ARRAY_BUFFER_ARB, bytes, vertexData, GL_STATIC_DRAW_ARB);
 | 
			
		||||
 | 
			
		||||
   /* Setup a buffer of indices to test the ELEMENTS path */
 | 
			
		||||
   glGenBuffersARB(1, &obj->ElementsBufferID);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										389
									
								
								progs/tests/texcmp.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										389
									
								
								progs/tests/texcmp.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,389 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Compressed texture demo.  Written by Daniel Borca.
 | 
			
		||||
 * This program is in the public domain.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#define GL_GLEXT_PROTOTYPES 1
 | 
			
		||||
#include <GL/glut.h>
 | 
			
		||||
 | 
			
		||||
#include "readtex.c" /* I know, this is a hack. */
 | 
			
		||||
#define TEXTURE_FILE "../images/tree2.rgba"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static float Rot = 0.0;
 | 
			
		||||
static GLboolean Anim = 1;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
        GLubyte *data;
 | 
			
		||||
        GLuint size;
 | 
			
		||||
        GLenum format;
 | 
			
		||||
        GLuint w, h;
 | 
			
		||||
 | 
			
		||||
        GLenum TC;
 | 
			
		||||
 | 
			
		||||
        GLubyte *cData;
 | 
			
		||||
        GLuint cSize;
 | 
			
		||||
        GLenum cFormat;
 | 
			
		||||
} TEXTURE;
 | 
			
		||||
 | 
			
		||||
static TEXTURE *Tx, t1, t2, t3;
 | 
			
		||||
static GLboolean fxt1, dxtc, s3tc;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static const char *TextureName (GLenum TC)
 | 
			
		||||
{
 | 
			
		||||
 switch (TC) {
 | 
			
		||||
        case GL_RGBA:
 | 
			
		||||
             return "RGBA";
 | 
			
		||||
        case GL_COMPRESSED_RGB:
 | 
			
		||||
             return "COMPRESSED_RGB";
 | 
			
		||||
        case GL_COMPRESSED_RGBA:
 | 
			
		||||
             return "COMPRESSED_RGBA";
 | 
			
		||||
        case GL_COMPRESSED_RGB_FXT1_3DFX:
 | 
			
		||||
             return "GL_COMPRESSED_RGB_FXT1_3DFX";
 | 
			
		||||
        case GL_COMPRESSED_RGBA_FXT1_3DFX:
 | 
			
		||||
             return "GL_COMPRESSED_RGBA_FXT1_3DFX";
 | 
			
		||||
        case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
 | 
			
		||||
             return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
 | 
			
		||||
        case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
 | 
			
		||||
             return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
 | 
			
		||||
        case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
 | 
			
		||||
             return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
 | 
			
		||||
        case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
 | 
			
		||||
             return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
 | 
			
		||||
        case GL_RGB_S3TC:
 | 
			
		||||
             return "GL_RGB_S3TC";
 | 
			
		||||
        case GL_RGB4_S3TC:
 | 
			
		||||
             return "GL_RGB4_S3TC";
 | 
			
		||||
        case GL_RGBA_S3TC:
 | 
			
		||||
             return "GL_RGBA_S3TC";
 | 
			
		||||
        case GL_RGBA4_S3TC:
 | 
			
		||||
             return "GL_RGBA4_S3TC";
 | 
			
		||||
        default:
 | 
			
		||||
             return "?";
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
PrintString(const char *s)
 | 
			
		||||
{
 | 
			
		||||
   while (*s) {
 | 
			
		||||
      glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
 | 
			
		||||
      s++;
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void Idle( void )
 | 
			
		||||
{
 | 
			
		||||
   float t = glutGet(GLUT_ELAPSED_TIME) * 0.001;  /* in seconds */
 | 
			
		||||
   Rot = t * 360 / 4;  /* 1 rotation per 4 seconds */
 | 
			
		||||
   glutPostRedisplay();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void Display( void )
 | 
			
		||||
{
 | 
			
		||||
   /* draw background gradient */
 | 
			
		||||
   glDisable(GL_TEXTURE_2D);
 | 
			
		||||
   glBegin(GL_POLYGON);
 | 
			
		||||
   glColor3f(1.0, 0.0, 0.2); glVertex2f(-1.5, -1.0);
 | 
			
		||||
   glColor3f(1.0, 0.0, 0.2); glVertex2f( 1.5, -1.0);
 | 
			
		||||
   glColor3f(0.0, 0.0, 1.0); glVertex2f( 1.5,  1.0);
 | 
			
		||||
   glColor3f(0.0, 0.0, 1.0); glVertex2f(-1.5,  1.0);
 | 
			
		||||
   glEnd();
 | 
			
		||||
 | 
			
		||||
   glPushMatrix();
 | 
			
		||||
   glRotatef(Rot, 0, 0, 1);
 | 
			
		||||
 | 
			
		||||
   glEnable(GL_TEXTURE_2D);
 | 
			
		||||
   glBegin(GL_POLYGON);
 | 
			
		||||
   glTexCoord2f(0, 1);  glVertex2f(-1, -0.5);
 | 
			
		||||
   glTexCoord2f(1, 1);  glVertex2f( 1, -0.5);
 | 
			
		||||
   glTexCoord2f(1, 0);  glVertex2f( 1,  0.5);
 | 
			
		||||
   glTexCoord2f(0, 0);  glVertex2f(-1,  0.5);
 | 
			
		||||
   glEnd();
 | 
			
		||||
 | 
			
		||||
   glPopMatrix();
 | 
			
		||||
 | 
			
		||||
   /* info */
 | 
			
		||||
   glColor4f(1, 1, 1, 1);
 | 
			
		||||
 | 
			
		||||
   glRasterPos3f(-1.2, -0.7, 0);
 | 
			
		||||
   PrintString("Selected: ");
 | 
			
		||||
   PrintString(TextureName(Tx->TC));
 | 
			
		||||
   if (Tx->cData) {
 | 
			
		||||
      char tmp[64];
 | 
			
		||||
      glRasterPos3f(-1.2, -0.8, 0);
 | 
			
		||||
      PrintString("Internal: ");
 | 
			
		||||
      PrintString(TextureName(Tx->cFormat));
 | 
			
		||||
      glRasterPos3f(-1.2, -0.9, 0);
 | 
			
		||||
      PrintString("Size    : ");
 | 
			
		||||
      sprintf(tmp, "%d (%d%% of %d)", Tx->cSize, Tx->cSize * 100 / Tx->size, Tx->size);
 | 
			
		||||
      PrintString(tmp);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   glutSwapBuffers();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void Reshape( int width, int height )
 | 
			
		||||
{
 | 
			
		||||
   glViewport( 0, 0, width, height );
 | 
			
		||||
   glMatrixMode( GL_PROJECTION );
 | 
			
		||||
   glLoadIdentity();
 | 
			
		||||
   glOrtho( -1.5, 1.5, -1.0, 1.0, -1.0, 1.0 );
 | 
			
		||||
   glMatrixMode( GL_MODELVIEW );
 | 
			
		||||
   glLoadIdentity();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void ReInit( GLenum TC, TEXTURE *Tx )
 | 
			
		||||
{
 | 
			
		||||
   GLint rv;
 | 
			
		||||
 | 
			
		||||
   if ((Tx->TC == TC) && (Tx->cData != NULL)) {
 | 
			
		||||
      glCompressedTexImage2DARB(GL_TEXTURE_2D, /* target */
 | 
			
		||||
	                        0,             /* level */
 | 
			
		||||
	                        Tx->cFormat,   /* real format */
 | 
			
		||||
	                        Tx->w,         /* original width */
 | 
			
		||||
	                        Tx->h,         /* original height */
 | 
			
		||||
	                        0,             /* border */
 | 
			
		||||
	                        Tx->cSize,     /* compressed size*/
 | 
			
		||||
	                        Tx->cData);    /* compressed data*/
 | 
			
		||||
   } else {
 | 
			
		||||
      glTexImage2D(GL_TEXTURE_2D,    /* target */
 | 
			
		||||
                   0,                /* level */
 | 
			
		||||
                   TC,               /* internal format */
 | 
			
		||||
                   Tx->w, Tx->h,     /* width, height */
 | 
			
		||||
                   0,                /* border */
 | 
			
		||||
                   Tx->format,       /* texture format */
 | 
			
		||||
                   GL_UNSIGNED_BYTE, /* texture type */
 | 
			
		||||
                   Tx->data);        /* the texture */
 | 
			
		||||
 | 
			
		||||
      /* okay, now cache the compressed texture */
 | 
			
		||||
      Tx->TC = TC;
 | 
			
		||||
      if (Tx->cData != NULL) {
 | 
			
		||||
         free(Tx->cData);
 | 
			
		||||
         Tx->cData = NULL;
 | 
			
		||||
      }
 | 
			
		||||
      glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &rv);
 | 
			
		||||
      if (rv) {
 | 
			
		||||
         glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&Tx->cFormat);
 | 
			
		||||
         glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, (GLint *)&Tx->cSize);
 | 
			
		||||
         if ((Tx->cData = malloc(Tx->cSize)) != NULL) {
 | 
			
		||||
            glGetCompressedTexImageARB(GL_TEXTURE_2D, 0, Tx->cData);
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void Init( void )
 | 
			
		||||
{
 | 
			
		||||
   /* HEIGHT * WIDTH + 1 (for trailing '\0') */
 | 
			
		||||
   static char pattern[8 * 32 + 1] = {"\
 | 
			
		||||
                                \
 | 
			
		||||
    MMM    EEEE   SSS    AAA    \
 | 
			
		||||
   M M M  E      S   S  A   A   \
 | 
			
		||||
   M M M  EEEE    SS    A   A   \
 | 
			
		||||
   M M M  E         SS  AAAAA   \
 | 
			
		||||
   M   M  E      S   S  A   A   \
 | 
			
		||||
   M   M   EEEE   SSS   A   A   \
 | 
			
		||||
                                "
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
   GLuint i, j;
 | 
			
		||||
 | 
			
		||||
   GLubyte (*texture1)[8 * 32][4];
 | 
			
		||||
   GLubyte (*texture2)[256][256][4];
 | 
			
		||||
 | 
			
		||||
   t1.w = 32;
 | 
			
		||||
   t1.h = 8;
 | 
			
		||||
   t1.size = t1.w * t1.h * 4;
 | 
			
		||||
   t1.data = malloc(t1.size);
 | 
			
		||||
   t1.format = GL_RGBA;
 | 
			
		||||
   t1.TC = GL_RGBA;
 | 
			
		||||
 | 
			
		||||
   texture1 = (GLubyte (*)[8 * 32][4])t1.data;
 | 
			
		||||
   for (i = 0; i < sizeof(pattern) - 1; i++) {
 | 
			
		||||
       switch (pattern[i]) {
 | 
			
		||||
              default:
 | 
			
		||||
              case ' ':
 | 
			
		||||
                   (*texture1)[i][0] = 255;
 | 
			
		||||
                   (*texture1)[i][1] = 255;
 | 
			
		||||
                   (*texture1)[i][2] = 255;
 | 
			
		||||
                   (*texture1)[i][3] = 64;
 | 
			
		||||
                   break;
 | 
			
		||||
              case 'M':
 | 
			
		||||
                   (*texture1)[i][0] = 255;
 | 
			
		||||
                   (*texture1)[i][1] = 0;
 | 
			
		||||
                   (*texture1)[i][2] = 0;
 | 
			
		||||
                   (*texture1)[i][3] = 255;
 | 
			
		||||
                   break;
 | 
			
		||||
              case 'E':
 | 
			
		||||
                   (*texture1)[i][0] = 0;
 | 
			
		||||
                   (*texture1)[i][1] = 255;
 | 
			
		||||
                   (*texture1)[i][2] = 0;
 | 
			
		||||
                   (*texture1)[i][3] = 255;
 | 
			
		||||
                   break;
 | 
			
		||||
              case 'S':
 | 
			
		||||
                   (*texture1)[i][0] = 0;
 | 
			
		||||
                   (*texture1)[i][1] = 0;
 | 
			
		||||
                   (*texture1)[i][2] = 255;
 | 
			
		||||
                   (*texture1)[i][3] = 255;
 | 
			
		||||
                   break;
 | 
			
		||||
              case 'A':
 | 
			
		||||
                   (*texture1)[i][0] = 255;
 | 
			
		||||
                   (*texture1)[i][1] = 255;
 | 
			
		||||
                   (*texture1)[i][2] = 0;
 | 
			
		||||
                   (*texture1)[i][3] = 255;
 | 
			
		||||
                   break;
 | 
			
		||||
       }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   t2.w = 256;
 | 
			
		||||
   t2.h = 256;
 | 
			
		||||
   t2.size = t2.w * t2.h * 4;
 | 
			
		||||
   t2.data = malloc(t2.size);
 | 
			
		||||
   t2.format = GL_RGBA;
 | 
			
		||||
   t2.TC = GL_RGBA;
 | 
			
		||||
 | 
			
		||||
   texture2 = (GLubyte (*)[256][256][4])t2.data;
 | 
			
		||||
   for (j = 0; j < t2.h; j++) {
 | 
			
		||||
      for (i = 0; i < t2.w; i++) {
 | 
			
		||||
         (*texture2)[j][i][0] = sqrt(i * j * 255 * 255 / (t2.w * t2.h));
 | 
			
		||||
         (*texture2)[j][i][1] = 0;
 | 
			
		||||
         (*texture2)[j][i][2] = 0;
 | 
			
		||||
         (*texture2)[j][i][3] = 255;
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   t3.data = LoadRGBImage(TEXTURE_FILE, (GLint *)&t3.w, (GLint *)&t3.h, &t3.format);
 | 
			
		||||
   t3.size = t3.w * t3.h * ((t3.format == GL_RGB) ? 3 : 4);
 | 
			
		||||
   t3.TC = GL_RGBA;
 | 
			
		||||
 | 
			
		||||
   ReInit(GL_RGBA, Tx = &t1);
 | 
			
		||||
 | 
			
		||||
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 | 
			
		||||
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 | 
			
		||||
   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 | 
			
		||||
   glEnable(GL_TEXTURE_2D);
 | 
			
		||||
 | 
			
		||||
   glEnable(GL_BLEND);
 | 
			
		||||
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void Key( unsigned char key, int x, int y )
 | 
			
		||||
{
 | 
			
		||||
   (void) x;
 | 
			
		||||
   (void) y;
 | 
			
		||||
   switch (key) {
 | 
			
		||||
      case 27:
 | 
			
		||||
         exit(0);
 | 
			
		||||
         break;
 | 
			
		||||
      case ' ':
 | 
			
		||||
         Anim = !Anim;
 | 
			
		||||
         if (Anim)
 | 
			
		||||
            glutIdleFunc( Idle );
 | 
			
		||||
         else
 | 
			
		||||
            glutIdleFunc( NULL );
 | 
			
		||||
         break;
 | 
			
		||||
      case 't':
 | 
			
		||||
         if (Tx == &t1) {
 | 
			
		||||
            Tx = &t2;
 | 
			
		||||
         } else if (Tx == &t2) {
 | 
			
		||||
            Tx = &t3;
 | 
			
		||||
         } else {
 | 
			
		||||
            Tx = &t1;
 | 
			
		||||
         }
 | 
			
		||||
         ReInit(Tx->TC, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '0':
 | 
			
		||||
         ReInit(GL_RGBA, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '1':
 | 
			
		||||
         ReInit(GL_COMPRESSED_RGB, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '2':
 | 
			
		||||
         ReInit(GL_COMPRESSED_RGBA, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '3':
 | 
			
		||||
         if (fxt1) ReInit(GL_COMPRESSED_RGB_FXT1_3DFX, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '4':
 | 
			
		||||
         if (fxt1) ReInit(GL_COMPRESSED_RGBA_FXT1_3DFX, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '5':
 | 
			
		||||
         if (dxtc) ReInit(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '6':
 | 
			
		||||
         if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '7':
 | 
			
		||||
         if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case '8':
 | 
			
		||||
         if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case 'a':
 | 
			
		||||
         if (s3tc) ReInit(GL_RGB_S3TC, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case 's':
 | 
			
		||||
         if (s3tc) ReInit(GL_RGB4_S3TC, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case 'd':
 | 
			
		||||
         if (s3tc) ReInit(GL_RGBA_S3TC, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
      case 'f':
 | 
			
		||||
         if (s3tc) ReInit(GL_RGBA4_S3TC, Tx);
 | 
			
		||||
         break;
 | 
			
		||||
   }
 | 
			
		||||
   glutPostRedisplay();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main( int argc, char *argv[] )
 | 
			
		||||
{
 | 
			
		||||
   glutInit( &argc, argv );
 | 
			
		||||
   glutInitWindowPosition( 0, 0 );
 | 
			
		||||
   glutInitWindowSize( 400, 300 );
 | 
			
		||||
 | 
			
		||||
   glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
 | 
			
		||||
 | 
			
		||||
   if (glutCreateWindow(argv[0]) <= 0) {
 | 
			
		||||
      printf("Couldn't create window\n");
 | 
			
		||||
      exit(0);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (!glutExtensionSupported("GL_ARB_texture_compression")) {
 | 
			
		||||
      printf("Sorry, GL_ARB_texture_compression not supported\n");
 | 
			
		||||
      exit(0);
 | 
			
		||||
   }
 | 
			
		||||
   if (glutExtensionSupported("GL_3DFX_texture_compression_FXT1")) {
 | 
			
		||||
      fxt1 = GL_TRUE;
 | 
			
		||||
   }
 | 
			
		||||
   if (glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
 | 
			
		||||
      dxtc = GL_TRUE;
 | 
			
		||||
   }
 | 
			
		||||
   if (glutExtensionSupported("GL_S3_s3tc")) {
 | 
			
		||||
      s3tc = GL_TRUE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   Init();
 | 
			
		||||
 | 
			
		||||
   glutReshapeFunc( Reshape );
 | 
			
		||||
   glutKeyboardFunc( Key );
 | 
			
		||||
   glutDisplayFunc( Display );
 | 
			
		||||
   if (Anim)
 | 
			
		||||
      glutIdleFunc( Idle );
 | 
			
		||||
 | 
			
		||||
   glutMainLoop();
 | 
			
		||||
   return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,18 +1,38 @@
 | 
			
		||||
/*
 | 
			
		||||
** gluos.h - operating system dependencies for GLU
 | 
			
		||||
**
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.5 2003/02/12 16:04:07 brianp Exp $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.5.4.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
#ifdef __VMS
 | 
			
		||||
#ifdef __cplusplus 
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
#pragma message disable nocordel
 | 
			
		||||
#pragma message disable codeunreachable
 | 
			
		||||
#pragma message disable codcauunr
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include <stdlib.h>         /* For _MAX_PATH definition */
 | 
			
		||||
#ifdef __WATCOMC__
 | 
			
		||||
/* Disable *lots* of warnings to get a clean build. I can't be bothered fixing the
 | 
			
		||||
 * code at the moment, as it is pretty ugly.
 | 
			
		||||
 */
 | 
			
		||||
#pragma warning 7   10
 | 
			
		||||
#pragma warning 13  10
 | 
			
		||||
#pragma warning 14  10
 | 
			
		||||
#pragma warning 367 10
 | 
			
		||||
#pragma warning 379 10
 | 
			
		||||
#pragma warning 726 10
 | 
			
		||||
#pragma warning 836 10
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef BUILD_FOR_SNAP
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <malloc.h>
 | 
			
		||||
 | 
			
		||||
#elif defined(_WIN32)
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>	    /* For _MAX_PATH definition */
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <malloc.h>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -31,10 +31,10 @@
 | 
			
		||||
** published by SGI, but has not been independently verified as being
 | 
			
		||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
 | 
			
		||||
** $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.14.1 $
 | 
			
		||||
*/
 | 
			
		||||
/*
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.2.14.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
@@ -43,6 +43,10 @@
 | 
			
		||||
#include <math.h>
 | 
			
		||||
#include "bezierEval.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __WATCOMC__
 | 
			
		||||
#pragma warning 14  10
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define TOLERANCE 0.0001
 | 
			
		||||
 | 
			
		||||
#ifndef MAX_ORDER
 | 
			
		||||
@@ -88,7 +92,7 @@ void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*order = degree +1 >=1.
 | 
			
		||||
 */
 | 
			
		||||
@@ -109,7 +113,7 @@ void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int st
 | 
			
		||||
	buf[r][i][j] = (1-uprime)*buf[r-1][i][j] + uprime*buf[r-1][i+1][j];
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  for(j=0; j<dimension; j++)
 | 
			
		||||
    retpoint[j] = buf[order-1][0][j];
 | 
			
		||||
}
 | 
			
		||||
@@ -135,10 +139,10 @@ void bezierCurveEvalDer(float u0, float u1, int order, float *ctlpoints, int str
 | 
			
		||||
    }
 | 
			
		||||
    ctlptr += stride;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  bezierCurveEval(u0, u1, order-1, (float*) buf, MAX_DIMENSION,  dimension, u, retDer);
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
void bezierCurveEvalDerGen(int der, float u0, float u1, int order, float *ctlpoints, int stride,  int dimension, float u, float retDer[])
 | 
			
		||||
{
 | 
			
		||||
  int i,k,r;
 | 
			
		||||
@@ -179,12 +183,12 @@ void bezierSurfEvalDerGen(int uder, int vder, float u0, float u1, int uorder, fl
 | 
			
		||||
    bezierCurveEvalDerGen(vder, v0, v1, vorder, ctlpoints+ustride*i, vstride, dimension, v, newPoints[i]);
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  bezierCurveEvalDerGen(uder, u0, u1, uorder, (float *) newPoints, MAX_DIMENSION, dimension, u, ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*division by w is performed*/    
 | 
			
		||||
/*division by w is performed*/
 | 
			
		||||
void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[])
 | 
			
		||||
{
 | 
			
		||||
  bezierSurfEvalDerGen(0, 0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, ret);
 | 
			
		||||
@@ -192,7 +196,7 @@ void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vord
 | 
			
		||||
    ret[0] /= ret[3];
 | 
			
		||||
    ret[1] /= ret[3];
 | 
			
		||||
    ret[2] /= ret[3];
 | 
			
		||||
  }    
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float retNormal[])
 | 
			
		||||
@@ -202,7 +206,7 @@ void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, in
 | 
			
		||||
  assert(dimension>=3 && dimension <=4);
 | 
			
		||||
  bezierSurfEvalDerGen(1,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialU);
 | 
			
		||||
  bezierSurfEvalDerGen(0,1, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialV);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if(dimension == 3){/*inhomogeneous*/
 | 
			
		||||
    crossProduct(partialU, partialV, retNormal);
 | 
			
		||||
 | 
			
		||||
@@ -215,11 +219,11 @@ void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, in
 | 
			
		||||
    float newPartialU[MAX_DIMENSION];
 | 
			
		||||
    float newPartialV[MAX_DIMENSION];
 | 
			
		||||
    int i;
 | 
			
		||||
    bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val);    
 | 
			
		||||
    bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val);
 | 
			
		||||
 | 
			
		||||
    for(i=0; i<=2; i++){
 | 
			
		||||
      newPartialU[i] = partialU[i] * val[3] - val[i] * partialU[3];
 | 
			
		||||
      newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3];      
 | 
			
		||||
      newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3];
 | 
			
		||||
    }
 | 
			
		||||
    crossProduct(newPartialU, newPartialV, retNormal);
 | 
			
		||||
    normalize(retNormal);
 | 
			
		||||
@@ -231,7 +235,7 @@ static void normalize(float vec[3])
 | 
			
		||||
{
 | 
			
		||||
  float size = (float)sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
 | 
			
		||||
 | 
			
		||||
  if(size < TOLERANCE) 
 | 
			
		||||
  if(size < TOLERANCE)
 | 
			
		||||
    {
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
      fprintf(stderr, "Warning: in oglBSpline.c normal is 0\n");
 | 
			
		||||
@@ -244,7 +248,7 @@ static void normalize(float vec[3])
 | 
			
		||||
    vec[2] = vec[2]/size;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void crossProduct(float x[3], float y[3], float ret[3])
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * glcurveval.h
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2003/04/30 15:20:37 $ $Revision: 1.5 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.h,v 1.5 2003/04/30 15:20:37 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.5.2.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.h,v 1.5.2.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __gluglcurveval_h_
 | 
			
		||||
@@ -72,7 +72,7 @@ typedef struct curveEvalMachine{
 | 
			
		||||
class OpenGLCurveEvaluator : public BasicCurveEvaluator  {  
 | 
			
		||||
public:
 | 
			
		||||
			OpenGLCurveEvaluator(void);
 | 
			
		||||
			~OpenGLCurveEvaluator(void);
 | 
			
		||||
			virtual ~OpenGLCurveEvaluator(void);
 | 
			
		||||
    void		range1f(long, REAL *, REAL *);
 | 
			
		||||
    void		domain1f(REAL, REAL);
 | 
			
		||||
    void		addMap(CurveMap *);
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -31,10 +31,10 @@
 | 
			
		||||
** published by SGI, but has not been independently verified as being
 | 
			
		||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
 | 
			
		||||
** $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $
 | 
			
		||||
*/
 | 
			
		||||
/*
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include "gluos.h"
 | 
			
		||||
@@ -99,7 +99,7 @@ GLUnurbs::GLUnurbs()
 | 
			
		||||
    //default autoloadmode is true
 | 
			
		||||
    autoloadmode = 1;
 | 
			
		||||
 | 
			
		||||
    //default callbackFlag is 0 
 | 
			
		||||
    //default callbackFlag is 0
 | 
			
		||||
    callbackFlag = 0;
 | 
			
		||||
 | 
			
		||||
    errorCallback = NULL;
 | 
			
		||||
@@ -127,8 +127,8 @@ GLUnurbs::errorHandler(int i)
 | 
			
		||||
    postError( gluError );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
GLUnurbs::loadGLMatrices(void) 
 | 
			
		||||
void
 | 
			
		||||
GLUnurbs::loadGLMatrices(void)
 | 
			
		||||
{
 | 
			
		||||
    GLfloat vmat[4][4];
 | 
			
		||||
    GLint viewport[4];
 | 
			
		||||
@@ -140,20 +140,20 @@ GLUnurbs::loadGLMatrices(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16], 
 | 
			
		||||
GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16],
 | 
			
		||||
			  const GLfloat projMatrix[16],
 | 
			
		||||
			  const GLint viewport[4])
 | 
			
		||||
{
 | 
			
		||||
    GLfloat vmat[4][4];
 | 
			
		||||
 | 
			
		||||
    multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix, 
 | 
			
		||||
    multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix,
 | 
			
		||||
	    (const GLfloat (*)[4]) projMatrix);
 | 
			
		||||
    loadCullingMatrix((GLfloat (*)[4]) vmat);
 | 
			
		||||
    loadSamplingMatrix((const GLfloat (*)[4]) vmat, (const GLint *) viewport);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*--------------------------------------------------------------------------
 | 
			
		||||
 * grabGLMatrix  
 | 
			
		||||
 * grabGLMatrix
 | 
			
		||||
 *--------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@@ -164,8 +164,8 @@ GLUnurbs::grabGLMatrix(GLfloat vmat[4][4])
 | 
			
		||||
 | 
			
		||||
    ::glGetFloatv((GLenum) GL_MODELVIEW_MATRIX, (GLfloat *) &(m1[0][0]));
 | 
			
		||||
    ::glGetFloatv((GLenum) GL_PROJECTION_MATRIX, (GLfloat *) &(m2[0][0]));
 | 
			
		||||
    multmatrix4d((GLfloat (*)[4]) vmat, 
 | 
			
		||||
	    (GLfloat (*)[4]) m1, (GLfloat (*)[4]) m2);
 | 
			
		||||
    multmatrix4d((GLfloat (*)[4]) vmat,
 | 
			
		||||
	    (const GLfloat (*)[4]) m1, (const GLfloat (*)[4]) m2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//for object space tesselation: view independent
 | 
			
		||||
@@ -180,27 +180,27 @@ GLUnurbs::setSamplingMatrixIdentity( void )
 | 
			
		||||
  };
 | 
			
		||||
  const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]);
 | 
			
		||||
  const long cstride = 1;
 | 
			
		||||
  
 | 
			
		||||
  setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
 | 
			
		||||
  setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
		   cstride);
 | 
			
		||||
  setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
  setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
		   cstride);
 | 
			
		||||
  setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
  setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
		   cstride);
 | 
			
		||||
  setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
  setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
		   cstride);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], 
 | 
			
		||||
GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4],
 | 
			
		||||
			       const GLint viewport[4])
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    /* rescale the mapping to correspond to pixels in x/y */
 | 
			
		||||
    REAL xsize = 0.5 * (REAL) (viewport[2]);
 | 
			
		||||
    REAL ysize = 0.5 * (REAL) (viewport[3]);
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
    INREAL smat[4][4];
 | 
			
		||||
    smat[0][0] = vmat[0][0] * xsize;
 | 
			
		||||
    smat[1][0] = vmat[1][0] * xsize;
 | 
			
		||||
@@ -225,13 +225,13 @@ GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4],
 | 
			
		||||
    const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]);
 | 
			
		||||
    const long cstride = 1;
 | 
			
		||||
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -263,14 +263,14 @@ GLUnurbs::loadCullingMatrix(GLfloat vmat[4][4])
 | 
			
		||||
    const long rstride = sizeof(cmat[0]) / sizeof(cmat[0][0]);
 | 
			
		||||
    const long cstride = 1;
 | 
			
		||||
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
	//added for curves by zl
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, 
 | 
			
		||||
    setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride,
 | 
			
		||||
	    cstride);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * glsurfeval.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/07/16 15:46:42 $ $Revision: 1.2 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.2 2001/07/16 15:46:42 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Polynomial Evaluator Interface */
 | 
			
		||||
@@ -58,14 +58,14 @@
 | 
			
		||||
/*#define NO_EVALUATION*/
 | 
			
		||||
 | 
			
		||||
//#define USE_LOD //for LOD test, have to turn on USE_LOD in insurfeval.c++ too
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
/*for statistics*/
 | 
			
		||||
//#define STATISTICS
 | 
			
		||||
#ifdef STATISTICS
 | 
			
		||||
static int STAT_num_of_triangles=0;
 | 
			
		||||
static int STAT_num_of_eval_vertices=0;
 | 
			
		||||
static int STAT_num_of_quad_strips=0;
 | 
			
		||||
#endif 
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*for output triangles*/
 | 
			
		||||
/*#define OUTPUT_TRIANGLES*/
 | 
			
		||||
@@ -74,16 +74,16 @@ static int STAT_num_of_quad_strips=0;
 | 
			
		||||
/*#define FOR_CHRIS*/
 | 
			
		||||
#ifdef FOR_CHRIS
 | 
			
		||||
extern "C"  {  void                evalUStripExt(int n_upper, REAL v_upper, REAL* upper_val,
 | 
			
		||||
                                   int n_lower, REAL v_lower, REAL* lower_val);}
 | 
			
		||||
				   int n_lower, REAL v_lower, REAL* lower_val);}
 | 
			
		||||
 | 
			
		||||
extern "C" {   void                evalVStripExt(int n_left, REAL u_left, REAL* left_val,
 | 
			
		||||
                                   int n_right, REAL u_right, REAL* right_val);
 | 
			
		||||
				   int n_right, REAL u_right, REAL* right_val);
 | 
			
		||||
	     }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**************begin for LOD_eval_list***********/
 | 
			
		||||
void OpenGLSurfaceEvaluator::LOD_eval_list(int level) 
 | 
			
		||||
void OpenGLSurfaceEvaluator::LOD_eval_list(int level)
 | 
			
		||||
{
 | 
			
		||||
  if(level == 0)
 | 
			
		||||
    LOD_eval_level = 1;
 | 
			
		||||
@@ -98,8 +98,8 @@ void OpenGLSurfaceEvaluator::LOD_eval_list(int level)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() 
 | 
			
		||||
{ 
 | 
			
		||||
OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator()
 | 
			
		||||
{
 | 
			
		||||
    int i;
 | 
			
		||||
 | 
			
		||||
    for (i=0; i<VERTEX_CACHE_SIZE; i++) {
 | 
			
		||||
@@ -120,7 +120,7 @@ OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator()
 | 
			
		||||
    global_uorder_BV = 0;
 | 
			
		||||
    global_vorder_BV = 0;
 | 
			
		||||
    global_baseData = NULL;
 | 
			
		||||
	
 | 
			
		||||
        
 | 
			
		||||
    global_bpm = NULL;
 | 
			
		||||
    output_triangles = 0; //don't output triangles by default
 | 
			
		||||
 | 
			
		||||
@@ -161,8 +161,8 @@ OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator()
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
OpenGLSurfaceEvaluator::~OpenGLSurfaceEvaluator() 
 | 
			
		||||
{ 
 | 
			
		||||
OpenGLSurfaceEvaluator::~OpenGLSurfaceEvaluator()
 | 
			
		||||
{
 | 
			
		||||
   for (int ii= 0; ii< VERTEX_CACHE_SIZE; ii++) {
 | 
			
		||||
      delete vertexCache[ii];
 | 
			
		||||
      vertexCache[ii]= 0;
 | 
			
		||||
@@ -197,11 +197,11 @@ void
 | 
			
		||||
OpenGLSurfaceEvaluator::mapgrid2f(long nu, REAL u0, REAL u1, long nv, REAL v0, REAL v1)
 | 
			
		||||
{
 | 
			
		||||
#ifdef USE_INTERNAL_EVAL
 | 
			
		||||
  inMapGrid2f((int) nu, (REAL) u0, (REAL) u1, (int) nv, 
 | 
			
		||||
  inMapGrid2f((int) nu, (REAL) u0, (REAL) u1, (int) nv,
 | 
			
		||||
	      (REAL) v0, (REAL) v1);
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
  if(output_triangles)	
 | 
			
		||||
  if(output_triangles)  
 | 
			
		||||
    {
 | 
			
		||||
      global_grid_u0 = u0;
 | 
			
		||||
      global_grid_u1 = u1;
 | 
			
		||||
@@ -211,7 +211,7 @@ OpenGLSurfaceEvaluator::mapgrid2f(long nu, REAL u0, REAL u1, long nv, REAL v0, R
 | 
			
		||||
      global_grid_nv = nv;
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    glMapGrid2d((GLint) nu, (GLdouble) u0, (GLdouble) u1, (GLint) nv, 
 | 
			
		||||
    glMapGrid2d((GLint) nu, (GLdouble) u0, (GLdouble) u1, (GLint) nv,
 | 
			
		||||
	    (GLdouble) v0, (GLdouble) v1);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -225,7 +225,7 @@ OpenGLSurfaceEvaluator::polymode(long style)
 | 
			
		||||
      switch(style) {
 | 
			
		||||
      default:
 | 
			
		||||
      case N_MESHFILL:
 | 
			
		||||
	
 | 
			
		||||
        
 | 
			
		||||
	glPolygonMode((GLenum) GL_FRONT_AND_BACK, (GLenum) GL_FILL);
 | 
			
		||||
	break;
 | 
			
		||||
      case N_MESHLINE:
 | 
			
		||||
@@ -361,11 +361,11 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i
 | 
			
		||||
  /*
 | 
			
		||||
   *the algorithm works by scanning from left to right.
 | 
			
		||||
   *leftMostV: the left most of the remaining verteces (on both upper and lower).
 | 
			
		||||
   *           it could an element of upperVerts or lowerVerts.
 | 
			
		||||
   *i: upperVerts[i] is the first vertex to the right of leftMostV on upper line   
 | 
			
		||||
   *j: lowerVerts[j] is the first vertex to the right of leftMostV on lower line   
 | 
			
		||||
   *	       it could an element of upperVerts or lowerVerts.
 | 
			
		||||
   *i: upperVerts[i] is the first vertex to the right of leftMostV on upper line
 | 
			
		||||
   *j: lowerVerts[j] is the first vertex to the right of leftMostV on lower line
 | 
			
		||||
   */
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /*initialize i,j,and leftMostV
 | 
			
		||||
   */
 | 
			
		||||
  if(upper_val[0] <= lower_val[0])
 | 
			
		||||
@@ -385,140 +385,140 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i
 | 
			
		||||
      leftMostV[1] = v_lower;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /*the main loop.
 | 
			
		||||
   *the invariance is that: 
 | 
			
		||||
   *at the beginning of each loop, the meaning of i,j,and leftMostV are 
 | 
			
		||||
   *the invariance is that:
 | 
			
		||||
   *at the beginning of each loop, the meaning of i,j,and leftMostV are
 | 
			
		||||
   *maintained
 | 
			
		||||
   */
 | 
			
		||||
  while(1)
 | 
			
		||||
    {
 | 
			
		||||
      if(i >= n_upper) /*case1: no more in upper*/
 | 
			
		||||
        {
 | 
			
		||||
          if(j<n_lower-1) /*at least two vertices in lower*/
 | 
			
		||||
            {
 | 
			
		||||
              bgntfan();
 | 
			
		||||
	{
 | 
			
		||||
	  if(j<n_lower-1) /*at least two vertices in lower*/
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(leftMostV[0], leftMostV[1]);
 | 
			
		||||
//	      glNormal3fv(leftMostNormal);
 | 
			
		||||
//              glVertex3fv(leftMostXYZ);
 | 
			
		||||
//		glVertex3fv(leftMostXYZ);
 | 
			
		||||
 | 
			
		||||
              while(j<n_lower){
 | 
			
		||||
	      while(j<n_lower){
 | 
			
		||||
		coord2f(lower_val[j], v_lower);
 | 
			
		||||
//		glNormal3fv(lowerNormal[j]);
 | 
			
		||||
//		glVertex3fv(lowerXYZ[j]);
 | 
			
		||||
		j++;
 | 
			
		||||
 | 
			
		||||
              }
 | 
			
		||||
              endtfan();
 | 
			
		||||
            }
 | 
			
		||||
          break; /*exit the main loop*/
 | 
			
		||||
        }
 | 
			
		||||
	      }
 | 
			
		||||
	      endtfan();
 | 
			
		||||
	    }
 | 
			
		||||
	  break; /*exit the main loop*/
 | 
			
		||||
	}
 | 
			
		||||
      else if(j>= n_lower) /*case2: no more in lower*/
 | 
			
		||||
        {
 | 
			
		||||
          if(i<n_upper-1) /*at least two vertices in upper*/
 | 
			
		||||
            {
 | 
			
		||||
              bgntfan();
 | 
			
		||||
	{
 | 
			
		||||
	  if(i<n_upper-1) /*at least two vertices in upper*/
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(leftMostV[0], leftMostV[1]);
 | 
			
		||||
//	      glNormal3fv(leftMostNormal);
 | 
			
		||||
//	      glVertex3fv(leftMostXYZ);
 | 
			
		||||
	      
 | 
			
		||||
              for(k=n_upper-1; k>=i; k--) /*reverse order for two-side lighting*/
 | 
			
		||||
        
 | 
			
		||||
	      for(k=n_upper-1; k>=i; k--) /*reverse order for two-side lighting*/
 | 
			
		||||
		{
 | 
			
		||||
		  coord2f(upper_val[k], v_upper);
 | 
			
		||||
//		  glNormal3fv(upperNormal[k]);
 | 
			
		||||
//		  glVertex3fv(upperXYZ[k]);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
              endtfan();
 | 
			
		||||
            }
 | 
			
		||||
          break; /*exit the main loop*/
 | 
			
		||||
        }
 | 
			
		||||
	      endtfan();
 | 
			
		||||
	    }
 | 
			
		||||
	  break; /*exit the main loop*/
 | 
			
		||||
	}
 | 
			
		||||
      else /* case3: neither is empty, plus the leftMostV, there is at least one triangle to output*/
 | 
			
		||||
        {
 | 
			
		||||
          if(upper_val[i] <= lower_val[j])
 | 
			
		||||
            {
 | 
			
		||||
	{
 | 
			
		||||
	  if(upper_val[i] <= lower_val[j])
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(lower_val[j], v_lower);
 | 
			
		||||
//	      glNormal3fv(lowerNormal[j]);
 | 
			
		||||
//	      glVertex3fv(lowerXYZ[j]);
 | 
			
		||||
 | 
			
		||||
              /*find the last k>=i such that 
 | 
			
		||||
               *upperverts[k][0] <= lowerverts[j][0]
 | 
			
		||||
               */
 | 
			
		||||
              k=i;
 | 
			
		||||
	      /*find the last k>=i such that
 | 
			
		||||
	       *upperverts[k][0] <= lowerverts[j][0]
 | 
			
		||||
	       */
 | 
			
		||||
	      k=i;
 | 
			
		||||
 | 
			
		||||
              while(k<n_upper)
 | 
			
		||||
                {
 | 
			
		||||
                  if(upper_val[k] > lower_val[j])
 | 
			
		||||
                    break;
 | 
			
		||||
                  k++;
 | 
			
		||||
	      while(k<n_upper)
 | 
			
		||||
		{
 | 
			
		||||
		  if(upper_val[k] > lower_val[j])
 | 
			
		||||
		    break;
 | 
			
		||||
		  k++;
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
              k--;
 | 
			
		||||
		}
 | 
			
		||||
	      k--;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
              for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/
 | 
			
		||||
                {
 | 
			
		||||
	      for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/
 | 
			
		||||
		{
 | 
			
		||||
		  coord2f(upper_val[l], v_upper);
 | 
			
		||||
//		  glNormal3fv(upperNormal[l]);
 | 
			
		||||
//		  glVertex3fv(upperXYZ[l]);
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
		}
 | 
			
		||||
	      coord2f(leftMostV[0], leftMostV[1]);
 | 
			
		||||
//	      glNormal3fv(leftMostNormal);
 | 
			
		||||
//	      glVertex3fv(leftMostXYZ);
 | 
			
		||||
 | 
			
		||||
              endtfan();
 | 
			
		||||
	      endtfan();
 | 
			
		||||
 | 
			
		||||
              /*update i and leftMostV for next loop
 | 
			
		||||
               */
 | 
			
		||||
              i = k+1;
 | 
			
		||||
	      /*update i and leftMostV for next loop
 | 
			
		||||
	       */
 | 
			
		||||
	      i = k+1;
 | 
			
		||||
 | 
			
		||||
	      leftMostV[0] = upper_val[k];
 | 
			
		||||
	      leftMostV[1] = v_upper;
 | 
			
		||||
//	      leftMostNormal = upperNormal[k];
 | 
			
		||||
//	      leftMostXYZ = upperXYZ[k];
 | 
			
		||||
            }
 | 
			
		||||
          else /*upperVerts[i][0] > lowerVerts[j][0]*/
 | 
			
		||||
            {
 | 
			
		||||
	    }
 | 
			
		||||
	  else /*upperVerts[i][0] > lowerVerts[j][0]*/
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(upper_val[i], v_upper);
 | 
			
		||||
//	      glNormal3fv(upperNormal[i]);
 | 
			
		||||
//	      glVertex3fv(upperXYZ[i]);
 | 
			
		||||
	
 | 
			
		||||
        
 | 
			
		||||
	      coord2f(leftMostV[0], leftMostV[1]);
 | 
			
		||||
//              glNormal3fv(leftMostNormal);
 | 
			
		||||
//		glNormal3fv(leftMostNormal);
 | 
			
		||||
//	      glVertex3fv(leftMostXYZ);
 | 
			
		||||
	      
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
              /*find the last k>=j such that
 | 
			
		||||
               *lowerverts[k][0] < upperverts[i][0]
 | 
			
		||||
               */
 | 
			
		||||
              k=j;
 | 
			
		||||
              while(k< n_lower)
 | 
			
		||||
                {
 | 
			
		||||
                  if(lower_val[k] >= upper_val[i])
 | 
			
		||||
                    break;
 | 
			
		||||
	      /*find the last k>=j such that
 | 
			
		||||
	       *lowerverts[k][0] < upperverts[i][0]
 | 
			
		||||
	       */
 | 
			
		||||
	      k=j;
 | 
			
		||||
	      while(k< n_lower)
 | 
			
		||||
		{
 | 
			
		||||
		  if(lower_val[k] >= upper_val[i])
 | 
			
		||||
		    break;
 | 
			
		||||
		  coord2f(lower_val[k], v_lower);
 | 
			
		||||
//		  glNormal3fv(lowerNormal[k]);
 | 
			
		||||
//		  glVertex3fv(lowerXYZ[k]);
 | 
			
		||||
 | 
			
		||||
                  k++;
 | 
			
		||||
                }
 | 
			
		||||
              endtfan();
 | 
			
		||||
		  k++;
 | 
			
		||||
		}
 | 
			
		||||
	      endtfan();
 | 
			
		||||
 | 
			
		||||
              /*update j and leftMostV for next loop
 | 
			
		||||
               */
 | 
			
		||||
              j=k;
 | 
			
		||||
	      /*update j and leftMostV for next loop
 | 
			
		||||
	       */
 | 
			
		||||
	      j=k;
 | 
			
		||||
	      leftMostV[0] = lower_val[j-1];
 | 
			
		||||
	      leftMostV[1] = v_lower;
 | 
			
		||||
 | 
			
		||||
//	      leftMostNormal = lowerNormal[j-1];
 | 
			
		||||
//	      leftMostXYZ = lowerXYZ[j-1];
 | 
			
		||||
            }     
 | 
			
		||||
        }
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
  //clean up 
 | 
			
		||||
  //clean up
 | 
			
		||||
//  free(upperXYZ);
 | 
			
		||||
//  free(lowerXYZ);
 | 
			
		||||
//  free(upperNormal);
 | 
			
		||||
@@ -526,7 +526,7 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int n_right, REAL u_right, REAL* right_val)
 | 
			
		||||
@@ -548,11 +548,11 @@ OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int
 | 
			
		||||
  /*
 | 
			
		||||
   *the algorithm works by scanning from bot to top.
 | 
			
		||||
   *botMostV: the bot most of the remaining verteces (on both left and right).
 | 
			
		||||
   *           it could an element of leftVerts or rightVerts.
 | 
			
		||||
   *i: leftVerts[i] is the first vertex to the top of botMostV on left line   
 | 
			
		||||
   *	       it could an element of leftVerts or rightVerts.
 | 
			
		||||
   *i: leftVerts[i] is the first vertex to the top of botMostV on left line
 | 
			
		||||
   *j: rightVerts[j] is the first vertex to the top of botMostV on rightline
 | 
			
		||||
   */
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /*initialize i,j,and botMostV
 | 
			
		||||
   */
 | 
			
		||||
  if(left_val[0] <= right_val[0])
 | 
			
		||||
@@ -573,142 +573,142 @@ OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /*the main loop.
 | 
			
		||||
   *the invariance is that: 
 | 
			
		||||
   *at the beginning of each loop, the meaning of i,j,and botMostV are 
 | 
			
		||||
   *the invariance is that:
 | 
			
		||||
   *at the beginning of each loop, the meaning of i,j,and botMostV are
 | 
			
		||||
   *maintained
 | 
			
		||||
   */
 | 
			
		||||
  while(1)
 | 
			
		||||
    {
 | 
			
		||||
      if(i >= n_left) /*case1: no more in left*/
 | 
			
		||||
        {
 | 
			
		||||
          if(j<n_right-1) /*at least two vertices in right*/
 | 
			
		||||
            {
 | 
			
		||||
              bgntfan();
 | 
			
		||||
	{
 | 
			
		||||
	  if(j<n_right-1) /*at least two vertices in right*/
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(botMostV[0], botMostV[1]);
 | 
			
		||||
              while(j<n_right){
 | 
			
		||||
	      while(j<n_right){
 | 
			
		||||
		coord2f(u_right, right_val[j]);
 | 
			
		||||
//		glNormal3fv(rightNormal[j]);
 | 
			
		||||
//		glVertex3fv(rightXYZ[j]);
 | 
			
		||||
		j++;
 | 
			
		||||
 | 
			
		||||
              }
 | 
			
		||||
              endtfan();
 | 
			
		||||
            }
 | 
			
		||||
          break; /*exit the main loop*/
 | 
			
		||||
        }
 | 
			
		||||
	      }
 | 
			
		||||
	      endtfan();
 | 
			
		||||
	    }
 | 
			
		||||
	  break; /*exit the main loop*/
 | 
			
		||||
	}
 | 
			
		||||
      else if(j>= n_right) /*case2: no more in right*/
 | 
			
		||||
        {
 | 
			
		||||
          if(i<n_left-1) /*at least two vertices in left*/
 | 
			
		||||
            {
 | 
			
		||||
              bgntfan();
 | 
			
		||||
              coord2f(botMostV[0], botMostV[1]);
 | 
			
		||||
	{
 | 
			
		||||
	  if(i<n_left-1) /*at least two vertices in left*/
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(botMostV[0], botMostV[1]);
 | 
			
		||||
//	      glNormal3fv(botMostNormal);
 | 
			
		||||
//	      glVertex3fv(botMostXYZ);
 | 
			
		||||
	      
 | 
			
		||||
              for(k=n_left-1; k>=i; k--) /*reverse order for two-side lighting*/
 | 
			
		||||
        
 | 
			
		||||
	      for(k=n_left-1; k>=i; k--) /*reverse order for two-side lighting*/
 | 
			
		||||
		{
 | 
			
		||||
		  coord2f(u_left, left_val[k]);
 | 
			
		||||
//		  glNormal3fv(leftNormal[k]);
 | 
			
		||||
//		  glVertex3fv(leftXYZ[k]);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
              endtfan();
 | 
			
		||||
            }
 | 
			
		||||
          break; /*exit the main loop*/
 | 
			
		||||
        }
 | 
			
		||||
	      endtfan();
 | 
			
		||||
	    }
 | 
			
		||||
	  break; /*exit the main loop*/
 | 
			
		||||
	}
 | 
			
		||||
      else /* case3: neither is empty, plus the botMostV, there is at least one triangle to output*/
 | 
			
		||||
        {
 | 
			
		||||
          if(left_val[i] <= right_val[j])
 | 
			
		||||
            {
 | 
			
		||||
	{
 | 
			
		||||
	  if(left_val[i] <= right_val[j])
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(u_right, right_val[j]);
 | 
			
		||||
//	      glNormal3fv(rightNormal[j]);
 | 
			
		||||
//	      glVertex3fv(rightXYZ[j]);
 | 
			
		||||
 | 
			
		||||
              /*find the last k>=i such that 
 | 
			
		||||
               *leftverts[k][0] <= rightverts[j][0]
 | 
			
		||||
               */
 | 
			
		||||
              k=i;
 | 
			
		||||
	      /*find the last k>=i such that
 | 
			
		||||
	       *leftverts[k][0] <= rightverts[j][0]
 | 
			
		||||
	       */
 | 
			
		||||
	      k=i;
 | 
			
		||||
 | 
			
		||||
              while(k<n_left)
 | 
			
		||||
                {
 | 
			
		||||
                  if(left_val[k] > right_val[j])
 | 
			
		||||
                    break;
 | 
			
		||||
                  k++;
 | 
			
		||||
	      while(k<n_left)
 | 
			
		||||
		{
 | 
			
		||||
		  if(left_val[k] > right_val[j])
 | 
			
		||||
		    break;
 | 
			
		||||
		  k++;
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
              k--;
 | 
			
		||||
		}
 | 
			
		||||
	      k--;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
              for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/
 | 
			
		||||
                {
 | 
			
		||||
	      for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/
 | 
			
		||||
		{
 | 
			
		||||
		  coord2f(u_left, left_val[l]);
 | 
			
		||||
//		  glNormal3fv(leftNormal[l]);
 | 
			
		||||
//		  glVertex3fv(leftXYZ[l]);
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
		}
 | 
			
		||||
	      coord2f(botMostV[0], botMostV[1]);
 | 
			
		||||
//	      glNormal3fv(botMostNormal);
 | 
			
		||||
//	      glVertex3fv(botMostXYZ);
 | 
			
		||||
 | 
			
		||||
              endtfan();
 | 
			
		||||
	      endtfan();
 | 
			
		||||
 | 
			
		||||
              /*update i and botMostV for next loop
 | 
			
		||||
               */
 | 
			
		||||
              i = k+1;
 | 
			
		||||
	      /*update i and botMostV for next loop
 | 
			
		||||
	       */
 | 
			
		||||
	      i = k+1;
 | 
			
		||||
 | 
			
		||||
	      botMostV[0] = u_left;
 | 
			
		||||
	      botMostV[1] = left_val[k];
 | 
			
		||||
//	      botMostNormal = leftNormal[k];
 | 
			
		||||
//	      botMostXYZ = leftXYZ[k];
 | 
			
		||||
            }
 | 
			
		||||
          else /*left_val[i] > right_val[j])*/
 | 
			
		||||
            {
 | 
			
		||||
	    }
 | 
			
		||||
	  else /*left_val[i] > right_val[j])*/
 | 
			
		||||
	    {
 | 
			
		||||
	      bgntfan();
 | 
			
		||||
	      coord2f(u_left, left_val[i]);
 | 
			
		||||
//	      glNormal3fv(leftNormal[i]);
 | 
			
		||||
//	      glVertex3fv(leftXYZ[i]);
 | 
			
		||||
	      
 | 
			
		||||
        
 | 
			
		||||
	      coord2f(botMostV[0], botMostV[1]);
 | 
			
		||||
//            glNormal3fv(botMostNormal);
 | 
			
		||||
//	      glNormal3fv(botMostNormal);
 | 
			
		||||
//	      glVertex3fv(botMostXYZ);
 | 
			
		||||
	      
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
              /*find the last k>=j such that
 | 
			
		||||
               *rightverts[k][0] < leftverts[i][0]
 | 
			
		||||
               */
 | 
			
		||||
              k=j;
 | 
			
		||||
              while(k< n_right)
 | 
			
		||||
                {
 | 
			
		||||
                  if(right_val[k] >= left_val[i])
 | 
			
		||||
                    break;
 | 
			
		||||
	      /*find the last k>=j such that
 | 
			
		||||
	       *rightverts[k][0] < leftverts[i][0]
 | 
			
		||||
	       */
 | 
			
		||||
	      k=j;
 | 
			
		||||
	      while(k< n_right)
 | 
			
		||||
		{
 | 
			
		||||
		  if(right_val[k] >= left_val[i])
 | 
			
		||||
		    break;
 | 
			
		||||
		  coord2f(u_right, right_val[k]);
 | 
			
		||||
//		  glNormal3fv(rightNormal[k]);
 | 
			
		||||
//		  glVertex3fv(rightXYZ[k]);
 | 
			
		||||
 | 
			
		||||
                  k++;
 | 
			
		||||
                }
 | 
			
		||||
              endtfan();
 | 
			
		||||
		  k++;
 | 
			
		||||
		}
 | 
			
		||||
	      endtfan();
 | 
			
		||||
 | 
			
		||||
              /*update j and botMostV for next loop
 | 
			
		||||
               */
 | 
			
		||||
              j=k;
 | 
			
		||||
	      /*update j and botMostV for next loop
 | 
			
		||||
	       */
 | 
			
		||||
	      j=k;
 | 
			
		||||
	      botMostV[0] = u_right;
 | 
			
		||||
	      botMostV[1] = right_val[j-1];
 | 
			
		||||
 | 
			
		||||
//	      botMostNormal = rightNormal[j-1];
 | 
			
		||||
//	      botMostXYZ = rightXYZ[j-1];
 | 
			
		||||
            }     
 | 
			
		||||
        }
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
  //clean up 
 | 
			
		||||
  //clean up
 | 
			
		||||
//  free(leftXYZ);
 | 
			
		||||
//  free(leftNormal);
 | 
			
		||||
//  free(rightXYZ);
 | 
			
		||||
//  free(rightNormal);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
OpenGLSurfaceEvaluator::bgnqstrip(void)
 | 
			
		||||
@@ -742,25 +742,25 @@ OpenGLSurfaceEvaluator::bgnmap2f(long)
 | 
			
		||||
{
 | 
			
		||||
  if(output_triangles)
 | 
			
		||||
    {
 | 
			
		||||
      /*deallocate the space which may has been 
 | 
			
		||||
      /*deallocate the space which may has been
 | 
			
		||||
       *allocated by global_bpm previously
 | 
			
		||||
       */
 | 
			
		||||
      if(global_bpm != NULL) {
 | 
			
		||||
	bezierPatchMeshListDelete(global_bpm);
 | 
			
		||||
	global_bpm = NULL;
 | 
			
		||||
      }
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      /*
 | 
			
		||||
	auto_normal_flag = 1; //always output normal in callback mode.
 | 
			
		||||
	                      //we could have used the following code,
 | 
			
		||||
	                      //but Inspector doesn't have gl context
 | 
			
		||||
                              //before it calls tessellator.
 | 
			
		||||
	                      //this way is temporary.
 | 
			
		||||
			      //we could have used the following code,
 | 
			
		||||
			      //but Inspector doesn't have gl context
 | 
			
		||||
			      //before it calls tessellator.
 | 
			
		||||
			      //this way is temporary.
 | 
			
		||||
	*/
 | 
			
		||||
      //NEWCALLBACK
 | 
			
		||||
      //if one of the two normal callback functions are set,
 | 
			
		||||
      //then set 
 | 
			
		||||
      //then set
 | 
			
		||||
      if(normalCallBackN != NULL ||
 | 
			
		||||
	 normalCallBackData != NULL)
 | 
			
		||||
	auto_normal_flag = 1;
 | 
			
		||||
@@ -777,19 +777,19 @@ OpenGLSurfaceEvaluator::bgnmap2f(long)
 | 
			
		||||
      if(glIsEnabled(GL_AUTO_NORMAL) == GL_TRUE)
 | 
			
		||||
	auto_normal_flag = 1;
 | 
			
		||||
      else if (callback_auto_normal == 1)
 | 
			
		||||
        auto_normal_flag = 1;
 | 
			
		||||
	auto_normal_flag = 1;
 | 
			
		||||
      else
 | 
			
		||||
	auto_normal_flag = 0;
 | 
			
		||||
	*/
 | 
			
		||||
 | 
			
		||||
      //NEWCALLBACK: no need to worry about gl states when gling clalback
 | 
			
		||||
    }
 | 
			
		||||
  else 
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      glPushAttrib((GLbitfield) GL_EVAL_BIT);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      /*to avoid side effect, we restor the opengl state for GL_POLYGON_MODE
 | 
			
		||||
       */	
 | 
			
		||||
       */       
 | 
			
		||||
      glGetIntegerv(GL_POLYGON_MODE, gl_polygon_mode);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -806,17 +806,17 @@ OpenGLSurfaceEvaluator::endmap2f(void)
 | 
			
		||||
  if(output_triangles)
 | 
			
		||||
    {
 | 
			
		||||
      //bezierPatchMeshListDelDeg(global_bpm);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      //    bezierPatchMeshListEval(global_bpm);
 | 
			
		||||
 | 
			
		||||
      //surfcount++;
 | 
			
		||||
      //printf("surfcount=%i\n", surfcount);
 | 
			
		||||
      //if(surfcount == 8) exit(0);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      inBPMListEvalEM(global_bpm);
 | 
			
		||||
      
 | 
			
		||||
      
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
    global_bpm = bezierPatchMeshListReverse(global_bpm);
 | 
			
		||||
    {
 | 
			
		||||
@@ -837,7 +837,7 @@ OpenGLSurfaceEvaluator::endmap2f(void)
 | 
			
		||||
    //bezierPatchMeshListPrint(global_bpm);
 | 
			
		||||
    //bezierPatchMeshListDraw(global_bpm);
 | 
			
		||||
 | 
			
		||||
//        printf("num triangles=%i\n", bezierPatchMeshListNumTriangles(global_bpm));
 | 
			
		||||
//	  printf("num triangles=%i\n", bezierPatchMeshListNumTriangles(global_bpm));
 | 
			
		||||
 | 
			
		||||
#ifdef USE_LOD
 | 
			
		||||
#else
 | 
			
		||||
@@ -873,20 +873,20 @@ glPopAttrib();
 | 
			
		||||
void
 | 
			
		||||
OpenGLSurfaceEvaluator::map2f(
 | 
			
		||||
    long _type,
 | 
			
		||||
    REAL _ulower,	/* u lower domain coord		*/
 | 
			
		||||
    REAL _ulower,	/* u lower domain coord 	*/
 | 
			
		||||
    REAL _uupper,	/* u upper domain coord 	*/
 | 
			
		||||
    long _ustride,	/* interpoint distance		*/
 | 
			
		||||
    long _uorder,	/* parametric order		*/
 | 
			
		||||
    REAL _vlower,	/* v lower domain coord		*/
 | 
			
		||||
    REAL _vupper, 	/* v upper domain coord		*/
 | 
			
		||||
    REAL _vlower,	/* v lower domain coord 	*/
 | 
			
		||||
    REAL _vupper,	/* v upper domain coord 	*/
 | 
			
		||||
    long _vstride,	/* interpoint distance		*/
 | 
			
		||||
    long _vorder,	/* parametric order		*/
 | 
			
		||||
    REAL *pts) 	/* control points		*/
 | 
			
		||||
    REAL *pts)	/* control points		*/
 | 
			
		||||
{
 | 
			
		||||
#ifdef USE_INTERNAL_EVAL
 | 
			
		||||
   inMap2f((int) _type, (REAL) _ulower, (REAL) _uupper, 
 | 
			
		||||
	    (int) _ustride, (int) _uorder, (REAL) _vlower, 
 | 
			
		||||
	    (REAL) _vupper, (int) _vstride, (int) _vorder, 
 | 
			
		||||
   inMap2f((int) _type, (REAL) _ulower, (REAL) _uupper,
 | 
			
		||||
	    (int) _ustride, (int) _uorder, (REAL) _vlower,
 | 
			
		||||
	    (REAL) _vupper, (int) _vstride, (int) _vorder,
 | 
			
		||||
	    (REAL *) pts);
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
@@ -897,7 +897,7 @@ OpenGLSurfaceEvaluator::map2f(
 | 
			
		||||
       if(global_bpm == NULL)
 | 
			
		||||
	 global_bpm = bezierPatchMeshMake2(10,10);
 | 
			
		||||
       if(
 | 
			
		||||
	  (global_bpm->bpatch == NULL && 
 | 
			
		||||
	  (global_bpm->bpatch == NULL &&
 | 
			
		||||
	  (_type == GL_MAP2_VERTEX_3 || _type == GL_MAP2_VERTEX_4))
 | 
			
		||||
	  ||
 | 
			
		||||
	  (global_bpm->bpatch_normal == NULL &&
 | 
			
		||||
@@ -922,7 +922,7 @@ OpenGLSurfaceEvaluator::map2f(
 | 
			
		||||
	   global_bpm = bezierPatchMeshListInsert(global_bpm, temp);
 | 
			
		||||
 | 
			
		||||
	   /*
 | 
			
		||||
	   global_bpm = bezierPatchMeshListInsert(global_bpm, 
 | 
			
		||||
	   global_bpm = bezierPatchMeshListInsert(global_bpm,
 | 
			
		||||
						  bezierPatchMeshMake(
 | 
			
		||||
								      (int) _type, _ulower, _uupper,(int)  _ustride, (int) _uorder, _vlower, _vupper, (int) _vstride, (int) _vorder, pts, 10, 10));
 | 
			
		||||
	   */
 | 
			
		||||
@@ -930,12 +930,12 @@ OpenGLSurfaceEvaluator::map2f(
 | 
			
		||||
     }
 | 
			
		||||
   else /*not output triangles*/
 | 
			
		||||
     {
 | 
			
		||||
       glMap2f((GLenum) _type, (GLfloat) _ulower, (GLfloat) _uupper, 
 | 
			
		||||
	       (GLint) _ustride, (GLint) _uorder, (GLfloat) _vlower, 
 | 
			
		||||
	       (GLfloat) _vupper, (GLint) _vstride, (GLint) _vorder, 
 | 
			
		||||
       glMap2f((GLenum) _type, (GLfloat) _ulower, (GLfloat) _uupper,
 | 
			
		||||
	       (GLint) _ustride, (GLint) _uorder, (GLfloat) _vlower,
 | 
			
		||||
	       (GLfloat) _vupper, (GLint) _vstride, (GLint) _vorder,
 | 
			
		||||
	       (const GLfloat *) pts);
 | 
			
		||||
     }
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -976,18 +976,18 @@ if(output_triangles)
 | 
			
		||||
  if(global_grid_nu == 0 || global_grid_nv == 0)
 | 
			
		||||
    return; /*no points need to be output*/
 | 
			
		||||
  du = (global_grid_u1 - global_grid_u0) / (REAL)global_grid_nu;
 | 
			
		||||
  dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv;  
 | 
			
		||||
  
 | 
			
		||||
  dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv;
 | 
			
		||||
 | 
			
		||||
  if(global_grid_nu >= global_grid_nv){
 | 
			
		||||
 | 
			
		||||
    for(i=umin; i<umax; i++){
 | 
			
		||||
      REAL u1 = (i==global_grid_nu)? global_grid_u1:(global_grid_u0 + i*du);
 | 
			
		||||
      REAL u2 = ((i+1) == global_grid_nu)? global_grid_u1: (global_grid_u0+(i+1)*du);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      bgnqstrip();
 | 
			
		||||
      for(j=vmax; j>=vmin; j--){
 | 
			
		||||
	REAL v1 = (j == global_grid_nv)? global_grid_v1: (global_grid_v0 +j*dv);
 | 
			
		||||
	
 | 
			
		||||
        
 | 
			
		||||
	coord2f(u1, v1);
 | 
			
		||||
	coord2f(u2, v1);
 | 
			
		||||
      }
 | 
			
		||||
@@ -999,10 +999,10 @@ if(output_triangles)
 | 
			
		||||
    for(i=vmin; i<vmax; i++){
 | 
			
		||||
      REAL v1 = (i==global_grid_nv)? global_grid_v1:(global_grid_v0 + i*dv);
 | 
			
		||||
      REAL v2 = ((i+1) == global_grid_nv)? global_grid_v1: (global_grid_v0+(i+1)*dv);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      bgnqstrip();
 | 
			
		||||
      for(j=umax; j>=umin; j--){
 | 
			
		||||
	REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du);	
 | 
			
		||||
	REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du);        
 | 
			
		||||
	coord2f(u1, v2);
 | 
			
		||||
	coord2f(u1, v1);
 | 
			
		||||
      }
 | 
			
		||||
@@ -1016,15 +1016,15 @@ else
 | 
			
		||||
    switch(style) {
 | 
			
		||||
    default:
 | 
			
		||||
    case N_MESHFILL:
 | 
			
		||||
	glEvalMesh2((GLenum) GL_FILL, (GLint) umin, (GLint) umax, 
 | 
			
		||||
	glEvalMesh2((GLenum) GL_FILL, (GLint) umin, (GLint) umax,
 | 
			
		||||
		(GLint) vmin, (GLint) vmax);
 | 
			
		||||
	break;
 | 
			
		||||
    case N_MESHLINE:
 | 
			
		||||
	glEvalMesh2((GLenum) GL_LINE, (GLint) umin, (GLint) umax, 
 | 
			
		||||
	glEvalMesh2((GLenum) GL_LINE, (GLint) umin, (GLint) umax,
 | 
			
		||||
		(GLint) vmin, (GLint) vmax);
 | 
			
		||||
	break;
 | 
			
		||||
    case N_MESHPOINT:
 | 
			
		||||
	glEvalMesh2((GLenum) GL_POINT, (GLint) umin, (GLint) umax, 
 | 
			
		||||
	glEvalMesh2((GLenum) GL_POINT, (GLint) umin, (GLint) umax,
 | 
			
		||||
		(GLint) vmin, (GLint) vmax);
 | 
			
		||||
	break;
 | 
			
		||||
    }
 | 
			
		||||
@@ -1171,7 +1171,7 @@ return;
 | 
			
		||||
	if (vcount == 2) {
 | 
			
		||||
	    vertexCache[0]->invoke(this);
 | 
			
		||||
	    vertexCache[1]->invoke(this);
 | 
			
		||||
            coord2f(u,v);
 | 
			
		||||
	    coord2f(u,v);
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
	    vcount++;
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * glsurfeval.h
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/08/07 17:34:11 $ $Revision: 1.4 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.h,v 1.4 2001/08/07 17:34:11 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.4.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.h,v 1.4.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __gluglsurfeval_h_
 | 
			
		||||
@@ -106,7 +106,7 @@ private:
 | 
			
		||||
class OpenGLSurfaceEvaluator : public BasicSurfaceEvaluator {
 | 
			
		||||
public:
 | 
			
		||||
			OpenGLSurfaceEvaluator();
 | 
			
		||||
    			~OpenGLSurfaceEvaluator( void );
 | 
			
		||||
    			virtual ~OpenGLSurfaceEvaluator( void );
 | 
			
		||||
    void		polymode( long style );
 | 
			
		||||
    void		range2f( long, REAL *, REAL * );
 | 
			
		||||
    void		domain2f( REAL, REAL, REAL, REAL );
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * arc.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.12.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.cc,v 1.2.12.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
@@ -50,11 +50,11 @@
 | 
			
		||||
#include "simplemath.h"
 | 
			
		||||
 | 
			
		||||
/* local preprocessor definitions */
 | 
			
		||||
#define	ZERO		0.00001/*0.000001*/
 | 
			
		||||
#define ZERO		0.00001/*0.000001*/
 | 
			
		||||
 | 
			
		||||
const int 	Arc::bezier_tag = (1<<13);
 | 
			
		||||
const int 	Arc::arc_tag = (1<<3);
 | 
			
		||||
const int 	Arc::tail_tag = (1<<6);
 | 
			
		||||
const int	Arc::bezier_tag = (1<<13);
 | 
			
		||||
const int	Arc::arc_tag = (1<<3);
 | 
			
		||||
const int	Arc::tail_tag = (1<<6);
 | 
			
		||||
 | 
			
		||||
/*--------------------------------------------------------------------------
 | 
			
		||||
 * makeSide - attach a pwl arc to an arc and mark it as a border arc
 | 
			
		||||
@@ -72,7 +72,7 @@ Arc::makeSide( PwlArc *pwl, arc_side side )
 | 
			
		||||
    clearbezier();
 | 
			
		||||
    setside( side );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*--------------------------------------------------------------------------
 | 
			
		||||
 * numpts - count number of points on arc loop
 | 
			
		||||
@@ -100,7 +100,7 @@ void
 | 
			
		||||
Arc::markverts( void )
 | 
			
		||||
{
 | 
			
		||||
    Arc_ptr jarc = this;
 | 
			
		||||
	
 | 
			
		||||
        
 | 
			
		||||
    do {
 | 
			
		||||
	TrimVertex *p = jarc->pwlArc->pts;
 | 
			
		||||
	for( int i=0; i<jarc->pwlArc->npts; i++ )
 | 
			
		||||
@@ -125,22 +125,22 @@ Arc::getextrema( Arc_ptr extrema[4] )
 | 
			
		||||
    botpt  = toppt   = this->tail()[1];
 | 
			
		||||
 | 
			
		||||
    for( Arc_ptr jarc = this->next; jarc != this; jarc = jarc->next ) {
 | 
			
		||||
	if ( jarc->tail()[0] <  leftpt || 
 | 
			
		||||
	if ( jarc->tail()[0] <	leftpt ||
 | 
			
		||||
	    (jarc->tail()[0] <= leftpt && jarc->rhead()[0]<=leftpt))  {
 | 
			
		||||
	    leftpt = jarc->pwlArc->pts->param[0];
 | 
			
		||||
	    extrema[1] = jarc;
 | 
			
		||||
	}
 | 
			
		||||
	if ( jarc->tail()[0] >  rightpt || 
 | 
			
		||||
	if ( jarc->tail()[0] >	rightpt ||
 | 
			
		||||
	    (jarc->tail()[0] >= rightpt && jarc->rhead()[0] >= rightpt)) {
 | 
			
		||||
	    rightpt = jarc->pwlArc->pts->param[0];
 | 
			
		||||
	    extrema[3] = jarc;
 | 
			
		||||
	}
 | 
			
		||||
	if ( jarc->tail()[1] <  botpt || 
 | 
			
		||||
            (jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt ))  {
 | 
			
		||||
	if ( jarc->tail()[1] <	botpt ||
 | 
			
		||||
	    (jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt ))  {
 | 
			
		||||
	    botpt = jarc->pwlArc->pts->param[1];
 | 
			
		||||
	    extrema[2] = jarc;
 | 
			
		||||
	}
 | 
			
		||||
	if ( jarc->tail()[1] >  toppt || 
 | 
			
		||||
	if ( jarc->tail()[1] >	toppt ||
 | 
			
		||||
	    (jarc->tail()[1] >= toppt && jarc->rhead()[1] >= toppt))  {
 | 
			
		||||
	    toppt = jarc->pwlArc->pts->param[1];
 | 
			
		||||
	    extrema[0] = jarc;
 | 
			
		||||
@@ -160,7 +160,7 @@ Arc::show()
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
    dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts );
 | 
			
		||||
    for( int i = 0; i < pwlArc->npts; i++ ) {
 | 
			
		||||
         dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0],
 | 
			
		||||
	 dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0],
 | 
			
		||||
			pwlArc->pts[i].param[1] );
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
@@ -176,13 +176,6 @@ Arc::print( void )
 | 
			
		||||
{
 | 
			
		||||
    Arc_ptr jarc = this;
 | 
			
		||||
 | 
			
		||||
    if( ! this ) {
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
	dprintf( "\n\nEMPTY TRIM\n\n" );
 | 
			
		||||
#endif
 | 
			
		||||
	return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
    dprintf( "BGNTRIM\n" );
 | 
			
		||||
#endif
 | 
			
		||||
@@ -217,10 +210,10 @@ Arc::isDisconnected( void )
 | 
			
		||||
#endif
 | 
			
		||||
	return 1;
 | 
			
		||||
    } else {
 | 
			
		||||
        /* average two points together */
 | 
			
		||||
        p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5;
 | 
			
		||||
        p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5;
 | 
			
		||||
        return 0;
 | 
			
		||||
	/* average two points together */
 | 
			
		||||
	p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5;
 | 
			
		||||
	p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5;
 | 
			
		||||
	return 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -251,29 +244,29 @@ Arc::check( void )
 | 
			
		||||
    do {
 | 
			
		||||
	assert( (jarc->pwlArc != 0) || (jarc->bezierArc != 0) );
 | 
			
		||||
 | 
			
		||||
        if (jarc->prev == 0 || jarc->next == 0) {
 | 
			
		||||
	if (jarc->prev == 0 || jarc->next == 0) {
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
	    dprintf( "checkjarc:null next/prev pointer\n");
 | 
			
		||||
	    jarc->print( );
 | 
			
		||||
#endif
 | 
			
		||||
	    return 0;
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
        if (jarc->next->prev != jarc) {
 | 
			
		||||
	if (jarc->next->prev != jarc) {
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
	    dprintf( "checkjarc: pointer linkage screwed up\n");
 | 
			
		||||
	    jarc->print( );
 | 
			
		||||
#endif
 | 
			
		||||
	    return 0;
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
        if( jarc->pwlArc ) {
 | 
			
		||||
	if( jarc->pwlArc ) {
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
	    assert( jarc->pwlArc->npts >= 1 );
 | 
			
		||||
	    assert( jarc->pwlArc->npts < 100000 );
 | 
			
		||||
/*
 | 
			
		||||
	    for( int i=0; i < jarc->pwlArc->npts-1; i++ )
 | 
			
		||||
		assert( neq_vert( jarc->pwlArc->pts[i].param, 
 | 
			
		||||
		assert( neq_vert( jarc->pwlArc->pts[i].param,
 | 
			
		||||
			     jarc->pwlArc->pts[i+1].param) );
 | 
			
		||||
*/
 | 
			
		||||
#endif
 | 
			
		||||
@@ -287,7 +280,7 @@ Arc::check( void )
 | 
			
		||||
		    return 0;
 | 
			
		||||
		}
 | 
			
		||||
		if( jarc->tail()[0] != jarc->prev->rhead()[0] ) {
 | 
			
		||||
		    
 | 
			
		||||
	        
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
		    dprintf( "checkjarc: geometric linkage screwed up 2\n");
 | 
			
		||||
		    jarc->prev->show();
 | 
			
		||||
@@ -316,13 +309,13 @@ Arc::check( void )
 | 
			
		||||
	    }
 | 
			
		||||
	    if( jarc->isbezier() ) {
 | 
			
		||||
		assert( jarc->pwlArc->npts == 2 );
 | 
			
		||||
    		assert( (jarc->pwlArc->pts[0].param[0] == \
 | 
			
		||||
	    		jarc->pwlArc->pts[1].param[0]) ||\
 | 
			
		||||
    	    		(jarc->pwlArc->pts[0].param[1] == \
 | 
			
		||||
	    		jarc->pwlArc->pts[1].param[1]) );
 | 
			
		||||
		assert( (jarc->pwlArc->pts[0].param[0] == \
 | 
			
		||||
                        jarc->pwlArc->pts[1].param[0]) ||\
 | 
			
		||||
                        (jarc->pwlArc->pts[0].param[1] == \
 | 
			
		||||
                        jarc->pwlArc->pts[1].param[1]) );
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
        jarc = jarc->next;
 | 
			
		||||
	jarc = jarc->next;
 | 
			
		||||
    } while (jarc != this);
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
@@ -347,9 +340,9 @@ Arc::append( Arc_ptr jarc )
 | 
			
		||||
    if( jarc != 0 ) {
 | 
			
		||||
	next = jarc->next;
 | 
			
		||||
	prev = jarc;
 | 
			
		||||
   	next->prev = prev->next = this;
 | 
			
		||||
	next->prev = prev->next = this;
 | 
			
		||||
    } else {
 | 
			
		||||
        next = prev = this;
 | 
			
		||||
	next = prev = this;
 | 
			
		||||
    }
 | 
			
		||||
    return this;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * arctessellator.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.12.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.cc,v 1.2.12.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glimports.h"
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ArcTessellator::ArcTessellator( TrimVertexPool& t, Pool& p ) 
 | 
			
		||||
	: trimvertexpool(t), pwlarcpool(p)
 | 
			
		||||
	: pwlarcpool(p), trimvertexpool(t)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,15 +35,15 @@
 | 
			
		||||
/*
 | 
			
		||||
 * basiccrveval.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "mystdio.h"
 | 
			
		||||
#include "types.h"
 | 
			
		||||
#include "basiccrveval.h"
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::domain1f( REAL, REAL )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -51,15 +51,15 @@ BasicCurveEvaluator::domain1f( REAL, REAL )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
BasicCurveEvaluator::range1f( long type, REAL *, REAL * )
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::range1f( long , REAL *, REAL * )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
    dprintf( "range1f\n" );
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::enable( long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -67,7 +67,7 @@ BasicCurveEvaluator::enable( long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::disable( long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -75,7 +75,7 @@ BasicCurveEvaluator::disable( long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::bgnmap1f( long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -83,7 +83,7 @@ BasicCurveEvaluator::bgnmap1f( long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -91,7 +91,7 @@ BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::mapgrid1f( long, REAL, REAL )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -99,7 +99,7 @@ BasicCurveEvaluator::mapgrid1f( long, REAL, REAL )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::mapmesh1f( long, long, long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -107,7 +107,7 @@ BasicCurveEvaluator::mapmesh1f( long, long, long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::evalcoord1f( long, REAL )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -115,7 +115,7 @@ BasicCurveEvaluator::evalcoord1f( long, REAL )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::endmap1f( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -123,7 +123,7 @@ BasicCurveEvaluator::endmap1f( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::bgnline( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -131,7 +131,7 @@ BasicCurveEvaluator::bgnline( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicCurveEvaluator::endline( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
 
 | 
			
		||||
@@ -35,15 +35,19 @@
 | 
			
		||||
/*
 | 
			
		||||
 * basicsurfaceevaluator.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "mystdio.h"
 | 
			
		||||
#include "types.h"
 | 
			
		||||
#include "basicsurfeval.h"
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
#ifdef __WATCOMC__
 | 
			
		||||
#pragma warning 726 10
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -51,7 +55,7 @@ BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::polymode( long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -63,12 +67,12 @@ void
 | 
			
		||||
BasicSurfaceEvaluator::range2f( long type, REAL *from, REAL *to )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
    dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n", 
 | 
			
		||||
    dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n",
 | 
			
		||||
		type, from[0], from[1], to[0], to[1] );
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::enable( long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -76,7 +80,7 @@ BasicSurfaceEvaluator::enable( long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::disable( long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -84,7 +88,7 @@ BasicSurfaceEvaluator::disable( long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::bgnmap2f( long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -92,7 +96,7 @@ BasicSurfaceEvaluator::bgnmap2f( long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::endmap2f( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -100,8 +104,8 @@ BasicSurfaceEvaluator::endmap2f( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long,
 | 
			
		||||
				    REAL, REAL, long, long,
 | 
			
		||||
			      REAL * )
 | 
			
		||||
{
 | 
			
		||||
@@ -110,7 +114,7 @@ BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long,
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -118,7 +122,7 @@ BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -126,7 +130,7 @@ BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -134,7 +138,7 @@ BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::evalpoint2i( long, long )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -142,7 +146,7 @@ BasicSurfaceEvaluator::evalpoint2i( long, long )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::bgnline( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -150,7 +154,7 @@ BasicSurfaceEvaluator::bgnline( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::endline( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -158,7 +162,7 @@ BasicSurfaceEvaluator::endline( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::bgnclosedline( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -166,7 +170,7 @@ BasicSurfaceEvaluator::bgnclosedline( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::endclosedline( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -174,7 +178,7 @@ BasicSurfaceEvaluator::endclosedline( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::bgntfan( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -182,13 +186,13 @@ BasicSurfaceEvaluator::bgntfan( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::endtfan( void )
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::bgntmesh( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -196,7 +200,7 @@ BasicSurfaceEvaluator::bgntmesh( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::swaptmesh( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -204,7 +208,7 @@ BasicSurfaceEvaluator::swaptmesh( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::endtmesh( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -212,7 +216,7 @@ BasicSurfaceEvaluator::endtmesh( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::bgnqstrip( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
@@ -220,7 +224,7 @@ BasicSurfaceEvaluator::bgnqstrip( void )
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
BasicSurfaceEvaluator::endqstrip( void )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * coveandtiler.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/coveandtiler.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/coveandtiler.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glimports.h"
 | 
			
		||||
@@ -52,7 +52,7 @@
 | 
			
		||||
const int CoveAndTiler::MAXSTRIPSIZE = 1000;
 | 
			
		||||
 | 
			
		||||
CoveAndTiler::CoveAndTiler( Backend& b )
 | 
			
		||||
            : backend( b )
 | 
			
		||||
	    : backend( b )
 | 
			
		||||
{ }
 | 
			
		||||
 | 
			
		||||
CoveAndTiler::~CoveAndTiler( void )
 | 
			
		||||
@@ -76,19 +76,19 @@ CoveAndTiler::output( GridTrimVertex& g )
 | 
			
		||||
    backend.tmeshvert( &g );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveAndTile( void )
 | 
			
		||||
{
 | 
			
		||||
    long ustart = (top.ustart >= bot.ustart) ? top.ustart : bot.ustart;
 | 
			
		||||
    long uend   = (top.uend <= bot.uend)     ? top.uend   : bot.uend;
 | 
			
		||||
    long uend	= (top.uend <= bot.uend)     ? top.uend   : bot.uend;
 | 
			
		||||
    if( ustart <= uend ) {
 | 
			
		||||
	tile( bot.vindex, ustart, uend );
 | 
			
		||||
	if( top.ustart >= bot.ustart )  
 | 
			
		||||
	if( top.ustart >= bot.ustart )
 | 
			
		||||
	    coveUpperLeft();
 | 
			
		||||
	else 
 | 
			
		||||
	else
 | 
			
		||||
	    coveLowerLeft();
 | 
			
		||||
    
 | 
			
		||||
	if( top.uend <= bot.uend )  
 | 
			
		||||
 | 
			
		||||
	if( top.uend <= bot.uend )
 | 
			
		||||
	    coveUpperRight();
 | 
			
		||||
	else
 | 
			
		||||
	    coveLowerRight();
 | 
			
		||||
@@ -126,7 +126,7 @@ CoveAndTiler::coveAndTile( void )
 | 
			
		||||
	    } else {
 | 
			
		||||
		tllv.set( bot.ustart-1, top.vindex );
 | 
			
		||||
	    }
 | 
			
		||||
 	    coveLowerLeftNoGrid( tl );
 | 
			
		||||
	    coveLowerLeftNoGrid( tl );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	TrimVertex brv, trv, *br, *tr;
 | 
			
		||||
@@ -158,7 +158,7 @@ CoveAndTiler::coveAndTile( void )
 | 
			
		||||
	    br = rl;
 | 
			
		||||
	    brrv.set( rl );
 | 
			
		||||
	    if( rf->param[0] < uarray.uarray[bot.uend+1] ) {
 | 
			
		||||
	        assert( rf->param[0] >= uarray.uarray[bot.uend] );
 | 
			
		||||
		assert( rf->param[0] >= uarray.uarray[bot.uend] );
 | 
			
		||||
		trrv.set( rf );
 | 
			
		||||
	    } else {
 | 
			
		||||
		trrv.set( bot.uend+1, top.vindex );
 | 
			
		||||
@@ -179,7 +179,7 @@ CoveAndTiler::coveAndTile( void )
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::tile( long vindex, long ustart, long uend )
 | 
			
		||||
{
 | 
			
		||||
    long numsteps = uend - ustart;
 | 
			
		||||
@@ -195,7 +195,7 @@ CoveAndTiler::tile( long vindex, long ustart, long uend )
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveUpperRight( void )
 | 
			
		||||
{
 | 
			
		||||
    GridVertex tgv( top.uend, top.vindex );
 | 
			
		||||
@@ -207,7 +207,7 @@ CoveAndTiler::coveUpperRight( void )
 | 
			
		||||
    output( tgv );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
    output( gv );
 | 
			
		||||
        coveUR();
 | 
			
		||||
	coveUR();
 | 
			
		||||
    backend.endtmesh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -215,15 +215,15 @@ void
 | 
			
		||||
CoveAndTiler::coveUpperRightNoGrid( TrimVertex* br )
 | 
			
		||||
{
 | 
			
		||||
    backend.bgntmesh( "coveUpperRight" );
 | 
			
		||||
    output( right.first() ); 
 | 
			
		||||
    output( right.first() );
 | 
			
		||||
    output( right.next() );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
    output( br );
 | 
			
		||||
        coveUR();
 | 
			
		||||
	coveUR();
 | 
			
		||||
    backend.endtmesh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveUR( )
 | 
			
		||||
{
 | 
			
		||||
    GridVertex gv( top.uend, bot.vindex );
 | 
			
		||||
@@ -238,7 +238,7 @@ CoveAndTiler::coveUR( )
 | 
			
		||||
	    backend.swaptmesh();
 | 
			
		||||
	}
 | 
			
		||||
    } else while( 1 ) {
 | 
			
		||||
        if( vert->param[0] < uarray.uarray[gv.gparam[0]]  ) {
 | 
			
		||||
	if( vert->param[0] < uarray.uarray[gv.gparam[0]]  ) {
 | 
			
		||||
	    output( vert );
 | 
			
		||||
	    backend.swaptmesh();
 | 
			
		||||
	    vert = right.next();
 | 
			
		||||
@@ -250,7 +250,7 @@ CoveAndTiler::coveUR( )
 | 
			
		||||
		for( ; vert; vert = right.next() ) {
 | 
			
		||||
		    output( vert );
 | 
			
		||||
		    backend.swaptmesh();
 | 
			
		||||
    		}
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
@@ -269,7 +269,7 @@ CoveAndTiler::coveUpperLeft( void )
 | 
			
		||||
    output( left.next() );
 | 
			
		||||
    output( gv );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
        coveUL();
 | 
			
		||||
	coveUL();
 | 
			
		||||
    backend.endtmesh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -277,15 +277,15 @@ void
 | 
			
		||||
CoveAndTiler::coveUpperLeftNoGrid( TrimVertex* bl )
 | 
			
		||||
{
 | 
			
		||||
    backend.bgntmesh( "coveUpperLeftNoGrid" );
 | 
			
		||||
    output( left.first() ); 
 | 
			
		||||
    output( left.first() );
 | 
			
		||||
    output( left.next() );
 | 
			
		||||
    output( bl );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
        coveUL();
 | 
			
		||||
	coveUL();
 | 
			
		||||
    backend.endtmesh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveUL()
 | 
			
		||||
{
 | 
			
		||||
    GridVertex gv( top.ustart, bot.vindex );
 | 
			
		||||
@@ -318,7 +318,7 @@ CoveAndTiler::coveUL()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveLowerLeft( void )
 | 
			
		||||
{
 | 
			
		||||
    GridVertex bgv( bot.ustart, bot.vindex );
 | 
			
		||||
@@ -330,7 +330,7 @@ CoveAndTiler::coveLowerLeft( void )
 | 
			
		||||
    output( bgv );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
    output( gv );
 | 
			
		||||
        coveLL();
 | 
			
		||||
	coveLL();
 | 
			
		||||
    backend.endtmesh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -338,15 +338,15 @@ void
 | 
			
		||||
CoveAndTiler::coveLowerLeftNoGrid( TrimVertex* tl )
 | 
			
		||||
{
 | 
			
		||||
    backend.bgntmesh( "coveLowerLeft" );
 | 
			
		||||
    output( left.last() ); 
 | 
			
		||||
    output( left.last() );
 | 
			
		||||
    output( left.prev() );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
    output( tl );
 | 
			
		||||
        coveLL( );
 | 
			
		||||
	coveLL( );
 | 
			
		||||
    backend.endtmesh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveLL()
 | 
			
		||||
{
 | 
			
		||||
    GridVertex gv( bot.ustart, top.vindex );
 | 
			
		||||
@@ -360,7 +360,7 @@ CoveAndTiler::coveLL()
 | 
			
		||||
	    backend.swaptmesh();
 | 
			
		||||
	}
 | 
			
		||||
    } else while( 1 ) {
 | 
			
		||||
        if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){
 | 
			
		||||
	if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){
 | 
			
		||||
	    output( vert );
 | 
			
		||||
	    backend.swaptmesh();
 | 
			
		||||
	    vert = left.prev();
 | 
			
		||||
@@ -369,29 +369,29 @@ CoveAndTiler::coveLL()
 | 
			
		||||
	    backend.swaptmesh();
 | 
			
		||||
	    output( gv );
 | 
			
		||||
	    if( gv.prevu() == top.ustart ) {
 | 
			
		||||
    		for( ; vert; vert = left.prev() ) {
 | 
			
		||||
		for( ; vert; vert = left.prev() ) {
 | 
			
		||||
		    output( vert );
 | 
			
		||||
		    backend.swaptmesh();
 | 
			
		||||
    		}
 | 
			
		||||
	        break;
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveLowerRight( void )
 | 
			
		||||
{
 | 
			
		||||
    GridVertex bgv( bot.uend, bot.vindex );
 | 
			
		||||
    GridVertex gv( bot.uend, top.vindex );
 | 
			
		||||
 | 
			
		||||
    right.last();
 | 
			
		||||
    backend.bgntmesh( "coveLowerRight" );	
 | 
			
		||||
    backend.bgntmesh( "coveLowerRight" );       
 | 
			
		||||
    output( bgv );
 | 
			
		||||
    output( right.prev() );
 | 
			
		||||
    output( gv );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
        coveLR();
 | 
			
		||||
	coveLR();
 | 
			
		||||
    backend.endtmesh( );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -399,15 +399,15 @@ void
 | 
			
		||||
CoveAndTiler::coveLowerRightNoGrid( TrimVertex* tr )
 | 
			
		||||
{
 | 
			
		||||
    backend.bgntmesh( "coveLowerRIght" );
 | 
			
		||||
    output( right.last() ); 
 | 
			
		||||
    output( right.last() );
 | 
			
		||||
    output( right.prev() );
 | 
			
		||||
    output( tr );
 | 
			
		||||
    backend.swaptmesh();
 | 
			
		||||
        coveLR();
 | 
			
		||||
	coveLR();
 | 
			
		||||
    backend.endtmesh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
void
 | 
			
		||||
CoveAndTiler::coveLR( )
 | 
			
		||||
{
 | 
			
		||||
    GridVertex gv( bot.uend, top.vindex );
 | 
			
		||||
@@ -421,7 +421,7 @@ CoveAndTiler::coveLR( )
 | 
			
		||||
	    output( vert );
 | 
			
		||||
	}
 | 
			
		||||
    } else while( 1 ) {
 | 
			
		||||
        if( vert->param[0] < uarray.uarray[gv.gparam[0]]  ) {
 | 
			
		||||
	if( vert->param[0] < uarray.uarray[gv.gparam[0]]  ) {
 | 
			
		||||
	    backend.swaptmesh();
 | 
			
		||||
	    output( vert );
 | 
			
		||||
	    vert = right.prev();
 | 
			
		||||
@@ -430,11 +430,11 @@ CoveAndTiler::coveLR( )
 | 
			
		||||
	    output( gv );
 | 
			
		||||
	    backend.swaptmesh();
 | 
			
		||||
	    if( gv.nextu() == top.uend ) {
 | 
			
		||||
    		for( ; vert; vert = right.prev() ) {
 | 
			
		||||
		for( ; vert; vert = right.prev() ) {
 | 
			
		||||
		    backend.swaptmesh();
 | 
			
		||||
		    output( vert );
 | 
			
		||||
    		}
 | 
			
		||||
	        break;
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * knotvector.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/knotvector.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/knotvector.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glimports.h"
 | 
			
		||||
@@ -45,17 +45,20 @@
 | 
			
		||||
#include "knotvector.h"
 | 
			
		||||
#include "defines.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __WATCOMC__
 | 
			
		||||
#pragma warning 726 10
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void Knotvector::init( long _knotcount, long _stride, long _order, INREAL *_knotlist )
 | 
			
		||||
{
 | 
			
		||||
    knotcount = _knotcount; 
 | 
			
		||||
    stride = _stride; 
 | 
			
		||||
    order = _order; 
 | 
			
		||||
    knotcount = _knotcount;
 | 
			
		||||
    stride = _stride;
 | 
			
		||||
    order = _order;
 | 
			
		||||
    knotlist = new Knot[_knotcount];
 | 
			
		||||
    assert( knotlist != 0 );
 | 
			
		||||
 | 
			
		||||
    for( int i = 0; i != _knotcount; i++ )
 | 
			
		||||
        knotlist[i] = (Knot) _knotlist[i]; 
 | 
			
		||||
	knotlist[i] = (Knot) _knotlist[i];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Knotvector::Knotvector( void )
 | 
			
		||||
@@ -70,7 +73,7 @@ Knotvector::~Knotvector( void )
 | 
			
		||||
 | 
			
		||||
int Knotvector::validate( void )
 | 
			
		||||
{
 | 
			
		||||
   /* kindex is used as an array index so subtract one first, 
 | 
			
		||||
   /* kindex is used as an array index so subtract one first,
 | 
			
		||||
     * this propagates throughout the code so study carefully */
 | 
			
		||||
    long	kindex = knotcount-1;
 | 
			
		||||
 | 
			
		||||
@@ -85,7 +88,7 @@ int Knotvector::validate( void )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if( identical( knotlist[kindex-(order-1)], knotlist[order-1]) ) {
 | 
			
		||||
	// valid knot range is empty 
 | 
			
		||||
	// valid knot range is empty
 | 
			
		||||
	return( 3 );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -94,33 +97,33 @@ int Knotvector::validate( void )
 | 
			
		||||
	    // decreasing knot sequence
 | 
			
		||||
	    return( 4 );
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
        
 | 
			
		||||
    /* check for valid multiplicity */
 | 
			
		||||
 | 
			
		||||
    /*	kindex is currently the index of the last knot.
 | 
			
		||||
     *	In the next loop  it is decremented to ignore the last knot
 | 
			
		||||
     *	and the loop stops when kindex  is 2 so as to ignore the first
 | 
			
		||||
     *  knot as well.  These knots are not used in computing 
 | 
			
		||||
     *  knot multiplicities.
 | 
			
		||||
     *	and the loop stops when kindex	is 2 so as to ignore the first
 | 
			
		||||
     *	knot as well.  These knots are not used in computing
 | 
			
		||||
     *	knot multiplicities.
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    long multi = 1;
 | 
			
		||||
    for( ; kindex >= 1; kindex-- ) {
 | 
			
		||||
	if( knotlist[kindex] - knotlist[kindex-1] < TOLERANCE ) {
 | 
			
		||||
	    multi++; 
 | 
			
		||||
	    multi++;
 | 
			
		||||
	    continue;
 | 
			
		||||
	} 
 | 
			
		||||
	}
 | 
			
		||||
	if ( multi > order ) {
 | 
			
		||||
            // knot multiplicity greater than order of spline
 | 
			
		||||
	    // knot multiplicity greater than order of spline
 | 
			
		||||
	    return( 5 );
 | 
			
		||||
	} 
 | 
			
		||||
	}
 | 
			
		||||
	multi = 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ( multi > order ) {
 | 
			
		||||
        // knot multiplicity greater than order of spline
 | 
			
		||||
	// knot multiplicity greater than order of spline
 | 
			
		||||
	return( 5 );
 | 
			
		||||
    } 
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -128,7 +131,7 @@ int Knotvector::validate( void )
 | 
			
		||||
void Knotvector::show( char *msg )
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
    dprintf( "%s\n", msg ); 
 | 
			
		||||
    dprintf( "%s\n", msg );
 | 
			
		||||
    dprintf( "order = %ld, count = %ld\n", order, knotcount );
 | 
			
		||||
 | 
			
		||||
    for( int i=0; i<knotcount; i++ )
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * mymath.h
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/08/13 16:52:18 $ $Revision: 1.2 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mymath.h,v 1.2 2001/08/13 16:52:18 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mymath.h,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __glumymath_h_
 | 
			
		||||
@@ -46,7 +46,7 @@
 | 
			
		||||
#define sqrtf		gl_fsqrt
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if GLBUILD | STANDALONE
 | 
			
		||||
#if defined(GLBUILD) || defined(STANDALONE)
 | 
			
		||||
#define M_SQRT2		1.41421356237309504880
 | 
			
		||||
#define ceilf		myceilf
 | 
			
		||||
#define floorf		myfloorf	
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * mysetjmp.h
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/03/22 11:38:36 $ $Revision: 1.2 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mysetjmp.h,v 1.2 2001/03/22 11:38:36 joukj Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mysetjmp.h,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __glumysetjmp_h_
 | 
			
		||||
@@ -55,7 +55,7 @@ extern "C" int mysetjmp( JumpBuffer * );
 | 
			
		||||
#define longjmp 	gl_longjmp
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if LIBRARYBUILD | GLBUILD
 | 
			
		||||
#if defined(LIBRARYBUILD) || defined(GLBUILD)
 | 
			
		||||
#include <setjmp.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * nurbsinterfac.c++
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glimports.h"
 | 
			
		||||
@@ -66,9 +66,9 @@
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
NurbsTessellator::NurbsTessellator( BasicCurveEvaluator &c, BasicSurfaceEvaluator& e) 
 | 
			
		||||
	: subdivider( renderhints, backend ),
 | 
			
		||||
	: maplist( backend ),
 | 
			
		||||
	  backend( c, e ),
 | 
			
		||||
	  maplist( backend ),
 | 
			
		||||
          subdivider( renderhints, backend ),
 | 
			
		||||
	  o_pwlcurvePool( sizeof( O_pwlcurve ), 32, "o_pwlcurvePool" ),
 | 
			
		||||
	  o_nurbscurvePool( sizeof( O_nurbscurve ), 32, "o_nurbscurvePool"),
 | 
			
		||||
	  o_curvePool( sizeof( O_curve ), 32,  "o_curvePool" ),
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * nurbstess.h
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.h,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __glunurbstess_h_
 | 
			
		||||
@@ -60,7 +60,7 @@ class NurbsTessellator {
 | 
			
		||||
public:
 | 
			
		||||
    			NurbsTessellator( BasicCurveEvaluator &c,
 | 
			
		||||
                                          BasicSurfaceEvaluator &e );
 | 
			
		||||
    			~NurbsTessellator( void );
 | 
			
		||||
    			virtual ~NurbsTessellator( void );
 | 
			
		||||
 | 
			
		||||
    void     		getnurbsproperty( long, INREAL * );
 | 
			
		||||
    void     		getnurbsproperty( long, long, INREAL * );
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * subdivider.cxx
 | 
			
		||||
 *
 | 
			
		||||
 * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/subdivider.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
 | 
			
		||||
 * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $
 | 
			
		||||
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/subdivider.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glimports.h"
 | 
			
		||||
@@ -112,13 +112,13 @@ Subdivider::makePatchBoundary( const REAL *from, const REAL *to )
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
Subdivider::Subdivider( Renderhints& r, Backend& b ) 
 | 
			
		||||
	: arcpool( sizeof( Arc), 1, "arcpool" ),
 | 
			
		||||
	: slicer( b ),
 | 
			
		||||
	  arctessellator( trimvertexpool, pwlarcpool ), 
 | 
			
		||||
	  arcpool( sizeof( Arc), 1, "arcpool" ),
 | 
			
		||||
 	  bezierarcpool( sizeof( BezierArc ), 1, "Bezarcpool" ),
 | 
			
		||||
	  pwlarcpool( sizeof( PwlArc ), 1, "Pwlarcpool" ),
 | 
			
		||||
	  renderhints( r ),
 | 
			
		||||
	  arctessellator( trimvertexpool, pwlarcpool ), 
 | 
			
		||||
	  backend( b ),
 | 
			
		||||
	  slicer( b )
 | 
			
		||||
	  backend( b )
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -31,10 +31,10 @@
 | 
			
		||||
** published by SGI, but has not been independently verified as being
 | 
			
		||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
 | 
			
		||||
** $Date: 2003/11/21 15:49:26 $ $Revision: 1.2.14.1 $
 | 
			
		||||
*/
 | 
			
		||||
/*
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.2.14.1 2003/11/21 15:49:26 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
@@ -47,6 +47,10 @@
 | 
			
		||||
#include "directedLine.h"
 | 
			
		||||
#include "polyDBG.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __WATCOMC__
 | 
			
		||||
#pragma warning 726 10
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
//we must return the newLine
 | 
			
		||||
directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end)
 | 
			
		||||
{
 | 
			
		||||
@@ -61,10 +65,10 @@ directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end)
 | 
			
		||||
      delete end->sline;
 | 
			
		||||
      delete begin;
 | 
			
		||||
      delete end;
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      return ret;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
  directedLine* newLine;
 | 
			
		||||
  sampledLine* sline = new sampledLine(begin->head(), end->tail());
 | 
			
		||||
  newLine =  new directedLine(INCREASING, sline);
 | 
			
		||||
@@ -85,9 +89,9 @@ directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end)
 | 
			
		||||
 | 
			
		||||
void directedLine::deleteSingleLine(directedLine* dline)
 | 
			
		||||
{
 | 
			
		||||
  //make sure that dline->prev->tail is the same as 
 | 
			
		||||
  //make sure that dline->prev->tail is the same as
 | 
			
		||||
  //dline->next->head. This is for numerical erros.
 | 
			
		||||
  //for example, if we delete a line which is almost degeneate 
 | 
			
		||||
  //for example, if we delete a line which is almost degeneate
 | 
			
		||||
  //within (epsilon), then we want to make that the polygon after deletion
 | 
			
		||||
  //is still a valid polygon
 | 
			
		||||
 | 
			
		||||
@@ -107,18 +111,18 @@ static Int myequal(Real a[2], Real b[2])
 | 
			
		||||
  if(a[0]==b[0] && a[1] == b[1])
 | 
			
		||||
    return 1;
 | 
			
		||||
  else
 | 
			
		||||
    return 0;    
 | 
			
		||||
    return 0;
 | 
			
		||||
    */
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  if(fabs(a[0]-b[0]) < 0.00001 &&
 | 
			
		||||
     fabs(a[1]-b[1]) < 0.00001)
 | 
			
		||||
    return 1;
 | 
			
		||||
  else
 | 
			
		||||
    return 0;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
directedLine* directedLine::deleteDegenerateLines()
 | 
			
		||||
{
 | 
			
		||||
  //if there is only one edge or two edges, don't do anything
 | 
			
		||||
@@ -136,7 +140,7 @@ directedLine* directedLine::deleteDegenerateLines()
 | 
			
		||||
  head()[1] != tail()[1])
 | 
			
		||||
  */
 | 
			
		||||
    first = this;
 | 
			
		||||
  else 
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      for(temp = this->next; temp != this; temp = temp->next)
 | 
			
		||||
	{
 | 
			
		||||
@@ -149,7 +153,7 @@ directedLine* directedLine::deleteDegenerateLines()
 | 
			
		||||
	      first = temp;
 | 
			
		||||
	      break;
 | 
			
		||||
	    }
 | 
			
		||||
	  
 | 
			
		||||
        
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -164,17 +168,17 @@ directedLine* directedLine::deleteDegenerateLines()
 | 
			
		||||
  for(temp =first->next; temp != first; temp = tempNext)
 | 
			
		||||
    {
 | 
			
		||||
      tempNext = temp->getNext();
 | 
			
		||||
/*      
 | 
			
		||||
/*
 | 
			
		||||
      if(temp->head()[0] == temp->tail()[0] &&
 | 
			
		||||
	 temp->head()[1] == temp->tail()[1])
 | 
			
		||||
*/	 
 | 
			
		||||
*/      
 | 
			
		||||
 | 
			
		||||
      if(myequal(temp->head(), temp->tail()))
 | 
			
		||||
	deleteSingleLine(temp);
 | 
			
		||||
    }	  
 | 
			
		||||
    }   
 | 
			
		||||
  return first;
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
directedLine* directedLine::deleteDegenerateLinesAllPolygons()
 | 
			
		||||
{
 | 
			
		||||
  directedLine* temp;
 | 
			
		||||
@@ -188,7 +192,7 @@ directedLine* directedLine::deleteDegenerateLinesAllPolygons()
 | 
			
		||||
      if(ret == NULL)
 | 
			
		||||
	{
 | 
			
		||||
	  ret = retEnd = temp->deleteDegenerateLines();
 | 
			
		||||
	  
 | 
			
		||||
        
 | 
			
		||||
	}
 | 
			
		||||
      else
 | 
			
		||||
	{
 | 
			
		||||
@@ -277,7 +281,7 @@ void directedLine::deletePolygonList()
 | 
			
		||||
      temp->deleteSinglePolygon();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*a loop by itself*/
 | 
			
		||||
directedLine::directedLine(short dir, sampledLine* sl)
 | 
			
		||||
@@ -289,7 +293,7 @@ directedLine::directedLine(short dir, sampledLine* sl)
 | 
			
		||||
  nextPolygon = NULL;
 | 
			
		||||
//  prevPolygon = NULL;
 | 
			
		||||
  rootBit = 0;/*important to initilzae to 0 meaning not root yet*/
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  rootLink = NULL;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -305,7 +309,7 @@ directedLine::directedLine()
 | 
			
		||||
  next = this;
 | 
			
		||||
  prev = this;
 | 
			
		||||
  nextPolygon = NULL;
 | 
			
		||||
  rootBit = 0;/*important to initilzae to 0 meaning not root yet*/  
 | 
			
		||||
  rootBit = 0;/*important to initilzae to 0 meaning not root yet*/
 | 
			
		||||
  rootLink = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -344,7 +348,7 @@ Int directedLine::numEdges()
 | 
			
		||||
  Int ret=0;
 | 
			
		||||
  directedLine* temp;
 | 
			
		||||
  if(next == this) return 1;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  ret = 1;
 | 
			
		||||
  for(temp = next; temp != this; temp = temp->next)
 | 
			
		||||
    ret++;
 | 
			
		||||
@@ -373,7 +377,7 @@ short directedLine::isPolygon()
 | 
			
		||||
 | 
			
		||||
  /*check this edge*/
 | 
			
		||||
  if(! isConnected()) return 0;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /*check all other edges*/
 | 
			
		||||
  for(temp=next; temp != this; temp = temp->next){
 | 
			
		||||
    if(!isConnected()) return 0;
 | 
			
		||||
@@ -381,14 +385,14 @@ short directedLine::isPolygon()
 | 
			
		||||
  return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*check if the head of this edge is connected to 
 | 
			
		||||
/*check if the head of this edge is connected to
 | 
			
		||||
 *the tail of the prev
 | 
			
		||||
 */
 | 
			
		||||
short directedLine::isConnected()
 | 
			
		||||
{
 | 
			
		||||
  if( (head()[0] == prev->tail()[0]) && (head()[1] == prev->tail()[1]))
 | 
			
		||||
    return 1;
 | 
			
		||||
  else 
 | 
			
		||||
  else
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -410,9 +414,9 @@ Int compV2InX(Real A[2], Real B[2])
 | 
			
		||||
 | 
			
		||||
/*compare two vertices NOT lines!
 | 
			
		||||
 *A vertex is the head of a directed line.
 | 
			
		||||
 *(x_1, y_1) <= (x_2, y_2) if 
 | 
			
		||||
 *(x_1, y_1) <= (x_2, y_2) if
 | 
			
		||||
 *either y_1 < y_2
 | 
			
		||||
 *or     y_1 == y_2 && x_1 < x_2.
 | 
			
		||||
 *or	 y_1 == y_2 && x_1 < x_2.
 | 
			
		||||
 *return -1 if this->head() <= nl->head(),
 | 
			
		||||
 *return  1 otherwise
 | 
			
		||||
 */
 | 
			
		||||
@@ -425,9 +429,9 @@ Int directedLine::compInY(directedLine* nl)
 | 
			
		||||
 | 
			
		||||
/*compare two vertices NOT lines!
 | 
			
		||||
 *A vertex is the head of a directed line.
 | 
			
		||||
 *(x_1, y_1) <= (x_2, y_2) if 
 | 
			
		||||
 *(x_1, y_1) <= (x_2, y_2) if
 | 
			
		||||
 *either x_1 < x_2
 | 
			
		||||
 *or     x_1 == x_2 && y_1 < y_2.
 | 
			
		||||
 *or	 x_1 == x_2 && y_1 < y_2.
 | 
			
		||||
 *return -1 if this->head() <= nl->head(),
 | 
			
		||||
 *return  1 otherwise
 | 
			
		||||
 */
 | 
			
		||||
@@ -467,8 +471,8 @@ void directedLine::printSingle()
 | 
			
		||||
{
 | 
			
		||||
  if(direction == INCREASING)
 | 
			
		||||
    printf("direction is INCREASING\n");
 | 
			
		||||
  else 
 | 
			
		||||
    printf("direction is DECREASING\n");    
 | 
			
		||||
  else
 | 
			
		||||
    printf("direction is DECREASING\n");
 | 
			
		||||
  printf("head=%f,%f)\n", head()[0], head()[1]);
 | 
			
		||||
  sline->print();
 | 
			
		||||
}
 | 
			
		||||
@@ -515,7 +519,7 @@ directedLine* directedLine::cutoffPolygon(directedLine *p)
 | 
			
		||||
 | 
			
		||||
  for(temp=this; temp != p; temp = temp->nextPolygon)
 | 
			
		||||
    {
 | 
			
		||||
      if(temp == NULL) 
 | 
			
		||||
      if(temp == NULL)
 | 
			
		||||
	{
 | 
			
		||||
	  fprintf(stderr, "in cutoffPolygon, not found\n");
 | 
			
		||||
	  exit(1);
 | 
			
		||||
@@ -531,7 +535,7 @@ directedLine* directedLine::cutoffPolygon(directedLine *p)
 | 
			
		||||
  else {
 | 
			
		||||
    prev_polygon->nextPolygon = p->nextPolygon;
 | 
			
		||||
    return this;
 | 
			
		||||
  } 
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Int directedLine::numPolygons()
 | 
			
		||||
@@ -539,9 +543,9 @@ Int directedLine::numPolygons()
 | 
			
		||||
  if(nextPolygon == NULL) return 1;
 | 
			
		||||
  else return 1+nextPolygon->numPolygons();
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
/*let  array[index ...] denote 
 | 
			
		||||
 | 
			
		||||
/*let  array[index ...] denote
 | 
			
		||||
 *all the edges in this polygon
 | 
			
		||||
 *return the next available index of array.
 | 
			
		||||
 */
 | 
			
		||||
@@ -555,8 +559,8 @@ Int directedLine::toArraySinglePolygon(directedLine** array, Int index)
 | 
			
		||||
    }
 | 
			
		||||
  return index;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
/*the space is allocated. The caller is responsible for 
 | 
			
		||||
 | 
			
		||||
/*the space is allocated. The caller is responsible for
 | 
			
		||||
 *deallocate the space.
 | 
			
		||||
 *total_num_edges is set to be the total number of edges of all polygons
 | 
			
		||||
 */
 | 
			
		||||
@@ -602,14 +606,14 @@ Real directedLine::polyArea()
 | 
			
		||||
/*******************split or combine polygons begin********************/
 | 
			
		||||
/*conect a diagonal of a single simple polygon or  two simple polygons.
 | 
			
		||||
 *If the two vertices v1 (head) and v2 (head) are in the same simple polygon,
 | 
			
		||||
 *then we actually split the simple polygon into two polygons. 
 | 
			
		||||
 *then we actually split the simple polygon into two polygons.
 | 
			
		||||
 *If instead two vertices velong to two difference polygons,
 | 
			
		||||
 *then we combine the  two polygons into one polygon.
 | 
			
		||||
 *It is upto the caller to decide whether this is a split or a 
 | 
			
		||||
 *It is upto the caller to decide whether this is a split or a
 | 
			
		||||
 *combination.
 | 
			
		||||
 *
 | 
			
		||||
 *Case Split:
 | 
			
		||||
 *split a single simple polygon into two simple polygons by 
 | 
			
		||||
 *split a single simple polygon into two simple polygons by
 | 
			
		||||
 *connecting a diagonal (two vertices).
 | 
			
		||||
 *v1, v2: the two vertices are the head() of the two directedLines.
 | 
			
		||||
 *  this routine generates one new sampledLine which is returned in
 | 
			
		||||
@@ -625,11 +629,11 @@ Real directedLine::polyArea()
 | 
			
		||||
 *the returned polygon is returned in ret_p1.
 | 
			
		||||
 */
 | 
			
		||||
/*ARGSUSED*/
 | 
			
		||||
void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, 
 | 
			
		||||
			   directedLine** ret_p1, 
 | 
			
		||||
void directedLine::connectDiagonal(directedLine* v1, directedLine* v2,
 | 
			
		||||
			   directedLine** ret_p1,
 | 
			
		||||
			   directedLine** ret_p2,
 | 
			
		||||
			   sampledLine** generatedLine,
 | 
			
		||||
			   directedLine* polygonList				   				   )
 | 
			
		||||
			   directedLine* polygonList								   )
 | 
			
		||||
{
 | 
			
		||||
  sampledLine *nsline  = new sampledLine(2);
 | 
			
		||||
 | 
			
		||||
@@ -637,7 +641,7 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2,
 | 
			
		||||
 | 
			
		||||
  nsline->setPoint(0, v1->head());
 | 
			
		||||
  nsline->setPoint(1, v2->head());
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /*the increasing line is from v1 head to v2 head*/
 | 
			
		||||
@@ -651,12 +655,12 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2,
 | 
			
		||||
  directedLine* v1Prev = v1->prev;
 | 
			
		||||
  directedLine* v2Prev = v2->prev;
 | 
			
		||||
 | 
			
		||||
  v1        ->prev = newLineDec; 
 | 
			
		||||
  v1	    ->prev = newLineDec;
 | 
			
		||||
  v2Prev    ->next = newLineDec;
 | 
			
		||||
  newLineDec->next = v1;
 | 
			
		||||
  newLineDec->prev = v2Prev;
 | 
			
		||||
 | 
			
		||||
  v2        ->prev = newLineInc;
 | 
			
		||||
  v2	    ->prev = newLineInc;
 | 
			
		||||
  v1Prev    ->next = newLineInc;
 | 
			
		||||
  newLineInc->next = v2;
 | 
			
		||||
  newLineInc->prev = v1Prev;
 | 
			
		||||
@@ -668,19 +672,19 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2,
 | 
			
		||||
 | 
			
		||||
//see the function connectDiangle
 | 
			
		||||
/*ARGSUSED*/
 | 
			
		||||
void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, 
 | 
			
		||||
			   directedLine** ret_p1, 
 | 
			
		||||
void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2,
 | 
			
		||||
			   directedLine** ret_p1,
 | 
			
		||||
			   directedLine** ret_p2,
 | 
			
		||||
			   directedLine* polygonList				   				   )
 | 
			
		||||
			   directedLine* polygonList								   )
 | 
			
		||||
{
 | 
			
		||||
  sampledLine *nsline  = new sampledLine(2);
 | 
			
		||||
  sampledLine *nsline2  = new sampledLine(2);
 | 
			
		||||
  sampledLine *nsline2	= new sampledLine(2);
 | 
			
		||||
 | 
			
		||||
  nsline->setPoint(0, v1->head());
 | 
			
		||||
  nsline->setPoint(1, v2->head());
 | 
			
		||||
  nsline2->setPoint(0, v1->head());
 | 
			
		||||
  nsline2->setPoint(1, v2->head());
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /*the increasing line is from v1 head to v2 head*/
 | 
			
		||||
  directedLine* newLineInc = new directedLine(INCREASING, nsline);
 | 
			
		||||
 | 
			
		||||
@@ -689,12 +693,12 @@ void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2,
 | 
			
		||||
  directedLine* v1Prev = v1->prev;
 | 
			
		||||
  directedLine* v2Prev = v2->prev;
 | 
			
		||||
 | 
			
		||||
  v1        ->prev = newLineDec; 
 | 
			
		||||
  v1	    ->prev = newLineDec;
 | 
			
		||||
  v2Prev    ->next = newLineDec;
 | 
			
		||||
  newLineDec->next = v1;
 | 
			
		||||
  newLineDec->prev = v2Prev;
 | 
			
		||||
 | 
			
		||||
  v2        ->prev = newLineInc;
 | 
			
		||||
  v2	    ->prev = newLineInc;
 | 
			
		||||
  v1Prev    ->next = newLineInc;
 | 
			
		||||
  newLineInc->next = v2;
 | 
			
		||||
  newLineInc->prev = v1Prev;
 | 
			
		||||
@@ -793,7 +797,7 @@ directedLine* readAllPolygons(char* filename)
 | 
			
		||||
  Int nPolygons;
 | 
			
		||||
  fscanf(fp, "%i", &nPolygons);
 | 
			
		||||
  directedLine *ret = NULL;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  for(i=0; i<nPolygons; i++)
 | 
			
		||||
    {
 | 
			
		||||
      Int nEdges;
 | 
			
		||||
@@ -810,7 +814,7 @@ directedLine* readAllPolygons(char* filename)
 | 
			
		||||
      sampledLine *sLine = new sampledLine(2, vert);
 | 
			
		||||
      directedLine *thisPoly = new directedLine(INCREASING, sLine);
 | 
			
		||||
thisPoly->rootLinkSet(NULL);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      directedLine *dLine;
 | 
			
		||||
      for(j=2; j<nEdges; j++)
 | 
			
		||||
	{
 | 
			
		||||
@@ -830,7 +834,7 @@ dLine->rootLinkSet(thisPoly);
 | 
			
		||||
      dLine = new directedLine(INCREASING, sLine);
 | 
			
		||||
dLine->rootLinkSet(thisPoly);
 | 
			
		||||
      thisPoly->insert(dLine);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      ret = thisPoly->insertPolygon(ret);
 | 
			
		||||
    }
 | 
			
		||||
  fclose(fp);
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -31,10 +31,10 @@
 | 
			
		||||
** published by SGI, but has not been independently verified as being
 | 
			
		||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
 | 
			
		||||
** $Date: 2003/11/21 15:49:26 $ $Revision: 1.2.14.1 $
 | 
			
		||||
*/
 | 
			
		||||
/*
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.2.14.1 2003/11/21 15:49:26 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
@@ -43,6 +43,11 @@
 | 
			
		||||
#include "zlassert.h"
 | 
			
		||||
#include "polyDBG.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __WATCOMC__
 | 
			
		||||
#pragma warning 14  10
 | 
			
		||||
#pragma warning 391 10
 | 
			
		||||
#pragma warning 726 10
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static Real area(Real A[2], Real B[2], Real C[2])
 | 
			
		||||
{
 | 
			
		||||
@@ -71,7 +76,7 @@ Int DBG_is_U_monotone(directedLine* poly)
 | 
			
		||||
{
 | 
			
		||||
  Int n_changes = 0;
 | 
			
		||||
  Int prev_sign;
 | 
			
		||||
  Int cur_sign;  
 | 
			
		||||
  Int cur_sign;
 | 
			
		||||
   directedLine* temp;
 | 
			
		||||
  cur_sign = compV2InX(poly->tail(), poly->head());
 | 
			
		||||
 | 
			
		||||
@@ -119,7 +124,7 @@ Int DBG_is_U_direction(directedLine* poly)
 | 
			
		||||
      if(temp->head()[0] == temp->tail()[0])
 | 
			
		||||
	V_count += temp->get_npoints();
 | 
			
		||||
      else if(temp->head()[1] == temp->tail()[1])
 | 
			
		||||
	U_count += temp->get_npoints();      
 | 
			
		||||
	U_count += temp->get_npoints();
 | 
			
		||||
	*/
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -142,7 +147,7 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2)
 | 
			
		||||
	     (l1->tail()[1] - l1->head()[1])*(l2->tail()[1]-l2->head()[1]) >=0)
 | 
			
		||||
	    return 0; //not intersect
 | 
			
		||||
	  else
 | 
			
		||||
	    return 1;	    
 | 
			
		||||
	    return 1;
 | 
			
		||||
	}
 | 
			
		||||
      //else we use the normal code
 | 
			
		||||
    }
 | 
			
		||||
@@ -154,8 +159,8 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2)
 | 
			
		||||
	     (l2->tail()[1] - l2->head()[1])*(l1->tail()[1]-l1->head()[1]) >=0)
 | 
			
		||||
	    return 0; //not intersect
 | 
			
		||||
	  else
 | 
			
		||||
	    return 1;	    
 | 
			
		||||
	}      
 | 
			
		||||
	    return 1;
 | 
			
		||||
	}
 | 
			
		||||
      //else we use the normal code
 | 
			
		||||
    }
 | 
			
		||||
  else //the two edges are not connected
 | 
			
		||||
@@ -165,11 +170,11 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2)
 | 
			
		||||
	 (l1->tail()[0] == l2->tail()[0] &&
 | 
			
		||||
	 l1->tail()[1] == l2->tail()[1]))
 | 
			
		||||
	return 1;
 | 
			
		||||
	
 | 
			
		||||
    }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if( 
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  if(
 | 
			
		||||
     (
 | 
			
		||||
      area(l1->head(), l1->tail(), l2->head())
 | 
			
		||||
      *
 | 
			
		||||
@@ -184,7 +189,7 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2)
 | 
			
		||||
      )
 | 
			
		||||
     )
 | 
			
		||||
    return 1;
 | 
			
		||||
  else 
 | 
			
		||||
  else
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -207,7 +212,7 @@ Int DBG_edgesIntersectGen(Real A[2], Real B[2], Real C[2], Real D[2])
 | 
			
		||||
  else
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
/*determien whether    (A,B) interesect chain[start] to [end]
 | 
			
		||||
 */
 | 
			
		||||
Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B[2])
 | 
			
		||||
@@ -216,13 +221,13 @@ Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B
 | 
			
		||||
  for(i=start; i<=end-2; i++)
 | 
			
		||||
    if(DBG_edgesIntersectGen(chain->getVertex(i), chain->getVertex(i+1), A, B))
 | 
			
		||||
      return 1;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*determine whether a polygon intersect itself or not
 | 
			
		||||
 *return 1 is it does,
 | 
			
		||||
 *       0 otherwise
 | 
			
		||||
 *	 0 otherwise
 | 
			
		||||
 */
 | 
			
		||||
Int DBG_polygonSelfIntersect(directedLine* poly)
 | 
			
		||||
{
 | 
			
		||||
@@ -235,7 +240,7 @@ Int DBG_polygonSelfIntersect(directedLine* poly)
 | 
			
		||||
	{
 | 
			
		||||
	  return 1;
 | 
			
		||||
	}
 | 
			
		||||
	  
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  for(temp1=poly->getNext(); temp1 != poly; temp1 = temp1->getNext())
 | 
			
		||||
@@ -261,7 +266,7 @@ Int DBG_edgeIntersectPoly(directedLine* edge, directedLine* poly)
 | 
			
		||||
      return 1;
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
/*check whether two polygons intersect
 | 
			
		||||
 */
 | 
			
		||||
Int DBG_polygonsIntersect(directedLine* p1, directedLine* p2)
 | 
			
		||||
@@ -291,7 +296,7 @@ Int DBG_polygonListIntersect(directedLine* pList)
 | 
			
		||||
	if(DBG_polygonsIntersect(temp, temp2))
 | 
			
		||||
	  return 1;
 | 
			
		||||
    }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -303,16 +308,16 @@ Int DBG_isCounterclockwise(directedLine* poly)
 | 
			
		||||
 | 
			
		||||
/*ray: v0 with direction (dx,dy).
 | 
			
		||||
 *edge: v1-v2.
 | 
			
		||||
 * the extra point v10[2] is given for the information at 
 | 
			
		||||
 * the extra point v10[2] is given for the information at
 | 
			
		||||
 *v1. Basically this edge is connectd to edge
 | 
			
		||||
 * v10-v1. If v1 is on the ray, 
 | 
			
		||||
 * v10-v1. If v1 is on the ray,
 | 
			
		||||
 * then we need v10  to determine whether this ray intersects
 | 
			
		||||
 * the edge or not (that is, return 1 or return 0). 
 | 
			
		||||
 * the edge or not (that is, return 1 or return 0).
 | 
			
		||||
 * If v1 is on the ray, then if v2 and v10 are on the same side of the ray,
 | 
			
		||||
 * we return 0, otherwise return 1.
 | 
			
		||||
 *For v2, if v2 is on the ray, we always return 0.
 | 
			
		||||
 *Notice that v1 and v2 are not symmetric. So the edge is directed!!!
 | 
			
		||||
 * The purpose for this convention is such that: a point is inside a polygon 
 | 
			
		||||
 * The purpose for this convention is such that: a point is inside a polygon
 | 
			
		||||
 * if and only if it intersets with odd number of edges.
 | 
			
		||||
 */
 | 
			
		||||
Int DBG_rayIntersectEdge(Real v0[2], Real dx, Real dy, Real v10[2], Real v1[2], Real v2[2])
 | 
			
		||||
@@ -330,17 +335,17 @@ if( (v1[1] >= v0[1] && v2[1]<= v0[1] )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /*if the ray is parallel to the edge, return 0: not intersect*/
 | 
			
		||||
  if(denom == 0.0) 
 | 
			
		||||
  if(denom == 0.0)
 | 
			
		||||
    return 0;
 | 
			
		||||
 | 
			
		||||
  /*if v0 is on the edge, return 0: not intersect*/
 | 
			
		||||
  if(nomRay == 0.0) 
 | 
			
		||||
  if(nomRay == 0.0)
 | 
			
		||||
    return 0;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /*if v1 is on the positive ray, and the neighbor of v1 crosses the ray
 | 
			
		||||
   *return 1: intersect
 | 
			
		||||
   */
 | 
			
		||||
  if(nomEdge == 0) 
 | 
			
		||||
  if(nomEdge == 0)
 | 
			
		||||
    { /*v1 is on the positive or negative ray*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -351,7 +356,7 @@ if( (v1[1] >= v0[1] && v2[1]<= v0[1] )
 | 
			
		||||
	{
 | 
			
		||||
	  if(area(v0, v1, v10) * area(v0, v1, v2) >0)
 | 
			
		||||
	    return 0;
 | 
			
		||||
	  else 
 | 
			
		||||
	  else
 | 
			
		||||
	    return 1;
 | 
			
		||||
	}
 | 
			
		||||
      else /*v1 on negative ray*/
 | 
			
		||||
@@ -378,10 +383,10 @@ Int DBG_rayIntersectPoly(Real v0[2], Real dx, Real dy, directedLine* poly)
 | 
			
		||||
  Int count=0;
 | 
			
		||||
  if(DBG_rayIntersectEdge(v0, dx, dy, poly->getPrev()->head(), poly->head(), poly->tail()))
 | 
			
		||||
    count++;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  for(temp=poly->getNext(); temp != poly; temp = temp->getNext())
 | 
			
		||||
    if(DBG_rayIntersectEdge(v0, dx, dy, temp->getPrev()->head(), temp->head(), temp->tail()))
 | 
			
		||||
      count++;    
 | 
			
		||||
      count++;
 | 
			
		||||
/*printf("ray intersect poly: count=%i\n", count);*/
 | 
			
		||||
  return count;
 | 
			
		||||
}
 | 
			
		||||
@@ -398,8 +403,8 @@ poly->printList();
 | 
			
		||||
	 == (DBG_rayIntersectPoly(v,1,Real(0.1234), poly) % 2 )
 | 
			
		||||
	 );
 | 
			
		||||
  if(DBG_rayIntersectPoly(v, 1, 0, poly) % 2 == 1)
 | 
			
		||||
    return 1; 
 | 
			
		||||
  else 
 | 
			
		||||
    return 1;
 | 
			
		||||
  else
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -410,8 +415,8 @@ Int DBG_enclosingPolygons(directedLine* poly, directedLine* list)
 | 
			
		||||
{
 | 
			
		||||
  directedLine* temp;
 | 
			
		||||
  Int count=0;
 | 
			
		||||
/*  
 | 
			
		||||
printf("%i\n", DBG_pointInsidePoly(poly->head(), 
 | 
			
		||||
/*
 | 
			
		||||
printf("%i\n", DBG_pointInsidePoly(poly->head(),
 | 
			
		||||
				   list->getNextPolygon()
 | 
			
		||||
				   ->getNextPolygon()
 | 
			
		||||
				   ->getNextPolygon()
 | 
			
		||||
@@ -423,15 +428,15 @@ printf("%i\n", DBG_pointInsidePoly(poly->head(),
 | 
			
		||||
    {
 | 
			
		||||
      if(poly != temp)
 | 
			
		||||
	if(DBG_pointInsidePoly(poly->head(), temp))
 | 
			
		||||
	  count++;    
 | 
			
		||||
/*      printf("count=%i\n", count);*/
 | 
			
		||||
	  count++;
 | 
			
		||||
/*	printf("count=%i\n", count);*/
 | 
			
		||||
    }
 | 
			
		||||
  return count;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void  DBG_reverse(directedLine* poly)
 | 
			
		||||
{
 | 
			
		||||
  if(poly->getDirection() == INCREASING) 
 | 
			
		||||
  if(poly->getDirection() == INCREASING)
 | 
			
		||||
    poly->putDirection(DECREASING);
 | 
			
		||||
  else
 | 
			
		||||
    poly->putDirection(INCREASING);
 | 
			
		||||
@@ -443,7 +448,7 @@ void  DBG_reverse(directedLine* poly)
 | 
			
		||||
  directedLine* temp;
 | 
			
		||||
  for(temp=oldNext; temp!=poly; temp = oldNext)
 | 
			
		||||
    {
 | 
			
		||||
      if(temp->getDirection() == INCREASING) 
 | 
			
		||||
      if(temp->getDirection() == INCREASING)
 | 
			
		||||
	temp->putDirection(DECREASING);
 | 
			
		||||
      else
 | 
			
		||||
	temp->putDirection(INCREASING);
 | 
			
		||||
@@ -512,7 +517,7 @@ Int DBG_check(directedLine *polyList)
 | 
			
		||||
	correctDir = 0; /*clockwise*/
 | 
			
		||||
 | 
			
		||||
      Int actualDir = DBG_isCounterclockwise(temp);
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      if(correctDir != actualDir)
 | 
			
		||||
	{
 | 
			
		||||
	  fprintf(stderr, "DBG_check: polygon with incorrect orientations. reversed\n");
 | 
			
		||||
@@ -526,7 +531,7 @@ Int DBG_check(directedLine *polyList)
 | 
			
		||||
 | 
			
		||||
/**************handle self intersections*****************/
 | 
			
		||||
//determine whether e interects [begin, end] or not
 | 
			
		||||
static directedLine* DBG_edgeIntersectChainD(directedLine *e, 
 | 
			
		||||
static directedLine* DBG_edgeIntersectChainD(directedLine *e,
 | 
			
		||||
			       directedLine *begin, directedLine *end)
 | 
			
		||||
{
 | 
			
		||||
  directedLine *temp;
 | 
			
		||||
@@ -537,10 +542,10 @@ static directedLine* DBG_edgeIntersectChainD(directedLine *e,
 | 
			
		||||
    }
 | 
			
		||||
  if(DBG_edgesIntersect(e, end))
 | 
			
		||||
    return end;
 | 
			
		||||
  return NULL;      
 | 
			
		||||
  return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//given a polygon, cut the edges off and finally obtain a 
 | 
			
		||||
//given a polygon, cut the edges off and finally obtain a
 | 
			
		||||
//a polygon without intersections. The cut-off edges are
 | 
			
		||||
//dealloated. The new polygon is returned.
 | 
			
		||||
directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur)
 | 
			
		||||
@@ -563,7 +568,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur)
 | 
			
		||||
	       Int n=5;
 | 
			
		||||
	       buf[0] = interc->tail()[0];
 | 
			
		||||
	       buf[1] = interc->tail()[1];
 | 
			
		||||
	       
 | 
			
		||||
 | 
			
		||||
	       for(i=1; i<n; i++)
 | 
			
		||||
		 {
 | 
			
		||||
		   Real r = ((Real)i) / ((Real) n);
 | 
			
		||||
@@ -591,7 +596,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur)
 | 
			
		||||
	    {
 | 
			
		||||
	      cutOccur = 1;
 | 
			
		||||
	      begin->deleteSingleLine(next);
 | 
			
		||||
	      
 | 
			
		||||
 | 
			
		||||
	      if(begin != end)
 | 
			
		||||
		{
 | 
			
		||||
		  if(DBG_polygonSelfIntersect(begin))
 | 
			
		||||
@@ -615,7 +620,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur)
 | 
			
		||||
  return begin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//given a polygon, cut the edges off and finally obtain a 
 | 
			
		||||
//given a polygon, cut the edges off and finally obtain a
 | 
			
		||||
//a polygon without intersections. The cut-off edges are
 | 
			
		||||
//dealloated. The new polygon is returned.
 | 
			
		||||
static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon)
 | 
			
		||||
@@ -642,7 +647,7 @@ static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon)
 | 
			
		||||
	  crt=crt->deleteChain(crt, crt->getNext());
 | 
			
		||||
	}
 | 
			
		||||
      else
 | 
			
		||||
	{	  
 | 
			
		||||
	{
 | 
			
		||||
	  //now we know crt and crt->getNext do not intersect
 | 
			
		||||
	  begin = crt;
 | 
			
		||||
	  end = crt->getNext();
 | 
			
		||||
@@ -651,8 +656,8 @@ static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon)
 | 
			
		||||
	  for(temp=end->getNext(); temp!=begin; temp= temp->getNext())
 | 
			
		||||
	    {
 | 
			
		||||
//printf("temp=(%f,%f)\n", temp->head()[0], temp->head()[1]);
 | 
			
		||||
               directedLine *intersect = DBG_edgeIntersectChainD(temp, begin, end);
 | 
			
		||||
               if(intersect != NULL)
 | 
			
		||||
	       directedLine *intersect = DBG_edgeIntersectChainD(temp, begin, end);
 | 
			
		||||
	       if(intersect != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		  crt = crt->deleteChain(intersect, temp);
 | 
			
		||||
		  find=1;
 | 
			
		||||
@@ -686,7 +691,7 @@ directedLine* DBG_cutIntersectionAllPoly(directedLine* list)
 | 
			
		||||
      if(left != NULL)
 | 
			
		||||
	ret=left->insertPolygon(ret);
 | 
			
		||||
    }
 | 
			
		||||
  return ret;            
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sampledLine*  DBG_collectSampledLinesAllPoly(directedLine *polygonList)
 | 
			
		||||
@@ -709,7 +714,7 @@ sampledLine*  DBG_collectSampledLinesAllPoly(directedLine *polygonList)
 | 
			
		||||
      DBG_collectSampledLinesPoly(temp, tempHead, tempTail);
 | 
			
		||||
      cTail->insert(tempHead);
 | 
			
		||||
      cTail = tempTail;
 | 
			
		||||
    }  
 | 
			
		||||
    }
 | 
			
		||||
  return cHead;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -721,7 +726,7 @@ void  DBG_collectSampledLinesPoly(directedLine *polygon, sampledLine*& retHead,
 | 
			
		||||
  retTail = NULL;
 | 
			
		||||
  if(polygon == NULL)
 | 
			
		||||
    return;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
  retHead = retTail = polygon->getSampledLine();
 | 
			
		||||
  for(temp = polygon->getNext(); temp != polygon; temp=temp->getNext())
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
** Author: Eric Veach, July 1994.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/geom.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
 | 
			
		||||
** $Date: 2003/11/21 15:49:26 $ $Revision: 1.1.16.1 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/geom.h,v 1.1.16.1 2003/11/21 15:49:26 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef __geom_h_
 | 
			
		||||
@@ -58,8 +58,8 @@
 | 
			
		||||
                         ((u)->s == (v)->s && (u)->t <= (v)->t))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define EdgeEval(u,v,w)	__gl_edgeEval(u,v,w)
 | 
			
		||||
#define EdgeSign(u,v,w)	__gl_edgeSign(u,v,w)
 | 
			
		||||
#define EdgeEval(u,v,w) __gl_edgeEval(u,v,w)
 | 
			
		||||
#define EdgeSign(u,v,w) __gl_edgeSign(u,v,w)
 | 
			
		||||
 | 
			
		||||
/* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */
 | 
			
		||||
 | 
			
		||||
@@ -69,11 +69,12 @@
 | 
			
		||||
#define TransSign(u,v,w)	__gl_transSign(u,v,w)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define EdgeGoesLeft(e)		VertLeq( (e)->Dst, (e)->Org )
 | 
			
		||||
#define EdgeGoesLeft(e) 	VertLeq( (e)->Dst, (e)->Org )
 | 
			
		||||
#define EdgeGoesRight(e)	VertLeq( (e)->Org, (e)->Dst )
 | 
			
		||||
 | 
			
		||||
#undef	ABS
 | 
			
		||||
#define ABS(x)	((x) < 0 ? -(x) : (x))
 | 
			
		||||
#define VertL1dist(u,v)	(ABS(u->s - v->s) + ABS(u->t - v->t))
 | 
			
		||||
#define VertL1dist(u,v) (ABS(u->s - v->s) + ABS(u->t - v->t))
 | 
			
		||||
 | 
			
		||||
#define VertCCW(u,v,w)	__gl_vertCCW(u,v,w)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
** Author: Eric Veach, July 1994.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2002/11/01 23:45:31 $ $Revision: 1.2 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/normal.c,v 1.2 2002/11/01 23:45:31 brianp Exp $
 | 
			
		||||
** $Date: 2003/11/21 15:49:26 $ $Revision: 1.2.12.1 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/normal.c,v 1.2.12.1 2003/11/21 15:49:26 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include "gluos.h"
 | 
			
		||||
@@ -64,6 +64,7 @@ static void Normalize( GLdouble v[3] )
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#undef	ABS
 | 
			
		||||
#define ABS(x)	((x) < 0 ? -(x) : (x))
 | 
			
		||||
 | 
			
		||||
static int LongAxis( GLdouble v[3] )
 | 
			
		||||
@@ -138,7 +139,7 @@ static void ComputeNormal( GLUtesselator *tess, GLdouble norm[3] )
 | 
			
		||||
    norm[LongAxis(d1)] = 1;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void CheckOrientation( GLUtesselator *tess )
 | 
			
		||||
{
 | 
			
		||||
@@ -176,7 +177,7 @@ extern int RandomSweep;
 | 
			
		||||
#define S_UNIT_X	(RandomSweep ? (2*drand48()-1) : 1.0)
 | 
			
		||||
#define S_UNIT_Y	(RandomSweep ? (2*drand48()-1) : 0.0)
 | 
			
		||||
#else
 | 
			
		||||
#if defined(SLANTED_SWEEP) 
 | 
			
		||||
#if defined(SLANTED_SWEEP)
 | 
			
		||||
/* The "feature merging" is not intended to be complete.  There are
 | 
			
		||||
 * special cases where edges are nearly parallel to the sweep line
 | 
			
		||||
 * which are not implemented.  The algorithm should still behave
 | 
			
		||||
@@ -242,7 +243,7 @@ void __gl_projectPolygon( GLUtesselator *tess )
 | 
			
		||||
  sUnit[i] = 0;
 | 
			
		||||
  sUnit[(i+1)%3] = S_UNIT_X;
 | 
			
		||||
  sUnit[(i+2)%3] = S_UNIT_Y;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  tUnit[i] = 0;
 | 
			
		||||
  tUnit[(i+1)%3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y;
 | 
			
		||||
  tUnit[(i+2)%3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
** Author: Eric Veach, July 1994.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2002/11/07 14:17:05 $ $Revision: 1.5 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/sweep.c,v 1.5 2002/11/07 14:17:05 brianp Exp $
 | 
			
		||||
** $Date: 2003/11/21 15:49:26 $ $Revision: 1.5.12.1 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/sweep.c,v 1.5.12.1 2003/11/21 15:49:26 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include "gluos.h"
 | 
			
		||||
@@ -92,6 +92,8 @@ extern void DebugEvent( GLUtesselator *tess );
 | 
			
		||||
 *   when it is necessary.)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#undef	MAX
 | 
			
		||||
#undef	MIN
 | 
			
		||||
#define MAX(x,y)	((x) >= (y) ? (x) : (y))
 | 
			
		||||
#define MIN(x,y)	((x) <= (y) ? (x) : (y))
 | 
			
		||||
 | 
			
		||||
@@ -99,7 +101,7 @@ extern void DebugEvent( GLUtesselator *tess );
 | 
			
		||||
 * winding of the new edge.
 | 
			
		||||
 */
 | 
			
		||||
#define AddWinding(eDst,eSrc)	(eDst->winding += eSrc->winding, \
 | 
			
		||||
				 eDst->Sym->winding += eSrc->Sym->winding)
 | 
			
		||||
                                 eDst->Sym->winding += eSrc->Sym->winding)
 | 
			
		||||
 | 
			
		||||
static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent );
 | 
			
		||||
static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp );
 | 
			
		||||
@@ -175,7 +177,7 @@ static int FixUpperEdge( ActiveRegion *reg, GLUhalfEdge *newEdge )
 | 
			
		||||
  reg->eUp = newEdge;
 | 
			
		||||
  newEdge->activeRegion = reg;
 | 
			
		||||
 | 
			
		||||
  return 1; 
 | 
			
		||||
  return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ActiveRegion *TopLeftRegion( ActiveRegion *reg )
 | 
			
		||||
@@ -225,7 +227,7 @@ static ActiveRegion *AddRegionBelow( GLUtesselator *tess,
 | 
			
		||||
  if (regNew == NULL) longjmp(tess->env,1);
 | 
			
		||||
 | 
			
		||||
  regNew->eUp = eNewUp;
 | 
			
		||||
  /* __gl_dictListInsertBefore */ 
 | 
			
		||||
  /* __gl_dictListInsertBefore */
 | 
			
		||||
  regNew->nodeUp = dictInsertBefore( tess->dict, regAbove->nodeUp, regNew );
 | 
			
		||||
  if (regNew->nodeUp == NULL) longjmp(tess->env,1);
 | 
			
		||||
  regNew->fixUpperEdge = FALSE;
 | 
			
		||||
@@ -292,7 +294,7 @@ static GLUhalfEdge *FinishLeftRegions( GLUtesselator *tess,
 | 
			
		||||
 * active region to the face, since at this point each face will belong
 | 
			
		||||
 * to at most one region (this was not necessarily true until this point
 | 
			
		||||
 * in the sweep).  The walk stops at the region above regLast; if regLast
 | 
			
		||||
 * is NULL we walk as far as possible.  At the same time we relink the
 | 
			
		||||
 * is NULL we walk as far as possible.	At the same time we relink the
 | 
			
		||||
 * mesh if necessary, so that the ordering of edges around vOrg is the
 | 
			
		||||
 * same as in the dictionary.
 | 
			
		||||
 */
 | 
			
		||||
@@ -449,11 +451,11 @@ static void SpliceMergeVertices( GLUtesselator *tess, GLUhalfEdge *e1,
 | 
			
		||||
  data[0] = e1->Org->data;
 | 
			
		||||
  data[1] = e2->Org->data;
 | 
			
		||||
  CallCombine( tess, e1->Org, data, weights, FALSE );
 | 
			
		||||
  if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1); 
 | 
			
		||||
  if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void VertexWeights( GLUvertex *isect, GLUvertex *org, GLUvertex *dst,
 | 
			
		||||
                           GLfloat *weights )
 | 
			
		||||
			   GLfloat *weights )
 | 
			
		||||
/*
 | 
			
		||||
 * Find some weights which describe how the intersection vertex is
 | 
			
		||||
 * a linear combination of "org" and "dest".  Each of the two edges
 | 
			
		||||
@@ -596,7 +598,7 @@ static int CheckForLeftSplice( GLUtesselator *tess, ActiveRegion *regUp )
 | 
			
		||||
    /* eUp->Dst is below eLo, so splice eUp->Dst into eLo */
 | 
			
		||||
    regUp->dirty = regLo->dirty = TRUE;
 | 
			
		||||
    e = __gl_meshSplitEdge( eLo );
 | 
			
		||||
    if (e == NULL) longjmp(tess->env,1);    
 | 
			
		||||
    if (e == NULL) longjmp(tess->env,1);
 | 
			
		||||
    if ( !__gl_meshSplice( eUp->Lnext, eLo->Sym ) ) longjmp(tess->env,1);
 | 
			
		||||
    e->Rface->inside = regUp->inside;
 | 
			
		||||
  }
 | 
			
		||||
@@ -682,7 +684,7 @@ static int CheckForIntersect( GLUtesselator *tess, ActiveRegion *regUp )
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if(    (! VertEq( dstUp, tess->event )
 | 
			
		||||
  if(	 (! VertEq( dstUp, tess->event )
 | 
			
		||||
	  && EdgeSign( dstUp, tess->event, &isect ) >= 0)
 | 
			
		||||
      || (! VertEq( dstLo, tess->event )
 | 
			
		||||
	  && EdgeSign( dstLo, tess->event, &isect ) <= 0 ))
 | 
			
		||||
@@ -705,7 +707,7 @@ static int CheckForIntersect( GLUtesselator *tess, ActiveRegion *regUp )
 | 
			
		||||
    if( dstUp == tess->event ) {
 | 
			
		||||
      /* Splice dstUp into eLo, and process the new region(s) */
 | 
			
		||||
      if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1);
 | 
			
		||||
      if ( !__gl_meshSplice( eUp->Lnext, eLo->Oprev ) ) longjmp(tess->env,1); 
 | 
			
		||||
      if ( !__gl_meshSplice( eUp->Lnext, eLo->Oprev ) ) longjmp(tess->env,1);
 | 
			
		||||
      regLo = regUp;
 | 
			
		||||
      regUp = TopRightRegion( regUp );
 | 
			
		||||
      e = RegionBelow(regUp)->eUp->Rprev;
 | 
			
		||||
@@ -813,7 +815,7 @@ static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp )
 | 
			
		||||
    if( eUp->Org != eLo->Org ) {
 | 
			
		||||
      if(    eUp->Dst != eLo->Dst
 | 
			
		||||
	  && ! regUp->fixUpperEdge && ! regLo->fixUpperEdge
 | 
			
		||||
          && (eUp->Dst == tess->event || eLo->Dst == tess->event) )
 | 
			
		||||
	  && (eUp->Dst == tess->event || eLo->Dst == tess->event) )
 | 
			
		||||
      {
 | 
			
		||||
	/* When all else fails in CheckForIntersect(), it uses tess->event
 | 
			
		||||
	 * as the intersection location.  To make this possible, it requires
 | 
			
		||||
@@ -822,7 +824,7 @@ static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp )
 | 
			
		||||
	 * case it might splice one of these edges into tess->event, and
 | 
			
		||||
	 * violate the invariant that fixable edges are the only right-going
 | 
			
		||||
	 * edge from their associated vertex).
 | 
			
		||||
         */
 | 
			
		||||
	 */
 | 
			
		||||
	if( CheckForIntersect( tess, regUp )) {
 | 
			
		||||
	  /* WalkDirtyRegions() was called recursively; we're done */
 | 
			
		||||
	  return;
 | 
			
		||||
@@ -846,7 +848,7 @@ static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void ConnectRightVertex( GLUtesselator *tess, ActiveRegion *regUp,
 | 
			
		||||
			        GLUhalfEdge *eBottomLeft )
 | 
			
		||||
				GLUhalfEdge *eBottomLeft )
 | 
			
		||||
/*
 | 
			
		||||
 * Purpose: connect a "right" vertex vEvent (one where all edges go left)
 | 
			
		||||
 * to the unprocessed portion of the mesh.  Since there are no right-going
 | 
			
		||||
@@ -959,7 +961,7 @@ static void ConnectLeftDegenerate( GLUtesselator *tess,
 | 
			
		||||
    SpliceMergeVertices( tess, e, vEvent->anEdge );
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if( ! VertEq( e->Dst, vEvent )) {
 | 
			
		||||
    /* General case -- splice vEvent into edge e which passes through it */
 | 
			
		||||
    if (__gl_meshSplitEdge( e->Sym ) == NULL) longjmp(tess->env,1);
 | 
			
		||||
@@ -969,7 +971,7 @@ static void ConnectLeftDegenerate( GLUtesselator *tess,
 | 
			
		||||
      regUp->fixUpperEdge = FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    if ( !__gl_meshSplice( vEvent->anEdge, e ) ) longjmp(tess->env,1);
 | 
			
		||||
    SweepEvent( tess, vEvent );	/* recurse */
 | 
			
		||||
    SweepEvent( tess, vEvent ); /* recurse */
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -1075,9 +1077,9 @@ static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent )
 | 
			
		||||
  ActiveRegion *regUp, *reg;
 | 
			
		||||
  GLUhalfEdge *e, *eTopLeft, *eBottomLeft;
 | 
			
		||||
 | 
			
		||||
  tess->event = vEvent;		/* for access in EdgeLeq() */
 | 
			
		||||
  tess->event = vEvent; 	/* for access in EdgeLeq() */
 | 
			
		||||
  DebugEvent( tess );
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /* Check if this vertex is the right endpoint of an edge that is
 | 
			
		||||
   * already in the dictionary.  In this case we don't need to waste
 | 
			
		||||
   * time searching for the location to insert new edges.
 | 
			
		||||
@@ -1143,7 +1145,7 @@ static void AddSentinel( GLUtesselator *tess, GLdouble t )
 | 
			
		||||
  e->Org->t = t;
 | 
			
		||||
  e->Dst->s = -SENTINEL_COORD;
 | 
			
		||||
  e->Dst->t = t;
 | 
			
		||||
  tess->event = e->Dst;		/* initialize it */
 | 
			
		||||
  tess->event = e->Dst; 	/* initialize it */
 | 
			
		||||
 | 
			
		||||
  reg->eUp = e;
 | 
			
		||||
  reg->windingNumber = 0;
 | 
			
		||||
@@ -1193,7 +1195,7 @@ static void DoneEdgeDict( GLUtesselator *tess )
 | 
			
		||||
    DeleteRegion( tess, reg );
 | 
			
		||||
/*    __gl_meshDelete( reg->eUp );*/
 | 
			
		||||
  }
 | 
			
		||||
  dictDeleteDict( tess->dict );	/* __gl_dictListDeleteDict */
 | 
			
		||||
  dictDeleteDict( tess->dict ); /* __gl_dictListDeleteDict */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1209,10 +1211,10 @@ static void RemoveDegenerateEdges( GLUtesselator *tess )
 | 
			
		||||
  for( e = eHead->next; e != eHead; e = eNext ) {
 | 
			
		||||
    eNext = e->next;
 | 
			
		||||
    eLnext = e->Lnext;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    if( VertEq( e->Org, e->Dst ) && e->Lnext->Lnext != e ) {
 | 
			
		||||
      /* Zero-length edge, contour has at least 3 edges */
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      SpliceMergeVertices( tess, eLnext, e );	/* deletes e->Org */
 | 
			
		||||
      if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1); /* e is a self-loop */
 | 
			
		||||
      e = eLnext;
 | 
			
		||||
@@ -1220,7 +1222,7 @@ static void RemoveDegenerateEdges( GLUtesselator *tess )
 | 
			
		||||
    }
 | 
			
		||||
    if( eLnext->Lnext == e ) {
 | 
			
		||||
      /* Degenerate contour (one or two edges) */
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      if( eLnext != e ) {
 | 
			
		||||
	if( eLnext == eNext || eLnext == eNext->Sym ) { eNext = eNext->next; }
 | 
			
		||||
	if ( !__gl_meshDelete( eLnext ) ) longjmp(tess->env,1);
 | 
			
		||||
@@ -1327,7 +1329,7 @@ int __gl_computeInterior( GLUtesselator *tess )
 | 
			
		||||
    for( ;; ) {
 | 
			
		||||
      vNext = (GLUvertex *)pqMinimum( tess->pq ); /* __gl_pqSortMinimum */
 | 
			
		||||
      if( vNext == NULL || ! VertEq( vNext, v )) break;
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      /* Merge together all vertices at exactly the same location.
 | 
			
		||||
       * This is more efficient than processing them one at a time,
 | 
			
		||||
       * simplifies the code (see ConnectLeftDegenerate), and is also
 | 
			
		||||
@@ -1349,7 +1351,7 @@ int __gl_computeInterior( GLUtesselator *tess )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* Set tess->event for debugging purposes */
 | 
			
		||||
  /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ 
 | 
			
		||||
  /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */
 | 
			
		||||
  tess->event = ((ActiveRegion *) dictKey( dictMin( tess->dict )))->eUp->Org;
 | 
			
		||||
  DebugEvent( tess );
 | 
			
		||||
  DoneEdgeDict( tess );
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
/*
 | 
			
		||||
** Author: Eric Veach, July 1994.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2002/11/01 23:45:31 $ $Revision: 1.3 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/tess.c,v 1.3 2002/11/01 23:45:31 brianp Exp $
 | 
			
		||||
** $Date: 2003/11/21 15:49:26 $ $Revision: 1.3.12.1 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/tess.c,v 1.3.12.1 2003/11/21 15:49:26 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include "gluos.h"
 | 
			
		||||
@@ -63,13 +63,13 @@
 | 
			
		||||
/*ARGSUSED*/ static void GLAPIENTRY noEnd( void ) {}
 | 
			
		||||
/*ARGSUSED*/ static void GLAPIENTRY noError( GLenum errnum ) {}
 | 
			
		||||
/*ARGSUSED*/ static void GLAPIENTRY noCombine( GLdouble coords[3], void *data[4],
 | 
			
		||||
                                    GLfloat weight[4], void **dataOut ) {}
 | 
			
		||||
				    GLfloat weight[4], void **dataOut ) {}
 | 
			
		||||
/*ARGSUSED*/ static void GLAPIENTRY noMesh( GLUmesh *mesh ) {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*ARGSUSED*/ void GLAPIENTRY __gl_noBeginData( GLenum type,
 | 
			
		||||
					     void *polygonData ) {}
 | 
			
		||||
/*ARGSUSED*/ void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, 
 | 
			
		||||
/*ARGSUSED*/ void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge,
 | 
			
		||||
				       void *polygonData ) {}
 | 
			
		||||
/*ARGSUSED*/ void GLAPIENTRY __gl_noVertexData( void *data,
 | 
			
		||||
					      void *polygonData ) {}
 | 
			
		||||
@@ -85,9 +85,10 @@
 | 
			
		||||
/* Half-edges are allocated in pairs (see mesh.c) */
 | 
			
		||||
typedef struct { GLUhalfEdge e, eSym; } EdgePair;
 | 
			
		||||
 | 
			
		||||
#undef	MAX
 | 
			
		||||
#define MAX(a,b)	((a) > (b) ? (a) : (b))
 | 
			
		||||
#define MAX_FAST_ALLOC	(MAX(sizeof(EdgePair), \
 | 
			
		||||
			 MAX(sizeof(GLUvertex),sizeof(GLUface))))
 | 
			
		||||
                         MAX(sizeof(GLUvertex),sizeof(GLUface))))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLUtesselator * GLAPIENTRY
 | 
			
		||||
@@ -170,7 +171,7 @@ static void GotoState( GLUtesselator *tess, enum TessState newState )
 | 
			
		||||
	gluTessBeginContour( tess );
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
         ;
 | 
			
		||||
	 ;
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      switch( tess->state ) {
 | 
			
		||||
@@ -184,7 +185,7 @@ static void GotoState( GLUtesselator *tess, enum TessState newState )
 | 
			
		||||
	MakeDormant( tess );
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
         ;
 | 
			
		||||
	 ;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@@ -246,7 +247,7 @@ gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value )
 | 
			
		||||
      /* tolerance should be in range [0..1] */
 | 
			
		||||
      assert(0.0 <= tess->relTolerance && tess->relTolerance <= 1.0);
 | 
			
		||||
      *value= tess->relTolerance;
 | 
			
		||||
      break;    
 | 
			
		||||
      break;
 | 
			
		||||
   case GLU_TESS_WINDING_RULE:
 | 
			
		||||
      assert(tess->windingRule == GLU_TESS_WINDING_ODD ||
 | 
			
		||||
	     tess->windingRule == GLU_TESS_WINDING_NONZERO ||
 | 
			
		||||
@@ -295,7 +296,7 @@ gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn)
 | 
			
		||||
    return;
 | 
			
		||||
  case GLU_TESS_EDGE_FLAG_DATA:
 | 
			
		||||
    tess->callEdgeFlagData= (fn == NULL) ?
 | 
			
		||||
	&__gl_noEdgeFlagData : (void (GLAPIENTRY *)(GLboolean, void *)) fn; 
 | 
			
		||||
	&__gl_noEdgeFlagData : (void (GLAPIENTRY *)(GLboolean, void *)) fn;
 | 
			
		||||
    /* If the client wants boundary edges to be flagged,
 | 
			
		||||
     * we render everything as separate triangles (no strips or fans).
 | 
			
		||||
     */
 | 
			
		||||
@@ -313,8 +314,8 @@ gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn)
 | 
			
		||||
    tess->callEnd = (fn == NULL) ? &noEnd : (void (GLAPIENTRY *)(void)) fn;
 | 
			
		||||
    return;
 | 
			
		||||
  case GLU_TESS_END_DATA:
 | 
			
		||||
    tess->callEndData = (fn == NULL) ? &__gl_noEndData : 
 | 
			
		||||
                                       (void (GLAPIENTRY *)(void *)) fn;
 | 
			
		||||
    tess->callEndData = (fn == NULL) ? &__gl_noEndData :
 | 
			
		||||
				       (void (GLAPIENTRY *)(void *)) fn;
 | 
			
		||||
    return;
 | 
			
		||||
  case GLU_TESS_ERROR:
 | 
			
		||||
    tess->callError = (fn == NULL) ? &noError : (void (GLAPIENTRY *)(GLenum)) fn;
 | 
			
		||||
@@ -329,9 +330,9 @@ gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn)
 | 
			
		||||
    return;
 | 
			
		||||
  case GLU_TESS_COMBINE_DATA:
 | 
			
		||||
    tess->callCombineData = (fn == NULL) ? &__gl_noCombineData :
 | 
			
		||||
                                           (void (GLAPIENTRY *)(GLdouble [3],
 | 
			
		||||
						     void *[4], 
 | 
			
		||||
						     GLfloat [4], 
 | 
			
		||||
					   (void (GLAPIENTRY *)(GLdouble [3],
 | 
			
		||||
						     void *[4],
 | 
			
		||||
						     GLfloat [4],
 | 
			
		||||
						     void **,
 | 
			
		||||
						     void *)) fn;
 | 
			
		||||
    return;
 | 
			
		||||
@@ -368,7 +369,7 @@ static int AddVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
 | 
			
		||||
  e->Org->coords[0] = coords[0];
 | 
			
		||||
  e->Org->coords[1] = coords[1];
 | 
			
		||||
  e->Org->coords[2] = coords[2];
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /* The winding of an edge says how the winding number changes as we
 | 
			
		||||
   * cross from the edge''s right face to its left face.  We add the
 | 
			
		||||
   * vertices in such an order that a CCW contour will add +1 to
 | 
			
		||||
@@ -503,7 +504,7 @@ gluTessEndPolygon( GLUtesselator *tess )
 | 
			
		||||
{
 | 
			
		||||
  GLUmesh *mesh;
 | 
			
		||||
 | 
			
		||||
  if (setjmp(tess->env) != 0) {	
 | 
			
		||||
  if (setjmp(tess->env) != 0) { 
 | 
			
		||||
     /* come back here if out of memory */
 | 
			
		||||
     CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
 | 
			
		||||
     return;
 | 
			
		||||
@@ -521,7 +522,7 @@ gluTessEndPolygon( GLUtesselator *tess )
 | 
			
		||||
       * an explicit mesh either.
 | 
			
		||||
       */
 | 
			
		||||
      if( __gl_renderCache( tess )) {
 | 
			
		||||
	tess->polygonData= NULL; 
 | 
			
		||||
	tess->polygonData= NULL;
 | 
			
		||||
	return;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
@@ -554,15 +555,15 @@ gluTessEndPolygon( GLUtesselator *tess )
 | 
			
		||||
    if( tess->boundaryOnly ) {
 | 
			
		||||
      rc = __gl_meshSetWindingNumber( mesh, 1, TRUE );
 | 
			
		||||
    } else {
 | 
			
		||||
      rc = __gl_meshTessellateInterior( mesh ); 
 | 
			
		||||
      rc = __gl_meshTessellateInterior( mesh );
 | 
			
		||||
    }
 | 
			
		||||
    if (rc == 0) longjmp(tess->env,1);	/* could've used a label */
 | 
			
		||||
 | 
			
		||||
    __gl_meshCheckMesh( mesh );
 | 
			
		||||
 | 
			
		||||
    if( tess->callBegin != &noBegin || tess->callEnd != &noEnd
 | 
			
		||||
       || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag 
 | 
			
		||||
       || tess->callBeginData != &__gl_noBeginData 
 | 
			
		||||
       || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag
 | 
			
		||||
       || tess->callBeginData != &__gl_noBeginData
 | 
			
		||||
       || tess->callEndData != &__gl_noEndData
 | 
			
		||||
       || tess->callVertexData != &__gl_noVertexData
 | 
			
		||||
       || tess->callEdgeFlagData != &__gl_noEdgeFlagData )
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -6,21 +6,21 @@
 | 
			
		||||
** 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
 | 
			
		||||
@@ -31,8 +31,8 @@
 | 
			
		||||
** published by SGI, but has not been independently verified as being
 | 
			
		||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
 | 
			
		||||
**
 | 
			
		||||
** $Date: 2002/11/01 23:45:31 $ $Revision: 1.3 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/quad.c,v 1.3 2002/11/01 23:45:31 brianp Exp $
 | 
			
		||||
** $Date: 2003/11/21 15:49:26 $ $Revision: 1.3.12.1 $
 | 
			
		||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/quad.c,v 1.3.12.1 2003/11/21 15:49:26 keithw Exp $
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include "gluos.h"
 | 
			
		||||
@@ -46,10 +46,11 @@
 | 
			
		||||
/* Make it not a power of two to avoid cache thrashing on the chip */
 | 
			
		||||
#define CACHE_SIZE	240
 | 
			
		||||
 | 
			
		||||
#define PI            3.14159265358979323846
 | 
			
		||||
#undef	PI
 | 
			
		||||
#define PI	      3.14159265358979323846
 | 
			
		||||
 | 
			
		||||
struct GLUquadric {
 | 
			
		||||
    GLint 	normals;
 | 
			
		||||
    GLint	normals;
 | 
			
		||||
    GLboolean	textureCoords;
 | 
			
		||||
    GLint	orientation;
 | 
			
		||||
    GLint	drawStyle;
 | 
			
		||||
@@ -70,7 +71,7 @@ gluNewQuadric(void)
 | 
			
		||||
    newstate->textureCoords = GL_FALSE;
 | 
			
		||||
    newstate->orientation = GLU_OUTSIDE;
 | 
			
		||||
    newstate->drawStyle = GLU_FILL;
 | 
			
		||||
    newstate->errorCallback = NULL; 
 | 
			
		||||
    newstate->errorCallback = NULL;
 | 
			
		||||
    return newstate;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -153,7 +154,7 @@ gluQuadricDrawStyle(GLUquadric *qobj, GLenum drawStyle)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLAPIENTRY
 | 
			
		||||
gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, 
 | 
			
		||||
gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
		GLdouble height, GLint slices, GLint stacks)
 | 
			
		||||
{
 | 
			
		||||
    GLint i,j;
 | 
			
		||||
@@ -219,7 +220,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
		sinCache2[i] = -xyNormalRatio * SIN(angle);
 | 
			
		||||
		cosCache2[i] = -xyNormalRatio * COS(angle);
 | 
			
		||||
	    }
 | 
			
		||||
	} 
 | 
			
		||||
	}
 | 
			
		||||
	sinCache[i] = SIN(angle);
 | 
			
		||||
	cosCache[i] = COS(angle);
 | 
			
		||||
    }
 | 
			
		||||
@@ -235,7 +236,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
		cosCache3[i] = -xyNormalRatio * COS(angle);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    } 
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    sinCache[slices] = sinCache[0];
 | 
			
		||||
    cosCache[slices] = cosCache[0];
 | 
			
		||||
@@ -252,8 +253,8 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
      case GLU_FILL:
 | 
			
		||||
	/* Note:
 | 
			
		||||
	** An argument could be made for using a TRIANGLE_FAN for the end
 | 
			
		||||
	** of the cylinder of either radii is 0.0 (a cone).  However, a 
 | 
			
		||||
	** TRIANGLE_FAN would not work in smooth shading mode (the common 
 | 
			
		||||
	** of the cylinder of either radii is 0.0 (a cone).  However, a
 | 
			
		||||
	** TRIANGLE_FAN would not work in smooth shading mode (the common
 | 
			
		||||
	** case) because the normal for the apex is different for every
 | 
			
		||||
	** triangle (and TRIANGLE_FAN doesn't let me respecify that normal).
 | 
			
		||||
	** Now, my choice is GL_TRIANGLES, or leave the GL_QUAD_STRIP and
 | 
			
		||||
@@ -285,26 +286,26 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
			glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
				(float) j / stacks);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			    radiusLow * cosCache[i], zLow);
 | 
			
		||||
		    if (qobj->textureCoords) {
 | 
			
		||||
			glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
				(float) (j+1) / stacks);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i],
 | 
			
		||||
			    radiusHigh * cosCache[i], zHigh);
 | 
			
		||||
		} else {
 | 
			
		||||
		    if (qobj->textureCoords) {
 | 
			
		||||
			glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
				(float) (j+1) / stacks);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i],
 | 
			
		||||
			    radiusHigh * cosCache[i], zHigh);
 | 
			
		||||
		    if (qobj->textureCoords) {
 | 
			
		||||
			glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
				(float) j / stacks);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			    radiusLow * cosCache[i], zLow);
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
@@ -333,7 +334,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
		    glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
			    (float) j / stacks);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(radiusLow * sintemp, 
 | 
			
		||||
		glVertex3f(radiusLow * sintemp,
 | 
			
		||||
			radiusLow * costemp, zLow);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
@@ -361,7 +362,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
		    glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
			    (float) j / stacks);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			radiusLow * cosCache[i], zLow);
 | 
			
		||||
	    }
 | 
			
		||||
	    glEnd();
 | 
			
		||||
@@ -389,7 +390,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
		    glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
			    (float) j / stacks);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i],
 | 
			
		||||
			zLow);
 | 
			
		||||
	    }
 | 
			
		||||
	    glEnd();
 | 
			
		||||
@@ -415,7 +416,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
		    glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
			    (float) j / stacks);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(radiusLow * sintemp, 
 | 
			
		||||
		glVertex3f(radiusLow * sintemp,
 | 
			
		||||
			radiusLow * costemp, zLow);
 | 
			
		||||
	    }
 | 
			
		||||
	    glEnd();
 | 
			
		||||
@@ -427,14 +428,14 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLAPIENTRY
 | 
			
		||||
gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, 
 | 
			
		||||
gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius,
 | 
			
		||||
	    GLint slices, GLint loops)
 | 
			
		||||
{
 | 
			
		||||
    gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, 0.0, 360.0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLAPIENTRY
 | 
			
		||||
gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, 
 | 
			
		||||
gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius,
 | 
			
		||||
		   GLdouble outerRadius, GLint slices, GLint loops,
 | 
			
		||||
		   GLdouble startAngle, GLdouble sweepAngle)
 | 
			
		||||
{
 | 
			
		||||
@@ -511,7 +512,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius,
 | 
			
		||||
		glTexCoord2f(0.5, 0.5);
 | 
			
		||||
	    }
 | 
			
		||||
	    glVertex3f(0.0, 0.0, 0.0);
 | 
			
		||||
	    radiusLow = outerRadius - 
 | 
			
		||||
	    radiusLow = outerRadius -
 | 
			
		||||
		    deltaRadius * ((float) (loops-1) / loops);
 | 
			
		||||
	    if (qobj->textureCoords) {
 | 
			
		||||
		texLow = radiusLow / outerRadius / 2;
 | 
			
		||||
@@ -523,7 +524,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius,
 | 
			
		||||
			glTexCoord2f(texLow * sinCache[i] + 0.5,
 | 
			
		||||
				texLow * cosCache[i] + 0.5);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			    radiusLow * cosCache[i], 0.0);
 | 
			
		||||
		}
 | 
			
		||||
	    } else {
 | 
			
		||||
@@ -532,7 +533,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius,
 | 
			
		||||
			glTexCoord2f(texLow * sinCache[i] + 0.5,
 | 
			
		||||
				texLow * cosCache[i] + 0.5);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			    radiusLow * cosCache[i], 0.0);
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
@@ -555,28 +556,28 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius,
 | 
			
		||||
			glTexCoord2f(texLow * sinCache[i] + 0.5,
 | 
			
		||||
				texLow * cosCache[i] + 0.5);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			    radiusLow * cosCache[i], 0.0);
 | 
			
		||||
 | 
			
		||||
		    if (qobj->textureCoords) {
 | 
			
		||||
			glTexCoord2f(texHigh * sinCache[i] + 0.5,
 | 
			
		||||
				texHigh * cosCache[i] + 0.5);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i],
 | 
			
		||||
			    radiusHigh * cosCache[i], 0.0);
 | 
			
		||||
		} else {
 | 
			
		||||
		    if (qobj->textureCoords) {
 | 
			
		||||
			glTexCoord2f(texHigh * sinCache[i] + 0.5,
 | 
			
		||||
				texHigh * cosCache[i] + 0.5);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusHigh * sinCache[i],
 | 
			
		||||
			    radiusHigh * cosCache[i], 0.0);
 | 
			
		||||
 | 
			
		||||
		    if (qobj->textureCoords) {
 | 
			
		||||
			glTexCoord2f(texLow * sinCache[i] + 0.5,
 | 
			
		||||
				texLow * cosCache[i] + 0.5);
 | 
			
		||||
		    }
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		    glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			    radiusLow * cosCache[i], 0.0);
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
@@ -629,7 +630,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius,
 | 
			
		||||
		    glTexCoord2f(texLow * sinCache[i] + 0.5,
 | 
			
		||||
			    texLow * cosCache[i] + 0.5);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			radiusLow * cosCache[i], 0.0);
 | 
			
		||||
	    }
 | 
			
		||||
	    glEnd();
 | 
			
		||||
@@ -684,7 +685,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius,
 | 
			
		||||
		    glTexCoord2f(texLow * sinCache[i] + 0.5,
 | 
			
		||||
			    texLow * cosCache[i] + 0.5);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i], 
 | 
			
		||||
		glVertex3f(radiusLow * sinCache[i],
 | 
			
		||||
			radiusLow * cosCache[i], 0.0);
 | 
			
		||||
	    }
 | 
			
		||||
	    glEnd();
 | 
			
		||||
@@ -788,7 +789,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks)
 | 
			
		||||
		cosCache3b[j] = -COS(angle);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    } 
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    sinCache1a[slices] = sinCache1a[0];
 | 
			
		||||
    cosCache1a[slices] = cosCache1a[0];
 | 
			
		||||
@@ -969,7 +970,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks)
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	      default:
 | 
			
		||||
	        break;
 | 
			
		||||
		break;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    glBegin(GL_QUAD_STRIP);
 | 
			
		||||
@@ -1046,7 +1047,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks)
 | 
			
		||||
		costemp2 = cosCache2b[j];
 | 
			
		||||
		break;
 | 
			
		||||
	      default:
 | 
			
		||||
	        break;
 | 
			
		||||
		break;
 | 
			
		||||
	    }
 | 
			
		||||
	    for (i = 0; i < slices; i++) {
 | 
			
		||||
		switch(qobj->normals) {
 | 
			
		||||
@@ -1067,7 +1068,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks)
 | 
			
		||||
		    glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
			    1 - (float) j / stacks);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(sintemp1 * sinCache1a[i], 
 | 
			
		||||
		glVertex3f(sintemp1 * sinCache1a[i],
 | 
			
		||||
			sintemp1 * cosCache1a[i], costemp1);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
@@ -1109,7 +1110,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks)
 | 
			
		||||
		    glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
			    1 - (float) j / stacks);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(sintemp1 * sinCache1a[i], 
 | 
			
		||||
		glVertex3f(sintemp1 * sinCache1a[i],
 | 
			
		||||
			sintemp1 * cosCache1a[i], costemp1);
 | 
			
		||||
	    }
 | 
			
		||||
	    glEnd();
 | 
			
		||||
@@ -1149,7 +1150,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks)
 | 
			
		||||
		    glTexCoord2f(1 - (float) i / slices,
 | 
			
		||||
			    1 - (float) j / stacks);
 | 
			
		||||
		}
 | 
			
		||||
		glVertex3f(sintemp1 * sinCache1b[j], 
 | 
			
		||||
		glVertex3f(sintemp1 * sinCache1b[j],
 | 
			
		||||
			costemp1 * sinCache1b[j], cosCache1b[j]);
 | 
			
		||||
	    }
 | 
			
		||||
	    glEnd();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * PC/HW routine collection v1.3 for DOS/DJGPP
 | 
			
		||||
 * PC/HW routine collection v1.4 for DOS/DJGPP
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (C) 2002 - Borca Daniel
 | 
			
		||||
 *  Email : dborca@yahoo.com
 | 
			
		||||
@@ -19,6 +19,8 @@
 | 
			
		||||
#define FALSE 0
 | 
			
		||||
#define TRUE !FALSE
 | 
			
		||||
 | 
			
		||||
#define SQR(x)       ((x) * (x))
 | 
			
		||||
 | 
			
		||||
#define MIN(x,y)     (((x) < (y)) ? (x) : (y))
 | 
			
		||||
#define MAX(x,y)     (((x) > (y)) ? (x) : (y))
 | 
			
		||||
#define MID(x,y,z)   MAX((x), MIN((y), (z)))
 | 
			
		||||
@@ -201,6 +203,8 @@ int pc_keyshifts (void);
 | 
			
		||||
 * timer
 | 
			
		||||
 */
 | 
			
		||||
int pc_install_int (PFUNC func, void *parm, unsigned int freq);
 | 
			
		||||
int pc_remove_int (int fid);
 | 
			
		||||
int pc_adjust_int (int fid, unsigned int freq);
 | 
			
		||||
void pc_remove_timer (void);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * PC/HW routine collection v1.3 for DOS/DJGPP
 | 
			
		||||
 * PC/HW routine collection v1.4 for DOS/DJGPP
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (C) 2002 - Borca Daniel
 | 
			
		||||
 *  Email : dborca@yahoo.com
 | 
			
		||||
@@ -8,6 +8,7 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <pc.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "pc_hw.h"
 | 
			
		||||
 | 
			
		||||
@@ -17,6 +18,8 @@
 | 
			
		||||
 | 
			
		||||
#define PIT_FREQ 0x1234DD
 | 
			
		||||
 | 
			
		||||
#define ADJUST(timer, basefreq) timer.counter = PIT_FREQ * timer.freq / SQR(basefreq)
 | 
			
		||||
 | 
			
		||||
#define unvolatile(__v, __t) __extension__ ({union { volatile __t __cp; __t __p; } __q; __q.__cp = __v; __q.__p;})
 | 
			
		||||
 | 
			
		||||
static int timer_installed;
 | 
			
		||||
@@ -29,15 +32,24 @@ typedef struct {
 | 
			
		||||
 | 
			
		||||
static TIMER timer_main, timer_func[MAX_TIMERS];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Desc: main timer callback
 | 
			
		||||
 *
 | 
			
		||||
 * In  : -
 | 
			
		||||
 * Out : 0 to bypass BIOS, 1 to chain to BIOS
 | 
			
		||||
 *
 | 
			
		||||
 * Note: -
 | 
			
		||||
 */
 | 
			
		||||
static int timer ()
 | 
			
		||||
{
 | 
			
		||||
 int i;
 | 
			
		||||
 | 
			
		||||
 for (i=0;i<MAX_TIMERS;i++) {
 | 
			
		||||
 for (i = 0; i < MAX_TIMERS; i++) {
 | 
			
		||||
     TIMER *t = &timer_func[i];
 | 
			
		||||
     if (t->func) {
 | 
			
		||||
        t->clock_ticks += t->counter;
 | 
			
		||||
        if (t->clock_ticks>=timer_main.counter) {
 | 
			
		||||
        if (t->clock_ticks >= timer_main.counter) {
 | 
			
		||||
           t->clock_ticks -= timer_main.counter;
 | 
			
		||||
           t->func(unvolatile(t->parm, void *));
 | 
			
		||||
        }
 | 
			
		||||
@@ -45,7 +57,7 @@ static int timer ()
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 timer_main.clock_ticks += timer_main.counter;
 | 
			
		||||
 if (timer_main.clock_ticks>=0x10000) {
 | 
			
		||||
 if (timer_main.clock_ticks >= 0x10000) {
 | 
			
		||||
    timer_main.clock_ticks -= 0x10000;
 | 
			
		||||
    return 1;
 | 
			
		||||
 } else {
 | 
			
		||||
@@ -54,6 +66,15 @@ static int timer ()
 | 
			
		||||
 }
 | 
			
		||||
} ENDOFUNC(timer)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Desc: uninstall timer engine
 | 
			
		||||
 *
 | 
			
		||||
 * In  : -
 | 
			
		||||
 * Out : -
 | 
			
		||||
 *
 | 
			
		||||
 * Note: -
 | 
			
		||||
 */
 | 
			
		||||
void pc_remove_timer (void)
 | 
			
		||||
{
 | 
			
		||||
 if (timer_installed) {
 | 
			
		||||
@@ -70,11 +91,22 @@ void pc_remove_timer (void)
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Desc: install timer engine
 | 
			
		||||
 *
 | 
			
		||||
 * In  : -
 | 
			
		||||
 * Out : 0 for success
 | 
			
		||||
 *
 | 
			
		||||
 * Note: initial frequency is 18.2 Hz
 | 
			
		||||
 */
 | 
			
		||||
static int install_timer (void)
 | 
			
		||||
{
 | 
			
		||||
 if (timer_installed||pc_install_irq(TIMER_IRQ, timer)) {
 | 
			
		||||
 if (timer_installed || pc_install_irq(TIMER_IRQ, timer)) {
 | 
			
		||||
    return -1;
 | 
			
		||||
 } else {
 | 
			
		||||
    memset(timer_func, 0, sizeof(timer_func));
 | 
			
		||||
 
 | 
			
		||||
    LOCKDATA(timer_func);
 | 
			
		||||
    LOCKDATA(timer_main);
 | 
			
		||||
    LOCKFUNC(timer);
 | 
			
		||||
@@ -94,65 +126,198 @@ static int install_timer (void)
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TIMER *find_slot (PFUNC func)
 | 
			
		||||
{
 | 
			
		||||
 int i;
 | 
			
		||||
 | 
			
		||||
 for (i=0;i<MAX_TIMERS;i++) {
 | 
			
		||||
     if (timer_func[i].func==func) {
 | 
			
		||||
        return &timer_func[i];
 | 
			
		||||
     }
 | 
			
		||||
 }
 | 
			
		||||
 for (i=0;i<MAX_TIMERS;i++) {
 | 
			
		||||
     if (!timer_func[i].func) {
 | 
			
		||||
        return &timer_func[i];
 | 
			
		||||
     }
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Desc: install timerfunc
 | 
			
		||||
 *
 | 
			
		||||
 * In  : callback function, opaque pointer to be passed to callee, freq (Hz)
 | 
			
		||||
 * Out : timerfunc id (0 .. MAX_TIMERS-1)
 | 
			
		||||
 *
 | 
			
		||||
 * Note: returns -1 if error
 | 
			
		||||
 */
 | 
			
		||||
int pc_install_int (PFUNC func, void *parm, unsigned int freq)
 | 
			
		||||
{
 | 
			
		||||
 int i;
 | 
			
		||||
 TIMER *t;
 | 
			
		||||
 TIMER *t = NULL;
 | 
			
		||||
 | 
			
		||||
 /* ensure the timer engine is set up */
 | 
			
		||||
 if (!timer_installed) {
 | 
			
		||||
    if (install_timer()) {
 | 
			
		||||
       return -1;
 | 
			
		||||
    }
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 if ((t=find_slot(func))!=NULL) {
 | 
			
		||||
 /* find an empty slot */
 | 
			
		||||
 for (i = 0; i < MAX_TIMERS; i++) {
 | 
			
		||||
     if (!timer_func[i].func) {
 | 
			
		||||
        t = &timer_func[i];
 | 
			
		||||
        break;
 | 
			
		||||
     }
 | 
			
		||||
 }
 | 
			
		||||
 if (t == NULL) {
 | 
			
		||||
    return -1;
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 DISABLE();
 | 
			
		||||
 | 
			
		||||
 t->func = func;
 | 
			
		||||
 t->parm = parm;
 | 
			
		||||
 t->freq = freq;
 | 
			
		||||
 t->clock_ticks = 0;
 | 
			
		||||
 | 
			
		||||
 /* update main timer / sons to match highest frequency */
 | 
			
		||||
 if (freq > timer_main.freq) {
 | 
			
		||||
    unsigned int new_counter = PIT_FREQ / freq;
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < MAX_TIMERS; i++) {
 | 
			
		||||
        if (timer_func[i].func) {
 | 
			
		||||
           ADJUST(timer_func[i], freq);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    outportb(0x43, 0x34);
 | 
			
		||||
    outportb(0x40, (unsigned char)new_counter);
 | 
			
		||||
    outportb(0x40, (unsigned char)(new_counter>>8));
 | 
			
		||||
    timer_main.clock_ticks = 0;
 | 
			
		||||
    timer_main.counter = new_counter;
 | 
			
		||||
    timer_main.freq = freq;
 | 
			
		||||
 } else {
 | 
			
		||||
    /* t == &timer_func[i] */
 | 
			
		||||
    ADJUST(timer_func[i], timer_main.freq);
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 ENABLE();
 | 
			
		||||
 | 
			
		||||
 return t - timer_func;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Desc: remove timerfunc
 | 
			
		||||
 *
 | 
			
		||||
 * In  : timerfunc id
 | 
			
		||||
 * Out : 0 if success
 | 
			
		||||
 *
 | 
			
		||||
 * Note: tries to relax the main timer whenever possible
 | 
			
		||||
 */
 | 
			
		||||
int pc_remove_int (int fid)
 | 
			
		||||
{
 | 
			
		||||
 int i;
 | 
			
		||||
 unsigned int freq = 0;
 | 
			
		||||
 | 
			
		||||
 /* are we installed? */
 | 
			
		||||
 if (!timer_installed) {
 | 
			
		||||
    return -1;
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 /* sanity check */
 | 
			
		||||
 if ((fid < 0) || (fid >= MAX_TIMERS) || (timer_func[fid].func == NULL)) {
 | 
			
		||||
    return -1;
 | 
			
		||||
 }
 | 
			
		||||
 timer_func[fid].func = NULL;
 | 
			
		||||
 | 
			
		||||
 /* scan for maximum frequency */
 | 
			
		||||
 for (i = 0; i < MAX_TIMERS; i++) {
 | 
			
		||||
     TIMER *t = &timer_func[i];
 | 
			
		||||
     if (t->func) {
 | 
			
		||||
        if (freq < t->freq) {
 | 
			
		||||
           freq = t->freq;
 | 
			
		||||
        }
 | 
			
		||||
     }
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 /* if there are no callbacks left, cleanup */
 | 
			
		||||
 if (!freq) {
 | 
			
		||||
    pc_remove_timer();
 | 
			
		||||
    return 0;
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 /* if we just lowered the maximum frequency, try to relax the timer engine */
 | 
			
		||||
 if (freq < timer_main.freq) {
 | 
			
		||||
    unsigned int new_counter = PIT_FREQ / freq;
 | 
			
		||||
 | 
			
		||||
    DISABLE();
 | 
			
		||||
 | 
			
		||||
    t->func = func;
 | 
			
		||||
    t->parm = parm;
 | 
			
		||||
    t->freq = freq;
 | 
			
		||||
    t->clock_ticks = 0;
 | 
			
		||||
 | 
			
		||||
    if (new_counter < timer_main.counter) {
 | 
			
		||||
       for (i=0;i<MAX_TIMERS;i++) {
 | 
			
		||||
           if (timer_func[i].func) {
 | 
			
		||||
              timer_func[i].counter = new_counter * timer_func[i].freq / freq;
 | 
			
		||||
           }
 | 
			
		||||
       }
 | 
			
		||||
       outportb(0x43, 0x34);
 | 
			
		||||
       outportb(0x40, (unsigned char)new_counter);
 | 
			
		||||
       outportb(0x40, (unsigned char)(new_counter>>8));
 | 
			
		||||
       timer_main.clock_ticks = 0;
 | 
			
		||||
       timer_main.counter = new_counter;
 | 
			
		||||
       timer_main.freq = freq;
 | 
			
		||||
    } else {
 | 
			
		||||
       t->counter = PIT_FREQ * freq / (timer_main.freq * timer_main.freq);
 | 
			
		||||
    for (i = 0; i < MAX_TIMERS; i++) {
 | 
			
		||||
        if (timer_func[i].func) {
 | 
			
		||||
           ADJUST(timer_func[i], freq);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ENABLE();
 | 
			
		||||
    outportb(0x43, 0x34);
 | 
			
		||||
    outportb(0x40, (unsigned char)new_counter);
 | 
			
		||||
    outportb(0x40, (unsigned char)(new_counter>>8));
 | 
			
		||||
    timer_main.clock_ticks = 0;
 | 
			
		||||
    timer_main.counter = new_counter;
 | 
			
		||||
    timer_main.freq = freq;
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
    ENABLE();
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 return -1;
 | 
			
		||||
 return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Desc: adjust timerfunc
 | 
			
		||||
 *
 | 
			
		||||
 * In  : timerfunc id, new frequency (Hz)
 | 
			
		||||
 * Out : 0 if success
 | 
			
		||||
 *
 | 
			
		||||
 * Note: might change the main timer frequency
 | 
			
		||||
 */
 | 
			
		||||
int pc_adjust_int (int fid, unsigned int freq)
 | 
			
		||||
{
 | 
			
		||||
 int i;
 | 
			
		||||
 | 
			
		||||
 /* are we installed? */
 | 
			
		||||
 if (!timer_installed) {
 | 
			
		||||
    return -1;
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 /* sanity check */
 | 
			
		||||
 if ((fid < 0) || (fid >= MAX_TIMERS) || (timer_func[fid].func == NULL)) {
 | 
			
		||||
    return -1;
 | 
			
		||||
 }
 | 
			
		||||
 timer_func[fid].freq = freq;
 | 
			
		||||
 | 
			
		||||
 /* scan for maximum frequency */
 | 
			
		||||
 freq = 0;
 | 
			
		||||
 for (i = 0; i < MAX_TIMERS; i++) {
 | 
			
		||||
     TIMER *t = &timer_func[i];
 | 
			
		||||
     if (t->func) {
 | 
			
		||||
        if (freq < t->freq) {
 | 
			
		||||
           freq = t->freq;
 | 
			
		||||
        }
 | 
			
		||||
     }
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 /* update main timer / sons to match highest frequency */
 | 
			
		||||
 DISABLE();
 | 
			
		||||
 | 
			
		||||
 /* using '>' is correct still (and avoids updating
 | 
			
		||||
  * the HW timer too often), but doesn't relax the timer!
 | 
			
		||||
  */
 | 
			
		||||
 if (freq != timer_main.freq) {
 | 
			
		||||
    unsigned int new_counter = PIT_FREQ / freq;
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < MAX_TIMERS; i++) {
 | 
			
		||||
        if (timer_func[i].func) {
 | 
			
		||||
           ADJUST(timer_func[i], freq);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    outportb(0x43, 0x34);
 | 
			
		||||
    outportb(0x40, (unsigned char)new_counter);
 | 
			
		||||
    outportb(0x40, (unsigned char)(new_counter>>8));
 | 
			
		||||
    timer_main.clock_ticks = 0;
 | 
			
		||||
    timer_main.counter = new_counter;
 | 
			
		||||
    timer_main.freq = freq;
 | 
			
		||||
 } else {
 | 
			
		||||
    ADJUST(timer_func[fid], timer_main.freq);
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 ENABLE();
 | 
			
		||||
 | 
			
		||||
 return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,8 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include "glutint.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -140,3 +142,78 @@ int APIENTRY glutGetModifiers (void)
 | 
			
		||||
 | 
			
		||||
 return mod;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* GAME MODE
 | 
			
		||||
 * Hack alert: incomplete... what is GameMode, anyway?
 | 
			
		||||
 */
 | 
			
		||||
GLint g_game;
 | 
			
		||||
static GLboolean game_possible;
 | 
			
		||||
static GLboolean game_active;
 | 
			
		||||
static GLuint game_width;
 | 
			
		||||
static GLuint game_height;
 | 
			
		||||
static GLuint game_bpp;
 | 
			
		||||
static GLuint game_refresh;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void APIENTRY glutGameModeString (const char *string)
 | 
			
		||||
{
 | 
			
		||||
 if (sscanf(string, "%ux%u:%u@%u", &game_width, &game_height, &game_bpp, &game_refresh) == 4) {
 | 
			
		||||
    game_possible = GL_TRUE;
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int APIENTRY glutGameModeGet (GLenum mode)
 | 
			
		||||
{
 | 
			
		||||
 switch (mode) {
 | 
			
		||||
        case GLUT_GAME_MODE_ACTIVE:
 | 
			
		||||
             return game_active;
 | 
			
		||||
        case GLUT_GAME_MODE_POSSIBLE:
 | 
			
		||||
             return game_possible && !g_curwin;
 | 
			
		||||
        case GLUT_GAME_MODE_WIDTH:
 | 
			
		||||
             return game_active ? (int)game_width : -1;
 | 
			
		||||
        case GLUT_GAME_MODE_HEIGHT:
 | 
			
		||||
             return game_active ? (int)game_height : -1;
 | 
			
		||||
        case GLUT_GAME_MODE_PIXEL_DEPTH:
 | 
			
		||||
             return game_active ? (int)game_bpp : -1;
 | 
			
		||||
        case GLUT_GAME_MODE_REFRESH_RATE:
 | 
			
		||||
             return game_active ? (int)game_refresh : -1;
 | 
			
		||||
        default:
 | 
			
		||||
             return -1;
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int APIENTRY glutEnterGameMode (void)
 | 
			
		||||
{
 | 
			
		||||
 if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) {
 | 
			
		||||
    g_bpp = game_bpp;
 | 
			
		||||
    g_refresh = game_refresh;
 | 
			
		||||
 | 
			
		||||
    glutInitWindowSize(game_width, game_height);
 | 
			
		||||
 | 
			
		||||
    if ((g_game = glutCreateWindow("<game>")) > 0) {
 | 
			
		||||
       game_active = GL_TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return g_game;
 | 
			
		||||
 } else {
 | 
			
		||||
    return 0;
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void GLUTAPIENTRY glutLeaveGameMode (void)
 | 
			
		||||
{
 | 
			
		||||
 if (glutGameModeGet(GLUT_GAME_MODE_ACTIVE)) {
 | 
			
		||||
    game_active = GL_FALSE;
 | 
			
		||||
 | 
			
		||||
    glutDestroyWindow(g_game);
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ char *__glutProgramName = "GGI";
 | 
			
		||||
 | 
			
		||||
static ggi_visual_t __glut_vis;
 | 
			
		||||
 | 
			
		||||
static GGIMesaContext __glut_ctx;
 | 
			
		||||
static ggi_mesa_context_t __glut_ctx;
 | 
			
		||||
 | 
			
		||||
//static int __glut_width = WIDTH;
 | 
			
		||||
//static int __glut_height = HEIGHT;
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
#include "glapi.h"
 | 
			
		||||
#include "glapitable.h"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -488,6 +488,12 @@ struct __DRIscreenPrivateRec {
 | 
			
		||||
     * the drawable that was bound.  Otherwise, this is NULL.
 | 
			
		||||
     */
 | 
			
		||||
    __DRIdrawablePrivate *fullscreen;
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * \brief Screen number for when multiple screens are supported
 | 
			
		||||
     */
 | 
			
		||||
    int myNum;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern void
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@
 | 
			
		||||
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: miniglx.c,v 1.1 2003/08/22 20:11:43 brianp Exp $ */
 | 
			
		||||
/* $Id: miniglx.c,v 1.1.2.1 2003/11/21 15:49:27 keithw Exp $ */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \mainpage Mini GLX
 | 
			
		||||
@@ -732,7 +732,7 @@ static int get_chipset_from_busid( Display *dpy )
 | 
			
		||||
      nr = sscanf(buf, "%04x\t%04x%04x", &encode, 
 | 
			
		||||
		  &vendor, &device);
 | 
			
		||||
      
 | 
			
		||||
      bus = encode >> 16;
 | 
			
		||||
      bus = encode >> 8;
 | 
			
		||||
      dev = (encode & 0xFF) >> 3;
 | 
			
		||||
      fn = encode & 0x7;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										300
									
								
								src/mesa/Makefile.OSMesa16
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										300
									
								
								src/mesa/Makefile.OSMesa16
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,300 @@
 | 
			
		||||
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.1
 | 
			
		||||
# Copyright (C) 1995-2003  Brian Paul
 | 
			
		||||
 | 
			
		||||
# Makefile for building Mesa for 16/32-bit/channel rendering with the OSMesa
 | 
			
		||||
# driver.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##### MACROS #####
 | 
			
		||||
 | 
			
		||||
TOP = ../..
 | 
			
		||||
 | 
			
		||||
GL_MAJOR = 1
 | 
			
		||||
GL_MINOR = 4
 | 
			
		||||
GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
 | 
			
		||||
 | 
			
		||||
GL_LIB_NAME = "GL"  # may be overridden in Make-config
 | 
			
		||||
OSMESA_LIB_NAME = "OSMesa16"  # may be overridden in Make-config
 | 
			
		||||
 | 
			
		||||
VPATH = RCS
 | 
			
		||||
 | 
			
		||||
LIBDIR = $(TOP)/lib
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Lists of source files
 | 
			
		||||
 | 
			
		||||
MAIN_SOURCES = \
 | 
			
		||||
	main/api_arrayelt.c \
 | 
			
		||||
	main/api_loopback.c \
 | 
			
		||||
	main/api_noop.c \
 | 
			
		||||
	main/api_validate.c \
 | 
			
		||||
	main/accum.c \
 | 
			
		||||
	main/arbprogram.c \
 | 
			
		||||
	main/arbfragparse.c \
 | 
			
		||||
	main/arbvertparse.c \
 | 
			
		||||
	main/attrib.c \
 | 
			
		||||
	main/blend.c \
 | 
			
		||||
	main/bufferobj.c \
 | 
			
		||||
	main/buffers.c \
 | 
			
		||||
	main/clip.c \
 | 
			
		||||
	main/colortab.c \
 | 
			
		||||
	main/context.c \
 | 
			
		||||
	main/convolve.c \
 | 
			
		||||
	main/debug.c \
 | 
			
		||||
	main/depth.c \
 | 
			
		||||
	main/dispatch.c \
 | 
			
		||||
	main/dlist.c \
 | 
			
		||||
	main/drawpix.c \
 | 
			
		||||
	main/enable.c \
 | 
			
		||||
	main/enums.c \
 | 
			
		||||
	main/eval.c \
 | 
			
		||||
	main/extensions.c \
 | 
			
		||||
	main/feedback.c \
 | 
			
		||||
	main/fog.c \
 | 
			
		||||
	main/get.c \
 | 
			
		||||
	main/hash.c \
 | 
			
		||||
	main/hint.c \
 | 
			
		||||
	main/histogram.c \
 | 
			
		||||
	main/image.c \
 | 
			
		||||
	main/imports.c \
 | 
			
		||||
	main/light.c \
 | 
			
		||||
	main/lines.c \
 | 
			
		||||
	main/matrix.c \
 | 
			
		||||
	main/nvprogram.c \
 | 
			
		||||
	main/nvfragparse.c \
 | 
			
		||||
	main/nvvertexec.c \
 | 
			
		||||
	main/nvvertparse.c \
 | 
			
		||||
	main/occlude.c \
 | 
			
		||||
	main/pixel.c \
 | 
			
		||||
	main/points.c \
 | 
			
		||||
	main/polygon.c \
 | 
			
		||||
	main/program.c \
 | 
			
		||||
	main/rastpos.c \
 | 
			
		||||
	main/state.c \
 | 
			
		||||
	main/stencil.c \
 | 
			
		||||
	main/texcompress.c \
 | 
			
		||||
	main/texformat.c \
 | 
			
		||||
	main/teximage.c \
 | 
			
		||||
	main/texobj.c \
 | 
			
		||||
	main/texstate.c \
 | 
			
		||||
	main/texstore.c \
 | 
			
		||||
	main/texutil.c \
 | 
			
		||||
	main/varray.c \
 | 
			
		||||
	main/vtxfmt.c
 | 
			
		||||
 | 
			
		||||
GLAPI_SOURCES = \
 | 
			
		||||
	glapi/glapi.c \
 | 
			
		||||
	glapi/glthread.c
 | 
			
		||||
 | 
			
		||||
MATH_SOURCES = \
 | 
			
		||||
	math/m_debug_clip.c \
 | 
			
		||||
	math/m_debug_norm.c \
 | 
			
		||||
	math/m_debug_xform.c \
 | 
			
		||||
	math/m_eval.c \
 | 
			
		||||
	math/m_matrix.c \
 | 
			
		||||
	math/m_translate.c \
 | 
			
		||||
	math/m_vector.c \
 | 
			
		||||
	math/m_xform.c
 | 
			
		||||
 | 
			
		||||
ARRAY_CACHE_SOURCES = \
 | 
			
		||||
	array_cache/ac_context.c \
 | 
			
		||||
	array_cache/ac_import.c
 | 
			
		||||
 | 
			
		||||
SWRAST_SOURCES = \
 | 
			
		||||
	swrast/s_aaline.c \
 | 
			
		||||
	swrast/s_aatriangle.c \
 | 
			
		||||
	swrast/s_accum.c \
 | 
			
		||||
	swrast/s_alpha.c \
 | 
			
		||||
	swrast/s_alphabuf.c \
 | 
			
		||||
	swrast/s_bitmap.c \
 | 
			
		||||
	swrast/s_blend.c \
 | 
			
		||||
	swrast/s_buffers.c \
 | 
			
		||||
	swrast/s_copypix.c \
 | 
			
		||||
	swrast/s_context.c \
 | 
			
		||||
	swrast/s_depth.c \
 | 
			
		||||
	swrast/s_drawpix.c \
 | 
			
		||||
	swrast/s_feedback.c \
 | 
			
		||||
	swrast/s_fog.c \
 | 
			
		||||
	swrast/s_imaging.c \
 | 
			
		||||
	swrast/s_lines.c \
 | 
			
		||||
	swrast/s_logic.c \
 | 
			
		||||
	swrast/s_masking.c \
 | 
			
		||||
	swrast/s_nvfragprog.c \
 | 
			
		||||
	swrast/s_pixeltex.c \
 | 
			
		||||
	swrast/s_points.c \
 | 
			
		||||
	swrast/s_readpix.c \
 | 
			
		||||
	swrast/s_span.c \
 | 
			
		||||
	swrast/s_stencil.c \
 | 
			
		||||
	swrast/s_texture.c \
 | 
			
		||||
	swrast/s_texstore.c \
 | 
			
		||||
	swrast/s_triangle.c \
 | 
			
		||||
	swrast/s_zoom.c
 | 
			
		||||
 | 
			
		||||
SWRAST_SETUP_SOURCES = \
 | 
			
		||||
	swrast_setup/ss_context.c \
 | 
			
		||||
	swrast_setup/ss_triangle.c \
 | 
			
		||||
	swrast_setup/ss_vb.c
 | 
			
		||||
 | 
			
		||||
TNL_SOURCES = \
 | 
			
		||||
	tnl/t_array_api.c \
 | 
			
		||||
	tnl/t_array_import.c \
 | 
			
		||||
	tnl/t_context.c \
 | 
			
		||||
	tnl/t_eval_api.c \
 | 
			
		||||
	tnl/t_imm_alloc.c \
 | 
			
		||||
	tnl/t_imm_api.c \
 | 
			
		||||
	tnl/t_imm_debug.c \
 | 
			
		||||
	tnl/t_imm_dlist.c \
 | 
			
		||||
	tnl/t_imm_elt.c \
 | 
			
		||||
	tnl/t_imm_eval.c \
 | 
			
		||||
	tnl/t_imm_exec.c \
 | 
			
		||||
	tnl/t_imm_fixup.c \
 | 
			
		||||
	tnl/t_pipeline.c \
 | 
			
		||||
	tnl/t_vb_fog.c \
 | 
			
		||||
	tnl/t_vb_light.c \
 | 
			
		||||
	tnl/t_vb_normals.c \
 | 
			
		||||
	tnl/t_vb_points.c \
 | 
			
		||||
	tnl/t_vb_program.c \
 | 
			
		||||
	tnl/t_vb_render.c \
 | 
			
		||||
	tnl/t_vb_texgen.c \
 | 
			
		||||
	tnl/t_vb_texmat.c \
 | 
			
		||||
	tnl/t_vb_vertex.c
 | 
			
		||||
 | 
			
		||||
ASM_C_SOURCES = \
 | 
			
		||||
	x86/x86.c \
 | 
			
		||||
	x86/common_x86.c \
 | 
			
		||||
	x86/3dnow.c \
 | 
			
		||||
	x86/sse.c \
 | 
			
		||||
	sparc/sparc.c
 | 
			
		||||
 | 
			
		||||
X86_SOURCES =			\
 | 
			
		||||
	x86/common_x86_asm.S	\
 | 
			
		||||
	x86/glapi_x86.S		\
 | 
			
		||||
	x86/x86_xform2.S	\
 | 
			
		||||
	x86/x86_xform3.S	\
 | 
			
		||||
	x86/x86_xform4.S	\
 | 
			
		||||
	x86/x86_cliptest.S	\
 | 
			
		||||
	x86/mmx_blend.S		\
 | 
			
		||||
	x86/3dnow_xform1.S	\
 | 
			
		||||
	x86/3dnow_xform2.S	\
 | 
			
		||||
	x86/3dnow_xform3.S	\
 | 
			
		||||
	x86/3dnow_xform4.S	\
 | 
			
		||||
	x86/3dnow_normal.S	\
 | 
			
		||||
	x86/sse_xform1.S	\
 | 
			
		||||
	x86/sse_xform2.S	\
 | 
			
		||||
	x86/sse_xform3.S	\
 | 
			
		||||
	x86/sse_xform4.S	\
 | 
			
		||||
	x86/sse_normal.S
 | 
			
		||||
 | 
			
		||||
SPARC_SOURCES =			\
 | 
			
		||||
	sparc/clip.S		\
 | 
			
		||||
	sparc/glapi_sparc.S	\
 | 
			
		||||
	sparc/norm.S		\
 | 
			
		||||
	sparc/xform.S
 | 
			
		||||
 | 
			
		||||
### Groups of files
 | 
			
		||||
 | 
			
		||||
CORE_SOURCES = \
 | 
			
		||||
	$(MAIN_SOURCES)		\
 | 
			
		||||
	$(GLAPI_SOURCES)	\
 | 
			
		||||
	$(MATH_SOURCES)		\
 | 
			
		||||
	$(ARRAY_CACHE_SOURCES)	\
 | 
			
		||||
	$(SWRAST_SOURCES)	\
 | 
			
		||||
	$(SWRAST_SETUP_SOURCES)	\
 | 
			
		||||
	$(TNL_SOURCES)		\
 | 
			
		||||
	$(ASM_C_SOURCES)
 | 
			
		||||
 | 
			
		||||
# This will probably get set to $(X86_SOURCES) in Make-config:
 | 
			
		||||
ASM_SOURCES =
 | 
			
		||||
 | 
			
		||||
OSMESA_DRIVER_SOURCES = \
 | 
			
		||||
	drivers/osmesa/osmesa.c
 | 
			
		||||
 | 
			
		||||
### Object files
 | 
			
		||||
 | 
			
		||||
CORE_OBJECTS = $(CORE_SOURCES:.c=.o)
 | 
			
		||||
 | 
			
		||||
ASM_OBJECTS = $(ASM_SOURCES:.S=.o)
 | 
			
		||||
 | 
			
		||||
OSMESA_OBJECTS = $(OSMESA_DRIVER_SOURCES:.c=.o)
 | 
			
		||||
 | 
			
		||||
OBJECTS = \
 | 
			
		||||
	$(CORE_OBJECTS) \
 | 
			
		||||
	$(ASM_OBJECTS) \
 | 
			
		||||
	$(OSMESA_OBJECTS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Include directories
 | 
			
		||||
 | 
			
		||||
INCLUDE_DIRS = \
 | 
			
		||||
	-I$(TOP)/include \
 | 
			
		||||
	-I$(TOP)/src/mesa \
 | 
			
		||||
	-I$(TOP)/src/mesa/main \
 | 
			
		||||
	-I$(TOP)/src/mesa/glapi \
 | 
			
		||||
	-I$(TOP)/src/mesa/math \
 | 
			
		||||
	-I$(TOP)/src/mesa/transform \
 | 
			
		||||
	-I$(TOP)/src/mesa/swrast \
 | 
			
		||||
	-I$(TOP)/src/mesa/swrast_setup
 | 
			
		||||
 | 
			
		||||
##### RULES #####
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
.S.o:
 | 
			
		||||
	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
x86/matypes.h: main/mtypes.h tnl/t_context.h x86/gen_matypes.c
 | 
			
		||||
	$(CC) $(INCLUDE_DIRS) $(CFLAGS) x86/gen_matypes.c -o x86/gen_matypes
 | 
			
		||||
	./x86/gen_matypes > x86/matypes.h
 | 
			
		||||
	rm -f x86/gen_matypes x86/*.o
 | 
			
		||||
 | 
			
		||||
x86/common_x86_asm.o: x86/matypes.h
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##### TARGETS #####
 | 
			
		||||
 | 
			
		||||
default:
 | 
			
		||||
	@echo "Specify a target configuration"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
targets: $(LIBDIR)/$(OSMESA16_LIB)
 | 
			
		||||
 | 
			
		||||
# Make the 16-bit/channel OSMesa library
 | 
			
		||||
$(LIBDIR)/$(OSMESA16_LIB): $(OBJECTS)
 | 
			
		||||
	$(TOP)/bin/mklib $(MAKELIB_FLAGS) -o $(OSMESA_LIB_NAME) -major $(GL_MAJOR) \
 | 
			
		||||
		-minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIBDIR) \
 | 
			
		||||
		$(GL_LIB_DEPS) $(OBJECTS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Run 'make dep' to update the dependencies if you change what's included
 | 
			
		||||
# by any source file.
 | 
			
		||||
#
 | 
			
		||||
dep: $(CORE_SOURCES) $(OSMESA_DRIVER_SOURCES) $(ASM_SOURCES)
 | 
			
		||||
	makedepend -fdepend -Y $(INCLUDE_DIRS) -DGGI -DSVGA -DFX \
 | 
			
		||||
		$(CORE_SOURCES) $(OSMESA_DRIVER_SOURCES) \
 | 
			
		||||
		$(ASM_SOURCES)
 | 
			
		||||
 | 
			
		||||
dep: $(CORE_SOURCES)
 | 
			
		||||
	makedepend -fdepend -Y -I../include $(CORE_SOURCES)
 | 
			
		||||
 | 
			
		||||
tags:
 | 
			
		||||
	etags `find . -name \*.[ch]` `find ../include`
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Remove .o and backup files
 | 
			
		||||
clean:
 | 
			
		||||
	-rm *.a
 | 
			
		||||
	-rm -f */*.o */*~ */*.o */*~
 | 
			
		||||
	-rm -f drivers/*/*.o
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
include $(TOP)/Make-config
 | 
			
		||||
 | 
			
		||||
include depend
 | 
			
		||||
@@ -25,6 +25,7 @@ MAIN_SOURCES = \
 | 
			
		||||
	main/api_noop.c \
 | 
			
		||||
	main/api_validate.c \
 | 
			
		||||
	main/accum.c \
 | 
			
		||||
	main/arbparse.c \
 | 
			
		||||
	main/arbprogram.c \
 | 
			
		||||
	main/arbfragparse.c \
 | 
			
		||||
	main/arbvertparse.c \
 | 
			
		||||
@@ -135,16 +136,10 @@ TNL_SOURCES = \
 | 
			
		||||
	tnl/t_array_api.c \
 | 
			
		||||
	tnl/t_array_import.c \
 | 
			
		||||
	tnl/t_context.c \
 | 
			
		||||
	tnl/t_eval_api.c \
 | 
			
		||||
	tnl/t_imm_alloc.c \
 | 
			
		||||
	tnl/t_imm_api.c \
 | 
			
		||||
	tnl/t_imm_debug.c \
 | 
			
		||||
	tnl/t_imm_dlist.c \
 | 
			
		||||
	tnl/t_imm_elt.c \
 | 
			
		||||
	tnl/t_imm_eval.c \
 | 
			
		||||
	tnl/t_imm_exec.c \
 | 
			
		||||
	tnl/t_imm_fixup.c \
 | 
			
		||||
	tnl/t_pipeline.c \
 | 
			
		||||
	tnl/t_save_api.c \
 | 
			
		||||
	tnl/t_save_loopback.c \
 | 
			
		||||
	tnl/t_save_playback.c \
 | 
			
		||||
	tnl/t_vb_fog.c \
 | 
			
		||||
	tnl/t_vb_light.c \
 | 
			
		||||
	tnl/t_vb_normals.c \
 | 
			
		||||
@@ -153,7 +148,11 @@ TNL_SOURCES = \
 | 
			
		||||
	tnl/t_vb_render.c \
 | 
			
		||||
	tnl/t_vb_texgen.c \
 | 
			
		||||
	tnl/t_vb_texmat.c \
 | 
			
		||||
	tnl/t_vb_vertex.c
 | 
			
		||||
	tnl/t_vb_vertex.c \
 | 
			
		||||
	tnl/t_vtx_api.c \
 | 
			
		||||
	tnl/t_vtx_eval.c \
 | 
			
		||||
	tnl/t_vtx_exec.c 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ASM_C_SOURCES =	\
 | 
			
		||||
	x86/common_x86.c \
 | 
			
		||||
@@ -209,7 +208,8 @@ GLIDE_DRIVER_SOURCES =			\
 | 
			
		||||
	drivers/glide/fxtexman.c	\
 | 
			
		||||
	drivers/glide/fxtris.c		\
 | 
			
		||||
	drivers/glide/fxvb.c		\
 | 
			
		||||
	drivers/glide/fxglidew.c
 | 
			
		||||
	drivers/glide/fxglidew.c	\
 | 
			
		||||
	drivers/glide/fxg.c
 | 
			
		||||
 | 
			
		||||
SVGA_DRIVER_SOURCES =			\
 | 
			
		||||
	drivers/svga/svgamesa.c		\
 | 
			
		||||
@@ -228,19 +228,21 @@ CORE_SOURCES = \
 | 
			
		||||
	$(GLAPI_SOURCES)	\
 | 
			
		||||
	$(MATH_SOURCES)		\
 | 
			
		||||
	$(ARRAY_CACHE_SOURCES)	\
 | 
			
		||||
	$(TNL_SOURCES)		\
 | 
			
		||||
	$(SWRAST_SOURCES)	\
 | 
			
		||||
	$(SWRAST_SETUP_SOURCES)	\
 | 
			
		||||
	$(TNL_SOURCES)		\
 | 
			
		||||
	$(ASM_C_SOURCES)
 | 
			
		||||
 | 
			
		||||
# This will probably get set to $(X86_SOURCES) in Make-config:
 | 
			
		||||
ASM_SOURCES =
 | 
			
		||||
 | 
			
		||||
ifndef SOLO
 | 
			
		||||
# This should get set in Make-config someday:
 | 
			
		||||
DRIVER_SOURCES = \
 | 
			
		||||
	$(X11_DRIVER_SOURCES) \
 | 
			
		||||
	$(GLIDE_DRIVER_SOURCES) \
 | 
			
		||||
	$(SVGA_DRIVER_SOURCES)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Object files
 | 
			
		||||
@@ -304,7 +306,7 @@ targets: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(OSMESA_LIB) $(LIBMESA)
 | 
			
		||||
$(LIBDIR)/$(GL_LIB): $(OBJECTS)
 | 
			
		||||
	$(TOP)/bin/mklib -o $(GL_LIB_NAME) -major $(GL_MAJOR) \
 | 
			
		||||
		-minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIBDIR) \
 | 
			
		||||
		$(GL_LIB_DEPS) $(OBJECTS)
 | 
			
		||||
		$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Make the OSMesa library
 | 
			
		||||
@@ -313,7 +315,7 @@ $(LIBDIR)/$(OSMESA_LIB): $(OSMESA_OBJECTS)
 | 
			
		||||
		$(TOP)/bin/mklib -o $(OSMESA_LIB_NAME) -major $(MESA_MAJOR) \
 | 
			
		||||
			-minor $(MESA_MINOR) -patch $(GL_TINY) -L$(LIBDIR) \
 | 
			
		||||
			-l$(GL_LIB_NAME) -install $(LIBDIR) \
 | 
			
		||||
			$(OSMESA_OBJECTS) ; \
 | 
			
		||||
			$(MKLIB_OPTIONS) $(OSMESA_OBJECTS) ; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -335,10 +335,10 @@ x86/gen_matypes.exe: x86/gen_matypes.c
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -s $<
 | 
			
		||||
 | 
			
		||||
# [dBorca] Hack alert:
 | 
			
		||||
# use standard API, to work around Win32 @x names
 | 
			
		||||
# also glapi_x86.S is protected against __WIN32__
 | 
			
		||||
main/dispatch.o: main/dispatch.c
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
 | 
			
		||||
# glapi_x86.S needs some adjustments
 | 
			
		||||
# in order to generate correct entrypoints
 | 
			
		||||
x86/glapi_x86.o: x86/glapi_x86.S
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -U__WIN32__ -DSTDCALL_API -c $<
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	-$(call UNLINK,array_cache/*.o)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										435
									
								
								src/mesa/Makefile.wfx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										435
									
								
								src/mesa/Makefile.wfx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,435 @@
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.1
 | 
			
		||||
#
 | 
			
		||||
# 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"),
 | 
			
		||||
# 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.
 | 
			
		||||
 | 
			
		||||
# Win32/FX core makefile for Mesa
 | 
			
		||||
#
 | 
			
		||||
#  Copyright (c) 2003 - Hiroshi Morii
 | 
			
		||||
#  Email : koolsmoky@users.sourceforge.net
 | 
			
		||||
#  URL   : http://www.3dfxzone.it/koolsmoky
 | 
			
		||||
 | 
			
		||||
# Debug build                : nmake -f Makefile.fx.win32 DEBUG=1
 | 
			
		||||
# Optimized build            : nmake -f Makefile.fx.win32
 | 
			
		||||
# Remove objects             : nmake -f Makefile.fx.win32 clean
 | 
			
		||||
# Remove files in bin, lib   : nmake -f Makefile.fx.win32 clobber
 | 
			
		||||
# Remove all generated files : nmake -f Makefile.fx.win32 realclean
 | 
			
		||||
 | 
			
		||||
.SUFFIXES: .S
 | 
			
		||||
##################################
 | 
			
		||||
# general
 | 
			
		||||
##################################
 | 
			
		||||
BUILDROOT = ..\..
 | 
			
		||||
 | 
			
		||||
!if "$(GLIDE3SDK)"==""
 | 
			
		||||
GLIDE3SDK = $(BUILDROOT)\glide3
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
!if "$(GLIDE3SDK)"==""
 | 
			
		||||
!error GLIDE3SDK undefined! Need to specify Glide3x SDK path!
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
GLIDE3LIB = $(GLIDE3SDK)\lib\glide3x.lib
 | 
			
		||||
TEXUS2LIB = #$(GLIDE3SDK)\lib\texus2.lib
 | 
			
		||||
LIBDIR    = $(BUILDROOT)\lib
 | 
			
		||||
GL_DLL    = OpenGL32.dll
 | 
			
		||||
 | 
			
		||||
HAVE_X86   = 1
 | 
			
		||||
HAVE_MMX   = 1
 | 
			
		||||
HAVE_SSE   =
 | 
			
		||||
HAVE_3DNOW = 1
 | 
			
		||||
 | 
			
		||||
##################################
 | 
			
		||||
# build flags
 | 
			
		||||
##################################
 | 
			
		||||
FLAGS = -DH3 -DFX_GLIDE_NAPALM=1 -DH4=1 -DFX_GLIDE_H5_CSIM=1 -DGLIDE3=1 -DGLIDE3_ALPHA=1 -DBUILD_GL32 -DFX #-DGLX_DIRECT_RENDERING
 | 
			
		||||
 | 
			
		||||
!if "$(USE_IEEE)"=="1"
 | 
			
		||||
FLAGS = $(FLAGS) -D__i386__
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
!if "$(HAVE_MMX)"=="1"
 | 
			
		||||
FLAGS = $(FLAGS) -DUSE_MMX_ASM
 | 
			
		||||
!endif
 | 
			
		||||
!if "$(HAVE_SSE)"=="1"
 | 
			
		||||
FLAGS = $(FLAGS) -DUSE_SSE_ASM
 | 
			
		||||
!endif
 | 
			
		||||
!if "$(HAVE_3DNOW)"=="1"
 | 
			
		||||
FLAGS = $(FLAGS) -DUSE_3DNOW_ASM
 | 
			
		||||
!endif
 | 
			
		||||
!if "$(HAVE_X86)"=="1"
 | 
			
		||||
FLAGS = $(FLAGS) -DUSE_X86_ASM
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
!if "$(DEBUG)" == "1"
 | 
			
		||||
FLAGS = $(FLAGS) -DMESA_DEBUG -DFX_DEBUG
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
##################################
 | 
			
		||||
# compiler setup
 | 
			
		||||
##################################
 | 
			
		||||
CC   = cl
 | 
			
		||||
LINK = link
 | 
			
		||||
AR   = lib
 | 
			
		||||
AS   = nasm
 | 
			
		||||
 | 
			
		||||
CFLAGS  = -nologo -G6 -c -D__MSC__ -D_MSC_VER=1200 -D_WIN32 -DWIN32 -DSTRICT -W3 #-WX -D__WIN32__
 | 
			
		||||
LFLAGS  = -nologo /DLL /OPT:WIN98 /MACHINE:IX86 /NODEFAULTLIB #/SUBSYSTEM:WINDOWS,4.00
 | 
			
		||||
ARFLAGS = -nologo
 | 
			
		||||
ASFLAGS = -O2 -fwin32
 | 
			
		||||
 | 
			
		||||
!if "$(DEBUG)"== "1"
 | 
			
		||||
CFLAGS  = $(CFLAGS) -Od -MDd -DDEBUG=1 -D_DEBUG -D_MT -Zi #-D_DLL conflicts with BUILD_GL32
 | 
			
		||||
LFLAGS  = $(LFLAGS) -debugtype:both /DEBUG
 | 
			
		||||
ARFLAGS = $(ARFLAGS) -debugtype:both
 | 
			
		||||
ASFLAGS = $(ASFLAGS) -g -DDEBUG=1
 | 
			
		||||
!else
 | 
			
		||||
CFLAGS  = $(CFLAGS) -Ox -MD -D_MT
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
#################################
 | 
			
		||||
# OS commands
 | 
			
		||||
#################################
 | 
			
		||||
RM = @del
 | 
			
		||||
MV = mv
 | 
			
		||||
 | 
			
		||||
#################################
 | 
			
		||||
# sources
 | 
			
		||||
#################################
 | 
			
		||||
MAIN_SOURCES = \
 | 
			
		||||
	main\api_arrayelt.c \
 | 
			
		||||
	main\api_loopback.c \
 | 
			
		||||
	main\api_noop.c \
 | 
			
		||||
	main\api_validate.c \
 | 
			
		||||
	main\accum.c \
 | 
			
		||||
	main\arbprogram.c \
 | 
			
		||||
	main\arbfragparse.c \
 | 
			
		||||
	main\arbvertparse.c \
 | 
			
		||||
	main\attrib.c \
 | 
			
		||||
	main\blend.c \
 | 
			
		||||
	main\bufferobj.c \
 | 
			
		||||
	main\buffers.c \
 | 
			
		||||
	main\clip.c \
 | 
			
		||||
	main\colortab.c \
 | 
			
		||||
	main\context.c \
 | 
			
		||||
	main\convolve.c \
 | 
			
		||||
	main\debug.c \
 | 
			
		||||
	main\depth.c \
 | 
			
		||||
	main\dispatch.c \
 | 
			
		||||
	main\dlist.c \
 | 
			
		||||
	main\drawpix.c \
 | 
			
		||||
	main\enable.c \
 | 
			
		||||
	main\enums.c \
 | 
			
		||||
	main\eval.c \
 | 
			
		||||
	main\extensions.c \
 | 
			
		||||
	main\feedback.c \
 | 
			
		||||
	main\fog.c \
 | 
			
		||||
	main\get.c \
 | 
			
		||||
	main\hash.c \
 | 
			
		||||
	main\hint.c \
 | 
			
		||||
	main\histogram.c \
 | 
			
		||||
	main\image.c \
 | 
			
		||||
	main\imports.c \
 | 
			
		||||
	main\light.c \
 | 
			
		||||
	main\lines.c \
 | 
			
		||||
	main\matrix.c \
 | 
			
		||||
	main\nvprogram.c \
 | 
			
		||||
	main\nvfragparse.c \
 | 
			
		||||
	main\nvvertexec.c \
 | 
			
		||||
	main\nvvertparse.c \
 | 
			
		||||
	main\occlude.c \
 | 
			
		||||
	main\pixel.c \
 | 
			
		||||
	main\points.c \
 | 
			
		||||
	main\polygon.c \
 | 
			
		||||
	main\program.c \
 | 
			
		||||
	main\rastpos.c \
 | 
			
		||||
	main\state.c \
 | 
			
		||||
	main\stencil.c \
 | 
			
		||||
	main\texcompress.c \
 | 
			
		||||
	main\texformat.c \
 | 
			
		||||
	main\teximage.c \
 | 
			
		||||
	main\texobj.c \
 | 
			
		||||
	main\texstate.c \
 | 
			
		||||
	main\texstore.c \
 | 
			
		||||
	main\texutil.c \
 | 
			
		||||
	main\varray.c \
 | 
			
		||||
	main\vtxfmt.c
 | 
			
		||||
 | 
			
		||||
GLAPI_SOURCES = \
 | 
			
		||||
	glapi\glapi.c \
 | 
			
		||||
	glapi\glthread.c
 | 
			
		||||
 | 
			
		||||
MATH_SOURCES = \
 | 
			
		||||
	math\m_debug_clip.c \
 | 
			
		||||
	math\m_debug_norm.c \
 | 
			
		||||
	math\m_debug_xform.c \
 | 
			
		||||
	math\m_eval.c \
 | 
			
		||||
	math\m_matrix.c \
 | 
			
		||||
	math\m_translate.c \
 | 
			
		||||
	math\m_vector.c \
 | 
			
		||||
	math\m_xform.c
 | 
			
		||||
 | 
			
		||||
ARRAY_CACHE_SOURCES = \
 | 
			
		||||
	array_cache\ac_context.c \
 | 
			
		||||
	array_cache\ac_import.c
 | 
			
		||||
 | 
			
		||||
SWRAST_SOURCES = \
 | 
			
		||||
	swrast\s_aaline.c \
 | 
			
		||||
	swrast\s_aatriangle.c \
 | 
			
		||||
	swrast\s_accum.c \
 | 
			
		||||
	swrast\s_alpha.c \
 | 
			
		||||
	swrast\s_alphabuf.c \
 | 
			
		||||
	swrast\s_bitmap.c \
 | 
			
		||||
	swrast\s_blend.c \
 | 
			
		||||
	swrast\s_buffers.c \
 | 
			
		||||
	swrast\s_copypix.c \
 | 
			
		||||
	swrast\s_context.c \
 | 
			
		||||
	swrast\s_depth.c \
 | 
			
		||||
	swrast\s_drawpix.c \
 | 
			
		||||
	swrast\s_feedback.c \
 | 
			
		||||
	swrast\s_fog.c \
 | 
			
		||||
	swrast\s_imaging.c \
 | 
			
		||||
	swrast\s_lines.c \
 | 
			
		||||
	swrast\s_logic.c \
 | 
			
		||||
	swrast\s_masking.c \
 | 
			
		||||
	swrast\s_nvfragprog.c \
 | 
			
		||||
	swrast\s_pixeltex.c \
 | 
			
		||||
	swrast\s_points.c \
 | 
			
		||||
	swrast\s_readpix.c \
 | 
			
		||||
	swrast\s_span.c \
 | 
			
		||||
	swrast\s_stencil.c \
 | 
			
		||||
	swrast\s_texture.c \
 | 
			
		||||
	swrast\s_texstore.c \
 | 
			
		||||
	swrast\s_triangle.c \
 | 
			
		||||
	swrast\s_zoom.c
 | 
			
		||||
 | 
			
		||||
SWRAST_SETUP_SOURCES = \
 | 
			
		||||
	swrast_setup\ss_context.c \
 | 
			
		||||
	swrast_setup\ss_triangle.c \
 | 
			
		||||
	swrast_setup\ss_vb.c
 | 
			
		||||
 | 
			
		||||
TNL_SOURCES = \
 | 
			
		||||
	tnl\t_array_api.c \
 | 
			
		||||
	tnl\t_array_import.c \
 | 
			
		||||
	tnl\t_context.c \
 | 
			
		||||
	tnl\t_eval_api.c \
 | 
			
		||||
	tnl\t_imm_alloc.c \
 | 
			
		||||
	tnl\t_imm_api.c \
 | 
			
		||||
	tnl\t_imm_debug.c \
 | 
			
		||||
	tnl\t_imm_dlist.c \
 | 
			
		||||
	tnl\t_imm_elt.c \
 | 
			
		||||
	tnl\t_imm_eval.c \
 | 
			
		||||
	tnl\t_imm_exec.c \
 | 
			
		||||
	tnl\t_imm_fixup.c \
 | 
			
		||||
	tnl\t_pipeline.c \
 | 
			
		||||
	tnl\t_vb_fog.c \
 | 
			
		||||
	tnl\t_vb_light.c \
 | 
			
		||||
	tnl\t_vb_normals.c \
 | 
			
		||||
	tnl\t_vb_points.c \
 | 
			
		||||
	tnl\t_vb_program.c \
 | 
			
		||||
	tnl\t_vb_render.c \
 | 
			
		||||
	tnl\t_vb_texgen.c \
 | 
			
		||||
	tnl\t_vb_texmat.c \
 | 
			
		||||
	tnl\t_vb_vertex.c
 | 
			
		||||
 | 
			
		||||
DRIVER_SOURCES = \
 | 
			
		||||
	drivers\glide\fxapi.c \
 | 
			
		||||
	drivers\glide\fxdd.c \
 | 
			
		||||
	drivers\glide\fxddspan.c \
 | 
			
		||||
	drivers\glide\fxddtex.c \
 | 
			
		||||
	drivers\glide\fxsetup.c \
 | 
			
		||||
	drivers\glide\fxtexman.c \
 | 
			
		||||
	drivers\glide\fxtris.c \
 | 
			
		||||
	drivers\glide\fxvb.c \
 | 
			
		||||
	drivers\glide\fxglidew.c \
 | 
			
		||||
	drivers\glide\fxwgl.c \
 | 
			
		||||
	drivers\glide\fxg.c
 | 
			
		||||
 | 
			
		||||
X86_SOURCES = \
 | 
			
		||||
	x86\x86.c \
 | 
			
		||||
	x86\glapi_x86.S \
 | 
			
		||||
	x86\common_x86.c \
 | 
			
		||||
	x86\common_x86_asm.S \
 | 
			
		||||
	x86\x86_xform2.S \
 | 
			
		||||
	x86\x86_xform3.S \
 | 
			
		||||
	x86\x86_xform4.S \
 | 
			
		||||
	x86\x86_cliptest.S
 | 
			
		||||
 | 
			
		||||
MMX_SOURCES = \
 | 
			
		||||
	x86\mmx_blend.S
 | 
			
		||||
 | 
			
		||||
SSE_SOURCES = \
 | 
			
		||||
	x86\sse.c \
 | 
			
		||||
	x86\sse_xform2.S \
 | 
			
		||||
	x86\sse_xform3.S \
 | 
			
		||||
	x86\sse_xform4.S \
 | 
			
		||||
	x86\sse_normal.S
 | 
			
		||||
 | 
			
		||||
K3D_SOURCES = \
 | 
			
		||||
	x86\3dnow.c \
 | 
			
		||||
	x86\3dnow_xform2.S \
 | 
			
		||||
	x86\3dnow_xform3.S \
 | 
			
		||||
	x86\3dnow_xform4.S \
 | 
			
		||||
	x86\3dnow_normal.S
 | 
			
		||||
 | 
			
		||||
!if "$(HAVE_MMX)"=="1"
 | 
			
		||||
X86_SOURCES = $(X86_SOURCES) $(MMX_SOURCES)
 | 
			
		||||
HAVE_X86 = 1
 | 
			
		||||
!endif
 | 
			
		||||
!if "$(HAVE_SSE)"=="1"
 | 
			
		||||
X86_SOURCES = $(X86_SOURCES) $(SSE_SOURCES)
 | 
			
		||||
HAVE_X86 = 1
 | 
			
		||||
!endif
 | 
			
		||||
!if "$(HAVE_3DNOW)"=="1"
 | 
			
		||||
X86_SOURCES = $(X86_SOURCES) $(K3D_SOURCES)
 | 
			
		||||
HAVE_X86 = 1
 | 
			
		||||
!endif
 | 
			
		||||
!if "$(HAVE_X86)"=="1"
 | 
			
		||||
!else
 | 
			
		||||
X86_SOURCES =
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
EXPORTS = drivers\glide\fxopengl.def
 | 
			
		||||
 | 
			
		||||
MAIN_OBJS         = $(MAIN_SOURCES:.c=.obj)
 | 
			
		||||
GLAPI_OBJS        = $(GLAPI_SOURCES:.c=.obj)
 | 
			
		||||
MATH_OBJS         = $(MATH_SOURCES:.c=.obj)
 | 
			
		||||
ARRAY_CACHE_OBJS  = $(ARRAY_CACHE_SOURCES:.c=.obj)
 | 
			
		||||
SWRAST_OBJS       = $(SWRAST_SOURCES:.c=.obj)
 | 
			
		||||
SWRAST_SETUP_OBJS = $(SWRAST_SETUP_SOURCES:.c=.obj)
 | 
			
		||||
TNL_OBJS          = $(TNL_SOURCES:.c=.obj)
 | 
			
		||||
DRIVER_OBJS       = $(DRIVER_SOURCES:.c=.obj)
 | 
			
		||||
X86_OBJS          = $(X86_SOURCES:.c=.obj)
 | 
			
		||||
X86_OBJS          = $(X86_OBJS:.S=.obj)
 | 
			
		||||
 | 
			
		||||
RES = drivers\glide\fx.res
 | 
			
		||||
 | 
			
		||||
CORE_LIBS = \
 | 
			
		||||
	$(LIBDIR)\main.lib \
 | 
			
		||||
	$(LIBDIR)\glapi.lib \
 | 
			
		||||
	$(LIBDIR)\math.lib \
 | 
			
		||||
	$(LIBDIR)\array_cache.lib \
 | 
			
		||||
	$(LIBDIR)\swrast.lib \
 | 
			
		||||
	$(LIBDIR)\swarst_setup.lib \
 | 
			
		||||
	$(LIBDIR)\tnl.lib
 | 
			
		||||
 | 
			
		||||
!if "$(X86_SOURCES)"!=""
 | 
			
		||||
X86_LIB = $(LIBDIR)\x86.lib
 | 
			
		||||
!else
 | 
			
		||||
X86_LIB =
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
INCS  = -I$(BUILDROOT)\include \
 | 
			
		||||
        -I. \
 | 
			
		||||
        -I.\drivers\glide \
 | 
			
		||||
        -I.\main \
 | 
			
		||||
        -I.\glapi \
 | 
			
		||||
        -I$(GLIDE3SDK)\include
 | 
			
		||||
 | 
			
		||||
DEP_LIB = user32.lib gdi32.lib kernel32.lib
 | 
			
		||||
 | 
			
		||||
!if "$(DEBUG)" == "1"
 | 
			
		||||
STD_LIB = MSVCRTD.lib
 | 
			
		||||
!else
 | 
			
		||||
STD_LIB = MSVCRT.lib
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
#################################
 | 
			
		||||
# build rules
 | 
			
		||||
#################################
 | 
			
		||||
default:: all
 | 
			
		||||
 | 
			
		||||
all: $(X86_LIB) $(CORE_LIBS) $(LIBDIR)\$(GL_DLL)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\$(GL_DLL): $(DRIVER_OBJS) $(CORE_LIBS) $(X86_LIB) $(RES)
 | 
			
		||||
	$(LINK) -out:$@ -def:$(EXPORTS) $(LFLAGS) $(DRIVER_OBJS) $(CORE_LIBS) $(X86_LIB) $(DEP_LIB) $(STD_LIB) $(TEXUS2LIB) $(GLIDE3LIB) $(RES)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\main.lib: $(MAIN_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(MAIN_OBJS)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\glapi.lib: $(GLAPI_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(GLAPI_OBJS)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\math.lib: $(MATH_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(MATH_OBJS)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\array_cache.lib: $(ARRAY_CACHE_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(ARRAY_CACHE_OBJS)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\swrast.lib: $(SWRAST_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(SWRAST_OBJS)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\swarst_setup.lib: $(SWRAST_SETUP_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(SWRAST_SETUP_OBJS)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\tnl.lib: $(TNL_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(TNL_OBJS)
 | 
			
		||||
 | 
			
		||||
x86\matypes.h: x86\gen_matypes.exe
 | 
			
		||||
	x86\gen_matypes.exe > $@
 | 
			
		||||
 | 
			
		||||
x86\gen_matypes.exe: x86\gen_matypes.obj
 | 
			
		||||
	$(LINK) -out:$@ -nologo x86\gen_matypes.obj
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)\x86.lib: x86\matypes.h $(X86_OBJS)
 | 
			
		||||
	$(AR) -out:$@ $(ARFLAGS) $(X86_OBJS)
 | 
			
		||||
 | 
			
		||||
.c.obj:
 | 
			
		||||
	$(CC) $(CFLAGS) $(FLAGS) $(INCS) $< /Fo$*.obj
 | 
			
		||||
 | 
			
		||||
.S.obj:
 | 
			
		||||
	$(CC) $(CFLAGS) $(FLAGS) $(INCS) $< -D__WIN32__ -DNASM_ASSEMBLER -EP > $*.i
 | 
			
		||||
	$(AS) $(ASFLAGS) $(INCS) $*.i -o $*.obj
 | 
			
		||||
	$(RM) $*.i
 | 
			
		||||
 | 
			
		||||
.rc.res:
 | 
			
		||||
	$(RC) -Fo$@ $(INCS) $(FLAGS) -D__WIN32__ $<
 | 
			
		||||
 | 
			
		||||
# [dBorca] Hack alert:
 | 
			
		||||
# glapi_x86.S needs some adjustments
 | 
			
		||||
# in order to generate correct entrypoints
 | 
			
		||||
x86\glapi_x86.obj: x86\glapi_x86.S
 | 
			
		||||
	$(CC) $(CFLAGS) $(FLAGS) $(INCS) x86\glapi_x86.S -DSTDCALL_API -DNASM_ASSEMBLER -EP > $*.i
 | 
			
		||||
	$(AS) $(ASFLAGS) $(INCS) $*.i -o $*.obj
 | 
			
		||||
	$(RM) $*.i
 | 
			
		||||
 | 
			
		||||
#################################
 | 
			
		||||
# cleanup rules
 | 
			
		||||
#################################
 | 
			
		||||
realclean: clean clobber
 | 
			
		||||
 | 
			
		||||
clean::
 | 
			
		||||
	$(RM) array_cache\*.obj
 | 
			
		||||
	$(RM) glapi\*.obj
 | 
			
		||||
	$(RM) main\*.obj
 | 
			
		||||
	$(RM) math\*.obj
 | 
			
		||||
	$(RM) swrast\*.obj
 | 
			
		||||
	$(RM) swrast_setup\*.obj
 | 
			
		||||
	$(RM) tnl\*.obj
 | 
			
		||||
	$(RM) x86\*.obj
 | 
			
		||||
	$(RM) drivers\glide\*.obj
 | 
			
		||||
        $(RM) drivers\glide\*.res
 | 
			
		||||
        $(RM) $(LIBDIR)\*.pdb
 | 
			
		||||
        $(RM) *.pdb
 | 
			
		||||
 | 
			
		||||
clobber::
 | 
			
		||||
	$(RM) $(LIBDIR)\*.lib
 | 
			
		||||
	$(RM) $(LIBDIR)\*.exp
 | 
			
		||||
	$(RM) $(LIBDIR)\*.dll
 | 
			
		||||
@@ -93,7 +93,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
 | 
			
		||||
 | 
			
		||||
   cl = &ac->Fallback.Index;
 | 
			
		||||
   cl->Size = 1;
 | 
			
		||||
   cl->Type = GL_UNSIGNED_INT;
 | 
			
		||||
   cl->Type = GL_FLOAT;
 | 
			
		||||
   cl->Stride = 0;
 | 
			
		||||
   cl->StrideB = 0;
 | 
			
		||||
   cl->Ptr = (GLubyte *) &ctx->Current.Index;
 | 
			
		||||
@@ -217,9 +217,9 @@ static void _ac_cache_init( GLcontext *ctx )
 | 
			
		||||
 | 
			
		||||
   cl = &ac->Cache.Index;
 | 
			
		||||
   cl->Size = 1;
 | 
			
		||||
   cl->Type = GL_UNSIGNED_INT;
 | 
			
		||||
   cl->Type = GL_FLOAT;
 | 
			
		||||
   cl->Stride = 0;
 | 
			
		||||
   cl->StrideB = sizeof(GLuint);
 | 
			
		||||
   cl->StrideB = sizeof(GLfloat);
 | 
			
		||||
   cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
 | 
			
		||||
   cl->Enabled = 1;
 | 
			
		||||
   cl->Flags = 0;
 | 
			
		||||
@@ -336,28 +336,28 @@ void _ac_DestroyContext( GLcontext *ctx )
 | 
			
		||||
    * not an offset into a buffer object.
 | 
			
		||||
    */
 | 
			
		||||
   if (ac->Cache.Vertex.Ptr && ac->Cache.Vertex.BufferObj == nullObj)
 | 
			
		||||
      FREE( ac->Cache.Vertex.Ptr );
 | 
			
		||||
      FREE( (void *) ac->Cache.Vertex.Ptr );
 | 
			
		||||
   if (ac->Cache.Normal.Ptr && ac->Cache.Normal.BufferObj == nullObj)
 | 
			
		||||
      FREE( ac->Cache.Normal.Ptr );
 | 
			
		||||
      FREE( (void *) ac->Cache.Normal.Ptr );
 | 
			
		||||
   if (ac->Cache.Color.Ptr && ac->Cache.Color.BufferObj == nullObj)
 | 
			
		||||
      FREE( ac->Cache.Color.Ptr );
 | 
			
		||||
      FREE( (void *) ac->Cache.Color.Ptr );
 | 
			
		||||
   if (ac->Cache.SecondaryColor.Ptr && ac->Cache.SecondaryColor.BufferObj == nullObj)
 | 
			
		||||
      FREE( ac->Cache.SecondaryColor.Ptr );
 | 
			
		||||
      FREE( (void *) ac->Cache.SecondaryColor.Ptr );
 | 
			
		||||
   if (ac->Cache.EdgeFlag.Ptr && ac->Cache.EdgeFlag.BufferObj == nullObj)
 | 
			
		||||
      FREE( ac->Cache.EdgeFlag.Ptr );
 | 
			
		||||
      FREE( (void *) ac->Cache.EdgeFlag.Ptr );
 | 
			
		||||
   if (ac->Cache.Index.Ptr && ac->Cache.Index.BufferObj == nullObj)
 | 
			
		||||
      FREE( ac->Cache.Index.Ptr );
 | 
			
		||||
      FREE( (void *) ac->Cache.Index.Ptr );
 | 
			
		||||
   if (ac->Cache.FogCoord.Ptr && ac->Cache.FogCoord.BufferObj == nullObj)
 | 
			
		||||
      FREE( ac->Cache.FogCoord.Ptr );
 | 
			
		||||
      FREE( (void *) ac->Cache.FogCoord.Ptr );
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
 | 
			
		||||
      if (ac->Cache.TexCoord[i].Ptr && ac->Cache.TexCoord[i].BufferObj == nullObj)
 | 
			
		||||
	 FREE( ac->Cache.TexCoord[i].Ptr );
 | 
			
		||||
	 FREE( (void *) ac->Cache.TexCoord[i].Ptr );
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < VERT_ATTRIB_MAX; i++) {
 | 
			
		||||
      if (ac->Cache.Attrib[i].Ptr && ac->Cache.Attrib[i].BufferObj == nullObj)
 | 
			
		||||
	 FREE( ac->Cache.Attrib[i].Ptr );
 | 
			
		||||
	 FREE( (void *) ac->Cache.Attrib[i].Ptr );
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (ac->Elts)
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * DOS/DJGPP device driver v1.3 for Mesa
 | 
			
		||||
 * DOS/DJGPP device driver v1.4 for Mesa
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (C) 2002 - Borca Daniel
 | 
			
		||||
 *  Email : dborca@yahoo.com
 | 
			
		||||
@@ -31,7 +31,10 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		.file	"blit.S"
 | 
			
		||||
#include "x86/assyntax.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		FILE("blit.S")
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * extern unsigned int vesa_gran_mask, vesa_gran_shift;
 | 
			
		||||
@@ -41,8 +44,15 @@
 | 
			
		||||
 * extern int vl_current_stride, vl_current_height;
 | 
			
		||||
 * extern int vl_current_offset, vl_current_delta;
 | 
			
		||||
 */
 | 
			
		||||
EXTERN _vesa_gran_mask, _vesa_gran_shift
 | 
			
		||||
EXTERN _vl_video_selector
 | 
			
		||||
 | 
			
		||||
		.text
 | 
			
		||||
EXTERN _vl_current_draw_buffer
 | 
			
		||||
EXTERN _vl_current_stride, _vl_current_height
 | 
			
		||||
EXTERN _vl_current_offset, _vl_current_delta
 | 
			
		||||
 | 
			
		||||
		SEG_TEXT
 | 
			
		||||
		USE32
 | 
			
		||||
 | 
			
		||||
/* Desc: VESA bank switching routine (BIOS)
 | 
			
		||||
 *
 | 
			
		||||
@@ -51,15 +61,15 @@
 | 
			
		||||
 *
 | 
			
		||||
 * Note: thrashes EAX
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
_vesa_swbankBIOS:
 | 
			
		||||
		movw	$0x4f05, %ax
 | 
			
		||||
		int	$0x10
 | 
			
		||||
		ret
 | 
			
		||||
		MOV_W	(CONST(0x4f05), AX)
 | 
			
		||||
		INT	(CONST(0x10))
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
		.p2align 2,,3
 | 
			
		||||
		.global	_vesa_swbank
 | 
			
		||||
_vesa_swbank:	.long	_vesa_swbankBIOS
 | 
			
		||||
		ALIGNTEXT8
 | 
			
		||||
		GLOBL	_vesa_swbank
 | 
			
		||||
_vesa_swbank:	D_LONG	_vesa_swbankBIOS
 | 
			
		||||
 | 
			
		||||
/* Desc: void vesa_b_dump_virtual (void);
 | 
			
		||||
 *
 | 
			
		||||
@@ -68,60 +78,60 @@ _vesa_swbank:	.long	_vesa_swbankBIOS
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_vesa_b_dump_virtual
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_vesa_b_dump_virtual
 | 
			
		||||
_vesa_b_dump_virtual:
 | 
			
		||||
		cld
 | 
			
		||||
		pushl	%es
 | 
			
		||||
		pushl	%ebx
 | 
			
		||||
		pushl	%esi
 | 
			
		||||
		pushl	%edi
 | 
			
		||||
		pushl	%ebp
 | 
			
		||||
		movl	_vl_video_selector, %es
 | 
			
		||||
		movl	_vl_current_draw_buffer, %esi
 | 
			
		||||
		movl	_vl_current_offset, %edi
 | 
			
		||||
		movl	_vesa_gran_shift, %ecx
 | 
			
		||||
		movl	_vesa_gran_mask, %ebp
 | 
			
		||||
		movl	%edi, %edx
 | 
			
		||||
		xorl	%ebx, %ebx
 | 
			
		||||
		andl	%ebp, %edi
 | 
			
		||||
		shrl	%cl, %edx
 | 
			
		||||
		incl	%ebp
 | 
			
		||||
		call	*_vesa_swbank
 | 
			
		||||
		movl	_vl_current_stride, %ecx
 | 
			
		||||
		movl	_vl_current_height, %eax
 | 
			
		||||
		movl	_vl_current_delta, %ebx
 | 
			
		||||
		shrl	$2, %ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	1:
 | 
			
		||||
		cmpl	%ebp, %edi
 | 
			
		||||
		jb	2f
 | 
			
		||||
		pushl	%eax
 | 
			
		||||
		pushl	%ebx
 | 
			
		||||
		incl	%edx
 | 
			
		||||
		xorl	%ebx, %ebx
 | 
			
		||||
		call	*_vesa_swbank
 | 
			
		||||
		popl	%ebx
 | 
			
		||||
		popl	%eax
 | 
			
		||||
		subl	%ebp, %edi
 | 
			
		||||
		.balign	4
 | 
			
		||||
	2:
 | 
			
		||||
		movsl
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	1b
 | 
			
		||||
		popl	%ecx
 | 
			
		||||
		addl	%ebx, %edi
 | 
			
		||||
		decl	%eax
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%ebp
 | 
			
		||||
		popl	%edi
 | 
			
		||||
		popl	%esi
 | 
			
		||||
		popl	%ebx
 | 
			
		||||
		popl	%es
 | 
			
		||||
		ret
 | 
			
		||||
		CLD
 | 
			
		||||
		PUSH_SR	(ES)
 | 
			
		||||
		PUSH_L	(EBX)
 | 
			
		||||
		PUSH_L	(ESI)
 | 
			
		||||
		PUSH_L	(EDI)
 | 
			
		||||
		PUSH_L	(EBP)
 | 
			
		||||
		MOV_SR	(CONTENT(_vl_video_selector), ES)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), ESI)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_offset), EDI)
 | 
			
		||||
		MOV_L	(CONTENT(_vesa_gran_shift), ECX)
 | 
			
		||||
		MOV_L	(CONTENT(_vesa_gran_mask), EBP)
 | 
			
		||||
		MOV_L	(EDI, EDX)
 | 
			
		||||
		XOR_L	(EBX, EBX)
 | 
			
		||||
		AND_L	(EBP, EDI)
 | 
			
		||||
		SHR_L	(CL, EDX)
 | 
			
		||||
		INC_L	(EBP)
 | 
			
		||||
		CALL	(VARINDIRECT(_vesa_swbank))
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_stride), ECX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_height), EAX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_delta), EBX)
 | 
			
		||||
		SHR_L	(CONST(2), ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(1):
 | 
			
		||||
		CMP_L	(EBP, EDI)
 | 
			
		||||
		jb	TLBL(2)
 | 
			
		||||
		PUSH_L	(EAX)
 | 
			
		||||
		PUSH_L	(EBX)
 | 
			
		||||
		INC_L	(EDX)
 | 
			
		||||
		XOR_L	(EBX, EBX)
 | 
			
		||||
		CALL	(VARINDIRECT(_vesa_swbank))
 | 
			
		||||
		POP_L	(EBX)
 | 
			
		||||
		POP_L	(EAX)
 | 
			
		||||
		SUB_L	(EBP, EDI)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(2):
 | 
			
		||||
		MOVS_L
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(1)
 | 
			
		||||
		POP_L	(ECX)
 | 
			
		||||
		ADD_L	(EBX, EDI)
 | 
			
		||||
		DEC_L	(EAX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EBP)
 | 
			
		||||
		POP_L	(EDI)
 | 
			
		||||
		POP_L	(ESI)
 | 
			
		||||
		POP_L	(EBX)
 | 
			
		||||
		POP_SR	(ES)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void vesa_l_dump_virtual (void);
 | 
			
		||||
 *
 | 
			
		||||
@@ -130,32 +140,32 @@ _vesa_b_dump_virtual:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_vesa_l_dump_virtual
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_vesa_l_dump_virtual
 | 
			
		||||
_vesa_l_dump_virtual:
 | 
			
		||||
		cld
 | 
			
		||||
		pushl	%es
 | 
			
		||||
		pushl	%esi
 | 
			
		||||
		pushl	%edi
 | 
			
		||||
		movl	_vl_video_selector, %es
 | 
			
		||||
		movl	_vl_current_draw_buffer, %esi
 | 
			
		||||
		movl	_vl_current_offset, %edi
 | 
			
		||||
		movl	_vl_current_stride, %ecx
 | 
			
		||||
		movl	_vl_current_height, %edx
 | 
			
		||||
		movl	_vl_current_delta, %eax
 | 
			
		||||
		shrl	$2, %ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		rep;	movsl
 | 
			
		||||
		popl	%ecx
 | 
			
		||||
		addl	%eax, %edi
 | 
			
		||||
		decl	%edx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%edi
 | 
			
		||||
		popl	%esi
 | 
			
		||||
		popl	%es
 | 
			
		||||
		ret
 | 
			
		||||
		CLD
 | 
			
		||||
		PUSH_SR	(ES)
 | 
			
		||||
		PUSH_L	(ESI)
 | 
			
		||||
		PUSH_L	(EDI)
 | 
			
		||||
		MOV_SR	(CONTENT(_vl_video_selector), ES)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), ESI)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_offset), EDI)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_stride), ECX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_height), EDX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_delta), EAX)
 | 
			
		||||
		SHR_L	(CONST(2), ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		REP	MOVS_L
 | 
			
		||||
		POP_L	(ECX)
 | 
			
		||||
		ADD_L	(EAX, EDI)
 | 
			
		||||
		DEC_L	(EDX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EDI)
 | 
			
		||||
		POP_L	(ESI)
 | 
			
		||||
		POP_SR	(ES)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void vesa_l_dump_virtual_mmx (void);
 | 
			
		||||
 *
 | 
			
		||||
@@ -164,36 +174,37 @@ _vesa_l_dump_virtual:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_vesa_l_dump_virtual_mmx
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_vesa_l_dump_virtual_mmx
 | 
			
		||||
_vesa_l_dump_virtual_mmx:
 | 
			
		||||
#ifdef USE_MMX_ASM
 | 
			
		||||
		pushl	%esi
 | 
			
		||||
		pushl	%edi
 | 
			
		||||
		movl	_vl_video_selector, %fs
 | 
			
		||||
		movl	_vl_current_draw_buffer, %esi
 | 
			
		||||
		movl	_vl_current_offset, %edi
 | 
			
		||||
		movl	_vl_current_stride, %ecx
 | 
			
		||||
		movl	_vl_current_height, %edx
 | 
			
		||||
		movl	_vl_current_delta, %eax
 | 
			
		||||
		shrl	$3, %ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	1:
 | 
			
		||||
		movq	(%esi), %mm0
 | 
			
		||||
		addl	$8, %esi
 | 
			
		||||
		movq	%mm0, %fs:(%edi)
 | 
			
		||||
		addl	$8, %edi
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	1b
 | 
			
		||||
		popl	%ecx
 | 
			
		||||
		addl	%eax, %edi
 | 
			
		||||
		decl	%edx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%edi
 | 
			
		||||
		popl	%esi
 | 
			
		||||
		emms
 | 
			
		||||
		PUSH_L	(ESI)
 | 
			
		||||
		PUSH_L	(EDI)
 | 
			
		||||
		MOV_SR	(CONTENT(_vl_video_selector), FS)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), ESI)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_offset), EDI)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_stride), ECX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_height), EDX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_delta), EAX)
 | 
			
		||||
		SHR_L	(CONST(3), ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(1):
 | 
			
		||||
		MOVQ	(REGIND(ESI), MM0)
 | 
			
		||||
		ADD_L	(CONST(8), ESI)
 | 
			
		||||
		SEGFS
 | 
			
		||||
		MOVQ	(MM0, REGIND(EDI))
 | 
			
		||||
		ADD_L	(CONST(8), EDI)
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(1)
 | 
			
		||||
		POP_L	(ECX)
 | 
			
		||||
		ADD_L	(EAX, EDI)
 | 
			
		||||
		DEC_L	(EDX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EDI)
 | 
			
		||||
		POP_L	(ESI)
 | 
			
		||||
		EMMS
 | 
			
		||||
#endif
 | 
			
		||||
		ret
 | 
			
		||||
		RET
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Mesa 3-D graphics library
 | 
			
		||||
 * Version:  5.0.1
 | 
			
		||||
 * Version:  5.1
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
 | 
			
		||||
 * 
 | 
			
		||||
@@ -34,6 +34,7 @@
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
#include "context.h"
 | 
			
		||||
#ifndef FX
 | 
			
		||||
#include "bufferobj.h"
 | 
			
		||||
#include "extensions.h"
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
#include "matrix.h"
 | 
			
		||||
@@ -1108,11 +1109,22 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This function is called to specify which buffer to read and write
 | 
			
		||||
 * for software rasterization (swrast) fallbacks.  This doesn't necessarily
 | 
			
		||||
 * correspond to glDrawBuffer() or glReadBuffer() calls.
 | 
			
		||||
 */
 | 
			
		||||
static void set_buffer (GLcontext *ctx, GLframebuffer *colorBuffer, GLuint bufferBit)
 | 
			
		||||
{
 | 
			
		||||
 /*
 | 
			
		||||
  * XXX todo - examine bufferBit and set read/write pointers
 | 
			
		||||
  */
 | 
			
		||||
 /* Normally, we would have
 | 
			
		||||
  *    ctx->Driver.ReadBuffer == set_read_buffer
 | 
			
		||||
  *    ctx->Driver.DrawBuffer == set_draw_buffer
 | 
			
		||||
  * and make sure set_draw_buffer calls _swrast_DrawBuffer,
 | 
			
		||||
  * which in turn will call this routine via dd->SetBuffer.
 | 
			
		||||
  */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1137,13 +1149,10 @@ static const GLubyte* get_string (GLcontext *ctx, GLenum name)
 | 
			
		||||
 switch (name) {
 | 
			
		||||
        case GL_RENDERER:
 | 
			
		||||
             return (const GLubyte *)"Mesa DJGPP"
 | 
			
		||||
                                     #ifdef FX
 | 
			
		||||
                                     " (FX)"
 | 
			
		||||
                                     #endif
 | 
			
		||||
                                     #ifdef MATROX
 | 
			
		||||
                                     " (MGA)"
 | 
			
		||||
                                     #endif
 | 
			
		||||
                                     "\0port (c) Borca Daniel aug-2003";
 | 
			
		||||
                                     "\0port (c) Borca Daniel oct-2003";
 | 
			
		||||
        default:
 | 
			
		||||
             return NULL;
 | 
			
		||||
 }
 | 
			
		||||
@@ -1311,7 +1320,7 @@ static void dmesa_init_pointers (GLcontext *ctx)
 | 
			
		||||
 | 
			
		||||
static void dmesa_update_state (GLcontext *ctx, GLuint new_state)
 | 
			
		||||
{
 | 
			
		||||
 /* Propogate statechange information to swrast and swrast_setup
 | 
			
		||||
 /* Propagate statechange information to swrast and swrast_setup
 | 
			
		||||
  * modules. The DMesa driver has no internal GL-dependent state.
 | 
			
		||||
  */
 | 
			
		||||
 _swrast_InvalidateState( ctx, new_state );
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W triangle template
 | 
			
		||||
 * DOS/DJGPP device driver v1.4 for Mesa  --  MGA2064W triangle template
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2003 - Borca Daniel
 | 
			
		||||
 *  Email : dborca@yahoo.com
 | 
			
		||||
@@ -83,7 +83,9 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(INTERP_Z) || defined(INTERP_RGB)
 | 
			
		||||
#if !LONG_LONG
 | 
			
		||||
 double one_area;
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef INTERP_RGB
 | 
			
		||||
 int red = v3->color[0];
 | 
			
		||||
 int green = v3->color[1];
 | 
			
		||||
@@ -147,7 +149,9 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v
 | 
			
		||||
 | 
			
		||||
 /* draw lower triangle */
 | 
			
		||||
#if defined(INTERP_Z) || defined(INTERP_RGB)
 | 
			
		||||
#if !LONG_LONG
 | 
			
		||||
 one_area = (double)(1<<15) / (double)area;
 | 
			
		||||
#endif
 | 
			
		||||
 mga_fifo(1);
 | 
			
		||||
#else
 | 
			
		||||
 mga_fifo(2);
 | 
			
		||||
@@ -163,8 +167,13 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v
 | 
			
		||||
 /* compute d?/dx and d?/dy derivatives */
 | 
			
		||||
 eMaj_dz = z3 - z1;
 | 
			
		||||
 eBot_dz = z2 - z1;
 | 
			
		||||
#if !LONG_LONG
 | 
			
		||||
 dzdx = (eMaj_dz * eBot_dy - eMaj_dy * eBot_dz) * one_area;
 | 
			
		||||
 dzdy = (eMaj_dx * eBot_dz - eMaj_dz * eBot_dx) * one_area;
 | 
			
		||||
#else
 | 
			
		||||
 dzdx = ((long long)(eMaj_dz * eBot_dy - eMaj_dy * eBot_dz)<<15) / area;
 | 
			
		||||
 dzdy = ((long long)(eMaj_dx * eBot_dz - eMaj_dz * eBot_dx)<<15) / area;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef INTERP_RGB
 | 
			
		||||
 mga_fifo(11);
 | 
			
		||||
@@ -196,12 +205,21 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v
 | 
			
		||||
 eBot_db = v2->color[2] - v1->color[2];
 | 
			
		||||
 | 
			
		||||
 /* compute color increments */
 | 
			
		||||
#if !LONG_LONG
 | 
			
		||||
 drdx = (eMaj_dr * eBot_dy - eMaj_dy * eBot_dr) * one_area;
 | 
			
		||||
 drdy = (eMaj_dx * eBot_dr - eMaj_dr * eBot_dx) * one_area;
 | 
			
		||||
 dgdx = (eMaj_dg * eBot_dy - eMaj_dy * eBot_dg) * one_area;
 | 
			
		||||
 dgdy = (eMaj_dx * eBot_dg - eMaj_dg * eBot_dx) * one_area;
 | 
			
		||||
 dbdx = (eMaj_db * eBot_dy - eMaj_dy * eBot_db) * one_area;
 | 
			
		||||
 dbdy = (eMaj_dx * eBot_db - eMaj_db * eBot_dx) * one_area;
 | 
			
		||||
#else
 | 
			
		||||
 drdx = ((long long)(eMaj_dr * eBot_dy - eMaj_dy * eBot_dr)<<15) / area;
 | 
			
		||||
 drdy = ((long long)(eMaj_dx * eBot_dr - eMaj_dr * eBot_dx)<<15) / area;
 | 
			
		||||
 dgdx = ((long long)(eMaj_dg * eBot_dy - eMaj_dy * eBot_dg)<<15) / area;
 | 
			
		||||
 dgdy = ((long long)(eMaj_dx * eBot_dg - eMaj_dg * eBot_dx)<<15) / area;
 | 
			
		||||
 dbdx = ((long long)(eMaj_db * eBot_dy - eMaj_dy * eBot_db)<<15) / area;
 | 
			
		||||
 dbdy = ((long long)(eMaj_dx * eBot_db - eMaj_db * eBot_dx)<<15) / area;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 mga_fifo(6);
 | 
			
		||||
 mga_outl(M_DR6, drdx);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,375 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Mesa 3-D graphics library
 | 
			
		||||
 * Version:  5.0
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (C) 1999-2002  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 device driver v1.3 for Mesa  --  MGA2064W triangle template
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2003 - Borca Daniel
 | 
			
		||||
 *  Email : dborca@yahoo.com
 | 
			
		||||
 *  Web   : http://www.geocities.com/dborca
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Triangle Rasterizer Template
 | 
			
		||||
 *
 | 
			
		||||
 * This file is #include'd to generate custom triangle rasterizers.
 | 
			
		||||
 *
 | 
			
		||||
 * The following macros may be defined to indicate what auxillary information
 | 
			
		||||
 * must be interplated across the triangle:
 | 
			
		||||
 *    INTERP_Z        - if defined, interpolate Z values
 | 
			
		||||
 *    INTERP_RGB      - if defined, interpolate RGB values
 | 
			
		||||
 *
 | 
			
		||||
 *    TAG             - function name
 | 
			
		||||
 *    CULL            - enable culling for: 0=no, 1=back, -1=front
 | 
			
		||||
 *
 | 
			
		||||
 *    SETUP_CODE      - to be executed once per triangle (usually HW init)
 | 
			
		||||
 *
 | 
			
		||||
 * For flatshaded primitives, the provoking vertex is the final one.
 | 
			
		||||
 * This code was designed for the origin to be in the upper-left corner.
 | 
			
		||||
 *
 | 
			
		||||
 * Inspired by triangle rasterizer code written by Brian Paul.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define TRI_SWAP(a, b)        \
 | 
			
		||||
do {                          \
 | 
			
		||||
    const MGAvertex *tmp = a; \
 | 
			
		||||
    a = b;                    \
 | 
			
		||||
    b = tmp;                  \
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3)
 | 
			
		||||
{
 | 
			
		||||
 int area;
 | 
			
		||||
 int x1, y1, x2, y2, x3, y3;
 | 
			
		||||
 int eMaj_dx, eMaj_dy, eBot_dx, eBot_dy, eTop_dx, eTop_dy;
 | 
			
		||||
#ifdef INTERP_RGB
 | 
			
		||||
#define FIFO_CNT_RGB 3
 | 
			
		||||
 int eMaj_dr, eBot_dr, eMaj_dg, eBot_dg, eMaj_db, eBot_db;
 | 
			
		||||
 int drdx, drdy, dgdx, dgdy, dbdx, dbdy;
 | 
			
		||||
#else
 | 
			
		||||
#define FIFO_CNT_RGB 0
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef INTERP_Z
 | 
			
		||||
#define FIFO_CNT_Z 1
 | 
			
		||||
 int dzdx, dzdy;
 | 
			
		||||
 int eMaj_dz, eBot_dz;
 | 
			
		||||
 int z1, z2, z3;
 | 
			
		||||
#else
 | 
			
		||||
#define FIFO_CNT_Z 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(INTERP_Z) || defined(INTERP_RGB)
 | 
			
		||||
#ifndef INTERP_RGB
 | 
			
		||||
 int red = v3->color[0];
 | 
			
		||||
 int green = v3->color[1];
 | 
			
		||||
 int blue = v3->color[2];
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
 unsigned long color = mga_mixrgb_full(v3->color);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 int sgn = 0;
 | 
			
		||||
 | 
			
		||||
 /* sort along the vertical axis */
 | 
			
		||||
 if (v2->win[1] < v1->win[1]) {
 | 
			
		||||
    TRI_SWAP(v1, v2);
 | 
			
		||||
#ifdef CULL
 | 
			
		||||
    cull = -cull;
 | 
			
		||||
#endif
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 if (v3->win[1] < v1->win[1]) {
 | 
			
		||||
    TRI_SWAP(v1, v3);
 | 
			
		||||
    TRI_SWAP(v2, v3);
 | 
			
		||||
 } else if (v3->win[1] < v2->win[1]) {
 | 
			
		||||
    TRI_SWAP(v2, v3);
 | 
			
		||||
#ifdef CULL
 | 
			
		||||
    cull = -cull;
 | 
			
		||||
#endif    
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
 x1 = v1->win[0];
 | 
			
		||||
 y1 = v1->win[1];
 | 
			
		||||
 x2 = v2->win[0];
 | 
			
		||||
 y2 = v2->win[1];
 | 
			
		||||
 x3 = v3->win[0];
 | 
			
		||||
 y3 = v3->win[1];
 | 
			
		||||
 | 
			
		||||
 /* compute deltas for each edge */
 | 
			
		||||
 eMaj_dx = x3 - x1;
 | 
			
		||||
 eMaj_dy = y3 - y1;
 | 
			
		||||
 eBot_dx = x2 - x1;
 | 
			
		||||
 eBot_dy = y2 - y1;
 | 
			
		||||
 eTop_dx = x3 - x2;
 | 
			
		||||
 eTop_dy = y3 - y2;
 | 
			
		||||
 | 
			
		||||
 /* compute area */
 | 
			
		||||
 if ((area = eMaj_dx * eBot_dy - eBot_dx * eMaj_dy) == 0) {
 | 
			
		||||
    return;
 | 
			
		||||
 }
 | 
			
		||||
#ifdef CULL
 | 
			
		||||
 if ((area * cull) > 0) {
 | 
			
		||||
    return;
 | 
			
		||||
 }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 mga_select();
 | 
			
		||||
 | 
			
		||||
 /* set engine state */
 | 
			
		||||
#ifdef SETUP_CODE
 | 
			
		||||
 SETUP_CODE
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 /* draw lower triangle */
 | 
			
		||||
#if defined(INTERP_Z) || defined(INTERP_RGB)
 | 
			
		||||
 mga_fifo(1);
 | 
			
		||||
#else
 | 
			
		||||
 mga_fifo(2);
 | 
			
		||||
 mga_outl(M_FCOL, color);
 | 
			
		||||
#endif
 | 
			
		||||
 mga_outl(M_YDST, y1);
 | 
			
		||||
 | 
			
		||||
#ifdef INTERP_Z
 | 
			
		||||
 z1 = v1->win[2];
 | 
			
		||||
 z2 = v2->win[2];
 | 
			
		||||
 z3 = v3->win[2];
 | 
			
		||||
 | 
			
		||||
 /* compute d?/dx and d?/dy derivatives */
 | 
			
		||||
 eMaj_dz = z3 - z1;
 | 
			
		||||
 eBot_dz = z2 - z1;
 | 
			
		||||
 dzdx = ((long long)(eMaj_dz * eBot_dy - eMaj_dy * eBot_dz)<<15) / area;
 | 
			
		||||
 dzdy = ((long long)(eMaj_dx * eBot_dz - eMaj_dz * eBot_dx)<<15) / area;
 | 
			
		||||
 | 
			
		||||
#ifndef INTERP_RGB
 | 
			
		||||
 mga_fifo(11);
 | 
			
		||||
 mga_outl(M_DR2, dzdx);
 | 
			
		||||
 mga_outl(M_DR3, dzdy);
 | 
			
		||||
 mga_outl(M_DR4, red<<15);
 | 
			
		||||
 mga_outl(M_DR6, 0);
 | 
			
		||||
 mga_outl(M_DR7, 0);
 | 
			
		||||
 mga_outl(M_DR8, green<<15);
 | 
			
		||||
 mga_outl(M_DR10, 0);
 | 
			
		||||
 mga_outl(M_DR11, 0);
 | 
			
		||||
 mga_outl(M_DR12, blue<<15);
 | 
			
		||||
 mga_outl(M_DR14, 0);
 | 
			
		||||
 mga_outl(M_DR15, 0);
 | 
			
		||||
#else
 | 
			
		||||
 mga_fifo(2);
 | 
			
		||||
 mga_outl(M_DR2, dzdx);
 | 
			
		||||
 mga_outl(M_DR3, dzdy);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef INTERP_RGB
 | 
			
		||||
 /* compute color deltas */
 | 
			
		||||
 eMaj_dr = v3->color[0] - v1->color[0];
 | 
			
		||||
 eBot_dr = v2->color[0] - v1->color[0];
 | 
			
		||||
 eMaj_dg = v3->color[1] - v1->color[1];
 | 
			
		||||
 eBot_dg = v2->color[1] - v1->color[1];
 | 
			
		||||
 eMaj_db = v3->color[2] - v1->color[2];
 | 
			
		||||
 eBot_db = v2->color[2] - v1->color[2];
 | 
			
		||||
 | 
			
		||||
 /* compute color increments */
 | 
			
		||||
 drdx = ((long long)(eMaj_dr * eBot_dy - eMaj_dy * eBot_dr)<<15) / area;
 | 
			
		||||
 drdy = ((long long)(eMaj_dx * eBot_dr - eMaj_dr * eBot_dx)<<15) / area;
 | 
			
		||||
 dgdx = ((long long)(eMaj_dg * eBot_dy - eMaj_dy * eBot_dg)<<15) / area;
 | 
			
		||||
 dgdy = ((long long)(eMaj_dx * eBot_dg - eMaj_dg * eBot_dx)<<15) / area;
 | 
			
		||||
 dbdx = ((long long)(eMaj_db * eBot_dy - eMaj_dy * eBot_db)<<15) / area;
 | 
			
		||||
 dbdy = ((long long)(eMaj_dx * eBot_db - eMaj_db * eBot_dx)<<15) / area;
 | 
			
		||||
 | 
			
		||||
 mga_fifo(6);
 | 
			
		||||
 mga_outl(M_DR6, drdx);
 | 
			
		||||
 mga_outl(M_DR7, drdy);
 | 
			
		||||
 mga_outl(M_DR10, dgdx);
 | 
			
		||||
 mga_outl(M_DR11, dgdy);
 | 
			
		||||
 mga_outl(M_DR14, dbdx);
 | 
			
		||||
 mga_outl(M_DR15, dbdy);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 if (area > 0) { /* major edge on the right */
 | 
			
		||||
    if (eBot_dy) { /* have lower triangle */
 | 
			
		||||
       mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB);
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_AR0, eBot_dy);
 | 
			
		||||
       if (x2 < x1) {
 | 
			
		||||
          mga_outl(M_AR1, eBot_dx + eBot_dy - 1);
 | 
			
		||||
          mga_outl(M_AR2, eBot_dx);
 | 
			
		||||
          sgn |= M_SDXL;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR1, -eBot_dx);
 | 
			
		||||
          mga_outl(M_AR2, -eBot_dx);
 | 
			
		||||
       }
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_AR6, eMaj_dy);
 | 
			
		||||
       if (x3 < x1) {
 | 
			
		||||
          mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1);
 | 
			
		||||
          mga_outl(M_AR5, eMaj_dx);
 | 
			
		||||
          sgn |= M_SDXR;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR4, -eMaj_dx);
 | 
			
		||||
          mga_outl(M_AR5, -eMaj_dx);
 | 
			
		||||
       }
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_FXBNDRY, (x1<<16) | x1);
 | 
			
		||||
#ifdef INTERP_Z
 | 
			
		||||
       mga_outl(M_DR0, z1<<15);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef INTERP_RGB
 | 
			
		||||
       mga_outl(M_DR4, v1->color[0]<<15);
 | 
			
		||||
       mga_outl(M_DR8, v1->color[1]<<15);
 | 
			
		||||
       mga_outl(M_DR12, v1->color[2]<<15);
 | 
			
		||||
#endif
 | 
			
		||||
       mga_outl(M_SGN, sgn);
 | 
			
		||||
       mga_outl(M_LEN | M_EXEC, eBot_dy);
 | 
			
		||||
    } else { /* no lower triangle */
 | 
			
		||||
       mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB);
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_AR6, eMaj_dy);
 | 
			
		||||
       if (x3 < x1) {
 | 
			
		||||
          mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1);
 | 
			
		||||
          mga_outl(M_AR5, eMaj_dx);
 | 
			
		||||
          sgn |= M_SDXR;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR4, -eMaj_dx);
 | 
			
		||||
          mga_outl(M_AR5, -eMaj_dx);
 | 
			
		||||
       }
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_FXBNDRY, (x1<<16) | x2);
 | 
			
		||||
#ifdef INTERP_Z
 | 
			
		||||
       mga_outl(M_DR0, z2<<15);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef INTERP_RGB
 | 
			
		||||
       mga_outl(M_DR4, v2->color[0]<<15);
 | 
			
		||||
       mga_outl(M_DR8, v2->color[1]<<15);
 | 
			
		||||
       mga_outl(M_DR12, v2->color[2]<<15);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* draw upper triangle */
 | 
			
		||||
    if (eTop_dy) {
 | 
			
		||||
       mga_fifo(5);
 | 
			
		||||
       mga_outl(M_AR0, eTop_dy);
 | 
			
		||||
       if (x3 < x2) {
 | 
			
		||||
          mga_outl(M_AR1, eTop_dx + eTop_dy - 1);
 | 
			
		||||
          mga_outl(M_AR2, eTop_dx);
 | 
			
		||||
          sgn |= M_SDXL;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR1, -eTop_dx);
 | 
			
		||||
          mga_outl(M_AR2, -eTop_dx);
 | 
			
		||||
          sgn &= ~M_SDXL;
 | 
			
		||||
       }
 | 
			
		||||
       mga_outl(M_SGN, sgn);
 | 
			
		||||
       mga_outl(M_LEN | M_EXEC, eTop_dy);
 | 
			
		||||
    }
 | 
			
		||||
 } else { /* major edge on the left */
 | 
			
		||||
    if (eBot_dy) { /* have lower triangle */
 | 
			
		||||
       mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB);
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_AR0, eMaj_dy);
 | 
			
		||||
       if (x3 < x1) {
 | 
			
		||||
          mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1);
 | 
			
		||||
          mga_outl(M_AR2, eMaj_dx);
 | 
			
		||||
          sgn |= M_SDXL;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR1, -eMaj_dx);
 | 
			
		||||
          mga_outl(M_AR2, -eMaj_dx);
 | 
			
		||||
       }
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_AR6, eBot_dy);
 | 
			
		||||
       if (x2 < x1) {
 | 
			
		||||
          mga_outl(M_AR4, eBot_dx + eBot_dy - 1);
 | 
			
		||||
          mga_outl(M_AR5, eBot_dx);
 | 
			
		||||
          sgn |= M_SDXR;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR4, -eBot_dx);
 | 
			
		||||
          mga_outl(M_AR5, -eBot_dx);
 | 
			
		||||
       }
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_FXBNDRY, (x1<<16) | x1);
 | 
			
		||||
#ifdef INTERP_Z
 | 
			
		||||
       mga_outl(M_DR0, z1<<15);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef INTERP_RGB
 | 
			
		||||
       mga_outl(M_DR4, v1->color[0]<<15);
 | 
			
		||||
       mga_outl(M_DR8, v1->color[1]<<15);
 | 
			
		||||
       mga_outl(M_DR12, v1->color[2]<<15);
 | 
			
		||||
#endif
 | 
			
		||||
       mga_outl(M_SGN, sgn);
 | 
			
		||||
       mga_outl(M_LEN | M_EXEC, eBot_dy);
 | 
			
		||||
    } else { /* no lower triangle */
 | 
			
		||||
       mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB);
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_AR0, eMaj_dy);
 | 
			
		||||
       if (x3 < x1) {
 | 
			
		||||
          mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1);
 | 
			
		||||
          mga_outl(M_AR2, eMaj_dx);
 | 
			
		||||
          sgn |= M_SDXL;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR1, -eMaj_dx);
 | 
			
		||||
          mga_outl(M_AR2, -eMaj_dx);
 | 
			
		||||
       }
 | 
			
		||||
 | 
			
		||||
       mga_outl(M_FXBNDRY, (x2<<16) | x1);
 | 
			
		||||
#ifdef INTERP_Z
 | 
			
		||||
       mga_outl(M_DR0, z1<<15);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef INTERP_RGB
 | 
			
		||||
       mga_outl(M_DR4, v1->color[0]<<15);
 | 
			
		||||
       mga_outl(M_DR8, v1->color[1]<<15);
 | 
			
		||||
       mga_outl(M_DR12, v1->color[2]<<15);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* draw upper triangle */
 | 
			
		||||
    if (eTop_dy) {
 | 
			
		||||
       mga_fifo(5);
 | 
			
		||||
       mga_outl(M_AR6, eTop_dy);
 | 
			
		||||
       if (x3 < x2) {
 | 
			
		||||
          mga_outl(M_AR4, eTop_dx + eTop_dy - 1);
 | 
			
		||||
          mga_outl(M_AR5, eTop_dx);
 | 
			
		||||
          sgn |= M_SDXR;
 | 
			
		||||
       } else {
 | 
			
		||||
          mga_outl(M_AR4, -eTop_dx);
 | 
			
		||||
          mga_outl(M_AR5, -eTop_dx);
 | 
			
		||||
          sgn &= ~M_SDXR;
 | 
			
		||||
       }
 | 
			
		||||
       mga_outl(M_SGN, sgn);
 | 
			
		||||
       mga_outl(M_LEN | M_EXEC, eTop_dy);
 | 
			
		||||
    }
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#undef FIFO_CNT_RGB
 | 
			
		||||
#undef FIFO_CNT_Z
 | 
			
		||||
 | 
			
		||||
#undef TRI_SWAP
 | 
			
		||||
 | 
			
		||||
#undef SETUP_CODE
 | 
			
		||||
#undef INTERP_RGB
 | 
			
		||||
#undef INTERP_Z
 | 
			
		||||
#undef CULL
 | 
			
		||||
#undef TAG
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * DOS/DJGPP device driver v1.3 for Mesa
 | 
			
		||||
 * DOS/DJGPP device driver v1.4 for Mesa
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (C) 2002 - Borca Daniel
 | 
			
		||||
 *  Email : dborca@yahoo.com
 | 
			
		||||
@@ -31,14 +31,20 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		.file	"virtual.S"
 | 
			
		||||
#include "x86/assyntax.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		FILE("virtual.S")
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * extern void *vl_current_draw_buffer;
 | 
			
		||||
 * extern int vl_current_width, vl_current_bytes;
 | 
			
		||||
 */
 | 
			
		||||
EXTERN _vl_current_draw_buffer
 | 
			
		||||
EXTERN _vl_current_width, _vl_current_bytes
 | 
			
		||||
 | 
			
		||||
		.text
 | 
			
		||||
		SEG_TEXT
 | 
			
		||||
		USE32
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_clear8 (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -47,14 +53,14 @@
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear8
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear8
 | 
			
		||||
_v_clear8:
 | 
			
		||||
		movl	4(%esp), %eax
 | 
			
		||||
		movb	%al, %ah
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		popl	%eax
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EAX)
 | 
			
		||||
		MOV_B	(AL, AH)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		POP_L	(EAX)
 | 
			
		||||
		jmp	_v_clear_common
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_clear16 (int color);
 | 
			
		||||
@@ -64,13 +70,13 @@ _v_clear8:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear16
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear16
 | 
			
		||||
_v_clear16:
 | 
			
		||||
		movl	4(%esp), %eax
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		popl	%eax
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EAX)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		POP_L	(EAX)
 | 
			
		||||
		jmp	_v_clear_common
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_clear32 (int color);
 | 
			
		||||
@@ -80,22 +86,22 @@ _v_clear16:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear32
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear32
 | 
			
		||||
_v_clear32:
 | 
			
		||||
		movl	4(%esp), %eax
 | 
			
		||||
		.balign	4
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EAX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
_v_clear_common:
 | 
			
		||||
		movl	_vl_current_bytes, %ecx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %edx
 | 
			
		||||
		shrl	$2, %ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		movl	%eax, (%edx)
 | 
			
		||||
		addl	$4, %edx
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		ret
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_bytes), ECX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), EDX)
 | 
			
		||||
		SHR_L	(CONST(2), ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		MOV_L	(EAX, REGIND(EDX))
 | 
			
		||||
		ADD_L	(CONST(4), EDX)
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_clear8_mmx (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -104,13 +110,13 @@ _v_clear_common:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear8_mmx
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear8_mmx
 | 
			
		||||
_v_clear8_mmx:
 | 
			
		||||
#ifdef USE_MMX_ASM
 | 
			
		||||
		movd	4(%esp), %mm0
 | 
			
		||||
		punpcklbw %mm0, %mm0
 | 
			
		||||
		punpcklwd %mm0, %mm0
 | 
			
		||||
		MOVD	(REGOFF(4, ESP), MM0)
 | 
			
		||||
		PUNPCKLBW (MM0, MM0)
 | 
			
		||||
		PUNPCKLWD (MM0, MM0)
 | 
			
		||||
		jmp	_v_clear_common_mmx
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -121,12 +127,12 @@ _v_clear8_mmx:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear16_mmx
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear16_mmx
 | 
			
		||||
_v_clear16_mmx:
 | 
			
		||||
#ifdef USE_MMX_ASM
 | 
			
		||||
		movd	4(%esp), %mm0
 | 
			
		||||
		punpcklwd %mm0, %mm0
 | 
			
		||||
		MOVD	(REGOFF(4, ESP), MM0)
 | 
			
		||||
		PUNPCKLWD (MM0, MM0)
 | 
			
		||||
		jmp	_v_clear_common_mmx
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -137,26 +143,26 @@ _v_clear16_mmx:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear32_mmx
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear32_mmx
 | 
			
		||||
_v_clear32_mmx:
 | 
			
		||||
#ifdef USE_MMX_ASM
 | 
			
		||||
		movd	4(%esp), %mm0
 | 
			
		||||
		.balign	4
 | 
			
		||||
		MOVD	(REGOFF(4, ESP), MM0)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
_v_clear_common_mmx:
 | 
			
		||||
		punpckldq %mm0, %mm0
 | 
			
		||||
		movl	_vl_current_bytes, %ecx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %edx
 | 
			
		||||
		shrl	$3, %ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		movq	%mm0, (%edx)
 | 
			
		||||
		addl	$8, %edx
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		emms
 | 
			
		||||
		PUNPCKLDQ (MM0, MM0)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_bytes), ECX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), EDX)
 | 
			
		||||
		SHR_L	(CONST(3), ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		MOVQ	(MM0, REGIND(EDX))
 | 
			
		||||
		ADD_L	(CONST(8), EDX)
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		EMMS
 | 
			
		||||
#endif
 | 
			
		||||
		ret
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_clear24 (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -165,26 +171,26 @@ _v_clear_common_mmx:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear24
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear24
 | 
			
		||||
_v_clear24:
 | 
			
		||||
		movl	$0xaaaaaaab, %eax
 | 
			
		||||
		mull	_vl_current_bytes
 | 
			
		||||
		movl	4(%esp), %eax
 | 
			
		||||
		movl	%edx, %ecx
 | 
			
		||||
		pushl	%ebx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %edx
 | 
			
		||||
		shrl	%ecx
 | 
			
		||||
		movb	10(%esp), %bl
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		movw	%ax, (%edx)
 | 
			
		||||
		movb	%bl, 2(%edx)
 | 
			
		||||
		addl	$3, %edx
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%ebx
 | 
			
		||||
		ret
 | 
			
		||||
		MOV_L	(CONST(0xaaaaaaab), EAX)
 | 
			
		||||
		MUL_L	(CONTENT(_vl_current_bytes))
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EAX)
 | 
			
		||||
		MOV_L	(EDX, ECX)
 | 
			
		||||
		PUSH_L	(EBX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), EDX)
 | 
			
		||||
		SHR_L	(CONST(1), ECX)
 | 
			
		||||
		MOV_B	(REGOFF(10,ESP), BL)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		MOV_W	(AX, REGIND(EDX))
 | 
			
		||||
		MOV_B	(BL, REGOFF(2,EDX))
 | 
			
		||||
		ADD_L	(CONST(3), EDX)
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EBX)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_clear24_mmx (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -193,47 +199,47 @@ _v_clear24:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_clear24_mmx
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_clear24_mmx
 | 
			
		||||
_v_clear24_mmx:
 | 
			
		||||
#ifdef USE_MMX_ASM
 | 
			
		||||
		movl	4(%esp), %eax
 | 
			
		||||
		movl	%eax, %edx
 | 
			
		||||
		movl	%eax, %ecx
 | 
			
		||||
		shll	$16, %edx
 | 
			
		||||
		rorl	$8, %ecx
 | 
			
		||||
		movw	%cx, %dx
 | 
			
		||||
		rorl	$16, %ecx
 | 
			
		||||
		movb	%dh, %cl
 | 
			
		||||
		shll	$8, %eax
 | 
			
		||||
		movb	%ch, %al
 | 
			
		||||
		rorl	$8, %eax
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EAX)
 | 
			
		||||
		MOV_L	(EAX, EDX)
 | 
			
		||||
		MOV_L	(EAX, ECX)
 | 
			
		||||
		SHL_L	(CONST(16), EDX)
 | 
			
		||||
		ROR_L	(CONST(8), ECX)
 | 
			
		||||
		MOV_W	(CX, DX)
 | 
			
		||||
		ROR_L	(CONST(16), ECX)
 | 
			
		||||
		MOV_B	(DH, CL)
 | 
			
		||||
		SHL_L	(CONST(8), EAX)
 | 
			
		||||
		MOV_B	(CH, AL)
 | 
			
		||||
		ROR_L	(CONST(8), EAX)
 | 
			
		||||
 | 
			
		||||
		pushl	%edx
 | 
			
		||||
		pushl	%eax
 | 
			
		||||
		movq	(%esp), %mm0
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		movq	(%esp), %mm1
 | 
			
		||||
		pushl	%edx
 | 
			
		||||
		movq	(%esp), %mm2
 | 
			
		||||
		PUSH_L	(EDX)
 | 
			
		||||
		PUSH_L	(EAX)
 | 
			
		||||
		MOVQ	(REGIND(ESP), MM0)
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		MOVQ	(REGIND(ESP), MM1)
 | 
			
		||||
		PUSH_L	(EDX)
 | 
			
		||||
		MOVQ	(REGIND(ESP), MM2)
 | 
			
		||||
 | 
			
		||||
		movl	$0xaaaaaaab, %eax
 | 
			
		||||
		mull	_vl_current_bytes
 | 
			
		||||
		movl	%edx, %ecx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %edx
 | 
			
		||||
		shrl	$4, %ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		movq	%mm0, (%edx)
 | 
			
		||||
		movq	%mm1, 8(%edx)
 | 
			
		||||
		movq	%mm2, 16(%edx)
 | 
			
		||||
		addl	$24, %edx
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		emms
 | 
			
		||||
		addl	$16, %esp
 | 
			
		||||
		MOV_L	(CONST(0xaaaaaaab), EAX)
 | 
			
		||||
		MUL_L	(CONTENT(_vl_current_bytes))
 | 
			
		||||
		MOV_L	(EDX, ECX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), EDX)
 | 
			
		||||
		SHR_L	(CONST(4), ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		MOVQ	(MM0, REGIND(EDX))
 | 
			
		||||
		MOVQ	(MM1, REGOFF(8,EDX))
 | 
			
		||||
		MOVQ	(MM2, REGOFF(16,EDX))
 | 
			
		||||
		ADD_L	(CONST(24), EDX)
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		EMMS
 | 
			
		||||
		ADD_L	(CONST(16), ESP)
 | 
			
		||||
#endif
 | 
			
		||||
		ret
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_rect8 (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -242,51 +248,51 @@ _v_clear24_mmx:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_rect8
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_rect8
 | 
			
		||||
_v_rect8:
 | 
			
		||||
		cld
 | 
			
		||||
		pushl	%esi
 | 
			
		||||
		pushl	%edi
 | 
			
		||||
		movl	28(%esp), %eax
 | 
			
		||||
		movl	_vl_current_width, %esi
 | 
			
		||||
		movl	16(%esp), %edi
 | 
			
		||||
		movb	%al, %ah
 | 
			
		||||
		movl	20(%esp), %ecx
 | 
			
		||||
		imull	%esi, %edi
 | 
			
		||||
		movl	24(%esp), %edx
 | 
			
		||||
		subl	%ecx, %esi
 | 
			
		||||
		addl	12(%esp), %edi
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		pushl	%ds
 | 
			
		||||
		popl	%es
 | 
			
		||||
		addl	_vl_current_draw_buffer, %edi
 | 
			
		||||
		popl	%eax
 | 
			
		||||
		pushl	%ebx
 | 
			
		||||
		movl	%ecx, %ebx
 | 
			
		||||
		andl	$3, %ebx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	1:
 | 
			
		||||
		shrl	$2, %ecx
 | 
			
		||||
		rep;	stosl
 | 
			
		||||
		testl	%ebx, %ebx
 | 
			
		||||
		jz	2f
 | 
			
		||||
		movl	%ebx, %ecx
 | 
			
		||||
		rep;	stosb
 | 
			
		||||
		.balign	4
 | 
			
		||||
	2:
 | 
			
		||||
		popl	%ecx
 | 
			
		||||
		addl	%esi, %edi
 | 
			
		||||
		decl	%edx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%ebx
 | 
			
		||||
		popl	%edi
 | 
			
		||||
		popl	%esi
 | 
			
		||||
		ret
 | 
			
		||||
		CLD
 | 
			
		||||
		PUSH_L	(ESI)
 | 
			
		||||
		PUSH_L	(EDI)
 | 
			
		||||
		MOV_L	(REGOFF(28, ESP), EAX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_width), ESI)
 | 
			
		||||
		MOV_L	(REGOFF(16, ESP), EDI)
 | 
			
		||||
		MOV_B	(AL, AH)
 | 
			
		||||
		MOV_L	(REGOFF(20, ESP), ECX)
 | 
			
		||||
		IMUL_L	(ESI, EDI)
 | 
			
		||||
		MOV_L	(REGOFF(24, ESP), EDX)
 | 
			
		||||
		SUB_L	(ECX, ESI)
 | 
			
		||||
		ADD_L	(REGOFF(12, ESP), EDI)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		PUSH_SR	(DS)
 | 
			
		||||
		POP_SR	(ES)
 | 
			
		||||
		ADD_L	(CONTENT(_vl_current_draw_buffer), EDI)
 | 
			
		||||
		POP_L	(EAX)
 | 
			
		||||
		PUSH_L	(EBX)
 | 
			
		||||
		MOV_L	(ECX, EBX)
 | 
			
		||||
		AND_L	(CONST(3), EBX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(1):
 | 
			
		||||
		SHR_L	(CONST(2), ECX)
 | 
			
		||||
		REP	STOS_L
 | 
			
		||||
		TEST_L	(EBX, EBX)
 | 
			
		||||
		jz	TLBL(2)
 | 
			
		||||
		MOV_L	(EBX, ECX)
 | 
			
		||||
		REP	STOS_B
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(2):
 | 
			
		||||
		POP_L	(ECX)
 | 
			
		||||
		ADD_L	(ESI, EDI)
 | 
			
		||||
		DEC_L	(EDX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EBX)
 | 
			
		||||
		POP_L	(EDI)
 | 
			
		||||
		POP_L	(ESI)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_rect16 (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -295,46 +301,46 @@ _v_rect8:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_rect16
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_rect16
 | 
			
		||||
_v_rect16:
 | 
			
		||||
		cld
 | 
			
		||||
		pushl	%esi
 | 
			
		||||
		pushl	%edi
 | 
			
		||||
		movl	28(%esp), %eax
 | 
			
		||||
		movl	_vl_current_width, %esi
 | 
			
		||||
		movl	16(%esp), %edi
 | 
			
		||||
		movl	20(%esp), %ecx
 | 
			
		||||
		imull	%esi, %edi
 | 
			
		||||
		movl	24(%esp), %edx
 | 
			
		||||
		subl	%ecx, %esi
 | 
			
		||||
		addl	12(%esp), %edi
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		shll	%esi
 | 
			
		||||
		pushw	%ax
 | 
			
		||||
		shll	%edi
 | 
			
		||||
		pushl	%ds
 | 
			
		||||
		popl	%es
 | 
			
		||||
		addl	_vl_current_draw_buffer, %edi
 | 
			
		||||
		popl	%eax
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	1:
 | 
			
		||||
		shrl	%ecx
 | 
			
		||||
		rep;	stosl
 | 
			
		||||
		jnc	2f
 | 
			
		||||
		stosw
 | 
			
		||||
		.balign	4
 | 
			
		||||
	2:
 | 
			
		||||
		popl	%ecx
 | 
			
		||||
		addl	%esi, %edi
 | 
			
		||||
		decl	%edx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%edi
 | 
			
		||||
		popl	%esi
 | 
			
		||||
		ret
 | 
			
		||||
		CLD
 | 
			
		||||
		PUSH_L	(ESI)
 | 
			
		||||
		PUSH_L	(EDI)
 | 
			
		||||
		MOV_L	(REGOFF(28, ESP), EAX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_width), ESI)
 | 
			
		||||
		MOV_L	(REGOFF(16, ESP), EDI)
 | 
			
		||||
		MOV_L	(REGOFF(20, ESP), ECX)
 | 
			
		||||
		IMUL_L	(ESI, EDI)
 | 
			
		||||
		MOV_L	(REGOFF(24, ESP), EDX)
 | 
			
		||||
		SUB_L	(ECX, ESI)
 | 
			
		||||
		ADD_L	(REGOFF(12, ESP), EDI)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		SHL_L	(CONST(1), ESI)
 | 
			
		||||
		PUSH_W	(AX)
 | 
			
		||||
		SHL_L	(CONST(1), EDI)
 | 
			
		||||
		PUSH_SR	(DS)
 | 
			
		||||
		POP_SR	(ES)
 | 
			
		||||
		ADD_L	(CONTENT(_vl_current_draw_buffer), EDI)
 | 
			
		||||
		POP_L	(EAX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(1):
 | 
			
		||||
		SHR_L	(CONST(1), ECX)
 | 
			
		||||
		REP	STOS_L
 | 
			
		||||
		jnc	TLBL(2)
 | 
			
		||||
		STOS_W
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(2):
 | 
			
		||||
		POP_L	(ECX)
 | 
			
		||||
		ADD_L	(ESI, EDI)
 | 
			
		||||
		DEC_L	(EDX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EDI)
 | 
			
		||||
		POP_L	(ESI)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_rect24 (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -343,43 +349,43 @@ _v_rect16:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_rect24
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_rect24
 | 
			
		||||
_v_rect24:
 | 
			
		||||
		pushl	%esi
 | 
			
		||||
		pushl	%edi
 | 
			
		||||
		movl	28(%esp), %eax
 | 
			
		||||
		movl	_vl_current_width, %esi
 | 
			
		||||
		movl	16(%esp), %edi
 | 
			
		||||
		movl	20(%esp), %ecx
 | 
			
		||||
		imull	%esi, %edi
 | 
			
		||||
		movl	24(%esp), %edx
 | 
			
		||||
		subl	%ecx, %esi
 | 
			
		||||
		addl	12(%esp), %edi
 | 
			
		||||
		leal	(%esi, %esi, 2), %esi
 | 
			
		||||
		pushl	%ebx
 | 
			
		||||
		leal	(%edi, %edi, 2), %edi
 | 
			
		||||
		movl	%eax, %ebx
 | 
			
		||||
		addl	_vl_current_draw_buffer, %edi
 | 
			
		||||
		shrl	$16, %ebx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	1:
 | 
			
		||||
		movw	%ax, (%edi)
 | 
			
		||||
		movb	%bl, 2(%edi)
 | 
			
		||||
		addl	$3, %edi
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	1b
 | 
			
		||||
		popl	%ecx
 | 
			
		||||
		addl	%esi, %edi
 | 
			
		||||
		decl	%edx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%ebx
 | 
			
		||||
		popl	%edi
 | 
			
		||||
		popl	%esi
 | 
			
		||||
		ret
 | 
			
		||||
		PUSH_L	(ESI)
 | 
			
		||||
		PUSH_L	(EDI)
 | 
			
		||||
		MOV_L	(REGOFF(28, ESP), EAX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_width), ESI)
 | 
			
		||||
		MOV_L	(REGOFF(16, ESP), EDI)
 | 
			
		||||
		MOV_L	(REGOFF(20, ESP), ECX)
 | 
			
		||||
		IMUL_L	(ESI, EDI)
 | 
			
		||||
		MOV_L	(REGOFF(24, ESP), EDX)
 | 
			
		||||
		SUB_L	(ECX, ESI)
 | 
			
		||||
		ADD_L	(REGOFF(12, ESP), EDI)
 | 
			
		||||
		LEA_L	(REGBIS(ESI, ESI, 2), ESI)
 | 
			
		||||
		PUSH_L	(EBX)
 | 
			
		||||
		LEA_L	(REGBIS(EDI, EDI, 2), EDI)
 | 
			
		||||
		MOV_L	(EAX, EBX)
 | 
			
		||||
		ADD_L	(CONTENT(_vl_current_draw_buffer), EDI)
 | 
			
		||||
		SHR_L	(CONST(16), EBX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(1):
 | 
			
		||||
		MOV_W	(AX, REGIND(EDI))
 | 
			
		||||
		MOV_B	(BL, REGOFF(2,EDI))
 | 
			
		||||
		ADD_L	(CONST(3), EDI)
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(1)
 | 
			
		||||
		POP_L	(ECX)
 | 
			
		||||
		ADD_L	(ESI, EDI)
 | 
			
		||||
		DEC_L	(EDX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EBX)
 | 
			
		||||
		POP_L	(EDI)
 | 
			
		||||
		POP_L	(ESI)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_rect32 (int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -388,38 +394,38 @@ _v_rect24:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_rect32
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_rect32
 | 
			
		||||
_v_rect32:
 | 
			
		||||
		pushl	%esi
 | 
			
		||||
		pushl	%edi
 | 
			
		||||
		movl	_vl_current_width, %esi
 | 
			
		||||
		movl	16(%esp), %edi
 | 
			
		||||
		movl	20(%esp), %ecx
 | 
			
		||||
		imull	%esi, %edi
 | 
			
		||||
		movl	24(%esp), %edx
 | 
			
		||||
		subl	%ecx, %esi
 | 
			
		||||
		addl	12(%esp), %edi
 | 
			
		||||
		shll	$2, %esi
 | 
			
		||||
		shll	$2, %edi
 | 
			
		||||
		movl	28(%esp), %eax
 | 
			
		||||
		addl	_vl_current_draw_buffer, %edi
 | 
			
		||||
		.balign	4
 | 
			
		||||
	0:
 | 
			
		||||
		pushl	%ecx
 | 
			
		||||
		.balign	4
 | 
			
		||||
	1:
 | 
			
		||||
		movl	%eax, (%edi)
 | 
			
		||||
		addl	$4, %edi
 | 
			
		||||
		decl	%ecx
 | 
			
		||||
		jnz	1b
 | 
			
		||||
		popl	%ecx
 | 
			
		||||
		addl	%esi, %edi
 | 
			
		||||
		decl	%edx
 | 
			
		||||
		jnz	0b
 | 
			
		||||
		popl	%edi
 | 
			
		||||
		popl	%esi
 | 
			
		||||
		ret
 | 
			
		||||
		PUSH_L	(ESI)
 | 
			
		||||
		PUSH_L	(EDI)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_width), ESI)
 | 
			
		||||
		MOV_L	(REGOFF(16, ESP), EDI)
 | 
			
		||||
		MOV_L	(REGOFF(20, ESP), ECX)
 | 
			
		||||
		IMUL_L	(ESI, EDI)
 | 
			
		||||
		MOV_L	(REGOFF(24, ESP), EDX)
 | 
			
		||||
		SUB_L	(ECX, ESI)
 | 
			
		||||
		ADD_L	(REGOFF(12, ESP), EDI)
 | 
			
		||||
		SHL_L	(CONST(2), ESI)
 | 
			
		||||
		SHL_L	(CONST(2), EDI)
 | 
			
		||||
		MOV_L	(REGOFF(28, ESP), EAX)
 | 
			
		||||
		ADD_L	(CONTENT(_vl_current_draw_buffer), EDI)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(0):
 | 
			
		||||
		PUSH_L	(ECX)
 | 
			
		||||
		ALIGNTEXT4
 | 
			
		||||
	TLBL(1):
 | 
			
		||||
		MOV_L	(EAX, REGIND(EDI))
 | 
			
		||||
		ADD_L	(CONST(4), EDI)
 | 
			
		||||
		DEC_L	(ECX)
 | 
			
		||||
		jnz	TLBL(1)
 | 
			
		||||
		POP_L	(ECX)
 | 
			
		||||
		ADD_L	(ESI, EDI)
 | 
			
		||||
		DEC_L	(EDX)
 | 
			
		||||
		jnz	TLBL(0)
 | 
			
		||||
		POP_L	(EDI)
 | 
			
		||||
		POP_L	(ESI)
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_putpixel8 (unsigned int offset, int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -428,14 +434,14 @@ _v_rect32:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_putpixel8
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_putpixel8
 | 
			
		||||
_v_putpixel8:
 | 
			
		||||
		movl	8(%esp), %ecx
 | 
			
		||||
		movl	4(%esp), %edx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %eax
 | 
			
		||||
		movb	%cl, (%eax,%edx)
 | 
			
		||||
		ret
 | 
			
		||||
		MOV_L	(REGOFF(8, ESP), ECX)
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EDX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), EAX)
 | 
			
		||||
		MOV_B	(CL, REGBI(EAX,EDX))
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_putpixel16 (unsigned int offset, int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -444,14 +450,14 @@ _v_putpixel8:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_putpixel16
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_putpixel16
 | 
			
		||||
_v_putpixel16:
 | 
			
		||||
		movl	8(%esp), %ecx
 | 
			
		||||
		movl	4(%esp), %edx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %eax
 | 
			
		||||
		movw	%cx, (%eax,%edx,2)
 | 
			
		||||
		ret
 | 
			
		||||
		MOV_L	(REGOFF(8, ESP), ECX)
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EDX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), EAX)
 | 
			
		||||
		MOV_W	(CX, REGBIS(EAX,EDX,2))
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_putpixel24 (unsigned int offset, int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -460,17 +466,17 @@ _v_putpixel16:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_putpixel24
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_putpixel24
 | 
			
		||||
_v_putpixel24:
 | 
			
		||||
		movl	4(%esp), %eax
 | 
			
		||||
		movl	8(%esp), %edx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %ecx
 | 
			
		||||
		leal	(%eax,%eax,2), %eax
 | 
			
		||||
		movw	%dx, (%ecx,%eax)
 | 
			
		||||
		shrl	$16, %edx
 | 
			
		||||
		movb	%dl, 2(%ecx,%eax)
 | 
			
		||||
		ret
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EAX)
 | 
			
		||||
		MOV_L	(REGOFF(8, ESP), EDX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), ECX)
 | 
			
		||||
		LEA_L	(REGBIS(EAX,EAX,2), EAX)
 | 
			
		||||
		MOV_W	(DX, REGBI(ECX,EAX))
 | 
			
		||||
		SHR_L	(CONST(16), EDX)
 | 
			
		||||
		MOV_B	(DL, REGBID(ECX,EAX,2))
 | 
			
		||||
		RET
 | 
			
		||||
 | 
			
		||||
/* Desc: void v_putpixel32 (unsigned int offset, int color);
 | 
			
		||||
 *
 | 
			
		||||
@@ -479,11 +485,11 @@ _v_putpixel24:
 | 
			
		||||
 *
 | 
			
		||||
 * Note: uses current draw buffer
 | 
			
		||||
 */
 | 
			
		||||
		.p2align 5,,31
 | 
			
		||||
		.global	_v_putpixel32
 | 
			
		||||
		ALIGNTEXT32
 | 
			
		||||
		GLOBL	_v_putpixel32
 | 
			
		||||
_v_putpixel32:
 | 
			
		||||
		movl	8(%esp), %ecx
 | 
			
		||||
		movl	4(%esp), %edx
 | 
			
		||||
		movl	_vl_current_draw_buffer, %eax
 | 
			
		||||
		movl	%ecx, (%eax,%edx,4)
 | 
			
		||||
		ret
 | 
			
		||||
		MOV_L	(REGOFF(8, ESP), ECX)
 | 
			
		||||
		MOV_L	(REGOFF(4, ESP), EDX)
 | 
			
		||||
		MOV_L	(CONTENT(_vl_current_draw_buffer), EAX)
 | 
			
		||||
		MOV_L	(ECX, REGBIS(EAX,EDX,4))
 | 
			
		||||
		RET
 | 
			
		||||
 
 | 
			
		||||
@@ -1,142 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * GLX Hardware Device Driver common code 
 | 
			
		||||
 * 
 | 
			
		||||
 * Based on the original MGA G200 driver (c) 1999 Wittawat Yamwong
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS 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.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 *    Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
 | 
			
		||||
 */
 | 
			
		||||
/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.c,v 1.3 2001/08/18 02:51:03 dawes Exp $ */
 | 
			
		||||
 
 | 
			
		||||
#include "hwlog.h"
 | 
			
		||||
hwlog_t hwlog = { 0,0,0, "[???] "};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Should be shared, but is this a good place for it?
 | 
			
		||||
 */
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int usec( void ) 
 | 
			
		||||
{
 | 
			
		||||
   struct timeval tv;
 | 
			
		||||
   struct timezone tz;
 | 
			
		||||
   
 | 
			
		||||
   gettimeofday( &tv, &tz );
 | 
			
		||||
   
 | 
			
		||||
   return (tv.tv_sec & 2047) * 1000000 + tv.tv_usec;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef HW_LOG_ENABLED
 | 
			
		||||
int hwOpenLog(const char *filename, char *prefix)
 | 
			
		||||
{
 | 
			
		||||
  hwCloseLog();
 | 
			
		||||
  hwSetLogLevel(0);
 | 
			
		||||
  hwlog.prefix=prefix;
 | 
			
		||||
  if (!filename)
 | 
			
		||||
    return -1;
 | 
			
		||||
  if ((hwlog.file = fopen(filename,"w")) == NULL)
 | 
			
		||||
      return -1;
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void hwCloseLog()
 | 
			
		||||
{
 | 
			
		||||
  if (hwlog.file) {
 | 
			
		||||
    fclose(hwlog.file);
 | 
			
		||||
    hwlog.file = NULL;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int hwIsLogReady()
 | 
			
		||||
{
 | 
			
		||||
  return (hwlog.file != NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void hwSetLogLevel(int level)
 | 
			
		||||
{
 | 
			
		||||
  hwlog.level = level;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int hwGetLogLevel()
 | 
			
		||||
{
 | 
			
		||||
  return hwlog.level;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void hwLog(int level, const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
  va_list ap;
 | 
			
		||||
  va_start(ap,format);
 | 
			
		||||
  hwLogv(level,format,ap);
 | 
			
		||||
  va_end(ap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void hwLogv(int l, const char *format, va_list ap)
 | 
			
		||||
{
 | 
			
		||||
  if (hwlog.file && (l <= hwlog.level)) {
 | 
			
		||||
    vfprintf(hwlog.file,format,ap);
 | 
			
		||||
    fflush(hwlog.file);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void hwMsg(int l, const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
  va_list ap;
 | 
			
		||||
  va_start(ap, format);
 | 
			
		||||
 | 
			
		||||
  if (l <= hwlog.level) {
 | 
			
		||||
    if (hwIsLogReady()) {
 | 
			
		||||
      int t = usec();
 | 
			
		||||
 | 
			
		||||
      hwLog(l, "%6i:", t - hwlog.timeTemp);
 | 
			
		||||
      hwlog.timeTemp = t;
 | 
			
		||||
      hwLogv(l, format, ap);
 | 
			
		||||
    } else {
 | 
			
		||||
      fprintf(stderr, hwlog.prefix);
 | 
			
		||||
      vfprintf(stderr, format, ap);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  va_end(ap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#else /* ifdef HW_LOG_ENABLED */
 | 
			
		||||
 | 
			
		||||
int hwlogdummy()
 | 
			
		||||
{
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void hwError(const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
  va_list ap;
 | 
			
		||||
  va_start(ap, format);
 | 
			
		||||
 | 
			
		||||
  fprintf(stderr, hwlog.prefix);
 | 
			
		||||
  vfprintf(stderr, format, ap);
 | 
			
		||||
  hwLogv(0, format, ap);
 | 
			
		||||
 | 
			
		||||
  va_end(ap);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,101 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * GLX Hardware Device Driver common code
 | 
			
		||||
 *
 | 
			
		||||
 * Based on the original MGA G200 driver (c) 1999 Wittawat Yamwong
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS 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.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 *    Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de>
 | 
			
		||||
 */
 | 
			
		||||
/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.h,v 1.5 2001/10/31 23:22:57 tsi Exp $ */
 | 
			
		||||
 
 | 
			
		||||
/* Usage:
 | 
			
		||||
 * - use mgaError for error messages. Always write to X error and log file.
 | 
			
		||||
 * - use mgaMsg for debugging. Can be disabled by undefining MGA_LOG_ENABLED.
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
#ifndef HWLOG_INC
 | 
			
		||||
#define HWLOG_INC
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#define DBG_LEVEL_BASE          1
 | 
			
		||||
#define DBG_LEVEL_VERBOSE       10
 | 
			
		||||
#define DBG_LEVEL_ENTEREXIT     20
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  FILE *file;
 | 
			
		||||
  int   level;
 | 
			
		||||
  unsigned int timeTemp;
 | 
			
		||||
  char *prefix;
 | 
			
		||||
} hwlog_t;
 | 
			
		||||
 | 
			
		||||
extern hwlog_t hwlog;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef HW_LOG_ENABLED
 | 
			
		||||
 | 
			
		||||
/* open and close log file. */
 | 
			
		||||
int  hwOpenLog(const char *filename, char *prefix);
 | 
			
		||||
void hwCloseLog(void);
 | 
			
		||||
 | 
			
		||||
/* return 1 if log file is succesfully opened */
 | 
			
		||||
int  hwIsLogReady(void);
 | 
			
		||||
 | 
			
		||||
/* set current log level to 'level'. Messages with level less than or equal
 | 
			
		||||
   the current log level will be written to the log file. */
 | 
			
		||||
void hwSetLogLevel(int level);
 | 
			
		||||
int  hwGetLogLevel(void);
 | 
			
		||||
 | 
			
		||||
/* hwLog and hwLogv write a message to the log file.	*/
 | 
			
		||||
/* do not call these directly, use hwMsg() instead	*/
 | 
			
		||||
void hwLog(int level, const char *format, ...);
 | 
			
		||||
void hwLogv(int level, const char *format, va_list ap);
 | 
			
		||||
 | 
			
		||||
int usec( void );
 | 
			
		||||
 | 
			
		||||
/* hwMsg writes a message to the log file or to the standard X error file. */
 | 
			
		||||
void hwMsg(int level, const char *format, ...);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static __inline__ int hwOpenLog(const char *f, char *prefix) { hwlog.prefix=prefix; return -1; }
 | 
			
		||||
#define hwIsLogReady() (0)
 | 
			
		||||
#define hwGetLogLevel() (-1)
 | 
			
		||||
#define hwLogLevel(n) (0)
 | 
			
		||||
#define hwLog()
 | 
			
		||||
#define hwMsg()
 | 
			
		||||
 | 
			
		||||
#define hwCloseLog()
 | 
			
		||||
#define hwSetLogLevel(x)
 | 
			
		||||
#define hwLogv(l,f,a)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void hwError(const char *format, ...);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -27,14 +27,13 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include "mm.h"
 | 
			
		||||
#include "hwlog.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void mmDumpMemInfo( memHeap_t *heap )
 | 
			
		||||
{
 | 
			
		||||
   TMemBlock *p;
 | 
			
		||||
 | 
			
		||||
   fprintf(stderr, "Memory heap %p:\n", heap);
 | 
			
		||||
   fprintf(stderr, "Memory heap %p:\n", (void *)heap);
 | 
			
		||||
   if (heap == 0) {
 | 
			
		||||
      fprintf(stderr, "  heap == 0\n");
 | 
			
		||||
   } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright 2000-2001 VA Linux Systems, Inc.
 | 
			
		||||
 * (c) Copyright IBM Corporation 2002
 | 
			
		||||
 * (C) Copyright IBM Corporation 2002, 2003
 | 
			
		||||
 * All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a
 | 
			
		||||
@@ -46,6 +46,7 @@
 | 
			
		||||
#include "texmem.h"
 | 
			
		||||
#include "simple_list.h"
 | 
			
		||||
#include "imports.h"
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 | 
			
		||||
@@ -156,22 +157,22 @@ static void printLocalLRU( driTexHeap * heap, const char *callername  )
 | 
			
		||||
	 continue;
 | 
			
		||||
      if (!t->tObj) {
 | 
			
		||||
	 fprintf( stderr, "Placeholder (%p) %d at 0x%x sz 0x%x\n",
 | 
			
		||||
		  t,
 | 
			
		||||
		  (void *)t,
 | 
			
		||||
		  t->memBlock->ofs / sz,
 | 
			
		||||
		  t->memBlock->ofs,
 | 
			
		||||
		  t->memBlock->size );
 | 
			
		||||
      } else {
 | 
			
		||||
	 fprintf( stderr, "Texture (%p) at 0x%x sz 0x%x\n",
 | 
			
		||||
		  t,
 | 
			
		||||
		  (void *)t,
 | 
			
		||||
		  t->memBlock->ofs,
 | 
			
		||||
		  t->memBlock->size );
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
   foreach ( t, heap->swapped_objects ) {
 | 
			
		||||
      if (!t->tObj) {
 | 
			
		||||
	 fprintf( stderr, "Swapped Placeholder (%p)\n", t );
 | 
			
		||||
	 fprintf( stderr, "Swapped Placeholder (%p)\n", (void *)t );
 | 
			
		||||
      } else {
 | 
			
		||||
	 fprintf( stderr, "Swapped Texture (%p)\n", t );
 | 
			
		||||
	 fprintf( stderr, "Swapped Texture (%p)\n", (void *)t );
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -190,7 +191,7 @@ static void printGlobalLRU( driTexHeap * heap, const char *callername )
 | 
			
		||||
   int i, j;
 | 
			
		||||
 | 
			
		||||
   fprintf( stderr, "%s in %s:\nGlobal LRU, heap %d list %p:\n", 
 | 
			
		||||
	    __FUNCTION__, callername, heap->heapId, list );
 | 
			
		||||
	    __FUNCTION__, callername, heap->heapId, (void *)list );
 | 
			
		||||
 | 
			
		||||
   for ( i = 0, j = heap->nrRegions ; i < heap->nrRegions ; i++ ) {
 | 
			
		||||
      fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n",
 | 
			
		||||
@@ -323,9 +324,9 @@ void driDestroyTextureObject( driTextureObject * t )
 | 
			
		||||
   if ( 0 ) {
 | 
			
		||||
      fprintf( stderr, "[%s:%d] freeing %p (tObj = %p, DriverData = %p)\n",
 | 
			
		||||
	       __FILE__, __LINE__,
 | 
			
		||||
	       t,
 | 
			
		||||
	       (t != NULL) ? t->tObj : NULL,
 | 
			
		||||
	       (t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL );
 | 
			
		||||
	       (void *)t,
 | 
			
		||||
	       (void *)((t != NULL) ? t->tObj : NULL),
 | 
			
		||||
	       (void *)((t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL ));
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if ( t != NULL ) {
 | 
			
		||||
@@ -355,7 +356,7 @@ void driDestroyTextureObject( driTextureObject * t )
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if ( 0 ) {
 | 
			
		||||
      fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, t );
 | 
			
		||||
      fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, (void *)t );
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -645,7 +646,7 @@ driCreateTextureHeap( unsigned heap_id, void * context, unsigned size,
 | 
			
		||||
   if ( 0 )
 | 
			
		||||
       fprintf( stderr, "%s( %u, %p, %u, %u, %u )\n",
 | 
			
		||||
		__FUNCTION__,
 | 
			
		||||
		heap_id, context, size, alignmentShift, nr_regions );
 | 
			
		||||
		heap_id, (void *)context, size, alignmentShift, nr_regions );
 | 
			
		||||
 | 
			
		||||
   heap = (driTexHeap *) CALLOC( sizeof( driTexHeap ) );
 | 
			
		||||
   if ( heap != NULL ) {
 | 
			
		||||
@@ -688,7 +689,7 @@ driCreateTextureHeap( unsigned heap_id, void * context, unsigned size,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   if ( 0 )
 | 
			
		||||
       fprintf( stderr, "%s returning %p\n", __FUNCTION__, heap );
 | 
			
		||||
       fprintf( stderr, "%s returning %p\n", __FUNCTION__, (void *)heap );
 | 
			
		||||
 | 
			
		||||
   return heap;
 | 
			
		||||
}
 | 
			
		||||
@@ -894,7 +895,7 @@ get_max_size( unsigned nr_heaps,
 | 
			
		||||
/**
 | 
			
		||||
 * Given the amount of texture memory, the number of texture units, and the
 | 
			
		||||
 * maximum size of a texel, calculate the maximum texture size the driver can
 | 
			
		||||
 * adverteise.
 | 
			
		||||
 * advertise.
 | 
			
		||||
 * 
 | 
			
		||||
 * \param heaps Texture heaps for this card
 | 
			
		||||
 * \param nr_heap Number of texture heaps
 | 
			
		||||
@@ -1097,7 +1098,7 @@ driValidateTextureHeaps( driTexHeap * const * texture_heaps,
 | 
			
		||||
	 if ( !check_in_heap( t, heap ) ) {
 | 
			
		||||
	    fprintf( stderr, "%s memory block for texture object @ %p not "
 | 
			
		||||
		     "found in heap #%d\n",
 | 
			
		||||
		     __FUNCTION__, t, i );
 | 
			
		||||
		     __FUNCTION__, (void *)t, i );
 | 
			
		||||
	    return GL_FALSE;
 | 
			
		||||
	 }
 | 
			
		||||
 | 
			
		||||
@@ -1105,7 +1106,7 @@ driValidateTextureHeaps( driTexHeap * const * texture_heaps,
 | 
			
		||||
	 if ( t->totalSize > t->memBlock->size ) {
 | 
			
		||||
	    fprintf( stderr, "%s: Memory block for texture object @ %p is "
 | 
			
		||||
		     "only %u bytes, but %u are required\n",
 | 
			
		||||
		     __FUNCTION__, t, t->totalSize, t->memBlock->size );
 | 
			
		||||
		     __FUNCTION__, (void *)t, t->totalSize, t->memBlock->size );
 | 
			
		||||
	    return GL_FALSE;
 | 
			
		||||
	 }
 | 
			
		||||
 | 
			
		||||
@@ -1159,15 +1160,76 @@ driValidateTextureHeaps( driTexHeap * const * texture_heaps,
 | 
			
		||||
   foreach ( t, swapped ) {
 | 
			
		||||
      if ( t->memBlock != NULL ) {
 | 
			
		||||
	 fprintf( stderr, "%s: Swapped texobj %p has non-NULL memblock %p\n",
 | 
			
		||||
		  __FUNCTION__, t, t->memBlock );
 | 
			
		||||
		  __FUNCTION__, (void *)t, (void *)t->memBlock );
 | 
			
		||||
	 return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      i++;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
   fprintf( stderr, "%s: swapped texture count = %u\n", i );
 | 
			
		||||
   fprintf( stderr, "%s: swapped texture count = %u\n", __FUNCTION__, i );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
   return GL_TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
/**
 | 
			
		||||
 * Compute which mipmap levels that really need to be sent to the hardware.
 | 
			
		||||
 * This depends on the base image size, GL_TEXTURE_MIN_LOD,
 | 
			
		||||
 * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
driCalculateTextureFirstLastLevel( driTextureObject * t )
 | 
			
		||||
{
 | 
			
		||||
   struct gl_texture_object * const tObj = t->tObj;
 | 
			
		||||
   const struct gl_texture_image * const baseImage =
 | 
			
		||||
       tObj->Image[tObj->BaseLevel];
 | 
			
		||||
 | 
			
		||||
   /* These must be signed values.  MinLod and MaxLod can be negative numbers,
 | 
			
		||||
    * and having firstLevel and lastLevel as signed prevents the need for
 | 
			
		||||
    * extra sign checks.
 | 
			
		||||
    */
 | 
			
		||||
   int   firstLevel;
 | 
			
		||||
   int   lastLevel;
 | 
			
		||||
 | 
			
		||||
   /* Yes, this looks overly complicated, but it's all needed.
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
   switch (tObj->Target) {
 | 
			
		||||
   case GL_TEXTURE_1D:
 | 
			
		||||
   case GL_TEXTURE_2D:
 | 
			
		||||
   case GL_TEXTURE_3D:
 | 
			
		||||
   case GL_TEXTURE_CUBE_MAP:
 | 
			
		||||
      if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
 | 
			
		||||
         /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
 | 
			
		||||
          */
 | 
			
		||||
 | 
			
		||||
         firstLevel = lastLevel = tObj->BaseLevel;
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
	 firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
 | 
			
		||||
	 firstLevel = MAX2(firstLevel, tObj->BaseLevel);
 | 
			
		||||
	 lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
 | 
			
		||||
	 lastLevel = MAX2(lastLevel, t->tObj->BaseLevel);
 | 
			
		||||
	 lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2);
 | 
			
		||||
	 lastLevel = MIN2(lastLevel, t->tObj->MaxLevel);
 | 
			
		||||
	 lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_TEXTURE_RECTANGLE_NV:
 | 
			
		||||
   case GL_TEXTURE_4D_SGIS:
 | 
			
		||||
      firstLevel = lastLevel = 0;
 | 
			
		||||
      break;
 | 
			
		||||
   default:
 | 
			
		||||
      return;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   /* save these values */
 | 
			
		||||
   t->firstLevel = firstLevel;
 | 
			
		||||
   t->lastLevel = lastLevel;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -290,4 +290,6 @@ void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
 | 
			
		||||
GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps,
 | 
			
		||||
    unsigned nr_heaps, const driTextureObject * swapped );
 | 
			
		||||
 | 
			
		||||
extern void driCalculateTextureFirstLastLevel( driTextureObject * t );
 | 
			
		||||
 | 
			
		||||
#endif /* DRI_TEXMEM_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
#include "dd.h"
 | 
			
		||||
#include "vblank.h"
 | 
			
		||||
#include "xmlpool.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
@@ -127,7 +128,7 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
 | 
			
		||||
	 if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) {
 | 
			
		||||
	    /* FIXME: This doesn't seem like the right thing to return here.
 | 
			
		||||
	     */
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
#ifndef _SOLO	     
 | 
			
		||||
	    return GLX_BAD_CONTEXT;
 | 
			
		||||
#else
 | 
			
		||||
	    return -1;
 | 
			
		||||
@@ -163,9 +164,9 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
 | 
			
		||||
	 /* FIXME: This doesn't seem like the right thing to return here.
 | 
			
		||||
	  */
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
	    return GLX_BAD_CONTEXT;
 | 
			
		||||
	 return GLX_BAD_CONTEXT;
 | 
			
		||||
#else
 | 
			
		||||
	    return -1;
 | 
			
		||||
	 return -1;
 | 
			
		||||
#endif
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
@@ -183,25 +184,56 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
/**
 | 
			
		||||
 * Gets a set of default vertical-blank-wait flags based on the internal GLX
 | 
			
		||||
 * API version and several environment variables.
 | 
			
		||||
 * API version and several configuration options.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
GLuint driGetDefaultVBlankFlags( void )
 | 
			
		||||
GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache )
 | 
			
		||||
{
 | 
			
		||||
   GLuint  flags = 0;
 | 
			
		||||
 | 
			
		||||
   int vblank_mode;
 | 
			
		||||
 | 
			
		||||
   flags |= (driCompareGLXAPIVersion( 20030317 ) >= 0) 
 | 
			
		||||
       ? VBLANK_FLAG_INTERVAL : 0;
 | 
			
		||||
   flags |= (getenv("LIBGL_SYNC_REFRESH") != NULL)
 | 
			
		||||
       ? VBLANK_FLAG_SYNC : 0;
 | 
			
		||||
   flags |= (getenv("LIBGL_THROTTLE_REFRESH") != NULL)
 | 
			
		||||
       ? VBLANK_FLAG_THROTTLE : 0;
 | 
			
		||||
 | 
			
		||||
   if ( driCheckOption( optionCache, "vblank_mode", DRI_ENUM ) )
 | 
			
		||||
      vblank_mode = driQueryOptioni( optionCache, "vblank_mode" );
 | 
			
		||||
   else
 | 
			
		||||
      vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;
 | 
			
		||||
 | 
			
		||||
   switch (vblank_mode) {
 | 
			
		||||
   case DRI_CONF_VBLANK_NEVER:
 | 
			
		||||
      flags = 0;
 | 
			
		||||
      break;
 | 
			
		||||
   case DRI_CONF_VBLANK_DEF_INTERVAL_0:
 | 
			
		||||
      break;
 | 
			
		||||
   case DRI_CONF_VBLANK_DEF_INTERVAL_1:
 | 
			
		||||
      flags |= VBLANK_FLAG_THROTTLE;
 | 
			
		||||
      break;
 | 
			
		||||
   case DRI_CONF_VBLANK_ALWAYS_SYNC:
 | 
			
		||||
      flags |= VBLANK_FLAG_SYNC;
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   return flags;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
/**
 | 
			
		||||
 * Sets the default swap interval when the drawable is first bound to a
 | 
			
		||||
 * direct rendering context.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags )
 | 
			
		||||
{
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
   if ( priv->pdraw->swap_interval == (unsigned)-1 ) {
 | 
			
		||||
      priv->pdraw->swap_interval = (flags & VBLANK_FLAG_THROTTLE) != 0 ? 1 : 0;
 | 
			
		||||
   }
 | 
			
		||||
#endif   
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
/**
 | 
			
		||||
 * Wrapper to call \c drmWaitVBlank.  The main purpose of this function is to
 | 
			
		||||
@@ -265,7 +297,10 @@ driWaitForVBlank( const  __DRIdrawablePrivate *priv, GLuint * vbl_seq,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   *missed_deadline = GL_FALSE;
 | 
			
		||||
   if ( (flags & VBLANK_FLAG_NO_IRQ) != 0 ) {
 | 
			
		||||
   if ( (flags & (VBLANK_FLAG_INTERVAL |
 | 
			
		||||
		  VBLANK_FLAG_THROTTLE |
 | 
			
		||||
		  VBLANK_FLAG_SYNC)) == 0 ||
 | 
			
		||||
	(flags & VBLANK_FLAG_NO_IRQ) != 0 ) {
 | 
			
		||||
      return 0;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -293,11 +328,14 @@ driWaitForVBlank( const  __DRIdrawablePrivate *priv, GLuint * vbl_seq,
 | 
			
		||||
   vbl.request.type = DRM_VBLANK_ABSOLUTE;
 | 
			
		||||
 | 
			
		||||
   if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) {
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
#ifndef _SOLO   
 | 
			
		||||
      interval = priv->pdraw->swap_interval;
 | 
			
		||||
#else
 | 
			
		||||
      interval = 0;
 | 
			
		||||
#endif
 | 
			
		||||
#endif      
 | 
			
		||||
      /* this must have been initialized when the drawable was first bound
 | 
			
		||||
       * to a direct rendering context. */
 | 
			
		||||
      assert ( interval != (unsigned)-1 );
 | 
			
		||||
   }
 | 
			
		||||
   else if ( (flags & VBLANK_FLAG_THROTTLE) != 0 ) {
 | 
			
		||||
      interval = 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,7 @@
 | 
			
		||||
 | 
			
		||||
#include "context.h"
 | 
			
		||||
#include "dri_util.h"
 | 
			
		||||
#include "xmlconfig.h"
 | 
			
		||||
 | 
			
		||||
#define VBLANK_FLAG_INTERVAL  (1U << 0)  /* Respect the swap_interval setting
 | 
			
		||||
					  */
 | 
			
		||||
@@ -45,7 +46,8 @@
 | 
			
		||||
extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
 | 
			
		||||
extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
 | 
			
		||||
    int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
 | 
			
		||||
extern GLuint driGetDefaultVBlankFlags( void );
 | 
			
		||||
extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
 | 
			
		||||
extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags );
 | 
			
		||||
extern int driWaitForVBlank( const __DRIdrawablePrivate *priv,
 | 
			
		||||
    GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										862
									
								
								src/mesa/drivers/dri/common/xmlconfig.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										862
									
								
								src/mesa/drivers/dri/common/xmlconfig.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,862 @@
 | 
			
		||||
/*
 | 
			
		||||
 * XML DRI client-side driver configuration
 | 
			
		||||
 * Copyright (C) 2003 Felix Kuehling
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS 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.
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * \file xmlconfig.c
 | 
			
		||||
 * \brief Driver-independent client-side part of the XML configuration
 | 
			
		||||
 * \author Felix Kuehling
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <expat.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include "imports.h"
 | 
			
		||||
#include "dri_util.h"
 | 
			
		||||
#include "xmlconfig.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * OS dependent ways of getting the name of the running program
 | 
			
		||||
 */
 | 
			
		||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#undef GET_PROGRAM_NAME
 | 
			
		||||
 | 
			
		||||
#if defined(__GNU_LIBRARY__) || defined(__GLIBC__)
 | 
			
		||||
#    define GET_PROGRAM_NAME() program_invocation_short_name
 | 
			
		||||
#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
 | 
			
		||||
#    include <osreldate.h>
 | 
			
		||||
#    if (__FreeBSD_version >= 440000)
 | 
			
		||||
#        include <stdlib.h>
 | 
			
		||||
#        define GET_PROGRAM_NAME() getprogname()
 | 
			
		||||
#    endif
 | 
			
		||||
#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100)
 | 
			
		||||
#    include <stdlib.h>
 | 
			
		||||
#    define GET_PROGRAM_NAME() getprogname()
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(GET_PROGRAM_NAME)
 | 
			
		||||
#    if defined(OpenBSD) || defined(NetBSD)
 | 
			
		||||
/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. It's
 | 
			
		||||
 * used as a last resort, if there is no documented facility available. */
 | 
			
		||||
static const char *__getProgramName () {
 | 
			
		||||
    extern const char *__progname;
 | 
			
		||||
    return progname;
 | 
			
		||||
}
 | 
			
		||||
#        define GET_PROGRAM_NAME() __getProgramName()
 | 
			
		||||
#    else
 | 
			
		||||
#        define GET_PROGRAM_NAME() ""
 | 
			
		||||
#        warning "Per application configuration won't with your OS version work."
 | 
			
		||||
#    endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/** \brief Find an option in an option cache with the name as key */
 | 
			
		||||
static GLuint findOption (const driOptionCache *cache, const char *name) {
 | 
			
		||||
    GLuint len = strlen (name);
 | 
			
		||||
    GLuint size = 1 << cache->tableSize, mask = size - 1;
 | 
			
		||||
    GLuint hash = 0;
 | 
			
		||||
    GLuint i, shift;
 | 
			
		||||
 | 
			
		||||
  /* compute a hash from the variable length name */
 | 
			
		||||
    for (i = 0, shift = 0; i < len; ++i, shift = (shift+8) & 31)
 | 
			
		||||
	hash += (GLuint)name[i] << shift;
 | 
			
		||||
    hash *= hash;
 | 
			
		||||
    hash = (hash >> (16-cache->tableSize/2)) & mask;
 | 
			
		||||
 | 
			
		||||
  /* this is just the starting point of the linear search for the option */
 | 
			
		||||
    for (i = 0; i < size; ++i, hash = (hash+1) & mask) {
 | 
			
		||||
      /* if we hit an empty entry then the option is not defined (yet) */
 | 
			
		||||
	if (cache->info[hash].name == 0)
 | 
			
		||||
	    break;
 | 
			
		||||
	else if (!strcmp (name, cache->info[hash].name))
 | 
			
		||||
	    break;
 | 
			
		||||
    }
 | 
			
		||||
  /* this assertion fails if the hash table is full */
 | 
			
		||||
    assert (i < size);
 | 
			
		||||
 | 
			
		||||
    return hash;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Count the real number of options in an option cache */
 | 
			
		||||
static GLuint countOptions (const driOptionCache *cache) {
 | 
			
		||||
    GLuint size = 1 << cache->tableSize;
 | 
			
		||||
    GLuint i, count = 0;
 | 
			
		||||
    for (i = 0; i < size; ++i)
 | 
			
		||||
	if (cache->info[i].name)
 | 
			
		||||
	    count++;
 | 
			
		||||
    return count;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Like strdup but using MALLOC and with error checking. */
 | 
			
		||||
#define XSTRDUP(dest,source) do { \
 | 
			
		||||
    GLuint len = strlen (source); \
 | 
			
		||||
    if (!(dest = MALLOC (len+1))) { \
 | 
			
		||||
	fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \
 | 
			
		||||
	abort(); \
 | 
			
		||||
    } \
 | 
			
		||||
    memcpy (dest, source, len+1); \
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
static int compare (const void *a, const void *b) {
 | 
			
		||||
    return strcmp (*(char *const*)a, *(char *const*)b);
 | 
			
		||||
}
 | 
			
		||||
/** \brief Binary search in a string array. */
 | 
			
		||||
static GLuint bsearchStr (const XML_Char *name,
 | 
			
		||||
			  const XML_Char *elems[], GLuint count) {
 | 
			
		||||
    const XML_Char **found;
 | 
			
		||||
    found = bsearch (&name, elems, count, sizeof (XML_Char *), compare);
 | 
			
		||||
    if (found)
 | 
			
		||||
	return found - elems;
 | 
			
		||||
    else
 | 
			
		||||
	return count;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parse a value of a given type. */
 | 
			
		||||
static GLboolean parseValue (driOptionValue *v, driOptionType type,
 | 
			
		||||
			     const XML_Char *string) {
 | 
			
		||||
    const XML_Char *tail;
 | 
			
		||||
  /* skip leading white-space */
 | 
			
		||||
    string += strspn (string, " \f\n\r\t\v");
 | 
			
		||||
    switch (type) {
 | 
			
		||||
      case DRI_BOOL:
 | 
			
		||||
	if (!strcmp (string, "false")) {
 | 
			
		||||
	    v->_bool = GL_FALSE;
 | 
			
		||||
	    tail = string + 5;
 | 
			
		||||
	} else if (!strcmp (string, "true")) {
 | 
			
		||||
	    v->_bool = GL_TRUE;
 | 
			
		||||
	    tail = string + 4;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	    return GL_FALSE;
 | 
			
		||||
	break;
 | 
			
		||||
      case DRI_ENUM: /* enum is just a special integer */
 | 
			
		||||
      case DRI_INT:
 | 
			
		||||
	v->_int = strtol (string, (char **)&tail, 0);
 | 
			
		||||
	break;
 | 
			
		||||
      case DRI_FLOAT:
 | 
			
		||||
	v->_float = strtod (string, (char **)&tail);
 | 
			
		||||
	break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (tail == string)
 | 
			
		||||
	return GL_FALSE; /* empty string (or containing only white-space) */
 | 
			
		||||
  /* skip trailing white space */
 | 
			
		||||
    if (*tail)
 | 
			
		||||
	tail += strspn (tail, " \f\n\r\t\v");
 | 
			
		||||
    if (*tail)
 | 
			
		||||
	return GL_FALSE; /* something left over that is not part of value */
 | 
			
		||||
 | 
			
		||||
    return GL_TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parse a list of ranges of type info->type. */
 | 
			
		||||
static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) {
 | 
			
		||||
    XML_Char *cp, *range;
 | 
			
		||||
    GLuint nRanges, i;
 | 
			
		||||
    driOptionRange *ranges;
 | 
			
		||||
 | 
			
		||||
    XSTRDUP (cp, string);
 | 
			
		||||
  /* pass 1: determine the number of ranges (number of commas + 1) */
 | 
			
		||||
    range = cp;
 | 
			
		||||
    for (nRanges = 1; *range; ++range)
 | 
			
		||||
	if (*range == ',')
 | 
			
		||||
	    ++nRanges;
 | 
			
		||||
 | 
			
		||||
    if ((ranges = MALLOC (nRanges*sizeof(driOptionRange))) == NULL) {
 | 
			
		||||
	fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
 | 
			
		||||
	abort();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* pass 2: parse all ranges into preallocated array */
 | 
			
		||||
    range = cp;
 | 
			
		||||
    for (i = 0; i < nRanges; ++i) {
 | 
			
		||||
	XML_Char *end, *sep;
 | 
			
		||||
	assert (range);
 | 
			
		||||
	end = strchr (range, ',');
 | 
			
		||||
	if (end)
 | 
			
		||||
	    *end = '\0';
 | 
			
		||||
	sep = strchr (range, ':');
 | 
			
		||||
	if (sep) { /* non-empty interval */
 | 
			
		||||
	    *sep = '\0';
 | 
			
		||||
	    if (!parseValue (&ranges[i].start, info->type, range) ||
 | 
			
		||||
		!parseValue (&ranges[i].end, info->type, sep+1))
 | 
			
		||||
	        break;
 | 
			
		||||
	    if (info->type == DRI_INT &&
 | 
			
		||||
		ranges[i].start._int > ranges[i].end._int)
 | 
			
		||||
		break;
 | 
			
		||||
	    if (info->type == DRI_FLOAT &&
 | 
			
		||||
		ranges[i].start._float > ranges[i].end._float)
 | 
			
		||||
		break;
 | 
			
		||||
	} else { /* empty interval */
 | 
			
		||||
	    if (!parseValue (&ranges[i].start, info->type, range))
 | 
			
		||||
		break;
 | 
			
		||||
	    ranges[i].end = ranges[i].start;
 | 
			
		||||
	}
 | 
			
		||||
	if (end)
 | 
			
		||||
	    range = end+1;
 | 
			
		||||
	else
 | 
			
		||||
	    range = NULL;
 | 
			
		||||
    }
 | 
			
		||||
    FREE (cp);
 | 
			
		||||
    if (i < nRanges) {
 | 
			
		||||
	FREE (ranges);
 | 
			
		||||
	return GL_FALSE;
 | 
			
		||||
    } else
 | 
			
		||||
	assert (range == NULL);
 | 
			
		||||
 | 
			
		||||
    info->nRanges = nRanges;
 | 
			
		||||
    info->ranges = ranges;
 | 
			
		||||
    return GL_TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Check if a value is in one of info->ranges. */
 | 
			
		||||
static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) {
 | 
			
		||||
    GLuint i;
 | 
			
		||||
    assert (info->type != DRI_BOOL); /* should be caught by the parser */
 | 
			
		||||
    if (info->nRanges == 0)
 | 
			
		||||
	return GL_TRUE;
 | 
			
		||||
    switch (info->type) {
 | 
			
		||||
      case DRI_ENUM: /* enum is just a special integer */
 | 
			
		||||
      case DRI_INT:
 | 
			
		||||
	for (i = 0; i < info->nRanges; ++i)
 | 
			
		||||
	    if (v->_int >= info->ranges[i].start._int &&
 | 
			
		||||
		v->_int <= info->ranges[i].end._int)
 | 
			
		||||
		return GL_TRUE;
 | 
			
		||||
	break;
 | 
			
		||||
      case DRI_FLOAT:
 | 
			
		||||
	for (i = 0; i < info->nRanges; ++i)
 | 
			
		||||
	    if (v->_float >= info->ranges[i].start._float &&
 | 
			
		||||
		v->_float <= info->ranges[i].end._float)
 | 
			
		||||
		return GL_TRUE;
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
	assert (0); /* should never happen */
 | 
			
		||||
    }
 | 
			
		||||
    return GL_FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Output a warning message. */
 | 
			
		||||
#define XML_WARNING1(msg) do {\
 | 
			
		||||
    __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \
 | 
			
		||||
                      XML_GetCurrentLineNumber(data->parser), \
 | 
			
		||||
                      XML_GetCurrentColumnNumber(data->parser)); \
 | 
			
		||||
} while (0)
 | 
			
		||||
#define XML_WARNING(msg,args...) do { \
 | 
			
		||||
    __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \
 | 
			
		||||
                      XML_GetCurrentLineNumber(data->parser), \
 | 
			
		||||
                      XML_GetCurrentColumnNumber(data->parser), \
 | 
			
		||||
                      args); \
 | 
			
		||||
} while (0)
 | 
			
		||||
/** \brief Output an error message. */
 | 
			
		||||
#define XML_ERROR1(msg) do { \
 | 
			
		||||
    __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \
 | 
			
		||||
                      XML_GetCurrentLineNumber(data->parser), \
 | 
			
		||||
                      XML_GetCurrentColumnNumber(data->parser)); \
 | 
			
		||||
} while (0)
 | 
			
		||||
#define XML_ERROR(msg,args...) do { \
 | 
			
		||||
    __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \
 | 
			
		||||
                      XML_GetCurrentLineNumber(data->parser), \
 | 
			
		||||
                      XML_GetCurrentColumnNumber(data->parser), \
 | 
			
		||||
                      args); \
 | 
			
		||||
} while (0)
 | 
			
		||||
/** \brief Output a fatal error message and abort. */
 | 
			
		||||
#define XML_FATAL1(msg) do { \
 | 
			
		||||
    fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \
 | 
			
		||||
             data->name, \
 | 
			
		||||
             XML_GetCurrentLineNumber(data->parser), \
 | 
			
		||||
             XML_GetCurrentColumnNumber(data->parser)); \
 | 
			
		||||
    abort();\
 | 
			
		||||
} while (0)
 | 
			
		||||
#define XML_FATAL(msg,args...) do { \
 | 
			
		||||
    fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \
 | 
			
		||||
             data->name, \
 | 
			
		||||
             XML_GetCurrentLineNumber(data->parser), \
 | 
			
		||||
             XML_GetCurrentColumnNumber(data->parser), \
 | 
			
		||||
             args); \
 | 
			
		||||
    abort();\
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
/** \brief Parser context for __driConfigOptions. */
 | 
			
		||||
struct OptInfoData {
 | 
			
		||||
    const char *name;
 | 
			
		||||
    XML_Parser parser;
 | 
			
		||||
    driOptionCache *cache;
 | 
			
		||||
    GLboolean inDriInfo;
 | 
			
		||||
    GLboolean inSection;
 | 
			
		||||
    GLboolean inDesc;
 | 
			
		||||
    GLboolean inOption;
 | 
			
		||||
    GLboolean inEnum;
 | 
			
		||||
    int curOption;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** \brief Elements in __driConfigOptions. */
 | 
			
		||||
enum OptInfoElem {
 | 
			
		||||
    OI_DESCRIPTION = 0, OI_DRIINFO, OI_ENUM, OI_OPTION, OI_SECTION, OI_COUNT
 | 
			
		||||
};
 | 
			
		||||
static const XML_Char *OptInfoElems[] = {
 | 
			
		||||
    "description", "driinfo", "enum", "option", "section"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** \brief Parse attributes of an enum element.
 | 
			
		||||
 *
 | 
			
		||||
 * We're not actually interested in the data. Just make sure this is ok
 | 
			
		||||
 * for external configuration tools.
 | 
			
		||||
 */
 | 
			
		||||
static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) {
 | 
			
		||||
    GLuint i;
 | 
			
		||||
    const XML_Char *value = NULL, *text = NULL;
 | 
			
		||||
    driOptionValue v;
 | 
			
		||||
    GLuint opt = data->curOption;
 | 
			
		||||
    for (i = 0; attr[i]; i += 2) {
 | 
			
		||||
	if (!strcmp (attr[i], "value")) value = attr[i+1];
 | 
			
		||||
	else if (!strcmp (attr[i], "text")) text = attr[i+1];
 | 
			
		||||
	else XML_FATAL("illegal enum attribute: %s.", attr[i]);
 | 
			
		||||
    }
 | 
			
		||||
    if (!value) XML_FATAL1 ("value attribute missing in enum.");
 | 
			
		||||
    if (!text) XML_FATAL1 ("text attribute missing in enum.");
 | 
			
		||||
     if (!parseValue (&v, data->cache->info[opt].type, value))
 | 
			
		||||
	XML_FATAL ("illegal enum value: %s.", value);
 | 
			
		||||
    if (!checkValue (&v, &data->cache->info[opt]))
 | 
			
		||||
	XML_FATAL ("enum value out of valid range: %s.", value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parse attributes of a description element.
 | 
			
		||||
 *
 | 
			
		||||
 * We're not actually interested in the data. Just make sure this is ok
 | 
			
		||||
 * for external configuration tools.
 | 
			
		||||
 */
 | 
			
		||||
static void parseDescAttr (struct OptInfoData *data, const XML_Char **attr) {
 | 
			
		||||
    GLuint i;
 | 
			
		||||
    const XML_Char *lang = NULL, *text = NULL;
 | 
			
		||||
    for (i = 0; attr[i]; i += 2) {
 | 
			
		||||
	if (!strcmp (attr[i], "lang")) lang = attr[i+1];
 | 
			
		||||
	else if (!strcmp (attr[i], "text")) text = attr[i+1];
 | 
			
		||||
	else XML_FATAL("illegal description attribute: %s.", attr[i]);
 | 
			
		||||
    }
 | 
			
		||||
    if (!lang) XML_FATAL1 ("lang attribute missing in description.");
 | 
			
		||||
    if (!text) XML_FATAL1 ("text attribute missing in description.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parse attributes of an option element. */
 | 
			
		||||
static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) {
 | 
			
		||||
    enum OptAttr {OA_DEFAULT = 0, OA_NAME, OA_TYPE, OA_VALID, OA_COUNT};
 | 
			
		||||
    static const XML_Char *optAttr[] = {"default", "name", "type", "valid"};
 | 
			
		||||
    const XML_Char *attrVal[OA_COUNT] = {NULL, NULL, NULL, NULL};
 | 
			
		||||
    const char *defaultVal;
 | 
			
		||||
    driOptionCache *cache = data->cache;
 | 
			
		||||
    GLuint opt, i;
 | 
			
		||||
    for (i = 0; attr[i]; i += 2) {
 | 
			
		||||
	GLuint attrName = bsearchStr (attr[i], optAttr, OA_COUNT);
 | 
			
		||||
	if (attrName >= OA_COUNT)
 | 
			
		||||
	    XML_FATAL ("illegal option attribute: %s", attr[i]);
 | 
			
		||||
	attrVal[attrName] = attr[i+1];
 | 
			
		||||
    }
 | 
			
		||||
    if (!attrVal[OA_NAME]) XML_FATAL1 ("name attribute missing in option.");
 | 
			
		||||
    if (!attrVal[OA_TYPE]) XML_FATAL1 ("type attribute missing in option.");
 | 
			
		||||
    if (!attrVal[OA_DEFAULT]) XML_FATAL1 ("default attribute missing in option.");
 | 
			
		||||
 | 
			
		||||
    opt = findOption (cache, attrVal[OA_NAME]);
 | 
			
		||||
    if (cache->info[opt].name)
 | 
			
		||||
	XML_FATAL ("option %s redefined.", attrVal[OA_NAME]);
 | 
			
		||||
    data->curOption = opt;
 | 
			
		||||
 | 
			
		||||
    XSTRDUP (cache->info[opt].name, attrVal[OA_NAME]);
 | 
			
		||||
 | 
			
		||||
    if (!strcmp (attrVal[OA_TYPE], "bool"))
 | 
			
		||||
	cache->info[opt].type = DRI_BOOL;
 | 
			
		||||
    else if (!strcmp (attrVal[OA_TYPE], "enum"))
 | 
			
		||||
	cache->info[opt].type = DRI_ENUM;
 | 
			
		||||
    else if (!strcmp (attrVal[OA_TYPE], "int"))
 | 
			
		||||
	cache->info[opt].type = DRI_INT;
 | 
			
		||||
    else if (!strcmp (attrVal[OA_TYPE], "float"))
 | 
			
		||||
	cache->info[opt].type = DRI_FLOAT;
 | 
			
		||||
    else
 | 
			
		||||
	XML_FATAL ("illegal type in option: %s.", attrVal[OA_TYPE]);
 | 
			
		||||
 | 
			
		||||
    defaultVal = getenv (cache->info[opt].name);
 | 
			
		||||
    if (defaultVal != NULL) {
 | 
			
		||||
      /* don't use XML_WARNING, we want the user to see this! */
 | 
			
		||||
	fprintf (stderr,
 | 
			
		||||
		 "ATTENTION: default value of option %s overridden by environment.\n",
 | 
			
		||||
		 cache->info[opt].name);
 | 
			
		||||
    } else
 | 
			
		||||
	defaultVal = attrVal[OA_DEFAULT];
 | 
			
		||||
    if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal))
 | 
			
		||||
	XML_FATAL ("illegal default value: %s.", defaultVal);
 | 
			
		||||
 | 
			
		||||
    if (attrVal[OA_VALID]) {
 | 
			
		||||
	if (cache->info[opt].type == DRI_BOOL)
 | 
			
		||||
	    XML_FATAL1 ("boolean option with valid attribute.");
 | 
			
		||||
	if (!parseRanges (&cache->info[opt], attrVal[OA_VALID]))
 | 
			
		||||
	    XML_FATAL ("illegal valid attribute: %s.", attrVal[OA_VALID]);
 | 
			
		||||
	if (!checkValue (&cache->values[opt], &cache->info[opt]))
 | 
			
		||||
	    XML_FATAL ("default value out of valid range '%s': %s.",
 | 
			
		||||
		       attrVal[OA_VALID], defaultVal);
 | 
			
		||||
    } else if (cache->info[opt].type == DRI_ENUM) {
 | 
			
		||||
	XML_FATAL1 ("valid attribute missing in option (mandatory for enums).");
 | 
			
		||||
    } else {
 | 
			
		||||
	cache->info[opt].nRanges = 0;
 | 
			
		||||
	cache->info[opt].ranges = NULL;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Handler for start element events. */
 | 
			
		||||
static void optInfoStartElem (void *userData, const XML_Char *name,
 | 
			
		||||
			      const XML_Char **attr) {
 | 
			
		||||
    struct OptInfoData *data = (struct OptInfoData *)userData;
 | 
			
		||||
    enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT);
 | 
			
		||||
    switch (elem) {
 | 
			
		||||
      case OI_DRIINFO:
 | 
			
		||||
	if (data->inDriInfo)
 | 
			
		||||
	    XML_FATAL1 ("nested <driinfo> elements.");
 | 
			
		||||
	if (attr[0])
 | 
			
		||||
	    XML_FATAL1 ("attributes specified on <driinfo> element.");
 | 
			
		||||
	data->inDriInfo = GL_TRUE;
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_SECTION:
 | 
			
		||||
	if (!data->inDriInfo)
 | 
			
		||||
	    XML_FATAL1 ("<section> must be inside <driinfo>.");
 | 
			
		||||
	if (data->inSection)
 | 
			
		||||
	    XML_FATAL1 ("nested <section> elements.");
 | 
			
		||||
	if (attr[0])
 | 
			
		||||
	    XML_FATAL1 ("attributes specified on <section> element.");
 | 
			
		||||
	data->inSection = GL_TRUE;
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_DESCRIPTION:
 | 
			
		||||
	if (!data->inSection && !data->inOption)
 | 
			
		||||
	    XML_FATAL1 ("<description> must be inside <description> or <option.");
 | 
			
		||||
	if (data->inDesc)
 | 
			
		||||
	    XML_FATAL1 ("nested <description> elements.");
 | 
			
		||||
	data->inDesc = GL_TRUE;
 | 
			
		||||
	parseDescAttr (data, attr);
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_OPTION:
 | 
			
		||||
	if (!data->inSection)
 | 
			
		||||
	    XML_FATAL1 ("<option> must be inside <section>.");
 | 
			
		||||
	if (data->inDesc)
 | 
			
		||||
	    XML_FATAL1 ("<option> nested in <description> element.");
 | 
			
		||||
	if (data->inOption)
 | 
			
		||||
	    XML_FATAL1 ("nested <option> elements.");
 | 
			
		||||
	data->inOption = GL_TRUE;
 | 
			
		||||
	parseOptInfoAttr (data, attr);
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_ENUM:
 | 
			
		||||
	if (!(data->inOption && data->inDesc))
 | 
			
		||||
	    XML_FATAL1 ("<enum> must be inside <option> and <description>.");
 | 
			
		||||
	if (data->inEnum)
 | 
			
		||||
	    XML_FATAL1 ("nested <enum> elements.");
 | 
			
		||||
	data->inEnum = GL_TRUE;
 | 
			
		||||
	parseEnumAttr (data, attr);
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
	XML_FATAL ("unknown element: %s.", name);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Handler for end element events. */
 | 
			
		||||
static void optInfoEndElem (void *userData, const XML_Char *name) {
 | 
			
		||||
    struct OptInfoData *data = (struct OptInfoData *)userData;
 | 
			
		||||
    enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT);
 | 
			
		||||
    switch (elem) {
 | 
			
		||||
      case OI_DRIINFO:
 | 
			
		||||
	data->inDriInfo = GL_FALSE;
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_SECTION:
 | 
			
		||||
	data->inSection = GL_FALSE;
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_DESCRIPTION:
 | 
			
		||||
	data->inDesc = GL_FALSE;
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_OPTION:
 | 
			
		||||
	data->inOption = GL_FALSE;
 | 
			
		||||
	break;
 | 
			
		||||
      case OI_ENUM:
 | 
			
		||||
	data->inEnum = GL_FALSE;
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
	assert (0); /* should have been caught by StartElem */
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void driParseOptionInfo (driOptionCache *info) {
 | 
			
		||||
    XML_Parser p;
 | 
			
		||||
    int status;
 | 
			
		||||
    struct OptInfoData userData;
 | 
			
		||||
    struct OptInfoData *data = &userData;
 | 
			
		||||
    GLuint nOptions;
 | 
			
		||||
 | 
			
		||||
  /* determine hash table size and allocate memory */
 | 
			
		||||
    GLuint size, log2size;
 | 
			
		||||
    for (size = 1, log2size = 0; size < __driNConfigOptions*3/2;
 | 
			
		||||
	 size <<= 1, ++log2size);
 | 
			
		||||
    info->tableSize = log2size;
 | 
			
		||||
    info->info = CALLOC (size * sizeof (driOptionInfo));
 | 
			
		||||
    info->values = CALLOC (size * sizeof (driOptionInfo));
 | 
			
		||||
    if (info->info == NULL || info->values == NULL) {
 | 
			
		||||
	fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
 | 
			
		||||
	abort();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    p = XML_ParserCreate ("UTF-8"); /* always UTF-8 */
 | 
			
		||||
    XML_SetElementHandler (p, optInfoStartElem, optInfoEndElem);
 | 
			
		||||
    XML_SetUserData (p, data);
 | 
			
		||||
 | 
			
		||||
    userData.name = "__driConfigOptions";
 | 
			
		||||
    userData.parser = p;
 | 
			
		||||
    userData.cache = info;
 | 
			
		||||
    userData.inDriInfo = GL_FALSE;
 | 
			
		||||
    userData.inSection = GL_FALSE;
 | 
			
		||||
    userData.inDesc = GL_FALSE;
 | 
			
		||||
    userData.inOption = GL_FALSE;
 | 
			
		||||
    userData.inEnum = GL_FALSE;
 | 
			
		||||
    userData.curOption = -1;
 | 
			
		||||
 | 
			
		||||
    status = XML_Parse (p, __driConfigOptions, strlen (__driConfigOptions), 1);
 | 
			
		||||
    if (!status)
 | 
			
		||||
	XML_FATAL ("%s.", XML_ErrorString(XML_GetErrorCode(p)));
 | 
			
		||||
 | 
			
		||||
    XML_ParserFree (p);
 | 
			
		||||
 | 
			
		||||
  /* Check if the actual number of options matches __driNConfigOptions.
 | 
			
		||||
   * A mismatch is not fatal (a hash table overflow would be) but we
 | 
			
		||||
   * want the driver developer's attention anyway. */
 | 
			
		||||
    nOptions = countOptions (info);
 | 
			
		||||
    if (nOptions != __driNConfigOptions) {
 | 
			
		||||
	fprintf (stderr,
 | 
			
		||||
		 "Error: __driNConfigOptions (%u) does not match the actual number of options in\n"
 | 
			
		||||
		 "       __driConfigOptions (%u).\n",
 | 
			
		||||
		 __driNConfigOptions, nOptions);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parser context for configuration files. */
 | 
			
		||||
struct OptConfData {
 | 
			
		||||
    const char *name;
 | 
			
		||||
    XML_Parser parser;
 | 
			
		||||
    driOptionCache *cache;
 | 
			
		||||
    GLint screenNum;
 | 
			
		||||
    const char *driverName, *execName;
 | 
			
		||||
    GLuint ignoringDevice;
 | 
			
		||||
    GLuint ignoringApp;
 | 
			
		||||
    GLuint inDriConf;
 | 
			
		||||
    GLuint inDevice;
 | 
			
		||||
    GLuint inApp;
 | 
			
		||||
    GLuint inOption;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** \brief Elements in configuration files. */
 | 
			
		||||
enum OptConfElem {
 | 
			
		||||
    OC_APPLICATION = 0, OC_DEVICE, OC_DRICONF, OC_OPTION, OC_COUNT
 | 
			
		||||
};
 | 
			
		||||
static const XML_Char *OptConfElems[] = {
 | 
			
		||||
    "application", "device", "driconf", "option"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** \brief Parse attributes of a device element. */
 | 
			
		||||
static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) {
 | 
			
		||||
    GLuint i;
 | 
			
		||||
    const XML_Char *driver = NULL, *screen = NULL;
 | 
			
		||||
    for (i = 0; attr[i]; i += 2) {
 | 
			
		||||
	if (!strcmp (attr[i], "driver")) driver = attr[i+1];
 | 
			
		||||
	else if (!strcmp (attr[i], "screen")) screen = attr[i+1];
 | 
			
		||||
	else XML_WARNING("unkown device attribute: %s.", attr[i]);
 | 
			
		||||
    }
 | 
			
		||||
    if (driver && strcmp (driver, data->driverName))
 | 
			
		||||
	data->ignoringDevice = data->inDevice;
 | 
			
		||||
    else if (screen) {
 | 
			
		||||
	driOptionValue screenNum;
 | 
			
		||||
	if (!parseValue (&screenNum, DRI_INT, screen))
 | 
			
		||||
	    XML_WARNING("illegal screen number: %s.", screen);
 | 
			
		||||
	else if (screenNum._int != data->screenNum)
 | 
			
		||||
	    data->ignoringDevice = data->inDevice;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parse attributes of an application element. */
 | 
			
		||||
static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) {
 | 
			
		||||
    GLuint i;
 | 
			
		||||
    const XML_Char *name = NULL, *exec = NULL;
 | 
			
		||||
    for (i = 0; attr[i]; i += 2) {
 | 
			
		||||
	if (!strcmp (attr[i], "name")) name = attr[i+1];
 | 
			
		||||
	else if (!strcmp (attr[i], "executable")) exec = attr[i+1];
 | 
			
		||||
	else XML_WARNING("unkown application attribute: %s.", attr[i]);
 | 
			
		||||
    }
 | 
			
		||||
    if (exec && strcmp (exec, data->execName))
 | 
			
		||||
	data->ignoringApp = data->inApp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parse attributes of an option element. */
 | 
			
		||||
static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) {
 | 
			
		||||
    GLuint i;
 | 
			
		||||
    const XML_Char *name = NULL, *value = NULL;
 | 
			
		||||
    for (i = 0; attr[i]; i += 2) {
 | 
			
		||||
	if (!strcmp (attr[i], "name")) name = attr[i+1];
 | 
			
		||||
	else if (!strcmp (attr[i], "value")) value = attr[i+1];
 | 
			
		||||
	else XML_WARNING("unkown option attribute: %s.", attr[i]);
 | 
			
		||||
    }
 | 
			
		||||
    if (!name) XML_WARNING1 ("name attribute missing in option.");
 | 
			
		||||
    if (!value) XML_WARNING1 ("value attribute missing in option.");
 | 
			
		||||
    if (name && value) {
 | 
			
		||||
	driOptionCache *cache = data->cache;
 | 
			
		||||
	GLuint opt = findOption (cache, name);
 | 
			
		||||
	if (cache->info[opt].name == NULL)
 | 
			
		||||
	    XML_WARNING ("undefined option: %s.", name);
 | 
			
		||||
	else if (getenv (cache->info[opt].name))
 | 
			
		||||
	  /* don't use XML_WARNING, we want the user to see this! */
 | 
			
		||||
	    fprintf (stderr, "ATTENTION: option value of option %s ignored.\n",
 | 
			
		||||
		     cache->info[opt].name);
 | 
			
		||||
	else if (!parseValue (&cache->values[opt], cache->info[opt].type, value))
 | 
			
		||||
	    XML_WARNING ("illegal option value: %s.", value);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Handler for start element events. */
 | 
			
		||||
static void optConfStartElem (void *userData, const XML_Char *name,
 | 
			
		||||
			      const XML_Char **attr) {
 | 
			
		||||
    struct OptConfData *data = (struct OptConfData *)userData;
 | 
			
		||||
    enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT);
 | 
			
		||||
    switch (elem) {
 | 
			
		||||
      case OC_DRICONF:
 | 
			
		||||
	if (data->inDriConf)
 | 
			
		||||
	    XML_WARNING1 ("nested <driconf> elements.");
 | 
			
		||||
	if (attr[0])
 | 
			
		||||
	    XML_WARNING1 ("attributes specified on <driconf> element.");
 | 
			
		||||
	data->inDriConf++;
 | 
			
		||||
	break;
 | 
			
		||||
      case OC_DEVICE:
 | 
			
		||||
	if (!data->inDriConf)
 | 
			
		||||
	    XML_WARNING1 ("<device> should be inside <driconf>.");
 | 
			
		||||
	if (data->inDevice)
 | 
			
		||||
	    XML_WARNING1 ("nested <device> elements.");
 | 
			
		||||
	data->inDevice++;
 | 
			
		||||
	if (!data->ignoringDevice && !data->ignoringApp)
 | 
			
		||||
	    parseDeviceAttr (data, attr);
 | 
			
		||||
	break;
 | 
			
		||||
      case OC_APPLICATION:
 | 
			
		||||
	if (!data->inDevice)
 | 
			
		||||
	    XML_WARNING1 ("<application> should be inside <device>.");
 | 
			
		||||
	if (data->inApp)
 | 
			
		||||
	    XML_WARNING1 ("nested <application> elements.");
 | 
			
		||||
	data->inApp++;
 | 
			
		||||
	if (!data->ignoringDevice && !data->ignoringApp)
 | 
			
		||||
	    parseAppAttr (data, attr);
 | 
			
		||||
	break;
 | 
			
		||||
      case OC_OPTION:
 | 
			
		||||
	if (!data->inApp)
 | 
			
		||||
	    XML_WARNING1 ("<option> should be inside <application>.");
 | 
			
		||||
	if (data->inOption)
 | 
			
		||||
	    XML_WARNING1 ("nested <option> elements.");
 | 
			
		||||
	data->inOption++;
 | 
			
		||||
	if (!data->ignoringDevice && !data->ignoringApp)
 | 
			
		||||
	    parseOptConfAttr (data, attr);
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
	XML_WARNING ("unknown element: %s.", name);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Handler for end element events. */
 | 
			
		||||
static void optConfEndElem (void *userData, const XML_Char *name) {
 | 
			
		||||
    struct OptConfData *data = (struct OptConfData *)userData;
 | 
			
		||||
    enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT);
 | 
			
		||||
    switch (elem) {
 | 
			
		||||
      case OC_DRICONF:
 | 
			
		||||
	data->inDriConf--;
 | 
			
		||||
	break;
 | 
			
		||||
      case OC_DEVICE:
 | 
			
		||||
	if (data->inDevice-- == data->ignoringDevice)
 | 
			
		||||
	    data->ignoringDevice = 0;
 | 
			
		||||
	break;
 | 
			
		||||
      case OC_APPLICATION:
 | 
			
		||||
	if (data->inApp-- == data->ignoringApp)
 | 
			
		||||
	    data->ignoringApp = 0;
 | 
			
		||||
	break;
 | 
			
		||||
      case OC_OPTION:
 | 
			
		||||
	data->inOption--;
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
	/* unknown element, warning was produced on start tag */;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Initialize an option cache based on info */
 | 
			
		||||
static void initOptionCache (driOptionCache *cache, driOptionCache *info) {
 | 
			
		||||
    cache->info = info->info;
 | 
			
		||||
    cache->tableSize = info->tableSize;
 | 
			
		||||
    cache->values = MALLOC ((1<<info->tableSize) * sizeof (driOptionValue));
 | 
			
		||||
    if (cache->values == NULL) {
 | 
			
		||||
	fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
 | 
			
		||||
	abort();
 | 
			
		||||
    }
 | 
			
		||||
    memcpy (cache->values, info->values,
 | 
			
		||||
	    (1<<info->tableSize) * sizeof (driOptionValue));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief Parse the named configuration file */
 | 
			
		||||
static void parseOneConfigFile (XML_Parser p) {
 | 
			
		||||
#define BUF_SIZE 0x1000
 | 
			
		||||
    struct OptConfData *data = (struct OptConfData *)XML_GetUserData (p);
 | 
			
		||||
    int status;
 | 
			
		||||
    int fd;
 | 
			
		||||
 | 
			
		||||
    if ((fd = open (data->name, O_RDONLY)) == -1) {
 | 
			
		||||
	__driUtilMessage ("Can't open configuration file %s: %s.",
 | 
			
		||||
			  data->name, strerror (errno));
 | 
			
		||||
	return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    while (1) {
 | 
			
		||||
	int bytesRead;
 | 
			
		||||
	void *buffer = XML_GetBuffer (p, BUF_SIZE);
 | 
			
		||||
	if (!buffer) {
 | 
			
		||||
	    __driUtilMessage ("Can't allocate parser buffer.");
 | 
			
		||||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
	bytesRead = read (fd, buffer, BUF_SIZE);
 | 
			
		||||
	if (bytesRead == -1) {
 | 
			
		||||
	    __driUtilMessage ("Error reading from configuration file %s: %s.",
 | 
			
		||||
			      data->name, strerror (errno));
 | 
			
		||||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
	status = XML_ParseBuffer (p, bytesRead, bytesRead == 0);
 | 
			
		||||
	if (!status) {
 | 
			
		||||
	    XML_ERROR ("%s.", XML_ErrorString(XML_GetErrorCode(p)));
 | 
			
		||||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
	if (bytesRead == 0)
 | 
			
		||||
	    break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    close (fd);
 | 
			
		||||
#undef BUF_SIZE
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void driParseConfigFiles (driOptionCache *cache, driOptionCache *info,
 | 
			
		||||
			  GLint screenNum, const char *driverName) {
 | 
			
		||||
    char *filenames[2] = {"/etc/drirc", NULL};
 | 
			
		||||
    char *home;
 | 
			
		||||
    GLuint i;
 | 
			
		||||
    struct OptConfData userData;
 | 
			
		||||
 | 
			
		||||
    initOptionCache (cache, info);
 | 
			
		||||
 | 
			
		||||
    userData.cache = cache;
 | 
			
		||||
    userData.screenNum = screenNum;
 | 
			
		||||
    userData.driverName = driverName;
 | 
			
		||||
#ifndef _SOLO    
 | 
			
		||||
    userData.execName = GET_PROGRAM_NAME();
 | 
			
		||||
#else
 | 
			
		||||
    userData.execName = "Solo";
 | 
			
		||||
#endif    
 | 
			
		||||
 | 
			
		||||
    if ((home = getenv ("HOME"))) {
 | 
			
		||||
	GLuint len = strlen (home);
 | 
			
		||||
	filenames[1] = MALLOC (len + 7+1);
 | 
			
		||||
	if (filenames[1] == NULL)
 | 
			
		||||
	    __driUtilMessage ("Can't allocate memory for %s/.drirc.", home);
 | 
			
		||||
	else {
 | 
			
		||||
	    memcpy (filenames[1], home, len);
 | 
			
		||||
	    memcpy (filenames[1] + len, "/.drirc", 7+1);
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < 2; ++i) {
 | 
			
		||||
	XML_Parser p;
 | 
			
		||||
	if (filenames[i] == NULL)
 | 
			
		||||
	    continue;
 | 
			
		||||
 | 
			
		||||
	p = XML_ParserCreate (NULL); /* use encoding specified by file */
 | 
			
		||||
	XML_SetElementHandler (p, optConfStartElem, optConfEndElem);
 | 
			
		||||
	XML_SetUserData (p, &userData);
 | 
			
		||||
	userData.parser = p;
 | 
			
		||||
	userData.name = filenames[i];
 | 
			
		||||
	userData.ignoringDevice = 0;
 | 
			
		||||
	userData.ignoringApp = 0;
 | 
			
		||||
	userData.inDriConf = 0;
 | 
			
		||||
	userData.inDevice = 0;
 | 
			
		||||
	userData.inApp = 0;
 | 
			
		||||
	userData.inOption = 0;
 | 
			
		||||
 | 
			
		||||
	parseOneConfigFile (p);
 | 
			
		||||
	XML_ParserFree (p);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (filenames[1])
 | 
			
		||||
	FREE (filenames[1]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void driDestroyOptionInfo (driOptionCache *info) {
 | 
			
		||||
    driDestroyOptionCache (info);
 | 
			
		||||
    if (info->info) {
 | 
			
		||||
	GLuint i, size = 1 << info->tableSize;
 | 
			
		||||
	for (i = 0; i < size; ++i) {
 | 
			
		||||
	    if (info->info[i].name) {
 | 
			
		||||
		FREE (info->info[i].name);
 | 
			
		||||
		if (info->info[i].ranges)
 | 
			
		||||
		    FREE (info->info[i].ranges);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
	FREE (info->info);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void driDestroyOptionCache (driOptionCache *cache) {
 | 
			
		||||
    if (cache->values)
 | 
			
		||||
	FREE (cache->values);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GLboolean driCheckOption (const driOptionCache *cache, const char *name,
 | 
			
		||||
			  driOptionType type) {
 | 
			
		||||
    GLuint i = findOption (cache, name);
 | 
			
		||||
    return cache->info[i].name != NULL && cache->info[i].type == type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GLboolean driQueryOptionb (const driOptionCache *cache, const char *name) {
 | 
			
		||||
    GLuint i = findOption (cache, name);
 | 
			
		||||
  /* make sure the option is defined and has the correct type */
 | 
			
		||||
    assert (cache->info[i].name != NULL);
 | 
			
		||||
    assert (cache->info[i].type == DRI_BOOL);
 | 
			
		||||
    return cache->values[i]._bool;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GLint driQueryOptioni (const driOptionCache *cache, const char *name) {
 | 
			
		||||
    GLuint i = findOption (cache, name);
 | 
			
		||||
  /* make sure the option is defined and has the correct type */
 | 
			
		||||
    assert (cache->info[i].name != NULL);
 | 
			
		||||
    assert (cache->info[i].type == DRI_INT || cache->info[i].type == DRI_ENUM);
 | 
			
		||||
    return cache->values[i]._int;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GLfloat driQueryOptionf (const driOptionCache *cache, const char *name) {
 | 
			
		||||
    GLuint i = findOption (cache, name);
 | 
			
		||||
  /* make sure the option is defined and has the correct type */
 | 
			
		||||
    assert (cache->info[i].name != NULL);
 | 
			
		||||
    assert (cache->info[i].type == DRI_FLOAT);
 | 
			
		||||
    return cache->values[i]._float;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										125
									
								
								src/mesa/drivers/dri/common/xmlconfig.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								src/mesa/drivers/dri/common/xmlconfig.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,125 @@
 | 
			
		||||
/*
 | 
			
		||||
 * XML DRI client-side driver configuration
 | 
			
		||||
 * Copyright (C) 2003 Felix Kuehling
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS 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.
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * \file xmlconfig.h
 | 
			
		||||
 * \brief Driver-independent client-side part of the XML configuration
 | 
			
		||||
 * \author Felix Kuehling
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __XMLCONFIG_H
 | 
			
		||||
#define __XMLCONFIG_H
 | 
			
		||||
 | 
			
		||||
/** \brief Option data types */
 | 
			
		||||
typedef enum driOptionType {
 | 
			
		||||
    DRI_BOOL, DRI_ENUM, DRI_INT, DRI_FLOAT
 | 
			
		||||
} driOptionType;
 | 
			
		||||
 | 
			
		||||
/** \brief Option value */
 | 
			
		||||
typedef union driOptionValue {
 | 
			
		||||
    GLboolean _bool; /**< \brief Boolean */
 | 
			
		||||
    GLint _int;      /**< \brief Integer or Enum */
 | 
			
		||||
    GLfloat _float;  /**< \brief Floating-point */
 | 
			
		||||
} driOptionValue;
 | 
			
		||||
 | 
			
		||||
/** \brief Single range of valid values
 | 
			
		||||
 *
 | 
			
		||||
 * For empty ranges (a single value) start == end */
 | 
			
		||||
typedef struct driOptionRange {
 | 
			
		||||
    driOptionValue start; /**< \brief Start */
 | 
			
		||||
    driOptionValue end;   /**< \brief End */
 | 
			
		||||
} driOptionRange;
 | 
			
		||||
 | 
			
		||||
/** \brief Information about an option */
 | 
			
		||||
typedef struct driOptionInfo {
 | 
			
		||||
    char *name;             /**< \brief Name */
 | 
			
		||||
    driOptionType type;     /**< \brief Type */
 | 
			
		||||
    driOptionRange *ranges; /**< \brief Array of ranges */
 | 
			
		||||
    GLuint nRanges;         /**< \brief Number of ranges */
 | 
			
		||||
} driOptionInfo;
 | 
			
		||||
 | 
			
		||||
/** \brief Option cache
 | 
			
		||||
 *
 | 
			
		||||
 * \li One in <driver>Screen caching option info and the default values
 | 
			
		||||
 * \li One in each <driver>Context with the actual values for that context */
 | 
			
		||||
typedef struct driOptionCache {
 | 
			
		||||
    driOptionInfo *info;
 | 
			
		||||
  /**< \brief Array of option infos
 | 
			
		||||
   *
 | 
			
		||||
   * Points to the same array in the screen and all contexts */
 | 
			
		||||
    driOptionValue *values;	
 | 
			
		||||
  /**< \brief Array of option values
 | 
			
		||||
   *
 | 
			
		||||
   * \li Default values in screen
 | 
			
		||||
   * \li Actual values in contexts 
 | 
			
		||||
   */
 | 
			
		||||
    GLuint tableSize;
 | 
			
		||||
  /**< \brief Size of the arrays
 | 
			
		||||
   *
 | 
			
		||||
   * Depending on the hash function this may differ from __driNConfigOptions.
 | 
			
		||||
   * In the current implementation it's not actually a size but log2(size).
 | 
			
		||||
   * The value is the same in the screen and all contexts. */
 | 
			
		||||
} driOptionCache;
 | 
			
		||||
 | 
			
		||||
/** \brief XML document describing available options
 | 
			
		||||
 *
 | 
			
		||||
 * This must be defined in a driver-specific soure file. xmlpool.h
 | 
			
		||||
 * defines helper macros and common options. */
 | 
			
		||||
extern const char __driConfigOptions[];
 | 
			
		||||
/** \brief The number of options supported by a driver
 | 
			
		||||
 *
 | 
			
		||||
 * This is used to choose an appropriate hash table size. So any value
 | 
			
		||||
 * larger than the actual number of options will work. */
 | 
			
		||||
extern const GLuint __driNConfigOptions;
 | 
			
		||||
 | 
			
		||||
/** \brief Parse XML option info from __driConfigOptions
 | 
			
		||||
 *
 | 
			
		||||
 * To be called in <driver>CreateScreen */
 | 
			
		||||
void driParseOptionInfo (driOptionCache *info);
 | 
			
		||||
/** \brief Initialize option cache from info and parse configuration files
 | 
			
		||||
 *
 | 
			
		||||
 * To be called in <driver>CreateContext. screenNum and driverName select
 | 
			
		||||
 * device sections. */
 | 
			
		||||
void driParseConfigFiles (driOptionCache *cache, driOptionCache *info,
 | 
			
		||||
			  GLint screenNum, const char *driverName);
 | 
			
		||||
/** \brief Destroy option info
 | 
			
		||||
 *
 | 
			
		||||
 * To be called in <driver>DestroyScreen */
 | 
			
		||||
void driDestroyOptionInfo (driOptionCache *info);
 | 
			
		||||
/** \brief Destroy option cache
 | 
			
		||||
 *
 | 
			
		||||
 * To be called in <driver>DestroyContext */
 | 
			
		||||
void driDestroyOptionCache (driOptionCache *cache);
 | 
			
		||||
 | 
			
		||||
/** \brief Check if there exists a certain option */
 | 
			
		||||
GLboolean driCheckOption (const driOptionCache *cache, const char *name,
 | 
			
		||||
			  driOptionType type);
 | 
			
		||||
 | 
			
		||||
/** \brief Query a boolean option value */
 | 
			
		||||
GLboolean driQueryOptionb (const driOptionCache *cache, const char *name);
 | 
			
		||||
/** \brief Query an integer option value */
 | 
			
		||||
GLint driQueryOptioni (const driOptionCache *cache, const char *name);
 | 
			
		||||
/** \brief Query a floating-point option value */
 | 
			
		||||
GLfloat driQueryOptionf (const driOptionCache *cache, const char *name);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										203
									
								
								src/mesa/drivers/dri/common/xmlpool.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										203
									
								
								src/mesa/drivers/dri/common/xmlpool.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,203 @@
 | 
			
		||||
/* -*- mode:C; coding: mult-utf-8-unix -*-
 | 
			
		||||
 *
 | 
			
		||||
 * !!! Important: This file is encoded in UTF-8 !!!
 | 
			
		||||
 *
 | 
			
		||||
 * Note (Emacs): You need Mule. In Debian the package is called
 | 
			
		||||
 * mule-ucs.
 | 
			
		||||
 *
 | 
			
		||||
 * Note (Emacs): You may have to enable multibyte characters in the
 | 
			
		||||
 * Mule customization group or by setting
 | 
			
		||||
 * default-enable-multibyte-characters to t in your .emacs:
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * XML DRI client-side driver configuration
 | 
			
		||||
 * Copyright (C) 2003 Felix Kuehling
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS 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.
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * \file xmlpool.h
 | 
			
		||||
 * \brief Pool of common options
 | 
			
		||||
 * \author Felix Kuehling
 | 
			
		||||
 *
 | 
			
		||||
 * This file defines macros that can be used to construct driConfigOptions
 | 
			
		||||
 * in the drivers.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __XMLPOOL_H
 | 
			
		||||
#define __XMLPOOL_H
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * generic macros
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/** \brief Begin __driConfigOptions */
 | 
			
		||||
#define DRI_CONF_BEGIN \
 | 
			
		||||
"<driinfo>\n"
 | 
			
		||||
 | 
			
		||||
/** \brief End __driConfigOptions */
 | 
			
		||||
#define DRI_CONF_END \
 | 
			
		||||
"</driinfo>\n"
 | 
			
		||||
 | 
			
		||||
/** \brief Begin a section of related options */
 | 
			
		||||
#define DRI_CONF_SECTION_BEGIN \
 | 
			
		||||
"<section>\n"
 | 
			
		||||
 | 
			
		||||
/** \brief End a section of related options */
 | 
			
		||||
#define DRI_CONF_SECTION_END \
 | 
			
		||||
"</section>\n"
 | 
			
		||||
 | 
			
		||||
/** \brief Begin an option definition */
 | 
			
		||||
#define DRI_CONF_OPT_BEGIN(name,type,def) \
 | 
			
		||||
"<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n"
 | 
			
		||||
 | 
			
		||||
/** \brief Begin an option definition with restrictions on valid values */
 | 
			
		||||
#define DRI_CONF_OPT_BEGIN_V(name,type,def,valid) \
 | 
			
		||||
"<option name=\""#name"\" type=\""#type"\" default=\""#def"\" valid=\""valid"\">\n"
 | 
			
		||||
 | 
			
		||||
/** \brief End an option description */
 | 
			
		||||
#define DRI_CONF_OPT_END \
 | 
			
		||||
"</option>\n"
 | 
			
		||||
 | 
			
		||||
/** \brief A verbal description in a specified language (empty version) */
 | 
			
		||||
#define DRI_CONF_DESC(lang,text) \
 | 
			
		||||
"<description lang=\""#lang"\" text=\""text"\"/>\n"
 | 
			
		||||
 | 
			
		||||
/** \brief A verbal description in a specified language */
 | 
			
		||||
#define DRI_CONF_DESC_BEGIN(lang,text) \
 | 
			
		||||
"<description lang=\""#lang"\" text=\""text"\">\n"
 | 
			
		||||
 | 
			
		||||
/** \brief End a description */
 | 
			
		||||
#define DRI_CONF_DESC_END \
 | 
			
		||||
"</description>\n"
 | 
			
		||||
 | 
			
		||||
/** \brief A verbal description of an enum value */
 | 
			
		||||
#define DRI_CONF_ENUM(value,text) \
 | 
			
		||||
"<enum value=\""#value"\" text=\""text"\"/>\n"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * predefined option sections and options with multi-lingual descriptions
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/** \brief Debugging options */
 | 
			
		||||
#define DRI_CONF_SECTION_DEBUG \
 | 
			
		||||
DRI_CONF_SECTION_BEGIN \
 | 
			
		||||
	DRI_CONF_DESC(en,"Debugging") \
 | 
			
		||||
	DRI_CONF_DESC(de,"Fehlersuche")
 | 
			
		||||
 | 
			
		||||
#define DRI_CONF_NO_RAST(def) \
 | 
			
		||||
DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
 | 
			
		||||
        DRI_CONF_DESC(en,"Disable 3D acceleration") \
 | 
			
		||||
        DRI_CONF_DESC(de,"3D-Beschleunigung abschalten") \
 | 
			
		||||
DRI_CONF_OPT_END
 | 
			
		||||
 | 
			
		||||
#define DRI_CONF_PERFORMANCE_BOXES(def) \
 | 
			
		||||
DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
 | 
			
		||||
        DRI_CONF_DESC(en,"Show performance boxes") \
 | 
			
		||||
        DRI_CONF_DESC(de,"Zeige Performanceboxen") \
 | 
			
		||||
DRI_CONF_OPT_END
 | 
			
		||||
 | 
			
		||||
#define DRI_CONF_DEBUG_DMA(def) \
 | 
			
		||||
DRI_CONF_OPT_BEGIN(debug_dma,bool,def) \
 | 
			
		||||
	DRI_CONF_DESC(en,"Debug DMA buffers") \
 | 
			
		||||
	DRI_CONF_DESC(de,"DMA Puffer debuggen") \
 | 
			
		||||
DRI_CONF_OPT_END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** \brief Texture-related options */
 | 
			
		||||
#define DRI_CONF_SECTION_QUALITY \
 | 
			
		||||
DRI_CONF_SECTION_BEGIN \
 | 
			
		||||
	DRI_CONF_DESC(en,"Image Quality") \
 | 
			
		||||
	DRI_CONF_DESC(de,"Bildqualität")
 | 
			
		||||
 | 
			
		||||
#define DRI_CONF_PREFERRED_BPT(def,valid) \
 | 
			
		||||
DRI_CONF_OPT_BEGIN_V(preferred_bpt,enum,def,valid) \
 | 
			
		||||
	DRI_CONF_DESC_BEGIN(en,"Preferred texture color depth") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"Same as frame buffer") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
	DRI_CONF_DESC_BEGIN(de,"Bevorzugte Textur Farbtiefe") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"So wie der Framebuffer") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
DRI_CONF_OPT_END
 | 
			
		||||
 | 
			
		||||
/** \brief Performance-related options */
 | 
			
		||||
#define DRI_CONF_SECTION_PERFORMANCE \
 | 
			
		||||
DRI_CONF_SECTION_BEGIN \
 | 
			
		||||
        DRI_CONF_DESC(en,"Performance") \
 | 
			
		||||
        DRI_CONF_DESC(de,"Leistung")
 | 
			
		||||
 | 
			
		||||
#define DRI_CONF_TCL_SW 0
 | 
			
		||||
#define DRI_CONF_TCL_PIPELINED 1
 | 
			
		||||
#define DRI_CONF_TCL_VTXFMT 2
 | 
			
		||||
#define DRI_CONF_TCL_CODEGEN 3
 | 
			
		||||
#define DRI_CONF_TCL_MODE(def) \
 | 
			
		||||
DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \
 | 
			
		||||
        DRI_CONF_DESC_BEGIN(en,"TCL mode (Transformation, Clipping, Lighting)") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"Software") \
 | 
			
		||||
                DRI_CONF_ENUM(1,"TCL stage in MESA pipeline") \
 | 
			
		||||
                DRI_CONF_ENUM(2,"Bypass MESA's pipeline") \
 | 
			
		||||
                DRI_CONF_ENUM(3,"Bypass MESA's pipeline with state-based code generation") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
        DRI_CONF_DESC_BEGIN(de,"TCL Modus (Transformation, Clipping, Licht)") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"Software") \
 | 
			
		||||
                DRI_CONF_ENUM(1,"TCL Stufe in MESA Pipeline") \
 | 
			
		||||
                DRI_CONF_ENUM(2,"Umgehe MESA's Pipeline") \
 | 
			
		||||
                DRI_CONF_ENUM(3,"Umgehe MESA's Pipeline mit zustandsbasierter Codegenerierung") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
DRI_CONF_OPT_END
 | 
			
		||||
 | 
			
		||||
#define DRI_CONF_FTHROTTLE_BUSY 0
 | 
			
		||||
#define DRI_CONF_FTHROTTLE_USLEEPS 1
 | 
			
		||||
#define DRI_CONF_FTHROTTLE_IRQS 2
 | 
			
		||||
#define DRI_CONF_FTHROTTLE_MODE(def) \
 | 
			
		||||
DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \
 | 
			
		||||
        DRI_CONF_DESC_BEGIN(en,"Frame throttling") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"Busy waiting") \
 | 
			
		||||
                DRI_CONF_ENUM(1,"Usleeps") \
 | 
			
		||||
                DRI_CONF_ENUM(2,"Software interrupts") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
        DRI_CONF_DESC_BEGIN(de,"Framethrottling") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"Aktives Warten") \
 | 
			
		||||
                DRI_CONF_ENUM(1,"Usleeps") \
 | 
			
		||||
                DRI_CONF_ENUM(2,"Sortware Interrutps") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
DRI_CONF_OPT_END
 | 
			
		||||
 | 
			
		||||
#define DRI_CONF_VBLANK_NEVER 0
 | 
			
		||||
#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
 | 
			
		||||
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
 | 
			
		||||
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
 | 
			
		||||
#define DRI_CONF_VBLANK_MODE(def) \
 | 
			
		||||
DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
 | 
			
		||||
        DRI_CONF_DESC_BEGIN(en,"Synchronization with vertical refresh (swap intervals)") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"Never, FPS rulez!") \
 | 
			
		||||
                DRI_CONF_ENUM(1,"Application preference, default interval 0") \
 | 
			
		||||
                DRI_CONF_ENUM(2,"Application preference, default interval 1") \
 | 
			
		||||
                DRI_CONF_ENUM(3,"Application preference, always synchronize with refresh") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
        DRI_CONF_DESC_BEGIN(de,"Synchronisation mit dem vertikalen Bildaufbau (swap intervals)") \
 | 
			
		||||
                DRI_CONF_ENUM(0,"Niemals, immer die maximale Framerate") \
 | 
			
		||||
                DRI_CONF_ENUM(1,"Anwendung entscheidet, Standardinterval 0") \
 | 
			
		||||
                DRI_CONF_ENUM(2,"Anwendung entscheidet, Standardinterval 1") \
 | 
			
		||||
                DRI_CONF_ENUM(3,"Anwendung entscheidet, immer mit Bildaufbau synchronisieren") \
 | 
			
		||||
        DRI_CONF_DESC_END \
 | 
			
		||||
DRI_CONF_OPT_END
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
# $Id: Makefile.X11,v 1.2 2003/08/23 04:58:24 jonsmirl Exp $
 | 
			
		||||
# $Id: Makefile.X11,v 1.2.2.1 2003/11/21 15:49:29 keithw Exp $
 | 
			
		||||
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.0
 | 
			
		||||
@@ -57,6 +57,10 @@ fb_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11
 | 
			
		||||
	rm -f $(TOP)/lib/fb_dri.so && \
 | 
			
		||||
	install fb_dri.so $(TOP)/lib/fb_dri.so
 | 
			
		||||
 | 
			
		||||
$(TOP)/lib/fb_dri.so:	fb_dri.so
 | 
			
		||||
	rm -f $(TOP)/lib/fb_dri.so && \
 | 
			
		||||
	install fb_dri.so $(TOP)/lib/fb_dri.so
 | 
			
		||||
 | 
			
		||||
# Run 'make -f Makefile.X11 dep' to update the dependencies if you change
 | 
			
		||||
# what's included by any source file.
 | 
			
		||||
depend: $(C_SOURCES) $(ASM_SOURCES)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: fb_dri.c,v 1.2 2003/10/08 01:53:30 kendallb Exp $ */
 | 
			
		||||
/* $Id: fb_dri.c,v 1.1.2.1 2003/11/21 15:49:29 keithw Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Mesa 3-D graphics library
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										123
									
								
								src/mesa/drivers/dri/gamma/Makefile.X11
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/mesa/drivers/dri/gamma/Makefile.X11
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,123 @@
 | 
			
		||||
# $Id: Makefile.X11,v 1.2.2.1 2003/11/21 15:49:29 keithw Exp $
 | 
			
		||||
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.0
 | 
			
		||||
# Copyright (C) 1995-2002  Brian Paul
 | 
			
		||||
 | 
			
		||||
TOP = ../../../../..
 | 
			
		||||
 | 
			
		||||
default: linux-solo
 | 
			
		||||
 | 
			
		||||
SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
 | 
			
		||||
MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
 | 
			
		||||
 | 
			
		||||
DEFINES += \
 | 
			
		||||
	-D_HAVE_SWRAST=1 \
 | 
			
		||||
	-D_HAVE_SWTNL=1 \
 | 
			
		||||
	-D_HAVE_SANITY=1 \
 | 
			
		||||
	-D_HAVE_CODEGEN=1 \
 | 
			
		||||
	-D_HAVE_LIGHTING=1 \
 | 
			
		||||
	-D_HAVE_TEXGEN=1 \
 | 
			
		||||
	-D_HAVE_USERCLIP=1 \
 | 
			
		||||
	-DGLX_DIRECT_RENDERING 
 | 
			
		||||
 | 
			
		||||
# Not yet
 | 
			
		||||
# MINIGLX_SOURCES = server/gamma_dri.c 
 | 
			
		||||
 | 
			
		||||
DRIVER_SOURCES = \
 | 
			
		||||
		gamma_context.c \
 | 
			
		||||
		gamma_dd.c \
 | 
			
		||||
		gamma_inithw.c \
 | 
			
		||||
		gamma_lock.c \
 | 
			
		||||
		gamma_render.c \
 | 
			
		||||
		gamma_screen.c \
 | 
			
		||||
		gamma_span.c \
 | 
			
		||||
		gamma_state.c \
 | 
			
		||||
		gamma_tex.c \
 | 
			
		||||
		gamma_texmem.c \
 | 
			
		||||
		gamma_texstate.c \
 | 
			
		||||
		gamma_tris.c \
 | 
			
		||||
		gamma_vb.c \
 | 
			
		||||
		gamma_xmesa.c \
 | 
			
		||||
		../common/mm.c \
 | 
			
		||||
		../common/utils.c \
 | 
			
		||||
		../common/texmem.c \
 | 
			
		||||
		../common/vblank.c
 | 
			
		||||
 | 
			
		||||
INCLUDES = $(MINIGLX_INCLUDES) \
 | 
			
		||||
	   $(SHARED_INCLUDES)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
C_SOURCES = $(DRIVER_SOURCES) \
 | 
			
		||||
	    $(MINIGLX_SOURCES) 
 | 
			
		||||
 | 
			
		||||
MESA_MODULES = $(TOP)/src/mesa/mesa.a
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ifeq ($(WINDOW_SYSTEM),dri)
 | 
			
		||||
WINOBJ=$(MESABUILDDIR)/dri/dri.a
 | 
			
		||||
WINLIB=
 | 
			
		||||
else
 | 
			
		||||
WINOBJ=
 | 
			
		||||
WINLIB=-L$(MESA)/src/glx/mini
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ASM_SOURCES = 
 | 
			
		||||
OBJECTS = $(C_SOURCES:.c=.o) \
 | 
			
		||||
	  $(ASM_SOURCES:.S=.o) 
 | 
			
		||||
 | 
			
		||||
### Include directories
 | 
			
		||||
 | 
			
		||||
INCLUDE_DIRS = \
 | 
			
		||||
	-I$(TOP)/include \
 | 
			
		||||
	-I$(TOP)/src/mesa \
 | 
			
		||||
	-I$(TOP)/src/mesa/main \
 | 
			
		||||
	-I$(TOP)/src/mesa/glapi \
 | 
			
		||||
	-I$(TOP)/src/mesa/math \
 | 
			
		||||
	-I$(TOP)/src/mesa/transform \
 | 
			
		||||
	-I$(TOP)/src/mesa/swrast \
 | 
			
		||||
	-I$(TOP)/src/mesa/swrast_setup
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##### RULES #####
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 | 
			
		||||
 | 
			
		||||
.S.o:
 | 
			
		||||
	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##### TARGETS #####
 | 
			
		||||
 | 
			
		||||
targets: depend gamma_dri.so
 | 
			
		||||
 | 
			
		||||
gamma_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11
 | 
			
		||||
	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
 | 
			
		||||
	rm -f $(TOP)/lib/gamma_dri.so && \
 | 
			
		||||
	install gamma_dri.so $(TOP)/lib/gamma_dri.so
 | 
			
		||||
 | 
			
		||||
$(TOP)/lib/gamma_dri.so:	gamma_dri.so
 | 
			
		||||
	rm -f $(TOP)/lib/gamma_dri.so && \
 | 
			
		||||
	install gamma_dri.so $(TOP)/lib/gamma_dri.so
 | 
			
		||||
 | 
			
		||||
# Run 'make -f Makefile.X11 dep' to update the dependencies if you change
 | 
			
		||||
# what's included by any source file.
 | 
			
		||||
depend: $(C_SOURCES) $(ASM_SOURCES)
 | 
			
		||||
	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
 | 
			
		||||
		$(C_SOURCES) $(ASM_SOURCES)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Emacs tags
 | 
			
		||||
tags:
 | 
			
		||||
	etags `find . -name \*.[ch]` `find ../include`
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Remove .o and backup files
 | 
			
		||||
clean:
 | 
			
		||||
	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
include $(TOP)/Make-config
 | 
			
		||||
 | 
			
		||||
include depend
 | 
			
		||||
@@ -48,9 +48,9 @@
 | 
			
		||||
#include "gamma_vb.h"
 | 
			
		||||
#include "gamma_tris.h"
 | 
			
		||||
 | 
			
		||||
extern const struct gl_pipeline_stage _gamma_render_stage;
 | 
			
		||||
extern const struct tnl_pipeline_stage _gamma_render_stage;
 | 
			
		||||
 | 
			
		||||
static const struct gl_pipeline_stage *gamma_pipeline[] = {
 | 
			
		||||
static const struct tnl_pipeline_stage *gamma_pipeline[] = {
 | 
			
		||||
   &_tnl_vertex_transform_stage,
 | 
			
		||||
   &_tnl_normal_transform_stage,
 | 
			
		||||
   &_tnl_lighting_stage,
 | 
			
		||||
 
 | 
			
		||||
@@ -46,18 +46,15 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
 | 
			
		||||
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
 | 
			
		||||
   GLfloat (*coord)[4];
 | 
			
		||||
   GLuint coord_stride;
 | 
			
		||||
   GLubyte (*col)[4];
 | 
			
		||||
   GLfloat (*col)[4];
 | 
			
		||||
   GLuint col_stride;
 | 
			
		||||
   int i;
 | 
			
		||||
   GLuint tc0_stride = 0;
 | 
			
		||||
   GLfloat (*tc0)[4] = 0;
 | 
			
		||||
   GLuint tc0_size = 0;
 | 
			
		||||
 | 
			
		||||
   if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) 
 | 
			
		||||
      gamma_import_float_colors( ctx );
 | 
			
		||||
   
 | 
			
		||||
   col = VB->ColorPtr[0]->Ptr;
 | 
			
		||||
   col_stride = VB->ColorPtr[0]->StrideB;
 | 
			
		||||
   col = VB->ColorPtr[0]->data;
 | 
			
		||||
   col_stride = VB->ColorPtr[0]->stride;
 | 
			
		||||
 | 
			
		||||
   if (ctx->Texture.Unit[0]._ReallyEnabled) {
 | 
			
		||||
      tc0_stride = VB->TexCoordPtr[0]->stride;
 | 
			
		||||
@@ -70,58 +67,8 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
 | 
			
		||||
      coord_stride = VB->NdcPtr->stride;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (VB->importable_data) {
 | 
			
		||||
      if (start) {
 | 
			
		||||
         coord =  (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride);
 | 
			
		||||
         STRIDE_4UB(col, start * col_stride);
 | 
			
		||||
         if (ctx->Texture.Unit[0]._ReallyEnabled)
 | 
			
		||||
	    tc0 =  (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
 | 
			
		||||
         for (i=start; i < end; i++) {
 | 
			
		||||
	    CHECK_DMA_BUFFER(gmesa, 9);
 | 
			
		||||
	    WRITEF(gmesa->buf, Tq4, tc0[0][3]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Tr4, tc0[0][2]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Tt4, tc0[0][0]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Ts4, tc0[0][1]);
 | 
			
		||||
	    WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vw, coord[0][3]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vz, coord[0][2]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vy, coord[0][1]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vx4, coord[0][0]);
 | 
			
		||||
	    STRIDE_4UB(col, col_stride);	    
 | 
			
		||||
	    tc0 =  (GLfloat (*)[4])((GLubyte *)tc0 +  tc0_stride);
 | 
			
		||||
	    coord =  (GLfloat (*)[4])((GLubyte *)coord +  coord_stride);
 | 
			
		||||
         }
 | 
			
		||||
      } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
 | 
			
		||||
         for (i=start; i < end; i++) {
 | 
			
		||||
	    CHECK_DMA_BUFFER(gmesa, 7);
 | 
			
		||||
	    WRITEF(gmesa->buf, Tt2, tc0[0][0]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Ts2, tc0[0][1]);
 | 
			
		||||
	    WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vw, coord[0][3]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vz, coord[0][2]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vy, coord[0][1]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vx4, coord[0][0]);
 | 
			
		||||
	    STRIDE_4UB(col, col_stride);	    
 | 
			
		||||
	    tc0 =  (GLfloat (*)[4])((GLubyte *)tc0 +  tc0_stride);
 | 
			
		||||
	    coord =  (GLfloat (*)[4])((GLubyte *)coord +  coord_stride);
 | 
			
		||||
         }
 | 
			
		||||
      } else {
 | 
			
		||||
         for (i=start; i < end; i++) {
 | 
			
		||||
	    CHECK_DMA_BUFFER(gmesa, 4);
 | 
			
		||||
	    WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vz, coord[0][2]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vy, coord[0][1]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vx3, coord[0][0]);
 | 
			
		||||
	    STRIDE_4UB(col, col_stride);	    
 | 
			
		||||
	    coord =  (GLfloat (*)[4])((GLubyte *)coord +  coord_stride);
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   } else {
 | 
			
		||||
      if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
 | 
			
		||||
         for (i=start; i < end; i++) {
 | 
			
		||||
   if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
 | 
			
		||||
      for (i=start; i < end; i++) {
 | 
			
		||||
	    CHECK_DMA_BUFFER(gmesa, 9);
 | 
			
		||||
	    WRITEF(gmesa->buf, Tq4, tc0[i][3]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Tr4, tc0[i][2]);
 | 
			
		||||
@@ -132,9 +79,9 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
 | 
			
		||||
	    WRITEF(gmesa->buf, Vz, coord[i][2]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vy, coord[i][1]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vx4, coord[i][0]);
 | 
			
		||||
         }
 | 
			
		||||
      } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
 | 
			
		||||
         for (i=start; i < end; i++) {
 | 
			
		||||
      }
 | 
			
		||||
   } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
 | 
			
		||||
      for (i=start; i < end; i++) {
 | 
			
		||||
	    CHECK_DMA_BUFFER(gmesa, 7);
 | 
			
		||||
	    WRITEF(gmesa->buf, Tt2, tc0[i][0]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Ts2, tc0[i][1]);
 | 
			
		||||
@@ -143,15 +90,14 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
 | 
			
		||||
	    WRITEF(gmesa->buf, Vz, coord[i][2]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vy, coord[i][1]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vx4, coord[i][0]);
 | 
			
		||||
         }
 | 
			
		||||
      } else {
 | 
			
		||||
         for (i=start; i < end; i++) {
 | 
			
		||||
      }
 | 
			
		||||
   } else {
 | 
			
		||||
      for (i=start; i < end; i++) {
 | 
			
		||||
	    CHECK_DMA_BUFFER(gmesa, 4);
 | 
			
		||||
	    WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vz, coord[i][2]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vy, coord[i][1]);
 | 
			
		||||
	    WRITEF(gmesa->buf, Vx3, coord[i][0]);
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
@@ -178,7 +124,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
 | 
			
		||||
   tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
 | 
			
		||||
   tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
 | 
			
		||||
   tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
 | 
			
		||||
   GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
 | 
			
		||||
   GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const GLuint hw_prim[GL_POLYGON+1] = {
 | 
			
		||||
@@ -236,7 +182,7 @@ static __inline void gammaEndPrimitive( gammaContextPtr gmesa )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static GLboolean gamma_run_render( GLcontext *ctx,
 | 
			
		||||
				  struct gl_pipeline_stage *stage )
 | 
			
		||||
				  struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
 | 
			
		||||
   TNLcontext *tnl = TNL_CONTEXT(ctx);
 | 
			
		||||
@@ -256,12 +202,16 @@ static GLboolean gamma_run_render( GLcontext *ctx,
 | 
			
		||||
 | 
			
		||||
   tnl->Driver.Render.Start( ctx );
 | 
			
		||||
 | 
			
		||||
   for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
 | 
			
		||||
   for (i = 0 ; i < VB->PrimitiveCount ; i++)
 | 
			
		||||
   {
 | 
			
		||||
      flags = VB->Primitive[i];
 | 
			
		||||
      length = VB->PrimitiveLength[i];
 | 
			
		||||
      if (length)
 | 
			
		||||
	 tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
 | 
			
		||||
      GLuint prim = VB->Primitive[i].mode;
 | 
			
		||||
      GLuint start = VB->Primitive[i].start;
 | 
			
		||||
      GLuint length = VB->Primitive[i].count;
 | 
			
		||||
 | 
			
		||||
      if (!length)
 | 
			
		||||
	 continue;
 | 
			
		||||
 | 
			
		||||
      tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   tnl->Driver.Render.Finish( ctx );
 | 
			
		||||
@@ -271,9 +221,9 @@ static GLboolean gamma_run_render( GLcontext *ctx,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void gamma_check_render( GLcontext *ctx,
 | 
			
		||||
				 struct gl_pipeline_stage *stage )
 | 
			
		||||
				 struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
 | 
			
		||||
   GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
 | 
			
		||||
 | 
			
		||||
   if (ctx->RenderMode == GL_RENDER) {
 | 
			
		||||
      if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
 | 
			
		||||
@@ -293,13 +243,13 @@ static void gamma_check_render( GLcontext *ctx,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void dtr( struct gl_pipeline_stage *stage )
 | 
			
		||||
static void dtr( struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   (void)stage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const struct gl_pipeline_stage _gamma_render_stage =
 | 
			
		||||
const struct tnl_pipeline_stage _gamma_render_stage =
 | 
			
		||||
{
 | 
			
		||||
   "gamma render",
 | 
			
		||||
   (_DD_NEW_SEPARATE_SPECULAR |
 | 
			
		||||
 
 | 
			
		||||
@@ -278,7 +278,7 @@ void gammaBuildVertices( GLcontext *ctx,
 | 
			
		||||
   if (!newinputs)
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
   if (newinputs & VERT_BIT_CLIP) {
 | 
			
		||||
   if (newinputs & VERT_BIT_POS) {
 | 
			
		||||
      setup_tab[gmesa->SetupIndex].emit( ctx, start, count, v, stride );
 | 
			
		||||
   } else {
 | 
			
		||||
      GLuint ind = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
 | 
			
		||||
      gmesa->glCtx->DriverCtx = NULL;
 | 
			
		||||
      _mesa_destroy_context(gmesa->glCtx);
 | 
			
		||||
 | 
			
		||||
      Xfree(gmesa);
 | 
			
		||||
      FREE(gmesa);
 | 
			
		||||
      driContextPriv->driverPrivate = NULL;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
# $Id: Makefile.X11,v 1.1 2003/09/30 10:54:15 alanh Exp $
 | 
			
		||||
# $Id: Makefile.X11,v 1.1.2.1 2003/11/21 15:49:29 keithw Exp $
 | 
			
		||||
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.0
 | 
			
		||||
@@ -94,6 +94,10 @@ i810_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11
 | 
			
		||||
	rm -f $(TOP)/lib/i810_dri.so && \
 | 
			
		||||
	install i810_dri.so $(TOP)/lib/i810_dri.so
 | 
			
		||||
 | 
			
		||||
$(TOP)/lib/i810_dri.so:	i810_dri.so
 | 
			
		||||
	rm -f $(TOP)/lib/i810_dri.so && \
 | 
			
		||||
	install i810_dri.so $(TOP)/lib/i810_dri.so
 | 
			
		||||
 | 
			
		||||
# Run 'make -f Makefile.X11 dep' to update the dependencies if you change
 | 
			
		||||
# what's included by any source file.
 | 
			
		||||
depend: $(C_SOURCES) $(ASM_SOURCES)
 | 
			
		||||
 
 | 
			
		||||
@@ -107,9 +107,9 @@ static const char * const card_extensions[] =
 | 
			
		||||
   NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern const struct gl_pipeline_stage _i810_render_stage;
 | 
			
		||||
extern const struct tnl_pipeline_stage _i810_render_stage;
 | 
			
		||||
 | 
			
		||||
static const struct gl_pipeline_stage *i810_pipeline[] = {
 | 
			
		||||
static const struct tnl_pipeline_stage *i810_pipeline[] = {
 | 
			
		||||
   &_tnl_vertex_transform_stage,
 | 
			
		||||
   &_tnl_normal_transform_stage,
 | 
			
		||||
   &_tnl_lighting_stage,
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
 | 
			
		||||
   tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
 | 
			
		||||
   tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, 
 | 
			
		||||
							  count, flags );
 | 
			
		||||
   I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
 | 
			
		||||
   I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -137,12 +137,12 @@ static void VERT_FALLBACK( GLcontext *ctx,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static GLboolean i810_run_render( GLcontext *ctx,
 | 
			
		||||
				  struct gl_pipeline_stage *stage )
 | 
			
		||||
				  struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   i810ContextPtr imesa = I810_CONTEXT(ctx);
 | 
			
		||||
   TNLcontext *tnl = TNL_CONTEXT(ctx);
 | 
			
		||||
   struct vertex_buffer *VB = &tnl->vb;
 | 
			
		||||
   GLuint i, length, flags = 0;
 | 
			
		||||
   GLuint i;
 | 
			
		||||
 | 
			
		||||
   /* Don't handle clipping or indexed vertices.
 | 
			
		||||
    */
 | 
			
		||||
@@ -150,17 +150,21 @@ static GLboolean i810_run_render( GLcontext *ctx,
 | 
			
		||||
      return GL_TRUE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   imesa->SetupNewInputs = VERT_BIT_CLIP;
 | 
			
		||||
   imesa->SetupNewInputs = VERT_BIT_POS;
 | 
			
		||||
 | 
			
		||||
   tnl->Driver.Render.Start( ctx );
 | 
			
		||||
 | 
			
		||||
   for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
 | 
			
		||||
   for (i = 0 ; i < VB->PrimitiveCount ; i++)
 | 
			
		||||
   {
 | 
			
		||||
      flags = VB->Primitive[i];
 | 
			
		||||
      length= VB->PrimitiveLength[i];
 | 
			
		||||
      if (length)
 | 
			
		||||
	 i810_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
 | 
			
		||||
							flags );
 | 
			
		||||
      GLuint prim = VB->Primitive[i].mode;
 | 
			
		||||
      GLuint start = VB->Primitive[i].start;
 | 
			
		||||
      GLuint length = VB->Primitive[i].count;
 | 
			
		||||
 | 
			
		||||
      if (!length)
 | 
			
		||||
	 continue;
 | 
			
		||||
 | 
			
		||||
      i810_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
 | 
			
		||||
						    prim );
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   tnl->Driver.Render.Finish( ctx );
 | 
			
		||||
@@ -169,9 +173,9 @@ static GLboolean i810_run_render( GLcontext *ctx,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
 | 
			
		||||
static void i810_check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
 | 
			
		||||
   GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
 | 
			
		||||
 | 
			
		||||
   if (ctx->RenderMode == GL_RENDER) {
 | 
			
		||||
      if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
 | 
			
		||||
@@ -191,13 +195,13 @@ static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void dtr( struct gl_pipeline_stage *stage )
 | 
			
		||||
static void dtr( struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   (void)stage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const struct gl_pipeline_stage _i810_render_stage =
 | 
			
		||||
const struct tnl_pipeline_stage _i810_render_stage =
 | 
			
		||||
{
 | 
			
		||||
   "i810 render",
 | 
			
		||||
   (_DD_NEW_SEPARATE_SPECULAR |
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
#include "imports.h"
 | 
			
		||||
#include "context.h"
 | 
			
		||||
#include "matrix.h"
 | 
			
		||||
#include "simple_list.h"
 | 
			
		||||
@@ -68,12 +69,12 @@ static drmBufMapPtr i810_create_empty_buffers(void)
 | 
			
		||||
{
 | 
			
		||||
   drmBufMapPtr retval;
 | 
			
		||||
 | 
			
		||||
   retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap));
 | 
			
		||||
   retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap), 32);
 | 
			
		||||
   if(retval == NULL) return NULL;
 | 
			
		||||
   memset(retval, 0, sizeof(drmBufMap));
 | 
			
		||||
   retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR);
 | 
			
		||||
   retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR, 32);
 | 
			
		||||
   if(retval->list == NULL) {
 | 
			
		||||
      Xfree(retval);
 | 
			
		||||
      ALIGN_FREE(retval);
 | 
			
		||||
      return NULL;
 | 
			
		||||
   }
 | 
			
		||||
   memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR);
 | 
			
		||||
@@ -143,7 +144,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
   i810Screen->bufs = i810_create_empty_buffers();
 | 
			
		||||
   if (i810Screen->bufs == NULL) {
 | 
			
		||||
      __driUtilMessage("i810InitDriver: i810_create_empty_buffers() failed");
 | 
			
		||||
      Xfree(i810Screen);
 | 
			
		||||
      FREE(i810Screen);
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -154,7 +155,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
	      i810Screen->back.handle,
 | 
			
		||||
	      i810Screen->back.size,
 | 
			
		||||
	      (drmAddress *)&i810Screen->back.map) != 0) {
 | 
			
		||||
      Xfree(i810Screen);
 | 
			
		||||
      FREE(i810Screen);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      __driUtilMessage("i810InitDriver: drmMap failed");
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
@@ -167,7 +168,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
	      i810Screen->depth.handle,
 | 
			
		||||
	      i810Screen->depth.size,
 | 
			
		||||
	      (drmAddress *)&i810Screen->depth.map) != 0) {
 | 
			
		||||
      Xfree(i810Screen);
 | 
			
		||||
      FREE(i810Screen);
 | 
			
		||||
      drmUnmap(i810Screen->back.map, i810Screen->back.size);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      __driUtilMessage("i810InitDriver: drmMap (2) failed");
 | 
			
		||||
@@ -181,7 +182,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
	      i810Screen->tex.handle,
 | 
			
		||||
	      i810Screen->tex.size,
 | 
			
		||||
	      (drmAddress *)&i810Screen->tex.map) != 0) {
 | 
			
		||||
      Xfree(i810Screen);
 | 
			
		||||
      FREE(i810Screen);
 | 
			
		||||
      drmUnmap(i810Screen->back.map, i810Screen->back.size);
 | 
			
		||||
      drmUnmap(i810Screen->depth.map, i810Screen->depth.size);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
@@ -205,7 +206,7 @@ i810DestroyScreen(__DRIscreenPrivate *sPriv)
 | 
			
		||||
   drmUnmap(i810Screen->depth.map, i810Screen->depth.size);
 | 
			
		||||
   drmUnmap(i810Screen->tex.map, i810Screen->tex.size);
 | 
			
		||||
 | 
			
		||||
   Xfree(i810Screen);
 | 
			
		||||
   FREE(i810Screen);
 | 
			
		||||
   sPriv->private = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -383,7 +383,7 @@ void i810BuildVertices( GLcontext *ctx,
 | 
			
		||||
   if (!newinputs)
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
   if (newinputs & VERT_BIT_CLIP) {
 | 
			
		||||
   if (newinputs & VERT_BIT_POS) {
 | 
			
		||||
      setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
 | 
			
		||||
   } else {
 | 
			
		||||
      GLuint ind = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
# $Id: Makefile.X11,v 1.2 2003/09/30 11:05:46 alanh Exp $
 | 
			
		||||
# $Id: Makefile.X11,v 1.2.2.1 2003/11/21 15:49:29 keithw Exp $
 | 
			
		||||
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.0
 | 
			
		||||
@@ -95,6 +95,10 @@ i830_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11
 | 
			
		||||
	rm -f $(TOP)/lib/i830_dri.so && \
 | 
			
		||||
	install i830_dri.so $(TOP)/lib/i830_dri.so
 | 
			
		||||
 | 
			
		||||
$(TOP)/lib/i830_dri.so:	i830_dri.so
 | 
			
		||||
	rm -f $(TOP)/lib/i830_dri.so && \
 | 
			
		||||
	install i830_dri.so $(TOP)/lib/i830_dri.so
 | 
			
		||||
 | 
			
		||||
# Run 'make -f Makefile.X11 dep' to update the dependencies if you change
 | 
			
		||||
# what's included by any source file.
 | 
			
		||||
depend: $(C_SOURCES) $(ASM_SOURCES)
 | 
			
		||||
 
 | 
			
		||||
@@ -167,9 +167,9 @@ static const char * const card_extensions[] =
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern const struct gl_pipeline_stage _i830_render_stage;
 | 
			
		||||
extern const struct tnl_pipeline_stage _i830_render_stage;
 | 
			
		||||
 | 
			
		||||
static const struct gl_pipeline_stage *i830_pipeline[] = {
 | 
			
		||||
static const struct tnl_pipeline_stage *i830_pipeline[] = {
 | 
			
		||||
   &_tnl_vertex_transform_stage,
 | 
			
		||||
   &_tnl_normal_transform_stage,
 | 
			
		||||
   &_tnl_lighting_stage,
 | 
			
		||||
 
 | 
			
		||||
@@ -122,7 +122,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
 | 
			
		||||
   tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
 | 
			
		||||
   tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, 
 | 
			
		||||
							  count, flags );
 | 
			
		||||
   I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
 | 
			
		||||
   I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -159,24 +159,27 @@ static GLboolean choose_render( struct vertex_buffer *VB, int bufsz )
 | 
			
		||||
   int nr_rprims = 0;
 | 
			
		||||
   int nr_rverts = 0;
 | 
			
		||||
   int rprim = 0;
 | 
			
		||||
   int i = 0, length, flags = 0;
 | 
			
		||||
   int i;
 | 
			
		||||
 | 
			
		||||
   
 | 
			
		||||
   for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
 | 
			
		||||
      flags = VB->Primitive[i];
 | 
			
		||||
      length = VB->PrimitiveLength[i];
 | 
			
		||||
   for (i = 0 ; i < VB->PrimitiveCount ; i++)
 | 
			
		||||
   {
 | 
			
		||||
      GLuint prim = VB->Primitive[i].mode;
 | 
			
		||||
      GLuint start = VB->Primitive[i].start;
 | 
			
		||||
      GLuint length = VB->Primitive[i].count;
 | 
			
		||||
 | 
			
		||||
      if (!length)
 | 
			
		||||
	 continue;
 | 
			
		||||
 | 
			
		||||
      if (!hw_prim[flags & PRIM_MODE_MASK])
 | 
			
		||||
      if (!hw_prim[prim & PRIM_MODE_MASK])
 | 
			
		||||
	 return GL_FALSE;
 | 
			
		||||
 | 
			
		||||
      nr_prims++;
 | 
			
		||||
      nr_rverts += length * scale_prim[flags & PRIM_MODE_MASK];
 | 
			
		||||
      nr_rverts += length * scale_prim[prim & PRIM_MODE_MASK];
 | 
			
		||||
 | 
			
		||||
      if (reduced_prim[flags&PRIM_MODE_MASK] != rprim) {
 | 
			
		||||
      if (reduced_prim[prim&PRIM_MODE_MASK] != rprim) {
 | 
			
		||||
	 nr_rprims++;
 | 
			
		||||
	 rprim = reduced_prim[flags&PRIM_MODE_MASK];
 | 
			
		||||
	 rprim = reduced_prim[prim&PRIM_MODE_MASK];
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -192,7 +195,7 @@ static GLboolean choose_render( struct vertex_buffer *VB, int bufsz )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static GLboolean i830_run_render( GLcontext *ctx, 
 | 
			
		||||
				 struct gl_pipeline_stage *stage )
 | 
			
		||||
				 struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   i830ContextPtr imesa = I830_CONTEXT(ctx);
 | 
			
		||||
   TNLcontext *tnl = TNL_CONTEXT(ctx);
 | 
			
		||||
@@ -205,16 +208,21 @@ static GLboolean i830_run_render( GLcontext *ctx,
 | 
			
		||||
      return GL_TRUE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   imesa->SetupNewInputs = VERT_BIT_CLIP;
 | 
			
		||||
   imesa->SetupNewInputs = VERT_BIT_POS;
 | 
			
		||||
 | 
			
		||||
   tnl->Driver.Render.Start( ctx );
 | 
			
		||||
   
 | 
			
		||||
   for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
 | 
			
		||||
      flags = VB->Primitive[i];
 | 
			
		||||
      length= VB->PrimitiveLength[i];
 | 
			
		||||
      if (length)
 | 
			
		||||
	 i830_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
 | 
			
		||||
						        flags );
 | 
			
		||||
   for (i = 0 ; i < VB->PrimitiveCount ; i++)
 | 
			
		||||
   {
 | 
			
		||||
      GLuint prim = VB->Primitive[i].mode;
 | 
			
		||||
      GLuint start = VB->Primitive[i].start;
 | 
			
		||||
      GLuint length = VB->Primitive[i].count;
 | 
			
		||||
 | 
			
		||||
      if (!length)
 | 
			
		||||
	 continue;
 | 
			
		||||
 | 
			
		||||
      i830_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
 | 
			
		||||
						    prim );
 | 
			
		||||
   }
 | 
			
		||||
      
 | 
			
		||||
   tnl->Driver.Render.Finish( ctx );
 | 
			
		||||
@@ -224,9 +232,9 @@ static GLboolean i830_run_render( GLcontext *ctx,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void i830_check_render( GLcontext *ctx, 
 | 
			
		||||
			       struct gl_pipeline_stage *stage )
 | 
			
		||||
			       struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
 | 
			
		||||
   GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
 | 
			
		||||
   if (ctx->RenderMode == GL_RENDER) {
 | 
			
		||||
      if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
 | 
			
		||||
	 inputs |= VERT_BIT_COLOR1;
 | 
			
		||||
@@ -244,13 +252,13 @@ static void i830_check_render( GLcontext *ctx,
 | 
			
		||||
   stage->inputs = inputs;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void dtr( struct gl_pipeline_stage *stage )
 | 
			
		||||
static void dtr( struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   (void)stage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const struct gl_pipeline_stage _i830_render_stage =
 | 
			
		||||
const struct tnl_pipeline_stage _i830_render_stage =
 | 
			
		||||
{
 | 
			
		||||
   "i830 render",
 | 
			
		||||
   (_DD_NEW_SEPARATE_SPECULAR |
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ static int i830_malloc_proxy_buf(drmBufMapPtr buffers)
 | 
			
		||||
   drmBufPtr buf;
 | 
			
		||||
   int i;
 | 
			
		||||
 | 
			
		||||
   buffer = ALIGN_MALLOC(I830_DMA_BUF_SZ);
 | 
			
		||||
   buffer = ALIGN_MALLOC(I830_DMA_BUF_SZ, 32);
 | 
			
		||||
   if(buffer == NULL) return -1;
 | 
			
		||||
   for(i = 0; i < I830_DMA_BUF_NR; i++) {
 | 
			
		||||
      buf = &(buffers->list[i]);
 | 
			
		||||
@@ -71,12 +71,12 @@ static drmBufMapPtr i830_create_empty_buffers(void)
 | 
			
		||||
{
 | 
			
		||||
   drmBufMapPtr retval;
 | 
			
		||||
 | 
			
		||||
   retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap));
 | 
			
		||||
   retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap), 32);
 | 
			
		||||
   if(retval == NULL) return NULL;
 | 
			
		||||
   memset(retval, 0, sizeof(drmBufMap));
 | 
			
		||||
   retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I830_DMA_BUF_NR);
 | 
			
		||||
   retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I830_DMA_BUF_NR, 32);
 | 
			
		||||
   if(retval->list == NULL) {
 | 
			
		||||
      Xfree(retval);
 | 
			
		||||
      FREE(retval);
 | 
			
		||||
      return NULL;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -182,7 +182,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
   if(i830Screen->bufs == NULL) {
 | 
			
		||||
      fprintf(stderr,"\nERROR: Failed to create empty buffers in %s \n",
 | 
			
		||||
	      __FUNCTION__);
 | 
			
		||||
      Xfree(i830Screen);
 | 
			
		||||
      FREE(i830Screen);
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -203,7 +203,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
	      (drmAddress *)&i830Screen->back.map) != 0) {
 | 
			
		||||
      fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
 | 
			
		||||
	      __LINE__, __FUNCTION__, __FILE__);
 | 
			
		||||
      Xfree(i830Screen);
 | 
			
		||||
      FREE(i830Screen);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
   }
 | 
			
		||||
@@ -217,7 +217,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
	      (drmAddress *)&i830Screen->depth.map) != 0) {
 | 
			
		||||
      fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n", 
 | 
			
		||||
	      __LINE__, __FUNCTION__, __FILE__);
 | 
			
		||||
      Xfree(i830Screen);
 | 
			
		||||
      FREE(i830Screen);
 | 
			
		||||
      drmUnmap(i830Screen->back.map, i830Screen->back.size);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
@@ -232,7 +232,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
	      (drmAddress *)&i830Screen->tex.map) != 0) {
 | 
			
		||||
      fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
 | 
			
		||||
	      __LINE__, __FUNCTION__, __FILE__);
 | 
			
		||||
      Xfree(i830Screen);
 | 
			
		||||
      FREE(i830Screen);
 | 
			
		||||
      drmUnmap(i830Screen->back.map, i830Screen->back.size);
 | 
			
		||||
      drmUnmap(i830Screen->depth.map, i830Screen->depth.size);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
@@ -288,7 +288,7 @@ static void i830DestroyScreen(__DRIscreenPrivate *sPriv)
 | 
			
		||||
   drmUnmap(i830Screen->back.map, i830Screen->back.size);
 | 
			
		||||
   drmUnmap(i830Screen->depth.map, i830Screen->depth.size);
 | 
			
		||||
   drmUnmap(i830Screen->tex.map, i830Screen->tex.size);
 | 
			
		||||
   Xfree(i830Screen);
 | 
			
		||||
   FREE(i830Screen);
 | 
			
		||||
   sPriv->private = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -445,7 +445,7 @@ void i830BuildVertices( GLcontext *ctx,
 | 
			
		||||
   if (!newinputs)
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
   if (newinputs & VERT_BIT_CLIP) {
 | 
			
		||||
   if (newinputs & VERT_BIT_POS) {
 | 
			
		||||
      setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
 | 
			
		||||
   } else {
 | 
			
		||||
      GLuint ind = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
# $Id: Makefile.X11,v 1.3 2003/08/24 04:44:23 jonsmirl Exp $
 | 
			
		||||
# $Id: Makefile.X11,v 1.3.2.1 2003/11/21 15:49:29 keithw Exp $
 | 
			
		||||
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.0
 | 
			
		||||
@@ -31,7 +31,8 @@ DRIVER_SOURCES = mgadd.c \
 | 
			
		||||
		 ../common/mm.c \
 | 
			
		||||
		 ../common/utils.c \
 | 
			
		||||
		 ../common/texmem.c \
 | 
			
		||||
		 ../common/vblank.c
 | 
			
		||||
		 ../common/vblank.c \
 | 
			
		||||
		 ../common/xmlconfig.c
 | 
			
		||||
 | 
			
		||||
FULL_DRIVER_SOURCES = 	\
 | 
			
		||||
		 mgapixel.c \
 | 
			
		||||
@@ -39,6 +40,7 @@ FULL_DRIVER_SOURCES = 	\
 | 
			
		||||
		 mgatex.c \
 | 
			
		||||
		 mgatexmem.c \
 | 
			
		||||
		 mga_texstate.c \
 | 
			
		||||
		 mga_texcombine.c \
 | 
			
		||||
		 mgavb.c \
 | 
			
		||||
		 mga_xmesa.c
 | 
			
		||||
 | 
			
		||||
@@ -99,6 +101,10 @@ mga_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11
 | 
			
		||||
	rm -f $(TOP)/lib/mga_dri.so && \
 | 
			
		||||
	install mga_dri.so $(TOP)/lib/mga_dri.so
 | 
			
		||||
 | 
			
		||||
$(TOP)/lib/mga_dri.so:	mga_dri.so
 | 
			
		||||
	rm -f $(TOP)/lib/mga_dri.so && \
 | 
			
		||||
	install mga_dri.so $(TOP)/lib/mga_dri.so
 | 
			
		||||
 | 
			
		||||
# Run 'make -f Makefile.X11 dep' to update the dependencies if you change
 | 
			
		||||
# what's included by any source file.
 | 
			
		||||
depend: $(C_SOURCES) $(ASM_SOURCES)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										647
									
								
								src/mesa/drivers/dri/mga/mga_texcombine.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										647
									
								
								src/mesa/drivers/dri/mga/mga_texcombine.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,647 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2003 Ville Syrjala
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a
 | 
			
		||||
 * copy of this software and associated documentation files (the "Software"),
 | 
			
		||||
 * to deal in the Software without restriction, including without limitation
 | 
			
		||||
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 | 
			
		||||
 * and/or sell copies of the Software, and to permit persons to whom the
 | 
			
		||||
 * Software is furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 | 
			
		||||
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 | 
			
		||||
 * DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 *
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *    Ville Syrjala <syrjala@sci.fi>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
 | 
			
		||||
#include "mgacontext.h"
 | 
			
		||||
#include "mgatex.h"
 | 
			
		||||
#include "mgaregs.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * GL_ARB_texture_env_combine
 | 
			
		||||
 * GL_EXT_texture_env_combine
 | 
			
		||||
 * GL_ARB_texture_env_crossbar
 | 
			
		||||
 * GL_ATI_texture_env_combine3
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define ARG_DISABLE 0xffffffff
 | 
			
		||||
#define MGA_ARG1  0
 | 
			
		||||
#define MGA_ARG2  1
 | 
			
		||||
#define MGA_ALPHA 2
 | 
			
		||||
 | 
			
		||||
GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
 | 
			
		||||
{
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
 | 
			
		||||
   const int source = mmesa->tmu_source[unit];
 | 
			
		||||
   const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
 | 
			
		||||
   GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
 | 
			
		||||
   GLuint numColorArgs = 0, numAlphaArgs = 0;
 | 
			
		||||
   GLuint arg1[3], arg2[3], alpha[3];
 | 
			
		||||
   int args[3];
 | 
			
		||||
   int i;
 | 
			
		||||
 | 
			
		||||
   switch (texUnit->CombineModeRGB) {
 | 
			
		||||
   case GL_REPLACE:
 | 
			
		||||
      numColorArgs = 1;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_MODULATE:
 | 
			
		||||
   case GL_ADD:
 | 
			
		||||
   case GL_ADD_SIGNED:
 | 
			
		||||
   case GL_SUBTRACT:
 | 
			
		||||
      numColorArgs = 2;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_INTERPOLATE:
 | 
			
		||||
   case GL_MODULATE_ADD_ATI:
 | 
			
		||||
   case GL_MODULATE_SIGNED_ADD_ATI:
 | 
			
		||||
   case GL_MODULATE_SUBTRACT_ATI:
 | 
			
		||||
      numColorArgs = 3;
 | 
			
		||||
      break;
 | 
			
		||||
   default:
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   switch (texUnit->CombineModeA) {
 | 
			
		||||
   case GL_REPLACE:
 | 
			
		||||
      numAlphaArgs = 1;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_MODULATE:
 | 
			
		||||
   case GL_ADD:
 | 
			
		||||
   case GL_ADD_SIGNED:
 | 
			
		||||
   case GL_SUBTRACT:
 | 
			
		||||
      numAlphaArgs = 2;
 | 
			
		||||
      break;
 | 
			
		||||
   default:
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   /* Start fresh :) */
 | 
			
		||||
   *reg = 0;
 | 
			
		||||
 | 
			
		||||
   /* COLOR */
 | 
			
		||||
   for (i = 0; i < 3; i++) {
 | 
			
		||||
      arg1[i] = 0;
 | 
			
		||||
      arg2[i] = 0;
 | 
			
		||||
      alpha[i] = 0;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   for (i = 0;i < numColorArgs; i++) {
 | 
			
		||||
      switch (texUnit->CombineSourceRGB[i]) {
 | 
			
		||||
      case GL_TEXTURE:
 | 
			
		||||
         arg1[i] |= 0;
 | 
			
		||||
         arg2[i] |= ARG_DISABLE;
 | 
			
		||||
         alpha[i] |= TD0_color_alpha_currtex;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_TEXTURE0:
 | 
			
		||||
         if (source == 0) {
 | 
			
		||||
            arg1[i] |= 0;
 | 
			
		||||
            arg2[i] |= ARG_DISABLE;
 | 
			
		||||
            alpha[i] |= TD0_color_alpha_currtex;
 | 
			
		||||
         } else {
 | 
			
		||||
            if (ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
               /* disable texturing */
 | 
			
		||||
               mmesa->setup.dwgctl &= DC_opcod_MASK;
 | 
			
		||||
               mmesa->setup.dwgctl |= DC_opcod_trap;
 | 
			
		||||
               mmesa->hw.alpha_sel = AC_alphasel_diffused;
 | 
			
		||||
               /* return GL_TRUE since we don't need a fallback */
 | 
			
		||||
               return GL_TRUE;
 | 
			
		||||
            }
 | 
			
		||||
            arg1[i] |= ARG_DISABLE;
 | 
			
		||||
            arg2[i] |= ARG_DISABLE;
 | 
			
		||||
            alpha[i] |= TD0_color_alpha_prevtex;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_TEXTURE1:
 | 
			
		||||
         if (source == 0) {
 | 
			
		||||
            if (ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
               /* disable texturing */
 | 
			
		||||
               mmesa->setup.dwgctl &= DC_opcod_MASK;
 | 
			
		||||
               mmesa->setup.dwgctl |= DC_opcod_trap;
 | 
			
		||||
               mmesa->hw.alpha_sel = AC_alphasel_diffused;
 | 
			
		||||
               /* return GL_TRUE since we don't need a fallback */
 | 
			
		||||
               return GL_TRUE;
 | 
			
		||||
            }
 | 
			
		||||
            arg1[i] |= ARG_DISABLE;
 | 
			
		||||
            /* G400 specs (TDUALSTAGE0) */
 | 
			
		||||
            arg2[i] |= TD0_color_arg2_prevstage;
 | 
			
		||||
            alpha[i] |= TD0_color_alpha_prevstage;
 | 
			
		||||
         } else {
 | 
			
		||||
            arg1[i] |= 0;
 | 
			
		||||
            arg2[i] |= ARG_DISABLE;
 | 
			
		||||
            alpha[i] |= TD0_color_alpha_currtex;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_CONSTANT:
 | 
			
		||||
         arg1[i] |= ARG_DISABLE;
 | 
			
		||||
         arg2[i] |= TD0_color_arg2_fcol;
 | 
			
		||||
         alpha[i] |= TD0_color_alpha_fcol;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_PRIMARY_COLOR:
 | 
			
		||||
         arg1[i] |= ARG_DISABLE;
 | 
			
		||||
         /* G400 specs (TDUALSTAGE1) */
 | 
			
		||||
         if (unit == 0 || (mmesa->setup.tdualstage0 &
 | 
			
		||||
                           ((TD0_color_sel_mul & TD0_color_sel_add) |
 | 
			
		||||
                            (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) {
 | 
			
		||||
            arg2[i] |= TD0_color_arg2_diffuse;
 | 
			
		||||
            alpha[i] |= TD0_color_alpha_diffuse;
 | 
			
		||||
         } else {
 | 
			
		||||
            arg2[i] |= ARG_DISABLE;
 | 
			
		||||
            alpha[i] |= ARG_DISABLE;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_PREVIOUS:
 | 
			
		||||
         arg1[i] |= ARG_DISABLE;
 | 
			
		||||
         if (unit == 0) {
 | 
			
		||||
            arg2[i] |= TD0_color_arg2_diffuse;
 | 
			
		||||
            alpha[i] |= TD0_color_alpha_diffuse;
 | 
			
		||||
         } else {
 | 
			
		||||
            arg2[i] |= TD0_color_arg2_prevstage;
 | 
			
		||||
            alpha[i] |= TD0_color_alpha_prevstage;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      default:
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      switch (texUnit->CombineOperandRGB[i]) {
 | 
			
		||||
      case GL_SRC_COLOR:
 | 
			
		||||
         arg1[i] |= 0;
 | 
			
		||||
         arg2[i] |= 0;
 | 
			
		||||
         alpha[i] |= ARG_DISABLE;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_ONE_MINUS_SRC_COLOR:
 | 
			
		||||
         arg1[i] |= TD0_color_arg1_inv_enable;
 | 
			
		||||
         arg2[i] |= TD0_color_arg2_inv_enable;
 | 
			
		||||
         alpha[i] |= ARG_DISABLE;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_SRC_ALPHA:
 | 
			
		||||
         arg1[i] |= TD0_color_arg1_replicatealpha_enable;
 | 
			
		||||
         arg2[i] |= TD0_color_arg2_replicatealpha_enable;
 | 
			
		||||
         alpha[i] |= 0;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_ONE_MINUS_SRC_ALPHA:
 | 
			
		||||
         arg1[i] |= (TD0_color_arg1_replicatealpha_enable |
 | 
			
		||||
                     TD0_color_arg1_inv_enable);
 | 
			
		||||
         arg2[i] |= (TD0_color_arg2_replicatealpha_enable |
 | 
			
		||||
                     TD0_color_arg2_inv_enable);
 | 
			
		||||
         alpha[i] |= (TD0_color_alpha1inv_enable |
 | 
			
		||||
                      TD0_color_alpha2inv_enable);
 | 
			
		||||
         break;
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   switch (texUnit->CombineModeRGB) {
 | 
			
		||||
   case GL_MODULATE_ADD_ATI:
 | 
			
		||||
   case GL_MODULATE_SIGNED_ADD_ATI:
 | 
			
		||||
      /* Special handling for ATI_texture_env_combine3.
 | 
			
		||||
       * If Arg1 == Arg0 or Arg1 == Arg2 we can use arg1 or arg2 as input for
 | 
			
		||||
       * both multiplier and adder.
 | 
			
		||||
       */
 | 
			
		||||
      /* Arg1 == arg1 */
 | 
			
		||||
      if (arg1[1] == arg1[0]) {
 | 
			
		||||
         if ((arg1[1] | arg2[2]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg1[1] | arg2[2];
 | 
			
		||||
            args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ARG2;
 | 
			
		||||
            break;
 | 
			
		||||
         } else
 | 
			
		||||
         if ((arg1[1] | alpha[2]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg1[1] | alpha[2];
 | 
			
		||||
            args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ALPHA;
 | 
			
		||||
            break;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      if (arg1[1] == arg1[2]) {
 | 
			
		||||
         if ((arg1[1] | arg2[0]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg1[1] | arg2[0];
 | 
			
		||||
            args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ARG1;
 | 
			
		||||
            break;
 | 
			
		||||
         } else
 | 
			
		||||
         if ((arg1[1] | alpha[0]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg1[1] | alpha[0];
 | 
			
		||||
            args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG1;
 | 
			
		||||
            break;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      /* fallthrough */
 | 
			
		||||
   case GL_MODULATE_SUBTRACT_ATI:
 | 
			
		||||
      /* Arg1 == arg2 */
 | 
			
		||||
      if (arg2[1] == arg2[0]) {
 | 
			
		||||
         if ((arg2[1] | arg1[2]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg2[1] | arg1[2];
 | 
			
		||||
            args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ARG1;
 | 
			
		||||
            break;
 | 
			
		||||
         } else
 | 
			
		||||
         if ((arg2[1] | alpha[2]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg2[1] | alpha[2];
 | 
			
		||||
            args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ALPHA;
 | 
			
		||||
            break;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      if (arg2[1] == arg2[2]) {
 | 
			
		||||
         if ((arg2[1] | arg1[0]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg2[1] | arg1[0];
 | 
			
		||||
            args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ARG2;
 | 
			
		||||
            break;
 | 
			
		||||
         } else
 | 
			
		||||
         if ((arg2[1] | alpha[0]) != ARG_DISABLE) {
 | 
			
		||||
            *reg |= arg2[1] | alpha[0];
 | 
			
		||||
            args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG2;
 | 
			
		||||
            break;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      /* fallthrough */
 | 
			
		||||
   default:
 | 
			
		||||
      /* Find working combo of arg1, arg2 and alpha.
 | 
			
		||||
       *
 | 
			
		||||
       * Keep the Arg0 != alpha cases first since there's
 | 
			
		||||
       * no way to get alpha out by itself (GL_REPLACE).
 | 
			
		||||
       *
 | 
			
		||||
       * Keep the Arg2 == alpha cases first because only alpha has the
 | 
			
		||||
       * capabilities to function as Arg2 (GL_INTERPOLATE). Also good for 
 | 
			
		||||
       * GL_ADD, GL_ADD_SIGNED, GL_SUBTRACT since we can't get alpha to the
 | 
			
		||||
       * adder.
 | 
			
		||||
       *
 | 
			
		||||
       * Keep the Arg1 == alpha cases last for GL_MODULATE_ADD_ATI,
 | 
			
		||||
       * GL_MODULATE_SIGNED_ADD_ATI. Again because we can't get alpha to the
 | 
			
		||||
       * adder.
 | 
			
		||||
       *
 | 
			
		||||
       * GL_MODULATE_SUBTRACT_ATI needs special treatment since it requires
 | 
			
		||||
       * that Arg1 == arg2. This requirement clashes with those of other modes.
 | 
			
		||||
       */
 | 
			
		||||
      if ((arg1[0] | arg2[1] | alpha[2]) != ARG_DISABLE) {
 | 
			
		||||
         *reg |= arg1[0] | arg2[1] | alpha[2];
 | 
			
		||||
         args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ALPHA;
 | 
			
		||||
      } else
 | 
			
		||||
      if ((arg1[1] | arg2[0] | alpha[2]) != ARG_DISABLE &&
 | 
			
		||||
          texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) {
 | 
			
		||||
         *reg |= arg1[1] | arg2[0] | alpha[2];
 | 
			
		||||
         args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ALPHA;
 | 
			
		||||
      } else
 | 
			
		||||
      if ((arg1[1] | arg2[2] | alpha[0]) != ARG_DISABLE &&
 | 
			
		||||
          texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) {
 | 
			
		||||
         *reg |= arg1[1] | arg2[2] | alpha[0];
 | 
			
		||||
         args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG2;
 | 
			
		||||
      } else
 | 
			
		||||
      if ((arg1[2] | arg2[1] | alpha[0]) != ARG_DISABLE) {
 | 
			
		||||
         *reg |= arg1[2] | arg2[1] | alpha[0];
 | 
			
		||||
         args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG1;
 | 
			
		||||
      } else
 | 
			
		||||
      if ((arg1[0] | arg2[2] | alpha[1]) != ARG_DISABLE) {
 | 
			
		||||
         *reg |= arg1[0] | arg2[2] | alpha[1];
 | 
			
		||||
         args[0] = MGA_ARG1; args[1] = MGA_ALPHA; args[2] = MGA_ARG2;
 | 
			
		||||
      } else
 | 
			
		||||
      if ((arg1[2] | arg2[0] | alpha[1]) != ARG_DISABLE) {
 | 
			
		||||
         *reg |= arg1[2] | arg2[0] | alpha[1];
 | 
			
		||||
         args[0] = MGA_ARG2; args[1] = MGA_ALPHA; args[2] = MGA_ARG1;
 | 
			
		||||
      } else {
 | 
			
		||||
         /* nothing suitable */
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   switch (texUnit->CombineModeRGB) {
 | 
			
		||||
   case GL_REPLACE:
 | 
			
		||||
      if (texUnit->CombineScaleShiftRGB) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (args[0] == MGA_ARG1) {
 | 
			
		||||
         *reg |= TD0_color_sel_arg1;
 | 
			
		||||
      } else if (args[0] == MGA_ARG2) {
 | 
			
		||||
         *reg |= TD0_color_sel_arg2;
 | 
			
		||||
      } else if (args[0] == MGA_ALPHA) {
 | 
			
		||||
         /* Can't get alpha out by itself */
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_MODULATE:
 | 
			
		||||
      if (texUnit->CombineScaleShiftRGB == 1) {
 | 
			
		||||
         *reg |= TD0_color_modbright_2x;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftRGB == 2) {
 | 
			
		||||
         *reg |= TD0_color_modbright_4x;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= TD0_color_sel_mul;
 | 
			
		||||
 | 
			
		||||
      if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
 | 
			
		||||
         if (args[0] == MGA_ARG1 || args[1] == MGA_ARG1) {
 | 
			
		||||
            *reg |= TD0_color_arg2mul_alpha2;
 | 
			
		||||
         } else if (args[0] == MGA_ARG2 || args[1] == MGA_ARG2) {
 | 
			
		||||
            *reg |= TD0_color_arg1mul_alpha1;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_ADD_SIGNED:
 | 
			
		||||
      *reg |= TD0_color_addbias_enable;
 | 
			
		||||
      /* fallthrough */
 | 
			
		||||
   case GL_ADD:
 | 
			
		||||
      if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA){
 | 
			
		||||
         /* Can't get alpha to the adder */
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      if (texUnit->CombineScaleShiftRGB == 1) {
 | 
			
		||||
         *reg |= TD0_color_add2x_enable;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftRGB == 2) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= (TD0_color_add_add |
 | 
			
		||||
               TD0_color_sel_add);
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_INTERPOLATE:
 | 
			
		||||
      if (args[2] != MGA_ALPHA) {
 | 
			
		||||
         /* Only alpha can function as Arg2 */
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      if (texUnit->CombineScaleShiftRGB == 1) {
 | 
			
		||||
         *reg |= TD0_color_add2x_enable;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftRGB == 2) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= (TD0_color_arg1mul_alpha1 |
 | 
			
		||||
               TD0_color_blend_enable |
 | 
			
		||||
               TD0_color_arg1add_mulout |
 | 
			
		||||
               TD0_color_arg2add_mulout |
 | 
			
		||||
               TD0_color_add_add |
 | 
			
		||||
               TD0_color_sel_add);
 | 
			
		||||
 | 
			
		||||
      /* Have to do this with xor since GL_ONE_MINUS_SRC_ALPHA may have
 | 
			
		||||
       * already touched this bit.
 | 
			
		||||
       */
 | 
			
		||||
      *reg ^= TD0_color_alpha1inv_enable;
 | 
			
		||||
 | 
			
		||||
      if (args[0] == MGA_ARG2) {
 | 
			
		||||
         /* Swap arguments */
 | 
			
		||||
         *reg ^= (TD0_color_arg1mul_alpha1 |
 | 
			
		||||
                  TD0_color_arg2mul_alpha2 |
 | 
			
		||||
                  TD0_color_alpha1inv_enable |
 | 
			
		||||
                  TD0_color_alpha2inv_enable);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
         /* Linear blending mode needs dualtex enabled */
 | 
			
		||||
         *(reg+1) = (TD0_color_arg2_prevstage |
 | 
			
		||||
                     TD0_color_sel_arg2 |
 | 
			
		||||
                     TD0_alpha_arg2_prevstage |
 | 
			
		||||
                     TD0_alpha_sel_arg2);
 | 
			
		||||
         mmesa->dualtex_env = GL_TRUE;
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_SUBTRACT:
 | 
			
		||||
      if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
 | 
			
		||||
         /* Can't get alpha to the adder */
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      if (texUnit->CombineScaleShiftRGB == 1) {
 | 
			
		||||
         *reg |= TD0_color_add2x_enable;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftRGB == 2) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= (TD0_color_add_sub |
 | 
			
		||||
               TD0_color_sel_add);
 | 
			
		||||
 | 
			
		||||
      if (args[0] == MGA_ARG2) {
 | 
			
		||||
         /* Swap arguments */
 | 
			
		||||
         *reg ^= (TD0_color_arg1_inv_enable |
 | 
			
		||||
                  TD0_color_arg2_inv_enable);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_MODULATE_SIGNED_ADD_ATI:
 | 
			
		||||
      *reg |= TD0_color_addbias_enable;
 | 
			
		||||
      /* fallthrough */
 | 
			
		||||
   case GL_MODULATE_ADD_ATI:
 | 
			
		||||
      if (args[1] == MGA_ALPHA) {
 | 
			
		||||
         /* Can't get alpha to the adder */
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      if (texUnit->CombineScaleShiftRGB == 1) {
 | 
			
		||||
         *reg |= TD0_color_add2x_enable;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftRGB == 2) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= (TD0_color_add_add |
 | 
			
		||||
               TD0_color_sel_add);
 | 
			
		||||
 | 
			
		||||
      if (args[1] == args[0] || args[1] == args[2]) {
 | 
			
		||||
         *reg |= TD0_color_arg1add_mulout;
 | 
			
		||||
         if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA)
 | 
			
		||||
            *reg |= TD0_color_arg1mul_alpha1;
 | 
			
		||||
 | 
			
		||||
         if (args[1] == MGA_ARG1) {
 | 
			
		||||
            /* Swap adder arguments */
 | 
			
		||||
            *reg ^= (TD0_color_arg1add_mulout |
 | 
			
		||||
                     TD0_color_arg2add_mulout);
 | 
			
		||||
            if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA) {
 | 
			
		||||
               /* Swap multiplier arguments */
 | 
			
		||||
               *reg ^= (TD0_color_arg1mul_alpha1 |
 | 
			
		||||
                        TD0_color_arg2mul_alpha2);
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      } else {
 | 
			
		||||
         *reg |= (TD0_color_arg2mul_alpha2 |
 | 
			
		||||
                  TD0_color_arg1add_mulout);
 | 
			
		||||
 | 
			
		||||
         if (args[1] == MGA_ARG1) {
 | 
			
		||||
            /* Swap arguments */
 | 
			
		||||
            *reg ^= (TD0_color_arg1mul_alpha1 |
 | 
			
		||||
                     TD0_color_arg2mul_alpha2 |
 | 
			
		||||
                     TD0_color_arg1add_mulout |
 | 
			
		||||
                     TD0_color_arg2add_mulout);
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_MODULATE_SUBTRACT_ATI:
 | 
			
		||||
      if (args[1] != MGA_ARG2) {
 | 
			
		||||
         /* Can't swap arguments */
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      if (texUnit->CombineScaleShiftRGB == 1) {
 | 
			
		||||
         *reg |= TD0_color_add2x_enable;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftRGB == 2) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= (TD0_color_add_sub |
 | 
			
		||||
               TD0_color_sel_add);
 | 
			
		||||
 | 
			
		||||
      if (args[1] == args[0] || args[1] == args[2]) {
 | 
			
		||||
         *reg |= TD0_color_arg1add_mulout;
 | 
			
		||||
         if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA)
 | 
			
		||||
            *reg |= TD0_color_arg1mul_alpha1;
 | 
			
		||||
      } else {
 | 
			
		||||
         *reg |= (TD0_color_arg2mul_alpha2 |
 | 
			
		||||
                  TD0_color_arg1add_mulout);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   /* ALPHA */
 | 
			
		||||
   for (i = 0; i < 2; i++) {
 | 
			
		||||
      arg1[i] = 0;
 | 
			
		||||
      arg2[i] = 0;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < numAlphaArgs; i++) {
 | 
			
		||||
      switch (texUnit->CombineSourceA[i]) {
 | 
			
		||||
      case GL_TEXTURE:
 | 
			
		||||
         arg1[i] |= 0;
 | 
			
		||||
         arg2[i] |= ARG_DISABLE;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_TEXTURE0:
 | 
			
		||||
         if (source == 0) {
 | 
			
		||||
            arg1[i] |= 0;
 | 
			
		||||
            arg2[i] |= ARG_DISABLE;
 | 
			
		||||
         } else {
 | 
			
		||||
            if (ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
               /* disable texturing */
 | 
			
		||||
               mmesa->setup.dwgctl &= DC_opcod_MASK;
 | 
			
		||||
               mmesa->setup.dwgctl |= DC_opcod_trap;
 | 
			
		||||
               mmesa->hw.alpha_sel = AC_alphasel_diffused;
 | 
			
		||||
               /* return GL_TRUE since we don't need a fallback */
 | 
			
		||||
               return GL_TRUE;
 | 
			
		||||
            }
 | 
			
		||||
            arg1[i] |= ARG_DISABLE;
 | 
			
		||||
            arg2[i] |= TD0_alpha_arg2_prevtex;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_TEXTURE1:
 | 
			
		||||
         if (source == 0) {
 | 
			
		||||
            if (ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
               /* disable texturing */
 | 
			
		||||
               mmesa->setup.dwgctl &= DC_opcod_MASK;
 | 
			
		||||
               mmesa->setup.dwgctl |= DC_opcod_trap;
 | 
			
		||||
               mmesa->hw.alpha_sel = AC_alphasel_diffused;
 | 
			
		||||
               /* return GL_TRUE since we don't need a fallback */
 | 
			
		||||
               return GL_TRUE;
 | 
			
		||||
            }
 | 
			
		||||
            arg1[i] |= ARG_DISABLE;
 | 
			
		||||
            /* G400 specs (TDUALSTAGE0) */
 | 
			
		||||
            arg2[i] |= TD0_alpha_arg2_prevstage;
 | 
			
		||||
         } else {
 | 
			
		||||
            arg1[i] |= 0;
 | 
			
		||||
            arg2[i] |= ARG_DISABLE;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_CONSTANT:
 | 
			
		||||
         arg1[i] |= ARG_DISABLE;
 | 
			
		||||
         arg2[i] |= TD0_alpha_arg2_fcol;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_PRIMARY_COLOR:
 | 
			
		||||
         arg1[i] |= ARG_DISABLE;
 | 
			
		||||
         /* G400 specs (TDUALSTAGE1) */
 | 
			
		||||
         if (unit == 0 || (mmesa->setup.tdualstage0 &
 | 
			
		||||
                           ((TD0_color_sel_mul & TD0_color_sel_add) |
 | 
			
		||||
                            (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) {
 | 
			
		||||
            arg2[i] |= TD0_alpha_arg2_diffuse;
 | 
			
		||||
         } else {
 | 
			
		||||
            arg2[i] |= ARG_DISABLE;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_PREVIOUS:
 | 
			
		||||
         arg1[i] |= ARG_DISABLE;
 | 
			
		||||
         if (unit == 0) {
 | 
			
		||||
            arg2[i] |= TD0_alpha_arg2_diffuse;
 | 
			
		||||
         } else {
 | 
			
		||||
            arg2[i] |= TD0_alpha_arg2_prevstage;
 | 
			
		||||
         }
 | 
			
		||||
         break;
 | 
			
		||||
      default:
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      switch (texUnit->CombineOperandA[i]) {
 | 
			
		||||
      case GL_SRC_ALPHA:
 | 
			
		||||
         arg1[i] |= 0;
 | 
			
		||||
         arg2[i] |= 0;
 | 
			
		||||
         break;
 | 
			
		||||
      case GL_ONE_MINUS_SRC_ALPHA:
 | 
			
		||||
         arg1[i] |= TD0_alpha_arg1_inv_enable;
 | 
			
		||||
         arg2[i] |= TD0_alpha_arg2_inv_enable;
 | 
			
		||||
         break;
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   /* Find a working combo of arg1 and arg2 */
 | 
			
		||||
   if ((arg1[0] | arg2[1]) != ARG_DISABLE) {
 | 
			
		||||
      *reg |= arg1[0] | arg2[1];
 | 
			
		||||
      args[0] = MGA_ARG1; args[1] = MGA_ARG2;
 | 
			
		||||
   } else
 | 
			
		||||
   if ((arg1[1] | arg2[0]) != ARG_DISABLE) {
 | 
			
		||||
      *reg |= arg1[1] | arg2[0];
 | 
			
		||||
      args[0] = MGA_ARG2; args[1] = MGA_ARG1;
 | 
			
		||||
   } else {
 | 
			
		||||
      /* nothing suitable */
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   switch (texUnit->CombineModeA) {
 | 
			
		||||
   case GL_REPLACE:
 | 
			
		||||
      if (texUnit->CombineScaleShiftA) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (args[0] == MGA_ARG1){
 | 
			
		||||
         *reg |= TD0_alpha_sel_arg1;
 | 
			
		||||
      } else if (args[0] == MGA_ARG2) {
 | 
			
		||||
         *reg |= TD0_alpha_sel_arg2;
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_MODULATE:
 | 
			
		||||
      if (texUnit->CombineScaleShiftA == 1) {
 | 
			
		||||
         *reg |= TD0_alpha_modbright_2x;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftA == 2) {
 | 
			
		||||
         *reg |= TD0_alpha_modbright_4x;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= TD0_alpha_sel_mul;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_ADD_SIGNED:
 | 
			
		||||
      *reg |= TD0_alpha_addbias_enable;
 | 
			
		||||
      /* fallthrough */
 | 
			
		||||
   case GL_ADD:
 | 
			
		||||
      if (texUnit->CombineScaleShiftA == 1) {
 | 
			
		||||
         *reg |= TD0_alpha_add2x_enable;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftA == 2) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= (TD0_alpha_add_enable |
 | 
			
		||||
               TD0_alpha_sel_add);
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_SUBTRACT:
 | 
			
		||||
      if (texUnit->CombineScaleShiftA == 1) {
 | 
			
		||||
         *reg |= TD0_alpha_add2x_enable;
 | 
			
		||||
      } else if (texUnit->CombineScaleShiftA == 2) {
 | 
			
		||||
         return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      *reg |= (TD0_alpha_add_disable |
 | 
			
		||||
               TD0_alpha_sel_add);
 | 
			
		||||
 | 
			
		||||
      if (args[0] == MGA_ARG2) {
 | 
			
		||||
         /* Swap arguments */
 | 
			
		||||
         *reg ^= (TD0_alpha_arg1_inv_enable |
 | 
			
		||||
                  TD0_alpha_arg2_inv_enable);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   return GL_TRUE;
 | 
			
		||||
}
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
@@ -52,6 +52,8 @@ static const unsigned TMC_tformat[ TMC_nr_tformat ] =
 | 
			
		||||
    [MESA_FORMAT_RGB565]   = TMC_tformat_tw16 | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
    [MESA_FORMAT_ARGB4444] = TMC_tformat_tw12 | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
    [MESA_FORMAT_ARGB1555] = TMC_tformat_tw15 | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
    [MESA_FORMAT_AL88]     = TMC_tformat_tw8al | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
    [MESA_FORMAT_I8]       = TMC_tformat_tw8a | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
    [MESA_FORMAT_CI8]      = TMC_tformat_tw8  | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
    [MESA_FORMAT_YCBCR]     = TMC_tformat_tw422uyvy | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
    [MESA_FORMAT_YCBCR_REV] = TMC_tformat_tw422 | TMC_takey_1 | TMC_tamask_0,
 | 
			
		||||
@@ -67,7 +69,7 @@ mgaSetTexImages( mgaContextPtr mmesa,
 | 
			
		||||
    GLint totalSize;
 | 
			
		||||
    GLint width, height;
 | 
			
		||||
    GLint i;
 | 
			
		||||
    GLint firstLevel, lastLevel, numLevels;
 | 
			
		||||
    GLint numLevels;
 | 
			
		||||
    GLint log2Width, log2Height;
 | 
			
		||||
    GLuint txformat = 0;
 | 
			
		||||
    GLint ofs;
 | 
			
		||||
@@ -81,6 +83,8 @@ mgaSetTexImages( mgaContextPtr mmesa,
 | 
			
		||||
	case MESA_FORMAT_RGB565:   txformat = TMC_tformat_tw16; break;
 | 
			
		||||
	case MESA_FORMAT_ARGB4444: txformat = TMC_tformat_tw12;	break;
 | 
			
		||||
	case MESA_FORMAT_ARGB1555: txformat = TMC_tformat_tw15; break;
 | 
			
		||||
	case MESA_FORMAT_AL88:     txformat = TMC_tformat_tw8al; break;
 | 
			
		||||
	case MESA_FORMAT_I8:       txformat = TMC_tformat_tw8a; break;
 | 
			
		||||
	case MESA_FORMAT_CI8:      txformat = TMC_tformat_tw8;  break;
 | 
			
		||||
        case MESA_FORMAT_YCBCR:    txformat  = TMC_tformat_tw422uyvy; break;
 | 
			
		||||
        case MESA_FORMAT_YCBCR_REV: txformat = TMC_tformat_tw422; break;
 | 
			
		||||
@@ -101,39 +105,21 @@ mgaSetTexImages( mgaContextPtr mmesa,
 | 
			
		||||
 | 
			
		||||
#endif /* MGA_USE_TABLE_FOR_FORMAT */
 | 
			
		||||
 | 
			
		||||
   if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
 | 
			
		||||
      /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
 | 
			
		||||
       */
 | 
			
		||||
   driCalculateTextureFirstLastLevel( (driTextureObject *) t );
 | 
			
		||||
   log2Width  = tObj->Image[t->base.firstLevel]->WidthLog2;
 | 
			
		||||
   log2Height = tObj->Image[t->base.firstLevel]->HeightLog2;
 | 
			
		||||
 | 
			
		||||
      firstLevel = lastLevel = tObj->BaseLevel;
 | 
			
		||||
   } else {
 | 
			
		||||
      /* Compute which mipmap levels we really want to send to the hardware.
 | 
			
		||||
       * This depends on the base image size, GL_TEXTURE_MIN_LOD,
 | 
			
		||||
       * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
 | 
			
		||||
       * Yes, this looks overly complicated, but it's all needed.
 | 
			
		||||
       */
 | 
			
		||||
   width = tObj->Image[t->base.firstLevel]->Width;
 | 
			
		||||
   height = tObj->Image[t->base.firstLevel]->Height;
 | 
			
		||||
 | 
			
		||||
      firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
 | 
			
		||||
      firstLevel = MAX2(firstLevel, tObj->BaseLevel);
 | 
			
		||||
      lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
 | 
			
		||||
      lastLevel = MAX2(lastLevel, tObj->BaseLevel);
 | 
			
		||||
      lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
 | 
			
		||||
      lastLevel = MIN2(lastLevel, tObj->MaxLevel);
 | 
			
		||||
      lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   log2Width = tObj->Image[firstLevel]->WidthLog2;
 | 
			
		||||
   log2Height = tObj->Image[firstLevel]->HeightLog2;
 | 
			
		||||
   width = tObj->Image[firstLevel]->Width;
 | 
			
		||||
   height = tObj->Image[firstLevel]->Height;
 | 
			
		||||
 | 
			
		||||
   numLevels = MIN2( lastLevel - firstLevel + 1,
 | 
			
		||||
   numLevels = MIN2( t->base.lastLevel - t->base.firstLevel + 1,
 | 
			
		||||
                     MGA_IS_G200(mmesa) ? G200_TEX_MAXLEVELS : G400_TEX_MAXLEVELS);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   totalSize = 0;
 | 
			
		||||
   for ( i = 0 ; i < numLevels ; i++ ) {
 | 
			
		||||
      const struct gl_texture_image * const texImage = tObj->Image[i+firstLevel];
 | 
			
		||||
      const struct gl_texture_image * const texImage = 
 | 
			
		||||
	  tObj->Image[ i + t->base.firstLevel ];
 | 
			
		||||
 | 
			
		||||
      if ( (texImage == NULL)
 | 
			
		||||
	   || ((i != 0)
 | 
			
		||||
@@ -149,13 +135,9 @@ mgaSetTexImages( mgaContextPtr mmesa,
 | 
			
		||||
                     baseImage->TexFormat->TexelBytes) + 31) & ~31;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   numLevels = i;
 | 
			
		||||
   lastLevel = firstLevel + numLevels - 1;
 | 
			
		||||
 | 
			
		||||
   /* save these values */
 | 
			
		||||
   t->base.firstLevel = firstLevel;
 | 
			
		||||
   t->base.lastLevel = lastLevel;
 | 
			
		||||
 | 
			
		||||
   numLevels = i;
 | 
			
		||||
   t->base.lastLevel = t->base.firstLevel + numLevels - 1;
 | 
			
		||||
   t->base.totalSize = totalSize;
 | 
			
		||||
 | 
			
		||||
   /* setup hardware register values */
 | 
			
		||||
@@ -225,7 +207,7 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit )
 | 
			
		||||
      t->setup.texctl2 |= TMC_decalblend_enable;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_BLEND:
 | 
			
		||||
      FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE );
 | 
			
		||||
      t->texenv_fallback = GL_TRUE;
 | 
			
		||||
      break;
 | 
			
		||||
   default:
 | 
			
		||||
      break;
 | 
			
		||||
@@ -251,12 +233,124 @@ static const GLuint g400_color_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
      (0),
 | 
			
		||||
 | 
			
		||||
      /* GL_REPLACE
 | 
			
		||||
       * Cv = Cs
 | 
			
		||||
       * Av = Af
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg2 ),
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * Cv = Cf Cs
 | 
			
		||||
       * Av = Af
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_DECAL
 | 
			
		||||
       * Cv = Cs
 | 
			
		||||
       * Av = Af
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_BLEND (Cc=0.0)
 | 
			
		||||
       * Cv = Cf ( 1 - Cs )
 | 
			
		||||
       * Av = Af
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg1_inv_enable |
 | 
			
		||||
       TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_ADD
 | 
			
		||||
       * Cv = Cf + Cs
 | 
			
		||||
       * Av = Af
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_add_add |
 | 
			
		||||
       TD0_color_sel_add |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
   },
 | 
			
		||||
   
 | 
			
		||||
   /* Unit 1:
 | 
			
		||||
    */
 | 
			
		||||
   {
 | 
			
		||||
      /* Disable combiner stage
 | 
			
		||||
       */
 | 
			
		||||
      (0),
 | 
			
		||||
       
 | 
			
		||||
      /* GL_REPLACE
 | 
			
		||||
       * Cv = Cs
 | 
			
		||||
       * Av = Ap
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * Cv = Cp Cs
 | 
			
		||||
       * Av = Ap
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
 | 
			
		||||
      /* GL_DECAL
 | 
			
		||||
       * Cv = Cs
 | 
			
		||||
       * Av = Ap
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_BLEND (Cc=0.0)
 | 
			
		||||
       * Cv = Cp ( 1 - Cs )
 | 
			
		||||
       * Av = Ap
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg1_inv_enable |
 | 
			
		||||
       TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_ADD
 | 
			
		||||
       * Cv = Cp + Cs
 | 
			
		||||
       * Av = Ap
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_add_add |
 | 
			
		||||
       TD0_color_sel_add |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
   },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const GLuint g400_color_alpha_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
{
 | 
			
		||||
   /* Unit 0:
 | 
			
		||||
    */
 | 
			
		||||
   {
 | 
			
		||||
      /* Disable combiner stage
 | 
			
		||||
       */
 | 
			
		||||
      (0),
 | 
			
		||||
 | 
			
		||||
      /* GL_REPLACE
 | 
			
		||||
       * Cv = Cs
 | 
			
		||||
       * Av = As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
       TD0_alpha_sel_arg1),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * Cv = Cf Cs
 | 
			
		||||
       * Av = Af As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
@@ -264,16 +358,35 @@ static const GLuint g400_color_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_DECAL
 | 
			
		||||
       * tmp = Cf ( 1 - As )
 | 
			
		||||
       * Cv = tmp + Cs As
 | 
			
		||||
       * Av = Af
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_alpha_currtex |
 | 
			
		||||
       TD0_color_alpha1inv_enable |
 | 
			
		||||
       TD0_color_arg1mul_alpha1 |
 | 
			
		||||
       TD0_color_blend_enable |
 | 
			
		||||
       TD0_color_arg1add_mulout |
 | 
			
		||||
       TD0_color_arg2add_mulout |
 | 
			
		||||
       TD0_color_add_add |
 | 
			
		||||
       TD0_color_sel_add |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_BLEND
 | 
			
		||||
 | 
			
		||||
      /* GL_BLEND (Cc=0.0)
 | 
			
		||||
       * Cv = Cf ( 1 - Cs )
 | 
			
		||||
       * Av = Af As
 | 
			
		||||
       */
 | 
			
		||||
      (0),
 | 
			
		||||
      (TD0_color_arg1_inv_enable |
 | 
			
		||||
       TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_ADD
 | 
			
		||||
       * Cv = Cf + Cs
 | 
			
		||||
       * Av = Af As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_add_add |
 | 
			
		||||
@@ -290,33 +403,53 @@ static const GLuint g400_color_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
      (0),
 | 
			
		||||
       
 | 
			
		||||
      /* GL_REPLACE
 | 
			
		||||
       * Cv = Cs
 | 
			
		||||
       * Av = As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg2 ),
 | 
			
		||||
       TD0_alpha_sel_arg1),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * Cv = Cp Cs
 | 
			
		||||
       * Av = Ap As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_alpha_prevstage |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
 | 
			
		||||
      /* GL_DECAL
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg1 |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_arg2 ),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_BLEND
 | 
			
		||||
       */
 | 
			
		||||
      (0),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_ADD
 | 
			
		||||
       * tmp = Cp ( 1 - As )
 | 
			
		||||
       * Cv = tmp + Cs As
 | 
			
		||||
       * Av = Ap
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_alpha_currtex |
 | 
			
		||||
       TD0_color_alpha1inv_enable |
 | 
			
		||||
       TD0_color_arg1mul_alpha1 |
 | 
			
		||||
       TD0_color_blend_enable |
 | 
			
		||||
       TD0_color_arg1add_mulout |
 | 
			
		||||
       TD0_color_arg2add_mulout |
 | 
			
		||||
       TD0_color_add_add |
 | 
			
		||||
       TD0_color_sel_add |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_BLEND (Cc=0.0)
 | 
			
		||||
       * Cv = Cp ( 1 - Cs )
 | 
			
		||||
       * Av = Ap As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg1_inv_enable |
 | 
			
		||||
       TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_ADD
 | 
			
		||||
       * Cv = Cp + Cs
 | 
			
		||||
       * Av = Ap As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_alpha_prevstage |
 | 
			
		||||
       TD0_color_add_add |
 | 
			
		||||
       TD0_color_sel_add |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
@@ -334,20 +467,25 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
      (0),
 | 
			
		||||
 | 
			
		||||
      /* GL_REPLACE
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg1 ),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * FIXME: Is this correct?
 | 
			
		||||
       * Cv = Cf
 | 
			
		||||
       * Av = As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_sel_arg1),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * Cv = Cf
 | 
			
		||||
       * Av = Af As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
 | 
			
		||||
      /* GL_DECAL
 | 
			
		||||
      /* GL_DECAL (undefined)
 | 
			
		||||
       * Cv = Cf
 | 
			
		||||
       * Av = Af
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
@@ -355,16 +493,20 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
 | 
			
		||||
      /* GL_BLEND
 | 
			
		||||
       * Cv = Cf
 | 
			
		||||
       * Av = Af As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
 | 
			
		||||
      /* GL_ADD
 | 
			
		||||
       * Cv = Cf
 | 
			
		||||
       * Av = Af As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
   },
 | 
			
		||||
@@ -377,21 +519,25 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
      (0),
 | 
			
		||||
 | 
			
		||||
      /* GL_REPLACE
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_alpha_sel_arg1 ),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * FIXME: Is this correct?
 | 
			
		||||
       * Cv = Cp
 | 
			
		||||
       * Av = As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_alpha_prevstage |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_sel_arg1),
 | 
			
		||||
      
 | 
			
		||||
      /* GL_MODULATE
 | 
			
		||||
       * Cv = Cp
 | 
			
		||||
       * Av = Ap As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
 | 
			
		||||
      /* GL_DECAL
 | 
			
		||||
      /* GL_DECAL (undefined)
 | 
			
		||||
       * Cv = Cp
 | 
			
		||||
       * Av = Ap
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
@@ -399,16 +545,20 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] =
 | 
			
		||||
       TD0_alpha_sel_arg2),
 | 
			
		||||
 | 
			
		||||
      /* GL_BLEND
 | 
			
		||||
       * Cv = Cp
 | 
			
		||||
       * Av = Ap As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_diffuse |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_alpha_arg2_diffuse |
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
 | 
			
		||||
      /* GL_ADD
 | 
			
		||||
       * Cv = Cp
 | 
			
		||||
       * Av = Ap As
 | 
			
		||||
       */
 | 
			
		||||
      (TD0_color_arg2_prevstage |
 | 
			
		||||
       TD0_color_sel_mul |
 | 
			
		||||
       TD0_color_sel_arg2 |
 | 
			
		||||
       TD0_alpha_arg2_prevstage |
 | 
			
		||||
       TD0_alpha_sel_mul),
 | 
			
		||||
   },
 | 
			
		||||
@@ -421,143 +571,236 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit )
 | 
			
		||||
   const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
 | 
			
		||||
   const struct gl_texture_object *tObj = texUnit->_Current;
 | 
			
		||||
   GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
 | 
			
		||||
   mgaTextureObjectPtr t;
 | 
			
		||||
   GLenum format;
 | 
			
		||||
 | 
			
		||||
   if ( tObj != ctx->Texture.Unit[source].Current2D || !tObj ) 
 | 
			
		||||
   if ( !tObj ||
 | 
			
		||||
        (tObj != ctx->Texture.Unit[source].Current2D &&
 | 
			
		||||
         tObj != ctx->Texture.Unit[source].CurrentRect) )
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
   format = tObj->Image[tObj->BaseLevel]->Format;
 | 
			
		||||
 | 
			
		||||
   t = (mgaTextureObjectPtr) tObj->DriverData;
 | 
			
		||||
 | 
			
		||||
   switch (ctx->Texture.Unit[source].EnvMode) {
 | 
			
		||||
   case GL_REPLACE:
 | 
			
		||||
      if (format == GL_RGB || format == GL_LUMINANCE) {
 | 
			
		||||
	 *reg = g400_color_combine[unit][MGA_REPLACE];
 | 
			
		||||
      }
 | 
			
		||||
      else if (format == GL_ALPHA) {
 | 
			
		||||
      if (format == GL_ALPHA) {
 | 
			
		||||
         *reg = g400_alpha_combine[unit][MGA_REPLACE];
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
         *reg = (TD0_color_sel_arg1 |
 | 
			
		||||
                 TD0_alpha_sel_arg1 );
 | 
			
		||||
      } else if (format == GL_RGB || format == GL_LUMINANCE) {
 | 
			
		||||
         *reg = g400_color_combine[unit][MGA_REPLACE];
 | 
			
		||||
      } else {
 | 
			
		||||
         *reg = g400_color_alpha_combine[unit][MGA_REPLACE];
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
   case GL_MODULATE:
 | 
			
		||||
      *reg = g400_color_combine[unit][MGA_MODULATE];
 | 
			
		||||
      if (format == GL_ALPHA) {
 | 
			
		||||
         *reg = g400_alpha_combine[unit][MGA_MODULATE];
 | 
			
		||||
      } else if (format == GL_RGB || format == GL_LUMINANCE) {
 | 
			
		||||
         *reg = g400_color_combine[unit][MGA_MODULATE];
 | 
			
		||||
      } else {
 | 
			
		||||
         *reg = g400_color_alpha_combine[unit][MGA_MODULATE];
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
   case GL_DECAL:
 | 
			
		||||
      if (format == GL_RGB) {
 | 
			
		||||
	 *reg = g400_color_combine[unit][MGA_DECAL];
 | 
			
		||||
      }
 | 
			
		||||
      else if ( format == GL_RGBA ) {
 | 
			
		||||
#if 0
 | 
			
		||||
         if (unit == 0) {
 | 
			
		||||
            /* this doesn't work */
 | 
			
		||||
            *reg = (TD0_color_arg2_diffuse |
 | 
			
		||||
                    TD0_color_alpha_currtex |
 | 
			
		||||
                    TD0_color_alpha2inv_enable |
 | 
			
		||||
                    TD0_color_arg2mul_alpha2 |
 | 
			
		||||
                    TD0_color_arg1mul_alpha1 |
 | 
			
		||||
                    TD0_color_blend_enable |
 | 
			
		||||
                    TD0_color_arg1add_mulout |
 | 
			
		||||
                    TD0_color_arg2add_mulout |
 | 
			
		||||
                    TD0_color_add_add |
 | 
			
		||||
                    TD0_color_sel_mul |
 | 
			
		||||
                    TD0_alpha_arg2_diffuse |
 | 
			
		||||
                    TD0_alpha_sel_arg2 );
 | 
			
		||||
         *reg = g400_color_combine[unit][MGA_DECAL];
 | 
			
		||||
      } else if (format == GL_RGBA) {
 | 
			
		||||
         *reg = g400_color_alpha_combine[unit][MGA_DECAL];
 | 
			
		||||
         if (ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
            /* Linear blending mode needs dual texturing enabled */
 | 
			
		||||
            *(reg+1) = (TD0_color_arg2_prevstage |
 | 
			
		||||
                        TD0_color_sel_arg2 |
 | 
			
		||||
                        TD0_alpha_arg2_prevstage |
 | 
			
		||||
                        TD0_alpha_sel_arg2);
 | 
			
		||||
            mmesa->dualtex_env = GL_TRUE;
 | 
			
		||||
         }
 | 
			
		||||
         else {
 | 
			
		||||
            *reg = (TD0_color_arg2_prevstage |
 | 
			
		||||
                    TD0_color_alpha_currtex |
 | 
			
		||||
                    TD0_color_alpha2inv_enable |
 | 
			
		||||
                    TD0_color_arg2mul_alpha2 |
 | 
			
		||||
                    TD0_color_arg1mul_alpha1 |
 | 
			
		||||
                    TD0_color_add_add |
 | 
			
		||||
                    TD0_color_sel_add |
 | 
			
		||||
                    TD0_alpha_arg2_prevstage |
 | 
			
		||||
                    TD0_alpha_sel_arg2 );
 | 
			
		||||
         }
 | 
			
		||||
#else
 | 
			
		||||
         /* s/w fallback, pretty sure we can't do in h/w */
 | 
			
		||||
	 FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE );
 | 
			
		||||
	 if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK )
 | 
			
		||||
	    fprintf( stderr, "FALLBACK: GL_DECAL RGBA texture, unit=%d\n",
 | 
			
		||||
		     unit );
 | 
			
		||||
#endif
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
	*reg = g400_alpha_combine[unit][MGA_DECAL];
 | 
			
		||||
      } else {
 | 
			
		||||
         /* Undefined */
 | 
			
		||||
         *reg = g400_alpha_combine[unit][MGA_DECAL];
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
   case GL_ADD:
 | 
			
		||||
     if (format == GL_INTENSITY) {
 | 
			
		||||
	if (unit == 0) {
 | 
			
		||||
	   *reg = ( TD0_color_arg2_diffuse |
 | 
			
		||||
		   TD0_color_add_add |
 | 
			
		||||
		   TD0_color_sel_add |
 | 
			
		||||
		   TD0_alpha_arg2_diffuse |
 | 
			
		||||
		   TD0_alpha_add_enable |
 | 
			
		||||
		   TD0_alpha_sel_add);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
	   *reg = ( TD0_color_arg2_prevstage |
 | 
			
		||||
		   TD0_color_add_add |
 | 
			
		||||
		   TD0_color_sel_add |
 | 
			
		||||
		   TD0_alpha_arg2_prevstage |
 | 
			
		||||
		   TD0_alpha_add_enable |
 | 
			
		||||
		   TD0_alpha_sel_add);
 | 
			
		||||
	}
 | 
			
		||||
     }      
 | 
			
		||||
     else if (format == GL_ALPHA) {
 | 
			
		||||
	*reg = g400_alpha_combine[unit][MGA_ADD];
 | 
			
		||||
     }
 | 
			
		||||
     else {
 | 
			
		||||
	*reg = g400_color_combine[unit][MGA_ADD];
 | 
			
		||||
     }
 | 
			
		||||
     break;
 | 
			
		||||
      if (format == GL_ALPHA) {
 | 
			
		||||
         *reg = g400_alpha_combine[unit][MGA_ADD];
 | 
			
		||||
      } else if (format == GL_RGB || format == GL_LUMINANCE) {
 | 
			
		||||
         *reg = g400_color_combine[unit][MGA_ADD];
 | 
			
		||||
      } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) {
 | 
			
		||||
         *reg = g400_color_alpha_combine[unit][MGA_ADD];
 | 
			
		||||
      } else if (format == GL_INTENSITY) {
 | 
			
		||||
         /* Cv = Cf + Cs
 | 
			
		||||
          * Av = Af + As
 | 
			
		||||
          */
 | 
			
		||||
         if (unit == 0) {
 | 
			
		||||
            *reg = (TD0_color_arg2_diffuse |
 | 
			
		||||
                    TD0_color_add_add |
 | 
			
		||||
                    TD0_color_sel_add |
 | 
			
		||||
                    TD0_alpha_arg2_diffuse |
 | 
			
		||||
                    TD0_alpha_add_enable |
 | 
			
		||||
                    TD0_alpha_sel_add);
 | 
			
		||||
         } else {
 | 
			
		||||
            *reg = (TD0_color_arg2_prevstage |
 | 
			
		||||
                    TD0_color_add_add |
 | 
			
		||||
                    TD0_color_sel_add |
 | 
			
		||||
                    TD0_alpha_arg2_prevstage |
 | 
			
		||||
                    TD0_alpha_add_enable |
 | 
			
		||||
                    TD0_alpha_sel_add);
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
   case GL_BLEND:
 | 
			
		||||
      if (format == GL_ALPHA) {
 | 
			
		||||
	 *reg = g400_alpha_combine[unit][MGA_BLEND];
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
	 FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE );
 | 
			
		||||
	 if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK )
 | 
			
		||||
	    fprintf( stderr, "FALLBACK: GL_BLEND envcolor=0x%08x\n",
 | 
			
		||||
		     mmesa->envcolor );
 | 
			
		||||
 | 
			
		||||
         /* Do singletexture GL_BLEND with 'all ones' env-color
 | 
			
		||||
          * by using both texture units.  Multitexture gl_blend
 | 
			
		||||
          * is a fallback.
 | 
			
		||||
          */
 | 
			
		||||
         if (unit == 0) {
 | 
			
		||||
            /* Part 1: R1 = Rf ( 1 - Rt )
 | 
			
		||||
             *         A1 = Af At
 | 
			
		||||
             */
 | 
			
		||||
            *reg = ( TD0_color_arg2_diffuse |
 | 
			
		||||
                     TD0_color_arg1_inv_enable |
 | 
			
		||||
                     TD0_color_sel_mul |
 | 
			
		||||
                     TD0_alpha_arg2_diffuse |
 | 
			
		||||
                     TD0_alpha_sel_arg1);
 | 
			
		||||
         *reg = g400_alpha_combine[unit][MGA_BLEND];
 | 
			
		||||
      } else {
 | 
			
		||||
         if (mmesa->blend_flags & MGA_BLEND_RGB_ZERO) {
 | 
			
		||||
            if (format == GL_RGB || format == GL_LUMINANCE) {
 | 
			
		||||
               *reg = g400_color_combine[unit][MGA_BLEND];
 | 
			
		||||
            } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) {
 | 
			
		||||
               *reg = g400_color_alpha_combine[unit][MGA_BLEND];
 | 
			
		||||
            } else if (format == GL_INTENSITY) {
 | 
			
		||||
               if (mmesa->blend_flags & MGA_BLEND_ALPHA_ZERO) {
 | 
			
		||||
                  /* Cv = Cf ( 1 - Cs )
 | 
			
		||||
                   * Av = Af ( 1 - As )
 | 
			
		||||
                   */
 | 
			
		||||
                  if (unit == 0) {
 | 
			
		||||
                     *reg = (TD0_color_arg1_inv_enable |
 | 
			
		||||
                             TD0_color_arg2_diffuse |
 | 
			
		||||
                             TD0_color_sel_mul |
 | 
			
		||||
                             TD0_alpha_arg1_inv_enable |
 | 
			
		||||
                             TD0_alpha_arg2_diffuse |
 | 
			
		||||
                             TD0_alpha_sel_mul);
 | 
			
		||||
                  } else {
 | 
			
		||||
                     *reg = (TD0_color_arg1_inv_enable |
 | 
			
		||||
                             TD0_color_arg2_prevstage |
 | 
			
		||||
                             TD0_color_sel_mul |
 | 
			
		||||
                             TD0_alpha_arg1_inv_enable |
 | 
			
		||||
                             TD0_alpha_arg2_prevstage |
 | 
			
		||||
                             TD0_alpha_sel_mul);
 | 
			
		||||
                  }
 | 
			
		||||
               } else if (mmesa->blend_flags & MGA_BLEND_ALPHA_ONE &&
 | 
			
		||||
                          ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
                  /* C1 = Cf ( 1 - Cs )
 | 
			
		||||
                   * A1 = Af ( 1 - As )
 | 
			
		||||
                   */
 | 
			
		||||
                  *reg = (TD0_color_arg1_inv_enable |
 | 
			
		||||
                          TD0_color_arg2_diffuse |
 | 
			
		||||
                          TD0_color_sel_mul |
 | 
			
		||||
                          TD0_alpha_arg1_inv_enable |
 | 
			
		||||
                          TD0_alpha_arg2_diffuse |
 | 
			
		||||
                          TD0_alpha_sel_mul);
 | 
			
		||||
                  /* Cv = C1
 | 
			
		||||
                   * Av = A1 + As
 | 
			
		||||
                   */
 | 
			
		||||
                  *(reg+1) = (TD0_color_arg2_prevstage |
 | 
			
		||||
                              TD0_color_sel_arg2 |
 | 
			
		||||
                              TD0_alpha_arg2_prevstage |
 | 
			
		||||
                              TD0_alpha_add_enable |
 | 
			
		||||
                              TD0_alpha_sel_add);
 | 
			
		||||
                  mmesa->dualtex_env = GL_TRUE;
 | 
			
		||||
               } else {
 | 
			
		||||
                  t->texenv_fallback = GL_TRUE;
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         } else if (mmesa->blend_flags & MGA_BLEND_RGB_ONE &&
 | 
			
		||||
                    ctx->Texture._EnabledUnits != 0x03) {
 | 
			
		||||
            if (format == GL_RGB || format == GL_LUMINANCE) {
 | 
			
		||||
                  /* C1 = Cf ( 1 - Cs )
 | 
			
		||||
                   * A1 = Af
 | 
			
		||||
                   */
 | 
			
		||||
                  *reg = (TD0_color_arg1_inv_enable |
 | 
			
		||||
                          TD0_color_arg2_diffuse |
 | 
			
		||||
                          TD0_color_sel_mul |
 | 
			
		||||
                          TD0_alpha_arg2_diffuse |
 | 
			
		||||
                          TD0_alpha_sel_arg2);
 | 
			
		||||
                  /* Cv = C1 + Cs
 | 
			
		||||
                   * Av = A1
 | 
			
		||||
                   */
 | 
			
		||||
                  *(reg+1) = (TD0_color_arg2_prevstage |
 | 
			
		||||
                              TD0_color_add_add |
 | 
			
		||||
                              TD0_color_sel_add |
 | 
			
		||||
                              TD0_alpha_arg2_prevstage |
 | 
			
		||||
                              TD0_alpha_sel_arg2);
 | 
			
		||||
                  mmesa->dualtex_env = GL_TRUE;
 | 
			
		||||
            } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) {
 | 
			
		||||
                  /* C1 = Cf ( 1 - Cs )
 | 
			
		||||
                   * A1 = Af As
 | 
			
		||||
                   */
 | 
			
		||||
                  *reg = (TD0_color_arg1_inv_enable |
 | 
			
		||||
                          TD0_color_arg2_diffuse |
 | 
			
		||||
                          TD0_color_sel_mul |
 | 
			
		||||
                          TD0_alpha_arg2_diffuse |
 | 
			
		||||
                          TD0_alpha_sel_mul);
 | 
			
		||||
                  /* Cv = C1 + Cs
 | 
			
		||||
                   * Av = A1
 | 
			
		||||
                   */
 | 
			
		||||
                  *(reg+1) = (TD0_color_arg2_prevstage |
 | 
			
		||||
                              TD0_color_add_add |
 | 
			
		||||
                              TD0_color_sel_add |
 | 
			
		||||
                              TD0_alpha_arg2_prevstage |
 | 
			
		||||
                              TD0_alpha_sel_arg2);
 | 
			
		||||
                  mmesa->dualtex_env = GL_TRUE;
 | 
			
		||||
            } else if (format == GL_INTENSITY) {
 | 
			
		||||
               if (mmesa->blend_flags & MGA_BLEND_ALPHA_ZERO) {
 | 
			
		||||
                  /* C1 = Cf ( 1 - Cs )
 | 
			
		||||
                   * A1 = Af ( 1 - As )
 | 
			
		||||
                   */
 | 
			
		||||
                  *reg = (TD0_color_arg1_inv_enable |
 | 
			
		||||
                          TD0_color_arg2_diffuse |
 | 
			
		||||
                          TD0_color_sel_mul |
 | 
			
		||||
                          TD0_alpha_arg1_inv_enable |
 | 
			
		||||
                          TD0_alpha_arg2_diffuse |
 | 
			
		||||
                          TD0_alpha_sel_mul);
 | 
			
		||||
                  /* Cv = C1 + Cs
 | 
			
		||||
                   * Av = A1
 | 
			
		||||
                   */
 | 
			
		||||
                  *(reg+1) = (TD0_color_arg2_prevstage |
 | 
			
		||||
                              TD0_color_add_add |
 | 
			
		||||
                              TD0_color_sel_add |
 | 
			
		||||
                              TD0_alpha_arg2_prevstage |
 | 
			
		||||
                              TD0_alpha_sel_arg2);
 | 
			
		||||
                  mmesa->dualtex_env = GL_TRUE;
 | 
			
		||||
               } else if (mmesa->blend_flags & MGA_BLEND_ALPHA_ONE) {
 | 
			
		||||
                  /* C1 = Cf ( 1 - Cs )
 | 
			
		||||
                   * A1 = Af ( 1 - As )
 | 
			
		||||
                   */
 | 
			
		||||
                  *reg = (TD0_color_arg1_inv_enable |
 | 
			
		||||
                          TD0_color_arg2_diffuse |
 | 
			
		||||
                          TD0_color_sel_mul |
 | 
			
		||||
                          TD0_alpha_arg1_inv_enable |
 | 
			
		||||
                          TD0_alpha_arg2_diffuse |
 | 
			
		||||
                          TD0_alpha_sel_mul);
 | 
			
		||||
                  /* Cv = C1 + Cs
 | 
			
		||||
                   * Av = A1 + As
 | 
			
		||||
                   */
 | 
			
		||||
                  *(reg+1) = (TD0_color_arg2_prevstage |
 | 
			
		||||
                              TD0_color_add_add |
 | 
			
		||||
                              TD0_color_sel_add |
 | 
			
		||||
                              TD0_alpha_arg2_prevstage |
 | 
			
		||||
                              TD0_alpha_add_enable |
 | 
			
		||||
                              TD0_alpha_sel_add);
 | 
			
		||||
                  mmesa->dualtex_env = GL_TRUE;
 | 
			
		||||
               } else {
 | 
			
		||||
                  t->texenv_fallback = GL_TRUE;
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         } else {
 | 
			
		||||
            /* Part 2: R2 = R1 + Rt
 | 
			
		||||
             *         A2 = A1
 | 
			
		||||
             */
 | 
			
		||||
            *reg = ( TD0_color_arg2_prevstage |
 | 
			
		||||
                     TD0_color_add_add |
 | 
			
		||||
                     TD0_color_sel_add |
 | 
			
		||||
                     TD0_alpha_arg2_prevstage |
 | 
			
		||||
                     TD0_alpha_sel_arg2);
 | 
			
		||||
            t->texenv_fallback = GL_TRUE;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_COMBINE_EXT:
 | 
			
		||||
      if (!mgaUpdateTextureEnvCombine(ctx, unit))
 | 
			
		||||
         t->texenv_fallback = GL_TRUE;
 | 
			
		||||
      break;
 | 
			
		||||
   default:
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void disable_tex( GLcontext *ctx, int unit )
 | 
			
		||||
{
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT( ctx );
 | 
			
		||||
@@ -573,7 +816,7 @@ static void disable_tex( GLcontext *ctx, int unit )
 | 
			
		||||
      mmesa->CurrentTexObj[unit] = NULL;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if ( unit != 0 ) {
 | 
			
		||||
   if ( unit != 0 && !mmesa->dualtex_env ) {
 | 
			
		||||
      mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -586,7 +829,7 @@ static void disable_tex( GLcontext *ctx, int unit )
 | 
			
		||||
   mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
 | 
			
		||||
static GLboolean enable_tex( GLcontext *ctx, int unit )
 | 
			
		||||
{
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
 | 
			
		||||
   const int source = mmesa->tmu_source[unit];
 | 
			
		||||
@@ -649,6 +892,14 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit )
 | 
			
		||||
      t->setup.texctl2 |= TMC_dualtex_enable;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   t->texenv_fallback = GL_FALSE;
 | 
			
		||||
 | 
			
		||||
   /* Set this before mgaUpdateTextureEnvG400() since
 | 
			
		||||
    * GL_ARB_texture_env_crossbar may have to disable texturing.
 | 
			
		||||
    */
 | 
			
		||||
   mmesa->setup.dwgctl &= DC_opcod_MASK;
 | 
			
		||||
   mmesa->setup.dwgctl |= DC_opcod_texture_trap;
 | 
			
		||||
 | 
			
		||||
   /* FIXME: The Radeon has some cached state so that it can avoid calling
 | 
			
		||||
    * FIXME: UpdateTextureEnv in some cases.  Is that possible here?
 | 
			
		||||
    */
 | 
			
		||||
@@ -680,13 +931,10 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit )
 | 
			
		||||
 | 
			
		||||
      mgaUpdateTextureEnvG200( ctx, unit );
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   mmesa->setup.dwgctl &= DC_opcod_MASK;
 | 
			
		||||
   mmesa->setup.dwgctl |= DC_opcod_texture_trap;
 | 
			
		||||
   mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit);
 | 
			
		||||
 | 
			
		||||
   FALLBACK( ctx, MGA_FALLBACK_BORDER_MODE, t->border_fallback );
 | 
			
		||||
   return !t->border_fallback;
 | 
			
		||||
   return !t->border_fallback && !t->texenv_fallback;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -697,8 +945,9 @@ static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
 | 
			
		||||
   const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   if ( texUnit->_ReallyEnabled == TEXTURE_2D_BIT) {
 | 
			
		||||
      return(enable_tex_2d( ctx, unit ) &&
 | 
			
		||||
   if ( texUnit->_ReallyEnabled == TEXTURE_2D_BIT ||
 | 
			
		||||
        texUnit->_ReallyEnabled == TEXTURE_RECT_BIT ) {
 | 
			
		||||
      return(enable_tex( ctx, unit ) &&
 | 
			
		||||
	     update_tex_common( ctx, unit ));
 | 
			
		||||
   }
 | 
			
		||||
   else if ( texUnit->_ReallyEnabled ) {
 | 
			
		||||
@@ -718,6 +967,7 @@ void mgaUpdateTextureState( GLcontext *ctx )
 | 
			
		||||
   GLboolean ok;
 | 
			
		||||
   unsigned  i;
 | 
			
		||||
 | 
			
		||||
   mmesa->dualtex_env = GL_FALSE;
 | 
			
		||||
 | 
			
		||||
   /* This works around a quirk with the MGA hardware.  If only OpenGL 
 | 
			
		||||
    * TEXTURE1 is enabled, then the hardware TEXTURE0 must be used.  The
 | 
			
		||||
@@ -740,8 +990,4 @@ void mgaUpdateTextureState( GLcontext *ctx )
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   FALLBACK( ctx, MGA_FALLBACK_TEXTURE, !ok );
 | 
			
		||||
   
 | 
			
		||||
   /* FIXME: I believe that ChooseVertexState should be called here instead of
 | 
			
		||||
    * FIXME: in mgaDDValidateState.
 | 
			
		||||
    */
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.18 2002/12/16 16:18:52 dawes Exp $ */
 | 
			
		||||
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.19 2003/03/26 20:43:49 tsi Exp $ */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright 2000-2001 VA Linux Systems, Inc.
 | 
			
		||||
 * All Rights Reserved.
 | 
			
		||||
@@ -56,11 +56,23 @@
 | 
			
		||||
 | 
			
		||||
#include "utils.h"
 | 
			
		||||
#include "vblank.h"
 | 
			
		||||
#include "dri_util.h"
 | 
			
		||||
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
#include "glxextensions.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* MGA configuration
 | 
			
		||||
 */
 | 
			
		||||
#include "xmlpool.h"
 | 
			
		||||
 | 
			
		||||
const char __driConfigOptions[] =
 | 
			
		||||
DRI_CONF_BEGIN
 | 
			
		||||
    DRI_CONF_SECTION_PERFORMANCE
 | 
			
		||||
        DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
 | 
			
		||||
    DRI_CONF_SECTION_END
 | 
			
		||||
DRI_CONF_END;
 | 
			
		||||
const GLuint __driNConfigOptions = 1;
 | 
			
		||||
 | 
			
		||||
#ifndef MGA_DEBUG
 | 
			
		||||
int MGA_DEBUG = 0;
 | 
			
		||||
#endif
 | 
			
		||||
@@ -97,7 +109,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
				    &gp, sizeof(gp));
 | 
			
		||||
      if (ret) {
 | 
			
		||||
	    fprintf(stderr, "drmMgaGetParam (MGA_PARAM_IRQ_NR): %d\n", ret);
 | 
			
		||||
	    free(mgaScreen);
 | 
			
		||||
	    FREE(mgaScreen);
 | 
			
		||||
	    sPriv->private = NULL;
 | 
			
		||||
	    return GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
@@ -105,23 +117,26 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
   
 | 
			
		||||
   mgaScreen->linecomp_sane = (sPriv->ddxMajor > 1) || (sPriv->ddxMinor > 1)
 | 
			
		||||
       || ((sPriv->ddxMinor == 1) && (sPriv->ddxPatch > 0));
 | 
			
		||||
#ifndef _SOLO   
 | 
			
		||||
   if ( ! mgaScreen->linecomp_sane ) {
 | 
			
		||||
      PFNGLXDISABLEEXTENSIONPROC glx_disable_extension;
 | 
			
		||||
#ifndef _SOLO       
 | 
			
		||||
   if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) {
 | 
			
		||||
      PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
 | 
			
		||||
          (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" );
 | 
			
		||||
      void * const psc = sPriv->psc->screenConfigs;
 | 
			
		||||
 | 
			
		||||
      glx_disable_extension = (PFNGLXDISABLEEXTENSIONPROC)
 | 
			
		||||
	  glXGetProcAddress( "__glXDisableExtension" );
 | 
			
		||||
      if ( glx_enable_extension != NULL ) {
 | 
			
		||||
	 if ( mgaScreen->linecomp_sane ) {
 | 
			
		||||
	    (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
 | 
			
		||||
	    (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
 | 
			
		||||
	    (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
 | 
			
		||||
	 }
 | 
			
		||||
 | 
			
		||||
      if ( glx_disable_extension != NULL ) {
 | 
			
		||||
	 (*glx_disable_extension)( "GLX_SGI_swap_control" );
 | 
			
		||||
	 (*glx_disable_extension)( "GLX_SGI_video_sync" );
 | 
			
		||||
	 (*glx_disable_extension)( "GLX_MESA_swap_control" );
 | 
			
		||||
	 (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
#endif
 | 
			
		||||
   if (serverInfo->chipset != MGA_CARD_TYPE_G200 &&
 | 
			
		||||
       serverInfo->chipset != MGA_CARD_TYPE_G400) {
 | 
			
		||||
      free(mgaScreen);
 | 
			
		||||
      FREE(mgaScreen);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      __driUtilMessage("Unrecognized chipset");
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
@@ -168,7 +183,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
	      mgaScreen->agp.size,
 | 
			
		||||
	      (drmAddress *)&mgaScreen->agp.map) != 0)
 | 
			
		||||
   {
 | 
			
		||||
      free(mgaScreen);
 | 
			
		||||
      Xfree(mgaScreen);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      __driUtilMessage("Couldn't map agp region");
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
@@ -194,7 +209,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
              serverInfo->agpTextureSize,
 | 
			
		||||
              (drmAddress *)&mgaScreen->texVirtual[MGA_AGP_HEAP]) != 0)
 | 
			
		||||
   {
 | 
			
		||||
      free(mgaScreen);
 | 
			
		||||
      FREE(mgaScreen);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      __driUtilMessage("Couldn't map agptexture region");
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
@@ -214,13 +229,16 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
 | 
			
		||||
   mgaScreen->bufs = drmMapBufs(sPriv->fd);
 | 
			
		||||
   if (!mgaScreen->bufs) {
 | 
			
		||||
      /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/
 | 
			
		||||
      free(mgaScreen);
 | 
			
		||||
      FREE(mgaScreen);
 | 
			
		||||
      sPriv->private = NULL;
 | 
			
		||||
      __driUtilMessage("Couldn't map dma buffers");
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
   }
 | 
			
		||||
   mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset;
 | 
			
		||||
 | 
			
		||||
   /* parse information in __driConfigOptions */
 | 
			
		||||
   driParseOptionInfo (&mgaScreen->optionCache);
 | 
			
		||||
 | 
			
		||||
   return GL_TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -234,14 +252,18 @@ mgaDestroyScreen(__DRIscreenPrivate *sPriv)
 | 
			
		||||
      fprintf(stderr, "mgaDestroyScreen\n");
 | 
			
		||||
 | 
			
		||||
   /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/
 | 
			
		||||
   free(mgaScreen);
 | 
			
		||||
 | 
			
		||||
   /* free all option information */
 | 
			
		||||
   driDestroyOptionInfo (&mgaScreen->optionCache);
 | 
			
		||||
 | 
			
		||||
   FREE(mgaScreen);
 | 
			
		||||
   sPriv->private = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern const struct gl_pipeline_stage _mga_render_stage;
 | 
			
		||||
extern const struct tnl_pipeline_stage _mga_render_stage;
 | 
			
		||||
 | 
			
		||||
static const struct gl_pipeline_stage *mga_pipeline[] = {
 | 
			
		||||
static const struct tnl_pipeline_stage *mga_pipeline[] = {
 | 
			
		||||
   &_tnl_vertex_transform_stage, 
 | 
			
		||||
   &_tnl_normal_transform_stage, 
 | 
			
		||||
   &_tnl_lighting_stage,	
 | 
			
		||||
@@ -263,6 +285,10 @@ static const char * const g400_extensions[] =
 | 
			
		||||
   "GL_ARB_multitexture",
 | 
			
		||||
   "GL_ARB_texture_env_add",
 | 
			
		||||
   "GL_EXT_texture_env_add",
 | 
			
		||||
   "GL_ARB_texture_env_combine",
 | 
			
		||||
   "GL_EXT_texture_env_combine",
 | 
			
		||||
   "GL_ARB_texture_env_crossbar",
 | 
			
		||||
   "GL_ATI_texture_env_combine3",
 | 
			
		||||
   "GL_EXT_texture_edge_clamp",
 | 
			
		||||
   "GL_SGIS_texture_edge_clamp",
 | 
			
		||||
#if defined (MESA_packed_depth_stencil)
 | 
			
		||||
@@ -286,6 +312,7 @@ static const char * const card_extensions[] =
 | 
			
		||||
   "GL_MESA_ycbcr_texture",
 | 
			
		||||
   "GL_SGIS_generate_mipmap",
 | 
			
		||||
   "GL_SGIS_texture_lod",
 | 
			
		||||
   "GL_NV_texture_rectangle",
 | 
			
		||||
   NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -353,6 +380,10 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
 | 
			
		||||
   mmesa->sarea = (void *)saPriv;
 | 
			
		||||
   mmesa->glBuffer = NULL;
 | 
			
		||||
 | 
			
		||||
   /* Parse configuration files */
 | 
			
		||||
   driParseConfigFiles (&mmesa->optionCache, &mgaScreen->optionCache,
 | 
			
		||||
                        sPriv->myNum, "mga");
 | 
			
		||||
 | 
			
		||||
   (void) memset( mmesa->texture_heaps, 0, sizeof( mmesa->texture_heaps ) );
 | 
			
		||||
   make_empty_list( & mmesa->swapped );
 | 
			
		||||
 | 
			
		||||
@@ -388,10 +419,10 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
 | 
			
		||||
				 mmesa->nr_heaps,
 | 
			
		||||
				 & ctx->Const,
 | 
			
		||||
				 4,
 | 
			
		||||
				 11, /* max 2D texture size is 1024x1024 */
 | 
			
		||||
				 11, /* max 2D texture size is 2048x2048 */
 | 
			
		||||
				 0,  /* 3D textures unsupported. */
 | 
			
		||||
				 0,  /* cube textures unsupported. */
 | 
			
		||||
				 0,  /* texture rectangles unsupported. */
 | 
			
		||||
				 11, /* max texture rect size is 2048x2048 */
 | 
			
		||||
				 maxlevels,
 | 
			
		||||
				 GL_FALSE );
 | 
			
		||||
 | 
			
		||||
@@ -487,14 +518,15 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
 | 
			
		||||
 | 
			
		||||
   mmesa->vblank_flags = ((mmesa->mgaScreen->irq == 0) 
 | 
			
		||||
			  || !mmesa->mgaScreen->linecomp_sane)
 | 
			
		||||
       ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags();
 | 
			
		||||
       ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache);
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
   mmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( "__glXGetUST" );
 | 
			
		||||
   if ( mmesa->get_ust == NULL ) 
 | 
			
		||||
#endif
 | 
			
		||||
   {
 | 
			
		||||
   mmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" );
 | 
			
		||||
   if ( mmesa->get_ust == NULL ) {
 | 
			
		||||
      mmesa->get_ust = get_ust_nop;
 | 
			
		||||
   }
 | 
			
		||||
#else
 | 
			
		||||
   mmesa->get_ust = get_ust_nop;
 | 
			
		||||
#endif   
 | 
			
		||||
 | 
			
		||||
   (*mmesa->get_ust)( & mmesa->swap_ust );
 | 
			
		||||
 | 
			
		||||
@@ -541,6 +573,9 @@ mgaDestroyContext(__DRIcontextPrivate *driContextPriv)
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /* free the option cache */
 | 
			
		||||
      driDestroyOptionCache (&mmesa->optionCache);
 | 
			
		||||
 | 
			
		||||
      FREE(mmesa);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -614,6 +649,7 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
 | 
			
		||||
      mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
 | 
			
		||||
 | 
			
		||||
      if (mmesa->driDrawable != driDrawPriv) {
 | 
			
		||||
	 driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags );
 | 
			
		||||
	 mmesa->driDrawable = driDrawPriv;
 | 
			
		||||
	 mmesa->dirty = ~0; 
 | 
			
		||||
	 mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK); 
 | 
			
		||||
@@ -647,7 +683,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
 | 
			
		||||
 | 
			
		||||
   if (*(dPriv->pStamp) != mmesa->lastStamp) {
 | 
			
		||||
      mmesa->lastStamp = *(dPriv->pStamp);
 | 
			
		||||
      mmesa->SetupNewInputs |= VERT_BIT_CLIP;
 | 
			
		||||
      mmesa->SetupNewInputs |= VERT_BIT_POS;
 | 
			
		||||
      mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
 | 
			
		||||
      mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) );
 | 
			
		||||
   }
 | 
			
		||||
@@ -695,7 +731,7 @@ static const struct __DriverAPIRec mgaAPI = {
 | 
			
		||||
 * The __driCreateScreen name is the symbol that libGL.so fetches.
 | 
			
		||||
 * Return:  pointer to a __DRIscreenPrivate.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
#ifndef _SOLO 
 | 
			
		||||
void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
 | 
			
		||||
                        int numConfigs, __GLXvisualConfig *config)
 | 
			
		||||
{
 | 
			
		||||
@@ -714,30 +750,6 @@ void *__driCreateScreen(struct DRIDriverRec *driver,
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
/* This function is called by libGL.so as soon as libGL.so is loaded.
 | 
			
		||||
 * This is where we'd register new extension functions with the dispatcher.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
__driRegisterExtensions( void )
 | 
			
		||||
{
 | 
			
		||||
   PFNGLXENABLEEXTENSIONPROC glx_enable_extension;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) {
 | 
			
		||||
      glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC)
 | 
			
		||||
	  glXGetProcAddress( "__glXEnableExtension" );
 | 
			
		||||
 | 
			
		||||
      if ( glx_enable_extension != NULL ) {
 | 
			
		||||
	 (*glx_enable_extension)( "GLX_SGI_swap_control", GL_FALSE );
 | 
			
		||||
	 (*glx_enable_extension)( "GLX_SGI_video_sync", GL_FALSE );
 | 
			
		||||
	 (*glx_enable_extension)( "GLX_MESA_swap_control", GL_FALSE );
 | 
			
		||||
	 (*glx_enable_extension)( "GLX_MESA_swap_frame_usage", GL_FALSE );
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get information about previous buffer swaps.
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,7 @@
 | 
			
		||||
#include "mtypes.h"
 | 
			
		||||
#include "mgaregs.h"
 | 
			
		||||
#include "mga_common.h"
 | 
			
		||||
#include "xmlconfig.h"
 | 
			
		||||
 | 
			
		||||
typedef struct mga_screen_private_s {
 | 
			
		||||
 | 
			
		||||
@@ -78,6 +79,9 @@ typedef struct mga_screen_private_s {
 | 
			
		||||
   drmRegion primary;
 | 
			
		||||
   drmRegion buffers;
 | 
			
		||||
   unsigned int sarea_priv_offset;
 | 
			
		||||
 | 
			
		||||
   /* Configuration cache with default values for all contexts */
 | 
			
		||||
   driOptionCache optionCache;
 | 
			
		||||
} mgaScreenPrivate;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,7 @@
 | 
			
		||||
#include "mga_sarea.h"
 | 
			
		||||
#include "texmem.h"
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
#include "xmlconfig.h"
 | 
			
		||||
 | 
			
		||||
#define MGA_SET_FIELD(reg,mask,val)  reg = ((reg) & (mask)) | ((val) & ~(mask))
 | 
			
		||||
#define MGA_FIELD(field,val) (((val) << (field ## _SHIFT)) & ~(field ## _MASK))
 | 
			
		||||
@@ -79,10 +80,12 @@ typedef void (*mga_point_func)( mgaContextPtr, mgaVertex * );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Reasons why the GL_BLEND fallback mightn't work:
 | 
			
		||||
/* GL_BLEND has some limitations
 | 
			
		||||
 */
 | 
			
		||||
#define MGA_BLEND_ENV_COLOR 0x1
 | 
			
		||||
#define MGA_BLEND_MULTITEX  0x2
 | 
			
		||||
#define MGA_BLEND_RGB_ZERO   0x1
 | 
			
		||||
#define MGA_BLEND_RGB_ONE    0x2
 | 
			
		||||
#define MGA_BLEND_ALPHA_ZERO 0x4
 | 
			
		||||
#define MGA_BLEND_ALPHA_ONE  0x8
 | 
			
		||||
 | 
			
		||||
struct mga_texture_object_s;
 | 
			
		||||
struct mga_screen_private_s;
 | 
			
		||||
@@ -149,6 +152,10 @@ typedef struct mga_texture_object_s
 | 
			
		||||
    * to fallback for GL_CLAMP_TO_BORDER.
 | 
			
		||||
    */
 | 
			
		||||
   GLboolean          border_fallback;
 | 
			
		||||
   /* Depending on multitxturing and environment color
 | 
			
		||||
    * GL_BLEND may have to be a software fallback.
 | 
			
		||||
    */
 | 
			
		||||
   GLboolean texenv_fallback;
 | 
			
		||||
} mgaTextureObject_t;
 | 
			
		||||
 | 
			
		||||
struct mga_hw_state {
 | 
			
		||||
@@ -202,10 +209,11 @@ struct mga_context_t {
 | 
			
		||||
   struct gl_client_array UbyteColor;
 | 
			
		||||
   struct gl_client_array UbyteSecondaryColor;
 | 
			
		||||
 | 
			
		||||
   /* Support for limited GL_BLEND fallback
 | 
			
		||||
   /* Support for GL_DECAL and GL_BLEND
 | 
			
		||||
    */
 | 
			
		||||
   unsigned int blend_flags;
 | 
			
		||||
   unsigned int envcolor;
 | 
			
		||||
   GLboolean dualtex_env;
 | 
			
		||||
 | 
			
		||||
   /* Rasterization state 
 | 
			
		||||
    */
 | 
			
		||||
@@ -299,6 +307,10 @@ struct mga_context_t {
 | 
			
		||||
   __DRIscreenPrivate *driScreen;
 | 
			
		||||
   struct mga_screen_private_s *mgaScreen;
 | 
			
		||||
   MGASAREAPrivPtr sarea;
 | 
			
		||||
 | 
			
		||||
   /* Configuration cache
 | 
			
		||||
    */
 | 
			
		||||
   driOptionCache optionCache;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define MGA_CONTEXT(ctx) ((mgaContextPtr)(ctx->DriverCtx))
 | 
			
		||||
 
 | 
			
		||||
@@ -26,9 +26,8 @@
 | 
			
		||||
 *    Gareth Hughes <gareth@valinux.com>
 | 
			
		||||
 */
 | 
			
		||||
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.16 2002/12/16 16:18:52 dawes Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <sched.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <sched.h>
 | 
			
		||||
 | 
			
		||||
#include "mtypes.h"
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -101,7 +101,7 @@ static void VERT_FALLBACK( GLcontext *ctx, GLuint start, GLuint count,
 | 
			
		||||
   tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
 | 
			
		||||
   tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
 | 
			
		||||
   tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
 | 
			
		||||
   MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_CLIP;
 | 
			
		||||
   MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_POS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define LOCAL_VARS mgaContextPtr mmesa = MGA_CONTEXT(ctx) 
 | 
			
		||||
@@ -131,12 +131,12 @@ static void VERT_FALLBACK( GLcontext *ctx, GLuint start, GLuint count,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static GLboolean mga_run_render( GLcontext *ctx,
 | 
			
		||||
				  struct gl_pipeline_stage *stage )
 | 
			
		||||
				  struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
 | 
			
		||||
   TNLcontext *tnl = TNL_CONTEXT(ctx);
 | 
			
		||||
   struct vertex_buffer *VB = &tnl->vb; 
 | 
			
		||||
   GLuint i, length, flags = 0;
 | 
			
		||||
   GLuint i;
 | 
			
		||||
 | 
			
		||||
   /* Don't handle clipping or indexed vertices or vertex manipulations.
 | 
			
		||||
    */
 | 
			
		||||
@@ -147,13 +147,17 @@ static GLboolean mga_run_render( GLcontext *ctx,
 | 
			
		||||
   tnl->Driver.Render.Start( ctx );
 | 
			
		||||
   mmesa->SetupNewInputs = ~0;      
 | 
			
		||||
 | 
			
		||||
   for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
 | 
			
		||||
   for (i = 0 ; i < VB->PrimitiveCount ; i++)
 | 
			
		||||
   {
 | 
			
		||||
      flags = VB->Primitive[i];
 | 
			
		||||
      length= VB->PrimitiveLength[i];	
 | 
			
		||||
      if (length)
 | 
			
		||||
	 mga_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
 | 
			
		||||
						       flags );
 | 
			
		||||
      GLuint prim = VB->Primitive[i].mode;
 | 
			
		||||
      GLuint start = VB->Primitive[i].start;
 | 
			
		||||
      GLuint length = VB->Primitive[i].count;
 | 
			
		||||
 | 
			
		||||
      if (!length)
 | 
			
		||||
	 continue;
 | 
			
		||||
 | 
			
		||||
      mga_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length, 
 | 
			
		||||
						   prim);
 | 
			
		||||
   } 
 | 
			
		||||
 | 
			
		||||
   tnl->Driver.Render.Finish( ctx );
 | 
			
		||||
@@ -162,9 +166,9 @@ static GLboolean mga_run_render( GLcontext *ctx,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void mga_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
 | 
			
		||||
static void mga_check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
 | 
			
		||||
   GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
 | 
			
		||||
 | 
			
		||||
   if (ctx->RenderMode == GL_RENDER) {
 | 
			
		||||
      if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) 
 | 
			
		||||
@@ -184,13 +188,13 @@ static void mga_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void dtr( struct gl_pipeline_stage *stage )
 | 
			
		||||
static void dtr( struct tnl_pipeline_stage *stage )
 | 
			
		||||
{
 | 
			
		||||
   (void)stage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const struct gl_pipeline_stage _mga_render_stage = 
 | 
			
		||||
const struct tnl_pipeline_stage _mga_render_stage = 
 | 
			
		||||
{ 
 | 
			
		||||
   "mga render",
 | 
			
		||||
   (_DD_NEW_SEPARATE_SPECULAR |
 | 
			
		||||
 
 | 
			
		||||
@@ -401,7 +401,7 @@ static void mgaDDColorMask(GLcontext *ctx,
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static int mgaStipples[16] = {
 | 
			
		||||
   0xffff1,  /* See above note */
 | 
			
		||||
   0xffff,
 | 
			
		||||
   0xa5a5,
 | 
			
		||||
   0x5a5a,
 | 
			
		||||
   0xa0a0,
 | 
			
		||||
@@ -425,9 +425,6 @@ static int mgaStipples[16] = {
 | 
			
		||||
 *
 | 
			
		||||
 * \param ctx GL rendering context to be affected
 | 
			
		||||
 * \param mask Pointer to the 32x32 stipple mask
 | 
			
		||||
 *
 | 
			
		||||
 * \note the fully opaque pattern (0xffff) has been disabled in order
 | 
			
		||||
 * to work around a conformance issue.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
 | 
			
		||||
@@ -492,8 +489,7 @@ static void updateSpecularLighting( GLcontext *ctx )
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
 | 
			
		||||
   unsigned int specen;
 | 
			
		||||
 | 
			
		||||
   specen = (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
 | 
			
		||||
	     ctx->Light.Enabled) ? TMC_specen_enable : 0;
 | 
			
		||||
   specen = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TMC_specen_enable : 0;
 | 
			
		||||
 | 
			
		||||
   if ( specen != mmesa->hw.specen ) {
 | 
			
		||||
      mmesa->hw.specen = specen;
 | 
			
		||||
@@ -519,14 +515,6 @@ static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void mgaDDShadeModel(GLcontext *ctx, GLenum mode)
 | 
			
		||||
{
 | 
			
		||||
   /* FIXME: This used to FLUSH_BATCH and set MGA_NEW_TEXTURE in new_state,
 | 
			
		||||
    * FIXME: so I'm not sure what to do here now.
 | 
			
		||||
    */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* =============================================================
 | 
			
		||||
 * Stencil
 | 
			
		||||
 */
 | 
			
		||||
@@ -671,6 +659,12 @@ static void mgaDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
 | 
			
		||||
   case GL_DECR:
 | 
			
		||||
      stencilctl |= SC_szpassop_decrsat;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_INCR_WRAP:
 | 
			
		||||
      stencilctl |= SC_szpassop_incr;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_DECR_WRAP:
 | 
			
		||||
      stencilctl |= SC_szpassop_decr;
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_INVERT:
 | 
			
		||||
      stencilctl |= SC_szpassop_invert;
 | 
			
		||||
      break;
 | 
			
		||||
@@ -826,8 +820,10 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
 | 
			
		||||
   else
 | 
			
		||||
      mgaXMesaSetBackClipRects( mmesa );
 | 
			
		||||
 | 
			
		||||
#ifndef _SOLO
 | 
			
		||||
   sarea->req_drawable = driDrawable->draw;
 | 
			
		||||
   sarea->req_draw_buffer = mmesa->draw_buffer;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
   mgaUpdateClipping( mmesa->glCtx );
 | 
			
		||||
   mgaCalcViewport( mmesa->glCtx );
 | 
			
		||||
 | 
			
		||||
@@ -888,6 +884,11 @@ static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT( ctx );
 | 
			
		||||
 | 
			
		||||
   switch(cap) {
 | 
			
		||||
   case GL_LIGHTING:
 | 
			
		||||
   case GL_COLOR_SUM_EXT:
 | 
			
		||||
      FLUSH_BATCH( mmesa );
 | 
			
		||||
      updateSpecularLighting( ctx );
 | 
			
		||||
      break;
 | 
			
		||||
   case GL_ALPHA_TEST:
 | 
			
		||||
      FLUSH_BATCH( mmesa );
 | 
			
		||||
      mmesa->hw.alpha_func_enable = (state) ? ~0 : 0;
 | 
			
		||||
@@ -1034,25 +1035,24 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa )
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if ((mmesa->dirty & MGA_UPLOAD_TEX0) && mmesa->CurrentTexObj[0]) {
 | 
			
		||||
      mmesa->CurrentTexObj[0]->setup.texctl2 &= ~TMC_specen_enable;
 | 
			
		||||
      mmesa->CurrentTexObj[0]->setup.texctl2 |= mmesa->hw.specen;
 | 
			
		||||
 | 
			
		||||
      memcpy(&sarea->TexState[0],
 | 
			
		||||
	     &mmesa->CurrentTexObj[0]->setup,
 | 
			
		||||
	     sizeof(sarea->TexState[0]));
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if ((mmesa->dirty & MGA_UPLOAD_TEX1) && mmesa->CurrentTexObj[1]) {
 | 
			
		||||
      mmesa->CurrentTexObj[1]->setup.texctl2 &= ~TMC_specen_enable;
 | 
			
		||||
      mmesa->CurrentTexObj[1]->setup.texctl2 |= mmesa->hw.specen;
 | 
			
		||||
 | 
			
		||||
      memcpy(&sarea->TexState[1],
 | 
			
		||||
	     &mmesa->CurrentTexObj[1]->setup,
 | 
			
		||||
	     sizeof(sarea->TexState[1]));
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if ( (sarea->TexState[0].texctl2 & TMC_borderen_MASK) !=
 | 
			
		||||
	(sarea->TexState[1].texctl2 & TMC_borderen_MASK) ) {
 | 
			
		||||
   if (mmesa->dualtex_env) {
 | 
			
		||||
      sarea->TexState[0].texctl2 |= TMC_dualtex_enable;
 | 
			
		||||
      memcpy( &sarea->TexState[1], &sarea->TexState[0],
 | 
			
		||||
	      sizeof(sarea->TexState[0]) );
 | 
			
		||||
      mmesa->dirty |= MGA_UPLOAD_TEX1|MGA_UPLOAD_TEX0;
 | 
			
		||||
   } else if ( (sarea->TexState[0].texctl2 & TMC_borderen_MASK) !=
 | 
			
		||||
               (sarea->TexState[1].texctl2 & TMC_borderen_MASK) ) {
 | 
			
		||||
      const int borderen = sarea->TexState[1].texctl2 & ~TMC_borderen_MASK;
 | 
			
		||||
 | 
			
		||||
      memcpy( &sarea->TexState[1], &sarea->TexState[0],
 | 
			
		||||
@@ -1070,15 +1070,10 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa )
 | 
			
		||||
   mmesa->sarea->dirty |= mmesa->dirty;
 | 
			
		||||
   mmesa->dirty &= MGA_UPLOAD_CLIPRECTS;
 | 
			
		||||
 | 
			
		||||
   /* This is a bit of a hack but seems to be the best place to ensure
 | 
			
		||||
    * that separate specular is disabled when not needed.
 | 
			
		||||
    */
 | 
			
		||||
   if (ctx->Texture._EnabledUnits == 0 ||
 | 
			
		||||
       !ctx->Light.Enabled ||
 | 
			
		||||
       ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) {
 | 
			
		||||
      sarea->TexState[0].texctl2 &= ~TMC_specen_enable;
 | 
			
		||||
      sarea->TexState[1].texctl2 &= ~TMC_specen_enable;
 | 
			
		||||
   }
 | 
			
		||||
   sarea->TexState[0].texctl2 &= ~TMC_specen_enable;
 | 
			
		||||
   sarea->TexState[1].texctl2 &= ~TMC_specen_enable;
 | 
			
		||||
   sarea->TexState[0].texctl2 |= mmesa->hw.specen;
 | 
			
		||||
   sarea->TexState[1].texctl2 |= mmesa->hw.specen;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1089,23 +1084,23 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa )
 | 
			
		||||
static void mgaDDValidateState( GLcontext *ctx )
 | 
			
		||||
{
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT( ctx );
 | 
			
		||||
   int new_state = mmesa->NewGLState;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   FLUSH_BATCH( mmesa );
 | 
			
		||||
 | 
			
		||||
   if (mmesa->NewGLState & _MGA_NEW_RASTERSETUP) {
 | 
			
		||||
      mgaChooseVertexState( ctx );
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (mmesa->NewGLState & _MGA_NEW_RENDERSTATE) {
 | 
			
		||||
      mgaChooseRenderState( ctx );
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (new_state & _NEW_TEXTURE) {
 | 
			
		||||
   if (mmesa->NewGLState & _NEW_TEXTURE) {
 | 
			
		||||
      mgaUpdateTextureState(ctx);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (!mmesa->Fallback) {
 | 
			
		||||
      if (mmesa->NewGLState & _MGA_NEW_RASTERSETUP) {
 | 
			
		||||
         mgaChooseVertexState( ctx );
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (mmesa->NewGLState & _MGA_NEW_RENDERSTATE) {
 | 
			
		||||
         mgaChooseRenderState( ctx );
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   mmesa->NewGLState = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1186,13 +1181,14 @@ void mgaInitState( mgaContextPtr mmesa )
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   mmesa->hw.blend_func = AC_src_one | AC_dst_zero;
 | 
			
		||||
   mmesa->hw.zmode = DC_zmode_zlt | DC_atype_zi;
 | 
			
		||||
   mmesa->hw.stencil = (0x0ff << S_smsk_SHIFT) | (0x0ff << S_swtmsk_SHIFT);
 | 
			
		||||
   mmesa->hw.stencilctl = SC_smode_salways | SC_sfailop_keep 
 | 
			
		||||
       | SC_szfailop_keep | SC_szpassop_keep;
 | 
			
		||||
   mmesa->hw.stencil_enable = 0;
 | 
			
		||||
   mmesa->hw.cull = _CULL_NEGATIVE;
 | 
			
		||||
   mmesa->hw.cull_dualtex = _CULL_POSITIVE;
 | 
			
		||||
   mmesa->hw.cull = _CULL_DISABLE;
 | 
			
		||||
   mmesa->hw.cull_dualtex = _CULL_DISABLE;
 | 
			
		||||
   mmesa->hw.specen = 0;
 | 
			
		||||
 | 
			
		||||
   mmesa->setup.dwgctl = (DC_opcod_trap |
 | 
			
		||||
@@ -1227,6 +1223,10 @@ void mgaInitState( mgaContextPtr mmesa )
 | 
			
		||||
   mmesa->setup.tdualstage1 = 0;
 | 
			
		||||
   mmesa->setup.fcol = 0;
 | 
			
		||||
   mmesa->dirty |= MGA_UPLOAD_CONTEXT;
 | 
			
		||||
 | 
			
		||||
   mmesa->envcolor = 0;
 | 
			
		||||
   mmesa->blend_flags = MGA_BLEND_RGB_ZERO | MGA_BLEND_ALPHA_ZERO;
 | 
			
		||||
   mmesa->dualtex_env = GL_FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1243,7 +1243,6 @@ void mgaDDInitStateFuncs( GLcontext *ctx )
 | 
			
		||||
   ctx->Driver.DepthMask = mgaDDDepthMask;
 | 
			
		||||
   ctx->Driver.Fogfv = mgaDDFogfv;
 | 
			
		||||
   ctx->Driver.Scissor = mgaDDScissor;
 | 
			
		||||
   ctx->Driver.ShadeModel = mgaDDShadeModel;
 | 
			
		||||
   ctx->Driver.CullFace = mgaDDCullFaceFrontFace;
 | 
			
		||||
   ctx->Driver.FrontFace = mgaDDCullFaceFrontFace;
 | 
			
		||||
   ctx->Driver.ColorMask = mgaDDColorMask;
 | 
			
		||||
 
 | 
			
		||||
@@ -221,7 +221,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
 | 
			
		||||
   case GL_ALPHA16:
 | 
			
		||||
   case GL_COMPRESSED_ALPHA:
 | 
			
		||||
      /* FIXME: This will report incorrect component sizes... */
 | 
			
		||||
      return &_mesa_texformat_argb4444;
 | 
			
		||||
      return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
 | 
			
		||||
 | 
			
		||||
   case 1:
 | 
			
		||||
   case GL_LUMINANCE:
 | 
			
		||||
@@ -231,7 +231,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
 | 
			
		||||
   case GL_LUMINANCE16:
 | 
			
		||||
   case GL_COMPRESSED_LUMINANCE:
 | 
			
		||||
      /* FIXME: This will report incorrect component sizes... */
 | 
			
		||||
      return &_mesa_texformat_rgb565;
 | 
			
		||||
      return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_rgb565;
 | 
			
		||||
 | 
			
		||||
   case 2:
 | 
			
		||||
   case GL_LUMINANCE_ALPHA:
 | 
			
		||||
@@ -243,7 +243,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
 | 
			
		||||
   case GL_LUMINANCE16_ALPHA16:
 | 
			
		||||
   case GL_COMPRESSED_LUMINANCE_ALPHA:
 | 
			
		||||
      /* FIXME: This will report incorrect component sizes... */
 | 
			
		||||
      return &_mesa_texformat_argb4444;
 | 
			
		||||
      return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
 | 
			
		||||
 | 
			
		||||
   case GL_INTENSITY:
 | 
			
		||||
   case GL_INTENSITY4:
 | 
			
		||||
@@ -252,7 +252,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
 | 
			
		||||
   case GL_INTENSITY16:
 | 
			
		||||
   case GL_COMPRESSED_INTENSITY:
 | 
			
		||||
      /* FIXME: This will report incorrect component sizes... */
 | 
			
		||||
      return &_mesa_texformat_argb4444;
 | 
			
		||||
      return MGA_IS_G400(mmesa) ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444;
 | 
			
		||||
 | 
			
		||||
   case GL_YCBCR_MESA:
 | 
			
		||||
      if (MGA_IS_G400(mmesa) &&
 | 
			
		||||
@@ -309,6 +309,7 @@ mgaAllocTexObj( struct gl_texture_object *tObj )
 | 
			
		||||
			    | TF_uvoffset_OGL);
 | 
			
		||||
 | 
			
		||||
      t->border_fallback = GL_FALSE;
 | 
			
		||||
      t->texenv_fallback = GL_FALSE;
 | 
			
		||||
 | 
			
		||||
      make_empty_list( & t->base );
 | 
			
		||||
 | 
			
		||||
@@ -328,31 +329,31 @@ static void mgaDDTexEnv( GLcontext *ctx, GLenum target,
 | 
			
		||||
   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
 | 
			
		||||
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   switch( pname ) {
 | 
			
		||||
   case GL_TEXTURE_ENV_COLOR: {
 | 
			
		||||
      GLubyte c[4];
 | 
			
		||||
      GLuint envColor;
 | 
			
		||||
 | 
			
		||||
      UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
 | 
			
		||||
      envColor = mgaPackColor( mmesa->mgaScreen->cpp, c[0], c[1], c[2], c[3] );
 | 
			
		||||
      mmesa->envcolor = PACK_COLOR_8888( c[3], c[0], c[1], c[2] );
 | 
			
		||||
 | 
			
		||||
      if (mmesa->setup.fcol != envColor) {
 | 
			
		||||
      if (mmesa->setup.fcol != mmesa->envcolor) {
 | 
			
		||||
	 FLUSH_BATCH(mmesa);
 | 
			
		||||
	 mmesa->setup.fcol = envColor;
 | 
			
		||||
	 mmesa->setup.fcol = mmesa->envcolor;
 | 
			
		||||
	 mmesa->dirty |= MGA_UPLOAD_CONTEXT;
 | 
			
		||||
 | 
			
		||||
	 mmesa->blend_flags &= ~MGA_BLEND_ENV_COLOR;
 | 
			
		||||
	 mmesa->blend_flags = 0;
 | 
			
		||||
 | 
			
		||||
	 /* Actually just require all four components to be
 | 
			
		||||
	  * equal.  This permits a single-pass GL_BLEND.
 | 
			
		||||
	  *
 | 
			
		||||
	  * More complex multitexture/multipass fallbacks
 | 
			
		||||
	  * for blend can be done later.
 | 
			
		||||
	  */
 | 
			
		||||
	 if (mmesa->envcolor != 0x0 && mmesa->envcolor != 0xffffffff)
 | 
			
		||||
	    mmesa->blend_flags |= MGA_BLEND_ENV_COLOR;
 | 
			
		||||
         if ((mmesa->envcolor & 0xffffff) == 0x0) {
 | 
			
		||||
            mmesa->blend_flags |= MGA_BLEND_RGB_ZERO;
 | 
			
		||||
         } else if ((mmesa->envcolor & 0xffffff) == 0xffffff) {
 | 
			
		||||
            mmesa->blend_flags |= MGA_BLEND_RGB_ONE;
 | 
			
		||||
         }
 | 
			
		||||
 | 
			
		||||
	 if ((mmesa->envcolor >> 24) == 0x0) {
 | 
			
		||||
            mmesa->blend_flags |= MGA_BLEND_ALPHA_ZERO;
 | 
			
		||||
         } else if ((mmesa->envcolor >> 24) == 0xff) {
 | 
			
		||||
            mmesa->blend_flags |= MGA_BLEND_ALPHA_ONE;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
@@ -445,8 +446,9 @@ mgaDDTexParameter( GLcontext *ctx, GLenum target,
 | 
			
		||||
    * to do anything now 
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
   if ( (t == NULL)
 | 
			
		||||
        || (target != GL_TEXTURE_2D) ) {
 | 
			
		||||
   if ( (t == NULL) ||
 | 
			
		||||
        (target != GL_TEXTURE_2D &&
 | 
			
		||||
         target != GL_TEXTURE_RECTANGLE_NV) ) {
 | 
			
		||||
      return;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
@@ -492,7 +494,8 @@ static void
 | 
			
		||||
mgaDDBindTexture( GLcontext *ctx, GLenum target,
 | 
			
		||||
		  struct gl_texture_object *tObj )
 | 
			
		||||
{
 | 
			
		||||
   if ( target == GL_TEXTURE_2D ) {
 | 
			
		||||
   if ( target == GL_TEXTURE_2D ||
 | 
			
		||||
        target == GL_TEXTURE_RECTANGLE_NV ) {
 | 
			
		||||
      if ( tObj->DriverData == NULL ) {
 | 
			
		||||
	 mgaAllocTexObj( tObj );
 | 
			
		||||
      }
 | 
			
		||||
@@ -547,5 +550,7 @@ mgaDDInitTextureFuncs( GLcontext *ctx )
 | 
			
		||||
   ctx->Driver.TexEnv			= mgaDDTexEnv;
 | 
			
		||||
   ctx->Driver.TexParameter		= mgaDDTexParameter;
 | 
			
		||||
 | 
			
		||||
   driInitTextureObjects( ctx, & mmesa->swapped, DRI_TEXMGR_DO_TEXTURE_2D );
 | 
			
		||||
   driInitTextureObjects( ctx, & mmesa->swapped,
 | 
			
		||||
                          (DRI_TEXMGR_DO_TEXTURE_2D |
 | 
			
		||||
                           DRI_TEXMGR_DO_TEXTURE_RECT) );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -46,4 +46,6 @@ void mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t );
 | 
			
		||||
 | 
			
		||||
void mgaDDInitTextureFuncs( GLcontext *ctx );
 | 
			
		||||
 | 
			
		||||
GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit );
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user