Compare commits
	
		
			293 Commits
		
	
	
		
			mesa_6_5_3
			...
			mesa_7_0_1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					005eea249c | ||
| 
						 | 
					9747de8ec6 | ||
| 
						 | 
					849a9799d0 | ||
| 
						 | 
					e32ae4fe33 | ||
| 
						 | 
					4595389c4c | ||
| 
						 | 
					e8ccc7cc49 | ||
| 
						 | 
					673d21047a | ||
| 
						 | 
					fdefc2bbda | ||
| 
						 | 
					2079df8527 | ||
| 
						 | 
					b53659452c | ||
| 
						 | 
					46f1d6653e | ||
| 
						 | 
					c1938a60f7 | ||
| 
						 | 
					d65110f352 | ||
| 
						 | 
					9fa3bbcb5a | ||
| 
						 | 
					99d62f2922 | ||
| 
						 | 
					284743cafe | ||
| 
						 | 
					08d7307b2a | ||
| 
						 | 
					ef6a64abe6 | ||
| 
						 | 
					18bfa52ef7 | ||
| 
						 | 
					d62be2652c | ||
| 
						 | 
					ea53ff80af | ||
| 
						 | 
					feeca1bcbc | ||
| 
						 | 
					12e7278c08 | ||
| 
						 | 
					45b5c44eb9 | ||
| 
						 | 
					e3456c1028 | ||
| 
						 | 
					327fb38573 | ||
| 
						 | 
					1d25d9e15f | ||
| 
						 | 
					cc7cee3f48 | ||
| 
						 | 
					d7062710cd | ||
| 
						 | 
					9bfba734d8 | ||
| 
						 | 
					aaebf2f47e | ||
| 
						 | 
					23f8d77b38 | ||
| 
						 | 
					87d22ee0fe | ||
| 
						 | 
					52e25f63d4 | ||
| 
						 | 
					f3fb67972b | ||
| 
						 | 
					6400756364 | ||
| 
						 | 
					d59f0314bd | ||
| 
						 | 
					131baefac3 | ||
| 
						 | 
					a450078b67 | ||
| 
						 | 
					f6b041bf6c | ||
| 
						 | 
					4f340d181a | ||
| 
						 | 
					b58e38e936 | ||
| 
						 | 
					8713cb48a8 | ||
| 
						 | 
					277c5e57ed | ||
| 
						 | 
					b3d62d5af5 | ||
| 
						 | 
					9c0f0c8d81 | ||
| 
						 | 
					18a0a2a7ac | ||
| 
						 | 
					8b99d9e33c | ||
| 
						 | 
					01e7e153e3 | ||
| 
						 | 
					0ad4ca24d2 | ||
| 
						 | 
					724a155552 | ||
| 
						 | 
					d38b74a316 | ||
| 
						 | 
					54cab4b47b | ||
| 
						 | 
					c093666bc5 | ||
| 
						 | 
					04972f6761 | ||
| 
						 | 
					67f8234622 | ||
| 
						 | 
					201d6dbd9c | ||
| 
						 | 
					fbcac5aa83 | ||
| 
						 | 
					2b72ab8f8f | ||
| 
						 | 
					0ea97b9408 | ||
| 
						 | 
					28683ac7c0 | ||
| 
						 | 
					c72e3e210f | ||
| 
						 | 
					b0fe0d8a55 | ||
| 
						 | 
					c128c3ce8c | ||
| 
						 | 
					6efdf648f5 | ||
| 
						 | 
					6a587c0124 | ||
| 
						 | 
					524c3336c4 | ||
| 
						 | 
					0e7e211055 | ||
| 
						 | 
					4e641bf3e9 | ||
| 
						 | 
					2189ff5e51 | ||
| 
						 | 
					33a73466ae | ||
| 
						 | 
					13c0abd8a7 | ||
| 
						 | 
					82de92c0fb | ||
| 
						 | 
					e4b8481f39 | ||
| 
						 | 
					b5990cec90 | ||
| 
						 | 
					d93642251e | ||
| 
						 | 
					c66fd808ac | ||
| 
						 | 
					73449270bb | ||
| 
						 | 
					6f56e68ee3 | ||
| 
						 | 
					65fae19383 | ||
| 
						 | 
					b78aec5767 | ||
| 
						 | 
					6bae7d40f7 | ||
| 
						 | 
					5f1f1f5704 | ||
| 
						 | 
					93881edb46 | ||
| 
						 | 
					56b99ace19 | ||
| 
						 | 
					3aad47679e | ||
| 
						 | 
					dac5303692 | ||
| 
						 | 
					64b03f33ee | ||
| 
						 | 
					b8b0dd1e20 | ||
| 
						 | 
					93f9e61f43 | ||
| 
						 | 
					f405fbb36d | ||
| 
						 | 
					5a09ea01e0 | ||
| 
						 | 
					98d25a5a28 | ||
| 
						 | 
					0aa998b2ab | ||
| 
						 | 
					b6087270a0 | ||
| 
						 | 
					3f709f16ef | ||
| 
						 | 
					67363327e5 | ||
| 
						 | 
					bcaf8fc7b1 | ||
| 
						 | 
					ef29d6af6c | ||
| 
						 | 
					6a69bb5864 | ||
| 
						 | 
					cbd29adbc8 | ||
| 
						 | 
					c729e67321 | ||
| 
						 | 
					5b23d36613 | ||
| 
						 | 
					a87390504f | ||
| 
						 | 
					cc358d861d | ||
| 
						 | 
					749e093e33 | ||
| 
						 | 
					eab6e16522 | ||
| 
						 | 
					1b39be3790 | ||
| 
						 | 
					69ff5a3dbc | ||
| 
						 | 
					01ec508c7f | ||
| 
						 | 
					d4e3b0b2c2 | ||
| 
						 | 
					b63c70666f | ||
| 
						 | 
					c33c00764c | ||
| 
						 | 
					6c342ad859 | ||
| 
						 | 
					86e4f52f3c | ||
| 
						 | 
					f0707c789a | ||
| 
						 | 
					aed53ba525 | ||
| 
						 | 
					3dec7c57b0 | ||
| 
						 | 
					544e441f53 | ||
| 
						 | 
					fa546c367d | ||
| 
						 | 
					64a6a50155 | ||
| 
						 | 
					c103453d4f | ||
| 
						 | 
					d7e3d1dc42 | ||
| 
						 | 
					02e44e41c8 | ||
| 
						 | 
					eed67a6e3e | ||
| 
						 | 
					e856edb279 | ||
| 
						 | 
					58239d2ae3 | ||
| 
						 | 
					2f6a0840c4 | ||
| 
						 | 
					c9e723e501 | ||
| 
						 | 
					87a980a795 | ||
| 
						 | 
					e282f89a38 | ||
| 
						 | 
					e2e4b60c7d | ||
| 
						 | 
					58dacc8df1 | ||
| 
						 | 
					b470189378 | ||
| 
						 | 
					574bf4d346 | ||
| 
						 | 
					795ebb1a3b | ||
| 
						 | 
					d0be8b959a | ||
| 
						 | 
					672ecba175 | ||
| 
						 | 
					0dcea4bf8e | ||
| 
						 | 
					16c503f39a | ||
| 
						 | 
					4d5d4e1f97 | ||
| 
						 | 
					a9ab36b8f2 | ||
| 
						 | 
					88288b614e | ||
| 
						 | 
					a154706061 | ||
| 
						 | 
					6fe41a4c01 | ||
| 
						 | 
					f4a2b9f83d | ||
| 
						 | 
					56c2f7bb42 | ||
| 
						 | 
					df747eb354 | ||
| 
						 | 
					ff7a41a159 | ||
| 
						 | 
					01fdb34b39 | ||
| 
						 | 
					3c9e5cb0bd | ||
| 
						 | 
					a6aa1f8016 | ||
| 
						 | 
					967c2d220d | ||
| 
						 | 
					0e6b7eb9c0 | ||
| 
						 | 
					ed42bd6e20 | ||
| 
						 | 
					2db667290a | ||
| 
						 | 
					cea0c2b144 | ||
| 
						 | 
					2b5ef29a7b | ||
| 
						 | 
					4ed59c6012 | ||
| 
						 | 
					7e7b1f7c4d | ||
| 
						 | 
					c48e4c6f09 | ||
| 
						 | 
					4f20fe8a93 | ||
| 
						 | 
					d28f6d9176 | ||
| 
						 | 
					fe6a2c4295 | ||
| 
						 | 
					faf47d9f84 | ||
| 
						 | 
					f9828f5c4f | ||
| 
						 | 
					7b165de5f8 | ||
| 
						 | 
					62ef001de7 | ||
| 
						 | 
					76d7b62cd2 | ||
| 
						 | 
					901fc0de18 | ||
| 
						 | 
					c970811dab | ||
| 
						 | 
					bb97694fad | ||
| 
						 | 
					516259d609 | ||
| 
						 | 
					3e4302fe3b | ||
| 
						 | 
					dcc8e5f4c1 | ||
| 
						 | 
					32c8d002d0 | ||
| 
						 | 
					c9b87b8ad8 | ||
| 
						 | 
					5d61cfd1fd | ||
| 
						 | 
					93e957cc65 | ||
| 
						 | 
					3eae496deb | ||
| 
						 | 
					81c6516af1 | ||
| 
						 | 
					9e91351826 | ||
| 
						 | 
					328b307e2f | ||
| 
						 | 
					d316b4dc22 | ||
| 
						 | 
					f0126a76ac | ||
| 
						 | 
					b8640db021 | ||
| 
						 | 
					28b47110b6 | ||
| 
						 | 
					fe2c58d2d5 | ||
| 
						 | 
					4917955205 | ||
| 
						 | 
					eca50a27e1 | ||
| 
						 | 
					0950e9727e | ||
| 
						 | 
					504fafe389 | ||
| 
						 | 
					72608aedc3 | ||
| 
						 | 
					be56660ba0 | ||
| 
						 | 
					36c8bc6141 | ||
| 
						 | 
					5c8296a6ab | ||
| 
						 | 
					6665658a56 | ||
| 
						 | 
					204bc4e441 | ||
| 
						 | 
					e90ad3dbbb | ||
| 
						 | 
					8d62afdb6a | ||
| 
						 | 
					59494bafb4 | ||
| 
						 | 
					33939fd29b | ||
| 
						 | 
					4960af08ad | ||
| 
						 | 
					f5b0cafbb1 | ||
| 
						 | 
					c578354642 | ||
| 
						 | 
					da37ac5ee7 | ||
| 
						 | 
					ed2fddc98e | ||
| 
						 | 
					58eaf0acca | ||
| 
						 | 
					d132f7245d | ||
| 
						 | 
					73bc8b63ac | ||
| 
						 | 
					377ce9e074 | ||
| 
						 | 
					f1d785188b | ||
| 
						 | 
					313c4c2643 | ||
| 
						 | 
					fbeae4f70c | ||
| 
						 | 
					9301a6a325 | ||
| 
						 | 
					6c036812be | ||
| 
						 | 
					c6abbbfd02 | ||
| 
						 | 
					8a7f474c69 | ||
| 
						 | 
					47e33a27df | ||
| 
						 | 
					401629c721 | ||
| 
						 | 
					f1770c3210 | ||
| 
						 | 
					8130a4fe98 | ||
| 
						 | 
					8f1c63b263 | ||
| 
						 | 
					857ebc6d47 | ||
| 
						 | 
					660bdc616b | ||
| 
						 | 
					88ae491bd2 | ||
| 
						 | 
					8445960d9f | ||
| 
						 | 
					74cae00c0e | ||
| 
						 | 
					56d9663574 | ||
| 
						 | 
					81d1a04e04 | ||
| 
						 | 
					62cbe6c3f3 | ||
| 
						 | 
					16cec9f767 | ||
| 
						 | 
					5e2a66466d | ||
| 
						 | 
					b3378f6cc5 | ||
| 
						 | 
					91948f99dd | ||
| 
						 | 
					ae5f67575d | ||
| 
						 | 
					e75fbd3f91 | ||
| 
						 | 
					a6dad578b5 | ||
| 
						 | 
					c6443eb1a3 | ||
| 
						 | 
					121533defb | ||
| 
						 | 
					3cddba688d | ||
| 
						 | 
					dc881e1909 | ||
| 
						 | 
					2dfb03beb2 | ||
| 
						 | 
					18cfe0c801 | ||
| 
						 | 
					60d136f63c | ||
| 
						 | 
					62da6a1b3e | ||
| 
						 | 
					77e7535c0f | ||
| 
						 | 
					5c1b53d58d | ||
| 
						 | 
					b2f1d6422b | ||
| 
						 | 
					99f24c8d17 | ||
| 
						 | 
					04c401c91e | ||
| 
						 | 
					03f201d935 | ||
| 
						 | 
					594b5ad87d | ||
| 
						 | 
					bfd5cf72c4 | ||
| 
						 | 
					7559364027 | ||
| 
						 | 
					65faf02367 | ||
| 
						 | 
					c409dbcae3 | ||
| 
						 | 
					cbf280dc26 | ||
| 
						 | 
					af0ae93863 | ||
| 
						 | 
					bcc3baadba | ||
| 
						 | 
					4ca7c804db | ||
| 
						 | 
					bfaf6156fb | ||
| 
						 | 
					d741b10be6 | ||
| 
						 | 
					e371a5f084 | ||
| 
						 | 
					af846712fd | ||
| 
						 | 
					c4615abb11 | ||
| 
						 | 
					430e036413 | ||
| 
						 | 
					502ebe90e8 | ||
| 
						 | 
					02e958a1e4 | ||
| 
						 | 
					cce5084941 | ||
| 
						 | 
					4b1d1b7b18 | ||
| 
						 | 
					7ff72a7659 | ||
| 
						 | 
					c4b3b8dece | ||
| 
						 | 
					65bab0dad8 | ||
| 
						 | 
					74edc663a6 | ||
| 
						 | 
					54d59cfb70 | ||
| 
						 | 
					b7f5b8af65 | ||
| 
						 | 
					4099531a0a | ||
| 
						 | 
					1606f2c123 | ||
| 
						 | 
					1dd7c00214 | ||
| 
						 | 
					f42d4ab41e | ||
| 
						 | 
					4a28548cbf | ||
| 
						 | 
					5814922d25 | ||
| 
						 | 
					3de20aead2 | ||
| 
						 | 
					6d27194dff | ||
| 
						 | 
					c233aa2768 | ||
| 
						 | 
					c93b2a1cb7 | ||
| 
						 | 
					eca456b63d | ||
| 
						 | 
					4003bde6ff | ||
| 
						 | 
					ddcf819906 | ||
| 
						 | 
					9ede048127 | ||
| 
						 | 
					97693436a5 | ||
| 
						 | 
					8a8a5bd104 | 
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,7 +1,8 @@
 | 
			
		||||
*~
 | 
			
		||||
*.a
 | 
			
		||||
*.o
 | 
			
		||||
*.so
 | 
			
		||||
*.sw[a-z]
 | 
			
		||||
*~
 | 
			
		||||
depend
 | 
			
		||||
depend.bak
 | 
			
		||||
lib
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								Makefile
									
									
									
									
									
								
							@@ -7,7 +7,9 @@ SUBDIRS = src progs
 | 
			
		||||
 | 
			
		||||
default: $(TOP)/configs/current
 | 
			
		||||
	@for dir in $(SUBDIRS) ; do \
 | 
			
		||||
		(cd $$dir ; $(MAKE)) || exit 1 ; \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir && $(MAKE)) || exit 1 ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -16,7 +18,9 @@ doxygen:
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	@for dir in $(SUBDIRS) ; do \
 | 
			
		||||
		(cd $$dir ; $(MAKE) clean) ; \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir && $(MAKE) clean) ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -34,9 +38,12 @@ realclean:
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	@for dir in $(SUBDIRS) ; do \
 | 
			
		||||
		(cd $$dir ; $(MAKE) install) || exit 1 ; \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir && $(MAKE) install) || exit 1 ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# DirectFBGL module installation
 | 
			
		||||
linux-directfb-install:
 | 
			
		||||
	cd src/mesa/drivers/directfb && $(MAKE) install
 | 
			
		||||
@@ -155,10 +162,10 @@ ultrix-gcc:
 | 
			
		||||
 | 
			
		||||
# Rules for making release tarballs
 | 
			
		||||
 | 
			
		||||
DIRECTORY = Mesa-6.5.3rc3
 | 
			
		||||
LIB_NAME = MesaLib-6.5.3rc3
 | 
			
		||||
DEMO_NAME = MesaDemos-6.5.3rc3
 | 
			
		||||
GLUT_NAME = MesaGLUT-6.5.3rc3
 | 
			
		||||
DIRECTORY = Mesa-7.0.1
 | 
			
		||||
LIB_NAME = MesaLib-7.0.1
 | 
			
		||||
DEMO_NAME = MesaDemos-7.0.1
 | 
			
		||||
GLUT_NAME = MesaGLUT-7.0.1
 | 
			
		||||
 | 
			
		||||
MAIN_FILES = \
 | 
			
		||||
	$(DIRECTORY)/Makefile*						\
 | 
			
		||||
@@ -222,6 +229,9 @@ MAIN_FILES = \
 | 
			
		||||
	$(DIRECTORY)/src/mesa/shader/slang/descrip.mms			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/shader/slang/sources			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch]		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/shader/slang/library/*.gc			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/shader/slang/library/*.syn		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/shader/slang/library/Makefile		\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast/*.[ch]				\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast/descrip.mms			\
 | 
			
		||||
	$(DIRECTORY)/src/mesa/swrast/sources				\
 | 
			
		||||
@@ -278,17 +288,6 @@ MAIN_FILES = \
 | 
			
		||||
	$(DIRECTORY)/vms/analyze_map.com				\
 | 
			
		||||
	$(DIRECTORY)/vms/xlib.opt					\
 | 
			
		||||
	$(DIRECTORY)/vms/xlib_share.opt					\
 | 
			
		||||
	$(DIRECTORY)/windows/VC6/mesa/gdi/gdi.dsp			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC6/mesa/glu/*.txt				\
 | 
			
		||||
	$(DIRECTORY)/windows/VC6/mesa/glu/glu.dsp			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC6/mesa/mesa.dsw				\
 | 
			
		||||
	$(DIRECTORY)/windows/VC6/mesa/mesa/mesa.dsp			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC6/mesa/osmesa/osmesa.dsp			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC7/mesa/gdi/gdi.vcproj			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC7/mesa/glu/glu.vcproj			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC7/mesa/mesa.sln				\
 | 
			
		||||
	$(DIRECTORY)/windows/VC7/mesa/mesa/mesa.vcproj			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj		\
 | 
			
		||||
	$(DIRECTORY)/windows/VC8/mesa/mesa.sln				\
 | 
			
		||||
	$(DIRECTORY)/windows/VC8/mesa/gdi/gdi.vcproj			\
 | 
			
		||||
	$(DIRECTORY)/windows/VC8/mesa/glu/glu.vcproj			\
 | 
			
		||||
@@ -318,6 +317,7 @@ SGI_GLU_FILES = \
 | 
			
		||||
	$(DIRECTORY)/src/glu/Makefile					\
 | 
			
		||||
	$(DIRECTORY)/src/glu/descrip.mms				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.mgw				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.win				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/Makefile.DJ				\
 | 
			
		||||
	$(DIRECTORY)/src/glu/sgi/glu.def				\
 | 
			
		||||
@@ -362,6 +362,8 @@ DEMO_FILES = \
 | 
			
		||||
	$(DIRECTORY)/progs/demos/*.cxx			\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/*.dat			\
 | 
			
		||||
	$(DIRECTORY)/progs/demos/README			\
 | 
			
		||||
	$(DIRECTORY)/progs/fbdev/Makefile		\
 | 
			
		||||
	$(DIRECTORY)/progs/fbdev/glfbdevtest.c		\
 | 
			
		||||
	$(DIRECTORY)/progs/osdemos/Makefile		\
 | 
			
		||||
	$(DIRECTORY)/progs/osdemos/*.c			\
 | 
			
		||||
	$(DIRECTORY)/progs/xdemos/Makefile*		\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								Makefile.mgw
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								Makefile.mgw
									
									
									
									
									
								
							@@ -51,37 +51,59 @@
 | 
			
		||||
#	realclean:	remove all generated files
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# MinGW core makefile updated for Mesa 7.0
 | 
			
		||||
#
 | 
			
		||||
#  Updated : by Heromyth, on 2007-7-21
 | 
			
		||||
#  Email   : zxpmyth@yahoo.com.cn
 | 
			
		||||
#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
 | 
			
		||||
#            The others havn't been tested yet.
 | 
			
		||||
#            2) The generated DLLs are *not* compatible with the ones built
 | 
			
		||||
#            with the other compilers like VC8, especially for GLUT. 
 | 
			
		||||
#            3) MAlthough more tests are needed, it can be used individually!
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.PHONY : all libgl clean realclean
 | 
			
		||||
 | 
			
		||||
ifeq ($(ICD),1)
 | 
			
		||||
  # when -std=c99 mingw will not define WIN32
 | 
			
		||||
  CFLAGS = -Wall -W -Werror
 | 
			
		||||
  CFLAGS = -Wall -Werror
 | 
			
		||||
else
 | 
			
		||||
  # I love c89
 | 
			
		||||
  CFLAGS = -Wall -W -pedantic
 | 
			
		||||
  CFLAGS = -Wall -pedantic
 | 
			
		||||
endif
 | 
			
		||||
CFLAGS += -O2 -ffast-math
 | 
			
		||||
 | 
			
		||||
export CFLAGS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
 | 
			
		||||
UNLINK = del $(subst /,\,$(1))
 | 
			
		||||
else
 | 
			
		||||
UNLINK = $(RM) $(1)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
all: libgl
 | 
			
		||||
all: libgl libglu libglut example
 | 
			
		||||
 | 
			
		||||
libgl: lib
 | 
			
		||||
	$(MAKE) -f Makefile.mgw -C src/mesa
 | 
			
		||||
 | 
			
		||||
libglu: libgl
 | 
			
		||||
	$(MAKE) -f Makefile.mgw -C src/glu/sgi
 | 
			
		||||
 | 
			
		||||
libglut: libglu 
 | 
			
		||||
	$(MAKE) -f Makefile.mgw -C src/glut/glx
 | 
			
		||||
 | 
			
		||||
example: libglut 
 | 
			
		||||
	$(MAKE) -f Makefile.mgw star -C progs/samples
 | 
			
		||||
	copy progs\samples\star.exe lib
 | 
			
		||||
 | 
			
		||||
lib:
 | 
			
		||||
	mkdir lib
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	$(MAKE) -f Makefile.mgw clean -C src/mesa
 | 
			
		||||
	$(MAKE) -f Makefile.mgw clean -C src/glu/sgi
 | 
			
		||||
	$(MAKE) -f Makefile.mgw clean -C src/glut/glx
 | 
			
		||||
 | 
			
		||||
realclean: clean
 | 
			
		||||
	-$(call UNLINK,lib/*.a)
 | 
			
		||||
 
 | 
			
		||||
@@ -100,6 +100,14 @@ do
 | 
			
		||||
	-L*)
 | 
			
		||||
	    DEPS="$DEPS $1"
 | 
			
		||||
	    ;;
 | 
			
		||||
	-pthread)
 | 
			
		||||
	    # this is a special case (see bugzilla 10876)
 | 
			
		||||
	    DEPS="$DEPS $1"
 | 
			
		||||
	    ;;
 | 
			
		||||
	'-pthread')
 | 
			
		||||
	    # for FreeBSD
 | 
			
		||||
	    DEPS="$DEPS -pthread"
 | 
			
		||||
	    ;;
 | 
			
		||||
	'-cplusplus')
 | 
			
		||||
	    CPLUSPLUS=1
 | 
			
		||||
	    ;;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										42
									
								
								configs/config.mgw
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								configs/config.mgw
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
# MinGW config include file updated for Mesa 7.0
 | 
			
		||||
#
 | 
			
		||||
#  Updated : by Heromyth, on 2007-7-21
 | 
			
		||||
#  Email   : zxpmyth@yahoo.com.cn
 | 
			
		||||
#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
 | 
			
		||||
#            The others havn't been tested yet.
 | 
			
		||||
#            2) The generated DLLs are *not* compatible with the ones built
 | 
			
		||||
#            with the other compilers like VC8, especially for GLUT. 
 | 
			
		||||
#            3) Although more tests are needed, it can be used individually!
 | 
			
		||||
 | 
			
		||||
# The generated DLLs by MingW with STDCALL are not totally compatible 
 | 
			
		||||
# with the ones linked by Microsoft's compilers.
 | 
			
		||||
#
 | 
			
		||||
# xxx_USING_STDCALL = 1          Compiling MESA with __stdcall. This is default!
 | 
			
		||||
# 
 | 
			
		||||
# xxx_USING_STDCALL = 0          Compiling MESA without __stdcall. I like this:)
 | 
			
		||||
#  
 | 
			
		||||
 | 
			
		||||
# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be
 | 
			
		||||
# different. For example:
 | 
			
		||||
#
 | 
			
		||||
#   GL_USING_STDCALL = 0
 | 
			
		||||
#   GLUT_USING_STDCALL = 1
 | 
			
		||||
# 
 | 
			
		||||
# Suggested setting:
 | 
			
		||||
#
 | 
			
		||||
#     ALL_USING_STDCALL = 1
 | 
			
		||||
#
 | 
			
		||||
# That's default!
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ALL_USING_STDCALL = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ifeq ($(ALL_USING_STDCALL),1)
 | 
			
		||||
  GL_USING_STDCALL = 1
 | 
			
		||||
  GLUT_USING_STDCALL = 1
 | 
			
		||||
else
 | 
			
		||||
  GL_USING_STDCALL = 0
 | 
			
		||||
  GLUT_USING_STDCALL = 0
 | 
			
		||||
endif
 | 
			
		||||
@@ -8,9 +8,9 @@
 | 
			
		||||
CONFIG_NAME = default
 | 
			
		||||
 | 
			
		||||
# Version info
 | 
			
		||||
MESA_MAJOR=6
 | 
			
		||||
MESA_MINOR=5
 | 
			
		||||
MESA_TINY=3
 | 
			
		||||
MESA_MAJOR=7
 | 
			
		||||
MESA_MINOR=0
 | 
			
		||||
MESA_TINY=1
 | 
			
		||||
 | 
			
		||||
# external projects.  This should be useless now that we use libdrm.
 | 
			
		||||
DRM_SOURCE_PATH=$(TOP)/../drm
 | 
			
		||||
 
 | 
			
		||||
@@ -27,9 +27,9 @@ ASM_SOURCES =
 | 
			
		||||
# Library/program dependencies
 | 
			
		||||
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
 | 
			
		||||
LIBDRM_LIB = `pkg-config --libs libdrm`
 | 
			
		||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
 | 
			
		||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
 | 
			
		||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
 | 
			
		||||
	-lm -lpthread $(LIBDRM_LIB)
 | 
			
		||||
	-lm -pthread $(LIBDRM_LIB)
 | 
			
		||||
 | 
			
		||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
 | 
			
		||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11
 | 
			
		||||
 
 | 
			
		||||
@@ -67,4 +67,4 @@ WINDOW_SYSTEM=dri
 | 
			
		||||
# gamma are missing because they have not been converted to use the new
 | 
			
		||||
# interface.
 | 
			
		||||
DRI_DIRS = i810 i915tex i915 i965 mach64 mga r128 r200 r300 radeon s3v \
 | 
			
		||||
	savage sis tdfx trident unichrome ffb nouveau
 | 
			
		||||
	savage sis tdfx trident unichrome ffb
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,13 @@ PIC_FLAGS  = -fPIC
 | 
			
		||||
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
 | 
			
		||||
ARCH_FLAGS ?=
 | 
			
		||||
 | 
			
		||||
# DRM and pciaccess
 | 
			
		||||
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
 | 
			
		||||
LIBDRM_LIB = `pkg-config --libs libdrm`
 | 
			
		||||
PCIACCESS_CFLAGS = `pkg-config --cflags pciaccess`
 | 
			
		||||
PCIACCESS_LIB = `pkg-config --libs pciaccess`
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
 | 
			
		||||
	-D_BSD_SOURCE -D_GNU_SOURCE -DHAVE_POSIX_MEMALIGN \
 | 
			
		||||
	-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC -DIN_DRI_DRIVER
 | 
			
		||||
@@ -28,7 +35,7 @@ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
 | 
			
		||||
ASM_SOURCES = 
 | 
			
		||||
 | 
			
		||||
# Library/program dependencies
 | 
			
		||||
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR) 
 | 
			
		||||
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR) $(PCIACCESS_LIB)
 | 
			
		||||
GL_LIB_DEPS = -lm -lpthread -ldl
 | 
			
		||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
 | 
			
		||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
 | 
			
		||||
@@ -39,5 +46,5 @@ SRC_DIRS = glx/mini mesa glu glut/mini
 | 
			
		||||
DRIVER_DIRS = dri
 | 
			
		||||
PROGRAM_DIRS = miniglx
 | 
			
		||||
 | 
			
		||||
#DRI_DIRS = ffb gamma sis savage
 | 
			
		||||
DRI_DIRS = i810 i915 mach64 mga r128 r200 radeon tdfx unichrome fb
 | 
			
		||||
#DRI_DIRS = ffb gamma sis savage tdfx unichrome fb
 | 
			
		||||
DRI_DIRS = i810 i915tex i915 mach64 mga r128 r200 radeon
 | 
			
		||||
 
 | 
			
		||||
@@ -88,19 +88,6 @@ driver (such as <code>radeon_dri.so</code>) at runtime.  The
 | 
			
		||||
environment variable <code>LIBGL_DRIVERS_PATH</code> should name the
 | 
			
		||||
directory where these modules are located.<br>
 | 
			
		||||
<br>
 | 
			
		||||
Prior to running a MiniGXL application, the following kernel modules
 | 
			
		||||
must be installed:<br>
 | 
			
		||||
<br>
 | 
			
		||||
<div style="margin-left: 40px;"> agpgart.o<br>
 | 
			
		||||
radeonfb.o  (assuming Radeon hardware)<br>
 | 
			
		||||
radeon.o  (assuming Radeon hardware)<br>
 | 
			
		||||
</div>
 | 
			
		||||
<code></code> <br>
 | 
			
		||||
Finally, MiniGLX reads a configuration file (by default,<code>
 | 
			
		||||
/etc/miniglx.conf</code>) to determine basic configuration information.
 | 
			
		||||
 The configuration file may also be located in the directory
 | 
			
		||||
specified by the <code>MINIGLX_CONF</code> environment variable).<br>
 | 
			
		||||
<br>
 | 
			
		||||
The remainder of this section describes the MiniGLX API functions.<br>
 | 
			
		||||
<br>
 | 
			
		||||
<h2>3.1 Initialization</h2>
 | 
			
		||||
 
 | 
			
		||||
@@ -88,3 +88,52 @@ Running the Build:
 | 
			
		||||
 | 
			
		||||
		Paul G. <pgarceau@users.sourceforge.net>
 | 
			
		||||
		Daniel Borca <dborca@users.sourceforge.net>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
*******************This section is added by Heromyth*****************************
 | 
			
		||||
Updated on 2007-7-21, by Heromyth <zxpmyth@yahoo.com.cn>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Notice:
 | 
			
		||||
	1) The generated DLLs are *not* compatible with the ones built
 | 
			
		||||
with the other compilers like VC8, especially for GLUT. 
 | 
			
		||||
 | 
			
		||||
	2) Although more tests are needed, it can be used individually!
 | 
			
		||||
 | 
			
		||||
	3) You can set the options about whether using STDCALL to build MESA. The 
 | 
			
		||||
config file is <Mesa3D-root>\configs\config.mgw. The default setting is that:
 | 
			
		||||
		ALL_USING_STDCALL = 1
 | 
			
		||||
, which means using STDCALL to build MESA. 
 | 
			
		||||
 | 
			
		||||
	4) Of course, you can MESA without using STDCALL,I like this:) 
 | 
			
		||||
The setting is :
 | 
			
		||||
		ALL_USING_STDCALL = 0
 | 
			
		||||
To do this, however, you must modify wingdi.h which is in MingW's include dir. 
 | 
			
		||||
For example, run:
 | 
			
		||||
	notepad	C:\MingW\include\wingdi.h
 | 
			
		||||
, and delete all the lines where all the wgl*() functions are. Because they would 
 | 
			
		||||
be conflicted with the ones in <Mesa3D-root>\include\GL\mesa_wgl.h.
 | 
			
		||||
 | 
			
		||||
======= Conflicted Functions List ======
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT);
 | 
			
		||||
WINGDIAPI HGLRC WINAPI wglCreateContext(HDC);
 | 
			
		||||
WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR);
 | 
			
		||||
WINGDIAPI HGLRC WINAPI wglGetCurrentContext(void);
 | 
			
		||||
WINGDIAPI HDC WINAPI wglGetCurrentDC(void);
 | 
			
		||||
WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF*);
 | 
			
		||||
WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC,HGLRC);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglRealizeLayerPalette(HDC,int,BOOL);
 | 
			
		||||
WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,const COLORREF*);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglShareLists(HGLRC,HGLRC);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
 | 
			
		||||
===================
 | 
			
		||||
 | 
			
		||||
*********************************************************************************
 | 
			
		||||
@@ -1,155 +1,163 @@
 | 
			
		||||
File: docs/README.WIN32
 | 
			
		||||
 | 
			
		||||
Last updated: Mar 31, 2006 - Karl Schultz - kschultz@users.sourceforge.net
 | 
			
		||||
 | 
			
		||||
Quick Start
 | 
			
		||||
----- -----
 | 
			
		||||
 | 
			
		||||
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
 | 
			
		||||
directory.  The libs and demos build separately, so if you do not care
 | 
			
		||||
about the demos or GLUT, you only need to unzip MesaLib.  If you unzip
 | 
			
		||||
more than one ZIP file, they all need to be unzipped into the same
 | 
			
		||||
directory.  Don't worry, you will not overwrite anything.
 | 
			
		||||
 | 
			
		||||
The Windows build system uses Microsoft Visual Studio.  Project files
 | 
			
		||||
for a specific version of Visual Studio are in their own directory in
 | 
			
		||||
the top-level "windows" directory.  For example, Visual Studio 6 files
 | 
			
		||||
are in windows/VC6.  If a directory does not exist for your version of
 | 
			
		||||
Visual Studio, you can try importing the project files from an earlier
 | 
			
		||||
version of Visual Studio.  At this time, project files exist for
 | 
			
		||||
Version 6 and Version 7.  The code has been built with a beta version
 | 
			
		||||
of Version 8 and it runs on 64-bit Windows.  If you want to try this,
 | 
			
		||||
start by importing the VC7 files and create the 64-bit targets in the
 | 
			
		||||
configuration manager.
 | 
			
		||||
 | 
			
		||||
It is likely that the new and free Visual Studio Express can be used
 | 
			
		||||
to build Mesa, but it hasn't been tried yet.  Start with the VC7
 | 
			
		||||
project files.
 | 
			
		||||
 | 
			
		||||
The project files to build the core Mesa library, Windows Mesa
 | 
			
		||||
drivers, OSMesa, and GLU are in the mesa directory.  The project files
 | 
			
		||||
to build GLUT and some demo programs are in the progs directory.
 | 
			
		||||
 | 
			
		||||
Makefiles are no longer shipped or supported, but can be generated
 | 
			
		||||
from the projects using Visual Studio.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Windows Drivers
 | 
			
		||||
------- -------
 | 
			
		||||
 | 
			
		||||
At this time, only the GDI driver is known to work.  Most of the demos
 | 
			
		||||
in progs/demos should work with this driver.
 | 
			
		||||
 | 
			
		||||
Source code also exists in the tree for other drivers in
 | 
			
		||||
src/mesa/drivers/windows, but the status of this code is unknown.
 | 
			
		||||
 | 
			
		||||
The GDI driver operates basically by writing pixel spans into a DIB
 | 
			
		||||
section and then blitting the DIB to the window.  The driver was
 | 
			
		||||
recently cleaned up and rewitten and so may have bugs or may be
 | 
			
		||||
missing some functionality.  The older versions of the CVS source may
 | 
			
		||||
be useful in figuring out any problems, or report them to me.
 | 
			
		||||
 | 
			
		||||
To build Mesa with the GDI driver, build the mesa, gdi, and glu
 | 
			
		||||
projects in the Visual Studio workspace found at
 | 
			
		||||
 | 
			
		||||
	windows/VC6/mesa/mesa.dsw
 | 
			
		||||
or
 | 
			
		||||
	windows/VC7/mesa/mesa.sln
 | 
			
		||||
 | 
			
		||||
The osmesa DLL can also be built with the osmesa project.
 | 
			
		||||
 | 
			
		||||
The build system creates a lib top-level directory and copies
 | 
			
		||||
resulting LIB and DLL files to this lib directory.  The files are:
 | 
			
		||||
 | 
			
		||||
	OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
 | 
			
		||||
	OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
 | 
			
		||||
 | 
			
		||||
If the MesaDemos ZIP file was extracted, the DLL files are also copied
 | 
			
		||||
to the demos directory.  This facilitates running the demos as described
 | 
			
		||||
below.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLUT and Demos
 | 
			
		||||
---- --- -----
 | 
			
		||||
 | 
			
		||||
A Visual Studio workspace can be found at 
 | 
			
		||||
 | 
			
		||||
	windows/VC6/progs/progs.dsw
 | 
			
		||||
or
 | 
			
		||||
	windows/VC7/progs/progs.sln
 | 
			
		||||
 | 
			
		||||
It can be used to build GLUT and a few demos.  The GLUT lib and DLL
 | 
			
		||||
are copied to the top-level lib directory, along with the Mesa libs.
 | 
			
		||||
 | 
			
		||||
The demo build system expects to find the LIB files in the top level
 | 
			
		||||
lib directory, so you must build the Mesa libs first.  The demo
 | 
			
		||||
executables are placed in the demos directory, because some of them
 | 
			
		||||
rely on data files found there.  Also, the Mesa lib DLL's were copied
 | 
			
		||||
there by the Mesa lib build process.  Therefore, you should be able to
 | 
			
		||||
simply run the demo executables from the demo directory.
 | 
			
		||||
 | 
			
		||||
If you want to run the demos from the Visual Studio, you may have to
 | 
			
		||||
change the startup directory and explicitly state where the executables are.
 | 
			
		||||
 | 
			
		||||
You may also build all the demo programs by using a makefile.  Go to
 | 
			
		||||
the progs/demos directory and make sure you have executed VCVARS32.BAT
 | 
			
		||||
or whatever setup script is appropriate for your compiler.  Then,
 | 
			
		||||
 | 
			
		||||
	nmake -f Makefile.win
 | 
			
		||||
 | 
			
		||||
should build all the demos.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Build System Notes
 | 
			
		||||
----- ------ -----
 | 
			
		||||
 | 
			
		||||
VC6
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Visual Studio 6 does not recognize files with the .cc extension as C++
 | 
			
		||||
language files, without a lot of unnatural tweaking.  So, the VC6
 | 
			
		||||
build process uses custom build steps to compile these files in the
 | 
			
		||||
GLU library.
 | 
			
		||||
 | 
			
		||||
Two additional configurations are provided, Debug x86 and Release x86
 | 
			
		||||
that activate the shader code compilation by defining SLANG_86.  It is
 | 
			
		||||
unknown if and how this works.
 | 
			
		||||
 | 
			
		||||
VC7
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The above-mentioned .cc problem does not exist in this version.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
General
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
After building, you can copy the above DLL files to a place in your
 | 
			
		||||
PATH such as $SystemRoot/SYSTEM32.  If you don't like putting things
 | 
			
		||||
in a system directory, place them in the same directory as the
 | 
			
		||||
executable(s).  Be careful about accidentially overwriting files of
 | 
			
		||||
the same name in the SYSTEM32 directory.
 | 
			
		||||
 | 
			
		||||
The DLL files are built so that the external entry points use the
 | 
			
		||||
stdcall calling convention.
 | 
			
		||||
 | 
			
		||||
Static LIB files are not built.  The LIB files that are built with are
 | 
			
		||||
the linker import files associated with the DLL files.
 | 
			
		||||
 | 
			
		||||
The si-glu sources are used to build the GLU libs.  This was done
 | 
			
		||||
mainly to get the better tessellator code.
 | 
			
		||||
 | 
			
		||||
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 as
 | 
			
		||||
much as I can.  I also monitor the Mesa mailing lists and will answer
 | 
			
		||||
questions in this area there as well.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Karl Schultz
 | 
			
		||||
File: docs/README.WIN32
 | 
			
		||||
 | 
			
		||||
Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net
 | 
			
		||||
 | 
			
		||||
Quick Start
 | 
			
		||||
----- -----
 | 
			
		||||
 | 
			
		||||
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
 | 
			
		||||
directory.  The libs and demos build separately, so if you do not care
 | 
			
		||||
about the demos or GLUT, you only need to unzip MesaLib.  If you unzip
 | 
			
		||||
more than one ZIP file, they all need to be unzipped into the same
 | 
			
		||||
directory.  Don't worry, you will not overwrite anything.
 | 
			
		||||
 | 
			
		||||
The Windows build system uses Microsoft Visual Studio.  Project files
 | 
			
		||||
for a specific version of Visual Studio are in their own directory in
 | 
			
		||||
the top-level "windows" directory.  For example, Visual Studio 8 files
 | 
			
		||||
are in windows/VC8.
 | 
			
		||||
 | 
			
		||||
Support has been dropped for versions of Visual Studio prior to 8. The
 | 
			
		||||
main reason is because Microsoft now provides a free compiler and
 | 
			
		||||
developer environment.  Visual Studio Express can be found at
 | 
			
		||||
 | 
			
		||||
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
 | 
			
		||||
 | 
			
		||||
You'll also need the Platform SDK.  Instructions for obtaining and
 | 
			
		||||
using the SDK with Visual Studio Express can be found at
 | 
			
		||||
 | 
			
		||||
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
 | 
			
		||||
 | 
			
		||||
If you are stuck using VC6 or VC7, you may start with these project
 | 
			
		||||
files, but you may need to modify them to reflect changes in the
 | 
			
		||||
Mesa source code tree.  If you sucessfully update the project files,
 | 
			
		||||
please submit them to the author of this document so that they may
 | 
			
		||||
be included in the next distribution. 
 | 
			
		||||
 | 
			
		||||
The project files to build the core Mesa library, Windows Mesa
 | 
			
		||||
drivers, OSMesa, and GLU are in the mesa directory.  The project files
 | 
			
		||||
to build GLUT and some demo programs are in the progs directory.
 | 
			
		||||
 | 
			
		||||
Makefiles are no longer shipped or supported, but can be generated
 | 
			
		||||
from the projects using Visual Studio.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Windows Drivers
 | 
			
		||||
------- -------
 | 
			
		||||
 | 
			
		||||
At this time, only the GDI driver is known to work.  Most of the demos
 | 
			
		||||
in progs/demos should work with this driver.
 | 
			
		||||
 | 
			
		||||
Source code also exists in the tree for other drivers in
 | 
			
		||||
src/mesa/drivers/windows, but the status of this code is unknown.
 | 
			
		||||
 | 
			
		||||
The GDI driver operates basically by writing pixel spans into a DIB
 | 
			
		||||
section and then blitting the DIB to the window.  The driver was
 | 
			
		||||
recently cleaned up and rewitten and so may have bugs or may be
 | 
			
		||||
missing some functionality.  The older versions of the CVS source may
 | 
			
		||||
be useful in figuring out any problems, or report them to me.
 | 
			
		||||
 | 
			
		||||
To build Mesa with the GDI driver, build the mesa, gdi, and glu
 | 
			
		||||
projects in the Visual Studio workspace found at
 | 
			
		||||
 | 
			
		||||
	windows/VC8/mesa/mesa.sln
 | 
			
		||||
 | 
			
		||||
The osmesa DLL can also be built with the osmesa project.
 | 
			
		||||
 | 
			
		||||
The build system creates a lib top-level directory and copies
 | 
			
		||||
resulting LIB and DLL files to this lib directory.  The files are:
 | 
			
		||||
 | 
			
		||||
	OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
 | 
			
		||||
	OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
 | 
			
		||||
 | 
			
		||||
If the MesaDemos ZIP file was extracted, the DLL files are also copied
 | 
			
		||||
to the demos directory.  This facilitates running the demos as described
 | 
			
		||||
below.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLUT and Demos
 | 
			
		||||
---- --- -----
 | 
			
		||||
 | 
			
		||||
A Visual Studio workspace can be found at 
 | 
			
		||||
 | 
			
		||||
	windows/VC8/progs/progs.sln
 | 
			
		||||
 | 
			
		||||
It can be used to build GLUT and a few demos.  The GLUT lib and DLL
 | 
			
		||||
are copied to the top-level lib directory, along with the Mesa libs.
 | 
			
		||||
 | 
			
		||||
The demo build system expects to find the LIB files in the top level
 | 
			
		||||
lib directory, so you must build the Mesa libs first.  The demo
 | 
			
		||||
executables are placed in the demos directory, because some of them
 | 
			
		||||
rely on data files found there.  Also, the Mesa lib DLL's were copied
 | 
			
		||||
there by the Mesa lib build process.  Therefore, you should be able to
 | 
			
		||||
simply run the demo executables from the demo directory.
 | 
			
		||||
 | 
			
		||||
If you want to run the demos from the Visual Studio, you may have to
 | 
			
		||||
change the startup directory and explicitly state where the executables are.
 | 
			
		||||
 | 
			
		||||
You may also build all the demo programs by using a makefile.  Go to
 | 
			
		||||
the progs/demos directory and make sure you have executed VCVARS32.BAT
 | 
			
		||||
or whatever setup script is appropriate for your compiler.  Then,
 | 
			
		||||
 | 
			
		||||
	nmake -f Makefile.win
 | 
			
		||||
 | 
			
		||||
should build all the demos.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Build System Notes
 | 
			
		||||
----- ------ -----
 | 
			
		||||
 | 
			
		||||
VC6 (not actively supported)
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Visual Studio 6 does not recognize files with the .cc extension as C++
 | 
			
		||||
language files, without a lot of unnatural tweaking.  So, the VC6
 | 
			
		||||
build process uses custom build steps to compile these files in the
 | 
			
		||||
GLU library.
 | 
			
		||||
 | 
			
		||||
Two additional configurations are provided, Debug x86 and Release x86
 | 
			
		||||
that activate the shader code compilation by defining SLANG_86.  It is
 | 
			
		||||
unknown if and how this works.
 | 
			
		||||
 | 
			
		||||
VC7 (not actively supported)
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The above-mentioned .cc problem does not exist in this version.
 | 
			
		||||
 | 
			
		||||
VC8
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
No notes.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
General
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
After building, you can copy the above DLL files to a place in your
 | 
			
		||||
PATH such as $SystemRoot/SYSTEM32.  If you don't like putting things
 | 
			
		||||
in a system directory, place them in the same directory as the
 | 
			
		||||
executable(s).  Be careful about accidentially overwriting files of
 | 
			
		||||
the same name in the SYSTEM32 directory.
 | 
			
		||||
 | 
			
		||||
The DLL files are built so that the external entry points use the
 | 
			
		||||
stdcall calling convention.
 | 
			
		||||
 | 
			
		||||
Static LIB files are not built.  The LIB files that are built with are
 | 
			
		||||
the linker import files associated with the DLL files.
 | 
			
		||||
 | 
			
		||||
The si-glu sources are used to build the GLU libs.  This was done
 | 
			
		||||
mainly to get the better tessellator code.
 | 
			
		||||
 | 
			
		||||
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 as
 | 
			
		||||
much as I can.  I also monitor the Mesa mailing lists and will answer
 | 
			
		||||
questions in this area there as well.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Karl Schultz
 | 
			
		||||
 
 | 
			
		||||
@@ -71,8 +71,8 @@ a:visited {
 | 
			
		||||
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
 | 
			
		||||
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>
 | 
			
		||||
<li><a href="sourcedocs.html" target="MainFrame">Source Documentation</a>
 | 
			
		||||
<li><a href="subset.html" target="MainFrame">Subset Information</a>
 | 
			
		||||
<li><a href="fbdev-dri.html" target="MainFrame">fbdev/DRI Environment</a>
 | 
			
		||||
<li><a href="subset.html" target="MainFrame">Mesa Subset Driver</a>
 | 
			
		||||
<li><a href="glfbdev-driver.html" target="MainFrame">glFBDev Driver</a>
 | 
			
		||||
<LI><A HREF="dispatch.html" target="MainFrame">GL Dispatch</A>
 | 
			
		||||
</ul>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,11 +9,7 @@
 | 
			
		||||
<H1>Downloading</H1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Last development release: <b>6.5.3</b>
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Last stable release: <b>6.4.2</b>
 | 
			
		||||
Last stable release: <b>7.0</b>
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
 
 | 
			
		||||
@@ -12,161 +12,77 @@
 | 
			
		||||
<H1>1. Introduction</H1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
The fbdev/DRI sub-project within Mesa brings hardware accelerated OpenGL
 | 
			
		||||
rendering to the Linux fbdev environment.
 | 
			
		||||
The X Window System / XFree86 is not needed.
 | 
			
		||||
The fbdev/DRI environment supports hardware-accelerated 3D rendering without
 | 
			
		||||
the X window system.  This is typically used for embedded applications.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Basically, the <a href="http://dri.sf.net/">DRI</a> drivers for hardware
 | 
			
		||||
accelerated OpenGL for XFree86 have been ported to fbdev so that X is
 | 
			
		||||
not needed.
 | 
			
		||||
This means fbdev/DRI works in full-screen mode only.
 | 
			
		||||
Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
DRI driver writers may find this simplified environment easier to work in,
 | 
			
		||||
compared to the full XFree86/DRI environment.
 | 
			
		||||
Applications in the fbdev/DRI environment use
 | 
			
		||||
the <a href="MiniGXL.html"> MiniGLX</a> interface to choose pixel
 | 
			
		||||
formats, create rendering contexts, etc.  It's a subset of the GLX and
 | 
			
		||||
Xlib interfaces allowing some degree of application portability between
 | 
			
		||||
the X and X-less environments.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Much of the work for this project has been done by Jon Smirl and
 | 
			
		||||
Keith Whitwell.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
To use fbdev/DRI, you'll need a Linux 2.4 or 2.6 kernel.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<h3>Background Info</h3>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
The Mesa-based DRI drivers used to be hosted in the DRI tree (which is
 | 
			
		||||
basically a copy of the XFree86 tree).
 | 
			
		||||
Since the Mesa-based DRI drivers are moreso "Mesa drivers" than "XFree86
 | 
			
		||||
drivers" and the fact that with some work, the drivers could be used
 | 
			
		||||
without X, the driver code was moved into the Mesa tree.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
So now the DRI drivers can be compiled for two different environments:
 | 
			
		||||
fbdev and XFree86.
 | 
			
		||||
To build the drivers for XFree86, one has to download/build the DRI
 | 
			
		||||
source tree.
 | 
			
		||||
Eventually, we'd like to be able to build the drivers for XFree86 outside
 | 
			
		||||
of the XFree86/DRI trees.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h1>2. Compilation</h1>
 | 
			
		||||
 | 
			
		||||
<h2>2.1 Compiling the DRM modules</h2>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
First, you'll need the DRM (Direct Rendering Manager) kernel module sources.
 | 
			
		||||
They're found in a module of the DRI CVS tree.
 | 
			
		||||
To obtain the code do the following:
 | 
			
		||||
You'll need the DRM and pciaccess libraries.  Check with:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri login
 | 
			
		||||
</pre>
 | 
			
		||||
<p>
 | 
			
		||||
Press Enter/Return when prompted for a password.  Then,
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri co drm
 | 
			
		||||
   pkg-config --modversion libdrm
 | 
			
		||||
   pkg-config --modversion pciaccess
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Compile the DRM kernel modules:
 | 
			
		||||
You can get them from the git repository with:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
  cd drm/linux
 | 
			
		||||
  make
 | 
			
		||||
   git clone git://anongit.freedesktop.org/git/mesa/drm
 | 
			
		||||
   git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Note: you may need to be root in order to make a few symlinks.
 | 
			
		||||
See the README files in those projects for build/install instructions.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
When compilation is done, you should have at least the following
 | 
			
		||||
kernel modules:
 | 
			
		||||
You'll need fbdev header files.  Check with:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
  gamma.o
 | 
			
		||||
  i810.o
 | 
			
		||||
  i830.o
 | 
			
		||||
  mach64.o
 | 
			
		||||
  mga.o
 | 
			
		||||
  r128.o
 | 
			
		||||
  radeon.o
 | 
			
		||||
  savage.o
 | 
			
		||||
  sis.o
 | 
			
		||||
  tdfx.o
 | 
			
		||||
  via.o
 | 
			
		||||
   ls -l /usr/include/linux/fb.h
 | 
			
		||||
</pre>
 | 
			
		||||
<p>
 | 
			
		||||
You'll probably want to copy/move them into your kernel module directory
 | 
			
		||||
(for example: <code>/lib/modules/2.4.18-14/kernel/drivers/char/drm/</code>).
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>2.2 Compiling the Mesa drivers</h2>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Begin by editing the <code>Mesa/configs/default</code> file to set
 | 
			
		||||
the <code>DRM_SOURCE_PATH</code> variable.
 | 
			
		||||
Set it to the location where the DRM module sources are located.
 | 
			
		||||
For example, if your current directory in step 2.1 was <code>/home/fred/</code>
 | 
			
		||||
set DRM_SOURCE_PATH to <code>/home/fred/drm</code>
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Next, assuming you're starting with a fresh Mesa CVS checkout,
 | 
			
		||||
do the following:
 | 
			
		||||
Compile Mesa with the 'linux-solo' configuration:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   make linux-solo
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
If you previously built the source tree, run <code>make realclean</code>
 | 
			
		||||
first to remove the old object files.
 | 
			
		||||
When complete you should have the following:
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
When this is finished, check the <code>Mesa/lib/</code> directory
 | 
			
		||||
to verify that the following files were made:
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
<li><code>libGL.so.1.2</code> - the client-side OpenGL library
 | 
			
		||||
    (and a few symlinks to it).
 | 
			
		||||
<li><code>libGLU.so.1.1</code> - the GLU library (and a few symlinks to it).
 | 
			
		||||
<li><code>libglut.so.3.7</code> - the GLUT library (and a few symlinks to it).
 | 
			
		||||
<li><code>mga_dri.so</code> - DRI driver for Matrox G200/G400 cards.
 | 
			
		||||
<li><code>r128_dri.so</code> - DRI driver for ATI Rage 128 cards.
 | 
			
		||||
<li><code>r200_dri.so</code> - DRI driver for ATI R200 Radeon cards.
 | 
			
		||||
<li><code>radeon_dri.so</code> - DRI driver for original ATI Radeon cards.
 | 
			
		||||
<li><code>i810_dri.so</code> - DRI driver for Intel i810/i815 chips.
 | 
			
		||||
<li><code>i830_dri.so</code> - DRI driver for Intel i830/i845 chips.
 | 
			
		||||
<li><code>mga_dri.so</code> - DRI driver for Matrox G200/G400 cards.
 | 
			
		||||
<li><code>sis_dri.so</code> - DRI driver for SIS cards.
 | 
			
		||||
<li><code>tdfx_dri.so</code> - DRI driver for 3dfx Voodoo 3/4/5 cards.
 | 
			
		||||
<li><code>gamma_dri.so</code> - DRI driver for 3Dlabs gamma cards.
 | 
			
		||||
<li><code>fb_dri.so</code> - software-only fbdev driver.
 | 
			
		||||
<li><code>miniglx.conf</code> - configuration file for the MiniGLX interface
 | 
			
		||||
<li>lib/libGL.so - the GL library which applications link with
 | 
			
		||||
<li>lib/*_dri_so - DRI drivers
 | 
			
		||||
<li>lib/miniglx.conf - sample MiniGLX config file
 | 
			
		||||
<li>progs/miniglx/* - several MiniGLX sample programs
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h1>3. Using fbdev/DRI</h1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
If XFree86 is currently running, exit/stop the X server so you're
 | 
			
		||||
working from the console.
 | 
			
		||||
If an X server currently running, exit/stop it so you're working from
 | 
			
		||||
the console.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -175,12 +91,23 @@ working from the console.
 | 
			
		||||
<p>
 | 
			
		||||
You'll need to load the kernel modules specific to your graphics hardware.
 | 
			
		||||
Typically, this consists of the agpgart module, an fbdev driver module
 | 
			
		||||
and the DRM kernel module (from step 2.1).
 | 
			
		||||
and the DRM kernel module.
 | 
			
		||||
</p>
 | 
			
		||||
<p>
 | 
			
		||||
As root, the kernel modules can be loaded as follows:
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
If you have Intel i915/i945 hardware:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   modprobe agpgart            # the AGP GART module
 | 
			
		||||
   modprobe intelfb            # the Intel fbdev driver
 | 
			
		||||
   modprobe i915               # the i915/945 DRI kernel module
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
If you have ATI Radeon/R200 hardware, run as root:
 | 
			
		||||
If you have ATI Radeon/R200 hardware:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   modprobe agpgart            # the AGP GART module
 | 
			
		||||
@@ -189,7 +116,7 @@ If you have ATI Radeon/R200 hardware, run as root:
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
If you have ATI Rage 128 hardware, run as root:
 | 
			
		||||
If you have ATI Rage 128 hardware:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   modprobe agpgart            # the AGP GART module
 | 
			
		||||
@@ -198,7 +125,7 @@ If you have ATI Rage 128 hardware, run as root:
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
If you have Matrox G200/G400 hardware, run as root:
 | 
			
		||||
If you have Matrox G200/G400 hardware:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   modprobe agpgart            # the AGP GART module
 | 
			
		||||
@@ -207,37 +134,46 @@ If you have Matrox G200/G400 hardware, run as root:
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Then run <code>lsmod</code> to be sure the modules are loaded.
 | 
			
		||||
For a Radeon card, you should see something like this:
 | 
			
		||||
To verify that the agpgart, fbdev and drm modules are loaded:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
Module                  Size  Used by    Not tainted
 | 
			
		||||
radeon                110308   0  (unused)
 | 
			
		||||
radeonfb               21900   0  (unused)
 | 
			
		||||
agpgart                43072   1 
 | 
			
		||||
   ls -l /dev/agpgart /dev/fb* /dev/dri
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Alternately, use lsmod to inspect the currently installed modules.
 | 
			
		||||
If you have problems, look at the output of dmesg.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>3.2 Configuration File</h2>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
The <code>Mesa/lib/miniglx.conf</code> file should be installed
 | 
			
		||||
in <code>/etc/</code>.
 | 
			
		||||
Copy the sample miniglx.conf to /etc/miniglx.conf and review/edit its contents.
 | 
			
		||||
Alternately, the MINIGLX_CONF environment variable can be used to
 | 
			
		||||
indicate the location of miniglx.conf
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Edit <code>/etc/miniglx.conf</code> to be sure it's set up correctly
 | 
			
		||||
for your hardware.
 | 
			
		||||
Comments in the file explain the options.
 | 
			
		||||
To determine the pciBusID value, run lspci and examine the output.
 | 
			
		||||
For example:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   /sbin/lspci:
 | 
			
		||||
   00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)
 | 
			
		||||
</pre>
 | 
			
		||||
<p>
 | 
			
		||||
00:02.0 indicates that pciBusID should be PCI:0:2:0
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>3.3 Running fbdev/DRI Programs</h2>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Make sure your LD_LIBRARY_PATH environment variable is set to the
 | 
			
		||||
<code>Mesa/lib/</code> directory.
 | 
			
		||||
location of the libGL.so library.  You may need to append other paths
 | 
			
		||||
to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location,
 | 
			
		||||
for example.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
@@ -245,7 +181,7 @@ Change to the <code>Mesa/progs/miniglx/</code> directory and
 | 
			
		||||
start the sample_server program in the background:
 | 
			
		||||
</p>
 | 
			
		||||
<pre>
 | 
			
		||||
   ./sample_server &
 | 
			
		||||
   ./sample_server &
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
@@ -268,27 +204,24 @@ them from a remote shell so that you can stop them with ctrl-C.
 | 
			
		||||
 | 
			
		||||
<h1>4.0 Troubleshooting</h1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
<ol>
 | 
			
		||||
<li>
 | 
			
		||||
If you try to run miniglxtest and get the following:
 | 
			
		||||
</p>
 | 
			
		||||
<br>
 | 
			
		||||
<pre>
 | 
			
		||||
   [miniglx] failed to probe chipset
 | 
			
		||||
   connect: Connection refused
 | 
			
		||||
   server connection lost
 | 
			
		||||
</pre>
 | 
			
		||||
<p>
 | 
			
		||||
It means that the sample_server process is not running.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<br>
 | 
			
		||||
<br>
 | 
			
		||||
</li>
 | 
			
		||||
</ol>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h1>5.0 Programming Information</h1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
The full OpenGL API is available with fbdev/DRI.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
OpenGL/Mesa is interfaced to fbdev via the <a href="MiniGLX.html">MiniGLX</a>
 | 
			
		||||
interface.
 | 
			
		||||
 
 | 
			
		||||
@@ -128,10 +128,15 @@ specification as well as the GL_ARB_vertex_program and
 | 
			
		||||
GL_ARB_fragment_program extensions.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
June 2007: Mesa 7.0 is released, implementing the OpenGL 2.1 specification
 | 
			
		||||
and OpenGL Shading Language.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Ongoing: Mesa is used as the core of many hardware OpenGL drivers for
 | 
			
		||||
the XFree86 X.org X servers within the
 | 
			
		||||
the XFree86 and X.org X servers within the
 | 
			
		||||
<A href="http://dri.freedesktop.org/" target="_parent">DRI project</A>.
 | 
			
		||||
I continue to enhance Mesa with new extensions and features.
 | 
			
		||||
</p>
 | 
			
		||||
@@ -141,9 +146,16 @@ I continue to enhance Mesa with new extensions and features.
 | 
			
		||||
<H1>Major Versions</H1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
This is a summary of the major versions of Mesa.  Note that Mesa's major
 | 
			
		||||
version number tracks OpenGL's minor version number (+1).
 | 
			
		||||
Work is underway to implement the OpenGL 2.0 specification.
 | 
			
		||||
This is a summary of the major versions of Mesa.
 | 
			
		||||
Mesa's major version number has been incremented whenever a new version
 | 
			
		||||
of the OpenGL specification is implemented.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<H2>Version 7.x features</H2>
 | 
			
		||||
<p>
 | 
			
		||||
Version 7.x of Mesa implements the OpenGL 2.1 API.  The main feature
 | 
			
		||||
of OpenGL 2.x is the OpenGL Shading Language.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,14 @@
 | 
			
		||||
<H1>News</H1>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>April ?, 2007</h2>
 | 
			
		||||
<h2>June 22, 2007</h2>
 | 
			
		||||
<p>
 | 
			
		||||
<a href="relnotes-7.0.html">Mesa 7.0</a> is released.
 | 
			
		||||
This is a stable release featuring OpenGL 2.1 support.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>April 27, 2007</h2>
 | 
			
		||||
<p>
 | 
			
		||||
<a href="relnotes-6.5.3.html">Mesa 6.5.3</a> is released.
 | 
			
		||||
This is a development release which will lead up to the Mesa 7.0 release
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 | 
			
		||||
<body bgcolor="#eeeeee">
 | 
			
		||||
 | 
			
		||||
<H1>Mesa 6.5.3 Release Notes / April ??, 2007</H1>
 | 
			
		||||
<H1>Mesa 6.5.3 Release Notes / April 27, 2007</H1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Mesa 6.5.3 is a development release with many changes and new features.
 | 
			
		||||
@@ -18,7 +18,15 @@ Mesa 7.0 is expected to follow shortly.
 | 
			
		||||
 | 
			
		||||
<h2>MD5 checksums</h2>
 | 
			
		||||
<pre>
 | 
			
		||||
TBD
 | 
			
		||||
39f33ea64e34e2d5b20640b008b57649  MesaLib-6.5.3.tar.gz
 | 
			
		||||
46359457147c469745f24b5074a186f0  MesaLib-6.5.3.tar.bz2
 | 
			
		||||
a8946fa861634ce15971396f47992c41  MesaLib-6.5.3.zip
 | 
			
		||||
08e26948d57eaca74d02a530b2d8106e  MesaDemos-6.5.3.tar.gz
 | 
			
		||||
8af91773ab2653fe537499676b05f2e8  MesaDemos-6.5.3.tar.bz2
 | 
			
		||||
783f81b171bf89b0929abc894efd25a6  MesaDemos-6.5.3.zip
 | 
			
		||||
9467d415388fe1ad82991fb20704b812  MesaGLUT-6.5.3.tar.gz
 | 
			
		||||
360843e46b7ebb6909290b023f9b26fa  MesaGLUT-6.5.3.tar.bz2
 | 
			
		||||
7686065e5c15a30de08a1610860b6840  MesaGLUT-6.5.3.zip
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -96,7 +104,7 @@ Driver			Status
 | 
			
		||||
DRI drivers		varies with the driver
 | 
			
		||||
XMesa/GLX (on Xlib)	implements OpenGL 2.1
 | 
			
		||||
OSMesa (off-screen)	implements OpenGL 2.1
 | 
			
		||||
Windows/Win32		implements OpenGL 1.5
 | 
			
		||||
Windows/Win32		implements OpenGL 2.1
 | 
			
		||||
Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
 | 
			
		||||
SVGA			unsupported
 | 
			
		||||
Wind River UGL		unsupported
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										86
									
								
								docs/relnotes-7.0.1.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								docs/relnotes-7.0.1.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
<HTML>
 | 
			
		||||
 | 
			
		||||
<TITLE>Mesa Release Notes</TITLE>
 | 
			
		||||
 | 
			
		||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
 | 
			
		||||
 | 
			
		||||
<BODY>
 | 
			
		||||
 | 
			
		||||
<body bgcolor="#eeeeee">
 | 
			
		||||
 | 
			
		||||
<H1>Mesa 7.0.1 Release Notes / (date), 2007</H1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Mesa 7.0.1 is a stable release with bug fixes since version 7.0.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>MD5 checksums</h2>
 | 
			
		||||
<pre>
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>New features</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<h2>Bug fixes</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
<li>Fixed some MingW build issues
 | 
			
		||||
<li>Added a few missing OpenGL 2.0 API entrypoints:
 | 
			
		||||
  <ul>
 | 
			
		||||
  <li>glVertexAttrib4bv
 | 
			
		||||
  <li>glVertexAttrib4iv
 | 
			
		||||
  <li>glVertexAttrib4ubv
 | 
			
		||||
  <li>glVertexAttrib4uiv
 | 
			
		||||
  <li>glVertexAttrib4usv
 | 
			
		||||
  </ul>
 | 
			
		||||
<li>Fixed glDrawPixels(GL_STENCIL_INDEX) pixel transfer bug 11457
 | 
			
		||||
<li>GLSL bug fix: added vec2(vec4) constructor
 | 
			
		||||
<li>GLSL bug fix: .strq and .rgba writemasks didn't always work
 | 
			
		||||
<li>Stencil pixel map didn't always work for glDrawPixels (bug 11475)
 | 
			
		||||
<li>Fixed polygon stipple bug in i915 driver
 | 
			
		||||
<li>Binding a zero-sized texture didn't disable texturing (bug 11309)
 | 
			
		||||
<li>Queries of GL_INFO_LOG_LENGTH, GL_SHADER_SOURCE_LENGTH didn't include
 | 
			
		||||
the terminating zero (bug 11588)
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>Change</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
<li>The libOSMesa library version has been reverted to 6.5.3 (soname=6)
 | 
			
		||||
in order to avoid application linking issues.  Otherwise, applications
 | 
			
		||||
previously linked with libOSMesa.so.6 would no longer link with libOSMesa.so.7
 | 
			
		||||
<li>Dropped obsolete, unmaintained Windows project files for VC6 and VC7.
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>To Do (someday) items</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
<li>Switch to freeglut
 | 
			
		||||
<li>Fix linux-glide target/driver.
 | 
			
		||||
<li>Improved lambda and derivative calculation for frag progs.
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>Driver Status</h2>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
Driver			Status
 | 
			
		||||
----------------------	----------------------
 | 
			
		||||
DRI drivers		varies with the driver
 | 
			
		||||
XMesa/GLX (on Xlib)	implements OpenGL 2.1
 | 
			
		||||
OSMesa (off-screen)	implements OpenGL 2.1
 | 
			
		||||
Windows/Win32		implements OpenGL 2.1
 | 
			
		||||
Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
 | 
			
		||||
SVGA			unsupported
 | 
			
		||||
Wind River UGL		unsupported
 | 
			
		||||
DJGPP			unsupported
 | 
			
		||||
GGI			unsupported
 | 
			
		||||
BeOS			unsupported
 | 
			
		||||
Allegro			unsupported
 | 
			
		||||
D3D			unsupported
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										93
									
								
								docs/relnotes-7.0.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								docs/relnotes-7.0.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
<HTML>
 | 
			
		||||
 | 
			
		||||
<TITLE>Mesa Release Notes</TITLE>
 | 
			
		||||
 | 
			
		||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
 | 
			
		||||
 | 
			
		||||
<BODY>
 | 
			
		||||
 | 
			
		||||
<body bgcolor="#eeeeee">
 | 
			
		||||
 | 
			
		||||
<H1>Mesa 7.0 Release Notes / June 22, 2007</H1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
Mesa 7.0 is a stable release, featuring OpenGL 2.1 API support.
 | 
			
		||||
A number of bugs have been fixed since the 6.5.3 release.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>MD5 checksums</h2>
 | 
			
		||||
<pre>
 | 
			
		||||
35a1698986f7ac8dc435624ee9256cda  MesaLib-7.0.tar.gz
 | 
			
		||||
50c371455fa7532c04aa0a970f9bc51f  MesaLib-7.0.tar.bz2
 | 
			
		||||
bcedb6f43c97c1bc49e5cc7f12835722  MesaLib-7.0.zip
 | 
			
		||||
9bad332c7b74f59be96556135212ca9e  MesaDemos-7.0.tar.gz
 | 
			
		||||
fada2bc1f29da513e015fda1e3abd0c0  MesaDemos-7.0.tar.bz2
 | 
			
		||||
84e3bbe470d983ae32f1f0c779faf99e  MesaDemos-7.0.zip
 | 
			
		||||
76c7bb54f9850c689eba844f6daed332  MesaGLUT-7.0.tar.gz
 | 
			
		||||
4af28296e02772ef1de00e4e79bf3d12  MesaGLUT-7.0.tar.bz2
 | 
			
		||||
9043cb0b54cc03d1874728d74b12188c  MesaGLUT-7.0.zip
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>New features</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
<li>OpenGL 2.0 and 2.1 API support.
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<h2>Bug fixes</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
<li>Fixed a few fog-related bugs.
 | 
			
		||||
<li>Fixed broken GLSL mix() function.
 | 
			
		||||
<li>Fixed broken GLSL exp() functions.
 | 
			
		||||
<li>Fixed GLSL mod4(vec4, vec4) bug.
 | 
			
		||||
<li>Implemented GLSL asin(), acos(), atan() functions.
 | 
			
		||||
<li>Fixed an R300 driver bug that caused Xorg composite manager to crash
 | 
			
		||||
<li>Fixed R300 vertex program/matrix bug (10848)
 | 
			
		||||
<li>GLSL dFdx() and dFdy() work for fragment program inputs now (texcoords)
 | 
			
		||||
<li>Specifying an invalid texture unit as a sampler could lead to a crash
 | 
			
		||||
<li>The GLX protocol request for glXDestroyPBuffer() was incorrect (bug 10983)
 | 
			
		||||
<li>ARB vp state.light[n].half value was incorrect (bug 10987)
 | 
			
		||||
<li>Fixed a positional light source bug (bug 11009)
 | 
			
		||||
<li>Fixed point size attenuation problem (bug 11042)
 | 
			
		||||
<li>glPopAttrib didn't restore texture object's LOD bias (bug 11049)
 | 
			
		||||
<li>Fixed a TLS / TEXTREL problem (bug 7459)
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>Internal code changes</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
<li>Some texture code consolidation and simplifiction (Ian Romanick)
 | 
			
		||||
<li>R300 driver clean-ups.
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>To Do (someday) items</h2>
 | 
			
		||||
<ul>
 | 
			
		||||
<li>Switch to freeglut
 | 
			
		||||
<li>Fix linux-glide target/driver.
 | 
			
		||||
<li>Improved lambda and derivative calculation for frag progs.
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>Driver Status</h2>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
Driver			Status
 | 
			
		||||
----------------------	----------------------
 | 
			
		||||
DRI drivers		varies with the driver
 | 
			
		||||
XMesa/GLX (on Xlib)	implements OpenGL 2.1
 | 
			
		||||
OSMesa (off-screen)	implements OpenGL 2.1
 | 
			
		||||
Windows/Win32		implements OpenGL 2.1
 | 
			
		||||
Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
 | 
			
		||||
SVGA			unsupported
 | 
			
		||||
Wind River UGL		unsupported
 | 
			
		||||
DJGPP			unsupported
 | 
			
		||||
GGI			unsupported
 | 
			
		||||
BeOS			unsupported
 | 
			
		||||
Allegro			unsupported
 | 
			
		||||
D3D			unsupported
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -20,6 +20,8 @@ The release notes summarize what's new or changed in each Mesa release.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<UL>
 | 
			
		||||
<LI><A HREF="relnotes-7.0.1.html">7.0.1 release notes</A>
 | 
			
		||||
<LI><A HREF="relnotes-7.0.html">7.0 release notes</A>
 | 
			
		||||
<LI><A HREF="relnotes-6.5.3.html">6.5.3 release notes</A>
 | 
			
		||||
<LI><A HREF="relnotes-6.5.2.html">6.5.2 release notes</A>
 | 
			
		||||
<LI><A HREF="relnotes-6.5.1.html">6.5.1 release notes</A>
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,9 @@ in Mesa:
 | 
			
		||||
<li>Linking of multiple shaders is not supported
 | 
			
		||||
<li>gl_ClipVertex
 | 
			
		||||
<li>The derivative functions such as dFdx() are not implemented
 | 
			
		||||
<li>The inverse trig functions asin(), acos(), and atan() are not implemented
 | 
			
		||||
<li>The gl_Color and gl_SecondaryColor varying vars are interpolated
 | 
			
		||||
    without perspective correction
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,18 @@
 | 
			
		||||
<HTML>
 | 
			
		||||
 | 
			
		||||
<TITLE>Mesa Subset</TITLE>
 | 
			
		||||
<TITLE>Mesa Subset Driver</TITLE>
 | 
			
		||||
 | 
			
		||||
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
 | 
			
		||||
 | 
			
		||||
<BODY>
 | 
			
		||||
 | 
			
		||||
<H1>Mesa Subset</H1>
 | 
			
		||||
<H1>Mesa Subset Driver</H1>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
In 2002/2003 Tungsten Graphics was contracted to develop a subset Mesa/Radeon
 | 
			
		||||
driver for an embedded environment.  The result is a reduced-size DRI driver
 | 
			
		||||
for the ATI R200 chip, for use with Linux fbdev rather than XFree86.
 | 
			
		||||
for the ATI R200 chip, for use with
 | 
			
		||||
<a href="fbdev-dri.html">fbdev/DRI environment</a>.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
@@ -19,15 +20,5 @@ The specification for this subset can be found
 | 
			
		||||
<a href="subset-A.html">here</a>.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
The <a href="MiniGLX.html">MiniGLX specification</a> describes the
 | 
			
		||||
interface between fbdev and Mesa.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
More info to come...
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</BODY>
 | 
			
		||||
</HTML>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Mesa 3-D graphics library
 | 
			
		||||
 * Version:  6.5.1
 | 
			
		||||
 * Version:  7.0
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
 | 
			
		||||
 * Copyright (C) 1999-2007  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"),
 | 
			
		||||
@@ -58,7 +58,11 @@
 | 
			
		||||
#  else /* for use with static link lib build of Win32 edition only */
 | 
			
		||||
#    define GLAPI extern
 | 
			
		||||
#  endif /* _STATIC_MESA support */
 | 
			
		||||
#  define GLAPIENTRY __stdcall
 | 
			
		||||
#  if defined(__MINGW32__) && defined(GL_NO_STDCALL)  /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
 | 
			
		||||
#    define GLAPIENTRY 
 | 
			
		||||
#  else
 | 
			
		||||
#    define GLAPIENTRY __stdcall
 | 
			
		||||
#  endif
 | 
			
		||||
#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
 | 
			
		||||
#  define GLAPI extern
 | 
			
		||||
#  define GLAPIENTRY __stdcall
 | 
			
		||||
@@ -84,7 +88,8 @@
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
 | 
			
		||||
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) \
 | 
			
		||||
     && !defined(OPENSTEP) && !defined(__CYGWIN__) || defined(__MINGW32__)
 | 
			
		||||
#include <GL/mesa_wgl.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -2161,11 +2166,11 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
 | 
			
		||||
#define GL_DEBUG_PRINT_MESA               0x875A
 | 
			
		||||
#define GL_DEBUG_ASSERT_MESA              0x875B
 | 
			
		||||
 | 
			
		||||
GLAPI GLhandleARB APIENTRY glCreateDebugObjectMESA (void);
 | 
			
		||||
GLAPI void APIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
 | 
			
		||||
GLAPI void APIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
 | 
			
		||||
GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void);
 | 
			
		||||
GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
 | 
			
		||||
GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
 | 
			
		||||
                                         GLsizei *length, GLcharARB *debugLog);
 | 
			
		||||
GLAPI GLsizei APIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
 | 
			
		||||
GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
 | 
			
		||||
 | 
			
		||||
#endif /* GL_MESA_shader_debug */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@
 | 
			
		||||
#define glActiveStencilFaceEXT		MANGLE(ActiveStencilFaceEXT)
 | 
			
		||||
#define glActiveTextureARB		MANGLE(ActiveTextureARB)
 | 
			
		||||
#define glActiveTexture		MANGLE(ActiveTexture)
 | 
			
		||||
#define glActiveVaryingNV		MANGLE(ActiveVaryingNV)
 | 
			
		||||
#define glAlphaFragmentOp1ATI		MANGLE(AlphaFragmentOp1ATI)
 | 
			
		||||
#define glAlphaFragmentOp2ATI		MANGLE(AlphaFragmentOp2ATI)
 | 
			
		||||
#define glAlphaFragmentOp3ATI		MANGLE(AlphaFragmentOp3ATI)
 | 
			
		||||
@@ -52,11 +53,16 @@
 | 
			
		||||
#define glBeginOcclusionQueryNV		MANGLE(BeginOcclusionQueryNV)
 | 
			
		||||
#define glBeginQueryARB		MANGLE(BeginQueryARB)
 | 
			
		||||
#define glBeginQuery		MANGLE(BeginQuery)
 | 
			
		||||
#define glBeginTransformFeedbackNV		MANGLE(BeginTransformFeedbackNV)
 | 
			
		||||
#define glBeginVertexShaderEXT		MANGLE(BeginVertexShaderEXT)
 | 
			
		||||
#define glBindAttribLocationARB		MANGLE(BindAttribLocationARB)
 | 
			
		||||
#define glBindAttribLocation		MANGLE(BindAttribLocation)
 | 
			
		||||
#define glBindBufferARB		MANGLE(BindBufferARB)
 | 
			
		||||
#define glBindBufferBaseNV		MANGLE(BindBufferBaseNV)
 | 
			
		||||
#define glBindBuffer		MANGLE(BindBuffer)
 | 
			
		||||
#define glBindBufferOffsetNV		MANGLE(BindBufferOffsetNV)
 | 
			
		||||
#define glBindBufferRangeNV		MANGLE(BindBufferRangeNV)
 | 
			
		||||
#define glBindFragDataLocationEXT		MANGLE(BindFragDataLocationEXT)
 | 
			
		||||
#define glBindFragmentShaderATI		MANGLE(BindFragmentShaderATI)
 | 
			
		||||
#define glBindFramebufferEXT		MANGLE(BindFramebufferEXT)
 | 
			
		||||
#define glBindLightParameterEXT		MANGLE(BindLightParameterEXT)
 | 
			
		||||
@@ -97,6 +103,7 @@
 | 
			
		||||
#define glBlitFramebufferEXT		MANGLE(BlitFramebufferEXT)
 | 
			
		||||
#define glBufferDataARB		MANGLE(BufferDataARB)
 | 
			
		||||
#define glBufferData		MANGLE(BufferData)
 | 
			
		||||
#define glBufferParameteriAPPLE		MANGLE(BufferParameteriAPPLE)
 | 
			
		||||
#define glBufferSubDataARB		MANGLE(BufferSubDataARB)
 | 
			
		||||
#define glBufferSubData		MANGLE(BufferSubData)
 | 
			
		||||
#define glCallList		MANGLE(CallList)
 | 
			
		||||
@@ -104,8 +111,11 @@
 | 
			
		||||
#define glCheckFramebufferStatusEXT		MANGLE(CheckFramebufferStatusEXT)
 | 
			
		||||
#define glClampColorARB		MANGLE(ClampColorARB)
 | 
			
		||||
#define glClearAccum		MANGLE(ClearAccum)
 | 
			
		||||
#define glClearColorIiEXT		MANGLE(ClearColorIiEXT)
 | 
			
		||||
#define glClearColorIuiEXT		MANGLE(ClearColorIuiEXT)
 | 
			
		||||
#define glClearColor		MANGLE(ClearColor)
 | 
			
		||||
#define glClearDebugLogMESA		MANGLE(ClearDebugLogMESA)
 | 
			
		||||
#define glClearDepthdNV		MANGLE(ClearDepthdNV)
 | 
			
		||||
#define glClearDepth		MANGLE(ClearDepth)
 | 
			
		||||
#define glClearIndex		MANGLE(ClearIndex)
 | 
			
		||||
#define glClear		MANGLE(Clear)
 | 
			
		||||
@@ -161,6 +171,7 @@
 | 
			
		||||
#define glColorFragmentOp1ATI		MANGLE(ColorFragmentOp1ATI)
 | 
			
		||||
#define glColorFragmentOp2ATI		MANGLE(ColorFragmentOp2ATI)
 | 
			
		||||
#define glColorFragmentOp3ATI		MANGLE(ColorFragmentOp3ATI)
 | 
			
		||||
#define glColorMaskIndexedEXT		MANGLE(ColorMaskIndexedEXT)
 | 
			
		||||
#define glColorMask		MANGLE(ColorMask)
 | 
			
		||||
#define glColorMaterial		MANGLE(ColorMaterial)
 | 
			
		||||
#define glColorPointerEXT		MANGLE(ColorPointerEXT)
 | 
			
		||||
@@ -261,19 +272,23 @@
 | 
			
		||||
#define glDeleteTextures		MANGLE(DeleteTextures)
 | 
			
		||||
#define glDeleteVertexArraysAPPLE		MANGLE(DeleteVertexArraysAPPLE)
 | 
			
		||||
#define glDeleteVertexShaderEXT		MANGLE(DeleteVertexShaderEXT)
 | 
			
		||||
#define glDepthBoundsdNV		MANGLE(DepthBoundsdNV)
 | 
			
		||||
#define glDepthBoundsEXT		MANGLE(DepthBoundsEXT)
 | 
			
		||||
#define glDepthFunc		MANGLE(DepthFunc)
 | 
			
		||||
#define glDepthMask		MANGLE(DepthMask)
 | 
			
		||||
#define glDepthRangedNV		MANGLE(DepthRangedNV)
 | 
			
		||||
#define glDepthRange		MANGLE(DepthRange)
 | 
			
		||||
#define glDetachObjectARB		MANGLE(DetachObjectARB)
 | 
			
		||||
#define glDetachShader		MANGLE(DetachShader)
 | 
			
		||||
#define glDetailTexFuncSGIS		MANGLE(DetailTexFuncSGIS)
 | 
			
		||||
#define glDisableClientState		MANGLE(DisableClientState)
 | 
			
		||||
#define glDisableIndexedEXT		MANGLE(DisableIndexedEXT)
 | 
			
		||||
#define glDisable		MANGLE(Disable)
 | 
			
		||||
#define glDisableVariantClientStateEXT		MANGLE(DisableVariantClientStateEXT)
 | 
			
		||||
#define glDisableVertexAttribArrayARB		MANGLE(DisableVertexAttribArrayARB)
 | 
			
		||||
#define glDisableVertexAttribArray		MANGLE(DisableVertexAttribArray)
 | 
			
		||||
#define glDrawArraysEXT		MANGLE(DrawArraysEXT)
 | 
			
		||||
#define glDrawArraysInstancedEXT		MANGLE(DrawArraysInstancedEXT)
 | 
			
		||||
#define glDrawArrays		MANGLE(DrawArrays)
 | 
			
		||||
#define glDrawBuffer		MANGLE(DrawBuffer)
 | 
			
		||||
#define glDrawBuffersARB		MANGLE(DrawBuffersARB)
 | 
			
		||||
@@ -281,6 +296,7 @@
 | 
			
		||||
#define glDrawBuffers		MANGLE(DrawBuffers)
 | 
			
		||||
#define glDrawElementArrayAPPLE		MANGLE(DrawElementArrayAPPLE)
 | 
			
		||||
#define glDrawElementArrayATI		MANGLE(DrawElementArrayATI)
 | 
			
		||||
#define glDrawElementsInstancedEXT		MANGLE(DrawElementsInstancedEXT)
 | 
			
		||||
#define glDrawElements		MANGLE(DrawElements)
 | 
			
		||||
#define glDrawMeshArraysSUN		MANGLE(DrawMeshArraysSUN)
 | 
			
		||||
#define glDrawPixels		MANGLE(DrawPixels)
 | 
			
		||||
@@ -296,6 +312,7 @@
 | 
			
		||||
#define glElementPointerAPPLE		MANGLE(ElementPointerAPPLE)
 | 
			
		||||
#define glElementPointerATI		MANGLE(ElementPointerATI)
 | 
			
		||||
#define glEnableClientState		MANGLE(EnableClientState)
 | 
			
		||||
#define glEnableIndexedEXT		MANGLE(EnableIndexedEXT)
 | 
			
		||||
#define glEnable		MANGLE(Enable)
 | 
			
		||||
#define glEnableVariantClientStateEXT		MANGLE(EnableVariantClientStateEXT)
 | 
			
		||||
#define glEnableVertexAttribArrayARB		MANGLE(EnableVertexAttribArrayARB)
 | 
			
		||||
@@ -306,6 +323,7 @@
 | 
			
		||||
#define glEndOcclusionQueryNV		MANGLE(EndOcclusionQueryNV)
 | 
			
		||||
#define glEndQueryARB		MANGLE(EndQueryARB)
 | 
			
		||||
#define glEndQuery		MANGLE(EndQuery)
 | 
			
		||||
#define glEndTransformFeedbackNV		MANGLE(EndTransformFeedbackNV)
 | 
			
		||||
#define glEndVertexShaderEXT		MANGLE(EndVertexShaderEXT)
 | 
			
		||||
#define glEvalCoord1d		MANGLE(EvalCoord1d)
 | 
			
		||||
#define glEvalCoord1dv		MANGLE(EvalCoord1dv)
 | 
			
		||||
@@ -331,6 +349,7 @@
 | 
			
		||||
#define glFinishObjectAPPLE		MANGLE(FinishObjectAPPLE)
 | 
			
		||||
#define glFinishTextureSUNX		MANGLE(FinishTextureSUNX)
 | 
			
		||||
#define glFlush		MANGLE(Flush)
 | 
			
		||||
#define glFlushMappedBufferRangeAPPLE		MANGLE(FlushMappedBufferRangeAPPLE)
 | 
			
		||||
#define glFlushPixelDataRangeNV		MANGLE(FlushPixelDataRangeNV)
 | 
			
		||||
#define glFlushRasterSGIX		MANGLE(FlushRasterSGIX)
 | 
			
		||||
#define glFlushVertexArrayRangeAPPLE		MANGLE(FlushVertexArrayRangeAPPLE)
 | 
			
		||||
@@ -370,6 +389,9 @@
 | 
			
		||||
#define glFramebufferTexture1DEXT		MANGLE(FramebufferTexture1DEXT)
 | 
			
		||||
#define glFramebufferTexture2DEXT		MANGLE(FramebufferTexture2DEXT)
 | 
			
		||||
#define glFramebufferTexture3DEXT		MANGLE(FramebufferTexture3DEXT)
 | 
			
		||||
#define glFramebufferTextureEXT		MANGLE(FramebufferTextureEXT)
 | 
			
		||||
#define glFramebufferTextureFaceEXT		MANGLE(FramebufferTextureFaceEXT)
 | 
			
		||||
#define glFramebufferTextureLayerEXT		MANGLE(FramebufferTextureLayerEXT)
 | 
			
		||||
#define glFrameZoomSGIX		MANGLE(FrameZoomSGIX)
 | 
			
		||||
#define glFreeObjectBufferATI		MANGLE(FreeObjectBufferATI)
 | 
			
		||||
#define glFrontFace		MANGLE(FrontFace)
 | 
			
		||||
@@ -398,12 +420,14 @@
 | 
			
		||||
#define glGetActiveAttrib		MANGLE(GetActiveAttrib)
 | 
			
		||||
#define glGetActiveUniformARB		MANGLE(GetActiveUniformARB)
 | 
			
		||||
#define glGetActiveUniform		MANGLE(GetActiveUniform)
 | 
			
		||||
#define glGetActiveVaryingNV		MANGLE(GetActiveVaryingNV)
 | 
			
		||||
#define glGetArrayObjectfvATI		MANGLE(GetArrayObjectfvATI)
 | 
			
		||||
#define glGetArrayObjectivATI		MANGLE(GetArrayObjectivATI)
 | 
			
		||||
#define glGetAttachedObjectsARB		MANGLE(GetAttachedObjectsARB)
 | 
			
		||||
#define glGetAttachedShaders		MANGLE(GetAttachedShaders)
 | 
			
		||||
#define glGetAttribLocationARB		MANGLE(GetAttribLocationARB)
 | 
			
		||||
#define glGetAttribLocation		MANGLE(GetAttribLocation)
 | 
			
		||||
#define glGetBooleanIndexedvEXT		MANGLE(GetBooleanIndexedvEXT)
 | 
			
		||||
#define glGetBooleanv		MANGLE(GetBooleanv)
 | 
			
		||||
#define glGetBufferParameterivARB		MANGLE(GetBufferParameterivARB)
 | 
			
		||||
#define glGetBufferParameteriv		MANGLE(GetBufferParameteriv)
 | 
			
		||||
@@ -444,6 +468,7 @@
 | 
			
		||||
#define glGetFinalCombinerInputParameterivNV		MANGLE(GetFinalCombinerInputParameterivNV)
 | 
			
		||||
#define glGetFloatv		MANGLE(GetFloatv)
 | 
			
		||||
#define glGetFogFuncSGIS		MANGLE(GetFogFuncSGIS)
 | 
			
		||||
#define glGetFragDataLocationEXT		MANGLE(GetFragDataLocationEXT)
 | 
			
		||||
#define glGetFragmentLightfvSGIX		MANGLE(GetFragmentLightfvSGIX)
 | 
			
		||||
#define glGetFragmentLightivSGIX		MANGLE(GetFragmentLightivSGIX)
 | 
			
		||||
#define glGetFragmentMaterialfvSGIX		MANGLE(GetFragmentMaterialfvSGIX)
 | 
			
		||||
@@ -460,6 +485,7 @@
 | 
			
		||||
#define glGetImageTransformParameterivHP		MANGLE(GetImageTransformParameterivHP)
 | 
			
		||||
#define glGetInfoLogARB		MANGLE(GetInfoLogARB)
 | 
			
		||||
#define glGetInstrumentsSGIX		MANGLE(GetInstrumentsSGIX)
 | 
			
		||||
#define glGetIntegerIndexedvEXT		MANGLE(GetIntegerIndexedvEXT)
 | 
			
		||||
#define glGetIntegerv		MANGLE(GetIntegerv)
 | 
			
		||||
#define glGetInvariantBooleanvEXT		MANGLE(GetInvariantBooleanvEXT)
 | 
			
		||||
#define glGetInvariantFloatvEXT		MANGLE(GetInvariantFloatvEXT)
 | 
			
		||||
@@ -503,12 +529,16 @@
 | 
			
		||||
#define glGetPolygonStipple		MANGLE(GetPolygonStipple)
 | 
			
		||||
#define glGetProgramEnvParameterdvARB		MANGLE(GetProgramEnvParameterdvARB)
 | 
			
		||||
#define glGetProgramEnvParameterfvARB		MANGLE(GetProgramEnvParameterfvARB)
 | 
			
		||||
#define glGetProgramEnvParameterIivNV		MANGLE(GetProgramEnvParameterIivNV)
 | 
			
		||||
#define glGetProgramEnvParameterIuivNV		MANGLE(GetProgramEnvParameterIuivNV)
 | 
			
		||||
#define glGetProgramInfoLog		MANGLE(GetProgramInfoLog)
 | 
			
		||||
#define glGetProgramivARB		MANGLE(GetProgramivARB)
 | 
			
		||||
#define glGetProgramiv		MANGLE(GetProgramiv)
 | 
			
		||||
#define glGetProgramivNV		MANGLE(GetProgramivNV)
 | 
			
		||||
#define glGetProgramLocalParameterdvARB		MANGLE(GetProgramLocalParameterdvARB)
 | 
			
		||||
#define glGetProgramLocalParameterfvARB		MANGLE(GetProgramLocalParameterfvARB)
 | 
			
		||||
#define glGetProgramLocalParameterIivNV		MANGLE(GetProgramLocalParameterIivNV)
 | 
			
		||||
#define glGetProgramLocalParameterIuivNV		MANGLE(GetProgramLocalParameterIuivNV)
 | 
			
		||||
#define glGetProgramNamedParameterdvNV		MANGLE(GetProgramNamedParameterdvNV)
 | 
			
		||||
#define glGetProgramNamedParameterfvNV		MANGLE(GetProgramNamedParameterfvNV)
 | 
			
		||||
#define glGetProgramParameterdvNV		MANGLE(GetProgramParameterdvNV)
 | 
			
		||||
@@ -545,20 +575,27 @@
 | 
			
		||||
#define glGetTexLevelParameterfv		MANGLE(GetTexLevelParameterfv)
 | 
			
		||||
#define glGetTexLevelParameteriv		MANGLE(GetTexLevelParameteriv)
 | 
			
		||||
#define glGetTexParameterfv		MANGLE(GetTexParameterfv)
 | 
			
		||||
#define glGetTexParameterIivEXT		MANGLE(GetTexParameterIivEXT)
 | 
			
		||||
#define glGetTexParameterIuivEXT		MANGLE(GetTexParameterIuivEXT)
 | 
			
		||||
#define glGetTexParameteriv		MANGLE(GetTexParameteriv)
 | 
			
		||||
#define glGetTrackMatrixivNV		MANGLE(GetTrackMatrixivNV)
 | 
			
		||||
#define glGetTransformFeedbackVaryingNV		MANGLE(GetTransformFeedbackVaryingNV)
 | 
			
		||||
#define glGetUniformBufferSizeEXT		MANGLE(GetUniformBufferSizeEXT)
 | 
			
		||||
#define glGetUniformfvARB		MANGLE(GetUniformfvARB)
 | 
			
		||||
#define glGetUniformfv		MANGLE(GetUniformfv)
 | 
			
		||||
#define glGetUniformivARB		MANGLE(GetUniformivARB)
 | 
			
		||||
#define glGetUniformiv		MANGLE(GetUniformiv)
 | 
			
		||||
#define glGetUniformLocationARB		MANGLE(GetUniformLocationARB)
 | 
			
		||||
#define glGetUniformLocation		MANGLE(GetUniformLocation)
 | 
			
		||||
#define glGetUniformOffsetEXT		MANGLE(GetUniformOffsetEXT)
 | 
			
		||||
#define glGetUniformuivEXT		MANGLE(GetUniformuivEXT)
 | 
			
		||||
#define glGetVariantArrayObjectfvATI		MANGLE(GetVariantArrayObjectfvATI)
 | 
			
		||||
#define glGetVariantArrayObjectivATI		MANGLE(GetVariantArrayObjectivATI)
 | 
			
		||||
#define glGetVariantBooleanvEXT		MANGLE(GetVariantBooleanvEXT)
 | 
			
		||||
#define glGetVariantFloatvEXT		MANGLE(GetVariantFloatvEXT)
 | 
			
		||||
#define glGetVariantIntegervEXT		MANGLE(GetVariantIntegervEXT)
 | 
			
		||||
#define glGetVariantPointervEXT		MANGLE(GetVariantPointervEXT)
 | 
			
		||||
#define glGetVaryingLocationNV		MANGLE(GetVaryingLocationNV)
 | 
			
		||||
#define glGetVertexAttribArrayObjectfvATI		MANGLE(GetVertexAttribArrayObjectfvATI)
 | 
			
		||||
#define glGetVertexAttribArrayObjectivATI		MANGLE(GetVertexAttribArrayObjectivATI)
 | 
			
		||||
#define glGetVertexAttribdvARB		MANGLE(GetVertexAttribdvARB)
 | 
			
		||||
@@ -567,6 +604,8 @@
 | 
			
		||||
#define glGetVertexAttribfvARB		MANGLE(GetVertexAttribfvARB)
 | 
			
		||||
#define glGetVertexAttribfv		MANGLE(GetVertexAttribfv)
 | 
			
		||||
#define glGetVertexAttribfvNV		MANGLE(GetVertexAttribfvNV)
 | 
			
		||||
#define glGetVertexAttribIivEXT		MANGLE(GetVertexAttribIivEXT)
 | 
			
		||||
#define glGetVertexAttribIuivEXT		MANGLE(GetVertexAttribIuivEXT)
 | 
			
		||||
#define glGetVertexAttribivARB		MANGLE(GetVertexAttribivARB)
 | 
			
		||||
#define glGetVertexAttribiv		MANGLE(GetVertexAttribiv)
 | 
			
		||||
#define glGetVertexAttribivNV		MANGLE(GetVertexAttribivNV)
 | 
			
		||||
@@ -613,6 +652,7 @@
 | 
			
		||||
#define glIsAsyncMarkerSGIX		MANGLE(IsAsyncMarkerSGIX)
 | 
			
		||||
#define glIsBufferARB		MANGLE(IsBufferARB)
 | 
			
		||||
#define glIsBuffer		MANGLE(IsBuffer)
 | 
			
		||||
#define glIsEnabledIndexedEXT		MANGLE(IsEnabledIndexedEXT)
 | 
			
		||||
#define glIsEnabled		MANGLE(IsEnabled)
 | 
			
		||||
#define glIsFenceAPPLE		MANGLE(IsFenceAPPLE)
 | 
			
		||||
#define glIsFenceNV		MANGLE(IsFenceNV)
 | 
			
		||||
@@ -852,17 +892,32 @@
 | 
			
		||||
#define glPrimitiveRestartNV		MANGLE(PrimitiveRestartNV)
 | 
			
		||||
#define glPrioritizeTexturesEXT		MANGLE(PrioritizeTexturesEXT)
 | 
			
		||||
#define glPrioritizeTextures		MANGLE(PrioritizeTextures)
 | 
			
		||||
#define glProgramBufferParametersfvNV		MANGLE(ProgramBufferParametersfvNV)
 | 
			
		||||
#define glProgramBufferParametersIivNV		MANGLE(ProgramBufferParametersIivNV)
 | 
			
		||||
#define glProgramBufferParametersIuivNV		MANGLE(ProgramBufferParametersIuivNV)
 | 
			
		||||
#define glProgramCallbackMESA		MANGLE(ProgramCallbackMESA)
 | 
			
		||||
#define glProgramEnvParameter4dARB		MANGLE(ProgramEnvParameter4dARB)
 | 
			
		||||
#define glProgramEnvParameter4dvARB		MANGLE(ProgramEnvParameter4dvARB)
 | 
			
		||||
#define glProgramEnvParameter4fARB		MANGLE(ProgramEnvParameter4fARB)
 | 
			
		||||
#define glProgramEnvParameter4fvARB		MANGLE(ProgramEnvParameter4fvARB)
 | 
			
		||||
#define glProgramEnvParameterI4iNV		MANGLE(ProgramEnvParameterI4iNV)
 | 
			
		||||
#define glProgramEnvParameterI4ivNV		MANGLE(ProgramEnvParameterI4ivNV)
 | 
			
		||||
#define glProgramEnvParameterI4uiNV		MANGLE(ProgramEnvParameterI4uiNV)
 | 
			
		||||
#define glProgramEnvParameterI4uivNV		MANGLE(ProgramEnvParameterI4uivNV)
 | 
			
		||||
#define glProgramEnvParameters4fvEXT		MANGLE(ProgramEnvParameters4fvEXT)
 | 
			
		||||
#define glProgramEnvParametersI4ivNV		MANGLE(ProgramEnvParametersI4ivNV)
 | 
			
		||||
#define glProgramEnvParametersI4uivNV		MANGLE(ProgramEnvParametersI4uivNV)
 | 
			
		||||
#define glProgramLocalParameter4dARB		MANGLE(ProgramLocalParameter4dARB)
 | 
			
		||||
#define glProgramLocalParameter4dvARB		MANGLE(ProgramLocalParameter4dvARB)
 | 
			
		||||
#define glProgramLocalParameter4fARB		MANGLE(ProgramLocalParameter4fARB)
 | 
			
		||||
#define glProgramLocalParameter4fvARB		MANGLE(ProgramLocalParameter4fvARB)
 | 
			
		||||
#define glProgramLocalParameterI4iNV		MANGLE(ProgramLocalParameterI4iNV)
 | 
			
		||||
#define glProgramLocalParameterI4ivNV		MANGLE(ProgramLocalParameterI4ivNV)
 | 
			
		||||
#define glProgramLocalParameterI4uiNV		MANGLE(ProgramLocalParameterI4uiNV)
 | 
			
		||||
#define glProgramLocalParameterI4uivNV		MANGLE(ProgramLocalParameterI4uivNV)
 | 
			
		||||
#define glProgramLocalParameters4fvEXT		MANGLE(ProgramLocalParameters4fvEXT)
 | 
			
		||||
#define glProgramLocalParametersI4ivNV		MANGLE(ProgramLocalParametersI4ivNV)
 | 
			
		||||
#define glProgramLocalParametersI4uivNV		MANGLE(ProgramLocalParametersI4uivNV)
 | 
			
		||||
#define glProgramNamedParameter4dNV		MANGLE(ProgramNamedParameter4dNV)
 | 
			
		||||
#define glProgramNamedParameter4dvNV		MANGLE(ProgramNamedParameter4dvNV)
 | 
			
		||||
#define glProgramNamedParameter4fNV		MANGLE(ProgramNamedParameter4fNV)
 | 
			
		||||
@@ -871,9 +926,11 @@
 | 
			
		||||
#define glProgramParameter4dvNV		MANGLE(ProgramParameter4dvNV)
 | 
			
		||||
#define glProgramParameter4fNV		MANGLE(ProgramParameter4fNV)
 | 
			
		||||
#define glProgramParameter4fvNV		MANGLE(ProgramParameter4fvNV)
 | 
			
		||||
#define glProgramParameteriEXT		MANGLE(ProgramParameteriEXT)
 | 
			
		||||
#define glProgramParameters4dvNV		MANGLE(ProgramParameters4dvNV)
 | 
			
		||||
#define glProgramParameters4fvNV		MANGLE(ProgramParameters4fvNV)
 | 
			
		||||
#define glProgramStringARB		MANGLE(ProgramStringARB)
 | 
			
		||||
#define glProgramVertexLimitNV		MANGLE(ProgramVertexLimitNV)
 | 
			
		||||
#define glPushAttrib		MANGLE(PushAttrib)
 | 
			
		||||
#define glPushClientAttrib		MANGLE(PushClientAttrib)
 | 
			
		||||
#define glPushMatrix		MANGLE(PushMatrix)
 | 
			
		||||
@@ -915,6 +972,7 @@
 | 
			
		||||
#define glRectsv		MANGLE(Rectsv)
 | 
			
		||||
#define glReferencePlaneSGIX		MANGLE(ReferencePlaneSGIX)
 | 
			
		||||
#define glRenderbufferStorageEXT		MANGLE(RenderbufferStorageEXT)
 | 
			
		||||
#define glRenderbufferStorageMultisampleCoverageNV		MANGLE(RenderbufferStorageMultisampleCoverageNV)
 | 
			
		||||
#define glRenderbufferStorageMultisampleEXT		MANGLE(RenderbufferStorageMultisampleEXT)
 | 
			
		||||
#define glRenderMode		MANGLE(RenderMode)
 | 
			
		||||
#define glReplacementCodePointerSUN		MANGLE(ReplacementCodePointerSUN)
 | 
			
		||||
@@ -1043,6 +1101,7 @@
 | 
			
		||||
#define glTestFenceAPPLE		MANGLE(TestFenceAPPLE)
 | 
			
		||||
#define glTestFenceNV		MANGLE(TestFenceNV)
 | 
			
		||||
#define glTestObjectAPPLE		MANGLE(TestObjectAPPLE)
 | 
			
		||||
#define glTexBufferEXT		MANGLE(TexBufferEXT)
 | 
			
		||||
#define glTexBumpParameterfvATI		MANGLE(TexBumpParameterfvATI)
 | 
			
		||||
#define glTexBumpParameterivATI		MANGLE(TexBumpParameterivATI)
 | 
			
		||||
#define glTexCoord1d		MANGLE(TexCoord1d)
 | 
			
		||||
@@ -1121,7 +1180,9 @@
 | 
			
		||||
#define glTexImage4DSGIS		MANGLE(TexImage4DSGIS)
 | 
			
		||||
#define glTexParameterf		MANGLE(TexParameterf)
 | 
			
		||||
#define glTexParameterfv		MANGLE(TexParameterfv)
 | 
			
		||||
#define glTexParameterIivEXT		MANGLE(TexParameterIivEXT)
 | 
			
		||||
#define glTexParameteri		MANGLE(TexParameteri)
 | 
			
		||||
#define glTexParameterIuivEXT		MANGLE(TexParameterIuivEXT)
 | 
			
		||||
#define glTexParameteriv		MANGLE(TexParameteriv)
 | 
			
		||||
#define glTexSubImage1DEXT		MANGLE(TexSubImage1DEXT)
 | 
			
		||||
#define glTexSubImage1D		MANGLE(TexSubImage1D)
 | 
			
		||||
@@ -1135,6 +1196,8 @@
 | 
			
		||||
#define glTextureMaterialEXT		MANGLE(TextureMaterialEXT)
 | 
			
		||||
#define glTextureNormalEXT		MANGLE(TextureNormalEXT)
 | 
			
		||||
#define glTrackMatrixNV		MANGLE(TrackMatrixNV)
 | 
			
		||||
#define glTransformFeedbackAttribsNV		MANGLE(TransformFeedbackAttribsNV)
 | 
			
		||||
#define glTransformFeedbackVaryingsNV		MANGLE(TransformFeedbackVaryingsNV)
 | 
			
		||||
#define glTranslated		MANGLE(Translated)
 | 
			
		||||
#define glTranslatef		MANGLE(Translatef)
 | 
			
		||||
#define glUniform1fARB		MANGLE(Uniform1fARB)
 | 
			
		||||
@@ -1145,6 +1208,8 @@
 | 
			
		||||
#define glUniform1i		MANGLE(Uniform1i)
 | 
			
		||||
#define glUniform1ivARB		MANGLE(Uniform1ivARB)
 | 
			
		||||
#define glUniform1iv		MANGLE(Uniform1iv)
 | 
			
		||||
#define glUniform1uiEXT		MANGLE(Uniform1uiEXT)
 | 
			
		||||
#define glUniform1uivEXT		MANGLE(Uniform1uivEXT)
 | 
			
		||||
#define glUniform2fARB		MANGLE(Uniform2fARB)
 | 
			
		||||
#define glUniform2f		MANGLE(Uniform2f)
 | 
			
		||||
#define glUniform2fvARB		MANGLE(Uniform2fvARB)
 | 
			
		||||
@@ -1153,6 +1218,8 @@
 | 
			
		||||
#define glUniform2i		MANGLE(Uniform2i)
 | 
			
		||||
#define glUniform2ivARB		MANGLE(Uniform2ivARB)
 | 
			
		||||
#define glUniform2iv		MANGLE(Uniform2iv)
 | 
			
		||||
#define glUniform2uiEXT		MANGLE(Uniform2uiEXT)
 | 
			
		||||
#define glUniform2uivEXT		MANGLE(Uniform2uivEXT)
 | 
			
		||||
#define glUniform3fARB		MANGLE(Uniform3fARB)
 | 
			
		||||
#define glUniform3f		MANGLE(Uniform3f)
 | 
			
		||||
#define glUniform3fvARB		MANGLE(Uniform3fvARB)
 | 
			
		||||
@@ -1161,6 +1228,8 @@
 | 
			
		||||
#define glUniform3i		MANGLE(Uniform3i)
 | 
			
		||||
#define glUniform3ivARB		MANGLE(Uniform3ivARB)
 | 
			
		||||
#define glUniform3iv		MANGLE(Uniform3iv)
 | 
			
		||||
#define glUniform3uiEXT		MANGLE(Uniform3uiEXT)
 | 
			
		||||
#define glUniform3uivEXT		MANGLE(Uniform3uivEXT)
 | 
			
		||||
#define glUniform4fARB		MANGLE(Uniform4fARB)
 | 
			
		||||
#define glUniform4f		MANGLE(Uniform4f)
 | 
			
		||||
#define glUniform4fvARB		MANGLE(Uniform4fvARB)
 | 
			
		||||
@@ -1169,6 +1238,9 @@
 | 
			
		||||
#define glUniform4i		MANGLE(Uniform4i)
 | 
			
		||||
#define glUniform4ivARB		MANGLE(Uniform4ivARB)
 | 
			
		||||
#define glUniform4iv		MANGLE(Uniform4iv)
 | 
			
		||||
#define glUniform4uiEXT		MANGLE(Uniform4uiEXT)
 | 
			
		||||
#define glUniform4uivEXT		MANGLE(Uniform4uivEXT)
 | 
			
		||||
#define glUniformBufferEXT		MANGLE(UniformBufferEXT)
 | 
			
		||||
#define glUniformMatrix2fvARB		MANGLE(UniformMatrix2fvARB)
 | 
			
		||||
#define glUniformMatrix2fv		MANGLE(UniformMatrix2fv)
 | 
			
		||||
#define glUniformMatrix2x3fv		MANGLE(UniformMatrix2x3fv)
 | 
			
		||||
@@ -1340,6 +1412,27 @@
 | 
			
		||||
#define glVertexAttrib4usvARB		MANGLE(VertexAttrib4usvARB)
 | 
			
		||||
#define glVertexAttrib4usv		MANGLE(VertexAttrib4usv)
 | 
			
		||||
#define glVertexAttribArrayObjectATI		MANGLE(VertexAttribArrayObjectATI)
 | 
			
		||||
#define glVertexAttribI1iEXT		MANGLE(VertexAttribI1iEXT)
 | 
			
		||||
#define glVertexAttribI1ivEXT		MANGLE(VertexAttribI1ivEXT)
 | 
			
		||||
#define glVertexAttribI1uiEXT		MANGLE(VertexAttribI1uiEXT)
 | 
			
		||||
#define glVertexAttribI1uivEXT		MANGLE(VertexAttribI1uivEXT)
 | 
			
		||||
#define glVertexAttribI2iEXT		MANGLE(VertexAttribI2iEXT)
 | 
			
		||||
#define glVertexAttribI2ivEXT		MANGLE(VertexAttribI2ivEXT)
 | 
			
		||||
#define glVertexAttribI2uiEXT		MANGLE(VertexAttribI2uiEXT)
 | 
			
		||||
#define glVertexAttribI2uivEXT		MANGLE(VertexAttribI2uivEXT)
 | 
			
		||||
#define glVertexAttribI3iEXT		MANGLE(VertexAttribI3iEXT)
 | 
			
		||||
#define glVertexAttribI3ivEXT		MANGLE(VertexAttribI3ivEXT)
 | 
			
		||||
#define glVertexAttribI3uiEXT		MANGLE(VertexAttribI3uiEXT)
 | 
			
		||||
#define glVertexAttribI3uivEXT		MANGLE(VertexAttribI3uivEXT)
 | 
			
		||||
#define glVertexAttribI4bvEXT		MANGLE(VertexAttribI4bvEXT)
 | 
			
		||||
#define glVertexAttribI4iEXT		MANGLE(VertexAttribI4iEXT)
 | 
			
		||||
#define glVertexAttribI4ivEXT		MANGLE(VertexAttribI4ivEXT)
 | 
			
		||||
#define glVertexAttribI4svEXT		MANGLE(VertexAttribI4svEXT)
 | 
			
		||||
#define glVertexAttribI4ubvEXT		MANGLE(VertexAttribI4ubvEXT)
 | 
			
		||||
#define glVertexAttribI4uiEXT		MANGLE(VertexAttribI4uiEXT)
 | 
			
		||||
#define glVertexAttribI4uivEXT		MANGLE(VertexAttribI4uivEXT)
 | 
			
		||||
#define glVertexAttribI4usvEXT		MANGLE(VertexAttribI4usvEXT)
 | 
			
		||||
#define glVertexAttribIPointerEXT		MANGLE(VertexAttribIPointerEXT)
 | 
			
		||||
#define glVertexAttribPointerARB		MANGLE(VertexAttribPointerARB)
 | 
			
		||||
#define glVertexAttribPointer		MANGLE(VertexAttribPointer)
 | 
			
		||||
#define glVertexAttribPointerNV		MANGLE(VertexAttribPointerNV)
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,19 @@
 | 
			
		||||
#define GLAPIENTRYP GLAPIENTRY *
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef GLAPI
 | 
			
		||||
#undef GLAPI
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
 | 
			
		||||
#    define GLAPI __declspec(dllexport)
 | 
			
		||||
#  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
 | 
			
		||||
#    define GLAPI __declspec(dllimport)
 | 
			
		||||
#  else /* for use with static link lib build of Win32 edition only */
 | 
			
		||||
#    define GLAPI extern
 | 
			
		||||
#  endif /* _STATIC_MESA support */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef GLAPI
 | 
			
		||||
#define GLAPI
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,10 @@
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#include <GL/glu.h>
 | 
			
		||||
 | 
			
		||||
#if defined(__MINGW32__)
 | 
			
		||||
#include <GL/mesa_wgl.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
@@ -108,14 +112,14 @@ extern _CRTIMP void __cdecl exit(int);
 | 
			
		||||
   and redifinition of Windows system defs, also removes requirement of
 | 
			
		||||
   pretty much any standard windows header from this file */
 | 
			
		||||
 | 
			
		||||
#if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
 | 
			
		||||
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
 | 
			
		||||
#	define GLUTAPIENTRY __stdcall
 | 
			
		||||
#else
 | 
			
		||||
#	define GLUTAPIENTRY
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* GLUT API entry point declarations for Win32. */
 | 
			
		||||
#if defined(GLUT_BUILDING_LIB) && defined(_DLL)
 | 
			
		||||
#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL)
 | 
			
		||||
# 	define GLUTAPI __declspec(dllexport)
 | 
			
		||||
#elif defined(_DLL)
 | 
			
		||||
#   define GLUTAPI __declspec(dllimport)
 | 
			
		||||
@@ -130,9 +134,12 @@ extern _CRTIMP void __cdecl exit(int);
 | 
			
		||||
#		pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" )
 | 
			
		||||
#	endif
 | 
			
		||||
#	define CALLBACK __stdcall
 | 
			
		||||
typedef int (GLUTAPIENTRY *PROC)();
 | 
			
		||||
typedef void *HGLRC;
 | 
			
		||||
typedef void *HDC;
 | 
			
		||||
 | 
			
		||||
#if !defined(__MINGW32__)
 | 
			
		||||
	typedef int (GLUTAPIENTRY *PROC)();
 | 
			
		||||
	typedef void *HGLRC;
 | 
			
		||||
	typedef void *HDC;
 | 
			
		||||
#endif
 | 
			
		||||
typedef unsigned long COLORREF;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,11 +26,12 @@
 | 
			
		||||
/* prototypes for the Mesa WGL functions */
 | 
			
		||||
/* relocated here so that I could make GLUT get them properly */
 | 
			
		||||
 | 
			
		||||
#define _mesa_wgl_h_
 | 
			
		||||
 | 
			
		||||
#ifndef _mesa_wgl_h_
 | 
			
		||||
#define _mesa_wgl_h_
 | 
			
		||||
 | 
			
		||||
#if defined(__MINGW32__)
 | 
			
		||||
#  define __W32API_USE_DLLIMPORT__
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
 | 
			
		||||
@@ -39,23 +40,16 @@ extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
 | 
			
		||||
#  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
 | 
			
		||||
#    define GLAPI __declspec(dllexport)
 | 
			
		||||
#    define WGLAPI __declspec(dllexport)
 | 
			
		||||
#  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
 | 
			
		||||
#    define GLAPI __declspec(dllimport)
 | 
			
		||||
#    define WGLAPI __declspec(dllimport)
 | 
			
		||||
#  else /* for use with static link lib build of Win32 edition only */
 | 
			
		||||
#    define GLAPI extern
 | 
			
		||||
#    define WGLAPI __declspec(dllimport)
 | 
			
		||||
#  endif /* _STATIC_MESA support */
 | 
			
		||||
#  define GLAPIENTRY __stdcall
 | 
			
		||||
#else
 | 
			
		||||
/* non-Windows compilation */
 | 
			
		||||
#  define GLAPI extern
 | 
			
		||||
#  define GLAPIENTRY
 | 
			
		||||
#endif /* WIN32 / CYGWIN32 bracket */
 | 
			
		||||
#ifndef WGLAPI
 | 
			
		||||
#define WGLAPI GLAPI
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__MINGW32__)
 | 
			
		||||
#  ifndef WIN32_LEAN_AND_MEAN
 | 
			
		||||
#    define WIN32_LEAN_AND_MEAN 1
 | 
			
		||||
#  endif
 | 
			
		||||
#  include <windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
 | 
			
		||||
@@ -80,23 +74,25 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
 | 
			
		||||
#  pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglDeleteContext(HGLRC);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
 | 
			
		||||
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglSwapBuffers(HDC hdc);
 | 
			
		||||
WGLAPI HDC   GLAPIENTRY wglGetCurrentDC(void);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglGetPixelFormat(HDC hdc);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if defined(GL_NO_STDCALL) || !defined(__MINGW32__)
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
 | 
			
		||||
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
 | 
			
		||||
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
 | 
			
		||||
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
 | 
			
		||||
WGLAPI PROC  GLAPIENTRY wglGetProcAddress(const char*);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglDeleteContext(HGLRC);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
 | 
			
		||||
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
 | 
			
		||||
WGLAPI HDC   GLAPIENTRY wglGetCurrentDC(void);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglGetPixelFormat(HDC hdc);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
 | 
			
		||||
WGLAPI PROC  GLAPIENTRY wglGetProcAddress(const char*);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglShareLists(HGLRC, HGLRC);
 | 
			
		||||
@@ -105,12 +101,15 @@ WGLAPI int   GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, un
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
 | 
			
		||||
WGLAPI int   GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __MINGW32__
 | 
			
		||||
WGLAPI int   GLAPIENTRY SwapBuffers(HDC);
 | 
			
		||||
WGLAPI int   GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
 | 
			
		||||
WGLAPI int   GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
 | 
			
		||||
WGLAPI int   GLAPIENTRY GetPixelFormat(HDC);
 | 
			
		||||
WGLAPI int   GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef WGL_ARB_extensions_string
 | 
			
		||||
#define WGL_ARB_extensions_string 1
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ message:
 | 
			
		||||
subdirs:
 | 
			
		||||
	@for dir in $(SUBDIRS) ; do \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir ; $(MAKE)) || exit 1 ; \
 | 
			
		||||
			(cd $$dir && $(MAKE)) || exit 1 ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
@@ -27,6 +27,6 @@ install:
 | 
			
		||||
clean:
 | 
			
		||||
	@for dir in $(SUBDIRS) tests ; do \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir ; $(MAKE) clean) ; \
 | 
			
		||||
			(cd $$dir && $(MAKE) clean) ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 
 | 
			
		||||
@@ -22,9 +22,11 @@ LIBS   = GLUT32.LIB OPENGL32.LIB
 | 
			
		||||
 | 
			
		||||
all:	OPENGL32.DLL GLU32.DLL GLUT32.DLL \
 | 
			
		||||
	readtex.h readtex.c showbuffer.h showbuffer.c \
 | 
			
		||||
	extfuncs.h trackball.h trackball.c \
 | 
			
		||||
	arbfplight.exe arbfslight.exe arbocclude.exe bounce.exe \
 | 
			
		||||
	clearspd.exe cubemap.exe drawpix.exe fire.exe fogcoord.exe \
 | 
			
		||||
	fplight.exe gamma.exe gearbox.exe \
 | 
			
		||||
	clearspd.exe cubemap.exe drawpix.exe engine.exe \
 | 
			
		||||
	fire.exe fogcoord.exe \
 | 
			
		||||
	fplight.exe fslight.exe gamma.exe gearbox.exe \
 | 
			
		||||
	gears.exe geartrain.exe gloss.exe \
 | 
			
		||||
	glinfo.exe glslnoise.exe \
 | 
			
		||||
	gltestperf.exe glutfx.exe ipers.exe isosurf.exe lodbias.exe \
 | 
			
		||||
@@ -42,14 +44,16 @@ bounce.exe: bounce.obj
 | 
			
		||||
clearspd.exe: clearspd.obj
 | 
			
		||||
cubemap.exe: cubemap.obj readtex.obj
 | 
			
		||||
drawpix.exe: drawpix.obj readtex.obj
 | 
			
		||||
engine.exe: engine.obj readtex.obj trackball.obj
 | 
			
		||||
fire.exe: fire.obj readtex.obj
 | 
			
		||||
fogcoord.exe: fogcoord.obj readtex.obj
 | 
			
		||||
fplight.exe: fplight.obj
 | 
			
		||||
fslight.exe: fslight.obj
 | 
			
		||||
gamma.exe: gamma.obj
 | 
			
		||||
gearbox.exe: gearbox.obj
 | 
			
		||||
gears.exe: gears.obj
 | 
			
		||||
geartrain.exe: geartrain.obj
 | 
			
		||||
gloss.exe: gloss.obj readtex.obj
 | 
			
		||||
gloss.exe: gloss.obj readtex.obj trackball.obj
 | 
			
		||||
glinfo.exe: glinfo.obj
 | 
			
		||||
glslnoise.exe: glslnoise.obj
 | 
			
		||||
gltestperf.exe: gltestperf.obj
 | 
			
		||||
@@ -105,14 +109,23 @@ showbuffer.c: $(TOP)\progs\util\showbuffer.c
 | 
			
		||||
showbuffer.h: $(TOP)\progs\util\showbuffer.h
 | 
			
		||||
	copy $** .
 | 
			
		||||
 | 
			
		||||
trackball.c: $(TOP)\progs\util\trackball.c
 | 
			
		||||
	copy $** .
 | 
			
		||||
 | 
			
		||||
trackball.h: $(TOP)\progs\util\trackball.h
 | 
			
		||||
	copy $** .
 | 
			
		||||
 | 
			
		||||
extfuncs.h: $(TOP)\progs\util\extfuncs.h
 | 
			
		||||
	copy $** .
 | 
			
		||||
 | 
			
		||||
.obj.exe:
 | 
			
		||||
	$(link) $(ldebug) -out:$@ $** /LIBPATH:$(LIBDIR) $(LIBS)
 | 
			
		||||
 | 
			
		||||
.c.obj:
 | 
			
		||||
	$(cc) $(cdebug) $(cflags) $(cvars) /I$(INCDIR) $*.c
 | 
			
		||||
	$(cc) $(cdebug) $(cflags) $(cvars) -D_USE_MATH_DEFINES /I$(INCDIR) $*.c
 | 
			
		||||
 | 
			
		||||
clean::
 | 
			
		||||
	del *.obj *.exe readtex.* showbuffer.*
 | 
			
		||||
	del *.obj *.exe readtex.* showbuffer.* trackball.*
 | 
			
		||||
 | 
			
		||||
clobber::
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ static PFNGLUNIFORM3FVARBPROC glUniform4fvARB = NULL;
 | 
			
		||||
 | 
			
		||||
static void normalize (GLfloat *dst, const GLfloat *src)
 | 
			
		||||
{
 | 
			
		||||
   GLfloat len = sqrtf (src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
 | 
			
		||||
   GLfloat len = sqrt (src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
 | 
			
		||||
   dst[0] = src[0] / len;
 | 
			
		||||
   dst[1] = src[1] / len;
 | 
			
		||||
   dst[2] = src[2] / len;
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ static GLfloat xRot = 90.0f, yRot = 0.0f;
 | 
			
		||||
static void
 | 
			
		||||
normalize(GLfloat *dst, const GLfloat *src)
 | 
			
		||||
{
 | 
			
		||||
   GLfloat len = sqrtf(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
 | 
			
		||||
   GLfloat len = sqrt(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
 | 
			
		||||
   dst[0] = src[0] / len;
 | 
			
		||||
   dst[1] = src[1] / len;
 | 
			
		||||
   dst[2] = src[2] / len;
 | 
			
		||||
 
 | 
			
		||||
@@ -1053,6 +1053,7 @@ main (int argc, char *argv[])
 | 
			
		||||
    else
 | 
			
		||||
       file = argv[1];
 | 
			
		||||
 | 
			
		||||
    glutInit(&argc, argv); 
 | 
			
		||||
    glutInitWindowPosition (0, 0);
 | 
			
		||||
    glutInitWindowSize(640,480);
 | 
			
		||||
    glutInitDisplayMode (GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
 | 
			
		||||
 
 | 
			
		||||
@@ -569,6 +569,7 @@ main(int ac, char **av)
 | 
			
		||||
   if (ac == 2)
 | 
			
		||||
      frontbuffer = 0;
 | 
			
		||||
 | 
			
		||||
   glutInit(&ac, av);
 | 
			
		||||
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
 | 
			
		||||
   glutInitWindowPosition(0, 0);
 | 
			
		||||
   glutInitWindowSize(640, 480);
 | 
			
		||||
 
 | 
			
		||||
@@ -1042,6 +1042,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
   read_surface( "isosurf.dat" );
 | 
			
		||||
 | 
			
		||||
   glutInit( &argc, argv);
 | 
			
		||||
   glutInitWindowPosition(0, 0);
 | 
			
		||||
   glutInitWindowSize(400, 400);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -826,7 +826,7 @@ static void pinit(void)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void INIT(void)
 | 
			
		||||
int main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
  printf("Morph 3D - Shows morphing platonic polyhedra\n");
 | 
			
		||||
  printf("Author: Marcelo Fernandes Vianna (vianna@cat.cbpf.br)\n\n");
 | 
			
		||||
@@ -841,6 +841,7 @@ static void INIT(void)
 | 
			
		||||
 | 
			
		||||
  object=1;
 | 
			
		||||
 | 
			
		||||
  glutInit(&argc, argv);
 | 
			
		||||
  glutInitWindowPosition(0,0);
 | 
			
		||||
  glutInitWindowSize(640,480);
 | 
			
		||||
 | 
			
		||||
@@ -888,9 +889,3 @@ static void INIT(void)
 | 
			
		||||
  glutMainLoop();
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
  INIT();
 | 
			
		||||
  return(0);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,10 +4,10 @@
 | 
			
		||||
 * Updated for GLU 1.3 tessellation by Gareth Hughes <gareth@valinux.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <GL/glut.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <GL/glut.h>
 | 
			
		||||
 | 
			
		||||
#define MAX_POINTS	256
 | 
			
		||||
#define MAX_CONTOURS	32
 | 
			
		||||
 
 | 
			
		||||
@@ -100,6 +100,7 @@ static void init( void )
 | 
			
		||||
 | 
			
		||||
int main( int argc, char *argv[] )
 | 
			
		||||
{
 | 
			
		||||
   glutInit(&argc, argv);
 | 
			
		||||
   glutInitWindowPosition(0, 0);
 | 
			
		||||
   glutInitWindowSize(500, 500);
 | 
			
		||||
   glutInitDisplayMode( GLUT_RGB );
 | 
			
		||||
 
 | 
			
		||||
@@ -5,17 +5,12 @@ include $(TOP)/configs/current
 | 
			
		||||
 | 
			
		||||
INCDIR = $(TOP)/include
 | 
			
		||||
 | 
			
		||||
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa -lGLU -lGL $(APP_LIB_DEPS)
 | 
			
		||||
 | 
			
		||||
OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
 | 
			
		||||
 | 
			
		||||
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
 | 
			
		||||
 | 
			
		||||
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
 | 
			
		||||
 | 
			
		||||
PROGS = \
 | 
			
		||||
	brick \
 | 
			
		||||
	bump \
 | 
			
		||||
	deriv \
 | 
			
		||||
	mandelbrot \
 | 
			
		||||
	noise \
 | 
			
		||||
	toyball \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										319
									
								
								progs/glsl/deriv.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										319
									
								
								progs/glsl/deriv.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,319 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Test OpenGL 2.0 dx/dy functions for texcoords.
 | 
			
		||||
 * Brian Paul
 | 
			
		||||
 * 2 May 2007
 | 
			
		||||
 *
 | 
			
		||||
 * NOTE: resize the window to observe how the partial derivatives of
 | 
			
		||||
 * the texcoords change.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#include <GL/glut.h>
 | 
			
		||||
#include <GL/glext.h>
 | 
			
		||||
#include "extfuncs.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static char *FragProgFile = NULL;
 | 
			
		||||
static char *VertProgFile = NULL;
 | 
			
		||||
static GLuint fragShader;
 | 
			
		||||
static GLuint vertShader;
 | 
			
		||||
static GLuint program;
 | 
			
		||||
static GLuint SphereList, RectList, CurList;
 | 
			
		||||
static GLint win = 0;
 | 
			
		||||
static GLboolean anim = GL_TRUE;
 | 
			
		||||
static GLfloat xRot = 0.0f, yRot = 0.0f;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
Redisplay(void)
 | 
			
		||||
{
 | 
			
		||||
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 | 
			
		||||
 | 
			
		||||
   glPushMatrix();
 | 
			
		||||
   glRotatef(xRot, 1.0f, 0.0f, 0.0f);
 | 
			
		||||
   glRotatef(yRot, 0.0f, 1.0f, 0.0f);
 | 
			
		||||
   glCallList(CurList);
 | 
			
		||||
   glPopMatrix();
 | 
			
		||||
 | 
			
		||||
   glutSwapBuffers();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
Idle(void)
 | 
			
		||||
{
 | 
			
		||||
   yRot = glutGet(GLUT_ELAPSED_TIME) * 0.1;
 | 
			
		||||
   glutPostRedisplay();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
Reshape(int width, int height)
 | 
			
		||||
{
 | 
			
		||||
   glViewport(0, 0, width, height);
 | 
			
		||||
   glMatrixMode(GL_PROJECTION);
 | 
			
		||||
   glLoadIdentity();
 | 
			
		||||
   glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
 | 
			
		||||
   glMatrixMode(GL_MODELVIEW);
 | 
			
		||||
   glLoadIdentity();
 | 
			
		||||
   glTranslatef(0.0f, 0.0f, -15.0f);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
CleanUp(void)
 | 
			
		||||
{
 | 
			
		||||
   glDeleteShader_func(fragShader);
 | 
			
		||||
   glDeleteShader_func(vertShader);
 | 
			
		||||
   glDeleteProgram_func(program);
 | 
			
		||||
   glutDestroyWindow(win);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
Key(unsigned char key, int x, int y)
 | 
			
		||||
{
 | 
			
		||||
  (void) x;
 | 
			
		||||
  (void) y;
 | 
			
		||||
 | 
			
		||||
   switch(key) {
 | 
			
		||||
   case ' ':
 | 
			
		||||
   case 'a':
 | 
			
		||||
      anim = !anim;
 | 
			
		||||
      if (anim)
 | 
			
		||||
         glutIdleFunc(Idle);
 | 
			
		||||
      else
 | 
			
		||||
         glutIdleFunc(NULL);
 | 
			
		||||
      break;
 | 
			
		||||
   case 'o':
 | 
			
		||||
      if (CurList == SphereList)
 | 
			
		||||
         CurList = RectList;
 | 
			
		||||
      else
 | 
			
		||||
         CurList = SphereList;
 | 
			
		||||
      break;
 | 
			
		||||
   case 27:
 | 
			
		||||
      CleanUp();
 | 
			
		||||
      exit(0);
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
   glutPostRedisplay();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
SpecialKey(int key, int x, int y)
 | 
			
		||||
{
 | 
			
		||||
   const GLfloat step = 3.0f;
 | 
			
		||||
 | 
			
		||||
  (void) x;
 | 
			
		||||
  (void) y;
 | 
			
		||||
 | 
			
		||||
   switch(key) {
 | 
			
		||||
   case GLUT_KEY_UP:
 | 
			
		||||
      xRot -= step;
 | 
			
		||||
      break;
 | 
			
		||||
   case GLUT_KEY_DOWN:
 | 
			
		||||
      xRot += step;
 | 
			
		||||
      break;
 | 
			
		||||
   case GLUT_KEY_LEFT:
 | 
			
		||||
      yRot -= step;
 | 
			
		||||
      break;
 | 
			
		||||
   case GLUT_KEY_RIGHT:
 | 
			
		||||
      yRot += step;
 | 
			
		||||
      break;
 | 
			
		||||
   }
 | 
			
		||||
   glutPostRedisplay();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
MakeSphere(void)
 | 
			
		||||
{
 | 
			
		||||
   GLUquadricObj *obj = gluNewQuadric();
 | 
			
		||||
   SphereList = glGenLists(1);
 | 
			
		||||
   gluQuadricTexture(obj, GL_TRUE);
 | 
			
		||||
   glNewList(SphereList, GL_COMPILE);
 | 
			
		||||
   gluSphere(obj, 2.0f, 30, 15);
 | 
			
		||||
   glEndList();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
MakeRect(void)
 | 
			
		||||
{
 | 
			
		||||
   RectList = glGenLists(1);
 | 
			
		||||
   glNewList(RectList, GL_COMPILE);
 | 
			
		||||
   glBegin(GL_POLYGON);
 | 
			
		||||
   glTexCoord2f(0, 0);   glVertex2f(-2, -2);
 | 
			
		||||
   glTexCoord2f(1, 0);   glVertex2f( 2, -2);
 | 
			
		||||
   glTexCoord2f(1, 1);   glVertex2f( 2,  2);
 | 
			
		||||
   glTexCoord2f(0, 1);   glVertex2f(-2,  2);
 | 
			
		||||
   glEnd();
 | 
			
		||||
   glEndList();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
LoadAndCompileShader(GLuint shader, const char *text)
 | 
			
		||||
{
 | 
			
		||||
   GLint stat;
 | 
			
		||||
 | 
			
		||||
   glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
 | 
			
		||||
 | 
			
		||||
   glCompileShader_func(shader);
 | 
			
		||||
 | 
			
		||||
   glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
 | 
			
		||||
   if (!stat) {
 | 
			
		||||
      GLchar log[1000];
 | 
			
		||||
      GLsizei len;
 | 
			
		||||
      glGetShaderInfoLog_func(shader, 1000, &len, log);
 | 
			
		||||
      fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
 | 
			
		||||
      exit(1);
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Read a shader from a file.
 | 
			
		||||
 */
 | 
			
		||||
static void
 | 
			
		||||
ReadShader(GLuint shader, const char *filename)
 | 
			
		||||
{
 | 
			
		||||
   const int max = 100*1000;
 | 
			
		||||
   int n;
 | 
			
		||||
   char *buffer = (char*) malloc(max);
 | 
			
		||||
   FILE *f = fopen(filename, "r");
 | 
			
		||||
   if (!f) {
 | 
			
		||||
      fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
 | 
			
		||||
      exit(1);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   n = fread(buffer, 1, max, f);
 | 
			
		||||
   printf("fslight: read %d bytes from shader file %s\n", n, filename);
 | 
			
		||||
   if (n > 0) {
 | 
			
		||||
      buffer[n] = 0;
 | 
			
		||||
      LoadAndCompileShader(shader, buffer);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   fclose(f);
 | 
			
		||||
   free(buffer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
CheckLink(GLuint prog)
 | 
			
		||||
{
 | 
			
		||||
   GLint stat;
 | 
			
		||||
   glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
 | 
			
		||||
   if (!stat) {
 | 
			
		||||
      GLchar log[1000];
 | 
			
		||||
      GLsizei len;
 | 
			
		||||
      glGetProgramInfoLog_func(prog, 1000, &len, log);
 | 
			
		||||
      fprintf(stderr, "Linker error:\n%s\n", log);
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
Init(void)
 | 
			
		||||
{
 | 
			
		||||
   static const char *fragShaderText =
 | 
			
		||||
      "void main() {\n"
 | 
			
		||||
      "   gl_FragColor = abs(dFdy(gl_TexCoord[0])) * 50.0;\n"
 | 
			
		||||
      "  // gl_FragColor = gl_TexCoord[0];\n"
 | 
			
		||||
      "}\n";
 | 
			
		||||
   static const char *vertShaderText =
 | 
			
		||||
      "void main() {\n"
 | 
			
		||||
      "   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
 | 
			
		||||
      "   gl_TexCoord[0] = gl_MultiTexCoord0;\n"
 | 
			
		||||
      "}\n";
 | 
			
		||||
   const char *version;
 | 
			
		||||
 | 
			
		||||
   version = (const char *) glGetString(GL_VERSION);
 | 
			
		||||
   if (version[0] != '2' || version[1] != '.') {
 | 
			
		||||
      printf("This program requires OpenGL 2.x, found %s\n", version);
 | 
			
		||||
      exit(1);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   GetExtensionFuncs();
 | 
			
		||||
 | 
			
		||||
   fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
 | 
			
		||||
   if (FragProgFile)
 | 
			
		||||
      ReadShader(fragShader, FragProgFile);
 | 
			
		||||
   else
 | 
			
		||||
      LoadAndCompileShader(fragShader, fragShaderText);
 | 
			
		||||
 | 
			
		||||
   vertShader = glCreateShader_func(GL_VERTEX_SHADER);
 | 
			
		||||
   if (VertProgFile)
 | 
			
		||||
      ReadShader(vertShader, VertProgFile);
 | 
			
		||||
   else
 | 
			
		||||
      LoadAndCompileShader(vertShader, vertShaderText);
 | 
			
		||||
 | 
			
		||||
   program = glCreateProgram_func();
 | 
			
		||||
   glAttachShader_func(program, fragShader);
 | 
			
		||||
   glAttachShader_func(program, vertShader);
 | 
			
		||||
   glLinkProgram_func(program);
 | 
			
		||||
   CheckLink(program);
 | 
			
		||||
   glUseProgram_func(program);
 | 
			
		||||
 | 
			
		||||
   /*assert(glGetError() == 0);*/
 | 
			
		||||
 | 
			
		||||
   glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
 | 
			
		||||
   glEnable(GL_DEPTH_TEST);
 | 
			
		||||
 | 
			
		||||
   MakeSphere();
 | 
			
		||||
   MakeRect();
 | 
			
		||||
 | 
			
		||||
   CurList = SphereList;
 | 
			
		||||
 | 
			
		||||
   printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
 | 
			
		||||
 | 
			
		||||
   assert(glIsProgram_func(program));
 | 
			
		||||
   assert(glIsShader_func(fragShader));
 | 
			
		||||
   assert(glIsShader_func(vertShader));
 | 
			
		||||
 | 
			
		||||
   glColor3f(1, 0, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
ParseOptions(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
   int i;
 | 
			
		||||
   for (i = 1; i < argc; i++) {
 | 
			
		||||
      if (strcmp(argv[i], "-fs") == 0) {
 | 
			
		||||
         FragProgFile = argv[i+1];
 | 
			
		||||
      }
 | 
			
		||||
      else if (strcmp(argv[i], "-vs") == 0) {
 | 
			
		||||
         VertProgFile = argv[i+1];
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
   glutInit(&argc, argv);
 | 
			
		||||
   glutInitWindowPosition( 0, 0);
 | 
			
		||||
   glutInitWindowSize(200, 200);
 | 
			
		||||
   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
 | 
			
		||||
   win = glutCreateWindow(argv[0]);
 | 
			
		||||
   glutReshapeFunc(Reshape);
 | 
			
		||||
   glutKeyboardFunc(Key);
 | 
			
		||||
   glutSpecialFunc(SpecialKey);
 | 
			
		||||
   glutDisplayFunc(Redisplay);
 | 
			
		||||
   if (anim)
 | 
			
		||||
      glutIdleFunc(Idle);
 | 
			
		||||
   ParseOptions(argc, argv);
 | 
			
		||||
   Init();
 | 
			
		||||
   glutMainLoop();
 | 
			
		||||
   return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,3 @@
 | 
			
		||||
/* $Id: miniglxtest.c,v 1.3 2004/03/25 14:58:39 brianp Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Test the mini GLX interface.
 | 
			
		||||
 */
 | 
			
		||||
@@ -7,6 +5,7 @@
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#define USE_MINI_GLX 1
 | 
			
		||||
@@ -16,90 +15,86 @@
 | 
			
		||||
#include <GL/glx.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define FRONTBUFFER 1
 | 
			
		||||
#define NR          6
 | 
			
		||||
#define DO_SLEEPS   1
 | 
			
		||||
#define NR_DISPLAYS 2
 | 
			
		||||
static GLXContext ctx;
 | 
			
		||||
 | 
			
		||||
GLXContext ctx;
 | 
			
		||||
static GLuint NumFrames = 100;
 | 
			
		||||
static GLuint NumDisplays = 1;
 | 
			
		||||
static GLboolean Texture = GL_FALSE;
 | 
			
		||||
static GLboolean SingleBuffer = GL_FALSE;
 | 
			
		||||
static GLboolean Sleeps = GL_TRUE;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
 | 
			
		||||
static void
 | 
			
		||||
rect(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
 | 
			
		||||
{
 | 
			
		||||
   glBegin( GL_QUADS );
 | 
			
		||||
   glVertex2f( x1, y1 );
 | 
			
		||||
   glVertex2f( x2, y1 );
 | 
			
		||||
   glVertex2f( x2, y2 );
 | 
			
		||||
   glVertex2f( x1, y2 );
 | 
			
		||||
   glBegin(GL_QUADS);
 | 
			
		||||
   glTexCoord2f(0, 0);  glColor3f(0, 0, 1);  glVertex2f(x1, y1);
 | 
			
		||||
   glTexCoord2f(1, 0);  glColor3f(1, 0, 0);  glVertex2f(x2, y1);
 | 
			
		||||
   glTexCoord2f(1, 1);  glColor3f(0, 1, 0);  glVertex2f(x2, y2);
 | 
			
		||||
   glTexCoord2f(0, 1);  glColor3f(0, 0, 0);  glVertex2f(x1, y2);
 | 
			
		||||
   glEnd();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void redraw( Display *dpy, Window w, int rot )
 | 
			
		||||
static void
 | 
			
		||||
redraw(Display *dpy, Window w, int rot)
 | 
			
		||||
{
 | 
			
		||||
   printf("Redraw event\n");
 | 
			
		||||
   GLfloat a;
 | 
			
		||||
 | 
			
		||||
#if FRONTBUFFER
 | 
			
		||||
    glDrawBuffer( GL_FRONT ); 
 | 
			
		||||
#else
 | 
			
		||||
/*     glDrawBuffer( GL_BACK );    */
 | 
			
		||||
#endif
 | 
			
		||||
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 | 
			
		||||
 | 
			
		||||
   glClearColor( rand()/(float)RAND_MAX, 
 | 
			
		||||
		 rand()/(float)RAND_MAX, 
 | 
			
		||||
		 rand()/(float)RAND_MAX,
 | 
			
		||||
		 1);
 | 
			
		||||
 | 
			
		||||
   glClear( GL_COLOR_BUFFER_BIT ); 
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
   glColor3f( rand()/(float)RAND_MAX, 
 | 
			
		||||
	      rand()/(float)RAND_MAX, 
 | 
			
		||||
	      rand()/(float)RAND_MAX );
 | 
			
		||||
   glPushMatrix();
 | 
			
		||||
   glRotatef(rot, 0, 0, 1);
 | 
			
		||||
   glScalef(.5, .5, .5);
 | 
			
		||||
   _subset_Rectf( -1, -1, 1, 1 );
 | 
			
		||||
      glRotatef(rot, 0, 0, 1);
 | 
			
		||||
      glScalef(.5, .5, .5);
 | 
			
		||||
      for (a = 0.0; a < 360.0; a += 30.0) {
 | 
			
		||||
         glPushMatrix();
 | 
			
		||||
            glRotatef(a, 0, 0, 1);
 | 
			
		||||
            glRotatef(40, 1, 0, 0);
 | 
			
		||||
            glColor3f(a / 360.0, 1-a/360.0, 0);
 | 
			
		||||
            rect(0.3, -0.25, 1.5, 0.25);
 | 
			
		||||
         glPopMatrix();
 | 
			
		||||
      }
 | 
			
		||||
   glPopMatrix();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if FRONTBUFFER
 | 
			
		||||
   glFlush();
 | 
			
		||||
#else
 | 
			
		||||
   glXSwapBuffers( dpy, w ); 
 | 
			
		||||
#endif
 | 
			
		||||
   glFinish();
 | 
			
		||||
   if (SingleBuffer)
 | 
			
		||||
      glFlush();
 | 
			
		||||
   else 
 | 
			
		||||
      glXSwapBuffers(dpy, w); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static Window make_rgb_db_window( Display *dpy,
 | 
			
		||||
				  unsigned int width, unsigned int height )
 | 
			
		||||
static Window
 | 
			
		||||
make_window(Display *dpy, unsigned int width, unsigned int height)
 | 
			
		||||
{
 | 
			
		||||
   int attrib[] = { GLX_RGBA,
 | 
			
		||||
		    GLX_RED_SIZE, 1,
 | 
			
		||||
		    GLX_GREEN_SIZE, 1,
 | 
			
		||||
		    GLX_BLUE_SIZE, 1,
 | 
			
		||||
#if !FRONTBUFFER
 | 
			
		||||
 		    GLX_DOUBLEBUFFER, 
 | 
			
		||||
#endif
 | 
			
		||||
		    None };
 | 
			
		||||
   int scrnum;
 | 
			
		||||
   int attrib_single[] = { GLX_RGBA,
 | 
			
		||||
                           GLX_RED_SIZE, 1,
 | 
			
		||||
                           GLX_GREEN_SIZE, 1,
 | 
			
		||||
                           GLX_BLUE_SIZE, 1,
 | 
			
		||||
                           GLX_DEPTH_SIZE, 1,
 | 
			
		||||
                           None };
 | 
			
		||||
   int attrib_double[] = { GLX_RGBA,
 | 
			
		||||
                           GLX_RED_SIZE, 1,
 | 
			
		||||
                           GLX_GREEN_SIZE, 1,
 | 
			
		||||
                           GLX_BLUE_SIZE, 1,
 | 
			
		||||
                           GLX_DEPTH_SIZE, 1,
 | 
			
		||||
                           GLX_DOUBLEBUFFER, 
 | 
			
		||||
                           None };
 | 
			
		||||
   int *attrib = SingleBuffer ? attrib_single : attrib_double;
 | 
			
		||||
   int scrnum = 0;
 | 
			
		||||
   XSetWindowAttributes attr;
 | 
			
		||||
   unsigned long mask;
 | 
			
		||||
   Window root;
 | 
			
		||||
   Window win;
 | 
			
		||||
   XVisualInfo *visinfo;
 | 
			
		||||
 | 
			
		||||
   scrnum = 0;
 | 
			
		||||
   root = RootWindow( dpy, scrnum );
 | 
			
		||||
   root = RootWindow(dpy, scrnum);
 | 
			
		||||
 | 
			
		||||
   if (!(visinfo = glXChooseVisual( dpy, scrnum, attrib ))) {
 | 
			
		||||
   if (!(visinfo = glXChooseVisual(dpy, scrnum, attrib))) {
 | 
			
		||||
      printf("Error: couldn't get an RGB, Double-buffered visual\n");
 | 
			
		||||
      exit(1);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if(!(ctx = glXCreateContext( dpy, visinfo, NULL, True ))) {
 | 
			
		||||
   if (!(ctx = glXCreateContext(dpy, visinfo, NULL, True))) {
 | 
			
		||||
      printf("Error: glXCreateContext failed\n");
 | 
			
		||||
      exit(1);
 | 
			
		||||
   }
 | 
			
		||||
@@ -107,19 +102,19 @@ static Window make_rgb_db_window( Display *dpy,
 | 
			
		||||
   /* window attributes */
 | 
			
		||||
   attr.background_pixel = 0;
 | 
			
		||||
   attr.border_pixel = 0;
 | 
			
		||||
   attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
 | 
			
		||||
   attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
 | 
			
		||||
   attr.event_mask = StructureNotifyMask | ExposureMask;
 | 
			
		||||
   mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
 | 
			
		||||
 | 
			
		||||
   win = XCreateWindow( dpy, root, 0, 0, width, height,
 | 
			
		||||
   win = XCreateWindow(dpy, root, 0, 0, width, height,
 | 
			
		||||
		        0, visinfo->depth, InputOutput,
 | 
			
		||||
		        visinfo->visual, mask, &attr );
 | 
			
		||||
		        visinfo->visual, mask, &attr);
 | 
			
		||||
   if (!win) {
 | 
			
		||||
      printf("Error: XCreateWindow failed\n");
 | 
			
		||||
      exit(1);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   glXMakeCurrent( dpy, win, ctx );
 | 
			
		||||
   glXMakeCurrent(dpy, win, ctx);
 | 
			
		||||
 | 
			
		||||
   glViewport(0, 0, width, height);
 | 
			
		||||
 | 
			
		||||
@@ -127,22 +122,24 @@ static Window make_rgb_db_window( Display *dpy,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void event_loop( Display *dpy, Window win )
 | 
			
		||||
static void
 | 
			
		||||
event_loop(Display *dpy, Window win)
 | 
			
		||||
{
 | 
			
		||||
   int i;
 | 
			
		||||
 | 
			
		||||
   printf("Hang on... drawing %d frames\n", NR);
 | 
			
		||||
   for (i = 0; i < NR; i++) {
 | 
			
		||||
      redraw( dpy, win, i*10 );
 | 
			
		||||
      if (DO_SLEEPS) {
 | 
			
		||||
	 printf("sleep(1)\n");   
 | 
			
		||||
	 sleep(1);  
 | 
			
		||||
   printf("Drawing %d frames\n", NumFrames);
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < NumFrames; i++) {
 | 
			
		||||
      redraw(dpy, win, -i*2);
 | 
			
		||||
      if (Sleeps) {
 | 
			
		||||
         usleep(20000);
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int foo( void )
 | 
			
		||||
static int
 | 
			
		||||
runtest(void)
 | 
			
		||||
{
 | 
			
		||||
   Display *dpy;
 | 
			
		||||
   Window win;
 | 
			
		||||
@@ -153,41 +150,121 @@ static int foo( void )
 | 
			
		||||
      return 1;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   win = make_rgb_db_window( dpy, 800, 600);
 | 
			
		||||
   win = make_window(dpy, 800, 600);
 | 
			
		||||
 | 
			
		||||
   srand(getpid());
 | 
			
		||||
 | 
			
		||||
   glShadeModel( GL_FLAT );
 | 
			
		||||
   glClearColor( 0.5, 0.5, 0.5, 1.0 );
 | 
			
		||||
   /* init GL state */
 | 
			
		||||
   glClearColor(0.5, 0.5, 0.5, 1.0);
 | 
			
		||||
   glEnable(GL_DEPTH_TEST);
 | 
			
		||||
   if (Texture) {
 | 
			
		||||
      GLubyte image[16][16][4];
 | 
			
		||||
      GLint i, j;
 | 
			
		||||
      for (i = 0; i < 16; i++) {
 | 
			
		||||
         for (j = 0; j < 16; j++) {
 | 
			
		||||
            if (((i / 2) ^ (j / 2)) & 1) {
 | 
			
		||||
               image[i][j][0] = 255;
 | 
			
		||||
               image[i][j][1] = 255;
 | 
			
		||||
               image[i][j][2] = 255;
 | 
			
		||||
               image[i][j][3] = 255;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
               image[i][j][0] = 128;
 | 
			
		||||
               image[i][j][1] = 128;
 | 
			
		||||
               image[i][j][2] = 128;
 | 
			
		||||
               image[i][j][3] = 128;
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0,
 | 
			
		||||
                   GL_RGBA, GL_UNSIGNED_BYTE, image);
 | 
			
		||||
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 | 
			
		||||
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 | 
			
		||||
      glEnable(GL_TEXTURE_2D);
 | 
			
		||||
   }
 | 
			
		||||
   if (SingleBuffer) {
 | 
			
		||||
      glDrawBuffer(GL_FRONT); 
 | 
			
		||||
      glReadBuffer(GL_FRONT); 
 | 
			
		||||
   }
 | 
			
		||||
   else {
 | 
			
		||||
      glDrawBuffer(GL_BACK);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   XMapWindow( dpy, win );
 | 
			
		||||
   XMapWindow(dpy, win);
 | 
			
		||||
 | 
			
		||||
   /* wait for window to get mapped */
 | 
			
		||||
   {
 | 
			
		||||
      XEvent e;
 | 
			
		||||
      while (1) {
 | 
			
		||||
	 XNextEvent( dpy, &e );
 | 
			
		||||
	 XNextEvent(dpy, &e);
 | 
			
		||||
	 if (e.type == MapNotify && e.xmap.window == win) {
 | 
			
		||||
	    break;
 | 
			
		||||
	 }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   event_loop( dpy, win );
 | 
			
		||||
   event_loop(dpy, win);
 | 
			
		||||
 | 
			
		||||
   glXDestroyContext( dpy, ctx );
 | 
			
		||||
   XDestroyWindow( dpy, win );
 | 
			
		||||
   glXDestroyContext(dpy, ctx);
 | 
			
		||||
   XDestroyWindow(dpy, win);
 | 
			
		||||
 | 
			
		||||
   XCloseDisplay( dpy );
 | 
			
		||||
   XCloseDisplay(dpy);
 | 
			
		||||
 | 
			
		||||
   return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
static void
 | 
			
		||||
usage(void)
 | 
			
		||||
{
 | 
			
		||||
   printf("Usage:\n");
 | 
			
		||||
   printf("  -f N   render N frames (default %d)\n", NumFrames);
 | 
			
		||||
   printf("  -d N   do N display cycles\n");
 | 
			
		||||
   printf("  -t     texturing\n");
 | 
			
		||||
   printf("  -s     single buffering\n");
 | 
			
		||||
   printf("  -n     no usleep() delay\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
parse_args(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
   int i;
 | 
			
		||||
   for (i = 0 ; i < NR_DISPLAYS ; i++) {
 | 
			
		||||
      if (foo() != 0)
 | 
			
		||||
   for (i = 1; i < argc; i++) {
 | 
			
		||||
      if (strcmp(argv[i], "-f") == 0) {
 | 
			
		||||
         NumFrames = atoi(argv[i + 1]);
 | 
			
		||||
         i++;
 | 
			
		||||
      }
 | 
			
		||||
      else if (strcmp(argv[i], "-d") == 0) {
 | 
			
		||||
         NumDisplays = atoi(argv[i + 1]);
 | 
			
		||||
         i++;
 | 
			
		||||
      }
 | 
			
		||||
      else if (strcmp(argv[i], "-n") == 0) {
 | 
			
		||||
         Sleeps = GL_FALSE;
 | 
			
		||||
      }
 | 
			
		||||
      else if (strcmp(argv[i], "-s") == 0) {
 | 
			
		||||
         SingleBuffer = GL_TRUE;
 | 
			
		||||
      }
 | 
			
		||||
      else if (strcmp(argv[i], "-t") == 0) {
 | 
			
		||||
         Texture = GL_TRUE;
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
         usage();
 | 
			
		||||
         exit(1);
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
   int i;
 | 
			
		||||
 | 
			
		||||
   parse_args(argc, argv);
 | 
			
		||||
 | 
			
		||||
   for (i = 0; i < NumDisplays; i++) {
 | 
			
		||||
      if (runtest() != 0)
 | 
			
		||||
	 break;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,15 @@
 | 
			
		||||
#  Email : dborca@users.sourceforge.net
 | 
			
		||||
#  Web   : http://www.geocities.com/dborca
 | 
			
		||||
 | 
			
		||||
# MinGW samples makefile updated for Mesa 7.0
 | 
			
		||||
#
 | 
			
		||||
#  Updated : by Heromyth, on 2007-7-21
 | 
			
		||||
#  Email   : zxpmyth@yahoo.com.cn
 | 
			
		||||
#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
 | 
			
		||||
#            The others havn't been tested yet.
 | 
			
		||||
#            2) The generated DLLs are *not* compatible with the ones built
 | 
			
		||||
#            with the other compilers like VC8, especially for GLUT. 
 | 
			
		||||
#            3) Although more tests are needed, it can be used individually!
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
#  Available options:
 | 
			
		||||
@@ -44,15 +53,31 @@
 | 
			
		||||
 | 
			
		||||
TOP = ../..
 | 
			
		||||
 | 
			
		||||
include $(TOP)/configs/config.mgw
 | 
			
		||||
ALL_USING_STDCALL ?= 1
 | 
			
		||||
GL_USING_STDCALL ?= 1
 | 
			
		||||
GLUT_USING_STDCALL ?= 1
 | 
			
		||||
 | 
			
		||||
CC = mingw32-gcc
 | 
			
		||||
CFLAGS = -Wall -W -pedantic
 | 
			
		||||
CFLAGS = -Wall -pedantic
 | 
			
		||||
CFLAGS += -O2 -ffast-math
 | 
			
		||||
CFLAGS += -I$(TOP)/include -I../util
 | 
			
		||||
ifeq ($(FX),1)
 | 
			
		||||
CFLAGS += -DFX
 | 
			
		||||
  CFLAGS += -DFX
 | 
			
		||||
endif
 | 
			
		||||
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK -D_STDCALL_SUPPORTED
 | 
			
		||||
CFLAGS += -D_WINDEF_ -D_WINGDI_
 | 
			
		||||
 | 
			
		||||
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
 | 
			
		||||
 | 
			
		||||
ifeq ($(GL_USING_STDCALL),0)
 | 
			
		||||
  CFLAGS += -DGL_NO_STDCALL
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(GLUT_USING_STDCALL),1)
 | 
			
		||||
  CFLAGS += -D_STDCALL_SUPPORTED
 | 
			
		||||
else
 | 
			
		||||
  CFLAGS += -DGLUT_NO_STDCALL
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LD = mingw32-g++
 | 
			
		||||
LDFLAGS = -s -L$(TOP)/lib
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ static PFNGLCREATEPROGRAMPROC glCreateProgram_func = NULL;
 | 
			
		||||
static PFNGLCREATESHADERPROC glCreateShader_func = NULL;
 | 
			
		||||
static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL;
 | 
			
		||||
static PFNGLDELETESHADERPROC glDeleteShader_func = NULL;
 | 
			
		||||
static PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib_func = NULL;
 | 
			
		||||
static PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders_func = NULL;
 | 
			
		||||
static PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation_func = NULL;
 | 
			
		||||
static PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog_func = NULL;
 | 
			
		||||
@@ -78,6 +79,7 @@ GetExtensionFuncs(void)
 | 
			
		||||
   glCreateShader_func = (PFNGLCREATESHADERPROC) glutGetProcAddress("glCreateShader");
 | 
			
		||||
   glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram");
 | 
			
		||||
   glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader");
 | 
			
		||||
   glGetActiveAttrib_func = (PFNGLGETACTIVEATTRIBPROC) glutGetProcAddress("glGetActiveAttrib");
 | 
			
		||||
   glGetAttachedShaders_func = (PFNGLGETATTACHEDSHADERSPROC) glutGetProcAddress("glGetAttachedShaders");
 | 
			
		||||
   glGetAttribLocation_func = (PFNGLGETATTRIBLOCATIONPROC) glutGetProcAddress("glGetAttribLocation");
 | 
			
		||||
   glGetProgramInfoLog_func = (PFNGLGETPROGRAMINFOLOGPROC) glutGetProcAddress("glGetProgramInfoLog");
 | 
			
		||||
 
 | 
			
		||||
@@ -17,14 +17,14 @@ message:
 | 
			
		||||
subdirs:
 | 
			
		||||
	@for dir in $(SUBDIRS) ; do \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir ; $(MAKE)) || exit 1 ; \
 | 
			
		||||
			(cd $$dir && $(MAKE)) || exit 1; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	@for dir in $(SUBDIRS) ; do \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir ; $(MAKE) install) || exit 1 ; \
 | 
			
		||||
			(cd $$dir && $(MAKE) install) || exit 1 ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
@@ -35,6 +35,6 @@ $(TOP)/$(LIB_DIR):
 | 
			
		||||
clean:
 | 
			
		||||
	@for dir in $(SUBDIRS) ; do \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir ; $(MAKE) clean) ; \
 | 
			
		||||
			(cd $$dir && $(MAKE) clean) ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										229
									
								
								src/glu/sgi/Makefile.mgw
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										229
									
								
								src/glu/sgi/Makefile.mgw
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,229 @@
 | 
			
		||||
# 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.
 | 
			
		||||
 | 
			
		||||
# MinGW core makefile v1.4 for Mesa
 | 
			
		||||
#
 | 
			
		||||
#  Copyright (C) 2002 - Daniel Borca
 | 
			
		||||
#  Email : dborca@users.sourceforge.net
 | 
			
		||||
#  Web   : http://www.geocities.com/dborca
 | 
			
		||||
 | 
			
		||||
# MinGW core-glu makefile updated for Mesa 7.0
 | 
			
		||||
#
 | 
			
		||||
#  Updated : by Heromyth, on 2007-7-21
 | 
			
		||||
#  Email   : zxpmyth@yahoo.com.cn
 | 
			
		||||
#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
 | 
			
		||||
#            The others havn't been tested yet.
 | 
			
		||||
#            2) The generated DLLs are *not* compatible with the ones built
 | 
			
		||||
#            with the other compilers like VC8, especially for GLUT. 
 | 
			
		||||
#            3) Although more tests are needed, it can be used individually!
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
#  Available options:
 | 
			
		||||
#
 | 
			
		||||
#    Environment variables:
 | 
			
		||||
#	CFLAGS
 | 
			
		||||
#
 | 
			
		||||
#	GLIDE		path to Glide3 SDK; used with FX.
 | 
			
		||||
#			default = $(TOP)/glide3
 | 
			
		||||
#	FX=1		build for 3dfx Glide3. Note that this disables
 | 
			
		||||
#			compilation of most WMesa code and requires fxMesa.
 | 
			
		||||
#			As a consequence, you'll need the Win32 Glide3
 | 
			
		||||
#			library to build any application.
 | 
			
		||||
#			default = no
 | 
			
		||||
#	ICD=1		build the installable client driver interface
 | 
			
		||||
#			(windows opengl driver interface)
 | 
			
		||||
#			default = no
 | 
			
		||||
#	X86=1		optimize for x86 (if possible, use MMX, SSE, 3DNow).
 | 
			
		||||
#			default = no
 | 
			
		||||
#
 | 
			
		||||
#    Targets:
 | 
			
		||||
#	all:		build GL
 | 
			
		||||
#	clean:		remove object files
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.PHONY: all clean
 | 
			
		||||
.INTERMEDIATE: x86/gen_matypes.exe
 | 
			
		||||
.SUFFIXES: .rc .res
 | 
			
		||||
 | 
			
		||||
# Set this to the prefix of your build tools, i.e. mingw32-
 | 
			
		||||
TOOLS_PREFIX = mingw32-
 | 
			
		||||
 | 
			
		||||
TOP = ../../..
 | 
			
		||||
 | 
			
		||||
LIBDIR = $(TOP)/lib
 | 
			
		||||
 | 
			
		||||
GLU_DLL = glu32.dll
 | 
			
		||||
GLU_IMP = libglu32.a
 | 
			
		||||
GLU_DEF = glu.def
 | 
			
		||||
 | 
			
		||||
include $(TOP)/configs/config.mgw
 | 
			
		||||
GL_USING_STDCALL ?= 1
 | 
			
		||||
 | 
			
		||||
LDLIBS = -L$(LIBDIR) -lopengl32
 | 
			
		||||
LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLU_IMP) -Wl,--output-def=$(LIBDIR)/$(GLU_DEF)
 | 
			
		||||
 | 
			
		||||
CFLAGS += -DBUILD_GLU32 -D_DLL
 | 
			
		||||
 | 
			
		||||
ifeq ($(GL_USING_STDCALL),1)
 | 
			
		||||
  LDFLAGS += -Wl,--add-stdcall-alias
 | 
			
		||||
else
 | 
			
		||||
  CFLAGS += -DGL_NO_STDCALL
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
CC = gcc
 | 
			
		||||
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude
 | 
			
		||||
CXX = g++
 | 
			
		||||
CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
 | 
			
		||||
 | 
			
		||||
AR = ar
 | 
			
		||||
ARFLAGS = crus
 | 
			
		||||
 | 
			
		||||
UNLINK = del $(subst /,\,$(1))
 | 
			
		||||
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
 | 
			
		||||
UNLINK = $(RM) $(1)
 | 
			
		||||
endif
 | 
			
		||||
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
 | 
			
		||||
UNLINK = $(RM) $(1)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
C_SOURCES = \
 | 
			
		||||
	libutil/error.c \
 | 
			
		||||
	libutil/glue.c \
 | 
			
		||||
	libutil/mipmap.c \
 | 
			
		||||
	libutil/project.c \
 | 
			
		||||
	libutil/quad.c \
 | 
			
		||||
	libutil/registry.c \
 | 
			
		||||
	libtess/dict.c \
 | 
			
		||||
	libtess/geom.c \
 | 
			
		||||
	libtess/memalloc.c \
 | 
			
		||||
	libtess/mesh.c \
 | 
			
		||||
	libtess/normal.c \
 | 
			
		||||
	libtess/priorityq.c \
 | 
			
		||||
	libtess/render.c \
 | 
			
		||||
	libtess/sweep.c \
 | 
			
		||||
	libtess/tess.c \
 | 
			
		||||
	libtess/tessmono.c
 | 
			
		||||
 | 
			
		||||
CC_SOURCES = \
 | 
			
		||||
	libnurbs/interface/bezierEval.cc \
 | 
			
		||||
	libnurbs/interface/bezierPatch.cc \
 | 
			
		||||
	libnurbs/interface/bezierPatchMesh.cc \
 | 
			
		||||
	libnurbs/interface/glcurveval.cc \
 | 
			
		||||
	libnurbs/interface/glinterface.cc \
 | 
			
		||||
	libnurbs/interface/glrenderer.cc \
 | 
			
		||||
	libnurbs/interface/glsurfeval.cc \
 | 
			
		||||
	libnurbs/interface/incurveeval.cc \
 | 
			
		||||
	libnurbs/interface/insurfeval.cc \
 | 
			
		||||
	libnurbs/internals/arc.cc \
 | 
			
		||||
	libnurbs/internals/arcsorter.cc \
 | 
			
		||||
	libnurbs/internals/arctess.cc \
 | 
			
		||||
	libnurbs/internals/backend.cc \
 | 
			
		||||
	libnurbs/internals/basiccrveval.cc \
 | 
			
		||||
	libnurbs/internals/basicsurfeval.cc \
 | 
			
		||||
	libnurbs/internals/bin.cc \
 | 
			
		||||
	libnurbs/internals/bufpool.cc \
 | 
			
		||||
	libnurbs/internals/cachingeval.cc \
 | 
			
		||||
	libnurbs/internals/ccw.cc \
 | 
			
		||||
	libnurbs/internals/coveandtiler.cc \
 | 
			
		||||
	libnurbs/internals/curve.cc \
 | 
			
		||||
	libnurbs/internals/curvelist.cc \
 | 
			
		||||
	libnurbs/internals/curvesub.cc \
 | 
			
		||||
	libnurbs/internals/dataTransform.cc \
 | 
			
		||||
	libnurbs/internals/displaylist.cc \
 | 
			
		||||
	libnurbs/internals/flist.cc \
 | 
			
		||||
	libnurbs/internals/flistsorter.cc \
 | 
			
		||||
	libnurbs/internals/hull.cc \
 | 
			
		||||
	libnurbs/internals/intersect.cc \
 | 
			
		||||
	libnurbs/internals/knotvector.cc \
 | 
			
		||||
	libnurbs/internals/mapdesc.cc \
 | 
			
		||||
	libnurbs/internals/mapdescv.cc \
 | 
			
		||||
	libnurbs/internals/maplist.cc \
 | 
			
		||||
	libnurbs/internals/mesher.cc \
 | 
			
		||||
	libnurbs/internals/monoTriangulationBackend.cc \
 | 
			
		||||
	libnurbs/internals/monotonizer.cc \
 | 
			
		||||
	libnurbs/internals/mycode.cc \
 | 
			
		||||
	libnurbs/internals/nurbsinterfac.cc \
 | 
			
		||||
	libnurbs/internals/nurbstess.cc \
 | 
			
		||||
	libnurbs/internals/patch.cc \
 | 
			
		||||
	libnurbs/internals/patchlist.cc \
 | 
			
		||||
	libnurbs/internals/quilt.cc \
 | 
			
		||||
	libnurbs/internals/reader.cc \
 | 
			
		||||
	libnurbs/internals/renderhints.cc \
 | 
			
		||||
	libnurbs/internals/slicer.cc \
 | 
			
		||||
	libnurbs/internals/sorter.cc \
 | 
			
		||||
	libnurbs/internals/splitarcs.cc \
 | 
			
		||||
	libnurbs/internals/subdivider.cc \
 | 
			
		||||
	libnurbs/internals/tobezier.cc \
 | 
			
		||||
	libnurbs/internals/trimline.cc \
 | 
			
		||||
	libnurbs/internals/trimregion.cc \
 | 
			
		||||
	libnurbs/internals/trimvertpool.cc \
 | 
			
		||||
	libnurbs/internals/uarray.cc \
 | 
			
		||||
	libnurbs/internals/varray.cc \
 | 
			
		||||
	libnurbs/nurbtess/directedLine.cc \
 | 
			
		||||
	libnurbs/nurbtess/gridWrap.cc \
 | 
			
		||||
	libnurbs/nurbtess/monoChain.cc \
 | 
			
		||||
	libnurbs/nurbtess/monoPolyPart.cc \
 | 
			
		||||
	libnurbs/nurbtess/monoTriangulation.cc \
 | 
			
		||||
	libnurbs/nurbtess/partitionX.cc \
 | 
			
		||||
	libnurbs/nurbtess/partitionY.cc \
 | 
			
		||||
	libnurbs/nurbtess/polyDBG.cc \
 | 
			
		||||
	libnurbs/nurbtess/polyUtil.cc \
 | 
			
		||||
	libnurbs/nurbtess/primitiveStream.cc \
 | 
			
		||||
	libnurbs/nurbtess/quicksort.cc \
 | 
			
		||||
	libnurbs/nurbtess/rectBlock.cc \
 | 
			
		||||
	libnurbs/nurbtess/sampleComp.cc \
 | 
			
		||||
	libnurbs/nurbtess/sampleCompBot.cc \
 | 
			
		||||
	libnurbs/nurbtess/sampleCompRight.cc \
 | 
			
		||||
	libnurbs/nurbtess/sampleCompTop.cc \
 | 
			
		||||
	libnurbs/nurbtess/sampleMonoPoly.cc \
 | 
			
		||||
	libnurbs/nurbtess/sampledLine.cc \
 | 
			
		||||
	libnurbs/nurbtess/searchTree.cc
 | 
			
		||||
 | 
			
		||||
SOURCES = $(C_SOURCES) $(CC_SOURCES)
 | 
			
		||||
 | 
			
		||||
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -c $<
 | 
			
		||||
.cc.o:
 | 
			
		||||
	$(CXX) -o $@ $(CXXFLAGS) -c $<
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR):
 | 
			
		||||
	mkdir -p $(LIBDIR)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
 | 
			
		||||
	g++ -shared -fPIC -o $(LIBDIR)/$(GLU_DLL) $(LDFLAGS) \
 | 
			
		||||
    $^ $(LDLIBS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	-$(call UNLINK,libutil/*.o)
 | 
			
		||||
	-$(call UNLINK,libtess/*.o)
 | 
			
		||||
	-$(call UNLINK,libnurbs/interface/*.o)
 | 
			
		||||
	-$(call UNLINK,libnurbs/internals/*.o)
 | 
			
		||||
	-$(call UNLINK,libnurbs/nurbtess/*.o)
 | 
			
		||||
@@ -93,7 +93,7 @@ public:
 | 
			
		||||
	output_triangles = flag;
 | 
			
		||||
      }
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
    void               putCallBack(GLenum which, void (APIENTRY *fn)() );
 | 
			
		||||
    void               putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
 | 
			
		||||
#else
 | 
			
		||||
    void               putCallBack(GLenum which, _GLUfuncptr fn );
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -1184,8 +1184,11 @@ return;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() )
 | 
			
		||||
#else
 | 
			
		||||
void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
 | 
			
		||||
#endif
 | 
			
		||||
{
 | 
			
		||||
  switch(which)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -145,7 +145,7 @@ public:
 | 
			
		||||
    void		newtmeshvert( long, long );
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
    void 	        putCallBack(GLenum which, void (APIENTRY *fn)() );
 | 
			
		||||
    void 	        putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
 | 
			
		||||
#else
 | 
			
		||||
    void 	        putCallBack(GLenum which, _GLUfuncptr fn );
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -43,10 +43,9 @@
 | 
			
		||||
#include "definitions.h"
 | 
			
		||||
#include "primitiveStream.h"
 | 
			
		||||
#include "directedLine.h"
 | 
			
		||||
#include "arc.h"
 | 
			
		||||
 | 
			
		||||
class Backend;
 | 
			
		||||
class Arc;
 | 
			
		||||
typedef Arc *Arc_ptr;
 | 
			
		||||
 | 
			
		||||
class reflexChain{
 | 
			
		||||
  Real2 *queue; 
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										198
									
								
								src/glut/glx/Makefile.mgw
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										198
									
								
								src/glut/glx/Makefile.mgw
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,198 @@
 | 
			
		||||
# 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.
 | 
			
		||||
 | 
			
		||||
# MinGW core makefile v1.4 for Mesa
 | 
			
		||||
#
 | 
			
		||||
#  Copyright (C) 2002 - Daniel Borca
 | 
			
		||||
#  Email : dborca@users.sourceforge.net
 | 
			
		||||
#  Web   : http://www.geocities.com/dborca
 | 
			
		||||
 | 
			
		||||
# MinGW core-glut makefile updated for Mesa 7.0
 | 
			
		||||
#
 | 
			
		||||
#  Updated : by Heromyth, on 2007-7-21
 | 
			
		||||
#  Email   : zxpmyth@yahoo.com.cn
 | 
			
		||||
#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
 | 
			
		||||
#            The others havn't been tested yet.
 | 
			
		||||
#            2) The generated DLLs are *not* compatible with the ones built
 | 
			
		||||
#            with the other compilers like VC8, especially for GLUT. 
 | 
			
		||||
#            3) Although more tests are needed, it can be used individually!
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
#  Available options:
 | 
			
		||||
#
 | 
			
		||||
#    Environment variables:
 | 
			
		||||
#	CFLAGS
 | 
			
		||||
#
 | 
			
		||||
#	GLIDE		path to Glide3 SDK; used with FX.
 | 
			
		||||
#			default = $(TOP)/glide3
 | 
			
		||||
#	FX=1		build for 3dfx Glide3. Note that this disables
 | 
			
		||||
#			compilation of most WMesa code and requires fxMesa.
 | 
			
		||||
#			As a consequence, you'll need the Win32 Glide3
 | 
			
		||||
#			library to build any application.
 | 
			
		||||
#			default = no
 | 
			
		||||
#	ICD=1		build the installable client driver interface
 | 
			
		||||
#			(windows opengl driver interface)
 | 
			
		||||
#			default = no
 | 
			
		||||
#	X86=1		optimize for x86 (if possible, use MMX, SSE, 3DNow).
 | 
			
		||||
#			default = no
 | 
			
		||||
#
 | 
			
		||||
#    Targets:
 | 
			
		||||
#	all:		build GL
 | 
			
		||||
#	clean:		remove object files
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.PHONY: all clean
 | 
			
		||||
.INTERMEDIATE: x86/gen_matypes.exe
 | 
			
		||||
.SUFFIXES: .rc .res
 | 
			
		||||
 | 
			
		||||
# Set this to the prefix of your build tools, i.e. mingw32-
 | 
			
		||||
TOOLS_PREFIX = mingw32-
 | 
			
		||||
 | 
			
		||||
TOP = ../../..
 | 
			
		||||
 | 
			
		||||
LIBDIR = $(TOP)/lib
 | 
			
		||||
 | 
			
		||||
GLUT_DLL = glut32.dll
 | 
			
		||||
GLUT_IMP = libglut32.a
 | 
			
		||||
GLUT_DEF = glut.def
 | 
			
		||||
 | 
			
		||||
include $(TOP)/configs/config.mgw
 | 
			
		||||
GLUT_USING_STDCALL ?= 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32 
 | 
			
		||||
LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLUT_IMP) -Wl,--output-def=$(LIBDIR)/$(GLUT_DEF) 
 | 
			
		||||
 | 
			
		||||
CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
 | 
			
		||||
 | 
			
		||||
ifeq ($(GL_USING_STDCALL),0)
 | 
			
		||||
  CFLAGS += -DGL_NO_STDCALL
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(GLUT_USING_STDCALL),1)
 | 
			
		||||
  CFLAGS += -D_STDCALL_SUPPORTED
 | 
			
		||||
  LDFLAGS += -Wl,--add-stdcall-alias
 | 
			
		||||
else
 | 
			
		||||
  CFLAGS += -DGLUT_NO_STDCALL
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include 
 | 
			
		||||
 | 
			
		||||
CC = gcc
 | 
			
		||||
CXX = g++
 | 
			
		||||
CXXFLAGS = $(CFLAGS)
 | 
			
		||||
 | 
			
		||||
AR = ar
 | 
			
		||||
ARFLAGS = crus
 | 
			
		||||
 | 
			
		||||
UNLINK = del $(subst /,\,$(1))
 | 
			
		||||
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
 | 
			
		||||
UNLINK = $(RM) $(1)
 | 
			
		||||
endif
 | 
			
		||||
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
 | 
			
		||||
UNLINK = $(RM) $(1)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h
 | 
			
		||||
 | 
			
		||||
SRCS = \
 | 
			
		||||
	glut_bitmap.c \
 | 
			
		||||
	glut_bwidth.c \
 | 
			
		||||
	glut_cindex.c \
 | 
			
		||||
	glut_cmap.c \
 | 
			
		||||
	glut_cursor.c \
 | 
			
		||||
	glut_dials.c \
 | 
			
		||||
	glut_dstr.c \
 | 
			
		||||
	glut_event.c \
 | 
			
		||||
	glut_ext.c \
 | 
			
		||||
	glut_fbc.c \
 | 
			
		||||
	glut_fullscrn.c \
 | 
			
		||||
	glut_gamemode.c \
 | 
			
		||||
	glut_get.c \
 | 
			
		||||
	glut_init.c \
 | 
			
		||||
	glut_input.c \
 | 
			
		||||
	glut_joy.c \
 | 
			
		||||
	glut_key.c \
 | 
			
		||||
	glut_keyctrl.c \
 | 
			
		||||
	glut_keyup.c \
 | 
			
		||||
	glut_mesa.c \
 | 
			
		||||
	glut_modifier.c \
 | 
			
		||||
	glut_overlay.c \
 | 
			
		||||
	glut_shapes.c \
 | 
			
		||||
	glut_space.c \
 | 
			
		||||
	glut_stroke.c \
 | 
			
		||||
	glut_swap.c \
 | 
			
		||||
	glut_swidth.c \
 | 
			
		||||
	glut_tablet.c \
 | 
			
		||||
	glut_teapot.c \
 | 
			
		||||
	glut_util.c \
 | 
			
		||||
	glut_vidresize.c \
 | 
			
		||||
	glut_warp.c \
 | 
			
		||||
	glut_win.c \
 | 
			
		||||
	glut_winmisc.c \
 | 
			
		||||
	win32_glx.c \
 | 
			
		||||
	win32_menu.c \
 | 
			
		||||
	win32_util.c \
 | 
			
		||||
	win32_winproc.c \
 | 
			
		||||
	win32_x11.c
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
SRCSSEMIGENS = \
 | 
			
		||||
	glut_8x13.c \
 | 
			
		||||
	glut_9x15.c \
 | 
			
		||||
	glut_hel10.c \
 | 
			
		||||
	glut_hel12.c \
 | 
			
		||||
	glut_hel18.c \
 | 
			
		||||
	glut_mroman.c \
 | 
			
		||||
	glut_roman.c \
 | 
			
		||||
	glut_tr10.c \
 | 
			
		||||
	glut_tr24.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SOURCES = $(SRCS) $(SRCSSEMIGENS)
 | 
			
		||||
 | 
			
		||||
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -c $<
 | 
			
		||||
.cc.o:
 | 
			
		||||
	$(CXX) -o $@ $(CXXFLAGS) -c $<
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR):
 | 
			
		||||
	mkdir -p $(LIBDIR)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
 | 
			
		||||
	$(CXX) -shared -fPIC -o $(LIBDIR)/$(GLUT_DLL) $(LDFLAGS) \
 | 
			
		||||
	$^ $(LDLIBS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	-$(call UNLINK,*.o)
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
 | 
			
		||||
/* Set a Fortran callback function. */
 | 
			
		||||
 | 
			
		||||
void GLUTAPIENTRY
 | 
			
		||||
void APIENTRY
 | 
			
		||||
__glutSetFCB(int which, void *func)
 | 
			
		||||
{
 | 
			
		||||
#ifdef SUPPORT_FORTRAN
 | 
			
		||||
@@ -100,7 +100,7 @@ __glutSetFCB(int which, void *func)
 | 
			
		||||
 | 
			
		||||
/* Get a Fortran callback function. */
 | 
			
		||||
 | 
			
		||||
void* GLUTAPIENTRY
 | 
			
		||||
void* APIENTRY
 | 
			
		||||
__glutGetFCB(int which)
 | 
			
		||||
{
 | 
			
		||||
#ifdef SUPPORT_FORTRAN
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,9 @@
 | 
			
		||||
#endif
 | 
			
		||||
#include <X11/Xutil.h>
 | 
			
		||||
#else
 | 
			
		||||
#ifdef __MINGW32__
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#ifndef __CYGWIN32__
 | 
			
		||||
#include <mmsystem.h>  /* Win32 Multimedia API header. */
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,9 @@
 | 
			
		||||
   implied. This program is -not- in the public domain. */
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#ifdef __MINGW32__
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#ifndef __CYGWIN32__
 | 
			
		||||
#include <mmsystem.h>  /* Win32 Multimedia API header. */
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,10 @@
 | 
			
		||||
#include <GL/glx.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef GLUT_BUILDING_LIB
 | 
			
		||||
#define GLUT_BUILDING_LIB  /* Building the GLUT library itself. */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <GL/glut.h>
 | 
			
		||||
 | 
			
		||||
#if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__)
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@
 | 
			
		||||
 | 
			
		||||
/* The following added by Paul Garceau <pgarceau@teleport.com> */
 | 
			
		||||
#if defined(__MINGW32__)
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
struct timeval;
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,9 @@
 | 
			
		||||
 | 
			
		||||
#include "glutint.h"
 | 
			
		||||
#include <sys/timeb.h>
 | 
			
		||||
#ifdef __MINGW32__
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) && !defined(__CYGWIN32__)
 | 
			
		||||
#include <mmsystem.h>  /* Win32 Multimedia API header. */
 | 
			
		||||
 
 | 
			
		||||
@@ -6,16 +6,14 @@
 | 
			
		||||
/* This program is freely distributable without licensing fees 
 | 
			
		||||
   and is provided without guarantee or warrantee expressed or 
 | 
			
		||||
   implied. This program is -not- in the public domain. */
 | 
			
		||||
 | 
			
		||||
#ifdef __MINGW32__
 | 
			
		||||
#include <GL/gl.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
 | 
			
		||||
/* These definitions are missing from windows.h */
 | 
			
		||||
WINGDIAPI int WINAPI wglChoosePixelFormat(HDC, PIXELFORMATDESCRIPTOR *);
 | 
			
		||||
WINGDIAPI int WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
 | 
			
		||||
WINGDIAPI int WINAPI wglGetPixelFormat(HDC);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglSetPixelFormat(HDC, int, PIXELFORMATDESCRIPTOR *);
 | 
			
		||||
WINGDIAPI BOOL WINAPI wglSwapBuffers(HDC);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Type definitions (conversions) */
 | 
			
		||||
typedef int Visual;			/* Win32 equivalent of X11 type */
 | 
			
		||||
 
 | 
			
		||||
@@ -90,7 +90,7 @@ int APIENTRY glutCreateWindow (const char *title)
 | 
			
		||||
   attr.event_mask = StructureNotifyMask | ExposureMask;
 | 
			
		||||
   mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
 | 
			
		||||
 | 
			
		||||
   win = XCreateWindow( dpy, root, 0, 0, g_width, g_height,
 | 
			
		||||
   win = XCreateWindow( dpy, root, g_xpos, g_ypos, g_width, g_height,
 | 
			
		||||
		        0, visinfo->depth, InputOutput,
 | 
			
		||||
		        visinfo->visual, mask, &attr );
 | 
			
		||||
   if (!win) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
# Build a subset DRI-based libGL.so library.
 | 
			
		||||
# Indirect rendering not supported, etc.
 | 
			
		||||
# Build the MiniGLX libGL.so library.
 | 
			
		||||
 | 
			
		||||
TOP = ../../..
 | 
			
		||||
include $(TOP)/configs/current
 | 
			
		||||
@@ -29,7 +28,9 @@ INCLUDE_DIRS = \
 | 
			
		||||
	-I$(TOP)/src/mesa/glapi \
 | 
			
		||||
	-I$(TOP)/src/glx/x11 \
 | 
			
		||||
	-I$(TOP)/src/mesa/drivers/dri/common \
 | 
			
		||||
	`pkg-config --cflags libdrm`
 | 
			
		||||
	$(LIBDRM_CFLAGS) \
 | 
			
		||||
	$(PCIACCESS_CFLAGS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##### RULES #####
 | 
			
		||||
@@ -43,16 +44,20 @@ INCLUDE_DIRS = \
 | 
			
		||||
 | 
			
		||||
##### TARGETS #####
 | 
			
		||||
 | 
			
		||||
default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
 | 
			
		||||
default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/miniglx.conf
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Make libGL
 | 
			
		||||
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME):  $(OBJECTS) Makefile
 | 
			
		||||
	$(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
 | 
			
		||||
	@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
 | 
			
		||||
		-major 1 -minor 2 $(MKLIB_OPTIONS) \
 | 
			
		||||
		-install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) `/usr/bin/pkg-config --libs libdrm` `/usr/bin/pkg-config --libs pciaccess`
 | 
			
		||||
	rm -f $(TOP)/$(LIB_DIR)/miniglx.conf
 | 
			
		||||
	install example.miniglx.conf $(TOP)/$(LIB_DIR)/miniglx.conf
 | 
			
		||||
		-install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) \
 | 
			
		||||
		$(LIBDRM_LIB) $(PCIACCESS_LIB)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# install sample miniglx.conf
 | 
			
		||||
$(TOP)/$(LIB_DIR)/miniglx.conf:
 | 
			
		||||
	$(INSTALL) example.miniglx.conf $(TOP)/$(LIB_DIR)/miniglx.conf
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
drmtest: xf86drm.o drmtest.o
 | 
			
		||||
 
 | 
			
		||||
@@ -1528,8 +1528,8 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   /* init other per-window fields */
 | 
			
		||||
   win->x = 0;
 | 
			
		||||
   win->y = 0;
 | 
			
		||||
   win->x = x;
 | 
			
		||||
   win->y = y;
 | 
			
		||||
   win->w = width;
 | 
			
		||||
   win->h = height;
 | 
			
		||||
   win->visual = visual;  /* ptr assignment */
 | 
			
		||||
@@ -1537,7 +1537,7 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
 | 
			
		||||
   win->bytesPerPixel = dpy->driverContext.cpp;
 | 
			
		||||
   win->rowStride = dpy->driverContext.shared.virtualWidth * win->bytesPerPixel;
 | 
			
		||||
   win->size = win->rowStride * height; 
 | 
			
		||||
   win->frontStart = dpy->driverContext.FBAddress;
 | 
			
		||||
   win->frontStart = dpy->driverContext.FBAddress + (win->rowStride * win->x) + (win->y * win->bytesPerPixel);
 | 
			
		||||
   win->frontBottom = (GLubyte *) win->frontStart + (height-1) * win->rowStride;
 | 
			
		||||
 | 
			
		||||
   /* This is incorrect: the hardware driver could put the backbuffer
 | 
			
		||||
 
 | 
			
		||||
@@ -150,7 +150,7 @@ DestroyPbuffer( Display * dpy, GLXDrawable drawable )
 | 
			
		||||
   if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
 | 
			
		||||
      xGLXDestroyPbufferReq * req;
 | 
			
		||||
 | 
			
		||||
      GetReqExtra( GLXDestroyPbuffer, 4, req );
 | 
			
		||||
      GetReq( GLXDestroyPbuffer, req );
 | 
			
		||||
      req->reqType = opcode;
 | 
			
		||||
      req->glxCode = X_GLXDestroyPbuffer;
 | 
			
		||||
      req->pbuffer = (GLXPbuffer) drawable;
 | 
			
		||||
 
 | 
			
		||||
@@ -1667,7 +1667,7 @@ __glXGetArrayType( const __GLXattribute * const state,
 | 
			
		||||
						    key, index );
 | 
			
		||||
 | 
			
		||||
    if ( a != NULL ) {
 | 
			
		||||
	*dest = (GLintptr) a->enabled;
 | 
			
		||||
	*dest = (GLintptr) a->data_type;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return (a != NULL);
 | 
			
		||||
 
 | 
			
		||||
@@ -117,17 +117,16 @@ $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
 | 
			
		||||
		$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS)
 | 
			
		||||
 | 
			
		||||
# Make the OSMesa library
 | 
			
		||||
# Note: version is kept at 6.5.3 to simplify app/linking issues
 | 
			
		||||
$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
 | 
			
		||||
	@ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
 | 
			
		||||
		$(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
 | 
			
		||||
			-major $(MESA_MAJOR) \
 | 
			
		||||
			-minor $(MESA_MINOR) -patch $(MESA_TINY) \
 | 
			
		||||
			-major 6 -minor 5 -patch 3 \
 | 
			
		||||
			-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
 | 
			
		||||
			$(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
 | 
			
		||||
	else \
 | 
			
		||||
		$(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
 | 
			
		||||
			-major $(MESA_MAJOR) \
 | 
			
		||||
			-minor $(MESA_MINOR) -patch $(GL_TINY) \
 | 
			
		||||
			-major 6 -minor 5 -patch 3 \
 | 
			
		||||
			-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
 | 
			
		||||
			$(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \
 | 
			
		||||
	fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
# Mesa 3-D graphics library
 | 
			
		||||
# Version:  5.1
 | 
			
		||||
# Version:  7.0
 | 
			
		||||
# 
 | 
			
		||||
# Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -26,6 +26,16 @@
 | 
			
		||||
#  Email : dborca@users.sourceforge.net
 | 
			
		||||
#  Web   : http://www.geocities.com/dborca
 | 
			
		||||
 | 
			
		||||
# MinGW core-gl makefile updated for Mesa 7.0
 | 
			
		||||
#
 | 
			
		||||
#  updated : by Heromyth, on 2007-7-21
 | 
			
		||||
#  Email   : zxpmyth@yahoo.com.cn
 | 
			
		||||
#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
 | 
			
		||||
#            The others havn't been tested yet.
 | 
			
		||||
#            2) The generated DLLs are *not* compatible with the ones built
 | 
			
		||||
#            with the other compilers like VC8, especially for GLUT. 
 | 
			
		||||
#            3) Although more tests are needed, it can be used individually!
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
#  Available options:
 | 
			
		||||
@@ -52,7 +62,6 @@
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.PHONY: all clean
 | 
			
		||||
.INTERMEDIATE: x86/gen_matypes.exe
 | 
			
		||||
.SUFFIXES: .rc .res
 | 
			
		||||
@@ -60,6 +69,8 @@
 | 
			
		||||
# Set this to the prefix of your build tools, i.e. mingw32-
 | 
			
		||||
TOOLS_PREFIX = mingw32-
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TOP = ../..
 | 
			
		||||
GLIDE ?= $(TOP)/glide3
 | 
			
		||||
LIBDIR = $(TOP)/lib
 | 
			
		||||
@@ -71,11 +82,25 @@ else
 | 
			
		||||
  GL_IMP = libopengl32.a
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
LDLIBS = -lgdi32
 | 
			
		||||
GL_DEF = gl.def
 | 
			
		||||
 | 
			
		||||
include $(TOP)/configs/config.mgw
 | 
			
		||||
GL_USING_STDCALL ?= 1
 | 
			
		||||
 | 
			
		||||
MESA_LIB = libmesa.a
 | 
			
		||||
 | 
			
		||||
LDLIBS = -lgdi32 -luser32 -liberty
 | 
			
		||||
LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GL_IMP) -Wl,--output-def=$(LIBDIR)/gl.def
 | 
			
		||||
 | 
			
		||||
CC = $(TOOLS_PREFIX)gcc
 | 
			
		||||
CFLAGS += -DBUILD_GL32 -D_OPENGL32_
 | 
			
		||||
CFLAGS += $(INCLUDE_DIRS)
 | 
			
		||||
CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_DLL -DMESA_MINWARN -DNDEBUG -D_USRDLL -DGDI_EXPORTS
 | 
			
		||||
 | 
			
		||||
ifeq ($(GL_USING_STDCALL),1)
 | 
			
		||||
  LDFLAGS += -Wl,--add-stdcall-alias
 | 
			
		||||
else
 | 
			
		||||
  CFLAGS += -DGL_NO_STDCALL
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
 | 
			
		||||
ifeq ($(FX),1)
 | 
			
		||||
  CFLAGS += -I$(GLIDE)/include -DFX
 | 
			
		||||
@@ -104,6 +129,8 @@ endif
 | 
			
		||||
 | 
			
		||||
include sources
 | 
			
		||||
 | 
			
		||||
CFLAGS += $(INCLUDE_DIRS) 
 | 
			
		||||
 | 
			
		||||
ifeq ($(X86),1)
 | 
			
		||||
CFLAGS += -DUSE_X86_ASM
 | 
			
		||||
CFLAGS += -DUSE_MMX_ASM
 | 
			
		||||
@@ -140,10 +167,9 @@ RESOURCE = $(GL_RES:.rc=.res)
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -c $<
 | 
			
		||||
.S.o:
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -c $<
 | 
			
		||||
.s.o:
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
 | 
			
		||||
 | 
			
		||||
.rc.res:
 | 
			
		||||
	windres -o $@ -Irc -Ocoff $<
 | 
			
		||||
 | 
			
		||||
@@ -153,9 +179,8 @@ $(LIBDIR):
 | 
			
		||||
	mkdir -p $(LIBDIR)
 | 
			
		||||
 | 
			
		||||
$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
 | 
			
		||||
	$(TOOLS_PREFIX)dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) \
 | 
			
		||||
	                       --target i386-mingw32 --def $(GL_DEF) -Wl,-enable-stdcall-fixup \
 | 
			
		||||
	                       $^ $(LDLIBS)
 | 
			
		||||
	$(CC) -shared -fPIC -o $(LIBDIR)/$(GL_DLL) $(LDFLAGS) \
 | 
			
		||||
	$^ $(LDLIBS)
 | 
			
		||||
 | 
			
		||||
$(X86_OBJECTS): x86/matypes.h
 | 
			
		||||
 | 
			
		||||
@@ -187,17 +212,21 @@ tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
 | 
			
		||||
	$(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	-$(call UNLINK,array_cache/*.o)
 | 
			
		||||
	-$(call UNLINK,glapi/*.o)
 | 
			
		||||
	-$(call UNLINK,main/*.o)
 | 
			
		||||
	-$(call UNLINK,math/*.o)
 | 
			
		||||
	-$(call UNLINK,vbo/*.o)
 | 
			
		||||
	-$(call UNLINK,shader/*.o)
 | 
			
		||||
	-$(call UNLINK,shader/slang/*.o)
 | 
			
		||||
	-$(call UNLINK,shader/grammar/*.o)
 | 
			
		||||
	-$(call UNLINK,sparc/*.o)
 | 
			
		||||
	-$(call UNLINK,ppc/*.o)
 | 
			
		||||
	-$(call UNLINK,swrast/*.o)
 | 
			
		||||
	-$(call UNLINK,swrast_setup/*.o)
 | 
			
		||||
	-$(call UNLINK,tnl/*.o)
 | 
			
		||||
	-$(call UNLINK,x86/*.o)
 | 
			
		||||
	-$(call UNLINK,x86/rtasm/*.o)
 | 
			
		||||
	-$(call UNLINK,x86-64/*.o)
 | 
			
		||||
	-$(call UNLINK,drivers/common/*.o)
 | 
			
		||||
	-$(call UNLINK,drivers/glide/*.o)
 | 
			
		||||
	-$(call UNLINK,drivers/windows/fx/*.o)
 | 
			
		||||
 
 | 
			
		||||
@@ -14,21 +14,25 @@ $(TOP)/$(LIB_DIR):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
subdirs:
 | 
			
		||||
	echo $(DRI_DIRS)
 | 
			
		||||
	@for dir in $(DRI_DIRS) ; do \
 | 
			
		||||
		echo $$dir ; \
 | 
			
		||||
		(cd $$dir && $(MAKE)) || exit 1; \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir && $(MAKE)) || exit 1 ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	@for dir in $(DRI_DIRS) ; do \
 | 
			
		||||
		(cd $$dir && $(MAKE) install) || exit 1; \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir && $(MAKE) install) || exit 1 ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	@for dir in $(DRI_DIRS) ; do \
 | 
			
		||||
		(cd $$dir && $(MAKE) clean) ; \
 | 
			
		||||
		if [ -d $$dir ] ; then \
 | 
			
		||||
			(cd $$dir && $(MAKE) clean) ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
	-rm -f common/*.o
 | 
			
		||||
 
 | 
			
		||||
@@ -25,11 +25,13 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 | 
			
		||||
	  $(ASM_SOURCES:.S=.o) 
 | 
			
		||||
 | 
			
		||||
else
 | 
			
		||||
# miniglx
 | 
			
		||||
WINOBJ=
 | 
			
		||||
WINLIB=-L$(MESA)/src/glx/mini
 | 
			
		||||
MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
 | 
			
		||||
INCLUDES = $(MINIGLX_INCLUDES) \
 | 
			
		||||
	   $(SHARED_INCLUDES)
 | 
			
		||||
	   $(SHARED_INCLUDES) \
 | 
			
		||||
	   $(PCIACCESS_CFLAGS)
 | 
			
		||||
 | 
			
		||||
OBJECTS = $(C_SOURCES:.c=.o) \
 | 
			
		||||
	  $(MINIGLX_SOURCES:.c=.o) \
 | 
			
		||||
@@ -54,7 +56,8 @@ SHARED_INCLUDES = \
 | 
			
		||||
	-I$(TOP)/src/mesa/swrast_setup \
 | 
			
		||||
	-I$(TOP)/src/egl/main \
 | 
			
		||||
	-I$(TOP)/src/egl/drivers/dri \
 | 
			
		||||
	`pkg-config --cflags libdrm`
 | 
			
		||||
	$(LIBDRM_CFLAGS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##### RULES #####
 | 
			
		||||
 | 
			
		||||
@@ -70,11 +73,6 @@ SHARED_INCLUDES = \
 | 
			
		||||
default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#$(TOP)/$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile
 | 
			
		||||
#	@echo BUILDING FOR: $(WINDOW_SYSTEM)
 | 
			
		||||
#	$(TOP)/bin/mklib -o $(LIBNAME) -noprefix -install $(TOP)/$(LIB_DIR) \
 | 
			
		||||
#		$(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES) $(OBJECTS)
 | 
			
		||||
 | 
			
		||||
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
 | 
			
		||||
	$(TOP)/bin/mklib -noprefix -o $@ \
 | 
			
		||||
		$(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
 | 
			
		||||
@@ -84,9 +82,6 @@ $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
 | 
			
		||||
	$(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR) 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Run 'make depend' to update the dependencies if you change
 | 
			
		||||
# what's included by any source file.
 | 
			
		||||
depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
 | 
			
		||||
	touch depend
 | 
			
		||||
	$(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \
 | 
			
		||||
@@ -103,8 +98,10 @@ clean:
 | 
			
		||||
	-rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
 | 
			
		||||
	-rm -f depend depend.bak
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
install: $(LIBNAME)
 | 
			
		||||
	$(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
 | 
			
		||||
	$(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
include depend
 | 
			
		||||
 
 | 
			
		||||
@@ -428,10 +428,12 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
 | 
			
		||||
 | 
			
		||||
    if (pdp->pClipRects) {
 | 
			
		||||
	_mesa_free(pdp->pClipRects); 
 | 
			
		||||
	pdp->pClipRects = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (pdp->pBackClipRects) {
 | 
			
		||||
	_mesa_free(pdp->pBackClipRects); 
 | 
			
		||||
	pdp->pBackClipRects = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
 | 
			
		||||
 
 | 
			
		||||
@@ -1471,9 +1471,10 @@ static const char ImageTransformParameterfvHP_names[] =
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(need_GL_ARB_vertex_program)
 | 
			
		||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
 | 
			
		||||
static const char VertexAttrib4ivARB_names[] = 
 | 
			
		||||
    "ip\0" /* Parameter signature */
 | 
			
		||||
    "glVertexAttrib4iv\0"
 | 
			
		||||
    "glVertexAttrib4ivARB\0"
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1579,9 +1580,10 @@ static const char PixelTransformParameterfvEXT_names[] =
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(need_GL_ARB_vertex_program)
 | 
			
		||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
 | 
			
		||||
static const char VertexAttrib4bvARB_names[] = 
 | 
			
		||||
    "ip\0" /* Parameter signature */
 | 
			
		||||
    "glVertexAttrib4bv\0"
 | 
			
		||||
    "glVertexAttrib4bvARB\0"
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
@@ -2384,9 +2386,10 @@ static const char GetAttribLocationARB_names[] =
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(need_GL_ARB_vertex_program)
 | 
			
		||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
 | 
			
		||||
static const char VertexAttrib4ubvARB_names[] = 
 | 
			
		||||
    "ip\0" /* Parameter signature */
 | 
			
		||||
    "glVertexAttrib4ubv\0"
 | 
			
		||||
    "glVertexAttrib4ubvARB\0"
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
@@ -2903,9 +2906,10 @@ static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] =
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(need_GL_ARB_vertex_program)
 | 
			
		||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
 | 
			
		||||
static const char VertexAttrib4usvARB_names[] = 
 | 
			
		||||
    "ip\0" /* Parameter signature */
 | 
			
		||||
    "glVertexAttrib4usv\0"
 | 
			
		||||
    "glVertexAttrib4usvARB\0"
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
@@ -4386,9 +4390,10 @@ static const char WindowPos4iMESA_names[] =
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(need_GL_ARB_vertex_program)
 | 
			
		||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
 | 
			
		||||
static const char VertexAttrib4uivARB_names[] = 
 | 
			
		||||
    "ip\0" /* Parameter signature */
 | 
			
		||||
    "glVertexAttrib4uiv\0"
 | 
			
		||||
    "glVertexAttrib4uivARB\0"
 | 
			
		||||
    "";
 | 
			
		||||
#endif
 | 
			
		||||
@@ -6243,6 +6248,8 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
 | 
			
		||||
    { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 },
 | 
			
		||||
    { CreateProgram_names, CreateProgram_remap_index, -1 },
 | 
			
		||||
    { StencilFuncSeparate_names, StencilFuncSeparate_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 },
 | 
			
		||||
@@ -6256,6 +6263,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
 | 
			
		||||
    { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 },
 | 
			
		||||
    { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 },
 | 
			
		||||
    { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 },
 | 
			
		||||
    { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 },
 | 
			
		||||
@@ -6268,6 +6276,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
 | 
			
		||||
    { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 },
 | 
			
		||||
    { Uniform4fARB_names, Uniform4fARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 },
 | 
			
		||||
    { LinkProgramARB_names, LinkProgramARB_remap_index, -1 },
 | 
			
		||||
    { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 },
 | 
			
		||||
@@ -6297,6 +6306,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
 | 
			
		||||
    { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 },
 | 
			
		||||
    { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 },
 | 
			
		||||
    { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 },
 | 
			
		||||
    { GetShaderiv_names, GetShaderiv_remap_index, -1 },
 | 
			
		||||
    { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 },
 | 
			
		||||
 
 | 
			
		||||
@@ -172,12 +172,8 @@ static void i915LayoutTextureImages( i915ContextPtr i915,
 | 
			
		||||
	 
 | 
			
		||||
	 t->intel.image[0][i].offset = total_height * pitch;
 | 
			
		||||
	 t->intel.image[0][i].internalFormat = baseImage->_BaseFormat;
 | 
			
		||||
	 if (t->intel.image[0][i].image->IsCompressed)
 | 
			
		||||
	 {
 | 
			
		||||
	   if (t->intel.image[0][i].image->Height > 4)
 | 
			
		||||
	     total_height += t->intel.image[0][i].image->Height/4;
 | 
			
		||||
	   else
 | 
			
		||||
	     total_height += 1;
 | 
			
		||||
	 if (t->intel.image[0][i].image->IsCompressed) {
 | 
			
		||||
	    total_height += (t->intel.image[0][i].image->Height + 3) / 4;
 | 
			
		||||
	 }
 | 
			
		||||
	 else
 | 
			
		||||
	   total_height += MAX2(2, t->intel.image[0][i].image->Height);
 | 
			
		||||
 
 | 
			
		||||
@@ -64,6 +64,7 @@ static void i915_reduced_primitive_state( intelContextPtr intel,
 | 
			
		||||
    st1 &= ~ST1_ENABLE;
 | 
			
		||||
 | 
			
		||||
    switch (rprim) {
 | 
			
		||||
    case GL_QUADS: /* from RASTERIZE(GL_QUADS) in t_dd_tritemp.h */
 | 
			
		||||
    case GL_TRIANGLES:
 | 
			
		||||
       if (intel->ctx.Polygon.StippleFlag &&
 | 
			
		||||
	   intel->hw_stipple)
 | 
			
		||||
 
 | 
			
		||||
@@ -634,11 +634,32 @@ static void intelUploadTexImage( intelContextPtr intel,
 | 
			
		||||
			       image->Height);
 | 
			
		||||
   }
 | 
			
		||||
   else if (image->IsCompressed) {
 | 
			
		||||
      GLuint row_len = image->Width * 2;
 | 
			
		||||
      GLuint row_len = 0;
 | 
			
		||||
      GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
 | 
			
		||||
      GLubyte *src = (GLubyte *)image->Data;
 | 
			
		||||
      GLuint j;
 | 
			
		||||
 | 
			
		||||
      /* must always copy whole blocks (8/16 bytes) */
 | 
			
		||||
      switch (image->InternalFormat) {
 | 
			
		||||
	case GL_COMPRESSED_RGB_FXT1_3DFX:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_FXT1_3DFX:
 | 
			
		||||
	case GL_RGB_S3TC:
 | 
			
		||||
	case GL_RGB4_S3TC:
 | 
			
		||||
	case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
 | 
			
		||||
	  row_len = (image->Width * 2 + 7) & ~7;
 | 
			
		||||
	  break;
 | 
			
		||||
	case GL_RGBA_S3TC:
 | 
			
		||||
	case GL_RGBA4_S3TC:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
 | 
			
		||||
	  row_len = (image->Width * 4 + 15) & ~15;
 | 
			
		||||
	  break;
 | 
			
		||||
	default:
 | 
			
		||||
	  fprintf(stderr,"Internal Compressed format not supported %d\n", image->InternalFormat);
 | 
			
		||||
	  break;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (INTEL_DEBUG & DEBUG_TEXTURE)
 | 
			
		||||
	 fprintf(stderr, 
 | 
			
		||||
		 "Upload image %dx%dx%d offset %xm row_len %x "
 | 
			
		||||
@@ -646,30 +667,11 @@ static void intelUploadTexImage( intelContextPtr intel,
 | 
			
		||||
		 image->Width, image->Height, image->Depth, offset,
 | 
			
		||||
		 row_len, t->Pitch, t->depth_pitch);
 | 
			
		||||
 | 
			
		||||
      switch (image->InternalFormat) {
 | 
			
		||||
	case GL_COMPRESSED_RGB_FXT1_3DFX:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_FXT1_3DFX:
 | 
			
		||||
	case GL_RGB_S3TC:
 | 
			
		||||
	case GL_RGB4_S3TC:
 | 
			
		||||
	case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
 | 
			
		||||
	  for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
 | 
			
		||||
	    __memcpy(dst, src, row_len );
 | 
			
		||||
	    src += row_len;
 | 
			
		||||
	  }
 | 
			
		||||
	  break;
 | 
			
		||||
	case GL_RGBA_S3TC:
 | 
			
		||||
	case GL_RGBA4_S3TC:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
 | 
			
		||||
	case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
 | 
			
		||||
	  for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
 | 
			
		||||
	    __memcpy(dst, src, (image->Width*4) );
 | 
			
		||||
	    src += image->Width*4;
 | 
			
		||||
	  }
 | 
			
		||||
	  break;
 | 
			
		||||
	default:
 | 
			
		||||
	  fprintf(stderr,"Internal Compressed format not supported %d\n", image->InternalFormat);
 | 
			
		||||
	  break;
 | 
			
		||||
      if (row_len) {
 | 
			
		||||
	 for (j = 0 ; j < (image->Height + 3)/4 ; j++, dst += (t->Pitch)) {
 | 
			
		||||
	   __memcpy(dst, src, row_len );
 | 
			
		||||
	   src += row_len;
 | 
			
		||||
	 }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
   /* Time for another vtbl entry:
 | 
			
		||||
 
 | 
			
		||||
@@ -455,12 +455,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned long
 | 
			
		||||
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags)
 | 
			
		||||
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
 | 
			
		||||
                I830MemRange *result, I830MemPool *pool, long size,
 | 
			
		||||
                unsigned long alignment, int flags)
 | 
			
		||||
{
 | 
			
		||||
  int ret;
 | 
			
		||||
   unsigned long ret;
 | 
			
		||||
 | 
			
		||||
  if (!result)
 | 
			
		||||
    return 0;
 | 
			
		||||
   if (!result)
 | 
			
		||||
      return 0;
 | 
			
		||||
 | 
			
		||||
   /* Make sure these are initialised. */
 | 
			
		||||
   result->Size = 0;
 | 
			
		||||
@@ -470,16 +472,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul
 | 
			
		||||
      return 0;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (pool->Free.Size < size)
 | 
			
		||||
     return AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
   else
 | 
			
		||||
   {
 | 
			
		||||
     ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
 | 
			
		||||
 | 
			
		||||
     if (ret==0)
 | 
			
		||||
       return AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
     return ret;
 | 
			
		||||
   if (pool->Free.Size < size) {
 | 
			
		||||
      ret = AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
   }
 | 
			
		||||
   else {
 | 
			
		||||
      ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
 | 
			
		||||
      if (ret == 0)
 | 
			
		||||
         ret = AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
   }
 | 
			
		||||
   return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
 | 
			
		||||
 
 | 
			
		||||
@@ -161,11 +161,9 @@ i915_miptree_layout(struct intel_mipmap_tree * mt)
 | 
			
		||||
            if (mt->compressed)
 | 
			
		||||
               img_height = MAX2(1, height / 4);
 | 
			
		||||
            else
 | 
			
		||||
               img_height = MAX2(2, height);
 | 
			
		||||
               img_height = (MAX2(2, height) + 1) & ~1;
 | 
			
		||||
 | 
			
		||||
	    mt->total_height += img_height;
 | 
			
		||||
	    mt->total_height += 1;
 | 
			
		||||
	    mt->total_height &= ~1;
 | 
			
		||||
 | 
			
		||||
            width = minify(width);
 | 
			
		||||
            height = minify(height);
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,7 @@ i915_reduced_primitive_state(struct intel_context *intel, GLenum rprim)
 | 
			
		||||
   st1 &= ~ST1_ENABLE;
 | 
			
		||||
 | 
			
		||||
   switch (rprim) {
 | 
			
		||||
   case GL_QUADS: /* from RASTERIZE(GL_QUADS) in t_dd_tritemp.h */
 | 
			
		||||
   case GL_TRIANGLES:
 | 
			
		||||
      if (intel->ctx.Polygon.StippleFlag && intel->hw_stipple)
 | 
			
		||||
         st1 |= ST1_ENABLE;
 | 
			
		||||
 
 | 
			
		||||
@@ -316,7 +316,8 @@ intelWindowMoved(struct intel_context *intel)
 | 
			
		||||
	 flags = intel_fb->vblank_flags & ~VBLANK_FLAG_SECONDARY;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (flags != intel_fb->vblank_flags) {
 | 
			
		||||
      if (flags != intel_fb->vblank_flags && intel_fb->vblank_flags &&
 | 
			
		||||
	  !(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ)) {
 | 
			
		||||
	 drmVBlank vbl;
 | 
			
		||||
	 int i;
 | 
			
		||||
 | 
			
		||||
@@ -327,7 +328,9 @@ intelWindowMoved(struct intel_context *intel)
 | 
			
		||||
	 }
 | 
			
		||||
 | 
			
		||||
	 for (i = 0; i < intel_fb->pf_num_pages; i++) {
 | 
			
		||||
	    if (!intel_fb->color_rb[i])
 | 
			
		||||
	    if (!intel_fb->color_rb[i] ||
 | 
			
		||||
		(intel_fb->vbl_waited - intel_fb->color_rb[i]->vbl_pending) <=
 | 
			
		||||
		(1<<23))
 | 
			
		||||
	       continue;
 | 
			
		||||
 | 
			
		||||
	    vbl.request.sequence = intel_fb->color_rb[i]->vbl_pending;
 | 
			
		||||
@@ -828,7 +831,8 @@ intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target)
 | 
			
		||||
   drm_i915_vblank_swap_t swap;
 | 
			
		||||
   GLboolean ret;
 | 
			
		||||
 | 
			
		||||
   if ((intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) ||
 | 
			
		||||
   if (!intel_fb->vblank_flags ||
 | 
			
		||||
       (intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) ||
 | 
			
		||||
       intelScreen->current_rotation != 0 ||
 | 
			
		||||
       intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6))
 | 
			
		||||
      return GL_FALSE;
 | 
			
		||||
 
 | 
			
		||||
@@ -607,12 +607,23 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
 | 
			
		||||
      if (intel->ctx.DrawBuffer == &intel_fb->Base) {
 | 
			
		||||
 | 
			
		||||
	 if (intel->driDrawable != driDrawPriv) {
 | 
			
		||||
	    intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0)
 | 
			
		||||
	       ? driGetDefaultVBlankFlags(&intel->optionCache)
 | 
			
		||||
	       : VBLANK_FLAG_NO_IRQ;
 | 
			
		||||
	    (*dri_interface->getUST) (&intel_fb->swap_ust);
 | 
			
		||||
	    driDrawableInitVBlank(driDrawPriv, intel_fb->vblank_flags,
 | 
			
		||||
				  &intel_fb->vbl_seq);
 | 
			
		||||
	    if (driDrawPriv->pdraw->swap_interval == (unsigned)-1) {
 | 
			
		||||
	       int i;
 | 
			
		||||
 | 
			
		||||
	       intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0)
 | 
			
		||||
		  ? driGetDefaultVBlankFlags(&intel->optionCache)
 | 
			
		||||
		 : VBLANK_FLAG_NO_IRQ;
 | 
			
		||||
 | 
			
		||||
	       (*dri_interface->getUST) (&intel_fb->swap_ust);
 | 
			
		||||
	       driDrawableInitVBlank(driDrawPriv, intel_fb->vblank_flags,
 | 
			
		||||
				     &intel_fb->vbl_seq);
 | 
			
		||||
	       intel_fb->vbl_waited = intel_fb->vbl_seq;
 | 
			
		||||
 | 
			
		||||
	       for (i = 0; i < (intel->intelScreen->third.handle ? 3 : 2); i++) {
 | 
			
		||||
		  if (intel_fb->color_rb[i])
 | 
			
		||||
		     intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_seq;
 | 
			
		||||
	       }
 | 
			
		||||
	    }
 | 
			
		||||
	    intel->driDrawable = driDrawPriv;
 | 
			
		||||
	    intelWindowMoved(intel);
 | 
			
		||||
	 }
 | 
			
		||||
@@ -658,37 +669,27 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
 | 
			
		||||
   if (sarea->width != intel->width ||
 | 
			
		||||
       sarea->height != intel->height ||
 | 
			
		||||
       sarea->rotation != intel->current_rotation) {
 | 
			
		||||
      
 | 
			
		||||
      void *batchMap = intel->batch->map;
 | 
			
		||||
      
 | 
			
		||||
      int numClipRects = intel->numClipRects;
 | 
			
		||||
 | 
			
		||||
      /*
 | 
			
		||||
       * FIXME: Really only need to do this when drawing to a
 | 
			
		||||
       * common back- or front buffer.
 | 
			
		||||
       */
 | 
			
		||||
 | 
			
		||||
      /*
 | 
			
		||||
       * This will drop the outstanding batchbuffer on the floor
 | 
			
		||||
       * This will essentially drop the outstanding batchbuffer on the floor.
 | 
			
		||||
       */
 | 
			
		||||
      intel->numClipRects = 0;
 | 
			
		||||
 | 
			
		||||
      if (batchMap != NULL) {
 | 
			
		||||
	 driBOUnmap(intel->batch->buffer);
 | 
			
		||||
	 intel->batch->map = NULL;
 | 
			
		||||
      }
 | 
			
		||||
      if (intel->Fallback)
 | 
			
		||||
	 _swrast_flush(&intel->ctx);
 | 
			
		||||
 | 
			
		||||
      intel_batchbuffer_reset(intel->batch);
 | 
			
		||||
      INTEL_FIREVERTICES(intel);
 | 
			
		||||
 | 
			
		||||
      if (batchMap == NULL) {
 | 
			
		||||
	 driBOUnmap(intel->batch->buffer);
 | 
			
		||||
	 intel->batch->map = NULL;
 | 
			
		||||
      }
 | 
			
		||||
      if (intel->batch->map != intel->batch->ptr)
 | 
			
		||||
	 intel_batchbuffer_flush(intel->batch);
 | 
			
		||||
 | 
			
		||||
      /* lose all primitives */
 | 
			
		||||
      intel->prim.primitive = ~0;
 | 
			
		||||
      intel->prim.start_ptr = 0;
 | 
			
		||||
      intel->prim.flush = 0;
 | 
			
		||||
 | 
			
		||||
      /* re-emit all state */
 | 
			
		||||
      intel->vtbl.lost_hardware(intel);
 | 
			
		||||
      intel->numClipRects = numClipRects;
 | 
			
		||||
 | 
			
		||||
      /* force window update */
 | 
			
		||||
      intel->lastStamp = 0;
 | 
			
		||||
@@ -729,7 +730,9 @@ void LOCK_HARDWARE( struct intel_context *intel )
 | 
			
		||||
				    BUFFER_BACK_LEFT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (intel_rb && (intel_fb->vbl_waited - intel_rb->vbl_pending) > (1<<23)) {
 | 
			
		||||
    if (intel_rb && intel_fb->vblank_flags &&
 | 
			
		||||
	!(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) &&
 | 
			
		||||
	(intel_fb->vbl_waited - intel_rb->vbl_pending) > (1<<23)) {
 | 
			
		||||
	drmVBlank vbl;
 | 
			
		||||
 | 
			
		||||
	vbl.request.type = DRM_VBLANK_ABSOLUTE;
 | 
			
		||||
 
 | 
			
		||||
@@ -105,6 +105,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
 | 
			
		||||
{
 | 
			
		||||
   struct gl_texture_object *tObj = intel->ctx.Texture.Unit[unit]._Current;
 | 
			
		||||
   struct intel_texture_object *intelObj = intel_texture_object(tObj);
 | 
			
		||||
   int comp_byte = 0;
 | 
			
		||||
   int cpp;
 | 
			
		||||
 | 
			
		||||
   GLuint face, i;
 | 
			
		||||
   GLuint nr_faces = 0;
 | 
			
		||||
@@ -148,6 +150,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
 | 
			
		||||
      intel_miptree_reference(&intelObj->mt, firstImage->mt);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (firstImage->base.IsCompressed) {
 | 
			
		||||
      comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
 | 
			
		||||
      cpp = comp_byte;
 | 
			
		||||
   }
 | 
			
		||||
   else cpp = firstImage->base.TexFormat->TexelBytes;
 | 
			
		||||
 | 
			
		||||
   /* Check tree can hold all active levels.  Check tree matches
 | 
			
		||||
    * target, imageFormat, etc.
 | 
			
		||||
    * 
 | 
			
		||||
@@ -165,7 +173,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
 | 
			
		||||
	intelObj->mt->width0 != firstImage->base.Width ||
 | 
			
		||||
	intelObj->mt->height0 != firstImage->base.Height ||
 | 
			
		||||
	intelObj->mt->depth0 != firstImage->base.Depth ||
 | 
			
		||||
	intelObj->mt->cpp != firstImage->base.TexFormat->TexelBytes ||
 | 
			
		||||
	intelObj->mt->cpp != cpp ||
 | 
			
		||||
	intelObj->mt->compressed != firstImage->base.IsCompressed)) {
 | 
			
		||||
      intel_miptree_release(intel, &intelObj->mt);
 | 
			
		||||
   }
 | 
			
		||||
@@ -174,10 +182,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
 | 
			
		||||
   /* May need to create a new tree:
 | 
			
		||||
    */
 | 
			
		||||
   if (!intelObj->mt) {
 | 
			
		||||
      int comp_byte = 0;
 | 
			
		||||
      
 | 
			
		||||
      if (firstImage->base.IsCompressed)
 | 
			
		||||
	 comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
 | 
			
		||||
      intelObj->mt = intel_miptree_create(intel,
 | 
			
		||||
                                          intelObj->base.Target,
 | 
			
		||||
                                          firstImage->base.InternalFormat,
 | 
			
		||||
@@ -186,8 +190,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
 | 
			
		||||
                                          firstImage->base.Width,
 | 
			
		||||
                                          firstImage->base.Height,
 | 
			
		||||
                                          firstImage->base.Depth,
 | 
			
		||||
                                          firstImage->base.TexFormat->
 | 
			
		||||
                                          TexelBytes,
 | 
			
		||||
                                          cpp,
 | 
			
		||||
                                          comp_byte);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -483,12 +483,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned long
 | 
			
		||||
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags)
 | 
			
		||||
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
 | 
			
		||||
                I830MemRange *result, I830MemPool *pool, long size,
 | 
			
		||||
                unsigned long alignment, int flags)
 | 
			
		||||
{
 | 
			
		||||
  int ret;
 | 
			
		||||
   unsigned long ret;
 | 
			
		||||
 | 
			
		||||
  if (!result)
 | 
			
		||||
    return 0;
 | 
			
		||||
   if (!result)
 | 
			
		||||
      return 0;
 | 
			
		||||
 | 
			
		||||
   /* Make sure these are initialised. */
 | 
			
		||||
   result->Size = 0;
 | 
			
		||||
@@ -498,16 +500,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul
 | 
			
		||||
      return 0;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   if (pool->Free.Size < size)
 | 
			
		||||
     return AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
   else
 | 
			
		||||
   {
 | 
			
		||||
     ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
 | 
			
		||||
 | 
			
		||||
     if (ret==0)
 | 
			
		||||
       return AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
     return ret;
 | 
			
		||||
   if (pool->Free.Size < size) {
 | 
			
		||||
      ret = AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
   }
 | 
			
		||||
   else {
 | 
			
		||||
      ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
 | 
			
		||||
      if (ret == 0)
 | 
			
		||||
         ret = AllocFromAGP(ctx, pI830, size, alignment, result);
 | 
			
		||||
   }
 | 
			
		||||
   return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
 | 
			
		||||
@@ -895,31 +896,6 @@ I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sa
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
static void
 | 
			
		||||
I830InitTextureHeap(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
 | 
			
		||||
{
 | 
			
		||||
   /* Start up the simple memory manager for agp space */
 | 
			
		||||
   drmI830MemInitHeap drmHeap;
 | 
			
		||||
   drmHeap.region = I830_MEM_REGION_AGP;
 | 
			
		||||
   drmHeap.start  = 0;
 | 
			
		||||
   drmHeap.size   = sarea->tex_size;
 | 
			
		||||
      
 | 
			
		||||
   if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT_HEAP,
 | 
			
		||||
			  &drmHeap, sizeof(drmHeap))) {
 | 
			
		||||
      fprintf(stderr,
 | 
			
		||||
		    "[drm] Failed to initialized agp heap manager\n");
 | 
			
		||||
   } else {
 | 
			
		||||
      fprintf(stderr,
 | 
			
		||||
		    "[drm] Initialized kernel agp heap manager, %d\n",
 | 
			
		||||
		    sarea->tex_size);
 | 
			
		||||
 | 
			
		||||
      I830SetParam(ctx, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY, 
 | 
			
		||||
		      sarea->log_tex_granularity);
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static Bool
 | 
			
		||||
I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
 | 
			
		||||
{
 | 
			
		||||
@@ -943,9 +919,6 @@ I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
 | 
			
		||||
  I830DRIMapScreenRegions(ctx, pI830, sarea);
 | 
			
		||||
  SetupDRIMM(ctx, pI830);
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
  I830InitTextureHeap(ctx, pI830, sarea);
 | 
			
		||||
#endif
 | 
			
		||||
   if (ctx->pciDevice != PCI_CHIP_845_G &&
 | 
			
		||||
       ctx->pciDevice != PCI_CHIP_I830_M) {
 | 
			
		||||
      I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 );
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@
 | 
			
		||||
#include "brw_state.h"
 | 
			
		||||
#include "brw_defines.h"
 | 
			
		||||
#include "brw_util.h"
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
#include "enums.h"
 | 
			
		||||
 | 
			
		||||
static void upload_cc_vp( struct brw_context *brw )
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@
 | 
			
		||||
 | 
			
		||||
#include "tnl/tnl.h"
 | 
			
		||||
#include "vbo/vbo_context.h"
 | 
			
		||||
 | 
			
		||||
#include "swrast/swrast.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -532,12 +532,15 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
 | 
			
		||||
				  GLuint dst_offset,
 | 
			
		||||
				  GLboolean dst_tiled,
 | 
			
		||||
				  GLshort x, GLshort y, 
 | 
			
		||||
				  GLshort w, GLshort h)
 | 
			
		||||
				  GLshort w, GLshort h,
 | 
			
		||||
				  GLenum logic_op)
 | 
			
		||||
{
 | 
			
		||||
   struct xy_setup_blit setup;
 | 
			
		||||
   struct xy_text_immediate_blit text;
 | 
			
		||||
   int dwords = ((src_size + 7) & ~7) / 4;
 | 
			
		||||
 | 
			
		||||
   assert( logic_op - GL_CLEAR >= 0 );
 | 
			
		||||
   assert( logic_op - GL_CLEAR < 0x10 );
 | 
			
		||||
 | 
			
		||||
   if (w < 0 || h < 0) 
 | 
			
		||||
      return;
 | 
			
		||||
@@ -561,7 +564,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
 | 
			
		||||
   setup.br0.length = (sizeof(setup) / sizeof(int)) - 2;
 | 
			
		||||
      
 | 
			
		||||
   setup.br13.dest_pitch = dst_pitch;
 | 
			
		||||
   setup.br13.rop = 0xcc;
 | 
			
		||||
   setup.br13.rop = translate_raster_op(logic_op);
 | 
			
		||||
   setup.br13.color_depth = (cpp == 4) ? BR13_8888 : BR13_565;
 | 
			
		||||
   setup.br13.clipping_enable = 0;
 | 
			
		||||
   setup.br13.mono_source_transparency = 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -72,6 +72,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
 | 
			
		||||
				  GLuint dst_offset,
 | 
			
		||||
				  GLboolean dst_tiled,
 | 
			
		||||
				  GLshort dst_x, GLshort dst_y, 
 | 
			
		||||
				  GLshort w, GLshort h);
 | 
			
		||||
				  GLshort w, GLshort h,
 | 
			
		||||
				  GLenum logic_op );
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -260,7 +260,9 @@ do_blit_bitmap( GLcontext *ctx,
 | 
			
		||||
	       int h = MIN2(DY, box_h - py);
 | 
			
		||||
	       int w = MIN2(DX, box_w - px); 
 | 
			
		||||
	       GLuint sz = align(align(w,8) * h, 64)/8;
 | 
			
		||||
	    
 | 
			
		||||
	       GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
 | 
			
		||||
		  ctx->Color.LogicOp : GL_COPY;
 | 
			
		||||
 | 
			
		||||
	       assert(sz <= sizeof(stipple));
 | 
			
		||||
	       memset(stipple, 0, sz);
 | 
			
		||||
 | 
			
		||||
@@ -288,7 +290,8 @@ do_blit_bitmap( GLcontext *ctx,
 | 
			
		||||
						  dst->tiled,
 | 
			
		||||
						  rect.x1 + px,
 | 
			
		||||
						  rect.y2 - (py + h),
 | 
			
		||||
						  w, h);
 | 
			
		||||
						  w, h,
 | 
			
		||||
						  logic_op);
 | 
			
		||||
	    } 
 | 
			
		||||
	 } 
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
 | 
			
		||||
      GLuint img_height;
 | 
			
		||||
 | 
			
		||||
      intel_miptree_set_level_info(mt, level, 1, x, y, width, 
 | 
			
		||||
				   mt->compressed ? height/4 : height, 1);
 | 
			
		||||
				   height, 1);
 | 
			
		||||
 | 
			
		||||
      if (mt->compressed)
 | 
			
		||||
	 img_height = MAX2(1, height/4);
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
 | 
			
		||||
	 dst->specular[2] = ((GLubyte *)p)[0];
 | 
			
		||||
	 dst->specular[1] = ((GLubyte *)p)[1];
 | 
			
		||||
	 dst->specular[0] = ((GLubyte *)p)[2];
 | 
			
		||||
	 dst->fog = ((GLubyte *)p)[3];
 | 
			
		||||
	 dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3];
 | 
			
		||||
	 p++;
 | 
			
		||||
 | 
			
		||||
      case TINY_VERTEX_FORMAT:
 | 
			
		||||
 
 | 
			
		||||
@@ -679,7 +679,6 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
 | 
			
		||||
	 newCtx->dri.drawable = driDrawPriv;
 | 
			
		||||
 | 
			
		||||
	 r200SetCliprects(newCtx);
 | 
			
		||||
	 r200UpdateWindow( newCtx->glCtx );
 | 
			
		||||
	 r200UpdateViewportOffset( newCtx->glCtx );
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								src/mesa/drivers/dri/r300/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								src/mesa/drivers/dri/r300/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,4 @@
 | 
			
		||||
radeon_chipset.h
 | 
			
		||||
radeon_screen.*
 | 
			
		||||
radeon_screen.[ch]
 | 
			
		||||
radeon_span.h
 | 
			
		||||
server
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								src/mesa/drivers/dri/r300/Lindent
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								src/mesa/drivers/dri/r300/Lindent
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@"
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
# src/mesa/drivers/dri/r300/Makefile
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TOP = ../../../../..
 | 
			
		||||
include $(TOP)/configs/current
 | 
			
		||||
 | 
			
		||||
@@ -28,8 +27,7 @@ DRIVER_SOURCES = \
 | 
			
		||||
		 radeon_lock.c \
 | 
			
		||||
		 radeon_span.c \
 | 
			
		||||
		 radeon_state.c \
 | 
			
		||||
		 radeon_mm.c \
 | 
			
		||||
		 radeon_vtxfmt_a.c \
 | 
			
		||||
		 r300_mem.c \
 | 
			
		||||
		 \
 | 
			
		||||
		 r300_context.c \
 | 
			
		||||
		 r300_ioctl.c \
 | 
			
		||||
@@ -42,34 +40,12 @@ DRIVER_SOURCES = \
 | 
			
		||||
		 r300_vertprog.c \
 | 
			
		||||
		 r300_fragprog.c \
 | 
			
		||||
		 r300_shader.c \
 | 
			
		||||
		 r300_maos.c \
 | 
			
		||||
		 r300_emit.c \
 | 
			
		||||
		 $(EGL_SOURCES)
 | 
			
		||||
 | 
			
		||||
#		 \
 | 
			
		||||
#		 r200_context.c \
 | 
			
		||||
#		 r200_ioctl.c \
 | 
			
		||||
#		 r200_state.c \
 | 
			
		||||
#		 r200_state_init.c \
 | 
			
		||||
#		 r200_cmdbuf.c \
 | 
			
		||||
#		 r200_pixel.c \
 | 
			
		||||
#		 r200_tex.c \
 | 
			
		||||
#		 r200_texmem.c \
 | 
			
		||||
#		 r200_texstate.c \
 | 
			
		||||
#		 r200_swtcl.c \
 | 
			
		||||
#		 r200_maos.c \
 | 
			
		||||
#		 r200_sanity.c \
 | 
			
		||||
#		 r200_vtxfmt.c \
 | 
			
		||||
#		 r200_vtxfmt_c.c \
 | 
			
		||||
#		 r200_vtxfmt_sse.c \
 | 
			
		||||
#		 r200_vtxfmt_x86.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
 | 
			
		||||
 | 
			
		||||
X86_SOURCES = 
 | 
			
		||||
#r200_vtxtmp_x86.S
 | 
			
		||||
 | 
			
		||||
DRIVER_DEFINES = -DCOMPILE_R300 -DGLX_DIRECT_RENDERING -DR200_MERGED=0 \
 | 
			
		||||
DRIVER_DEFINES = -DCOMPILE_R300 -DR200_MERGED=0 \
 | 
			
		||||
	-DRADEON_COMMON=1 -DRADEON_COMMON_FOR_R300
 | 
			
		||||
 | 
			
		||||
SYMLINKS = \
 | 
			
		||||
@@ -83,11 +59,11 @@ SYMLINKS = \
 | 
			
		||||
COMMON_SYMLINKS = \
 | 
			
		||||
	radeon_chipset.h \
 | 
			
		||||
	radeon_screen.c \
 | 
			
		||||
	radeon_screen.h
 | 
			
		||||
	radeon_screen.h \
 | 
			
		||||
	radeon_span.h
 | 
			
		||||
 | 
			
		||||
##### TARGETS #####
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
include ../Makefile.template
 | 
			
		||||
 | 
			
		||||
server:
 | 
			
		||||
@@ -100,4 +76,3 @@ $(COMMON_SYMLINKS):
 | 
			
		||||
	@[ -e $@ ] || ln -sf ../radeon/$@ ./
 | 
			
		||||
 | 
			
		||||
symlinks: $(SYMLINKS) $(COMMON_SYMLINKS)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,103 +0,0 @@
 | 
			
		||||
#ifndef __PIXEL_SHADER_H__
 | 
			
		||||
#define __PIXEL_SHADER_H__
 | 
			
		||||
 | 
			
		||||
#include "r300_reg.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* INSTR 0 */
 | 
			
		||||
 | 
			
		||||
#define PFS_OP_MAD	0
 | 
			
		||||
#define PFS_OP_DP3	1
 | 
			
		||||
#define PFS_OP_DP4	2
 | 
			
		||||
#define PFS_OP_MIN	4
 | 
			
		||||
#define PFS_OP_MAX	5
 | 
			
		||||
#define PFS_OP_CMP	8
 | 
			
		||||
#define PFS_OP_FRC	9
 | 
			
		||||
#define PFS_OP_OUTC_REPL_ALPHA	10
 | 
			
		||||
 | 
			
		||||
/* "or" these with arg0 value to negate or take absolute value of an argument */
 | 
			
		||||
#define PFS_ARG_NEG  (1<<5)
 | 
			
		||||
#define PFS_ARG_ABS  (1<<6)
 | 
			
		||||
 | 
			
		||||
#define MAKE_PFS_INSTR0(op, arg0, arg1, arg2, flags) \
 | 
			
		||||
	( ((op)<<23) \
 | 
			
		||||
	  | ((arg0)<<R300_FPI0_ARG0C_SHIFT) \
 | 
			
		||||
	  | ((arg1)<<R300_FPI0_ARG1C_SHIFT) \
 | 
			
		||||
	  | ((arg2)<<R300_FPI0_ARG2C_SHIFT) \
 | 
			
		||||
	  | (flags) \
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
#define PFS_FLAG_X	1
 | 
			
		||||
#define PFS_FLAG_Y	2
 | 
			
		||||
#define PFS_FLAG_XY	3
 | 
			
		||||
#define PFS_FLAG_Z	4
 | 
			
		||||
#define PFS_FLAG_XZ	5
 | 
			
		||||
#define PFS_FLAG_YZ	6
 | 
			
		||||
#define PFS_FLAG_ALL	7
 | 
			
		||||
#define PFS_FLAG_NONE	0
 | 
			
		||||
 | 
			
		||||
#define EASY_PFS_INSTR0(op, arg0, arg1, arg2) \
 | 
			
		||||
	MAKE_PFS_INSTR0(PFS_OP_##op, \
 | 
			
		||||
		R300_FPI0_ARGC_##arg0, \
 | 
			
		||||
		R300_FPI0_ARGC_##arg1, \
 | 
			
		||||
		R300_FPI0_ARGC_##arg2, \
 | 
			
		||||
		0)
 | 
			
		||||
 | 
			
		||||
/* INSTR 1 */
 | 
			
		||||
 | 
			
		||||
#define PFS_FLAG_CONST (1<<5)
 | 
			
		||||
 | 
			
		||||
#define MAKE_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
 | 
			
		||||
	((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
 | 
			
		||||
	  | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
 | 
			
		||||
	  | ((dstc) << R300_FPI1_DSTC_SHIFT) \
 | 
			
		||||
	  | ((reg) << 23) | ((output)<<26))
 | 
			
		||||
 | 
			
		||||
#define EASY_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
 | 
			
		||||
	MAKE_PFS_INSTR1(dstc, src0, src1, src2, PFS_FLAG_##reg, PFS_FLAG_##output)
 | 
			
		||||
 | 
			
		||||
/* INSTR 2 */
 | 
			
		||||
 | 
			
		||||
/* you can "or" PFS_ARG_NEG with these values to negate them */
 | 
			
		||||
 | 
			
		||||
#define MAKE_PFS_INSTR2(op, arg0, arg1, arg2, flags) \
 | 
			
		||||
	(((op) << 23) | \
 | 
			
		||||
	  ((arg0)<<R300_FPI2_ARG0A_SHIFT) | \
 | 
			
		||||
	  ((arg1)<<R300_FPI2_ARG1A_SHIFT) | \
 | 
			
		||||
	  ((arg2)<<R300_FPI2_ARG2A_SHIFT) | \
 | 
			
		||||
	  (flags))
 | 
			
		||||
 | 
			
		||||
#define EASY_PFS_INSTR2(op, arg0, arg1, arg2) \
 | 
			
		||||
	MAKE_PFS_INSTR2(R300_FPI2_OUTA_##op, \
 | 
			
		||||
		R300_FPI2_ARGA_##arg0, \
 | 
			
		||||
		R300_FPI2_ARGA_##arg1, \
 | 
			
		||||
		R300_FPI2_ARGA_##arg2, \
 | 
			
		||||
		0)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* INSTR 3 */
 | 
			
		||||
 | 
			
		||||
#define PFS_FLAG_NONE	0
 | 
			
		||||
#define PFS_FLAG_REG	1
 | 
			
		||||
#define PFS_FLAG_OUTPUT	2
 | 
			
		||||
#define PFS_FLAG_BOTH	3
 | 
			
		||||
 | 
			
		||||
#define MAKE_PFS_INSTR3(dstc, src0, src1, src2, flags) \
 | 
			
		||||
	((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
 | 
			
		||||
	  | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
 | 
			
		||||
	  | ((dstc) << R300_FPI1_DSTC_SHIFT) \
 | 
			
		||||
	  | ((flags) << 23))
 | 
			
		||||
 | 
			
		||||
#define EASY_PFS_INSTR3(dstc, src0, src1, src2, flag) \
 | 
			
		||||
	MAKE_PFS_INSTR3(dstc, src0, src1, src2, PFS_FLAG_##flag)
 | 
			
		||||
 | 
			
		||||
	/* What are 0's ORed with flags ? They are register numbers that
 | 
			
		||||
	   just happen to be 0 */
 | 
			
		||||
#define PFS_NOP	{ \
 | 
			
		||||
		EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO), \
 | 
			
		||||
		EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL), \
 | 
			
		||||
		EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO), \
 | 
			
		||||
		EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT) \
 | 
			
		||||
		} 
 | 
			
		||||
	
 | 
			
		||||
#endif
 | 
			
		||||
@@ -27,9 +27,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
**************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *   Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
/**
 | 
			
		||||
 * \file
 | 
			
		||||
 *
 | 
			
		||||
 * \author Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
@@ -52,15 +53,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#include "r300_emit.h"
 | 
			
		||||
#include "r300_state.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Set this to 1 for extremely verbose debugging of command buffers
 | 
			
		||||
#define DEBUG_CMDBUF		0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Send the current command buffer via ioctl to the hardware.
 | 
			
		||||
 */
 | 
			
		||||
int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller)
 | 
			
		||||
int r300FlushCmdBufLocked(r300ContextPtr r300, const char *caller)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
	int i;
 | 
			
		||||
@@ -83,22 +82,24 @@ int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller)
 | 
			
		||||
					r300->cmdbuf.cmd_buf[i]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cmd.buf = (char*)(r300->cmdbuf.cmd_buf + start);
 | 
			
		||||
	cmd.buf = (char *)(r300->cmdbuf.cmd_buf + start);
 | 
			
		||||
	cmd.bufsz = (r300->cmdbuf.count_used - start) * 4;
 | 
			
		||||
 | 
			
		||||
	if (r300->radeon.state.scissor.enabled) {
 | 
			
		||||
		cmd.nbox = r300->radeon.state.scissor.numClipRects;
 | 
			
		||||
		cmd.boxes = (drm_clip_rect_t *)r300->radeon.state.scissor.pClipRects;
 | 
			
		||||
		cmd.boxes =
 | 
			
		||||
		    (drm_clip_rect_t *) r300->radeon.state.scissor.pClipRects;
 | 
			
		||||
	} else {
 | 
			
		||||
		cmd.nbox = r300->radeon.numClipRects;
 | 
			
		||||
		cmd.boxes = (drm_clip_rect_t *)r300->radeon.pClipRects;
 | 
			
		||||
		cmd.boxes = (drm_clip_rect_t *) r300->radeon.pClipRects;
 | 
			
		||||
	}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
	ret = drmCommandWrite(r300->radeon.dri.fd,
 | 
			
		||||
			DRM_RADEON_CMDBUF, &cmd, sizeof(cmd));
 | 
			
		||||
	
 | 
			
		||||
			      DRM_RADEON_CMDBUF, &cmd, sizeof(cmd));
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & DEBUG_SYNC) {
 | 
			
		||||
		fprintf(stderr, "Syncing in %s (from %s)\n\n", __FUNCTION__, caller);
 | 
			
		||||
		fprintf(stderr, "Syncing in %s (from %s)\n\n",
 | 
			
		||||
			__FUNCTION__, caller);
 | 
			
		||||
		radeonWaitForIdleLocked(&r300->radeon);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -109,37 +110,36 @@ int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller)
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int r300FlushCmdBuf(r300ContextPtr r300, const char* caller)
 | 
			
		||||
int r300FlushCmdBuf(r300ContextPtr r300, const char *caller)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	LOCK_HARDWARE(&r300->radeon);
 | 
			
		||||
 | 
			
		||||
	ret=r300FlushCmdBufLocked(r300, caller);
 | 
			
		||||
	ret = r300FlushCmdBufLocked(r300, caller);
 | 
			
		||||
 | 
			
		||||
	UNLOCK_HARDWARE(&r300->radeon);
 | 
			
		||||
 | 
			
		||||
	if (ret) {
 | 
			
		||||
		fprintf(stderr, "drmRadeonCmdBuffer: %d (exiting)\n", ret);
 | 
			
		||||
		exit(ret);
 | 
			
		||||
		fprintf(stderr, "drmRadeonCmdBuffer: %d\n", ret);
 | 
			
		||||
		_mesa_exit(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void r300_print_state_atom(r300ContextPtr r300, struct r300_state_atom *state)
 | 
			
		||||
static void r300PrintStateAtom(r300ContextPtr r300, struct r300_state_atom *state)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
	int dwords = (*state->check)(r300, state);
 | 
			
		||||
	int dwords = (*state->check) (r300, state);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "  emit %s/%d/%d\n", state->name, dwords, state->cmd_size);
 | 
			
		||||
	fprintf(stderr, "  emit %s/%d/%d\n", state->name, dwords,
 | 
			
		||||
		state->cmd_size);
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & DEBUG_VERBOSE)
 | 
			
		||||
		for (i = 0; i < dwords; i++)
 | 
			
		||||
			fprintf(stderr, "      %s[%d]: %08X\n", state->name, i,
 | 
			
		||||
				state->cmd[i]);
 | 
			
		||||
			fprintf(stderr, "      %s[%d]: %08X\n",
 | 
			
		||||
				state->name, i, state->cmd[i]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -148,22 +148,23 @@ void r300_print_state_atom(r300ContextPtr r300, struct r300_state_atom *state)
 | 
			
		||||
 * The caller must have ensured that there is enough space in the command
 | 
			
		||||
 * buffer.
 | 
			
		||||
 */
 | 
			
		||||
static __inline__ void r300DoEmitState(r300ContextPtr r300, GLboolean dirty)
 | 
			
		||||
static __inline__ void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty)
 | 
			
		||||
{
 | 
			
		||||
	struct r300_state_atom* atom;
 | 
			
		||||
	uint32_t* dest;
 | 
			
		||||
	struct r300_state_atom *atom;
 | 
			
		||||
	uint32_t *dest;
 | 
			
		||||
 | 
			
		||||
	dest = r300->cmdbuf.cmd_buf + r300->cmdbuf.count_used;
 | 
			
		||||
 | 
			
		||||
	if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_STATE) {
 | 
			
		||||
		foreach(atom, &r300->hw.atomlist) {
 | 
			
		||||
			if ((atom->dirty || r300->hw.all_dirty) == dirty) {
 | 
			
		||||
				int dwords = (*atom->check)(r300, atom);
 | 
			
		||||
				int dwords = (*atom->check) (r300, atom);
 | 
			
		||||
 | 
			
		||||
				if (dwords)
 | 
			
		||||
					r300_print_state_atom(r300, atom);
 | 
			
		||||
					r300PrintStateAtom(r300, atom);
 | 
			
		||||
				else
 | 
			
		||||
					fprintf(stderr, "  skip state %s\n",
 | 
			
		||||
					fprintf(stderr,
 | 
			
		||||
						"  skip state %s\n",
 | 
			
		||||
						atom->name);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -171,32 +172,31 @@ static __inline__ void r300DoEmitState(r300ContextPtr r300, GLboolean dirty)
 | 
			
		||||
 | 
			
		||||
	/* Emit WAIT */
 | 
			
		||||
	*dest = cmdwait(R300_WAIT_3D | R300_WAIT_3D_CLEAN);
 | 
			
		||||
	dest ++;
 | 
			
		||||
	r300->cmdbuf.count_used ++;
 | 
			
		||||
	dest++;
 | 
			
		||||
	r300->cmdbuf.count_used++;
 | 
			
		||||
 | 
			
		||||
	/* Emit cache flush */
 | 
			
		||||
	*dest = cmdpacket0(R300_TX_CNTL, 1);
 | 
			
		||||
	dest ++;
 | 
			
		||||
	r300->cmdbuf.count_used ++;
 | 
			
		||||
	
 | 
			
		||||
	dest++;
 | 
			
		||||
	r300->cmdbuf.count_used++;
 | 
			
		||||
 | 
			
		||||
	*dest = R300_TX_FLUSH;
 | 
			
		||||
	dest ++;
 | 
			
		||||
	r300->cmdbuf.count_used ++;
 | 
			
		||||
	
 | 
			
		||||
	dest++;
 | 
			
		||||
	r300->cmdbuf.count_used++;
 | 
			
		||||
 | 
			
		||||
	/* Emit END3D */
 | 
			
		||||
	*dest = cmdpacify();
 | 
			
		||||
	dest ++;
 | 
			
		||||
	r300->cmdbuf.count_used ++;
 | 
			
		||||
	
 | 
			
		||||
	dest++;
 | 
			
		||||
	r300->cmdbuf.count_used++;
 | 
			
		||||
 | 
			
		||||
	/* Emit actual atoms */
 | 
			
		||||
 | 
			
		||||
	foreach(atom, &r300->hw.atomlist) {
 | 
			
		||||
		if ((atom->dirty || r300->hw.all_dirty) == dirty) {
 | 
			
		||||
			int dwords = (*atom->check)(r300, atom);
 | 
			
		||||
			int dwords = (*atom->check) (r300, atom);
 | 
			
		||||
 | 
			
		||||
			if (dwords) {
 | 
			
		||||
				memcpy(dest, atom->cmd, dwords*4);
 | 
			
		||||
				memcpy(dest, atom->cmd, dwords * 4);
 | 
			
		||||
				dest += dwords;
 | 
			
		||||
				r300->cmdbuf.count_used += dwords;
 | 
			
		||||
				atom->dirty = GL_FALSE;
 | 
			
		||||
@@ -216,7 +216,8 @@ void r300EmitState(r300ContextPtr r300)
 | 
			
		||||
	if (RADEON_DEBUG & (DEBUG_STATE | DEBUG_PRIMS))
 | 
			
		||||
		fprintf(stderr, "%s\n", __FUNCTION__);
 | 
			
		||||
 | 
			
		||||
	if (r300->cmdbuf.count_used && !r300->hw.is_dirty && !r300->hw.all_dirty)
 | 
			
		||||
	if (r300->cmdbuf.count_used && !r300->hw.is_dirty
 | 
			
		||||
	    && !r300->hw.all_dirty)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* To avoid going across the entire set of states multiple times, just check
 | 
			
		||||
@@ -229,14 +230,14 @@ void r300EmitState(r300ContextPtr r300)
 | 
			
		||||
		if (RADEON_DEBUG & DEBUG_STATE)
 | 
			
		||||
			fprintf(stderr, "Begin reemit state\n");
 | 
			
		||||
 | 
			
		||||
		r300DoEmitState(r300, GL_FALSE);
 | 
			
		||||
		r300EmitAtoms(r300, GL_FALSE);
 | 
			
		||||
		r300->cmdbuf.count_reemit = r300->cmdbuf.count_used;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & DEBUG_STATE)
 | 
			
		||||
		fprintf(stderr, "Begin dirty state\n");
 | 
			
		||||
 | 
			
		||||
	r300DoEmitState(r300, GL_TRUE);
 | 
			
		||||
	r300EmitAtoms(r300, GL_TRUE);
 | 
			
		||||
 | 
			
		||||
	assert(r300->cmdbuf.count_used < r300->cmdbuf.size);
 | 
			
		||||
 | 
			
		||||
@@ -255,25 +256,22 @@ static int check_##NM( r300ContextPtr r300, 		\
 | 
			
		||||
#define packet0_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->packet0.count)
 | 
			
		||||
#define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
 | 
			
		||||
 | 
			
		||||
CHECK( always, atom->cmd_size )
 | 
			
		||||
CHECK( variable, packet0_count(atom->cmd) ? (1 + packet0_count(atom->cmd)) : 0 )
 | 
			
		||||
CHECK( vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd)*4) : 0 )
 | 
			
		||||
 | 
			
		||||
CHECK(always, atom->cmd_size)
 | 
			
		||||
    CHECK(variable, packet0_count(atom->cmd) ? (1 + packet0_count(atom->cmd)) : 0)
 | 
			
		||||
    CHECK(vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd) * 4) : 0)
 | 
			
		||||
#undef packet0_count
 | 
			
		||||
#undef vpu_count
 | 
			
		||||
 | 
			
		||||
#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX )				\
 | 
			
		||||
#define ALLOC_STATE( ATOM, CHK, SZ, IDX )				\
 | 
			
		||||
   do {									\
 | 
			
		||||
      r300->hw.ATOM.cmd_size = (SZ);					\
 | 
			
		||||
      r300->hw.ATOM.cmd = (uint32_t*)CALLOC((SZ) * sizeof(uint32_t));	\
 | 
			
		||||
      r300->hw.ATOM.name = (NM);					\
 | 
			
		||||
      r300->hw.ATOM.name = #ATOM;					\
 | 
			
		||||
      r300->hw.ATOM.idx = (IDX);					\
 | 
			
		||||
      r300->hw.ATOM.check = check_##CHK;				\
 | 
			
		||||
      r300->hw.ATOM.dirty = GL_FALSE;					\
 | 
			
		||||
      r300->hw.max_state_size += (SZ);					\
 | 
			
		||||
      insert_at_tail(&r300->hw.atomlist, &r300->hw.ATOM);		\
 | 
			
		||||
   } while (0)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Allocate memory for the command buffer and initialize the state atom
 | 
			
		||||
 * list. Note that the initial hardware state is set by r300InitState().
 | 
			
		||||
@@ -284,304 +282,239 @@ void r300InitCmdBuf(r300ContextPtr r300)
 | 
			
		||||
	int has_tcl = 1;
 | 
			
		||||
 | 
			
		||||
	if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL))
 | 
			
		||||
 	      has_tcl = 0;
 | 
			
		||||
		has_tcl = 0;
 | 
			
		||||
 | 
			
		||||
	r300->hw.max_state_size = 2+2; /* reserve extra space for WAIT_IDLE and tex cache flush */
 | 
			
		||||
	r300->hw.max_state_size = 2 + 2;	/* reserve extra space for WAIT_IDLE and tex cache flush */
 | 
			
		||||
 | 
			
		||||
	mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
 | 
			
		||||
	if (RADEON_DEBUG & DEBUG_TEXTURE) {
 | 
			
		||||
		fprintf(stderr, "Using %d maximum texture units..\n", mtu);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Initialize state atoms */
 | 
			
		||||
	ALLOC_STATE( vpt, always, R300_VPT_CMDSIZE, "vpt", 0 );
 | 
			
		||||
	r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6);
 | 
			
		||||
	ALLOC_STATE( vap_cntl, always, 2, "vap_cntl", 0 );
 | 
			
		||||
	r300->hw.vap_cntl.cmd[0] = cmdpacket0(R300_VAP_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE( vte, always, 3, "vte", 0 );
 | 
			
		||||
	r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2);
 | 
			
		||||
	ALLOC_STATE( unk2134, always, 3, "unk2134", 0 );
 | 
			
		||||
	r300->hw.unk2134.cmd[0] = cmdpacket0(0x2134, 2);
 | 
			
		||||
	ALLOC_STATE( vap_cntl_status, always, 2, "vap_cntl_status", 0 );
 | 
			
		||||
	r300->hw.vap_cntl_status.cmd[0] = cmdpacket0(R300_VAP_CNTL_STATUS, 1);
 | 
			
		||||
	ALLOC_STATE( vir[0], variable, R300_VIR_CMDSIZE, "vir/0", 0 );
 | 
			
		||||
	r300->hw.vir[0].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1);
 | 
			
		||||
	ALLOC_STATE( vir[1], variable, R300_VIR_CMDSIZE, "vir/1", 1 );
 | 
			
		||||
	r300->hw.vir[1].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_1_0, 1);
 | 
			
		||||
	ALLOC_STATE( vic, always, R300_VIC_CMDSIZE, "vic", 0 );
 | 
			
		||||
	r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_INPUT_CNTL_0, 2);
 | 
			
		||||
	ALLOC_STATE( unk21DC, always, 2, "unk21DC", 0 );
 | 
			
		||||
	r300->hw.unk21DC.cmd[0] = cmdpacket0(0x21DC, 1);
 | 
			
		||||
	ALLOC_STATE( unk221C, always, 2, "unk221C", 0 );
 | 
			
		||||
	r300->hw.unk221C.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_221C, 1);
 | 
			
		||||
	ALLOC_STATE( unk2220, always, 5, "unk2220", 0 );
 | 
			
		||||
	r300->hw.unk2220.cmd[0] = cmdpacket0(0x2220, 4);
 | 
			
		||||
	ALLOC_STATE( unk2288, always, 2, "unk2288", 0 );
 | 
			
		||||
	r300->hw.unk2288.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_2288, 1);
 | 
			
		||||
	ALLOC_STATE( vof, always, R300_VOF_CMDSIZE, "vof", 0 );
 | 
			
		||||
	r300->hw.vof.cmd[R300_VOF_CMD_0] = cmdpacket0(R300_VAP_OUTPUT_VTX_FMT_0, 2);
 | 
			
		||||
	
 | 
			
		||||
	if (has_tcl) {
 | 
			
		||||
	  ALLOC_STATE( pvs, always, R300_PVS_CMDSIZE, "pvs", 0 );
 | 
			
		||||
	  r300->hw.pvs.cmd[R300_PVS_CMD_0] = cmdpacket0(R300_VAP_PVS_CNTL_1, 3);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE( gb_enable, always, 2, "gb_enable", 0 );
 | 
			
		||||
		r300->hw.gb_enable.cmd[0] = cmdpacket0(R300_GB_ENABLE, 1);
 | 
			
		||||
	ALLOC_STATE( gb_misc, always, R300_GB_MISC_CMDSIZE, "gb_misc", 0 );
 | 
			
		||||
		r300->hw.gb_misc.cmd[0] = cmdpacket0(R300_GB_MSPOS0, 5);
 | 
			
		||||
	ALLOC_STATE( txe, always, R300_TXE_CMDSIZE, "txe", 0 );
 | 
			
		||||
		r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1);
 | 
			
		||||
	ALLOC_STATE( unk4200, always, 5, "unk4200", 0 );
 | 
			
		||||
		r300->hw.unk4200.cmd[0] = cmdpacket0(0x4200, 4);
 | 
			
		||||
	ALLOC_STATE( unk4214, always, 2, "unk4214", 0 );
 | 
			
		||||
		r300->hw.unk4214.cmd[0] = cmdpacket0(0x4214, 1);
 | 
			
		||||
	ALLOC_STATE( ps, always, R300_PS_CMDSIZE, "ps", 0 );
 | 
			
		||||
		r300->hw.ps.cmd[0] = cmdpacket0(R300_RE_POINTSIZE, 1);
 | 
			
		||||
	ALLOC_STATE( unk4230, always, 4, "unk4230", 0 );
 | 
			
		||||
		r300->hw.unk4230.cmd[0] = cmdpacket0(0x4230, 3);
 | 
			
		||||
	ALLOC_STATE( lcntl, always, 2, "lcntl", 0 );
 | 
			
		||||
		r300->hw.lcntl.cmd[0] = cmdpacket0(R300_RE_LINE_CNT, 1);
 | 
			
		||||
	ALLOC_STATE( unk4260, always, 4, "unk4260", 0 );
 | 
			
		||||
		r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3);
 | 
			
		||||
	ALLOC_STATE( shade, always, 5, "shade", 0 );
 | 
			
		||||
		r300->hw.shade.cmd[0] = cmdpacket0(R300_RE_SHADE, 4);
 | 
			
		||||
	ALLOC_STATE( polygon_mode, always, 4, "polygon_mode", 0 );
 | 
			
		||||
		r300->hw.polygon_mode.cmd[0] = cmdpacket0(R300_RE_POLYGON_MODE, 3);
 | 
			
		||||
	ALLOC_STATE( fogp, always, 3, "fogp", 0 );
 | 
			
		||||
		r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2);
 | 
			
		||||
	ALLOC_STATE( zbias_cntl, always, 2, "zbias_cntl", 0 );
 | 
			
		||||
		r300->hw.zbias_cntl.cmd[0] = cmdpacket0(R300_RE_ZBIAS_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE( zbs, always, R300_ZBS_CMDSIZE, "zbs", 0 );
 | 
			
		||||
		r300->hw.zbs.cmd[R300_ZBS_CMD_0] = cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4);
 | 
			
		||||
	ALLOC_STATE( occlusion_cntl, always, 2, "occlusion_cntl", 0 );
 | 
			
		||||
		r300->hw.occlusion_cntl.cmd[0] = cmdpacket0(R300_RE_OCCLUSION_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE( cul, always, R300_CUL_CMDSIZE, "cul", 0 );
 | 
			
		||||
		r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE( unk42C0, always, 3, "unk42C0", 0 );
 | 
			
		||||
		r300->hw.unk42C0.cmd[0] = cmdpacket0(0x42C0, 2);
 | 
			
		||||
	ALLOC_STATE( rc, always, R300_RC_CMDSIZE, "rc", 0 );
 | 
			
		||||
		r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_CNTL_0, 2);
 | 
			
		||||
	ALLOC_STATE( ri, always, R300_RI_CMDSIZE, "ri", 0 );
 | 
			
		||||
		r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_INTERP_0, 8);
 | 
			
		||||
	ALLOC_STATE( rr, variable, R300_RR_CMDSIZE, "rr", 0 );
 | 
			
		||||
		r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1);
 | 
			
		||||
	ALLOC_STATE( unk43A4, always, 3, "unk43A4", 0 );
 | 
			
		||||
		r300->hw.unk43A4.cmd[0] = cmdpacket0(0x43A4, 2);
 | 
			
		||||
	ALLOC_STATE( unk43E8, always, 2, "unk43E8", 0 );
 | 
			
		||||
		r300->hw.unk43E8.cmd[0] = cmdpacket0(0x43E8, 1);
 | 
			
		||||
	ALLOC_STATE( fp, always, R300_FP_CMDSIZE, "fp", 0 );
 | 
			
		||||
		r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3);
 | 
			
		||||
		r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4);
 | 
			
		||||
	ALLOC_STATE( fpt, variable, R300_FPT_CMDSIZE, "fpt", 0 );
 | 
			
		||||
		r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0);
 | 
			
		||||
	ALLOC_STATE( unk46A4, always, 6, "unk46A4", 0 );
 | 
			
		||||
		r300->hw.unk46A4.cmd[0] = cmdpacket0(0x46A4, 5);
 | 
			
		||||
	ALLOC_STATE( fpi[0], variable, R300_FPI_CMDSIZE, "fpi/0", 0 );
 | 
			
		||||
		r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1);
 | 
			
		||||
	ALLOC_STATE( fpi[1], variable, R300_FPI_CMDSIZE, "fpi/1", 1 );
 | 
			
		||||
		r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, 1);
 | 
			
		||||
	ALLOC_STATE( fpi[2], variable, R300_FPI_CMDSIZE, "fpi/2", 2 );
 | 
			
		||||
		r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, 1);
 | 
			
		||||
	ALLOC_STATE( fpi[3], variable, R300_FPI_CMDSIZE, "fpi/3", 3 );
 | 
			
		||||
		r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1);
 | 
			
		||||
	ALLOC_STATE( fogs, always, R300_FOGS_CMDSIZE, "fogs", 0 );
 | 
			
		||||
		r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_RE_FOG_STATE, 1);
 | 
			
		||||
	ALLOC_STATE( fogc, always, R300_FOGC_CMDSIZE, "fogc", 0 );
 | 
			
		||||
		r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FOG_COLOR_R, 3);
 | 
			
		||||
	ALLOC_STATE( at, always, R300_AT_CMDSIZE, "at", 0 );
 | 
			
		||||
		r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_PP_ALPHA_TEST, 2);
 | 
			
		||||
	ALLOC_STATE( unk4BD8, always, 2, "unk4BD8", 0 );
 | 
			
		||||
		r300->hw.unk4BD8.cmd[0] = cmdpacket0(0x4BD8, 1);
 | 
			
		||||
	ALLOC_STATE( fpp, variable, R300_FPP_CMDSIZE, "fpp", 0 );
 | 
			
		||||
		r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0);
 | 
			
		||||
	ALLOC_STATE( unk4E00, always, 2, "unk4E00", 0 );
 | 
			
		||||
		r300->hw.unk4E00.cmd[0] = cmdpacket0(0x4E00, 1);
 | 
			
		||||
	ALLOC_STATE( bld, always, R300_BLD_CMDSIZE, "bld", 0 );
 | 
			
		||||
		r300->hw.bld.cmd[R300_BLD_CMD_0] = cmdpacket0(R300_RB3D_CBLEND, 2);
 | 
			
		||||
	ALLOC_STATE( cmk, always, R300_CMK_CMDSIZE, "cmk", 0 );
 | 
			
		||||
		r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1);
 | 
			
		||||
	ALLOC_STATE( blend_color, always, 4, "blend_color", 0 );
 | 
			
		||||
		r300->hw.blend_color.cmd[0] = cmdpacket0(R300_RB3D_BLEND_COLOR, 3);
 | 
			
		||||
	ALLOC_STATE( cb, always, R300_CB_CMDSIZE, "cb", 0 );
 | 
			
		||||
		r300->hw.cb.cmd[R300_CB_CMD_0] = cmdpacket0(R300_RB3D_COLOROFFSET0, 1);
 | 
			
		||||
		r300->hw.cb.cmd[R300_CB_CMD_1] = cmdpacket0(R300_RB3D_COLORPITCH0, 1);
 | 
			
		||||
	ALLOC_STATE( unk4E50, always, 10, "unk4E50", 0 );
 | 
			
		||||
		r300->hw.unk4E50.cmd[0] = cmdpacket0(0x4E50, 9);
 | 
			
		||||
	ALLOC_STATE( unk4E88, always, 2, "unk4E88", 0 );
 | 
			
		||||
		r300->hw.unk4E88.cmd[0] = cmdpacket0(0x4E88, 1);
 | 
			
		||||
	ALLOC_STATE( unk4EA0, always, 3, "unk4EA0 R350 only", 0 );
 | 
			
		||||
		r300->hw.unk4EA0.cmd[0] = cmdpacket0(0x4EA0, 2);
 | 
			
		||||
	ALLOC_STATE( zs, always, R300_ZS_CMDSIZE, "zstencil", 0 );
 | 
			
		||||
		r300->hw.zs.cmd[R300_ZS_CMD_0] = cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3);
 | 
			
		||||
	ALLOC_STATE( zstencil_format, always, 5, "zstencil_format", 0 );
 | 
			
		||||
	r300->hw.zstencil_format.cmd[0] = cmdpacket0(R300_RB3D_ZSTENCIL_FORMAT, 4);
 | 
			
		||||
	ALLOC_STATE( zb, always, R300_ZB_CMDSIZE, "zb", 0 );
 | 
			
		||||
	r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_RB3D_DEPTHOFFSET, 2);
 | 
			
		||||
	ALLOC_STATE( unk4F28, always, 2, "unk4F28", 0 );
 | 
			
		||||
	r300->hw.unk4F28.cmd[0] = cmdpacket0(0x4F28, 1);
 | 
			
		||||
	ALLOC_STATE( unk4F30, always, 3, "unk4F30", 0 );
 | 
			
		||||
	r300->hw.unk4F30.cmd[0] = cmdpacket0(0x4F30, 2);
 | 
			
		||||
	ALLOC_STATE( unk4F44, always, 2, "unk4F44", 0 );
 | 
			
		||||
	r300->hw.unk4F44.cmd[0] = cmdpacket0(0x4F44, 1);
 | 
			
		||||
	ALLOC_STATE( unk4F54, always, 2, "unk4F54", 0 );
 | 
			
		||||
	r300->hw.unk4F54.cmd[0] = cmdpacket0(0x4F54, 1);
 | 
			
		||||
 | 
			
		||||
	/* VPU only on TCL */
 | 
			
		||||
	if (has_tcl) {
 | 
			
		||||
	  ALLOC_STATE( vpi, vpu, R300_VPI_CMDSIZE, "vpi", 0 );
 | 
			
		||||
	  r300->hw.vpi.cmd[R300_VPI_CMD_0] = cmdvpu(R300_PVS_UPLOAD_PROGRAM, 0);
 | 
			
		||||
	  ALLOC_STATE( vpp, vpu, R300_VPP_CMDSIZE, "vpp", 0 );
 | 
			
		||||
	  r300->hw.vpp.cmd[R300_VPP_CMD_0] = cmdvpu(R300_PVS_UPLOAD_PARAMETERS, 0);
 | 
			
		||||
	  ALLOC_STATE( vps, vpu, R300_VPS_CMDSIZE, "vps", 0 );
 | 
			
		||||
	  r300->hw.vps.cmd[R300_VPS_CMD_0] = cmdvpu(R300_PVS_UPLOAD_POINTSIZE, 1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Textures */
 | 
			
		||||
	ALLOC_STATE( tex.filter, variable, mtu+1, "tex_filter", 0 );
 | 
			
		||||
	r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FILTER_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE( tex.filter_1, variable, mtu+1, "tex_filter_1", 0 );
 | 
			
		||||
	r300->hw.tex.filter_1.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FILTER1_0, 0);
 | 
			
		||||
	
 | 
			
		||||
	ALLOC_STATE( tex.size, variable, mtu+1, "tex_size", 0 );
 | 
			
		||||
	r300->hw.tex.size.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_SIZE_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE( tex.format, variable, mtu+1, "tex_format", 0 );
 | 
			
		||||
	r300->hw.tex.format.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FORMAT_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE( tex.pitch, variable, mtu+1, "tex_pitch", 0 );
 | 
			
		||||
	r300->hw.tex.pitch.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_PITCH_0, 0);
 | 
			
		||||
	
 | 
			
		||||
	ALLOC_STATE( tex.offset, variable, mtu+1, "tex_offset", 0 );
 | 
			
		||||
	r300->hw.tex.offset.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_OFFSET_0, 0);
 | 
			
		||||
	
 | 
			
		||||
	ALLOC_STATE( tex.chroma_key, variable, mtu+1, "tex_chroma_key", 0 );
 | 
			
		||||
	r300->hw.tex.chroma_key.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_CHROMA_KEY_0, 0);
 | 
			
		||||
	
 | 
			
		||||
	ALLOC_STATE( tex.border_color, variable, mtu+1, "tex_border_color", 0 );
 | 
			
		||||
	r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_BORDER_COLOR_0, 0);
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	/* Setup the atom linked list */
 | 
			
		||||
	make_empty_list(&r300->hw.atomlist);
 | 
			
		||||
	r300->hw.atomlist.name = "atom-list";
 | 
			
		||||
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vpt);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vap_cntl);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vte);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2134);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vap_cntl_status);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vir[0]);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vir[1]);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vic);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk21DC);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk221C);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2220);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2288);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.vof);
 | 
			
		||||
 | 
			
		||||
	if (has_tcl)
 | 
			
		||||
	  insert_at_tail(&r300->hw.atomlist, &r300->hw.pvs);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.gb_enable);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.gb_misc);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.txe);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4200);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4214);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.ps);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4230);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.lcntl);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4260);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.shade);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.polygon_mode);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fogp);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.zbias_cntl);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.zbs);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.occlusion_cntl);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.cul);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42C0);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.rc);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.ri);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.rr);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43A4);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43E8);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fp);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fpt);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk46A4);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[0]);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[1]);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[2]);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[3]);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fogs);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fogc);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.at);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4BD8);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.fpp);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E00);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.bld);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.cmk);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.blend_color);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.cb);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E50);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E88);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4EA0);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.zs);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.zstencil_format);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.zb);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F28);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F30);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F44);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F54);
 | 
			
		||||
	/* Initialize state atoms */
 | 
			
		||||
	ALLOC_STATE(vpt, always, R300_VPT_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6);
 | 
			
		||||
	ALLOC_STATE(vap_cntl, always, 2, 0);
 | 
			
		||||
	r300->hw.vap_cntl.cmd[0] = cmdpacket0(R300_VAP_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE(vte, always, 3, 0);
 | 
			
		||||
	r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2);
 | 
			
		||||
	ALLOC_STATE(unk2134, always, 3, 0);
 | 
			
		||||
	r300->hw.unk2134.cmd[0] = cmdpacket0(0x2134, 2);
 | 
			
		||||
	ALLOC_STATE(vap_cntl_status, always, 2, 0);
 | 
			
		||||
	r300->hw.vap_cntl_status.cmd[0] = cmdpacket0(R300_VAP_CNTL_STATUS, 1);
 | 
			
		||||
	ALLOC_STATE(vir[0], variable, R300_VIR_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.vir[0].cmd[R300_VIR_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1);
 | 
			
		||||
	ALLOC_STATE(vir[1], variable, R300_VIR_CMDSIZE, 1);
 | 
			
		||||
	r300->hw.vir[1].cmd[R300_VIR_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_VAP_INPUT_ROUTE_1_0, 1);
 | 
			
		||||
	ALLOC_STATE(vic, always, R300_VIC_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_INPUT_CNTL_0, 2);
 | 
			
		||||
	ALLOC_STATE(unk21DC, always, 2, 0);
 | 
			
		||||
	r300->hw.unk21DC.cmd[0] = cmdpacket0(0x21DC, 1);
 | 
			
		||||
	ALLOC_STATE(unk221C, always, 2, 0);
 | 
			
		||||
	r300->hw.unk221C.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_221C, 1);
 | 
			
		||||
	ALLOC_STATE(unk2220, always, 5, 0);
 | 
			
		||||
	r300->hw.unk2220.cmd[0] = cmdpacket0(0x2220, 4);
 | 
			
		||||
	ALLOC_STATE(unk2288, always, 2, 0);
 | 
			
		||||
	r300->hw.unk2288.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_2288, 1);
 | 
			
		||||
	ALLOC_STATE(vof, always, R300_VOF_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.vof.cmd[R300_VOF_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_VAP_OUTPUT_VTX_FMT_0, 2);
 | 
			
		||||
 | 
			
		||||
	if (has_tcl) {
 | 
			
		||||
	  insert_at_tail(&r300->hw.atomlist, &r300->hw.vpi);
 | 
			
		||||
	  insert_at_tail(&r300->hw.atomlist, &r300->hw.vpp);
 | 
			
		||||
	  insert_at_tail(&r300->hw.atomlist, &r300->hw.vps);
 | 
			
		||||
		ALLOC_STATE(pvs, always, R300_PVS_CMDSIZE, 0);
 | 
			
		||||
		r300->hw.pvs.cmd[R300_PVS_CMD_0] =
 | 
			
		||||
		    cmdpacket0(R300_VAP_PVS_CNTL_1, 3);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.filter);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.filter_1);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.size);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.format);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.pitch);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.offset);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.chroma_key);
 | 
			
		||||
	insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.border_color);
 | 
			
		||||
	ALLOC_STATE(gb_enable, always, 2, 0);
 | 
			
		||||
	r300->hw.gb_enable.cmd[0] = cmdpacket0(R300_GB_ENABLE, 1);
 | 
			
		||||
	ALLOC_STATE(gb_misc, always, R300_GB_MISC_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.gb_misc.cmd[0] = cmdpacket0(R300_GB_MSPOS0, 5);
 | 
			
		||||
	ALLOC_STATE(txe, always, R300_TXE_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1);
 | 
			
		||||
	ALLOC_STATE(unk4200, always, 5, 0);
 | 
			
		||||
	r300->hw.unk4200.cmd[0] = cmdpacket0(0x4200, 4);
 | 
			
		||||
	ALLOC_STATE(unk4214, always, 2, 0);
 | 
			
		||||
	r300->hw.unk4214.cmd[0] = cmdpacket0(0x4214, 1);
 | 
			
		||||
	ALLOC_STATE(ps, always, R300_PS_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.ps.cmd[0] = cmdpacket0(R300_RE_POINTSIZE, 1);
 | 
			
		||||
	ALLOC_STATE(unk4230, always, 4, 0);
 | 
			
		||||
	r300->hw.unk4230.cmd[0] = cmdpacket0(0x4230, 3);
 | 
			
		||||
	ALLOC_STATE(lcntl, always, 2, 0);
 | 
			
		||||
	r300->hw.lcntl.cmd[0] = cmdpacket0(R300_RE_LINE_CNT, 1);
 | 
			
		||||
	ALLOC_STATE(unk4260, always, 4, 0);
 | 
			
		||||
	r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3);
 | 
			
		||||
	ALLOC_STATE(shade, always, 5, 0);
 | 
			
		||||
	r300->hw.shade.cmd[0] = cmdpacket0(R300_RE_SHADE, 4);
 | 
			
		||||
	ALLOC_STATE(polygon_mode, always, 4, 0);
 | 
			
		||||
	r300->hw.polygon_mode.cmd[0] = cmdpacket0(R300_RE_POLYGON_MODE, 3);
 | 
			
		||||
	ALLOC_STATE(fogp, always, 3, 0);
 | 
			
		||||
	r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2);
 | 
			
		||||
	ALLOC_STATE(zbias_cntl, always, 2, 0);
 | 
			
		||||
	r300->hw.zbias_cntl.cmd[0] = cmdpacket0(R300_RE_ZBIAS_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE(zbs, always, R300_ZBS_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.zbs.cmd[R300_ZBS_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4);
 | 
			
		||||
	ALLOC_STATE(occlusion_cntl, always, 2, 0);
 | 
			
		||||
	r300->hw.occlusion_cntl.cmd[0] = cmdpacket0(R300_RE_OCCLUSION_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE(cul, always, R300_CUL_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1);
 | 
			
		||||
	ALLOC_STATE(unk42C0, always, 3, 0);
 | 
			
		||||
	r300->hw.unk42C0.cmd[0] = cmdpacket0(0x42C0, 2);
 | 
			
		||||
	ALLOC_STATE(rc, always, R300_RC_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_CNTL_0, 2);
 | 
			
		||||
	ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_INTERP_0, 8);
 | 
			
		||||
	ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1);
 | 
			
		||||
	ALLOC_STATE(unk43A4, always, 3, 0);
 | 
			
		||||
	r300->hw.unk43A4.cmd[0] = cmdpacket0(0x43A4, 2);
 | 
			
		||||
	ALLOC_STATE(unk43E8, always, 2, 0);
 | 
			
		||||
	r300->hw.unk43E8.cmd[0] = cmdpacket0(0x43E8, 1);
 | 
			
		||||
	ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3);
 | 
			
		||||
	r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4);
 | 
			
		||||
	ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0);
 | 
			
		||||
	ALLOC_STATE(unk46A4, always, 6, 0);
 | 
			
		||||
	r300->hw.unk46A4.cmd[0] = cmdpacket0(0x46A4, 5);
 | 
			
		||||
	ALLOC_STATE(fpi[0], variable, R300_FPI_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1);
 | 
			
		||||
	ALLOC_STATE(fpi[1], variable, R300_FPI_CMDSIZE, 1);
 | 
			
		||||
	r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, 1);
 | 
			
		||||
	ALLOC_STATE(fpi[2], variable, R300_FPI_CMDSIZE, 2);
 | 
			
		||||
	r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, 1);
 | 
			
		||||
	ALLOC_STATE(fpi[3], variable, R300_FPI_CMDSIZE, 3);
 | 
			
		||||
	r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1);
 | 
			
		||||
	ALLOC_STATE(fogs, always, R300_FOGS_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_RE_FOG_STATE, 1);
 | 
			
		||||
	ALLOC_STATE(fogc, always, R300_FOGC_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FOG_COLOR_R, 3);
 | 
			
		||||
	ALLOC_STATE(at, always, R300_AT_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_PP_ALPHA_TEST, 2);
 | 
			
		||||
	ALLOC_STATE(unk4BD8, always, 2, 0);
 | 
			
		||||
	r300->hw.unk4BD8.cmd[0] = cmdpacket0(0x4BD8, 1);
 | 
			
		||||
	ALLOC_STATE(fpp, variable, R300_FPP_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0);
 | 
			
		||||
	ALLOC_STATE(unk4E00, always, 2, 0);
 | 
			
		||||
	r300->hw.unk4E00.cmd[0] = cmdpacket0(0x4E00, 1);
 | 
			
		||||
	ALLOC_STATE(bld, always, R300_BLD_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.bld.cmd[R300_BLD_CMD_0] = cmdpacket0(R300_RB3D_CBLEND, 2);
 | 
			
		||||
	ALLOC_STATE(cmk, always, R300_CMK_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1);
 | 
			
		||||
	ALLOC_STATE(blend_color, always, 4, 0);
 | 
			
		||||
	r300->hw.blend_color.cmd[0] = cmdpacket0(R300_RB3D_BLEND_COLOR, 3);
 | 
			
		||||
	ALLOC_STATE(cb, always, R300_CB_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.cb.cmd[R300_CB_CMD_0] = cmdpacket0(R300_RB3D_COLOROFFSET0, 1);
 | 
			
		||||
	r300->hw.cb.cmd[R300_CB_CMD_1] = cmdpacket0(R300_RB3D_COLORPITCH0, 1);
 | 
			
		||||
	ALLOC_STATE(unk4E50, always, 10, 0);
 | 
			
		||||
	r300->hw.unk4E50.cmd[0] = cmdpacket0(0x4E50, 9);
 | 
			
		||||
	ALLOC_STATE(unk4E88, always, 2, 0);
 | 
			
		||||
	r300->hw.unk4E88.cmd[0] = cmdpacket0(0x4E88, 1);
 | 
			
		||||
	ALLOC_STATE(unk4EA0, always, 3, 0);
 | 
			
		||||
	r300->hw.unk4EA0.cmd[0] = cmdpacket0(0x4EA0, 2);
 | 
			
		||||
	ALLOC_STATE(zs, always, R300_ZS_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.zs.cmd[R300_ZS_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3);
 | 
			
		||||
	ALLOC_STATE(zstencil_format, always, 5, 0);
 | 
			
		||||
	r300->hw.zstencil_format.cmd[0] =
 | 
			
		||||
	    cmdpacket0(R300_RB3D_ZSTENCIL_FORMAT, 4);
 | 
			
		||||
	ALLOC_STATE(zb, always, R300_ZB_CMDSIZE, 0);
 | 
			
		||||
	r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_RB3D_DEPTHOFFSET, 2);
 | 
			
		||||
	ALLOC_STATE(unk4F28, always, 2, 0);
 | 
			
		||||
	r300->hw.unk4F28.cmd[0] = cmdpacket0(0x4F28, 1);
 | 
			
		||||
	ALLOC_STATE(unk4F30, always, 3, 0);
 | 
			
		||||
	r300->hw.unk4F30.cmd[0] = cmdpacket0(0x4F30, 2);
 | 
			
		||||
	ALLOC_STATE(unk4F44, always, 2, 0);
 | 
			
		||||
	r300->hw.unk4F44.cmd[0] = cmdpacket0(0x4F44, 1);
 | 
			
		||||
	ALLOC_STATE(unk4F54, always, 2, 0);
 | 
			
		||||
	r300->hw.unk4F54.cmd[0] = cmdpacket0(0x4F54, 1);
 | 
			
		||||
 | 
			
		||||
	/* VPU only on TCL */
 | 
			
		||||
	if (has_tcl) {
 | 
			
		||||
		ALLOC_STATE(vpi, vpu, R300_VPI_CMDSIZE, 0);
 | 
			
		||||
		r300->hw.vpi.cmd[R300_VPI_CMD_0] =
 | 
			
		||||
		    cmdvpu(R300_PVS_UPLOAD_PROGRAM, 0);
 | 
			
		||||
		ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0);
 | 
			
		||||
		r300->hw.vpp.cmd[R300_VPP_CMD_0] =
 | 
			
		||||
		    cmdvpu(R300_PVS_UPLOAD_PARAMETERS, 0);
 | 
			
		||||
		ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0);
 | 
			
		||||
		r300->hw.vps.cmd[R300_VPS_CMD_0] =
 | 
			
		||||
		    cmdvpu(R300_PVS_UPLOAD_POINTSIZE, 1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Textures */
 | 
			
		||||
	ALLOC_STATE(tex.filter, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.filter.cmd[R300_TEX_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_TX_FILTER_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE(tex.filter_1, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.filter_1.cmd[R300_TEX_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_TX_FILTER1_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE(tex.size, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.size.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_SIZE_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE(tex.format, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.format.cmd[R300_TEX_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_TX_FORMAT_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE(tex.pitch, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.pitch.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_PITCH_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE(tex.offset, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.offset.cmd[R300_TEX_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_TX_OFFSET_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE(tex.chroma_key, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.chroma_key.cmd[R300_TEX_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_TX_CHROMA_KEY_0, 0);
 | 
			
		||||
 | 
			
		||||
	ALLOC_STATE(tex.border_color, variable, mtu + 1, 0);
 | 
			
		||||
	r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] =
 | 
			
		||||
	    cmdpacket0(R300_TX_BORDER_COLOR_0, 0);
 | 
			
		||||
 | 
			
		||||
	r300->hw.is_dirty = GL_TRUE;
 | 
			
		||||
	r300->hw.all_dirty = GL_TRUE;
 | 
			
		||||
 | 
			
		||||
	/* Initialize command buffer */
 | 
			
		||||
	size = 256 * driQueryOptioni(&r300->radeon.optionCache, "command_buffer_size");
 | 
			
		||||
	if (size < 2*r300->hw.max_state_size) {
 | 
			
		||||
		size = 2*r300->hw.max_state_size+65535;
 | 
			
		||||
	size =
 | 
			
		||||
	    256 * driQueryOptioni(&r300->radeon.optionCache,
 | 
			
		||||
				  "command_buffer_size");
 | 
			
		||||
	if (size < 2 * r300->hw.max_state_size) {
 | 
			
		||||
		size = 2 * r300->hw.max_state_size + 65535;
 | 
			
		||||
	}
 | 
			
		||||
	if (size > 64*256)
 | 
			
		||||
		size = 64*256;
 | 
			
		||||
	if (size > 64 * 256)
 | 
			
		||||
		size = 64 * 256;
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA)) {
 | 
			
		||||
	if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) {
 | 
			
		||||
		fprintf(stderr, "sizeof(drm_r300_cmd_header_t)=%zd\n",
 | 
			
		||||
			sizeof(drm_r300_cmd_header_t));
 | 
			
		||||
		fprintf(stderr, "sizeof(drm_radeon_cmd_buffer_t)=%zd\n",
 | 
			
		||||
			sizeof(drm_radeon_cmd_buffer_t));
 | 
			
		||||
		fprintf(stderr,
 | 
			
		||||
			"Allocating %d bytes command buffer (max state is %d bytes)\n",
 | 
			
		||||
			size*4, r300->hw.max_state_size*4);
 | 
			
		||||
			size * 4, r300->hw.max_state_size * 4);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	r300->cmdbuf.size = size;
 | 
			
		||||
	r300->cmdbuf.cmd_buf = (uint32_t*)CALLOC(size*4);
 | 
			
		||||
	r300->cmdbuf.cmd_buf = (uint32_t *) CALLOC(size * 4);
 | 
			
		||||
	r300->cmdbuf.count_used = 0;
 | 
			
		||||
	r300->cmdbuf.count_reemit = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Destroy the command buffer and state atoms.
 | 
			
		||||
 */
 | 
			
		||||
void r300DestroyCmdBuf(r300ContextPtr r300)
 | 
			
		||||
{
 | 
			
		||||
	struct r300_state_atom* atom;
 | 
			
		||||
	struct r300_state_atom *atom;
 | 
			
		||||
 | 
			
		||||
	FREE(r300->cmdbuf.cmd_buf);
 | 
			
		||||
 | 
			
		||||
@@ -614,8 +547,7 @@ void r300EmitBlit(r300ContextPtr rmesa,
 | 
			
		||||
	assert(w < (1 << 16));
 | 
			
		||||
	assert(h < (1 << 16));
 | 
			
		||||
 | 
			
		||||
	cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 8,
 | 
			
		||||
							__FUNCTION__);
 | 
			
		||||
	cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 8, __FUNCTION__);
 | 
			
		||||
 | 
			
		||||
	cmd[0].header.cmd_type = R300_CMD_PACKET3;
 | 
			
		||||
	cmd[0].header.pad0 = R300_CMD_PACKET3_RAW;
 | 
			
		||||
@@ -642,44 +574,8 @@ void r300EmitWait(r300ContextPtr rmesa, GLuint flags)
 | 
			
		||||
 | 
			
		||||
	assert(!(flags & ~(R300_WAIT_2D | R300_WAIT_3D)));
 | 
			
		||||
 | 
			
		||||
	cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 1,
 | 
			
		||||
							__FUNCTION__);
 | 
			
		||||
	cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__);
 | 
			
		||||
	cmd[0].u = 0;
 | 
			
		||||
	cmd[0].wait.cmd_type = R300_CMD_WAIT;
 | 
			
		||||
	cmd[0].wait.flags = flags;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset)
 | 
			
		||||
{
 | 
			
		||||
	int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2;
 | 
			
		||||
	int i;
 | 
			
		||||
	int cmd_reserved = 0;
 | 
			
		||||
	int cmd_written = 0;
 | 
			
		||||
	drm_radeon_cmd_header_t *cmd = NULL;
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & DEBUG_VERTS)
 | 
			
		||||
	    fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset);
 | 
			
		||||
 | 
			
		||||
	start_packet3(RADEON_CP_PACKET3_3D_LOAD_VBPNTR, sz-1);
 | 
			
		||||
	e32(nr);
 | 
			
		||||
	for(i=0;i+1<nr;i+=2){
 | 
			
		||||
		e32(  (rmesa->state.aos[i].aos_size << 0)
 | 
			
		||||
		      |(rmesa->state.aos[i].aos_stride << 8)
 | 
			
		||||
		      |(rmesa->state.aos[i+1].aos_size << 16)
 | 
			
		||||
		      |(rmesa->state.aos[i+1].aos_stride << 24)
 | 
			
		||||
			);
 | 
			
		||||
		e32(rmesa->state.aos[i].aos_offset +
 | 
			
		||||
		    offset*4*rmesa->state.aos[i].aos_stride);
 | 
			
		||||
		e32(rmesa->state.aos[i+1].aos_offset +
 | 
			
		||||
		    offset*4*rmesa->state.aos[i+1].aos_stride);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(nr & 1){
 | 
			
		||||
		e32(  (rmesa->state.aos[nr-1].aos_size << 0)
 | 
			
		||||
		      |(rmesa->state.aos[nr-1].aos_stride << 8)
 | 
			
		||||
			);
 | 
			
		||||
		e32(rmesa->state.aos[nr-1].aos_offset + 
 | 
			
		||||
		    offset*4*rmesa->state.aos[nr-1].aos_stride);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,9 +27,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
**************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *   Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
/**
 | 
			
		||||
 * \file
 | 
			
		||||
 *
 | 
			
		||||
 * \author Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __R300_CMDBUF_H__
 | 
			
		||||
@@ -37,24 +38,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
#include "r300_context.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller);
 | 
			
		||||
extern int r300FlushCmdBuf(r300ContextPtr r300, const char* caller);
 | 
			
		||||
extern int r300FlushCmdBufLocked(r300ContextPtr r300, const char *caller);
 | 
			
		||||
extern int r300FlushCmdBuf(r300ContextPtr r300, const char *caller);
 | 
			
		||||
 | 
			
		||||
extern void r300EmitState(r300ContextPtr r300);
 | 
			
		||||
 | 
			
		||||
extern void r300InitCmdBuf(r300ContextPtr r300);
 | 
			
		||||
extern void r300DestroyCmdBuf(r300ContextPtr r300);
 | 
			
		||||
 | 
			
		||||
extern void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Make sure that enough space is available in the command buffer
 | 
			
		||||
 * by flushing if necessary.
 | 
			
		||||
 *
 | 
			
		||||
 * \param dwords The number of dwords we need to be free on the command buffer
 | 
			
		||||
 */
 | 
			
		||||
static __inline__ void r300EnsureCmdBufSpace(r300ContextPtr r300,
 | 
			
		||||
					     int dwords, const char* caller)
 | 
			
		||||
					     int dwords, const char *caller)
 | 
			
		||||
{
 | 
			
		||||
	assert(dwords < r300->cmdbuf.size);
 | 
			
		||||
 | 
			
		||||
@@ -62,7 +61,6 @@ static __inline__ void r300EnsureCmdBufSpace(r300ContextPtr r300,
 | 
			
		||||
		r300FlushCmdBuf(r300, caller);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Allocate the given number of dwords in the command buffer and return
 | 
			
		||||
 * a pointer to the allocated area.
 | 
			
		||||
@@ -70,10 +68,10 @@ static __inline__ void r300EnsureCmdBufSpace(r300ContextPtr r300,
 | 
			
		||||
 * causes state reemission after a flush. This is necessary to ensure
 | 
			
		||||
 * correct hardware state after an unlock.
 | 
			
		||||
 */
 | 
			
		||||
static __inline__ uint32_t* r300RawAllocCmdBuf(r300ContextPtr r300,
 | 
			
		||||
					       int dwords, const char* caller)
 | 
			
		||||
static __inline__ uint32_t *r300RawAllocCmdBuf(r300ContextPtr r300,
 | 
			
		||||
					       int dwords, const char *caller)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t* ptr;
 | 
			
		||||
	uint32_t *ptr;
 | 
			
		||||
 | 
			
		||||
	r300EnsureCmdBufSpace(r300, dwords, caller);
 | 
			
		||||
 | 
			
		||||
@@ -82,17 +80,17 @@ static __inline__ uint32_t* r300RawAllocCmdBuf(r300ContextPtr r300,
 | 
			
		||||
	return ptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static __inline__ uint32_t* r300AllocCmdBuf(r300ContextPtr r300,
 | 
			
		||||
					    int dwords, const char* caller)
 | 
			
		||||
static __inline__ uint32_t *r300AllocCmdBuf(r300ContextPtr r300,
 | 
			
		||||
					    int dwords, const char *caller)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t* ptr;
 | 
			
		||||
	uint32_t *ptr;
 | 
			
		||||
 | 
			
		||||
	r300EnsureCmdBufSpace(r300, dwords, caller);
 | 
			
		||||
 | 
			
		||||
	if (!r300->cmdbuf.count_used) {
 | 
			
		||||
		if (RADEON_DEBUG & DEBUG_IOCTL)
 | 
			
		||||
			fprintf(stderr, "Reemit state after flush (from %s)\n",
 | 
			
		||||
				caller);
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"Reemit state after flush (from %s)\n", caller);
 | 
			
		||||
		r300EmitState(r300);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -102,17 +100,17 @@ static __inline__ uint32_t* r300AllocCmdBuf(r300ContextPtr r300,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void r300EmitBlit(r300ContextPtr rmesa,
 | 
			
		||||
		  GLuint color_fmt,
 | 
			
		||||
		  GLuint src_pitch,
 | 
			
		||||
		  GLuint src_offset,
 | 
			
		||||
		  GLuint dst_pitch,
 | 
			
		||||
		  GLuint dst_offset,
 | 
			
		||||
		  GLint srcx, GLint srcy,
 | 
			
		||||
		  GLint dstx, GLint dsty, GLuint w, GLuint h);
 | 
			
		||||
			 GLuint color_fmt,
 | 
			
		||||
			 GLuint src_pitch,
 | 
			
		||||
			 GLuint src_offset,
 | 
			
		||||
			 GLuint dst_pitch,
 | 
			
		||||
			 GLuint dst_offset,
 | 
			
		||||
			 GLint srcx, GLint srcy,
 | 
			
		||||
			 GLint dstx, GLint dsty, GLuint w, GLuint h);
 | 
			
		||||
 | 
			
		||||
extern void r300EmitWait(r300ContextPtr rmesa, GLuint flags);
 | 
			
		||||
extern void r300EmitLOAD_VBPNTR(r300ContextPtr rmesa, int start);
 | 
			
		||||
extern void r300EmitVertexShader(r300ContextPtr rmesa);
 | 
			
		||||
extern void r300EmitPixelShader(r300ContextPtr rmesa);
 | 
			
		||||
 | 
			
		||||
#endif /* __R300_CMDBUF_H__ */
 | 
			
		||||
#endif				/* __R300_CMDBUF_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -27,11 +27,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
**************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *   Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
 *   Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
/**
 | 
			
		||||
 * \file
 | 
			
		||||
 *
 | 
			
		||||
 * \author Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
 *
 | 
			
		||||
 * \author Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
#include "api_arrayelt.h"
 | 
			
		||||
#include "context.h"
 | 
			
		||||
@@ -59,10 +62,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#include "r300_state.h"
 | 
			
		||||
#include "r300_ioctl.h"
 | 
			
		||||
#include "r300_tex.h"
 | 
			
		||||
#include "r300_maos.h"
 | 
			
		||||
#include "r300_emit.h"
 | 
			
		||||
 | 
			
		||||
#ifdef USER_BUFFERS
 | 
			
		||||
#include "radeon_mm.h"
 | 
			
		||||
#include "r300_mem.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "vblank.h"
 | 
			
		||||
@@ -70,8 +73,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#include "xmlpool.h"		/* for symbolic values of enum-type options */
 | 
			
		||||
 | 
			
		||||
/* hw_tcl_on derives from future_hw_tcl_on when its safe to change it. */
 | 
			
		||||
int future_hw_tcl_on=1;
 | 
			
		||||
int hw_tcl_on=1;
 | 
			
		||||
int future_hw_tcl_on = 1;
 | 
			
		||||
int hw_tcl_on = 1;
 | 
			
		||||
 | 
			
		||||
#define need_GL_EXT_stencil_two_side
 | 
			
		||||
#define need_GL_ARB_multisample
 | 
			
		||||
@@ -88,6 +91,7 @@ int hw_tcl_on=1;
 | 
			
		||||
#include "extension_helper.h"
 | 
			
		||||
 | 
			
		||||
const struct dri_extension card_extensions[] = {
 | 
			
		||||
  /* *INDENT-OFF* */
 | 
			
		||||
  {"GL_ARB_multisample",		GL_ARB_multisample_functions},
 | 
			
		||||
  {"GL_ARB_multitexture",		NULL},
 | 
			
		||||
  {"GL_ARB_texture_border_clamp",	NULL},
 | 
			
		||||
@@ -126,6 +130,7 @@ const struct dri_extension card_extensions[] = {
 | 
			
		||||
  {"GL_NV_vertex_program",		GL_NV_vertex_program_functions},
 | 
			
		||||
  {"GL_SGIS_generate_mipmap",		NULL},
 | 
			
		||||
  {NULL,				NULL}
 | 
			
		||||
  /* *INDENT-ON* */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern struct tnl_pipeline_stage _r300_render_stage;
 | 
			
		||||
@@ -164,7 +169,6 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = {
 | 
			
		||||
	0,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Create the device specific rendering context.
 | 
			
		||||
 */
 | 
			
		||||
GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
@@ -183,10 +187,13 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
	assert(screen);
 | 
			
		||||
 | 
			
		||||
	/* Allocate the R300 context */
 | 
			
		||||
	r300 = (r300ContextPtr)CALLOC(sizeof(*r300));
 | 
			
		||||
	r300 = (r300ContextPtr) CALLOC(sizeof(*r300));
 | 
			
		||||
	if (!r300)
 | 
			
		||||
		return GL_FALSE;
 | 
			
		||||
 | 
			
		||||
	if (!(screen->chip_flags & RADEON_CHIPSET_TCL))
 | 
			
		||||
		hw_tcl_on = future_hw_tcl_on = 0;
 | 
			
		||||
 | 
			
		||||
	/* Parse configuration files.
 | 
			
		||||
	 * Do this here so that initialMaxAnisotropy is set before we create
 | 
			
		||||
	 * the default textures.
 | 
			
		||||
@@ -196,8 +203,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
	r300->initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache,
 | 
			
		||||
						     "def_max_anisotropy");
 | 
			
		||||
 | 
			
		||||
	//r300->texmicrotile = GL_TRUE;
 | 
			
		||||
 | 
			
		||||
	/* Init default driver functions then plug in our R300-specific functions
 | 
			
		||||
	 * (the texture functions are especially important)
 | 
			
		||||
	 */
 | 
			
		||||
@@ -208,21 +213,19 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
	r300InitShaderFuncs(&functions);
 | 
			
		||||
 | 
			
		||||
#ifdef USER_BUFFERS
 | 
			
		||||
	radeon_mm_init(r300);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef HW_VBOS
 | 
			
		||||
	if (hw_tcl_on) {
 | 
			
		||||
		r300_init_vbo_funcs(&functions);
 | 
			
		||||
	}
 | 
			
		||||
	r300_mem_init(r300);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (!radeonInitContext(&r300->radeon, &functions,
 | 
			
		||||
			       glVisual, driContextPriv, sharedContextPrivate)) {
 | 
			
		||||
			       glVisual, driContextPriv,
 | 
			
		||||
			       sharedContextPrivate)) {
 | 
			
		||||
		FREE(r300);
 | 
			
		||||
		return GL_FALSE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Init r300 context data */
 | 
			
		||||
	r300->dma.buf0_address = r300->radeon.radeonScreen->buffers->list[0].address;
 | 
			
		||||
	r300->dma.buf0_address =
 | 
			
		||||
	    r300->radeon.radeonScreen->buffers->list[0].address;
 | 
			
		||||
 | 
			
		||||
	(void)memset(r300->texture_heaps, 0, sizeof(r300->texture_heaps));
 | 
			
		||||
	make_empty_list(&r300->swapped);
 | 
			
		||||
@@ -230,6 +233,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
	r300->nr_heaps = 1 /* screen->numTexHeaps */ ;
 | 
			
		||||
	assert(r300->nr_heaps < RADEON_NR_TEX_HEAPS);
 | 
			
		||||
	for (i = 0; i < r300->nr_heaps; i++) {
 | 
			
		||||
		/* *INDENT-OFF* */
 | 
			
		||||
		r300->texture_heaps[i] = driCreateTextureHeap(i, r300,
 | 
			
		||||
							       screen->
 | 
			
		||||
							       texSize[i], 12,
 | 
			
		||||
@@ -245,9 +249,10 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
							       (destroy_texture_object_t
 | 
			
		||||
								*)
 | 
			
		||||
							       r300DestroyTexObj);
 | 
			
		||||
		/* *INDENT-ON* */
 | 
			
		||||
	}
 | 
			
		||||
	r300->texture_depth = driQueryOptioni(&r300->radeon.optionCache,
 | 
			
		||||
					       "texture_depth");
 | 
			
		||||
					      "texture_depth");
 | 
			
		||||
	if (r300->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
 | 
			
		||||
		r300->texture_depth = (screen->cpp == 4) ?
 | 
			
		||||
		    DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
 | 
			
		||||
@@ -259,12 +264,13 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
 | 
			
		||||
	ctx = r300->radeon.glCtx;
 | 
			
		||||
 | 
			
		||||
	ctx->Const.MaxTextureImageUnits = driQueryOptioni(&r300->radeon.optionCache,
 | 
			
		||||
						     "texture_image_units");
 | 
			
		||||
	ctx->Const.MaxTextureCoordUnits = driQueryOptioni(&r300->radeon.optionCache,
 | 
			
		||||
						     "texture_coord_units");
 | 
			
		||||
	ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits,
 | 
			
		||||
					  ctx->Const.MaxTextureCoordUnits);
 | 
			
		||||
	ctx->Const.MaxTextureImageUnits =
 | 
			
		||||
	    driQueryOptioni(&r300->radeon.optionCache, "texture_image_units");
 | 
			
		||||
	ctx->Const.MaxTextureCoordUnits =
 | 
			
		||||
	    driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units");
 | 
			
		||||
	ctx->Const.MaxTextureUnits =
 | 
			
		||||
	    MIN2(ctx->Const.MaxTextureImageUnits,
 | 
			
		||||
		 ctx->Const.MaxTextureCoordUnits);
 | 
			
		||||
	ctx->Const.MaxTextureMaxAnisotropy = 16.0;
 | 
			
		||||
 | 
			
		||||
	ctx->Const.MinPointSize = 1.0;
 | 
			
		||||
@@ -280,7 +286,8 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
#ifdef USER_BUFFERS
 | 
			
		||||
	/* Needs further modifications */
 | 
			
		||||
#if 0
 | 
			
		||||
	ctx->Const.MaxArrayLockSize = (/*512*/RADEON_BUFFER_SIZE*16*1024) / (4*4);
 | 
			
		||||
	ctx->Const.MaxArrayLockSize =
 | 
			
		||||
	    ( /*512 */ RADEON_BUFFER_SIZE * 16 * 1024) / (4 * 4);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -310,54 +317,53 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
	_tnl_allow_vertex_fog(ctx, GL_TRUE);
 | 
			
		||||
 | 
			
		||||
	/* currently bogus data */
 | 
			
		||||
	ctx->Const.VertexProgram.MaxInstructions=VSF_MAX_FRAGMENT_LENGTH/4;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeInstructions=VSF_MAX_FRAGMENT_LENGTH/4;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeAttribs=16; /* r420 */
 | 
			
		||||
	ctx->Const.VertexProgram.MaxTemps=32;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeTemps=/*VSF_MAX_FRAGMENT_TEMPS*/32;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeParameters=256; /* r420 */
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeAddressRegs=1;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeInstructions =
 | 
			
		||||
	    VSF_MAX_FRAGMENT_LENGTH / 4;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeAttribs = 16;	/* r420 */
 | 
			
		||||
	ctx->Const.VertexProgram.MaxTemps = 32;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeTemps =
 | 
			
		||||
	    /*VSF_MAX_FRAGMENT_TEMPS */ 32;
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeParameters = 256;	/* r420 */
 | 
			
		||||
	ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
 | 
			
		||||
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeAttribs = 11;	/* copy i915... */
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeInstructions = PFS_MAX_ALU_INST+PFS_MAX_TEX_INST;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeTexIndirections = PFS_MAX_TEX_INDIRECT;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeInstructions =
 | 
			
		||||
	    PFS_MAX_ALU_INST + PFS_MAX_TEX_INST;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeTexIndirections =
 | 
			
		||||
	    PFS_MAX_TEX_INDIRECT;
 | 
			
		||||
	ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;	/* and these are?? */
 | 
			
		||||
	_tnl_ProgramCacheInit(ctx);
 | 
			
		||||
	ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
 | 
			
		||||
 | 
			
		||||
	driInitExtensions(ctx, card_extensions, GL_TRUE);
 | 
			
		||||
 | 
			
		||||
	if (driQueryOptionb(&r300->radeon.optionCache, "disable_stencil_two_side"))
 | 
			
		||||
           _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side");
 | 
			
		||||
	if (driQueryOptionb
 | 
			
		||||
	    (&r300->radeon.optionCache, "disable_stencil_two_side"))
 | 
			
		||||
		_mesa_disable_extension(ctx, "GL_EXT_stencil_two_side");
 | 
			
		||||
 | 
			
		||||
	if (r300->radeon.glCtx->Mesa_DXTn && !driQueryOptionb (&r300->radeon.optionCache, "disable_s3tc")) {
 | 
			
		||||
	  _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
 | 
			
		||||
	  _mesa_enable_extension( ctx, "GL_S3_s3tc" );
 | 
			
		||||
	}
 | 
			
		||||
	else if (driQueryOptionb (&r300->radeon.optionCache, "force_s3tc_enable")) {
 | 
			
		||||
	  _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
 | 
			
		||||
	if (r300->radeon.glCtx->Mesa_DXTn
 | 
			
		||||
	    && !driQueryOptionb(&r300->radeon.optionCache, "disable_s3tc")) {
 | 
			
		||||
		_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
 | 
			
		||||
		_mesa_enable_extension(ctx, "GL_S3_s3tc");
 | 
			
		||||
	} else
 | 
			
		||||
	    if (driQueryOptionb(&r300->radeon.optionCache, "force_s3tc_enable"))
 | 
			
		||||
	{
 | 
			
		||||
		_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	r300->disable_lowimpact_fallback = driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback");
 | 
			
		||||
	r300->disable_lowimpact_fallback =
 | 
			
		||||
	    driQueryOptionb(&r300->radeon.optionCache,
 | 
			
		||||
			    "disable_lowimpact_fallback");
 | 
			
		||||
 | 
			
		||||
	radeonInitSpanFuncs(ctx);
 | 
			
		||||
	r300InitCmdBuf(r300);
 | 
			
		||||
	r300InitState(r300);
 | 
			
		||||
 | 
			
		||||
#ifdef RADEON_VTXFMT_A
 | 
			
		||||
	radeon_init_vtxfmt_a(r300);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
	/* plug in a few more device driver functions */
 | 
			
		||||
	/* XXX these should really go right after _mesa_init_driver_functions() */
 | 
			
		||||
	r300InitPixelFuncs(ctx);
 | 
			
		||||
	r300InitSwtcl(ctx);
 | 
			
		||||
#endif
 | 
			
		||||
	TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
 | 
			
		||||
 | 
			
		||||
	tcl_mode = driQueryOptioni(&r300->radeon.optionCache, "tcl_mode");
 | 
			
		||||
@@ -370,10 +376,12 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
	if (tcl_mode == DRI_CONF_TCL_SW ||
 | 
			
		||||
	    !(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) {
 | 
			
		||||
		if (r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL) {
 | 
			
		||||
			r300->radeon.radeonScreen->chip_flags &= ~RADEON_CHIPSET_TCL;
 | 
			
		||||
			r300->radeon.radeonScreen->chip_flags &=
 | 
			
		||||
			    ~RADEON_CHIPSET_TCL;
 | 
			
		||||
			fprintf(stderr, "Disabling HW TCL support\n");
 | 
			
		||||
		}
 | 
			
		||||
		TCL_FALLBACK(r300->radeon.glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
 | 
			
		||||
		TCL_FALLBACK(r300->radeon.glCtx,
 | 
			
		||||
			     RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return GL_TRUE;
 | 
			
		||||
@@ -381,7 +389,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
 | 
			
		||||
static void r300FreeGartAllocations(r300ContextPtr r300)
 | 
			
		||||
{
 | 
			
		||||
	int i, ret, tries=0, done_age, in_use=0;
 | 
			
		||||
	int i, ret, tries = 0, done_age, in_use = 0;
 | 
			
		||||
	drm_radeon_mem_free_t memfree;
 | 
			
		||||
 | 
			
		||||
	memfree.region = RADEON_MEM_REGION_GART;
 | 
			
		||||
@@ -401,7 +409,7 @@ static void r300FreeGartAllocations(r300ContextPtr r300)
 | 
			
		||||
	if (in_use)
 | 
			
		||||
		r300FlushCmdBuf(r300, __FUNCTION__);
 | 
			
		||||
 | 
			
		||||
	done_age = radeonGetAge((radeonContextPtr)r300);
 | 
			
		||||
	done_age = radeonGetAge((radeonContextPtr) r300);
 | 
			
		||||
 | 
			
		||||
	for (i = r300->rmm->u_last; i > 0; i--) {
 | 
			
		||||
		if (r300->rmm->u_list[i].ptr == NULL) {
 | 
			
		||||
@@ -416,19 +424,20 @@ static void r300FreeGartAllocations(r300ContextPtr r300)
 | 
			
		||||
		assert(r300->rmm->u_list[i].h_pending == 0);
 | 
			
		||||
 | 
			
		||||
		tries = 0;
 | 
			
		||||
		while(r300->rmm->u_list[i].age > done_age && tries++ < 1000) {
 | 
			
		||||
		while (r300->rmm->u_list[i].age > done_age && tries++ < 1000) {
 | 
			
		||||
			usleep(10);
 | 
			
		||||
			done_age = radeonGetAge((radeonContextPtr)r300);
 | 
			
		||||
			done_age = radeonGetAge((radeonContextPtr) r300);
 | 
			
		||||
		}
 | 
			
		||||
		if (tries >= 1000) {
 | 
			
		||||
			WARN_ONCE("Failed to idle region!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		memfree.region_offset = (char *)r300->rmm->u_list[i].ptr -
 | 
			
		||||
			(char *)r300->radeon.radeonScreen->gartTextures.map;
 | 
			
		||||
		    (char *)r300->radeon.radeonScreen->gartTextures.map;
 | 
			
		||||
 | 
			
		||||
		ret = drmCommandWrite(r300->radeon.radeonScreen->driScreen->fd,
 | 
			
		||||
				DRM_RADEON_FREE, &memfree, sizeof(memfree));
 | 
			
		||||
				      DRM_RADEON_FREE, &memfree,
 | 
			
		||||
				      sizeof(memfree));
 | 
			
		||||
		if (ret) {
 | 
			
		||||
			fprintf(stderr, "Failed to free at %p\nret = %s\n",
 | 
			
		||||
				r300->rmm->u_list[i].ptr, strerror(-ret));
 | 
			
		||||
@@ -438,18 +447,10 @@ static void r300FreeGartAllocations(r300ContextPtr r300)
 | 
			
		||||
 | 
			
		||||
			r300->rmm->u_list[i].pending = 0;
 | 
			
		||||
			r300->rmm->u_list[i].ptr = NULL;
 | 
			
		||||
			if (r300->rmm->u_list[i].fb) {
 | 
			
		||||
				LOCK_HARDWARE(&(r300->radeon));
 | 
			
		||||
				ret = mmFreeMem(r300->rmm->u_list[i].fb);
 | 
			
		||||
				UNLOCK_HARDWARE(&(r300->radeon));
 | 
			
		||||
				if (ret) fprintf(stderr, "failed to free!\n");
 | 
			
		||||
				r300->rmm->u_list[i].fb = NULL;
 | 
			
		||||
			}
 | 
			
		||||
			r300->rmm->u_list[i].ref_count = 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
    r300->rmm->u_head = i;
 | 
			
		||||
#endif /* USER_BUFFERS */
 | 
			
		||||
	r300->rmm->u_head = i;
 | 
			
		||||
#endif				/* USER_BUFFERS */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Destroy the device specific context.
 | 
			
		||||
@@ -477,7 +478,8 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
 | 
			
		||||
	if (r300) {
 | 
			
		||||
		GLboolean release_texture_heaps;
 | 
			
		||||
 | 
			
		||||
		release_texture_heaps = (r300->radeon.glCtx->Shared->RefCount == 1);
 | 
			
		||||
		release_texture_heaps =
 | 
			
		||||
		    (r300->radeon.glCtx->Shared->RefCount == 1);
 | 
			
		||||
		_swsetup_DestroyContext(r300->radeon.glCtx);
 | 
			
		||||
		_tnl_ProgramCacheDestroy(r300->radeon.glCtx);
 | 
			
		||||
		_tnl_DestroyContext(r300->radeon.glCtx);
 | 
			
		||||
@@ -485,7 +487,8 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
 | 
			
		||||
		_swrast_DestroyContext(r300->radeon.glCtx);
 | 
			
		||||
 | 
			
		||||
		if (r300->dma.current.buf) {
 | 
			
		||||
			r300ReleaseDmaRegion(r300, &r300->dma.current, __FUNCTION__ );
 | 
			
		||||
			r300ReleaseDmaRegion(r300, &r300->dma.current,
 | 
			
		||||
					     __FUNCTION__);
 | 
			
		||||
#ifndef USER_BUFFERS
 | 
			
		||||
			r300FlushCmdBuf(r300, __FUNCTION__);
 | 
			
		||||
#endif
 | 
			
		||||
@@ -518,7 +521,7 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
 | 
			
		||||
		/* the memory manager might be accessed when Mesa frees the shared
 | 
			
		||||
		 * state, so don't destroy it earlier
 | 
			
		||||
		 */
 | 
			
		||||
		radeon_mm_destroy(r300);
 | 
			
		||||
		r300_mem_destroy(r300);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		/* free the option cache */
 | 
			
		||||
 
 | 
			
		||||
@@ -27,10 +27,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
**************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *   Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
 *   Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
/**
 | 
			
		||||
 * \file
 | 
			
		||||
 *
 | 
			
		||||
 * \author Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
 * \author Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __R300_CONTEXT_H__
 | 
			
		||||
@@ -45,19 +46,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
#include "mtypes.h"
 | 
			
		||||
#include "colormac.h"
 | 
			
		||||
#include "radeon_context.h"
 | 
			
		||||
 | 
			
		||||
#define USER_BUFFERS
 | 
			
		||||
/* KW: Disable this code.  Driver should hook into vbo module
 | 
			
		||||
 * directly, see i965 driver for example.
 | 
			
		||||
 */
 | 
			
		||||
/* #define RADEON_VTXFMT_A */
 | 
			
		||||
#define HW_VBOS
 | 
			
		||||
 | 
			
		||||
/* We don't handle 16 bits elts swapping yet */
 | 
			
		||||
#ifdef MESA_BIG_ENDIAN
 | 
			
		||||
#define FORCE_32BITS_ELTS
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
//#define OPTIMIZE_ELTS
 | 
			
		||||
 | 
			
		||||
@@ -68,13 +58,10 @@ typedef struct r300_context *r300ContextPtr;
 | 
			
		||||
#include "radeon_lock.h"
 | 
			
		||||
#include "mm.h"
 | 
			
		||||
 | 
			
		||||
/* Checkpoint.. for convenience */
 | 
			
		||||
#define CPT	{ fprintf(stderr, "%s:%s line %d\n", __FILE__, __FUNCTION__, __LINE__); }
 | 
			
		||||
/* From http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html .
 | 
			
		||||
   I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble
 | 
			
		||||
   with other compilers ... GLUE!
 | 
			
		||||
*/
 | 
			
		||||
#if 1
 | 
			
		||||
#define WARN_ONCE(a, ...)	{ \
 | 
			
		||||
	static int warn##__LINE__=1; \
 | 
			
		||||
	if(warn##__LINE__){ \
 | 
			
		||||
@@ -86,32 +73,61 @@ typedef struct r300_context *r300ContextPtr;
 | 
			
		||||
		warn##__LINE__=0;\
 | 
			
		||||
		} \
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
#define WARN_ONCE(a, ...) {}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  /* We should probably change types within vertex_shader
 | 
			
		||||
      and pixel_shader structure later on */
 | 
			
		||||
#define CARD32 GLuint
 | 
			
		||||
#include "vertex_shader.h"
 | 
			
		||||
#include "r300_vertprog.h"
 | 
			
		||||
#include "r300_fragprog.h"
 | 
			
		||||
#undef CARD32
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This function takes a float and packs it into a uint32_t
 | 
			
		||||
 */
 | 
			
		||||
static __inline__ uint32_t r300PackFloat32(float fl)
 | 
			
		||||
{
 | 
			
		||||
	union { float fl; uint32_t u; } u;
 | 
			
		||||
	union {
 | 
			
		||||
		float fl;
 | 
			
		||||
		uint32_t u;
 | 
			
		||||
	} u;
 | 
			
		||||
 | 
			
		||||
	u.fl = fl;
 | 
			
		||||
	return u.u;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* This is probably wrong for some values, I need to test this
 | 
			
		||||
 * some more.  Range checking would be a good idea also..
 | 
			
		||||
 *
 | 
			
		||||
 * But it works for most things.  I'll fix it later if someone
 | 
			
		||||
 * else with a better clue doesn't
 | 
			
		||||
 */
 | 
			
		||||
static __inline__ uint32_t r300PackFloat24(float f)
 | 
			
		||||
{
 | 
			
		||||
	float mantissa;
 | 
			
		||||
	int exponent;
 | 
			
		||||
	uint32_t float24 = 0;
 | 
			
		||||
 | 
			
		||||
	if (f == 0.0)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	mantissa = frexpf(f, &exponent);
 | 
			
		||||
 | 
			
		||||
	/* Handle -ve */
 | 
			
		||||
	if (mantissa < 0) {
 | 
			
		||||
		float24 |= (1 << 23);
 | 
			
		||||
		mantissa = mantissa * -1.0;
 | 
			
		||||
	}
 | 
			
		||||
	/* Handle exponent, bias of 63 */
 | 
			
		||||
	exponent += 62;
 | 
			
		||||
	float24 |= (exponent << 16);
 | 
			
		||||
	/* Kill 7 LSB of mantissa */
 | 
			
		||||
	float24 |= (r300PackFloat32(mantissa) & 0x7FFFFF) >> 7;
 | 
			
		||||
 | 
			
		||||
	return float24;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/************ DMA BUFFERS **************/
 | 
			
		||||
 | 
			
		||||
/* Need refcounting on dma buffers:
 | 
			
		||||
 */
 | 
			
		||||
struct r300_dma_buffer {
 | 
			
		||||
	int refcount;		/* the number of retained regions in buf */
 | 
			
		||||
	int refcount;		/**< the number of retained regions in buf */
 | 
			
		||||
	drmBufPtr buf;
 | 
			
		||||
	int id;
 | 
			
		||||
};
 | 
			
		||||
@@ -130,10 +146,10 @@ struct r300_dma_region {
 | 
			
		||||
	char *address;		/* == buf->address */
 | 
			
		||||
	int start, end, ptr;	/* offsets from start of buf */
 | 
			
		||||
 | 
			
		||||
    int aos_offset;     /* address in GART memory */
 | 
			
		||||
    int aos_stride;     /* distance between elements, in dwords */
 | 
			
		||||
    int aos_size;       /* number of components (1-4) */
 | 
			
		||||
    int aos_reg;        /* VAP register assignment */
 | 
			
		||||
	int aos_offset;		/* address in GART memory */
 | 
			
		||||
	int aos_stride;		/* distance between elements, in dwords */
 | 
			
		||||
	int aos_size;		/* number of components (1-4) */
 | 
			
		||||
	int aos_reg;		/* VAP register assignment */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct r300_dma {
 | 
			
		||||
@@ -175,16 +191,15 @@ struct r300_tex_obj {
 | 
			
		||||
	drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
 | 
			
		||||
	/* Six, for the cube faces */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	GLuint pitch; /* this isn't sent to hardware just used in calculations */
 | 
			
		||||
	GLuint pitch;		/* this isn't sent to hardware just used in calculations */
 | 
			
		||||
	/* hardware register values */
 | 
			
		||||
	/* Note that R200 has 8 registers per texture and R300 only 7 */
 | 
			
		||||
	GLuint filter;
 | 
			
		||||
	GLuint filter_1;
 | 
			
		||||
	GLuint pitch_reg;
 | 
			
		||||
	GLuint size;	/* npot only */
 | 
			
		||||
	GLuint size;		/* npot only */
 | 
			
		||||
	GLuint format;
 | 
			
		||||
	GLuint offset;	/* Image location in the card's address space.
 | 
			
		||||
	GLuint offset;		/* Image location in the card's address space.
 | 
			
		||||
				   All cube faces follow. */
 | 
			
		||||
	GLuint unknown4;
 | 
			
		||||
	GLuint unknown5;
 | 
			
		||||
@@ -198,10 +213,9 @@ struct r300_tex_obj {
 | 
			
		||||
	GLuint pp_cubic_faces;	/* cube face 1,2,3,4 log2 sizes */
 | 
			
		||||
	GLuint format_x;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	GLboolean border_fallback;
 | 
			
		||||
 | 
			
		||||
	GLuint tile_bits; /* hw texture tile bits used on this texture */
 | 
			
		||||
	GLuint tile_bits;	/* hw texture tile bits used on this texture */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct r300_texture_env_state {
 | 
			
		||||
@@ -210,7 +224,6 @@ struct r300_texture_env_state {
 | 
			
		||||
	GLenum envMode;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* The blit width for texture uploads
 | 
			
		||||
 */
 | 
			
		||||
#define R300_BLIT_WIDTH_BYTES 1024
 | 
			
		||||
@@ -218,7 +231,7 @@ struct r300_texture_env_state {
 | 
			
		||||
 | 
			
		||||
struct r300_texture_state {
 | 
			
		||||
	struct r300_texture_env_state unit[R300_MAX_TEXTURE_UNITS];
 | 
			
		||||
	int tc_count; /* number of incoming texture coordinates from VAP */
 | 
			
		||||
	int tc_count;		/* number of incoming texture coordinates from VAP */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -230,16 +243,15 @@ struct r300_texture_state {
 | 
			
		||||
 */
 | 
			
		||||
struct r300_state_atom {
 | 
			
		||||
	struct r300_state_atom *next, *prev;
 | 
			
		||||
	const char* name;	/* for debug */
 | 
			
		||||
	const char *name;	/* for debug */
 | 
			
		||||
	int cmd_size;		/* maximum size in dwords */
 | 
			
		||||
	GLuint idx;		/* index in an array (e.g. textures) */
 | 
			
		||||
	uint32_t* cmd;
 | 
			
		||||
	uint32_t *cmd;
 | 
			
		||||
	GLboolean dirty;
 | 
			
		||||
 | 
			
		||||
	int (*check)(r300ContextPtr, struct r300_state_atom* atom);
 | 
			
		||||
	int (*check) (r300ContextPtr, struct r300_state_atom * atom);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define R300_VPT_CMD_0		0
 | 
			
		||||
#define R300_VPT_XSCALE		1
 | 
			
		||||
#define R300_VPT_XOFFSET	2
 | 
			
		||||
@@ -249,7 +261,7 @@ struct r300_state_atom {
 | 
			
		||||
#define R300_VPT_ZOFFSET	6
 | 
			
		||||
#define R300_VPT_CMDSIZE	7
 | 
			
		||||
 | 
			
		||||
#define R300_VIR_CMD_0		0 /* vir is variable size (at least 1) */
 | 
			
		||||
#define R300_VIR_CMD_0		0	/* vir is variable size (at least 1) */
 | 
			
		||||
#define R300_VIR_CNTL_0		1
 | 
			
		||||
#define R300_VIR_CNTL_1		2
 | 
			
		||||
#define R300_VIR_CNTL_2		3
 | 
			
		||||
@@ -270,7 +282,6 @@ struct r300_state_atom {
 | 
			
		||||
#define R300_VOF_CNTL_1		2
 | 
			
		||||
#define R300_VOF_CMDSIZE	3
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define R300_PVS_CMD_0		0
 | 
			
		||||
#define R300_PVS_CNTL_1		1
 | 
			
		||||
#define R300_PVS_CNTL_2		2
 | 
			
		||||
@@ -320,7 +331,7 @@ struct r300_state_atom {
 | 
			
		||||
#define R300_RI_INTERP_7	8
 | 
			
		||||
#define R300_RI_CMDSIZE		9
 | 
			
		||||
 | 
			
		||||
#define R300_RR_CMD_0		0 /* rr is variable size (at least 1) */
 | 
			
		||||
#define R300_RR_CMD_0		0	/* rr is variable size (at least 1) */
 | 
			
		||||
#define R300_RR_ROUTE_0		1
 | 
			
		||||
#define R300_RR_ROUTE_1		2
 | 
			
		||||
#define R300_RR_ROUTE_2		3
 | 
			
		||||
@@ -402,11 +413,11 @@ struct r300_state_atom {
 | 
			
		||||
 | 
			
		||||
#define R300_VPI_CMD_0		0
 | 
			
		||||
#define R300_VPI_INSTR_0	1
 | 
			
		||||
#define R300_VPI_CMDSIZE	1025 /* 256 16 byte instructions */
 | 
			
		||||
#define R300_VPI_CMDSIZE	1025	/* 256 16 byte instructions */
 | 
			
		||||
 | 
			
		||||
#define R300_VPP_CMD_0		0
 | 
			
		||||
#define R300_VPP_PARAM_0	1
 | 
			
		||||
#define R300_VPP_CMDSIZE	1025 /* 256 4-component parameters */
 | 
			
		||||
#define R300_VPP_CMDSIZE	1025	/* 256 4-component parameters */
 | 
			
		||||
 | 
			
		||||
#define R300_VPS_CMD_0		0
 | 
			
		||||
#define R300_VPS_ZERO_0		1
 | 
			
		||||
@@ -428,54 +439,54 @@ struct r300_state_atom {
 | 
			
		||||
struct r300_hw_state {
 | 
			
		||||
	struct r300_state_atom atomlist;
 | 
			
		||||
 | 
			
		||||
	GLboolean	is_dirty;
 | 
			
		||||
	GLboolean	all_dirty;
 | 
			
		||||
	int		max_state_size;	/* in dwords */
 | 
			
		||||
	GLboolean is_dirty;
 | 
			
		||||
	GLboolean all_dirty;
 | 
			
		||||
	int max_state_size;	/* in dwords */
 | 
			
		||||
 | 
			
		||||
	struct r300_state_atom vpt;	/* viewport (1D98) */
 | 
			
		||||
	struct r300_state_atom vap_cntl;
 | 
			
		||||
	struct r300_state_atom vof;     /* VAP output format register 0x2090 */
 | 
			
		||||
	struct r300_state_atom vof;	/* VAP output format register 0x2090 */
 | 
			
		||||
	struct r300_state_atom vte;	/* (20B0) */
 | 
			
		||||
	struct r300_state_atom unk2134;	/* (2134) */
 | 
			
		||||
	struct r300_state_atom vap_cntl_status;
 | 
			
		||||
	struct r300_state_atom vir[2];	/* vap input route (2150/21E0) */
 | 
			
		||||
	struct r300_state_atom vic;	/* vap input control (2180) */
 | 
			
		||||
	struct r300_state_atom unk21DC; /* (21DC) */
 | 
			
		||||
	struct r300_state_atom unk221C; /* (221C) */
 | 
			
		||||
	struct r300_state_atom unk2220; /* (2220) */
 | 
			
		||||
	struct r300_state_atom unk2288; /* (2288) */
 | 
			
		||||
	struct r300_state_atom unk21DC;	/* (21DC) */
 | 
			
		||||
	struct r300_state_atom unk221C;	/* (221C) */
 | 
			
		||||
	struct r300_state_atom unk2220;	/* (2220) */
 | 
			
		||||
	struct r300_state_atom unk2288;	/* (2288) */
 | 
			
		||||
	struct r300_state_atom pvs;	/* pvs_cntl (22D0) */
 | 
			
		||||
	struct r300_state_atom gb_enable; /* (4008) */
 | 
			
		||||
	struct r300_state_atom gb_misc; /* Multisampling position shifts ? (4010) */
 | 
			
		||||
	struct r300_state_atom unk4200; /* (4200) */
 | 
			
		||||
	struct r300_state_atom unk4214; /* (4214) */
 | 
			
		||||
	struct r300_state_atom gb_enable;	/* (4008) */
 | 
			
		||||
	struct r300_state_atom gb_misc;	/* Multisampling position shifts ? (4010) */
 | 
			
		||||
	struct r300_state_atom unk4200;	/* (4200) */
 | 
			
		||||
	struct r300_state_atom unk4214;	/* (4214) */
 | 
			
		||||
	struct r300_state_atom ps;	/* pointsize (421C) */
 | 
			
		||||
	struct r300_state_atom unk4230; /* (4230) */
 | 
			
		||||
	struct r300_state_atom unk4230;	/* (4230) */
 | 
			
		||||
	struct r300_state_atom lcntl;	/* line control */
 | 
			
		||||
	struct r300_state_atom unk4260; /* (4260) */
 | 
			
		||||
	struct r300_state_atom unk4260;	/* (4260) */
 | 
			
		||||
	struct r300_state_atom shade;
 | 
			
		||||
	struct r300_state_atom polygon_mode;
 | 
			
		||||
	struct r300_state_atom fogp;	/* fog parameters (4294) */
 | 
			
		||||
	struct r300_state_atom unk429C; /* (429C) */
 | 
			
		||||
	struct r300_state_atom unk429C;	/* (429C) */
 | 
			
		||||
	struct r300_state_atom zbias_cntl;
 | 
			
		||||
	struct r300_state_atom zbs;	/* zbias (42A4) */
 | 
			
		||||
	struct r300_state_atom occlusion_cntl;
 | 
			
		||||
	struct r300_state_atom cul;	/* cull cntl (42B8) */
 | 
			
		||||
	struct r300_state_atom unk42C0; /* (42C0) */
 | 
			
		||||
	struct r300_state_atom unk42C0;	/* (42C0) */
 | 
			
		||||
	struct r300_state_atom rc;	/* rs control (4300) */
 | 
			
		||||
	struct r300_state_atom ri;	/* rs interpolators (4310) */
 | 
			
		||||
	struct r300_state_atom rr;	/* rs route (4330) */
 | 
			
		||||
	struct r300_state_atom unk43A4;	/* (43A4) */
 | 
			
		||||
	struct r300_state_atom unk43E8;	/* (43E8) */
 | 
			
		||||
	struct r300_state_atom fp;	/* fragment program cntl + nodes (4600) */
 | 
			
		||||
	struct r300_state_atom fpt;     /* texi - (4620) */
 | 
			
		||||
	struct r300_state_atom fpt;	/* texi - (4620) */
 | 
			
		||||
	struct r300_state_atom unk46A4;	/* (46A4) */
 | 
			
		||||
	struct r300_state_atom fpi[4];	/* fp instructions (46C0/47C0/48C0/49C0) */
 | 
			
		||||
	struct r300_state_atom fogs;	/* fog state (4BC0) */
 | 
			
		||||
	struct r300_state_atom fogc;	/* fog color (4BC8) */
 | 
			
		||||
	struct r300_state_atom at;	/* alpha test (4BD4) */
 | 
			
		||||
	struct r300_state_atom unk4BD8;	/* (4BD8) */
 | 
			
		||||
	struct r300_state_atom fpp;     /* 0x4C00 and following */
 | 
			
		||||
	struct r300_state_atom fpp;	/* 0x4C00 and following */
 | 
			
		||||
	struct r300_state_atom unk4E00;	/* (4E00) */
 | 
			
		||||
	struct r300_state_atom bld;	/* blending (4E04) */
 | 
			
		||||
	struct r300_state_atom cmk;	/* colormask (4E0C) */
 | 
			
		||||
@@ -495,11 +506,11 @@ struct r300_hw_state {
 | 
			
		||||
	struct r300_state_atom vpi;	/* vp instructions */
 | 
			
		||||
	struct r300_state_atom vpp;	/* vp parameters */
 | 
			
		||||
	struct r300_state_atom vps;	/* vertex point size (?) */
 | 
			
		||||
		/* 8 texture units */
 | 
			
		||||
		/* the state is grouped by function and not by
 | 
			
		||||
		   texture unit. This makes single unit updates
 | 
			
		||||
		   really awkward - we are much better off
 | 
			
		||||
		   updating the whole thing at once */
 | 
			
		||||
	/* 8 texture units */
 | 
			
		||||
	/* the state is grouped by function and not by
 | 
			
		||||
	   texture unit. This makes single unit updates
 | 
			
		||||
	   really awkward - we are much better off
 | 
			
		||||
	   updating the whole thing at once */
 | 
			
		||||
	struct {
 | 
			
		||||
		struct r300_state_atom filter;
 | 
			
		||||
		struct r300_state_atom filter_1;
 | 
			
		||||
@@ -509,11 +520,10 @@ struct r300_hw_state {
 | 
			
		||||
		struct r300_state_atom offset;
 | 
			
		||||
		struct r300_state_atom chroma_key;
 | 
			
		||||
		struct r300_state_atom border_color;
 | 
			
		||||
		} tex;
 | 
			
		||||
	} tex;
 | 
			
		||||
	struct r300_state_atom txe;	/* tex enable (4104) */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This structure holds the command buffer while it is being constructed.
 | 
			
		||||
 *
 | 
			
		||||
@@ -522,13 +532,12 @@ struct r300_hw_state {
 | 
			
		||||
 * otherwise.
 | 
			
		||||
 */
 | 
			
		||||
struct r300_cmdbuf {
 | 
			
		||||
	int		size;		/* DWORDs allocated for buffer */
 | 
			
		||||
	uint32_t*	cmd_buf;
 | 
			
		||||
	int		count_used;	/* DWORDs filled so far */
 | 
			
		||||
	int		count_reemit;	/* size of re-emission batch */
 | 
			
		||||
	int size;		/* DWORDs allocated for buffer */
 | 
			
		||||
	uint32_t *cmd_buf;
 | 
			
		||||
	int count_used;		/* DWORDs filled so far */
 | 
			
		||||
	int count_reemit;	/* size of re-emission batch */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * State cache
 | 
			
		||||
 */
 | 
			
		||||
@@ -560,9 +569,9 @@ struct r300_vertex_shader_fragment {
 | 
			
		||||
	union {
 | 
			
		||||
		GLuint d[VSF_MAX_FRAGMENT_LENGTH];
 | 
			
		||||
		float f[VSF_MAX_FRAGMENT_LENGTH];
 | 
			
		||||
		VERTEX_SHADER_INSTRUCTION i[VSF_MAX_FRAGMENT_LENGTH/4];
 | 
			
		||||
		} body;
 | 
			
		||||
	};
 | 
			
		||||
		VERTEX_SHADER_INSTRUCTION i[VSF_MAX_FRAGMENT_LENGTH / 4];
 | 
			
		||||
	} body;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define VSF_DEST_PROGRAM	0x0
 | 
			
		||||
#define VSF_DEST_MATRIX0	0x200
 | 
			
		||||
@@ -576,24 +585,19 @@ struct r300_vertex_shader_fragment {
 | 
			
		||||
struct r300_vertex_shader_state {
 | 
			
		||||
	struct r300_vertex_shader_fragment program;
 | 
			
		||||
 | 
			
		||||
	/* a bit of a waste - each uses only a subset of allocated space..
 | 
			
		||||
	    but easier to program */
 | 
			
		||||
	struct r300_vertex_shader_fragment matrix[3];
 | 
			
		||||
	struct r300_vertex_shader_fragment vector[2];
 | 
			
		||||
 | 
			
		||||
	struct r300_vertex_shader_fragment unknown1;
 | 
			
		||||
	struct r300_vertex_shader_fragment unknown2;
 | 
			
		||||
 | 
			
		||||
	int program_start;
 | 
			
		||||
	int unknown_ptr1;  /* pointer within program space */
 | 
			
		||||
	int unknown_ptr1;	/* pointer within program space */
 | 
			
		||||
	int program_end;
 | 
			
		||||
 | 
			
		||||
	int param_offset;
 | 
			
		||||
	int param_count;
 | 
			
		||||
 | 
			
		||||
	int unknown_ptr2;  /* pointer within program space */
 | 
			
		||||
	int unknown_ptr3;  /* pointer within program space */
 | 
			
		||||
	};
 | 
			
		||||
	int unknown_ptr2;	/* pointer within program space */
 | 
			
		||||
	int unknown_ptr3;	/* pointer within program space */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern int hw_tcl_on;
 | 
			
		||||
 | 
			
		||||
@@ -603,7 +607,6 @@ extern int hw_tcl_on;
 | 
			
		||||
/* Should but doesnt work */
 | 
			
		||||
//#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->curr_vp)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday.
 | 
			
		||||
 * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly.
 | 
			
		||||
 */
 | 
			
		||||
@@ -621,7 +624,7 @@ struct r300_vertex_program {
 | 
			
		||||
	struct r300_vertex_shader_fragment program;
 | 
			
		||||
 | 
			
		||||
	int pos_end;
 | 
			
		||||
	int num_temporaries; /* Number of temp vars used by program */
 | 
			
		||||
	int num_temporaries;	/* Number of temp vars used by program */
 | 
			
		||||
	int wpos_idx;
 | 
			
		||||
	int inputs[VERT_ATTRIB_MAX];
 | 
			
		||||
	int outputs[VERT_RESULT_MAX];
 | 
			
		||||
@@ -631,7 +634,7 @@ struct r300_vertex_program {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct r300_vertex_program_cont {
 | 
			
		||||
	struct gl_vertex_program mesa_program; /* Must be first */
 | 
			
		||||
	struct gl_vertex_program mesa_program;	/* Must be first */
 | 
			
		||||
	struct r300_vertex_shader_fragment params;
 | 
			
		||||
	struct r300_vertex_program *progs;
 | 
			
		||||
};
 | 
			
		||||
@@ -644,8 +647,8 @@ struct r300_vertex_program_cont {
 | 
			
		||||
 | 
			
		||||
/* Mapping Mesa registers to R300 temporaries */
 | 
			
		||||
struct reg_acc {
 | 
			
		||||
       int reg;        /* Assigned hw temp */
 | 
			
		||||
       unsigned int refcount; /* Number of uses by mesa program */
 | 
			
		||||
	int reg;		/* Assigned hw temp */
 | 
			
		||||
	unsigned int refcount;	/* Number of uses by mesa program */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -676,7 +679,6 @@ struct reg_lifetime {
 | 
			
		||||
	int scalar_lastread;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Store usage information about an ALU instruction slot during the
 | 
			
		||||
 * compilation of a fragment program.
 | 
			
		||||
@@ -702,7 +704,7 @@ struct r300_pfs_compile_slot {
 | 
			
		||||
 * Store information during compilation of fragment programs.
 | 
			
		||||
 */
 | 
			
		||||
struct r300_pfs_compile_state {
 | 
			
		||||
	int nrslots;       /* number of ALU slots used so far */
 | 
			
		||||
	int nrslots;		/* number of ALU slots used so far */
 | 
			
		||||
 | 
			
		||||
	/* Track which (parts of) slots are already filled with instructions */
 | 
			
		||||
	struct r300_pfs_compile_slot slot[PFS_MAX_ALU_INST];
 | 
			
		||||
@@ -713,7 +715,7 @@ struct r300_pfs_compile_state {
 | 
			
		||||
	/* Used to map Mesa's inputs/temps onto hardware temps */
 | 
			
		||||
	int temp_in_use;
 | 
			
		||||
	struct reg_acc temps[PFS_NUM_TEMP_REGS];
 | 
			
		||||
	struct reg_acc inputs[32]; /* don't actually need 32... */
 | 
			
		||||
	struct reg_acc inputs[32];	/* don't actually need 32... */
 | 
			
		||||
 | 
			
		||||
	/* Track usage of hardware temps, for register allocation,
 | 
			
		||||
	 * indirection detection, etc. */
 | 
			
		||||
@@ -769,7 +771,7 @@ struct r300_fragment_program {
 | 
			
		||||
	 * gl_program_parameter_list::ParameterValues, or a pointer to a
 | 
			
		||||
	 * global constant (e.g. for sin/cos-approximation)
 | 
			
		||||
	 */
 | 
			
		||||
	const GLfloat* constant[PFS_NUM_CONST_REGS];
 | 
			
		||||
	const GLfloat *constant[PFS_NUM_CONST_REGS];
 | 
			
		||||
	int const_nr;
 | 
			
		||||
 | 
			
		||||
	int max_temp_idx;
 | 
			
		||||
@@ -799,30 +801,17 @@ struct radeon_vertex_buffer {
 | 
			
		||||
	int Count;
 | 
			
		||||
	void *Elts;
 | 
			
		||||
	int elt_size;
 | 
			
		||||
	int elt_min, elt_max; /* debug */
 | 
			
		||||
	int elt_min, elt_max;	/* debug */
 | 
			
		||||
 | 
			
		||||
	struct dt AttribPtr[VERT_ATTRIB_MAX];
 | 
			
		||||
 | 
			
		||||
	const struct _mesa_prim  *Primitive;
 | 
			
		||||
	GLuint      PrimitiveCount;
 | 
			
		||||
	const struct _mesa_prim *Primitive;
 | 
			
		||||
	GLuint PrimitiveCount;
 | 
			
		||||
	GLint LockFirst;
 | 
			
		||||
	GLsizei LockCount;
 | 
			
		||||
	int lock_uptodate;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct r300_aos_rec {
 | 
			
		||||
	GLuint offset;
 | 
			
		||||
	int element_size; /* in dwords */
 | 
			
		||||
	int stride;       /* distance between elements, in dwords */
 | 
			
		||||
 | 
			
		||||
	int format;
 | 
			
		||||
 | 
			
		||||
	int ncomponents; /* number of components - between 1 and 4, inclusive */
 | 
			
		||||
 | 
			
		||||
	int reg; /* which register they are assigned to. */
 | 
			
		||||
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
struct r300_state {
 | 
			
		||||
	struct r300_depthbuffer_state depth;
 | 
			
		||||
	struct r300_texture_state texture;
 | 
			
		||||
@@ -836,12 +825,12 @@ struct r300_state {
 | 
			
		||||
	GLuint *Elts;
 | 
			
		||||
	struct r300_dma_region elt_dma;
 | 
			
		||||
 | 
			
		||||
	DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for.
 | 
			
		||||
				 They are the same as tnl->render_inputs for fixed pipeline */
 | 
			
		||||
	 DECLARE_RENDERINPUTS(render_inputs_bitset);	/* actual render inputs that R300 was configured for.
 | 
			
		||||
							   They are the same as tnl->render_inputs for fixed pipeline */
 | 
			
		||||
 | 
			
		||||
	struct {
 | 
			
		||||
		int transform_offset;  /* Transform matrix offset, -1 if none */
 | 
			
		||||
		} vap_param;  /* vertex processor parameter allocation - tells where to write parameters */
 | 
			
		||||
		int transform_offset;	/* Transform matrix offset, -1 if none */
 | 
			
		||||
	} vap_param;		/* vertex processor parameter allocation - tells where to write parameters */
 | 
			
		||||
 | 
			
		||||
	struct r300_stencilbuffer_state stencil;
 | 
			
		||||
 | 
			
		||||
@@ -852,10 +841,10 @@ struct r300_state {
 | 
			
		||||
#define R300_FALLBACK_RAST 2
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * R300 context structure.
 | 
			
		||||
 * \brief R300 context structure.
 | 
			
		||||
 */
 | 
			
		||||
struct r300_context {
 | 
			
		||||
	struct radeon_context radeon; /* parent class, must be first */
 | 
			
		||||
	struct radeon_context radeon;	/* parent class, must be first */
 | 
			
		||||
 | 
			
		||||
	struct r300_hw_state hw;
 | 
			
		||||
	struct r300_cmdbuf cmdbuf;
 | 
			
		||||
@@ -882,13 +871,12 @@ struct r300_context {
 | 
			
		||||
	GLuint prefer_gart_client_texturing;
 | 
			
		||||
 | 
			
		||||
#ifdef USER_BUFFERS
 | 
			
		||||
	struct radeon_memory_manager *rmm;
 | 
			
		||||
	GLvector4f dummy_attrib[_TNL_ATTRIB_MAX];
 | 
			
		||||
	GLvector4f *temp_attrib[_TNL_ATTRIB_MAX];
 | 
			
		||||
	struct r300_memory_manager *rmm;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	GLboolean texmicrotile;
 | 
			
		||||
	GLboolean span_dlocking;
 | 
			
		||||
	GLvector4f dummy_attrib[_TNL_ATTRIB_MAX];
 | 
			
		||||
	GLvector4f *temp_attrib[_TNL_ATTRIB_MAX];
 | 
			
		||||
 | 
			
		||||
	GLboolean disable_lowimpact_fallback;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -899,42 +887,16 @@ struct r300_buffer_object {
 | 
			
		||||
 | 
			
		||||
#define R300_CONTEXT(ctx)		((r300ContextPtr)(ctx->DriverCtx))
 | 
			
		||||
 | 
			
		||||
static __inline GLuint r300PackColor( GLuint cpp,
 | 
			
		||||
					GLubyte r, GLubyte g,
 | 
			
		||||
					GLubyte b, GLubyte a )
 | 
			
		||||
{
 | 
			
		||||
   switch ( cpp ) {
 | 
			
		||||
   case 2:
 | 
			
		||||
      return PACK_COLOR_565( r, g, b );
 | 
			
		||||
   case 4:
 | 
			
		||||
      return PACK_COLOR_8888( r, g, b, a );
 | 
			
		||||
   default:
 | 
			
		||||
      return 0;
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
extern void r300DestroyContext(__DRIcontextPrivate * driContextPriv);
 | 
			
		||||
extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 | 
			
		||||
				   __DRIcontextPrivate * driContextPriv,
 | 
			
		||||
				   void *sharedContextPrivate);
 | 
			
		||||
 | 
			
		||||
extern int r300_get_num_verts(r300ContextPtr rmesa, int num_verts, int prim);
 | 
			
		||||
 | 
			
		||||
extern void r300_select_vertex_shader(r300ContextPtr r300);
 | 
			
		||||
extern void r300SelectVertexShader(r300ContextPtr r300);
 | 
			
		||||
extern void r300InitShaderFuncs(struct dd_function_table *functions);
 | 
			
		||||
extern int r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program_cont *vp, float *dst);
 | 
			
		||||
extern int r300Fallback(GLcontext *ctx);
 | 
			
		||||
 | 
			
		||||
extern void radeon_vb_to_rvb(r300ContextPtr rmesa, struct radeon_vertex_buffer *rvb, struct vertex_buffer *vb);
 | 
			
		||||
extern GLboolean r300_run_vb_render(GLcontext *ctx, struct tnl_pipeline_stage *stage);
 | 
			
		||||
 | 
			
		||||
#ifdef RADEON_VTXFMT_A
 | 
			
		||||
extern void radeon_init_vtxfmt_a(r300ContextPtr rmesa);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HW_VBOS
 | 
			
		||||
extern void r300_init_vbo_funcs(struct dd_function_table *functions);
 | 
			
		||||
extern void r300_evict_vbos(GLcontext *ctx, int amount);
 | 
			
		||||
#endif
 | 
			
		||||
extern int r300VertexProgUpdateParams(GLcontext * ctx,
 | 
			
		||||
				      struct r300_vertex_program_cont *vp,
 | 
			
		||||
				      float *dst);
 | 
			
		||||
 | 
			
		||||
#define RADEON_D_CAPTURE 0
 | 
			
		||||
#define RADEON_D_PLAYBACK 1
 | 
			
		||||
 
 | 
			
		||||
@@ -27,9 +27,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
**************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *   Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
/**
 | 
			
		||||
 * \file
 | 
			
		||||
 *
 | 
			
		||||
 * \author Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "glheader.h"
 | 
			
		||||
@@ -47,11 +48,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#include "r300_context.h"
 | 
			
		||||
#include "radeon_ioctl.h"
 | 
			
		||||
#include "r300_state.h"
 | 
			
		||||
#include "r300_maos.h"
 | 
			
		||||
#include "r300_emit.h"
 | 
			
		||||
#include "r300_ioctl.h"
 | 
			
		||||
 | 
			
		||||
#ifdef USER_BUFFERS
 | 
			
		||||
#include "radeon_mm.h"
 | 
			
		||||
#include "r300_mem.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if SWIZZLE_X != R300_INPUT_ROUTE_SELECT_X || \
 | 
			
		||||
@@ -65,7 +66,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
#define DEBUG_ALL DEBUG_VERTS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if defined(USE_X86_ASM)
 | 
			
		||||
#define COPY_DWORDS( dst, src, nr )					\
 | 
			
		||||
do {									\
 | 
			
		||||
@@ -86,9 +86,9 @@ do {						\
 | 
			
		||||
} while (0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void emit_vec4(GLcontext * ctx,
 | 
			
		||||
		      struct r300_dma_region *rvb,
 | 
			
		||||
		      GLvoid *data, int stride, int count)
 | 
			
		||||
static void r300EmitVec4(GLcontext * ctx,
 | 
			
		||||
			 struct r300_dma_region *rvb,
 | 
			
		||||
			 GLvoid * data, int stride, int count)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
	int *out = (int *)(rvb->address + rvb->start);
 | 
			
		||||
@@ -107,9 +107,9 @@ static void emit_vec4(GLcontext * ctx,
 | 
			
		||||
		}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void emit_vec8(GLcontext * ctx,
 | 
			
		||||
		      struct r300_dma_region *rvb,
 | 
			
		||||
		      GLvoid *data, int stride, int count)
 | 
			
		||||
static void r300EmitVec8(GLcontext * ctx,
 | 
			
		||||
			 struct r300_dma_region *rvb,
 | 
			
		||||
			 GLvoid * data, int stride, int count)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
	int *out = (int *)(rvb->address + rvb->start);
 | 
			
		||||
@@ -129,9 +129,9 @@ static void emit_vec8(GLcontext * ctx,
 | 
			
		||||
		}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void emit_vec12(GLcontext * ctx,
 | 
			
		||||
		       struct r300_dma_region *rvb,
 | 
			
		||||
		       GLvoid *data, int stride, int count)
 | 
			
		||||
static void r300EmitVec12(GLcontext * ctx,
 | 
			
		||||
			  struct r300_dma_region *rvb,
 | 
			
		||||
			  GLvoid * data, int stride, int count)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
	int *out = (int *)(rvb->address + rvb->start);
 | 
			
		||||
@@ -152,9 +152,9 @@ static void emit_vec12(GLcontext * ctx,
 | 
			
		||||
		}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void emit_vec16(GLcontext * ctx,
 | 
			
		||||
		       struct r300_dma_region *rvb,
 | 
			
		||||
		       GLvoid *data, int stride, int count)
 | 
			
		||||
static void r300EmitVec16(GLcontext * ctx,
 | 
			
		||||
			  struct r300_dma_region *rvb,
 | 
			
		||||
			  GLvoid * data, int stride, int count)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
	int *out = (int *)(rvb->address + rvb->start);
 | 
			
		||||
@@ -176,9 +176,9 @@ static void emit_vec16(GLcontext * ctx,
 | 
			
		||||
		}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void emit_vector(GLcontext * ctx,
 | 
			
		||||
static void r300EmitVec(GLcontext * ctx,
 | 
			
		||||
			struct r300_dma_region *rvb,
 | 
			
		||||
			GLvoid *data, int size, int stride, int count)
 | 
			
		||||
			GLvoid * data, int size, int stride, int count)
 | 
			
		||||
{
 | 
			
		||||
	r300ContextPtr rmesa = R300_CONTEXT(ctx);
 | 
			
		||||
 | 
			
		||||
@@ -186,86 +186,57 @@ static void emit_vector(GLcontext * ctx,
 | 
			
		||||
		fprintf(stderr, "%s count %d size %d stride %d\n",
 | 
			
		||||
			__FUNCTION__, count, size, stride);
 | 
			
		||||
 | 
			
		||||
	/* Gets triggered when playing with future_hw_tcl_on ...*/
 | 
			
		||||
	/* Gets triggered when playing with future_hw_tcl_on ... */
 | 
			
		||||
	//assert(!rvb->buf);
 | 
			
		||||
 | 
			
		||||
	if (stride == 0) {
 | 
			
		||||
		r300AllocDmaRegion(rmesa, rvb, size * 4, 4);
 | 
			
		||||
		count = 1;
 | 
			
		||||
		rvb->aos_offset	= GET_START(rvb);
 | 
			
		||||
		rvb->aos_stride	= 0;
 | 
			
		||||
		rvb->aos_offset = GET_START(rvb);
 | 
			
		||||
		rvb->aos_stride = 0;
 | 
			
		||||
	} else {
 | 
			
		||||
		r300AllocDmaRegion(rmesa, rvb, size * count * 4, 4);	/* alignment? */
 | 
			
		||||
		rvb->aos_offset	= GET_START(rvb);
 | 
			
		||||
		rvb->aos_stride	= size;
 | 
			
		||||
		rvb->aos_offset = GET_START(rvb);
 | 
			
		||||
		rvb->aos_stride = size;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	/* Emit the data
 | 
			
		||||
	 */
 | 
			
		||||
	switch (size) {
 | 
			
		||||
	case 1:
 | 
			
		||||
		emit_vec4(ctx, rvb, data, stride, count);
 | 
			
		||||
		r300EmitVec4(ctx, rvb, data, stride, count);
 | 
			
		||||
		break;
 | 
			
		||||
	case 2:
 | 
			
		||||
		emit_vec8(ctx, rvb, data, stride, count);
 | 
			
		||||
		r300EmitVec8(ctx, rvb, data, stride, count);
 | 
			
		||||
		break;
 | 
			
		||||
	case 3:
 | 
			
		||||
		emit_vec12(ctx, rvb, data, stride, count);
 | 
			
		||||
		r300EmitVec12(ctx, rvb, data, stride, count);
 | 
			
		||||
		break;
 | 
			
		||||
	case 4:
 | 
			
		||||
		emit_vec16(ctx, rvb, data, stride, count);
 | 
			
		||||
		r300EmitVec16(ctx, rvb, data, stride, count);
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		assert(0);
 | 
			
		||||
		exit(1);
 | 
			
		||||
		_mesa_exit(-1);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void r300EmitElts(GLcontext * ctx, void *elts, unsigned long n_elts, int elt_size)
 | 
			
		||||
{
 | 
			
		||||
	r300ContextPtr rmesa = R300_CONTEXT(ctx);
 | 
			
		||||
	struct r300_dma_region *rvb=&rmesa->state.elt_dma;
 | 
			
		||||
	void *out;
 | 
			
		||||
	
 | 
			
		||||
	assert(elt_size == 2 || elt_size == 4);
 | 
			
		||||
	
 | 
			
		||||
	if(r300IsGartMemory(rmesa, elts, n_elts * elt_size)){
 | 
			
		||||
		rvb->address = rmesa->radeon.radeonScreen->gartTextures.map;
 | 
			
		||||
		rvb->start = ((char *)elts) - rvb->address;
 | 
			
		||||
		rvb->aos_offset = rmesa->radeon.radeonScreen->gart_texture_offset + rvb->start;
 | 
			
		||||
		
 | 
			
		||||
		return ;
 | 
			
		||||
	}else if(r300IsGartMemory(rmesa, elts, 1)){
 | 
			
		||||
		WARN_ONCE("Pointer not within GART memory!\n");
 | 
			
		||||
		exit(1);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	r300AllocDmaRegion(rmesa, rvb, n_elts * elt_size, elt_size);
 | 
			
		||||
	rvb->aos_offset	= GET_START(rvb);
 | 
			
		||||
	
 | 
			
		||||
	out = rvb->address + rvb->start;
 | 
			
		||||
	memcpy(out, elts, n_elts * elt_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static GLuint t_type(struct dt *dt)
 | 
			
		||||
{
 | 
			
		||||
	switch (dt->type) {
 | 
			
		||||
	case GL_UNSIGNED_BYTE:
 | 
			
		||||
		return AOS_FORMAT_UBYTE;
 | 
			
		||||
	
 | 
			
		||||
	case GL_SHORT:
 | 
			
		||||
		return AOS_FORMAT_USHORT;
 | 
			
		||||
	
 | 
			
		||||
	case GL_FLOAT:
 | 
			
		||||
		return AOS_FORMAT_FLOAT;
 | 
			
		||||
	
 | 
			
		||||
	default:
 | 
			
		||||
		assert(0);
 | 
			
		||||
	break;
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return AOS_FORMAT_FLOAT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -274,18 +245,15 @@ static GLuint t_vir0_size(struct dt *dt)
 | 
			
		||||
	switch (dt->type) {
 | 
			
		||||
	case GL_UNSIGNED_BYTE:
 | 
			
		||||
		return 4;
 | 
			
		||||
	
 | 
			
		||||
	case GL_SHORT:
 | 
			
		||||
		return 7;
 | 
			
		||||
	
 | 
			
		||||
	case GL_FLOAT:
 | 
			
		||||
		return dt->size - 1;
 | 
			
		||||
	
 | 
			
		||||
	default:
 | 
			
		||||
		assert(0);
 | 
			
		||||
	break;
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -294,65 +262,72 @@ static GLuint t_aos_size(struct dt *dt)
 | 
			
		||||
	switch (dt->type) {
 | 
			
		||||
	case GL_UNSIGNED_BYTE:
 | 
			
		||||
		return 1;
 | 
			
		||||
	
 | 
			
		||||
	case GL_SHORT:
 | 
			
		||||
		return 2;
 | 
			
		||||
	
 | 
			
		||||
	case GL_FLOAT:
 | 
			
		||||
		return dt->size;
 | 
			
		||||
	
 | 
			
		||||
	default:
 | 
			
		||||
		assert(0);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static GLuint t_vir0(uint32_t *dst, struct dt *dt, int *inputs, GLint *tab, GLuint nr)
 | 
			
		||||
static GLuint t_vir0(uint32_t * dst, struct dt *dt, int *inputs,
 | 
			
		||||
		     GLint * tab, GLuint nr)
 | 
			
		||||
{
 | 
			
		||||
	GLuint i, dw;
 | 
			
		||||
	
 | 
			
		||||
	for (i = 0; i + 1 < nr; i += 2){
 | 
			
		||||
		dw =  t_vir0_size(&dt[tab[i]]) | (inputs[tab[i]] << 8) | (t_type(&dt[tab[i]]) << 14);
 | 
			
		||||
		dw |= (t_vir0_size(&dt[tab[i + 1]]) | (inputs[tab[i + 1]] << 8) | (t_type(&dt[tab[i + 1]]) << 14)) << 16;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i + 1 < nr; i += 2) {
 | 
			
		||||
		dw = t_vir0_size(&dt[tab[i]]) | (inputs[tab[i]] << 8) |
 | 
			
		||||
		    (t_type(&dt[tab[i]]) << 14);
 | 
			
		||||
		dw |=
 | 
			
		||||
		    (t_vir0_size(&dt[tab[i + 1]]) |
 | 
			
		||||
		     (inputs[tab[i + 1]] << 8) | (t_type(&dt[tab[i + 1]])
 | 
			
		||||
						  << 14)) << 16;
 | 
			
		||||
 | 
			
		||||
		if (i + 2 == nr) {
 | 
			
		||||
			dw |= (1 << (13 + 16));
 | 
			
		||||
		}
 | 
			
		||||
		dst[i >> 1] = dw;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (nr & 1) {
 | 
			
		||||
		dw = t_vir0_size(&dt[tab[nr - 1]]) | (inputs[tab[nr - 1]] << 8) | (t_type(&dt[tab[nr - 1]]) << 14);
 | 
			
		||||
		dw = t_vir0_size(&dt[tab[nr - 1]]) | (inputs[tab[nr - 1]]
 | 
			
		||||
						      << 8) |
 | 
			
		||||
		    (t_type(&dt[tab[nr - 1]]) << 14);
 | 
			
		||||
		dw |= 1 << 13;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		dst[nr >> 1] = dw;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return (nr + 1) >> 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static GLuint t_swizzle(int swizzle[4])
 | 
			
		||||
{
 | 
			
		||||
	return (swizzle[0] << R300_INPUT_ROUTE_X_SHIFT) |
 | 
			
		||||
	       (swizzle[1] << R300_INPUT_ROUTE_Y_SHIFT) |
 | 
			
		||||
	       (swizzle[2] << R300_INPUT_ROUTE_Z_SHIFT) |
 | 
			
		||||
	       (swizzle[3] << R300_INPUT_ROUTE_W_SHIFT);
 | 
			
		||||
	    (swizzle[1] << R300_INPUT_ROUTE_Y_SHIFT) |
 | 
			
		||||
	    (swizzle[2] << R300_INPUT_ROUTE_Z_SHIFT) |
 | 
			
		||||
	    (swizzle[3] << R300_INPUT_ROUTE_W_SHIFT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static GLuint t_vir1(uint32_t *dst, int swizzle[][4], GLuint nr)
 | 
			
		||||
static GLuint t_vir1(uint32_t * dst, int swizzle[][4], GLuint nr)
 | 
			
		||||
{
 | 
			
		||||
	GLuint i;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i + 1 < nr; i += 2) {
 | 
			
		||||
		dst[i >> 1] = t_swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE;
 | 
			
		||||
		dst[i >> 1] |= (t_swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE) << 16;
 | 
			
		||||
		dst[i >> 1] |=
 | 
			
		||||
		    (t_swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE)
 | 
			
		||||
		    << 16;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (nr & 1)
 | 
			
		||||
		dst[nr >> 1] = t_swizzle(swizzle[nr - 1]) | R300_INPUT_ROUTE_ENABLE;
 | 
			
		||||
	
 | 
			
		||||
		dst[nr >> 1] =
 | 
			
		||||
		    t_swizzle(swizzle[nr - 1]) | R300_INPUT_ROUTE_ENABLE;
 | 
			
		||||
 | 
			
		||||
	return (nr + 1) >> 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -365,23 +340,23 @@ static GLuint t_vic(GLcontext * ctx, GLuint InputsRead)
 | 
			
		||||
{
 | 
			
		||||
	r300ContextPtr r300 = R300_CONTEXT(ctx);
 | 
			
		||||
	GLuint i, vic_1 = 0;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (InputsRead & (1 << VERT_ATTRIB_POS))
 | 
			
		||||
		vic_1 |= R300_INPUT_CNTL_POS;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (InputsRead & (1 << VERT_ATTRIB_NORMAL))
 | 
			
		||||
		vic_1 |= R300_INPUT_CNTL_NORMAL;
 | 
			
		||||
 | 
			
		||||
	if (InputsRead & (1 << VERT_ATTRIB_COLOR0))
 | 
			
		||||
		vic_1 |= R300_INPUT_CNTL_COLOR;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	r300->state.texture.tc_count = 0;
 | 
			
		||||
	for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
 | 
			
		||||
		if (InputsRead & (1 << (VERT_ATTRIB_TEX0 + i))) {
 | 
			
		||||
			r300->state.texture.tc_count++;
 | 
			
		||||
			vic_1 |= R300_INPUT_CNTL_TC0 << i;
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return vic_1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -390,7 +365,7 @@ static GLuint t_vic(GLcontext * ctx, GLuint InputsRead)
 | 
			
		||||
 * This function should never return R300_FALLBACK_TCL when using software tcl.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int r300EmitArrays(GLcontext *ctx)
 | 
			
		||||
int r300EmitArrays(GLcontext * ctx)
 | 
			
		||||
{
 | 
			
		||||
	r300ContextPtr rmesa = R300_CONTEXT(ctx);
 | 
			
		||||
	r300ContextPtr r300 = rmesa;
 | 
			
		||||
@@ -400,71 +375,100 @@ int r300EmitArrays(GLcontext *ctx)
 | 
			
		||||
	GLuint i;
 | 
			
		||||
	GLuint InputsRead = 0, OutputsWritten = 0;
 | 
			
		||||
	int *inputs = NULL;
 | 
			
		||||
	int vir_inputs[VERT_ATTRIB_MAX];
 | 
			
		||||
	GLint tab[VERT_ATTRIB_MAX];
 | 
			
		||||
	int swizzle[VERT_ATTRIB_MAX][4];
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (hw_tcl_on) {
 | 
			
		||||
		struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx);
 | 
			
		||||
		struct r300_vertex_program *prog =
 | 
			
		||||
		    (struct r300_vertex_program *)
 | 
			
		||||
		    CURRENT_VERTEX_SHADER(ctx);
 | 
			
		||||
		inputs = prog->inputs;
 | 
			
		||||
		InputsRead = CURRENT_VERTEX_SHADER(ctx)->key.InputsRead;
 | 
			
		||||
		OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten;
 | 
			
		||||
	} else {
 | 
			
		||||
		DECLARE_RENDERINPUTS(inputs_bitset);
 | 
			
		||||
		inputs = r300->state.sw_tcl_inputs;
 | 
			
		||||
		
 | 
			
		||||
		RENDERINPUTS_COPY( inputs_bitset, TNL_CONTEXT(ctx)->render_inputs_bitset );
 | 
			
		||||
		
 | 
			
		||||
		assert(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_POS ));
 | 
			
		||||
 | 
			
		||||
		RENDERINPUTS_COPY(inputs_bitset,
 | 
			
		||||
				  TNL_CONTEXT(ctx)->render_inputs_bitset);
 | 
			
		||||
 | 
			
		||||
		assert(RENDERINPUTS_TEST(inputs_bitset, _TNL_ATTRIB_POS));
 | 
			
		||||
		InputsRead |= 1 << VERT_ATTRIB_POS;
 | 
			
		||||
		OutputsWritten |= 1 << VERT_RESULT_HPOS;
 | 
			
		||||
		
 | 
			
		||||
		assert(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_NORMAL ) == 0);
 | 
			
		||||
			
 | 
			
		||||
		assert(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR0 ));
 | 
			
		||||
 | 
			
		||||
		assert(RENDERINPUTS_TEST(inputs_bitset, _TNL_ATTRIB_NORMAL)
 | 
			
		||||
		       == 0);
 | 
			
		||||
 | 
			
		||||
		assert(RENDERINPUTS_TEST(inputs_bitset, _TNL_ATTRIB_COLOR0));
 | 
			
		||||
		InputsRead |= 1 << VERT_ATTRIB_COLOR0;
 | 
			
		||||
		OutputsWritten |= 1 << VERT_RESULT_COL0;
 | 
			
		||||
		
 | 
			
		||||
		if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR1 )) {
 | 
			
		||||
 | 
			
		||||
		if (RENDERINPUTS_TEST(inputs_bitset, _TNL_ATTRIB_COLOR1)) {
 | 
			
		||||
			InputsRead |= 1 << VERT_ATTRIB_COLOR1;
 | 
			
		||||
			OutputsWritten |= 1 << VERT_RESULT_COL1;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
 | 
			
		||||
			if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_TEX(i) )) {
 | 
			
		||||
			if (RENDERINPUTS_TEST
 | 
			
		||||
			    (inputs_bitset, _TNL_ATTRIB_TEX(i))) {
 | 
			
		||||
				InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i);
 | 
			
		||||
				OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i);
 | 
			
		||||
			}
 | 
			
		||||
				
 | 
			
		||||
 | 
			
		||||
		for (i = 0, nr = 0; i < VERT_ATTRIB_MAX; i++)
 | 
			
		||||
			if (InputsRead & (1 << i))
 | 
			
		||||
				inputs[i] = nr++;
 | 
			
		||||
			else
 | 
			
		||||
				inputs[i] = -1;
 | 
			
		||||
		
 | 
			
		||||
		RENDERINPUTS_COPY( rmesa->state.render_inputs_bitset, inputs_bitset );
 | 
			
		||||
 | 
			
		||||
		if (!
 | 
			
		||||
		    (r300->radeon.radeonScreen->
 | 
			
		||||
		     chip_flags & RADEON_CHIPSET_TCL)) {
 | 
			
		||||
			/* Fixed, apply to vir0 only */
 | 
			
		||||
			memcpy(vir_inputs, inputs,
 | 
			
		||||
			       VERT_ATTRIB_MAX * sizeof(int));
 | 
			
		||||
			inputs = vir_inputs;
 | 
			
		||||
 | 
			
		||||
			if (InputsRead & VERT_ATTRIB_POS)
 | 
			
		||||
				inputs[VERT_ATTRIB_POS] = 0;
 | 
			
		||||
 | 
			
		||||
			if (InputsRead & (1 << VERT_ATTRIB_COLOR0))
 | 
			
		||||
				inputs[VERT_ATTRIB_COLOR0] = 2;
 | 
			
		||||
 | 
			
		||||
			if (InputsRead & (1 << VERT_ATTRIB_COLOR1))
 | 
			
		||||
				inputs[VERT_ATTRIB_COLOR1] = 3;
 | 
			
		||||
 | 
			
		||||
			for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++)
 | 
			
		||||
				if (InputsRead & (1 << i))
 | 
			
		||||
					inputs[i] = 6 + (i - VERT_ATTRIB_TEX0);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		RENDERINPUTS_COPY(rmesa->state.render_inputs_bitset,
 | 
			
		||||
				  inputs_bitset);
 | 
			
		||||
	}
 | 
			
		||||
	assert(InputsRead);
 | 
			
		||||
	assert(OutputsWritten);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	for (i = 0, nr = 0; i < VERT_ATTRIB_MAX; i++)
 | 
			
		||||
		if (InputsRead & (1 << i))
 | 
			
		||||
			tab[nr++] = i;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (nr > R300_MAX_AOS_ARRAYS)
 | 
			
		||||
		return R300_FALLBACK_TCL;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < nr; i++) {
 | 
			
		||||
		int ci;
 | 
			
		||||
		int comp_size, fix, found = 0;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		swizzle[i][0] = SWIZZLE_ZERO;
 | 
			
		||||
		swizzle[i][1] = SWIZZLE_ZERO;
 | 
			
		||||
		swizzle[i][2] = SWIZZLE_ZERO;
 | 
			
		||||
		swizzle[i][3] = SWIZZLE_ONE;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		for (ci = 0; ci < VB->AttribPtr[tab[i]].size; ci++)
 | 
			
		||||
			swizzle[i][ci] = ci;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
#if MESA_BIG_ENDIAN
 | 
			
		||||
#define SWAP_INT(a, b) do { \
 | 
			
		||||
	int __temp; \
 | 
			
		||||
@@ -472,107 +476,126 @@ int r300EmitArrays(GLcontext *ctx)
 | 
			
		||||
	a = b; \
 | 
			
		||||
	b = __temp; \
 | 
			
		||||
} while (0)
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
		if (VB->AttribPtr[tab[i]].type == GL_UNSIGNED_BYTE) {
 | 
			
		||||
			SWAP_INT(swizzle[i][0], swizzle[i][3]);
 | 
			
		||||
			SWAP_INT(swizzle[i][1], swizzle[i][2]);
 | 
			
		||||
		}
 | 
			
		||||
#endif /* MESA_BIG_ENDIAN */
 | 
			
		||||
		
 | 
			
		||||
		if (r300IsGartMemory(rmesa, VB->AttribPtr[tab[i]].data, /*(count-1)*stride */ 4)) {
 | 
			
		||||
#endif				/* MESA_BIG_ENDIAN */
 | 
			
		||||
 | 
			
		||||
		if (r300IsGartMemory(rmesa, VB->AttribPtr[tab[i]].data,
 | 
			
		||||
				     /*(count-1)*stride */ 4)) {
 | 
			
		||||
			if (VB->AttribPtr[tab[i]].stride % 4)
 | 
			
		||||
				return R300_FALLBACK_TCL;
 | 
			
		||||
				
 | 
			
		||||
			rmesa->state.aos[i].address = VB->AttribPtr[tab[i]].data;
 | 
			
		||||
 | 
			
		||||
			rmesa->state.aos[i].address =
 | 
			
		||||
			    VB->AttribPtr[tab[i]].data;
 | 
			
		||||
			rmesa->state.aos[i].start = 0;
 | 
			
		||||
			rmesa->state.aos[i].aos_offset = r300GartOffsetFromVirtual(rmesa, VB->AttribPtr[tab[i]].data);
 | 
			
		||||
			rmesa->state.aos[i].aos_stride = VB->AttribPtr[tab[i]].stride / 4;
 | 
			
		||||
			
 | 
			
		||||
			rmesa->state.aos[i].aos_size = t_emit_size(&VB->AttribPtr[tab[i]]);
 | 
			
		||||
			rmesa->state.aos[i].aos_offset =
 | 
			
		||||
			    r300GartOffsetFromVirtual(rmesa,
 | 
			
		||||
						      VB->
 | 
			
		||||
						      AttribPtr[tab[i]].data);
 | 
			
		||||
			rmesa->state.aos[i].aos_stride =
 | 
			
		||||
			    VB->AttribPtr[tab[i]].stride / 4;
 | 
			
		||||
 | 
			
		||||
			rmesa->state.aos[i].aos_size =
 | 
			
		||||
			    t_emit_size(&VB->AttribPtr[tab[i]]);
 | 
			
		||||
		} else {
 | 
			
		||||
			/* TODO: emit_vector can only handle 4 byte vectors */
 | 
			
		||||
			/* TODO: r300EmitVec can only handle 4 byte vectors */
 | 
			
		||||
			if (VB->AttribPtr[tab[i]].type != GL_FLOAT)
 | 
			
		||||
				return R300_FALLBACK_TCL;
 | 
			
		||||
			
 | 
			
		||||
			emit_vector(ctx, &rmesa->state.aos[i], VB->AttribPtr[tab[i]].data,
 | 
			
		||||
				    t_emit_size(&VB->AttribPtr[tab[i]]), VB->AttribPtr[tab[i]].stride, count);
 | 
			
		||||
 | 
			
		||||
			r300EmitVec(ctx, &rmesa->state.aos[i],
 | 
			
		||||
				    VB->AttribPtr[tab[i]].data,
 | 
			
		||||
				    t_emit_size(&VB->AttribPtr[tab[i]]),
 | 
			
		||||
				    VB->AttribPtr[tab[i]].stride, count);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		rmesa->state.aos[i].aos_size = t_aos_size(&VB->AttribPtr[tab[i]]);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		rmesa->state.aos[i].aos_size =
 | 
			
		||||
		    t_aos_size(&VB->AttribPtr[tab[i]]);
 | 
			
		||||
 | 
			
		||||
		comp_size = _mesa_sizeof_type(VB->AttribPtr[tab[i]].type);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		for (fix = 0; fix <= 4 - VB->AttribPtr[tab[i]].size; fix++) {
 | 
			
		||||
			if ((rmesa->state.aos[i].aos_offset - comp_size * fix) % 4)
 | 
			
		||||
			if ((rmesa->state.aos[i].aos_offset -
 | 
			
		||||
			     comp_size * fix) % 4)
 | 
			
		||||
				continue;
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			found = 1;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		if (found) {
 | 
			
		||||
			if (fix > 0) {
 | 
			
		||||
				WARN_ONCE("Feeling lucky?\n");
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			rmesa->state.aos[i].aos_offset -= comp_size * fix;
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			for (ci = 0; ci < VB->AttribPtr[tab[i]].size; ci++)
 | 
			
		||||
				swizzle[i][ci] += fix;
 | 
			
		||||
		} else {
 | 
			
		||||
			WARN_ONCE("Cannot handle offset %x with stride %d, comp %d\n",
 | 
			
		||||
				  rmesa->state.aos[i].aos_offset, rmesa->state.aos[i].aos_stride, VB->AttribPtr[tab[i]].size);
 | 
			
		||||
			WARN_ONCE
 | 
			
		||||
			    ("Cannot handle offset %x with stride %d, comp %d\n",
 | 
			
		||||
			     rmesa->state.aos[i].aos_offset,
 | 
			
		||||
			     rmesa->state.aos[i].aos_stride,
 | 
			
		||||
			     VB->AttribPtr[tab[i]].size);
 | 
			
		||||
			return R300_FALLBACK_TCL;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
			  
 | 
			
		||||
 | 
			
		||||
	/* setup INPUT_ROUTE */
 | 
			
		||||
	R300_STATECHANGE(r300, vir[0]);
 | 
			
		||||
	((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count =
 | 
			
		||||
		t_vir0(&r300->hw.vir[0].cmd[R300_VIR_CNTL_0], VB->AttribPtr, inputs, tab, nr);
 | 
			
		||||
	((drm_r300_cmd_header_t *) r300->hw.vir[0].cmd)->packet0.count =
 | 
			
		||||
	    t_vir0(&r300->hw.vir[0].cmd[R300_VIR_CNTL_0], VB->AttribPtr,
 | 
			
		||||
		   inputs, tab, nr);
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, vir[1]);
 | 
			
		||||
	((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count =
 | 
			
		||||
		t_vir1(&r300->hw.vir[1].cmd[R300_VIR_CNTL_0], swizzle, nr);
 | 
			
		||||
	((drm_r300_cmd_header_t *) r300->hw.vir[1].cmd)->packet0.count =
 | 
			
		||||
	    t_vir1(&r300->hw.vir[1].cmd[R300_VIR_CNTL_0], swizzle, nr);
 | 
			
		||||
 | 
			
		||||
	/* Set up input_cntl */
 | 
			
		||||
	/* I don't think this is needed for vertex buffers, but it doesn't hurt anything */
 | 
			
		||||
	R300_STATECHANGE(r300, vic);
 | 
			
		||||
	r300->hw.vic.cmd[R300_VIC_CNTL_0] = 0x5555;  /* Hard coded value, no idea what it means */
 | 
			
		||||
	r300->hw.vic.cmd[R300_VIC_CNTL_0] = 0x5555;	/* Hard coded value, no idea what it means */
 | 
			
		||||
	r300->hw.vic.cmd[R300_VIC_CNTL_1] = t_vic(ctx, InputsRead);
 | 
			
		||||
 | 
			
		||||
	/* Stage 3: VAP output */
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, vof);
 | 
			
		||||
	
 | 
			
		||||
	r300->hw.vof.cmd[R300_VOF_CNTL_0]=0;
 | 
			
		||||
	r300->hw.vof.cmd[R300_VOF_CNTL_1]=0;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
	r300->hw.vof.cmd[R300_VOF_CNTL_0] = 0;
 | 
			
		||||
	r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0;
 | 
			
		||||
 | 
			
		||||
	if (OutputsWritten & (1 << VERT_RESULT_HPOS))
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
 | 
			
		||||
	
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |=
 | 
			
		||||
		    R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
 | 
			
		||||
 | 
			
		||||
	if (OutputsWritten & (1 << VERT_RESULT_COL0))
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
 | 
			
		||||
	
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |=
 | 
			
		||||
		    R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
 | 
			
		||||
 | 
			
		||||
	if (OutputsWritten & (1 << VERT_RESULT_COL1))
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
 | 
			
		||||
	
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |=
 | 
			
		||||
		    R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
 | 
			
		||||
 | 
			
		||||
	/*if(OutputsWritten & (1 << VERT_RESULT_BFC0))
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
 | 
			
		||||
	
 | 
			
		||||
	if(OutputsWritten & (1 << VERT_RESULT_BFC1))
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;*/
 | 
			
		||||
	   r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
 | 
			
		||||
 | 
			
		||||
	   if(OutputsWritten & (1 << VERT_RESULT_BFC1))
 | 
			
		||||
	   r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT; */
 | 
			
		||||
	//if(OutputsWritten & (1 << VERT_RESULT_FOGC))
 | 
			
		||||
 | 
			
		||||
	if (OutputsWritten & (1 << VERT_RESULT_PSIZ))
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
 | 
			
		||||
		r300->hw.vof.cmd[R300_VOF_CNTL_0] |=
 | 
			
		||||
		    R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
 | 
			
		||||
 | 
			
		||||
	for(i=0;i < ctx->Const.MaxTextureUnits;i++)
 | 
			
		||||
		if(OutputsWritten & (1 << (VERT_RESULT_TEX0 + i)))
 | 
			
		||||
	for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
 | 
			
		||||
		if (OutputsWritten & (1 << (VERT_RESULT_TEX0 + i)))
 | 
			
		||||
			r300->hw.vof.cmd[R300_VOF_CNTL_1] |= (4 << (3 * i));
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	rmesa->state.aos_count = nr;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return R300_FALLBACK_NONE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -581,37 +604,14 @@ void r300UseArrays(GLcontext * ctx)
 | 
			
		||||
{
 | 
			
		||||
	r300ContextPtr rmesa = R300_CONTEXT(ctx);
 | 
			
		||||
	int i;
 | 
			
		||||
	
 | 
			
		||||
	if(rmesa->state.elt_dma.buf)
 | 
			
		||||
		radeon_mm_use(rmesa, rmesa->state.elt_dma.buf->id);
 | 
			
		||||
	
 | 
			
		||||
	for (i=0; i < rmesa->state.aos_count;i++) {
 | 
			
		||||
 | 
			
		||||
	if (rmesa->state.elt_dma.buf)
 | 
			
		||||
		r300_mem_use(rmesa, rmesa->state.elt_dma.buf->id);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < rmesa->state.aos_count; i++) {
 | 
			
		||||
		if (rmesa->state.aos[i].buf)
 | 
			
		||||
			radeon_mm_use(rmesa, rmesa->state.aos[i].buf->id);
 | 
			
		||||
			r300_mem_use(rmesa, rmesa->state.aos[i].buf->id);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
#ifdef HW_VBOS
 | 
			
		||||
	
 | 
			
		||||
#define USE_VBO(a) \
 | 
			
		||||
    do { \
 | 
			
		||||
	if (ctx->Array.ArrayObj->a.BufferObj->Name \
 | 
			
		||||
	    && ctx->Array.ArrayObj->a.Enabled) \
 | 
			
		||||
	    radeon_mm_use(rmesa, ((struct r300_buffer_object *)ctx->Array.ArrayObj->a.BufferObj)->id); \
 | 
			
		||||
    } while(0)
 | 
			
		||||
	
 | 
			
		||||
	if (ctx->Array.ElementArrayBufferObj->Name && ctx->Array.ElementArrayBufferObj->OnCard)
 | 
			
		||||
		radeon_mm_use(rmesa, ((struct r300_buffer_object *)ctx->Array.ElementArrayBufferObj)->id);
 | 
			
		||||
	
 | 
			
		||||
	USE_VBO(Vertex);
 | 
			
		||||
	USE_VBO(Normal);
 | 
			
		||||
	USE_VBO(Color);
 | 
			
		||||
	USE_VBO(SecondaryColor);
 | 
			
		||||
	USE_VBO(FogCoord);
 | 
			
		||||
	
 | 
			
		||||
	for (i=0; i < MAX_TEXTURE_COORD_UNITS; i++)
 | 
			
		||||
		USE_VBO(TexCoord[i]);
 | 
			
		||||
#endif
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -621,7 +621,7 @@ void r300ReleaseArrays(GLcontext * ctx)
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	r300ReleaseDmaRegion(rmesa, &rmesa->state.elt_dma, __FUNCTION__);
 | 
			
		||||
	for (i=0;i<rmesa->state.aos_count;i++) {
 | 
			
		||||
	for (i = 0; i < rmesa->state.aos_count; i++) {
 | 
			
		||||
		r300ReleaseDmaRegion(rmesa, &rmesa->state.aos[i], __FUNCTION__);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -59,10 +59,6 @@
 | 
			
		||||
 | 
			
		||||
#define CP_PACKET0(reg, n)	(RADEON_CP_PACKET0 | ((n)<<16) | ((reg)>>2))
 | 
			
		||||
 | 
			
		||||
void static inline check_space(int dwords)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static __inline__ uint32_t cmdpacket0(int reg, int count)
 | 
			
		||||
{
 | 
			
		||||
	drm_r300_cmd_header_t cmd;
 | 
			
		||||
@@ -138,7 +134,7 @@ static __inline__ uint32_t cmdpacify(void)
 | 
			
		||||
		cmd = (drm_radeon_cmd_header_t*)			\
 | 
			
		||||
			r300AllocCmdBuf(rmesa,				\
 | 
			
		||||
					(_n+2),				\
 | 
			
		||||
					__func__);			\
 | 
			
		||||
					__FUNCTION__);			\
 | 
			
		||||
		cmd_reserved=_n+2;					\
 | 
			
		||||
		cmd_written=1;						\
 | 
			
		||||
		cmd[0].i=cmdpacket0((reg), _n+1);			\
 | 
			
		||||
@@ -160,7 +156,7 @@ static __inline__ uint32_t cmdpacify(void)
 | 
			
		||||
				"cmd_written=%d cmd_reserved=%d\n",	\
 | 
			
		||||
				__FILE__, __FUNCTION__, __LINE__,	\
 | 
			
		||||
				cmd_written, cmd_reserved);		\
 | 
			
		||||
			exit(-1);					\
 | 
			
		||||
			_mesa_exit(-1);					\
 | 
			
		||||
		}							\
 | 
			
		||||
	} while(0)
 | 
			
		||||
 | 
			
		||||
@@ -173,7 +169,7 @@ static __inline__ uint32_t cmdpacify(void)
 | 
			
		||||
		cmd = (drm_radeon_cmd_header_t*)			\
 | 
			
		||||
			r300AllocCmdBuf(rmesa,				\
 | 
			
		||||
					(_n+1),				\
 | 
			
		||||
					__func__);			\
 | 
			
		||||
					__FUNCTION__);			\
 | 
			
		||||
		cmd_reserved = _n+2;					\
 | 
			
		||||
		cmd_written =1;						\
 | 
			
		||||
		cmd[0].i = cmdvpu((dest), _n/4);			\
 | 
			
		||||
@@ -188,14 +184,14 @@ static __inline__ uint32_t cmdpacify(void)
 | 
			
		||||
		cmd = (drm_radeon_cmd_header_t*)			\
 | 
			
		||||
			r300AllocCmdBuf(rmesa,				\
 | 
			
		||||
					(_n+3),				\
 | 
			
		||||
					__func__);			\
 | 
			
		||||
					__FUNCTION__);			\
 | 
			
		||||
		cmd_reserved = _n+3;					\
 | 
			
		||||
		cmd_written = 2;					\
 | 
			
		||||
		if(_n > 0x3fff) {					\
 | 
			
		||||
			fprintf(stderr,"Too big packet3 %08x: cannot "	\
 | 
			
		||||
				"store %d dwords\n",			\
 | 
			
		||||
				_p, _n);				\
 | 
			
		||||
			exit(-1);					\
 | 
			
		||||
			_mesa_exit(-1);					\
 | 
			
		||||
		}							\
 | 
			
		||||
		cmd[0].i = cmdpacket3(R300_CMD_PACKET3_RAW);		\
 | 
			
		||||
		cmd[1].i = _p | ((_n & 0x3fff)<<16);			\
 | 
			
		||||
@@ -208,85 +204,35 @@ void static inline end_3d(r300ContextPtr rmesa)
 | 
			
		||||
{
 | 
			
		||||
	drm_radeon_cmd_header_t *cmd = NULL;
 | 
			
		||||
 | 
			
		||||
	cmd = (drm_radeon_cmd_header_t*)r300AllocCmdBuf(rmesa,
 | 
			
		||||
							1,
 | 
			
		||||
							__FUNCTION__);
 | 
			
		||||
	cmd[0].header.cmd_type=R300_CMD_END3D;
 | 
			
		||||
	cmd =
 | 
			
		||||
	    (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__);
 | 
			
		||||
	cmd[0].header.cmd_type = R300_CMD_END3D;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void static inline cp_delay(r300ContextPtr rmesa, unsigned short count)
 | 
			
		||||
{
 | 
			
		||||
	drm_radeon_cmd_header_t *cmd = NULL;
 | 
			
		||||
 | 
			
		||||
	cmd = (drm_radeon_cmd_header_t*)r300AllocCmdBuf(rmesa,
 | 
			
		||||
							1,
 | 
			
		||||
							__FUNCTION__);
 | 
			
		||||
	cmd[0].i=cmdcpdelay(count);
 | 
			
		||||
	cmd =
 | 
			
		||||
	    (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__);
 | 
			
		||||
	cmd[0].i = cmdcpdelay(count);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void static inline cp_wait(r300ContextPtr rmesa, unsigned char flags)
 | 
			
		||||
{
 | 
			
		||||
	drm_radeon_cmd_header_t *cmd = NULL;
 | 
			
		||||
 | 
			
		||||
	cmd = (drm_radeon_cmd_header_t*)r300AllocCmdBuf(rmesa,
 | 
			
		||||
							1,
 | 
			
		||||
							__FUNCTION__);
 | 
			
		||||
	cmd =
 | 
			
		||||
	    (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__);
 | 
			
		||||
	cmd[0].i = cmdwait(flags);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * fire vertex buffer
 | 
			
		||||
 */
 | 
			
		||||
static void inline fire_AOS(r300ContextPtr rmesa, int vertex_count, int type)
 | 
			
		||||
{
 | 
			
		||||
	int cmd_reserved = 0;
 | 
			
		||||
	int cmd_written = 0;
 | 
			
		||||
	drm_radeon_cmd_header_t *cmd = NULL;
 | 
			
		||||
	check_space(9);
 | 
			
		||||
extern int r300EmitArrays(GLcontext * ctx);
 | 
			
		||||
 | 
			
		||||
	start_packet3(RADEON_CP_PACKET3_3D_DRAW_VBUF_2, 0);
 | 
			
		||||
#ifdef NOTNEEDED_ANYMORE
 | 
			
		||||
	e32(0x840c0024);
 | 
			
		||||
#ifdef USER_BUFFERS
 | 
			
		||||
void r300UseArrays(GLcontext * ctx);
 | 
			
		||||
#endif
 | 
			
		||||
	e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST |
 | 
			
		||||
	    (vertex_count<<16) | type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * These are followed by the corresponding data
 | 
			
		||||
 */
 | 
			
		||||
#define start_index32_packet(vertex_count, type)			\
 | 
			
		||||
	do {								\
 | 
			
		||||
		int _vc;						\
 | 
			
		||||
		_vc = (vertex_count);					\
 | 
			
		||||
		start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, _vc);	\
 | 
			
		||||
		e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (_vc<<16) |	\
 | 
			
		||||
		    type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit);		\
 | 
			
		||||
	} while (0);
 | 
			
		||||
 | 
			
		||||
#define start_index16_packet(vertex_count, type)			\
 | 
			
		||||
	do {								\
 | 
			
		||||
		int _vc, _n;						\
 | 
			
		||||
		_vc = (vertex_count);					\
 | 
			
		||||
		_n = (vertex_count+1)>>1;				\
 | 
			
		||||
		start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, _n);	\
 | 
			
		||||
		e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (_vc<<16) |	\
 | 
			
		||||
		    type);						\
 | 
			
		||||
	} while (0);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Interestingly enough this ones needs the call to setup_AOS, even thought
 | 
			
		||||
 * some of the data so setup is not needed and some is not as arbitrary
 | 
			
		||||
 * as when used by DRAW_VBUF_2 or DRAW_INDX_2
 | 
			
		||||
 */
 | 
			
		||||
#define start_immediate_packet(vertex_count, type, vertex_size)		\
 | 
			
		||||
	do {								\
 | 
			
		||||
		int _vc;						\
 | 
			
		||||
		_vc = (vertex_count);					\
 | 
			
		||||
		start_packet3(RADEON_CP_PACKET3_3D_DRAW_IMMD_2,		\
 | 
			
		||||
			      _vc*(vertex_size));			\
 | 
			
		||||
		e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED |	\
 | 
			
		||||
		    (_vc<<16) | type);					\
 | 
			
		||||
	} while (0);
 | 
			
		||||
extern void r300ReleaseArrays(GLcontext * ctx);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -41,26 +41,6 @@
 | 
			
		||||
 | 
			
		||||
#include "r300_context.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
/* representation of a register for emit_arith/swizzle */
 | 
			
		||||
typedef struct _pfs_reg_t {
 | 
			
		||||
	enum {
 | 
			
		||||
		REG_TYPE_INPUT,
 | 
			
		||||
		REG_TYPE_OUTPUT,
 | 
			
		||||
		REG_TYPE_TEMP,
 | 
			
		||||
		REG_TYPE_CONST
 | 
			
		||||
	} type:2;
 | 
			
		||||
	GLuint index:6;
 | 
			
		||||
	GLuint v_swz:5;
 | 
			
		||||
	GLuint s_swz:5;
 | 
			
		||||
	GLuint negate_v:1;
 | 
			
		||||
	GLuint negate_s:1;
 | 
			
		||||
	GLuint absolute:1;
 | 
			
		||||
	GLboolean no_use:1;
 | 
			
		||||
	GLboolean valid:1;
 | 
			
		||||
} pfs_reg_t;
 | 
			
		||||
#endif
 | 
			
		||||
typedef struct r300_fragment_program_swizzle {
 | 
			
		||||
	GLuint length;
 | 
			
		||||
	GLuint src[4];
 | 
			
		||||
@@ -118,6 +98,7 @@ typedef struct r300_fragment_program_swizzle {
 | 
			
		||||
 | 
			
		||||
struct r300_fragment_program;
 | 
			
		||||
 | 
			
		||||
extern void r300_translate_fragment_shader(r300ContextPtr r300, struct r300_fragment_program *rp);
 | 
			
		||||
extern void r300TranslateFragmentShader(r300ContextPtr r300,
 | 
			
		||||
					struct r300_fragment_program *fp);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -29,10 +29,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
**************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *   Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
 *   Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
/**
 | 
			
		||||
 * \file
 | 
			
		||||
 *
 | 
			
		||||
 * \author Keith Whitwell <keith@tungstengraphics.com>
 | 
			
		||||
 *
 | 
			
		||||
 * \author Nicolai Haehnle <prefect_@gmx.net>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sched.h>
 | 
			
		||||
@@ -61,14 +63,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
 | 
			
		||||
{
 | 
			
		||||
	GLcontext* ctx = r300->radeon.glCtx;
 | 
			
		||||
	GLcontext *ctx = r300->radeon.glCtx;
 | 
			
		||||
	__DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
 | 
			
		||||
	GLuint cboffset, cbpitch;
 | 
			
		||||
	drm_r300_cmd_header_t* cmd2;
 | 
			
		||||
	drm_r300_cmd_header_t *cmd2;
 | 
			
		||||
	int cmd_reserved = 0;
 | 
			
		||||
	int cmd_written = 0;
 | 
			
		||||
	drm_radeon_cmd_header_t *cmd = NULL;
 | 
			
		||||
	r300ContextPtr rmesa=r300;
 | 
			
		||||
	r300ContextPtr rmesa = r300;
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & DEBUG_IOCTL)
 | 
			
		||||
		fprintf(stderr, "%s: %s buffer (%i,%i %ix%i)\n",
 | 
			
		||||
@@ -87,69 +89,78 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
 | 
			
		||||
 | 
			
		||||
	cp_wait(r300, R300_WAIT_3D | R300_WAIT_3D_CLEAN);
 | 
			
		||||
	end_3d(rmesa);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, cb);
 | 
			
		||||
	reg_start(R300_RB3D_COLOROFFSET0, 0);
 | 
			
		||||
	e32(cboffset);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (r300->radeon.radeonScreen->cpp == 4)
 | 
			
		||||
		cbpitch |= R300_COLOR_FORMAT_ARGB8888;
 | 
			
		||||
	else
 | 
			
		||||
		cbpitch |= R300_COLOR_FORMAT_RGB565;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (r300->radeon.sarea->tiling_enabled)
 | 
			
		||||
		cbpitch |= R300_COLOR_TILE_ENABLE;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	reg_start(R300_RB3D_COLORPITCH0, 0);
 | 
			
		||||
	e32(cbpitch);
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, cmk);
 | 
			
		||||
	reg_start(R300_RB3D_COLORMASK, 0);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (flags & CLEARBUFFER_COLOR) {
 | 
			
		||||
		e32((ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) |
 | 
			
		||||
			(ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) |
 | 
			
		||||
			(ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) |
 | 
			
		||||
			(ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0));
 | 
			
		||||
		    (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) |
 | 
			
		||||
		    (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) |
 | 
			
		||||
		    (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0));
 | 
			
		||||
	} else {
 | 
			
		||||
		e32(0);
 | 
			
		||||
		e32(0x0);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, zs);
 | 
			
		||||
	reg_start(R300_RB3D_ZSTENCIL_CNTL_0, 2);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
	uint32_t t1, t2;
 | 
			
		||||
	
 | 
			
		||||
	t1 = 0x0;
 | 
			
		||||
	t2 = 0x0;
 | 
			
		||||
	
 | 
			
		||||
	if (flags & CLEARBUFFER_DEPTH) {
 | 
			
		||||
		t1 |= R300_RB3D_Z_WRITE_ONLY;
 | 
			
		||||
		t2 |= (R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
 | 
			
		||||
	} else {
 | 
			
		||||
		t1 |= R300_RB3D_Z_DISABLED_1; // disable
 | 
			
		||||
		uint32_t t1, t2;
 | 
			
		||||
 | 
			
		||||
		t1 = 0x0;
 | 
			
		||||
		t2 = 0x0;
 | 
			
		||||
 | 
			
		||||
		if (flags & CLEARBUFFER_DEPTH) {
 | 
			
		||||
			t1 |= R300_RB3D_Z_WRITE_ONLY;
 | 
			
		||||
			t2 |=
 | 
			
		||||
			    (R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
 | 
			
		||||
		} else {
 | 
			
		||||
			t1 |= R300_RB3D_Z_DISABLED_1;	// disable
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (flags & CLEARBUFFER_STENCIL) {
 | 
			
		||||
			t1 |= R300_RB3D_STENCIL_ENABLE;
 | 
			
		||||
			t2 |=
 | 
			
		||||
			    (R300_ZS_ALWAYS <<
 | 
			
		||||
			     R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
 | 
			
		||||
			    (R300_ZS_REPLACE <<
 | 
			
		||||
			     R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
 | 
			
		||||
			    (R300_ZS_REPLACE <<
 | 
			
		||||
			     R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) |
 | 
			
		||||
			    (R300_ZS_REPLACE <<
 | 
			
		||||
			     R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) |
 | 
			
		||||
			    (R300_ZS_ALWAYS <<
 | 
			
		||||
			     R300_RB3D_ZS1_BACK_FUNC_SHIFT) |
 | 
			
		||||
			    (R300_ZS_REPLACE <<
 | 
			
		||||
			     R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) |
 | 
			
		||||
			    (R300_ZS_REPLACE <<
 | 
			
		||||
			     R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) |
 | 
			
		||||
			    (R300_ZS_REPLACE <<
 | 
			
		||||
			     R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		e32(t1);
 | 
			
		||||
		e32(t2);
 | 
			
		||||
		e32(r300->state.stencil.clear);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if (flags & CLEARBUFFER_STENCIL) {
 | 
			
		||||
		t1 |= R300_RB3D_STENCIL_ENABLE;
 | 
			
		||||
		t2 |= 
 | 
			
		||||
		    (R300_ZS_ALWAYS<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | 
 | 
			
		||||
		    (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
 | 
			
		||||
		    (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) |
 | 
			
		||||
		    (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) |
 | 
			
		||||
		    (R300_ZS_ALWAYS<<R300_RB3D_ZS1_BACK_FUNC_SHIFT) |
 | 
			
		||||
		    (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) |
 | 
			
		||||
		    (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) |
 | 
			
		||||
		    (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) ;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	e32(t1);
 | 
			
		||||
	e32(t2);
 | 
			
		||||
	e32(r300->state.stencil.clear);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	cmd2 = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__);
 | 
			
		||||
 | 
			
		||||
	cmd2 = (drm_r300_cmd_header_t *) r300AllocCmdBuf(r300, 9, __FUNCTION__);
 | 
			
		||||
	cmd2[0].packet3.cmd_type = R300_CMD_PACKET3;
 | 
			
		||||
	cmd2[0].packet3.packet = R300_CMD_PACKET3_CLEAR;
 | 
			
		||||
	cmd2[1].u = r300PackFloat32(dPriv->w / 2.0);
 | 
			
		||||
@@ -161,11 +172,10 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
 | 
			
		||||
	cmd2[7].u = r300PackFloat32(ctx->Color.ClearColor[2]);
 | 
			
		||||
	cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]);
 | 
			
		||||
 | 
			
		||||
	reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
 | 
			
		||||
	reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0);
 | 
			
		||||
	e32(R300_RB3D_DSTCACHE_UNKNOWN_0A);
 | 
			
		||||
	  
 | 
			
		||||
 | 
			
		||||
	reg_start(R300_RB3D_ZCACHE_CTLSTAT,0);
 | 
			
		||||
	reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0);
 | 
			
		||||
	e32(R300_RB3D_ZCACHE_UNKNOWN_03);
 | 
			
		||||
	cp_wait(rmesa, R300_WAIT_3D | R300_WAIT_3D_CLEAN);
 | 
			
		||||
}
 | 
			
		||||
@@ -173,7 +183,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
 | 
			
		||||
static void r300EmitClearState(GLcontext * ctx)
 | 
			
		||||
{
 | 
			
		||||
	r300ContextPtr r300 = R300_CONTEXT(ctx);
 | 
			
		||||
	r300ContextPtr rmesa=r300;
 | 
			
		||||
	r300ContextPtr rmesa = r300;
 | 
			
		||||
	__DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
 | 
			
		||||
	int i;
 | 
			
		||||
	int cmd_reserved = 0;
 | 
			
		||||
@@ -182,49 +192,62 @@ static void r300EmitClearState(GLcontext * ctx)
 | 
			
		||||
	int has_tcl = 1;
 | 
			
		||||
 | 
			
		||||
	if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL))
 | 
			
		||||
 	      has_tcl = 0;
 | 
			
		||||
		
 | 
			
		||||
		has_tcl = 0;
 | 
			
		||||
 | 
			
		||||
	/* FIXME: the values written to R300_VAP_INPUT_ROUTE_0_0 and
 | 
			
		||||
	 * R300_VAP_INPUT_ROUTE_0_1 are in fact known, however, the values are
 | 
			
		||||
	 * quite complex; see the functions in r300_emit.c.
 | 
			
		||||
	 *
 | 
			
		||||
	 * I believe it would be a good idea to extend the functions in
 | 
			
		||||
	 * r300_emit.c so that they can be used to setup the default values for
 | 
			
		||||
	 * these registers, as well as the actual values used for rendering.
 | 
			
		||||
	 */
 | 
			
		||||
	R300_STATECHANGE(r300, vir[0]);
 | 
			
		||||
	reg_start(R300_VAP_INPUT_ROUTE_0_0, 0);
 | 
			
		||||
	if (!has_tcl)
 | 
			
		||||
	  e32(0x22030003);
 | 
			
		||||
		e32(0x22030003);
 | 
			
		||||
	else
 | 
			
		||||
	  e32(0x21030003);
 | 
			
		||||
	
 | 
			
		||||
		e32(0x21030003);
 | 
			
		||||
 | 
			
		||||
	/* disable fog */
 | 
			
		||||
	R300_STATECHANGE(r300, fogs);
 | 
			
		||||
	reg_start(R300_RE_FOG_STATE, 0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, vir[1]);
 | 
			
		||||
	reg_start(R300_VAP_INPUT_ROUTE_1_0, 0);
 | 
			
		||||
	e32(0xF688F688);
 | 
			
		||||
 | 
			
		||||
	/* R300_VAP_INPUT_CNTL_0, R300_VAP_INPUT_CNTL_1 */
 | 
			
		||||
	R300_STATECHANGE(r300, vic);
 | 
			
		||||
	reg_start(R300_VAP_INPUT_CNTL_0, 1);
 | 
			
		||||
	e32(0x00000001);
 | 
			
		||||
	e32(0x00000405);
 | 
			
		||||
	e32(R300_INPUT_CNTL_0_COLOR);
 | 
			
		||||
	e32(R300_INPUT_CNTL_POS | R300_INPUT_CNTL_COLOR | R300_INPUT_CNTL_TC0);
 | 
			
		||||
 | 
			
		||||
	if (!has_tcl) {
 | 
			
		||||
	  /* comes from fglrx startup of clear */
 | 
			
		||||
	  reg_start(R300_SE_VTE_CNTL, 1);
 | 
			
		||||
	  e32(0x043f);
 | 
			
		||||
	  e32(0x8);
 | 
			
		||||
	  
 | 
			
		||||
	  reg_start(0x21dc, 0);
 | 
			
		||||
	  e32(0xaaaaaaaa);
 | 
			
		||||
		R300_STATECHANGE(r300, vte);
 | 
			
		||||
		/* comes from fglrx startup of clear */
 | 
			
		||||
		reg_start(R300_SE_VTE_CNTL, 1);
 | 
			
		||||
		e32(R300_VTX_W0_FMT | R300_VPORT_X_SCALE_ENA |
 | 
			
		||||
		    R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
 | 
			
		||||
		    R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
 | 
			
		||||
		    R300_VPORT_Z_OFFSET_ENA);
 | 
			
		||||
		e32(0x8);
 | 
			
		||||
 | 
			
		||||
		reg_start(0x21dc, 0);
 | 
			
		||||
		e32(0xaaaaaaaa);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, vof);
 | 
			
		||||
	reg_start(R300_VAP_OUTPUT_VTX_FMT_0, 1);
 | 
			
		||||
	e32(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT);
 | 
			
		||||
	e32(0); /* no textures */
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
	e32(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT |
 | 
			
		||||
	    R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT);
 | 
			
		||||
	e32(0x0);			/* no textures */
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, txe);
 | 
			
		||||
	reg_start(R300_TX_ENABLE, 0);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, vpt);
 | 
			
		||||
	reg_start(R300_SE_VPORT_XSCALE, 5);
 | 
			
		||||
	efloat(1.0);
 | 
			
		||||
@@ -233,28 +256,28 @@ static void r300EmitClearState(GLcontext * ctx)
 | 
			
		||||
	efloat(dPriv->y);
 | 
			
		||||
	efloat(1.0);
 | 
			
		||||
	efloat(0.0);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, at);
 | 
			
		||||
	reg_start(R300_PP_ALPHA_TEST, 0);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, bld);
 | 
			
		||||
	reg_start(R300_RB3D_CBLEND, 1);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, unk221C);
 | 
			
		||||
	reg_start(R300_VAP_UNKNOWN_221C, 0);
 | 
			
		||||
	e32(R300_221C_CLEAR);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, ps);
 | 
			
		||||
	reg_start(R300_RE_POINTSIZE, 0);
 | 
			
		||||
	e32(((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) |
 | 
			
		||||
		((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT));
 | 
			
		||||
	
 | 
			
		||||
	    ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT));
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, ri);
 | 
			
		||||
	reg_start(R300_RS_INTERP_0, 8);
 | 
			
		||||
	for(i = 0; i < 8; ++i){
 | 
			
		||||
	for (i = 0; i < 8; ++i) {
 | 
			
		||||
		e32(R300_RS_INTERP_USED);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -262,64 +285,61 @@ static void r300EmitClearState(GLcontext * ctx)
 | 
			
		||||
	/* The second constant is needed to get glxgears display anything .. */
 | 
			
		||||
	reg_start(R300_RS_CNTL_0, 1);
 | 
			
		||||
	e32((1 << R300_RS_CNTL_CI_CNT_SHIFT) | R300_RS_CNTL_0_UNKNOWN_18);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, rr);
 | 
			
		||||
	reg_start(R300_RS_ROUTE_0, 0);
 | 
			
		||||
	e32(0x00004000);
 | 
			
		||||
	
 | 
			
		||||
	e32(R300_RS_ROUTE_0_COLOR);
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, fp);
 | 
			
		||||
	reg_start(R300_PFS_CNTL_0, 2);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	reg_start(R300_PFS_NODE_0, 3);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	e32(0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	e32(0x0);
 | 
			
		||||
	e32(R300_PFS_NODE_OUTPUT_COLOR);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	R300_STATECHANGE(r300, fpi[0]);
 | 
			
		||||
	R300_STATECHANGE(r300, fpi[1]);
 | 
			
		||||
	R300_STATECHANGE(r300, fpi[2]);
 | 
			
		||||
	R300_STATECHANGE(r300, fpi[3]);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	reg_start(R300_PFS_INSTR0_0, 0);
 | 
			
		||||
	e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)));
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	reg_start(R300_PFS_INSTR1_0, 0);
 | 
			
		||||
	e32(FP_SELC(0,NO,XYZ,FP_TMP(0),0,0));
 | 
			
		||||
	
 | 
			
		||||
	e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0));
 | 
			
		||||
 | 
			
		||||
	reg_start(R300_PFS_INSTR2_0, 0);
 | 
			
		||||
	e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)));
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	reg_start(R300_PFS_INSTR3_0, 0);
 | 
			
		||||
	e32(FP_SELA(0,NO,W,FP_TMP(0),0,0));
 | 
			
		||||
	e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0));
 | 
			
		||||
 | 
			
		||||
	if (has_tcl) {
 | 
			
		||||
	  R300_STATECHANGE(r300, pvs);
 | 
			
		||||
	  reg_start(R300_VAP_PVS_CNTL_1, 2);
 | 
			
		||||
	  e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
 | 
			
		||||
	      (0 << R300_PVS_CNTL_1_POS_END_SHIFT) |
 | 
			
		||||
	      (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT));
 | 
			
		||||
	  e32(0);
 | 
			
		||||
	  e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT);
 | 
			
		||||
	  
 | 
			
		||||
	  R300_STATECHANGE(r300, vpi);
 | 
			
		||||
	  vsf_start_fragment(0x0, 8);
 | 
			
		||||
	  e32(VP_OUT(ADD,OUT,0,XYZW));
 | 
			
		||||
	  e32(VP_IN(IN,0));
 | 
			
		||||
	  e32(VP_ZERO());
 | 
			
		||||
	  e32(0);
 | 
			
		||||
	
 | 
			
		||||
	  e32(VP_OUT(ADD,OUT,1,XYZW));
 | 
			
		||||
	  e32(VP_IN(IN,1));
 | 
			
		||||
	  e32(VP_ZERO());
 | 
			
		||||
	  e32(0);
 | 
			
		||||
		R300_STATECHANGE(r300, pvs);
 | 
			
		||||
		reg_start(R300_VAP_PVS_CNTL_1, 2);
 | 
			
		||||
		e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
 | 
			
		||||
		    (0 << R300_PVS_CNTL_1_POS_END_SHIFT) |
 | 
			
		||||
		    (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT));
 | 
			
		||||
		e32(0x0);
 | 
			
		||||
		e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT);
 | 
			
		||||
 | 
			
		||||
		R300_STATECHANGE(r300, vpi);
 | 
			
		||||
		vsf_start_fragment(0x0, 8);
 | 
			
		||||
		e32(VP_OUT(ADD, OUT, 0, XYZW));
 | 
			
		||||
		e32(VP_IN(IN, 0));
 | 
			
		||||
		e32(VP_ZERO());
 | 
			
		||||
		e32(0x0);
 | 
			
		||||
 | 
			
		||||
		e32(VP_OUT(ADD, OUT, 1, XYZW));
 | 
			
		||||
		e32(VP_IN(IN, 1));
 | 
			
		||||
		e32(VP_ZERO());
 | 
			
		||||
		e32(0x0);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/*reg_start(0x4500,0);
 | 
			
		||||
	e32(2560-1);*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -357,8 +377,8 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask)
 | 
			
		||||
		bits |= CLEARBUFFER_DEPTH;
 | 
			
		||||
		mask &= ~BUFFER_BIT_DEPTH;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if ( (mask & BUFFER_BIT_STENCIL) && r300->state.stencil.hw_stencil) {
 | 
			
		||||
 | 
			
		||||
	if ((mask & BUFFER_BIT_STENCIL) && r300->state.stencil.hw_stencil) {
 | 
			
		||||
		bits |= CLEARBUFFER_STENCIL;
 | 
			
		||||
		mask &= ~BUFFER_BIT_STENCIL;
 | 
			
		||||
	}
 | 
			
		||||
@@ -370,11 +390,11 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask)
 | 
			
		||||
		_swrast_Clear(ctx, mask);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1);
 | 
			
		||||
	swapped = r300->radeon.sarea->pfCurrentPage == 1;
 | 
			
		||||
 | 
			
		||||
	/* Make sure it fits there. */
 | 
			
		||||
	r300EnsureCmdBufSpace(r300, 421*3, __FUNCTION__);
 | 
			
		||||
	if(flags || bits)
 | 
			
		||||
	r300EnsureCmdBufSpace(r300, 421 * 3, __FUNCTION__);
 | 
			
		||||
	if (flags || bits)
 | 
			
		||||
		r300EmitClearState(ctx);
 | 
			
		||||
 | 
			
		||||
	if (flags & BUFFER_BIT_FRONT_LEFT) {
 | 
			
		||||
@@ -392,7 +412,6 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void r300Flush(GLcontext * ctx)
 | 
			
		||||
{
 | 
			
		||||
	r300ContextPtr r300 = R300_CONTEXT(ctx);
 | 
			
		||||
@@ -405,13 +424,13 @@ void r300Flush(GLcontext * ctx)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef USER_BUFFERS
 | 
			
		||||
#include "radeon_mm.h"
 | 
			
		||||
#include "r300_mem.h"
 | 
			
		||||
 | 
			
		||||
static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa, int size)
 | 
			
		||||
{
 | 
			
		||||
	struct r300_dma_buffer *dmabuf;
 | 
			
		||||
	size = MAX2(size, RADEON_BUFFER_SIZE*16);
 | 
			
		||||
	
 | 
			
		||||
	size = MAX2(size, RADEON_BUFFER_SIZE * 16);
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA))
 | 
			
		||||
		fprintf(stderr, "%s\n", __FUNCTION__);
 | 
			
		||||
 | 
			
		||||
@@ -424,37 +443,31 @@ static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa, int size)
 | 
			
		||||
 | 
			
		||||
	if (rmesa->dma.nr_released_bufs > 4)
 | 
			
		||||
		r300FlushCmdBuf(rmesa, __FUNCTION__);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	dmabuf = CALLOC_STRUCT(r300_dma_buffer);
 | 
			
		||||
	dmabuf->buf = (void *)1; /* hack */
 | 
			
		||||
	dmabuf->buf = (void *)1;	/* hack */
 | 
			
		||||
	dmabuf->refcount = 1;
 | 
			
		||||
 | 
			
		||||
	dmabuf->id = radeon_mm_alloc(rmesa, 4, size);
 | 
			
		||||
	dmabuf->id = r300_mem_alloc(rmesa, 4, size);
 | 
			
		||||
	if (dmabuf->id == 0) {
 | 
			
		||||
		LOCK_HARDWARE(&rmesa->radeon);	/* no need to validate */
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		r300FlushCmdBufLocked(rmesa, __FUNCTION__);
 | 
			
		||||
		radeonWaitForIdleLocked(&rmesa->radeon);
 | 
			
		||||
		
 | 
			
		||||
		dmabuf->id = radeon_mm_alloc(rmesa, 4, size);
 | 
			
		||||
 | 
			
		||||
#ifdef HW_VBOS
 | 
			
		||||
		if (dmabuf->id == 0) {
 | 
			
		||||
			/* Just kick all */
 | 
			
		||||
			r300_evict_vbos(rmesa->radeon.glCtx, /*RADEON_BUFFER_SIZE*16*/1<<30);
 | 
			
		||||
			dmabuf->id = radeon_mm_alloc(rmesa, 4, size);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		dmabuf->id = r300_mem_alloc(rmesa, 4, size);
 | 
			
		||||
 | 
			
		||||
		UNLOCK_HARDWARE(&rmesa->radeon);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		if (dmabuf->id == 0) {
 | 
			
		||||
			fprintf(stderr, "Error: Could not get dma buffer... exiting\n");
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"Error: Could not get dma buffer... exiting\n");
 | 
			
		||||
			_mesa_exit(-1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
	rmesa->dma.current.buf = dmabuf;
 | 
			
		||||
	rmesa->dma.current.address = radeon_mm_ptr(rmesa, dmabuf->id);
 | 
			
		||||
	rmesa->dma.current.address = r300_mem_ptr(rmesa, dmabuf->id);
 | 
			
		||||
	rmesa->dma.current.end = size;
 | 
			
		||||
	rmesa->dma.current.start = 0;
 | 
			
		||||
	rmesa->dma.current.ptr = 0;
 | 
			
		||||
@@ -473,7 +486,7 @@ void r300ReleaseDmaRegion(r300ContextPtr rmesa,
 | 
			
		||||
		rmesa->dma.flush(rmesa);
 | 
			
		||||
 | 
			
		||||
	if (--region->buf->refcount == 0) {
 | 
			
		||||
		radeon_mm_free(rmesa, region->buf->id);
 | 
			
		||||
		r300_mem_free(rmesa, region->buf->id);
 | 
			
		||||
		FREE(region->buf);
 | 
			
		||||
		rmesa->dma.nr_released_bufs++;
 | 
			
		||||
	}
 | 
			
		||||
@@ -503,8 +516,7 @@ void r300AllocDmaRegion(r300ContextPtr rmesa,
 | 
			
		||||
	    (rmesa->dma.current.ptr + alignment) & ~alignment;
 | 
			
		||||
 | 
			
		||||
	if (rmesa->dma.current.ptr + bytes > rmesa->dma.current.end)
 | 
			
		||||
		r300RefillCurrentDmaRegion(rmesa,
 | 
			
		||||
					   (bytes + 0x7) & ~0x7);
 | 
			
		||||
		r300RefillCurrentDmaRegion(rmesa, (bytes + 0x7) & ~0x7);
 | 
			
		||||
 | 
			
		||||
	region->start = rmesa->dma.current.start;
 | 
			
		||||
	region->ptr = rmesa->dma.current.start;
 | 
			
		||||
@@ -529,7 +541,7 @@ static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa)
 | 
			
		||||
	int size = 0;
 | 
			
		||||
	drmDMAReq dma;
 | 
			
		||||
	int ret;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA))
 | 
			
		||||
		fprintf(stderr, "%s\n", __FUNCTION__);
 | 
			
		||||
 | 
			
		||||
@@ -572,8 +584,9 @@ static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa)
 | 
			
		||||
 | 
			
		||||
		if (ret != 0) {
 | 
			
		||||
			UNLOCK_HARDWARE(&rmesa->radeon);
 | 
			
		||||
			fprintf(stderr, "Error: Could not get dma buffer... exiting\n");
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"Error: Could not get dma buffer... exiting\n");
 | 
			
		||||
			_mesa_exit(-1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -609,15 +622,16 @@ void r300ReleaseDmaRegion(r300ContextPtr rmesa,
 | 
			
		||||
		drm_radeon_cmd_header_t *cmd;
 | 
			
		||||
 | 
			
		||||
		if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA))
 | 
			
		||||
			fprintf(stderr, "%s -- DISCARD BUF %d\n", __FUNCTION__,
 | 
			
		||||
				region->buf->buf->idx);
 | 
			
		||||
			fprintf(stderr, "%s -- DISCARD BUF %d\n",
 | 
			
		||||
				__FUNCTION__, region->buf->buf->idx);
 | 
			
		||||
		cmd =
 | 
			
		||||
		    (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa,
 | 
			
		||||
								sizeof(*cmd) / 4,
 | 
			
		||||
								sizeof
 | 
			
		||||
								(*cmd) / 4,
 | 
			
		||||
								__FUNCTION__);
 | 
			
		||||
		cmd->dma.cmd_type = R300_CMD_DMA_DISCARD;
 | 
			
		||||
		cmd->dma.buf_idx = region->buf->buf->idx;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		FREE(region->buf);
 | 
			
		||||
		rmesa->dma.nr_released_bufs++;
 | 
			
		||||
	}
 | 
			
		||||
@@ -665,34 +679,15 @@ void r300AllocDmaRegion(r300ContextPtr rmesa,
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Called via glXGetMemoryOffsetMESA() */
 | 
			
		||||
GLuint r300GetMemoryOffsetMESA(__DRInativeDisplay * dpy, int scrn,
 | 
			
		||||
			       const GLvoid * pointer)
 | 
			
		||||
{
 | 
			
		||||
	GET_CURRENT_CONTEXT(ctx);
 | 
			
		||||
	r300ContextPtr rmesa;
 | 
			
		||||
	GLuint card_offset;
 | 
			
		||||
 | 
			
		||||
	if (!ctx || !(rmesa = R300_CONTEXT(ctx))) {
 | 
			
		||||
		fprintf(stderr, "%s: no context\n", __FUNCTION__);
 | 
			
		||||
		return ~0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!r300IsGartMemory(rmesa, pointer, 0))
 | 
			
		||||
		return ~0;
 | 
			
		||||
 | 
			
		||||
	card_offset = r300GartOffsetFromVirtual(rmesa, pointer);
 | 
			
		||||
 | 
			
		||||
	return card_offset - rmesa->radeon.radeonScreen->gart_base;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GLboolean r300IsGartMemory(r300ContextPtr rmesa, const GLvoid * pointer,
 | 
			
		||||
			   GLint size)
 | 
			
		||||
{
 | 
			
		||||
	int offset =
 | 
			
		||||
	    (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
 | 
			
		||||
	    (char *)pointer -
 | 
			
		||||
	    (char *)rmesa->radeon.radeonScreen->gartTextures.map;
 | 
			
		||||
	int valid = (size >= 0 && offset >= 0
 | 
			
		||||
		     && offset + size < rmesa->radeon.radeonScreen->gartTextures.size);
 | 
			
		||||
		     && offset + size <
 | 
			
		||||
		     rmesa->radeon.radeonScreen->gartTextures.size);
 | 
			
		||||
 | 
			
		||||
	if (RADEON_DEBUG & DEBUG_IOCTL)
 | 
			
		||||
		fprintf(stderr, "r300IsGartMemory( %p ) : %d\n", pointer,
 | 
			
		||||
@@ -704,11 +699,13 @@ GLboolean r300IsGartMemory(r300ContextPtr rmesa, const GLvoid * pointer,
 | 
			
		||||
GLuint r300GartOffsetFromVirtual(r300ContextPtr rmesa, const GLvoid * pointer)
 | 
			
		||||
{
 | 
			
		||||
	int offset =
 | 
			
		||||
	    (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
 | 
			
		||||
	    (char *)pointer -
 | 
			
		||||
	    (char *)rmesa->radeon.radeonScreen->gartTextures.map;
 | 
			
		||||
 | 
			
		||||
	//fprintf(stderr, "offset=%08x\n", offset);
 | 
			
		||||
 | 
			
		||||
	if (offset < 0 || offset > rmesa->radeon.radeonScreen->gartTextures.size)
 | 
			
		||||
	if (offset < 0
 | 
			
		||||
	    || offset > rmesa->radeon.radeonScreen->gartTextures.size)
 | 
			
		||||
		return ~0;
 | 
			
		||||
	else
 | 
			
		||||
		return rmesa->radeon.radeonScreen->gart_texture_offset + offset;
 | 
			
		||||
 
 | 
			
		||||
@@ -39,11 +39,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#include "r300_context.h"
 | 
			
		||||
#include "radeon_drm.h"
 | 
			
		||||
 | 
			
		||||
extern GLuint r300GetMemoryOffsetMESA(__DRInativeDisplay * dpy, int scrn,
 | 
			
		||||
				      const GLvoid * pointer);
 | 
			
		||||
 | 
			
		||||
extern GLboolean r300IsGartMemory(r300ContextPtr rmesa, const GLvoid * pointer,
 | 
			
		||||
				  GLint size);
 | 
			
		||||
extern GLboolean r300IsGartMemory(r300ContextPtr rmesa,
 | 
			
		||||
				  const GLvoid * pointer, GLint size);
 | 
			
		||||
 | 
			
		||||
extern GLuint r300GartOffsetFromVirtual(r300ContextPtr rmesa,
 | 
			
		||||
					const GLvoid * pointer);
 | 
			
		||||
@@ -51,10 +48,11 @@ extern GLuint r300GartOffsetFromVirtual(r300ContextPtr rmesa,
 | 
			
		||||
extern void r300Flush(GLcontext * ctx);
 | 
			
		||||
 | 
			
		||||
extern void r300ReleaseDmaRegion(r300ContextPtr rmesa,
 | 
			
		||||
			  struct r300_dma_region *region, const char *caller);
 | 
			
		||||
				 struct r300_dma_region *region,
 | 
			
		||||
				 const char *caller);
 | 
			
		||||
extern void r300AllocDmaRegion(r300ContextPtr rmesa,
 | 
			
		||||
			struct r300_dma_region *region,
 | 
			
		||||
			int bytes, int alignment);
 | 
			
		||||
			       struct r300_dma_region *region, int bytes,
 | 
			
		||||
			       int alignment);
 | 
			
		||||
 | 
			
		||||
extern void r300InitIoctlFuncs(struct dd_function_table *functions);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user