Compare commits
	
		
			433 Commits
		
	
	
		
			gliding_pe
			...
			mesa_20050
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 020225496e | ||
|  | 69509641a8 | ||
|  | 978d2fda3c | ||
|  | ae516306b4 | ||
|  | e45b5a4fa8 | ||
|  | 8e5099d6a0 | ||
|  | d2ee346a93 | ||
|  | 170999a103 | ||
|  | d1834e8c10 | ||
|  | 0432411837 | ||
|  | 0f71c6691e | ||
|  | fc534034cc | ||
|  | 1de60fe47f | ||
|  | c16264b138 | ||
|  | 1aadf1c039 | ||
|  | 1008f57f6f | ||
|  | 2b73e5aaaf | ||
|  | 863eca9973 | ||
|  | 39e14d2cff | ||
|  | 741b980433 | ||
|  | 3f6d985753 | ||
|  | 49109d01c0 | ||
|  | 8286abd798 | ||
|  | 53d13e014f | ||
|  | f387c83ec1 | ||
|  | e87ab8c05f | ||
|  | 6b5afb0036 | ||
|  | 89bf62cd49 | ||
|  | 5dc31379c4 | ||
|  | c97a3a3038 | ||
|  | 7df5eddf6a | ||
|  | f7c0c4f485 | ||
|  | b4c8b34534 | ||
|  | 45ab8cb08a | ||
|  | b31b1f44f1 | ||
|  | 7708b75d72 | ||
|  | c73968af95 | ||
|  | 9a726cdf8f | ||
|  | 7179810375 | ||
|  | a1b07e187e | ||
|  | 39c0e51329 | ||
|  | 2f9722863d | ||
|  | 731f1b12a0 | ||
|  | 2d5f12ae6b | ||
|  | afa7f6a0f5 | ||
|  | eeada48497 | ||
|  | 0c4731b27c | ||
|  | 17bcf9f816 | ||
|  | eb9d6f44a9 | ||
|  | 241b6b7ab1 | ||
|  | 2dea6df80b | ||
|  | 6fe176a648 | ||
|  | eb8be5d923 | ||
|  | 446980473d | ||
|  | b70a47736a | ||
|  | 3cc2f82bb5 | ||
|  | 923515b3f8 | ||
|  | e3e8067db7 | ||
|  | 8f384f0b67 | ||
|  | e58d32947e | ||
|  | 063efce6ee | ||
|  | bab559b1fa | ||
|  | 8f8e0f0b01 | ||
|  | 18a74321aa | ||
|  | c2745ffa49 | ||
|  | 9557401a98 | ||
|  | 67cc1f6ba6 | ||
|  | c70dace694 | ||
|  | 6040d34109 | ||
|  | 8608978aba | ||
|  | 02168254a8 | ||
|  | e5ff2b94ff | ||
|  | 216f89318e | ||
|  | e3cdbca63f | ||
|  | 6bc9ea1df9 | ||
|  | 9a1b5af333 | ||
|  | 8818eae253 | ||
|  | 2b2bd08589 | ||
|  | dc7fc17396 | ||
|  | 96582f4f28 | ||
|  | dd4c1dd038 | ||
|  | b745bf08cd | ||
|  | 2f74adc41f | ||
|  | e53fc72f67 | ||
|  | bd565e4bb7 | ||
|  | 9a3da7ea7b | ||
|  | 6e56f905d0 | ||
|  | 2860e5f536 | ||
|  | 22652f952f | ||
|  | ae818ed1da | ||
|  | 198d6d05b0 | ||
|  | 5a0cb726d1 | ||
|  | d2ab4eb2c2 | ||
|  | 2ec2e94e2e | ||
|  | 40c1c723fb | ||
|  | bf7f998f39 | ||
|  | bb2c65200c | ||
|  | 5119056324 | ||
|  | 4c80f8df46 | ||
|  | e03b5cdf3f | ||
|  | 167b141e6e | ||
|  | d06da50888 | ||
|  | c1082804a8 | ||
|  | ffd97d20aa | ||
|  | a33f0d3024 | ||
|  | 380991cb65 | ||
|  | 3e8001a465 | ||
|  | af1a729972 | ||
|  | cf4f3c5061 | ||
|  | 4cf20d9236 | ||
|  | 72a313902b | ||
|  | f9bad3dfea | ||
|  | a495ed372f | ||
|  | d9789b7861 | ||
|  | 51ac95ba89 | ||
|  | 6493bd07a7 | ||
|  | 7bfe8df08a | ||
|  | 5873faf39b | ||
|  | fdeda9c458 | ||
|  | 9b134f641c | ||
|  | efeea95dcc | ||
|  | 45472672a2 | ||
|  | aca2e0da3c | ||
|  | d5084d42d4 | ||
|  | 578f63f2bf | ||
|  | 1c606a9aa1 | ||
|  | 09f433b97c | ||
|  | 8110df4f61 | ||
|  | 9cf35d2876 | ||
|  | 11bd5c1ac4 | ||
|  | 686e9b9f57 | ||
|  | aecc05627a | ||
|  | d0ddf190aa | ||
|  | 5cb977fedf | ||
|  | 296428dcf4 | ||
|  | ee83a1302f | ||
|  | 7012d01d88 | ||
|  | a6ed129dfc | ||
|  | 733bc876ee | ||
|  | 64034c4fb5 | ||
|  | 846eb333ae | ||
|  | c9a69a6968 | ||
|  | 269e3895d9 | ||
|  | 5c72837af9 | ||
|  | 5f430c9976 | ||
|  | 714be699be | ||
|  | 10432bcc0a | ||
|  | 69a2f7cdd5 | ||
|  | db21f1c84f | ||
|  | 4e68f4c1fa | ||
|  | 1e5772f0ba | ||
|  | ac6728d2d9 | ||
|  | 49d8cbe8d1 | ||
|  | 9d148e6b2b | ||
|  | 363d0bcf01 | ||
|  | e490242b9a | ||
|  | a582015905 | ||
|  | 3509fd8c1b | ||
|  | 93cd9237d7 | ||
|  | 1243b829bb | ||
|  | 2fcaf7a529 | ||
|  | a42fe19d8d | ||
|  | e57d5c4742 | ||
|  | 5a5b4436cb | ||
|  | 3ffe8731e6 | ||
|  | c5f5055097 | ||
|  | dbeea25bb8 | ||
|  | f29f2fc294 | ||
|  | ab81d1fd99 | ||
|  | d9fdb6c2bb | ||
|  | 9eef0da109 | ||
|  | 8b88f62fbd | ||
|  | 948fa3b295 | ||
|  | 586f2c59fe | ||
|  | e3b0c19ec9 | ||
|  | 9ca8815d3b | ||
|  | ecb6bfc0ce | ||
|  | fee163a61a | ||
|  | 0e26580c90 | ||
|  | c8542705f7 | ||
|  | 435eff8b85 | ||
|  | 276330b241 | ||
|  | ff6723e326 | ||
|  | 1180fc13db | ||
|  | 5c6aec2f39 | ||
|  | 86300c6945 | ||
|  | fc3bc1ae14 | ||
|  | d3bd97bb14 | ||
|  | 52064f6c37 | ||
|  | 2eb147e7f5 | ||
|  | 6f3d16c64a | ||
|  | 42fa81275c | ||
|  | e3f684b753 | ||
|  | 883d20791a | ||
|  | b1d0ac64ab | ||
|  | c64573997c | ||
|  | e133984f51 | ||
|  | bd8162aaac | ||
|  | 4a55d4ffa7 | ||
|  | 6258b76c49 | ||
|  | 203dcb733d | ||
|  | bd1d9d96b2 | ||
|  | 9f8b3fac97 | ||
|  | 0355d3ff94 | ||
|  | cb34c11663 | ||
|  | 1077779c7d | ||
|  | 1c39d183c4 | ||
|  | fd4f7064e2 | ||
|  | db46e2a7dd | ||
|  | e7769cb348 | ||
|  | d83c4e6dd1 | ||
|  | 73e8ffe9f3 | ||
|  | 286c4cc201 | ||
|  | b3e878ad90 | ||
|  | eae0439ae6 | ||
|  | 79c0bb5264 | ||
|  | 41a93f544e | ||
|  | e4b2356c07 | ||
|  | ebef61f5c0 | ||
|  | fe6ee3f5e6 | ||
|  | f5581bb994 | ||
|  | 47b29f511a | ||
|  | c3f764f7bb | ||
|  | 3151b27b0a | ||
|  | 209b090241 | ||
|  | d8f9599403 | ||
|  | c6e1569b7f | ||
|  | 82761cb08b | ||
|  | c22990c29a | ||
|  | 3aeae20685 | ||
|  | 884b5ade86 | ||
|  | 138b7ef4d9 | ||
|  | 3a934557bf | ||
|  | 5f0bf77255 | ||
|  | 8af7ff1ded | ||
|  | 1c54579e86 | ||
|  | 7d33053e47 | ||
|  | 47d18cbb64 | ||
|  | f1d053b19a | ||
|  | 28d0a9c9dd | ||
|  | 5f534aa1e2 | ||
|  | e9e20fc47d | ||
|  | a5cb1aa211 | ||
|  | 431417fec7 | ||
|  | 5c81a4b9cd | ||
|  | a6ebcdfe7d | ||
|  | 2c19069182 | ||
|  | 15e75e00c7 | ||
|  | d59054e60b | ||
|  | 5cef1a1fed | ||
|  | 545515cbea | ||
|  | 97e1e60b1c | ||
|  | 69441868f6 | ||
|  | 55d8dd4078 | ||
|  | d09df24082 | ||
|  | c03b6f40ba | ||
|  | c039af165d | ||
|  | c3259fa436 | ||
|  | b83aadb0e4 | ||
|  | 576caad33e | ||
|  | cbc8d7596a | ||
|  | 6ffd0a4cf1 | ||
|  | 5c906924ed | ||
|  | 9b4536a654 | ||
|  | df943a4041 | ||
|  | 0d4af83f25 | ||
|  | bf87f86493 | ||
|  | 963586b871 | ||
|  | fc06f9fb25 | ||
|  | 20d44dc9bc | ||
|  | 11b0a76370 | ||
|  | adbff7e977 | ||
|  | a661654a33 | ||
|  | 6f973f3367 | ||
|  | 6a13c7da4c | ||
|  | addcc6afbd | ||
|  | 19fb77ee7b | ||
|  | b10d080b1e | ||
|  | 3ed1f07686 | ||
|  | 2cbbd3dc50 | ||
|  | a7fcac5e92 | ||
|  | 07d91bbb59 | ||
|  | b3474de7b5 | ||
|  | 7c26b61f93 | ||
|  | 88b69d7998 | ||
|  | f069e5e412 | ||
|  | 0ff98b03c6 | ||
|  | 70375aff48 | ||
|  | 52bf005425 | ||
|  | 8d51bbf2a3 | ||
|  | fc8f202181 | ||
|  | c4e1fd5a7f | ||
|  | f8ed0aa268 | ||
|  | d03ab104db | ||
|  | 93d2d54e7a | ||
|  | 8ea22650bd | ||
|  | 2510ba618d | ||
|  | b7142567bc | ||
|  | 61f08d8094 | ||
|  | f905145b60 | ||
|  | 02986cb2cc | ||
|  | 2e823f29e4 | ||
|  | b52673117b | ||
|  | 49b1d95c1c | ||
|  | e9a3d8a772 | ||
|  | afb3fb4b77 | ||
|  | 635ee2df37 | ||
|  | 509710cfd7 | ||
|  | efb41b07ff | ||
|  | 78803b2667 | ||
|  | a131d50fb7 | ||
|  | e3a846b0e3 | ||
|  | 65ce50897e | ||
|  | 8855664489 | ||
|  | 35725a92be | ||
|  | d8aa5ffed5 | ||
|  | 067e788acd | ||
|  | 73b4c1b388 | ||
|  | a3deff2404 | ||
|  | 6cae4f3bc9 | ||
|  | f434e07a6a | ||
|  | 369404299c | ||
|  | b2b01a60db | ||
|  | 60e2810ae4 | ||
|  | 99b329ca13 | ||
|  | ed5f790919 | ||
|  | 8c01903114 | ||
|  | 6372ea0da0 | ||
|  | 2a37053fd5 | ||
|  | 1e8fc5ffea | ||
|  | 5c968cbc5e | ||
|  | 98e35025ba | ||
|  | fd451b6d01 | ||
|  | 25fe93f0a1 | ||
|  | c604e457d1 | ||
|  | 9a5ba4794c | ||
|  | fa2802d4d0 | ||
|  | 0e7836b500 | ||
|  | d3ea221d3e | ||
|  | 2f951683be | ||
|  | 5a38200122 | ||
|  | f18d70b804 | ||
|  | cfcf86b37d | ||
|  | 0ad2ef20a7 | ||
|  | ad0dbe6b04 | ||
|  | 41bddcfa7b | ||
|  | 55ba0dccc9 | ||
|  | aaa5a66433 | ||
|  | 5f92c38f0e | ||
|  | db382c5b1d | ||
|  | a657c1aee8 | ||
|  | d9c389dff6 | ||
|  | c51ed8c236 | ||
|  | c61782958b | ||
|  | c3984fc015 | ||
|  | 481bdd383a | ||
|  | bfc8a8dc63 | ||
|  | 29c909f81c | ||
|  | 5234d17514 | ||
|  | c39a4bc83c | ||
|  | a92100a3c6 | ||
|  | fe1230f1c8 | ||
|  | 26772ac988 | ||
|  | 425569bbc5 | ||
|  | 93b52d9484 | ||
|  | 1706ba4101 | ||
|  | 9a54843a94 | ||
|  | cb80e3905c | ||
|  | 32e845f05e | ||
|  | 7d4abc9b3a | ||
|  | a62fe7f5e3 | ||
|  | 00e599e783 | ||
|  | 1d7f71924d | ||
|  | 05ab19ef43 | ||
|  | a095aa4f4b | ||
|  | 675f802542 | ||
|  | 116986bad5 | ||
|  | 798e753e07 | ||
|  | ce1d7ee5ee | ||
|  | 068039eec1 | ||
|  | 05bbafa01a | ||
|  | 8fb17f5b3f | ||
|  | 3e62d3a8d8 | ||
|  | 050b77a9ac | ||
|  | 59b4b7e07e | ||
|  | 46d50d9e8e | ||
|  | de4fe1e3c5 | ||
|  | 7f8e10f96c | ||
|  | e7c7a0f353 | ||
|  | 6bd390743d | ||
|  | 2fb2e27e28 | ||
|  | 5b641a516e | ||
|  | 706bb1c714 | ||
|  | 1d5c727bba | ||
|  | a890ceee63 | ||
|  | 8a7dcd97bd | ||
|  | a78bbd0816 | ||
|  | 80a939cafb | ||
|  | 6af6a69312 | ||
|  | 979f35fb78 | ||
|  | b81efaaa1a | ||
|  | 00e760c971 | ||
|  | 3f35fbbf66 | ||
|  | 9eae0b9f19 | ||
|  | c1aa3d1e6f | ||
|  | dd9da8cdb5 | ||
|  | fbe5296d14 | ||
|  | 7541794373 | ||
|  | 3c4c86aff2 | ||
|  | 34dd4843d7 | ||
|  | 7457a648d2 | ||
|  | bd5bba8470 | ||
|  | e2e4a5c992 | ||
|  | 02eb36fa8d | ||
|  | 0c7d2fff1e | ||
|  | 5c9d21df3d | ||
|  | 8998de569c | ||
|  | 278c6025f9 | ||
|  | 4f05e61543 | ||
|  | 45f26f9979 | ||
|  | 203bd3e8ec | ||
|  | 91c219d906 | ||
|  | 522ea42718 | ||
|  | e24a9c10b5 | ||
|  | 96035d54f3 | ||
|  | 746df56717 | ||
|  | 5737fda093 | ||
|  | 439f7feab1 | ||
|  | f0d484fa5a | ||
|  | 2579c32a5f | ||
|  | 0bd5373d94 | ||
|  | 9d05d3dd30 | ||
|  | e6aa21156a | 
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @@ -87,6 +87,7 @@ linux-dri \ | ||||
| linux-dri-x86 \ | ||||
| linux-dri-x86-64 \ | ||||
| linux-dri-ppc \ | ||||
| linux-fbdev \ | ||||
| linux-glide \ | ||||
| linux-icc \ | ||||
| linux-icc-static \ | ||||
| @@ -107,7 +108,9 @@ linux-x86 \ | ||||
| linux-x86-debug \ | ||||
| linux-x86-32 \ | ||||
| linux-x86-64 \ | ||||
| linux-x86-64-debug \ | ||||
| linux-x86-64-static \ | ||||
| linux-x86-xcb \ | ||||
| linux-x86-glide \ | ||||
| linux-x86-static \ | ||||
| netbsd \ | ||||
| @@ -142,7 +145,6 @@ LIB_FILES =	\ | ||||
| 	$(DIRECTORY)/configs/[a-z]*					\ | ||||
| 	$(DIRECTORY)/docs/*.html					\ | ||||
| 	$(DIRECTORY)/docs/COPYING					\ | ||||
| 	$(DIRECTORY)/docs/INSTALL.GNU					\ | ||||
| 	$(DIRECTORY)/docs/README.*					\ | ||||
| 	$(DIRECTORY)/docs/RELNOTES*					\ | ||||
| 	$(DIRECTORY)/docs/VERSIONS					\ | ||||
|   | ||||
| @@ -31,8 +31,6 @@ | ||||
| #  Available options: | ||||
| # | ||||
| #    Environment variables: | ||||
| #	CPU		optimize for the given processor. | ||||
| #			default = pentium | ||||
| #	GLU=[mesa|sgi]	specify GLU directory; can be `sgi' (requires GNU/C++) | ||||
| #			or `mesa'. | ||||
| #			default = mesa | ||||
| @@ -59,12 +57,10 @@ | ||||
|  | ||||
| .PHONY : all libgl libglu libglut clean realclean | ||||
|  | ||||
| CPU ?= pentium | ||||
|  | ||||
| GLU ?= mesa | ||||
|  | ||||
| CFLAGS = -Wall -W -pedantic | ||||
| CFLAGS += -O2 -ffast-math -mtune=$(CPU) | ||||
| CFLAGS += -O2 -ffast-math | ||||
|  | ||||
| export CFLAGS | ||||
|  | ||||
|   | ||||
| @@ -31,8 +31,6 @@ | ||||
| #  Available options: | ||||
| # | ||||
| #    Environment variables: | ||||
| #	CPU		optimize for the given processor. | ||||
| #			default = pentium | ||||
| #	GLIDE		path to Glide3 SDK; used with FX. | ||||
| #			default = $(TOP)/glide3 | ||||
| #	FX=1		build for 3dfx Glide3. Note that this disables | ||||
| @@ -57,8 +55,6 @@ | ||||
|  | ||||
| .PHONY : all libgl clean realclean | ||||
|  | ||||
| CPU ?= pentium | ||||
|  | ||||
| ifeq ($(ICD),1) | ||||
|   # when -std=c99 mingw will not define WIN32 | ||||
|   CFLAGS = -Wall -W -Werror | ||||
| @@ -66,7 +62,7 @@ else | ||||
|   # I love c89 | ||||
|   CFLAGS = -Wall -W -pedantic | ||||
| endif | ||||
| CFLAGS += -O2 -ffast-math -mtune=$(CPU) | ||||
| CFLAGS += -O2 -ffast-math | ||||
|  | ||||
| export CFLAGS | ||||
|  | ||||
|   | ||||
							
								
								
									
										179
									
								
								Mesa.dsw
									
									
									
									
									
								
							
							
						
						
									
										179
									
								
								Mesa.dsw
									
									
									
									
									
								
							| @@ -1,179 +0,0 @@ | ||||
| Microsoft Developer Studio Workspace File, Format Version 6.00 | ||||
| # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "array_cache"=".\SRC\MESA\array_cache\array_cache.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "gdi"=".\src\mesa\drivers\windows\gdi\gdi.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name array_cache | ||||
|     End Project Dependency | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name main | ||||
|     End Project Dependency | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name math | ||||
|     End Project Dependency | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name swrast_setup | ||||
|     End Project Dependency | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name swrast | ||||
|     End Project Dependency | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name tnl | ||||
|     End Project Dependency | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name glapi | ||||
|     End Project Dependency | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name shader | ||||
|     End Project Dependency | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "glapi"=".\SRC\MESA\glapi\glapi.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "glu"=".\src\glu\sgi\glu.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name gdi | ||||
|     End Project Dependency | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "main"=".\SRC\MESA\main\main.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "math"=".\SRC\MESA\math\math.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "osmesa"=".\SRC\MESA\DRIVERS\osmesa\osmesa.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
|     Begin Project Dependency | ||||
|     Project_Dep_Name gdi | ||||
|     End Project Dependency | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "shader"=".\SRC\MESA\shader\shader.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "swrast"=".\SRC\MESA\swrast\swrast.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "swrast_setup"=".\SRC\MESA\swrast_setup\swrast_setup.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "tnl"=".\SRC\MESA\tnl\tnl.dsp" - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Global: | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<3> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| @@ -35,11 +35,11 @@ OSMESA_LIB = OSMesa | ||||
|  | ||||
|  | ||||
| # Library names (actual file names) | ||||
| GL_LIB_NAME = libGL.so | ||||
| GLU_LIB_NAME = libGLU.so | ||||
| GLUT_LIB_NAME = libglut.so | ||||
| GLW_LIB_NAME = libGLw.so | ||||
| OSMESA_LIB_NAME = libOSMesa.so | ||||
| GL_LIB_NAME = lib$(GL_LIB).so | ||||
| GLU_LIB_NAME = lib$(GLU_LIB).so | ||||
| GLUT_LIB_NAME = lib$(GLUT_LIB).so | ||||
| GLW_LIB_NAME = lib$(GLW_LIB).so | ||||
| OSMESA_LIB_NAME = lib$(OSMesa).so | ||||
|  | ||||
|  | ||||
| # Optional assembly language optimization files for libGL | ||||
| @@ -56,6 +56,7 @@ INSTALL_PREFIX = /usr/local | ||||
| SRC_DIRS = mesa glu glut/glx glw | ||||
| GLU_DIRS = sgi | ||||
| DRIVER_DIRS = x11 osmesa | ||||
| # Which subdirs under $(TOP)/progs/ to enter: | ||||
| PROGRAM_DIRS = demos redbook samples xdemos | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -17,6 +17,8 @@ WARN_FLAGS = -Wall | ||||
| OPT_FLAGS  = -O -g | ||||
| PIC_FLAGS  = -fPIC | ||||
|  | ||||
| # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. | ||||
| ARCH_FLAGS ?= | ||||
|  | ||||
| DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ | ||||
| 	-D_BSD_SOURCE -D_GNU_SOURCE \ | ||||
| @@ -24,25 +26,25 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ | ||||
|  | ||||
| X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions | ||||
|  | ||||
| CFLAGS =  $(WARN_FLAGS) $(OPT_FLAGS) $(ASM_FLAGS) -std=c99 $(PIC_FLAGS) -ffast-math  \ | ||||
| 	$(DEFINES) | ||||
| CFLAGS   = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ | ||||
| 	$(ASM_FLAGS) -std=c99 -ffast-math  | ||||
|  | ||||
| CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) \ | ||||
| 	$(DEFINES) | ||||
| CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) | ||||
|  | ||||
|  | ||||
| ASM_SOURCES =  | ||||
|  | ||||
| # Library/program dependencies | ||||
| DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lm -lpthread -ldl | ||||
| EXTRA_LIB_PATH=-L/usr/X11R6/lib | ||||
|  | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11 | ||||
| DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl | ||||
| GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl | ||||
| GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB)  -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS  = $(EXTRA_LIB_PATH) -L$(LIB_DIR) -l$(GL_LIB) -lXt -lX11 | ||||
|  | ||||
|  | ||||
| # Directories | ||||
| SRC_DIRS = mesa glu glut/glx glw glx/x11 | ||||
| SRC_DIRS = glx/x11 mesa glu glut/glx glw | ||||
| DRIVER_DIRS = dri | ||||
| PROGRAM_DIRS =  | ||||
| WINDOW_SYSTEM=dri | ||||
|   | ||||
| @@ -1,40 +1,20 @@ | ||||
| # -*-makefile-*- | ||||
| # Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others | ||||
|  | ||||
| include $(TOP)/configs/default | ||||
| include $(TOP)/configs/linux-dri | ||||
|  | ||||
| CONFIG_NAME = linux-dri-x86-64 | ||||
|  | ||||
| # Compiler and flags | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -D_GNU_SOURCE  | ||||
|  | ||||
| CFLAGS = -m64 -Wmissing-prototypes -g -std=c99  -Wundef -fPIC -ffast-math $(DEFINES) | ||||
| CXXFLAGS = -m64 -Wall -g -ansi -pedantic -fPIC $(DEFINES) | ||||
|  | ||||
| X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions | ||||
|  | ||||
| #ASM_SOURCES = $(X86_SOURCES) | ||||
| ARCH_FLAGS = -m64 | ||||
|  | ||||
| LIB_DIR = $(TOP)/lib64 | ||||
|  | ||||
| # Library/program dependencies | ||||
| DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib64 -lX11 -lXext -lXxf86vm -lm -lpthread -ldl | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib64 -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib64 -lXt -lX11 | ||||
| EXTRA_LIB_PATH=-L/usr/X11R6/lib64 | ||||
|  | ||||
| # Directories | ||||
| SRC_DIRS = mesa glu glut/glx glw glx/x11 | ||||
| DRIVER_DIRS = dri | ||||
| PROGRAM_DIRS =  | ||||
| WINDOW_SYSTEM=dri | ||||
|  | ||||
| # ffb, gamma, and sis are missing because they have | ||||
| # not be converted to use the new interface.  Do i810 & i830 really | ||||
| # need to be included here? | ||||
| # ffb, gamma, and sis are missing because they have not be converted to use | ||||
| # the new interface.  i810 and i830 are missing because there is no x86-64 | ||||
| # system where they could *ever* be used. | ||||
| # | ||||
| DRI_DIRS = dri_client i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome savage | ||||
| DRI_DIRS = dri_client i915 mach64 mga r128 r200 radeon tdfx unichrome savage | ||||
|  | ||||
|   | ||||
							
								
								
									
										10
									
								
								configs/linux-fbdev
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								configs/linux-fbdev
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| # Configuration for Linux fbdev interface | ||||
|  | ||||
| include $(TOP)/configs/linux | ||||
|  | ||||
| CONFIG_NAME = linux-fbdev | ||||
| DRIVER_DIRS = fbdev | ||||
|  | ||||
| CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -DUSE_GLFBDEV_DRIVER | ||||
|  | ||||
| PROGRAM_DIRS = fbdev | ||||
							
								
								
									
										29
									
								
								configs/linux-profile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								configs/linux-profile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| # Configuration for profiling on Linux with gprof | ||||
|  | ||||
| include $(TOP)/configs/default | ||||
|  | ||||
| CONFIG_NAME = linux-profile | ||||
|  | ||||
| # Compiler and flags | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| CFLAGS = -pg -O -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG | ||||
|  | ||||
| CXXFLAGS = -pg -O -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
| # Need to have -L/usr/X11R6/lib in these: | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lXt -L/usr/X11R6/lib -lX11 | ||||
|  | ||||
| # Need to make static libs for profiling: | ||||
| MKLIB_OPTIONS = -static | ||||
| GL_LIB_NAME = lib$(GL_LIB).a | ||||
| GLU_LIB_NAME = lib$(GLU_LIB).a | ||||
| GLUT_LIB_NAME = lib$(GLUT_LIB).a | ||||
| GLW_LIB_NAME = lib$(GLW_LIB).a | ||||
| OSMESA_LIB_NAME = lib$(OSMesa).a | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread | ||||
| @@ -8,26 +8,35 @@ CONFIG_NAME = linux-solo | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE -DUSE_EXTERNAL_DXTN_LIB=1 | ||||
| WARN_FLAGS = -Wall -Wundef | ||||
| OPT_FLAGS  = -O3 -g | ||||
| PIC_FLAGS  = -fPIC | ||||
|                                                                                  | ||||
| CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math | ||||
| # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. | ||||
| ARCH_FLAGS ?= | ||||
|  | ||||
| CXXFLAGS = $(DEFINES) -Wall -O3 -ansi -pedantic -fPIC | ||||
| DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ | ||||
| 	-D_BSD_SOURCE -D_GNU_SOURCE \ | ||||
| 	-DDRI_NEW_INTERFACE_ONLY -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC | ||||
|  | ||||
| CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ | ||||
| 	 $(ASM_FLAGS) -std=c99 -ffast-math | ||||
|  | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
| CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) | ||||
|  | ||||
| ASM_SOURCES = | ||||
|  | ||||
| # Library/program dependencies | ||||
| DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl | ||||
| DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(LIB_DIR) -lEGL -l$(GL_LIB)  | ||||
| GL_LIB_DEPS = -lm -lpthread -ldl | ||||
| GLU_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lm | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread | ||||
|  | ||||
| # Directories | ||||
| SRC_DIRS = mesa glx/mini glu glut/mini | ||||
| SRC_DIRS = egl mesa glx/mini glu glut/mini | ||||
| DRIVER_DIRS = dri | ||||
| PROGRAM_DIRS = miniglx | ||||
| PROGRAM_DIRS = miniglx egl | ||||
|  | ||||
| #DRI_DIRS = fb ffb gamma sis savage | ||||
| DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome | ||||
| #DRI_DIRS = ffb gamma sis savage | ||||
| DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome fb | ||||
|   | ||||
| @@ -8,7 +8,7 @@ CONFIG_NAME = linux-solo-ia64 | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE | ||||
| DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE -DDRM_USE_MALLOC | ||||
|  | ||||
| CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math | ||||
|  | ||||
|   | ||||
| @@ -1,32 +1,12 @@ | ||||
| # Configuration for linux-solo: Linux DRI hardware drivers for fbdev | ||||
| # -*-makefile-*- | ||||
| # Configuration for linux-solo-x86: Linux hardware drivers for fbdev for x86 | ||||
|  | ||||
| include $(TOP)/configs/default | ||||
| include $(TOP)/configs/linux-solo | ||||
|  | ||||
| CONFIG_NAME = linux-solo-x86 | ||||
|  | ||||
| # Compiler and flags | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 | ||||
|  | ||||
| CFLAGS = $(DEFINES) -Wmissing-prototypes -O3 -g -std=c99 -Wundef -fPIC -ffast-math | ||||
|  | ||||
| CXXFLAGS = $(DEFINES) -Wall -O3 -ansi -pedantic -fPIC | ||||
|  | ||||
| # Unnecessary on x86, generally. | ||||
| PIC_FLAGS =  | ||||
|  | ||||
| ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM | ||||
| ASM_SOURCES = $(X86_SOURCES) | ||||
|  | ||||
| # Library/program dependencies | ||||
| DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl | ||||
| GL_LIB_DEPS = -lm -lpthread -ldl | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread | ||||
|  | ||||
| # Directories | ||||
| SRC_DIRS = mesa glx/mini glu glut/mini | ||||
| DRIVER_DIRS = dri | ||||
| PROGRAM_DIRS = miniglx | ||||
|  | ||||
| #DRI_DIRS = fb ffb gamma sis savage | ||||
| DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome | ||||
|   | ||||
| @@ -9,5 +9,5 @@ CONFIG_NAME = linux-x86-32 | ||||
|  | ||||
| CFLAGS = -m32 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include | ||||
|  | ||||
| CXXFLAGS = -m32 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE | ||||
| CXXFLAGS = -m32 -Wall -O3 fPIC -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE | ||||
|  | ||||
|   | ||||
| @@ -8,14 +8,14 @@ CONFIG_NAME = linux-x86-64 | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| CFLAGS = -m64 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include | ||||
| CFLAGS = -m64 -Wall -O3 -std=c99 -pedantic -fPIC -D_REENTRANT -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DUSE_X86_64_ASM | ||||
|  | ||||
| CXXFLAGS = -m64 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE | ||||
| CXXFLAGS = -m64 -Wall -O3 -fPIC -D_REENTRANT -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
|  | ||||
| #ASM_SOURCES = $(X86_SOURCES) | ||||
| ASM_SOURCES = $(X86-64_SOURCES) | ||||
|  | ||||
|  | ||||
| LIB_DIR = $(TOP)/lib64 | ||||
|   | ||||
							
								
								
									
										28
									
								
								configs/linux-x86-64-debug
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								configs/linux-x86-64-debug
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| # Configuration for Linux for 64-bit X86 (Opteron) | ||||
|  | ||||
| include $(TOP)/configs/default | ||||
|  | ||||
| CONFIG_NAME = linux-x86-64-debug | ||||
|  | ||||
| # Compiler and flags | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| CFLAGS = -g -m64 -Wall -O3 -std=c99 -pedantic -fPIC -D_REENTRANT -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DUSE_X86_64_ASM -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK | ||||
|  | ||||
| CXXFLAGS = -g -m64 -Wall -O3 -ansi -pedantic -fPIC -D_REENTRANT -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG -DRUN_DEBUG_BENCHMARK | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
|  | ||||
| ASM_SOURCES = $(X86-64_SOURCES) | ||||
|  | ||||
|  | ||||
| LIB_DIR = $(TOP)/lib64 | ||||
|  | ||||
|  | ||||
| # Library/program dependencies | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib64 -lX11 -lXext -lm -lpthread | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib64 -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib64 -lXt -lX11 | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm | ||||
| @@ -10,7 +10,7 @@ CXX = g++ | ||||
|  | ||||
| CFLAGS = -m64 -Wall -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include | ||||
|  | ||||
| CXXFLAGS = -m64 -Wall -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE | ||||
| CXXFLAGS = -m64 -Wall -O3 -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
|   | ||||
							
								
								
									
										24
									
								
								configs/linux-x86-xcb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								configs/linux-x86-xcb
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| # Configuration for Linux with x86 optimizations | ||||
|  | ||||
| include $(TOP)/configs/default | ||||
|  | ||||
| CONFIG_NAME = linux-x86-xcb | ||||
|  | ||||
| # Compiler and flags | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
|  | ||||
| CFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -DUSE_XCB -I/usr/X11R6/include | ||||
|  | ||||
| CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XCB | ||||
|  | ||||
| GLUT_CFLAGS = -fexceptions | ||||
|  | ||||
|  | ||||
| ASM_SOURCES = $(X86_SOURCES) $(X86_API) | ||||
|  | ||||
| # Library/program dependencies | ||||
| GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -lXCB | ||||
| GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm | ||||
| GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11 | ||||
| APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm | ||||
							
								
								
									
										182
									
								
								docs/INSTALL.GNU
									
									
									
									
									
								
							
							
						
						
									
										182
									
								
								docs/INSTALL.GNU
									
									
									
									
									
								
							| @@ -1,182 +0,0 @@ | ||||
| Basic Installation | ||||
| ================== | ||||
|  | ||||
|    These are generic installation instructions. | ||||
|  | ||||
|    The `configure' shell script attempts to guess correct values for | ||||
| various system-dependent variables used during compilation.  It uses | ||||
| those values to create a `Makefile' in each directory of the package. | ||||
| It may also create one or more `.h' files containing system-dependent | ||||
| definitions.  Finally, it creates a shell script `config.status' that | ||||
| you can run in the future to recreate the current configuration, a file | ||||
| `config.cache' that saves the results of its tests to speed up | ||||
| reconfiguring, and a file `config.log' containing compiler output | ||||
| (useful mainly for debugging `configure'). | ||||
|  | ||||
|    If you need to do unusual things to compile the package, please try | ||||
| to figure out how `configure' could check whether to do them, and mail | ||||
| diffs or instructions to the address given in the `README' so they can | ||||
| be considered for the next release.  If at some point `config.cache' | ||||
| contains results you don't want to keep, you may remove or edit it. | ||||
|  | ||||
|    The file `configure.in' is used to create `configure' by a program | ||||
| called `autoconf'.  You only need `configure.in' if you want to change | ||||
| it or regenerate `configure' using a newer version of `autoconf'. | ||||
|  | ||||
| The simplest way to compile this package is: | ||||
|  | ||||
|   1. `cd' to the directory containing the package's source code and type | ||||
|      `./configure' to configure the package for your system.  If you're | ||||
|      using `csh' on an old version of System V, you might need to type | ||||
|      `sh ./configure' instead to prevent `csh' from trying to execute | ||||
|      `configure' itself. | ||||
|  | ||||
|      Running `configure' takes awhile.  While running, it prints some | ||||
|      messages telling which features it is checking for. | ||||
|  | ||||
|   2. Type `make' to compile the package. | ||||
|  | ||||
|   3. Optionally, type `make check' to run any self-tests that come with | ||||
|      the package. | ||||
|  | ||||
|   4. Type `make install' to install the programs and any data files and | ||||
|      documentation. | ||||
|  | ||||
|   5. You can remove the program binaries and object files from the | ||||
|      source code directory by typing `make clean'.  To also remove the | ||||
|      files that `configure' created (so you can compile the package for | ||||
|      a different kind of computer), type `make distclean'.  There is | ||||
|      also a `make maintainer-clean' target, but that is intended mainly | ||||
|      for the package's developers.  If you use it, you may have to get | ||||
|      all sorts of other programs in order to regenerate files that came | ||||
|      with the distribution. | ||||
|  | ||||
| Compilers and Options | ||||
| ===================== | ||||
|  | ||||
|    Some systems require unusual options for compilation or linking that | ||||
| the `configure' script does not know about.  You can give `configure' | ||||
| initial values for variables by setting them in the environment.  Using | ||||
| a Bourne-compatible shell, you can do that on the command line like | ||||
| this: | ||||
|      CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure | ||||
|  | ||||
| Or on systems that have the `env' program, you can do it like this: | ||||
|      env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure | ||||
|  | ||||
| Compiling For Multiple Architectures | ||||
| ==================================== | ||||
|  | ||||
|    You can compile the package for more than one kind of computer at the | ||||
| same time, by placing the object files for each architecture in their | ||||
| own directory.  To do this, you must use a version of `make' that | ||||
| supports the `VPATH' variable, such as GNU `make'.  `cd' to the | ||||
| directory where you want the object files and executables to go and run | ||||
| the `configure' script.  `configure' automatically checks for the | ||||
| source code in the directory that `configure' is in and in `..'. | ||||
|  | ||||
|    If you have to use a `make' that does not supports the `VPATH' | ||||
| variable, you have to compile the package for one architecture at a time | ||||
| in the source code directory.  After you have installed the package for | ||||
| one architecture, use `make distclean' before reconfiguring for another | ||||
| architecture. | ||||
|  | ||||
| Installation Names | ||||
| ================== | ||||
|  | ||||
|    By default, `make install' will install the package's files in | ||||
| `/usr/local/bin', `/usr/local/man', etc.  You can specify an | ||||
| installation prefix other than `/usr/local' by giving `configure' the | ||||
| option `--prefix=PATH'. | ||||
|  | ||||
|    You can specify separate installation prefixes for | ||||
| architecture-specific files and architecture-independent files.  If you | ||||
| give `configure' the option `--exec-prefix=PATH', the package will use | ||||
| PATH as the prefix for installing programs and libraries. | ||||
| Documentation and other data files will still use the regular prefix. | ||||
|  | ||||
|    In addition, if you use an unusual directory layout you can give | ||||
| options like `--bindir=PATH' to specify different values for particular | ||||
| kinds of files.  Run `configure --help' for a list of the directories | ||||
| you can set and what kinds of files go in them. | ||||
|  | ||||
|    If the package supports it, you can cause programs to be installed | ||||
| with an extra prefix or suffix on their names by giving `configure' the | ||||
| option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. | ||||
|  | ||||
| Optional Features | ||||
| ================= | ||||
|  | ||||
|    Some packages pay attention to `--enable-FEATURE' options to | ||||
| `configure', where FEATURE indicates an optional part of the package. | ||||
| They may also pay attention to `--with-PACKAGE' options, where PACKAGE | ||||
| is something like `gnu-as' or `x' (for the X Window System).  The | ||||
| `README' should mention any `--enable-' and `--with-' options that the | ||||
| package recognizes. | ||||
|  | ||||
|    For packages that use the X Window System, `configure' can usually | ||||
| find the X include and library files automatically, but if it doesn't, | ||||
| you can use the `configure' options `--x-includes=DIR' and | ||||
| `--x-libraries=DIR' to specify their locations. | ||||
|  | ||||
| Specifying the System Type | ||||
| ========================== | ||||
|  | ||||
|    There may be some features `configure' can not figure out | ||||
| automatically, but needs to determine by the type of host the package | ||||
| will run on.  Usually `configure' can figure that out, but if it prints | ||||
| a message saying it can not guess the host type, give it the | ||||
| `--host=TYPE' option.  TYPE can either be a short name for the system | ||||
| type, such as `sun4', or a canonical name with three fields: | ||||
|      CPU-COMPANY-SYSTEM | ||||
|  | ||||
| See the file `config.sub' for the possible values of each field.  If | ||||
| `config.sub' isn't included in this package, then this package doesn't | ||||
| need to know the host type. | ||||
|  | ||||
|    If you are building compiler tools for cross-compiling, you can also | ||||
| use the `--target=TYPE' option to select the type of system they will | ||||
| produce code for and the `--build=TYPE' option to select the type of | ||||
| system on which you are compiling the package. | ||||
|  | ||||
| Sharing Defaults | ||||
| ================ | ||||
|  | ||||
|    If you want to set default values for `configure' scripts to share, | ||||
| you can create a site shell script called `config.site' that gives | ||||
| default values for variables like `CC', `cache_file', and `prefix'. | ||||
| `configure' looks for `PREFIX/share/config.site' if it exists, then | ||||
| `PREFIX/etc/config.site' if it exists.  Or, you can set the | ||||
| `CONFIG_SITE' environment variable to the location of the site script. | ||||
| A warning: not all `configure' scripts look for a site script. | ||||
|  | ||||
| Operation Controls | ||||
| ================== | ||||
|  | ||||
|    `configure' recognizes the following options to control how it | ||||
| operates. | ||||
|  | ||||
| `--cache-file=FILE' | ||||
|      Use and save the results of the tests in FILE instead of | ||||
|      `./config.cache'.  Set FILE to `/dev/null' to disable caching, for | ||||
|      debugging `configure'. | ||||
|  | ||||
| `--help' | ||||
|      Print a summary of the options to `configure', and exit. | ||||
|  | ||||
| `--quiet' | ||||
| `--silent' | ||||
| `-q' | ||||
|      Do not print messages saying which checks are being made.  To | ||||
|      suppress all normal output, redirect it to `/dev/null' (any error | ||||
|      messages will still be shown). | ||||
|  | ||||
| `--srcdir=DIR' | ||||
|      Look for the package's source code in directory DIR.  Usually | ||||
|      `configure' can determine that directory automatically. | ||||
|  | ||||
| `--version' | ||||
|      Print the version of Autoconf used to generate the `configure' | ||||
|      script, and exit. | ||||
|  | ||||
| `configure' also accepts some other, not widely useful, options. | ||||
| @@ -27,6 +27,9 @@ GL_OES_read_format - allows one to query the fastest glReadPixels format | ||||
|  | ||||
| GL_ARB_pixel_buffer_object - buffer objects for pixel read/write functions. | ||||
|  | ||||
| GL_EXT_framebuffer_object - allows render-to-texture and provides a | ||||
|   window-system indepedent Pbuffer facility | ||||
|  | ||||
| DirectFB driver, contributed by Claudio Ciccani.  See docs/README.directfb | ||||
| for details. | ||||
|  | ||||
| @@ -94,4 +97,4 @@ D3D			needs updating | ||||
|  | ||||
|  | ||||
| ---------------------------------------------------------------------- | ||||
| $Id: RELNOTES-6.3,v 3.8 2005/01/20 04:03:37 brianp Exp $ | ||||
| $Id: RELNOTES-6.3,v 3.9 2005/05/04 20:11:35 brianp Exp $ | ||||
|   | ||||
| @@ -1308,7 +1308,7 @@ Mesa Version History | ||||
| 	- glReadPixels from a clipped front color buffer didn't always work | ||||
| 	- glTexImage didn't accept GL_RED/GREEN/BLUE as the format | ||||
| 	- Attempting queries/accesses of VBO 0 weren't detected as errors | ||||
| 	- paletted textures failed if the palette had fewer that 256 entries | ||||
| 	- paletted textures failed if the palette had fewer than 256 entries | ||||
|     Changes: | ||||
| 	- fixed a bunch of compiler warnings found with gcc 3.4 | ||||
| 	- bug reports should to go bugzilla.freedesktop.org | ||||
| @@ -1320,11 +1320,13 @@ Mesa Version History | ||||
| 	- GL_ARB_pixel_buffer_object extension | ||||
| 	- GL_OES_read_format extension (Ian Romanick) | ||||
| 	- DirectFB driver (Claudio Ciccani) | ||||
| 	- x86_64 vertex transformation code (Mikko T.) | ||||
|     Changes: | ||||
| 	- added -stereo option for glxgears demo (Jacek Rosik) | ||||
| 	- updated the PBuffer demo code in xdemos/ directory | ||||
| 	- glDeleteTextures/Programs/Buffers() now makes the object ID | ||||
| 	  available for immediate re-use | ||||
| 	- assorted 64-bit clean-ups fixes (x86_64 and Win64) | ||||
|     Bug fixes: | ||||
| 	- some functions didn't support PBO functionality | ||||
| 	- glGetTexImage didn't convert color index images to RGBA as required | ||||
|   | ||||
| @@ -1,15 +1,27 @@ | ||||
| <HTML> | ||||
|  | ||||
| <title>Banner</title> | ||||
|  | ||||
|  | ||||
| <body text="#ffffff" bgcolor="#aa4444"> | ||||
|  | ||||
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||||
| <html> | ||||
| <head> | ||||
|   <title>Banner</title> | ||||
| </head> | ||||
| <body bgcolor="#000000" text="#ffffff"> | ||||
| <center> | ||||
| <p> | ||||
| <font size="5">The Mesa 3D Graphics Library</font> | ||||
| </p> | ||||
| <table style="width: 95%; text-align: left;" border="0" cellpadding="2" | ||||
|  cellspacing="2"> | ||||
|   <tbody> | ||||
|     <tr> | ||||
|       <td style="vertical-align: top;"> | ||||
|       <p><img src="gears.png"> </p> | ||||
|       </td> | ||||
|       <td style="text-align: center;"><font face="sans-serif" size="5">The | ||||
| Mesa 3D Graphics Library</font></td> | ||||
|       <td style="vertical-align: top; text-align: right;"> | ||||
|       <p><img src="gears.png"> </p> | ||||
|       </td> | ||||
|     </tr> | ||||
|   </tbody> | ||||
| </table> | ||||
| <p><font face="sans-serif" size="5"><br> | ||||
| </font></p> | ||||
| </center> | ||||
|  | ||||
| </body> | ||||
| </html> | ||||
| @@ -4,20 +4,20 @@ | ||||
|  | ||||
| <link rel="stylesheet" type="text/css" href="mesa.css"></head> | ||||
|  | ||||
| <body bgcolor="#119955"> | ||||
| <body bgcolor="#eeeeee"> | ||||
|  | ||||
| <!--Override a few values from the style sheet: --> | ||||
| <style> | ||||
| <!-- | ||||
| body { | ||||
| 	background-color: #119955; | ||||
| 	color: white; | ||||
| 	background-color: #cccccc; | ||||
| 	color: black; | ||||
| } | ||||
| a:link { | ||||
| 	color: #fff; | ||||
| 	color: #000; | ||||
| } | ||||
| a:visited { | ||||
| 	color: #ccc; | ||||
| 	color: #000; | ||||
| } | ||||
| --> | ||||
| </style> | ||||
|   | ||||
| @@ -67,9 +67,11 @@ Here are the basic instructions for Unix systems: | ||||
| Mesa developers working with the Mesa CVS repository need to first | ||||
| have an account on <a href="http://www.freedesktop.org" target="_parent"> | ||||
| freedesktop.org</a>. | ||||
| You can request an account from either | ||||
| <a href="mailto:dstone@trinity.unimelb.edu.au">Daniel Stone</a> or | ||||
| <a href="mailto:eta@lclark.edu">Eric Anholt</a>. | ||||
| To get an account, please ask Brian or the other Mesa developers for | ||||
| permission. | ||||
| Then, if there are no objections, follow this | ||||
| <a href="http://www.freedesktop.org/wiki/AccountRequests" target="_parent"> | ||||
| procedure</a>. | ||||
| </p> | ||||
|  | ||||
| <p> | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								docs/gears.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/gears.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.6 KiB | 
| @@ -1,20 +1,29 @@ | ||||
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"> | ||||
| <html> | ||||
|  | ||||
| <title>Mesa Home Page</title></head> | ||||
| <head> | ||||
| <title>Mesa Home Page</title> | ||||
| </head> | ||||
|  | ||||
| <frameset rows="80,*" border="0" frameborder="yes"> | ||||
|  | ||||
| <frameset rows="50,100% " border="1" framespacing="1" frameborder="yes"> | ||||
| <frame src="banner.html" name="BannerFrame" scrolling="no" marginwidth="1" marginheight="1" resize=""> | ||||
| <frameset cols="28%,72% " border="1" framespacing="1" frameborder="yes"> | ||||
| <frame src="contents.html" name="ContentsFrame" marginwidth="2" marginheight="1" resize=""> | ||||
| <frame src="news.html" name="MainFrame" marginwidth="3" marginheight="1" resize=""> | ||||
| </frameset> | ||||
| </frameset> | ||||
|   <frame src="banner.html" name="BannerFrame" | ||||
|    scrolling="no" marginwidth="1" marginheight="1"> | ||||
|  | ||||
|   <frameset cols="28%,72% " border="1" frameborder="yes"> | ||||
|  | ||||
|     <frame src="contents.html" name="ContentsFrame" | ||||
|      marginwidth="2" marginheight="1" noresize="noresize"> | ||||
|  | ||||
|     <frame src="news.html" name="MainFrame" | ||||
|      marginwidth="3" marginheight="1" noresize="noresize"> | ||||
|  | ||||
|   </frameset> | ||||
|  | ||||
| <noframes> | ||||
|  | ||||
| <body> | ||||
| </body> | ||||
|  | ||||
| <p>Sorry, this site requires frame support</p> | ||||
| </noframes> | ||||
|  | ||||
| </frameset> | ||||
|  | ||||
| </html> | ||||
| @@ -1,20 +1,19 @@ | ||||
| /* Mesa CSS */ | ||||
| body { | ||||
| 	background-color: #55bbff; | ||||
| 	background-color: #ffffff; | ||||
| 	/*background-color: #55bbff;*/ | ||||
| 	font: 14px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif; | ||||
| 	color: black; | ||||
|  	link: #111188; | ||||
| } | ||||
|  | ||||
| h1 { | ||||
| 	background-color: #55bbff; | ||||
| 	font: 24px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif; | ||||
| 	font-weight: bold; | ||||
| 	color: black; | ||||
| } | ||||
|  | ||||
| h2 { | ||||
| 	background-color: #55bbff; | ||||
| 	font: 18px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif, bold; | ||||
| 	font-weight: bold; | ||||
| 	color: black; | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  | ||||
| <TITLE>Mesa News</TITLE> | ||||
|  | ||||
| <link rel="stylesheet" type="text/css" href="mesa.css"></head> | ||||
| <head><link rel="stylesheet" type="text/css" href="mesa.css"></head> | ||||
|  | ||||
| <BODY> | ||||
|  | ||||
| @@ -25,7 +25,7 @@ This is a stable release which just fixes bugs since the 6.2 release. | ||||
| 	- glReadPixels from a clipped front color buffer didn't always work | ||||
| 	- glTexImage didn't accept GL_RED/GREEN/BLUE as the format | ||||
| 	- Attempting queries/accesses of VBO 0 weren't detected as errors | ||||
| 	- paletted textures failed if the palette had fewer that 256 entries | ||||
| 	- paletted textures failed if the palette had fewer than 256 entries | ||||
|     Changes: | ||||
| 	- fixed a bunch of compiler warnings found with gcc 3.4 | ||||
| 	- bug reports should to go bugzilla.freedesktop.org | ||||
| @@ -960,6 +960,6 @@ source code</a>.</p> | ||||
|  | ||||
|  | ||||
| <hr> | ||||
| $Id: news.html,v 3.17 2005/01/20 03:55:10 brianp Exp $ | ||||
| $Id: news.html,v 3.19 2005/05/05 14:18:31 brianp Exp $ | ||||
| </body> | ||||
| </html> | ||||
| @@ -13,6 +13,7 @@ | ||||
|  | ||||
| The following individuals and groups are to be acknowledged for their | ||||
| contributions to Mesa over the years. | ||||
| This list is far from complete and somewhat dated, unfortunately. | ||||
|  | ||||
|  | ||||
| <ul> | ||||
| @@ -32,14 +33,21 @@ substantial piece of work. | ||||
| Tungsten Graphics, Inc. have supported the ongoing development of Mesa. | ||||
| <br> | ||||
| <br> | ||||
| <li>The <A HREF="http://sourceforge.net/projects/mesa3d" | ||||
| target="_parent">Mesa</A> | ||||
| project is hosted by<A HREF="http://sourceforge.net" | ||||
| target="_parent"><IMG SRC="http://sourceforge.net/sflogo.php?group_id=3&type=1" | ||||
| <li>The | ||||
| <A HREF="http://sourceforge.net/projects/mesa3d" target="_parent">Mesa</A> | ||||
| website is hosted by | ||||
| <A HREF="http://sourceforge.net" target="_parent"> | ||||
| <IMG SRC="http://sourceforge.net/sflogo.php?group_id=3&type=1" | ||||
| WIDTH="88" HEIGHT="31" ALIGN="BOTTOM" ALT="Sourceforge.net" BORDER="0"></A> | ||||
| <br> | ||||
| <br> | ||||
|  | ||||
| <li>The Mesa CVS repository is hosted by | ||||
| <a href="http://freedesktop.org/" target="_parent">freedesktop.org</a>. | ||||
| <br> | ||||
| <br> | ||||
|  | ||||
|  | ||||
| <li><a href="http://www.altsoftware.com/" | ||||
| target="_parent">alt.software</a> contributed the Direct3D driver. | ||||
|  | ||||
|   | ||||
| @@ -104,7 +104,7 @@ | ||||
| #define APIENTRY GLAPIENTRY | ||||
| #endif | ||||
|  | ||||
| /* "P" suffix for when function returns a pointer */ | ||||
| /* "P" suffix to be used for a pointer to a function */ | ||||
| #ifndef APIENTRYP | ||||
| #define APIENTRYP APIENTRY * | ||||
| #endif | ||||
| @@ -853,7 +853,7 @@ GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); | ||||
|  | ||||
| GLAPI GLenum GLAPIENTRY glGetError( void ); | ||||
|  | ||||
| GLAPI const GLubyte GLAPIENTRYP glGetString( GLenum name ); | ||||
| GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name ); | ||||
|  | ||||
| GLAPI void GLAPIENTRY glFinish( void ); | ||||
|  | ||||
|   | ||||
| @@ -62,7 +62,10 @@ extern const char * | ||||
| glFBDevGetString( int str ); | ||||
|  | ||||
|  | ||||
| extern const void * | ||||
| typedef void (*GLFBDevProc)(); | ||||
|  | ||||
|  | ||||
| extern const GLFBDevProc | ||||
| glFBDevGetProcAddress( const char *procName ); | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,11 @@ | ||||
| ** compliant with the OpenGL(R) version 1.2.1 Specification. | ||||
| */ | ||||
|  | ||||
| #if 0/*XXX TEMPORARY HACK*/ | ||||
| #include <GLES/gl.h> | ||||
| #else | ||||
| #include <GL/gl.h> | ||||
| #endif | ||||
| #include <GLES/egltypes.h> | ||||
|  | ||||
| /* XXX should go in eglext.h */ | ||||
| @@ -192,7 +196,7 @@ GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display); | ||||
| GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); | ||||
| GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy); | ||||
| GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name); | ||||
| GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))(); | ||||
| GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))(void); | ||||
|  | ||||
| GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); | ||||
| GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); | ||||
| @@ -225,6 +229,44 @@ GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine); | ||||
| GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw); | ||||
| GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target); | ||||
|  | ||||
|  | ||||
|  | ||||
| /* EGL_MESA_screen extension  >>> PRELIMINARY <<< */ | ||||
| #ifndef EGL_MESA_screen_surface | ||||
| #define EGL_MESA_screen_surface 1 | ||||
|  | ||||
| #define EGL_BAD_SCREEN_MESA        0x4000 | ||||
| #define EGL_BAD_MODE_MESA          0x4001 | ||||
| #define EGL_SCREEN_COUNT_MESA      0x4002 | ||||
| #define EGL_SCREEN_POSITION_MESA   0x4003 | ||||
| #define EGL_MODE_ID_MESA           0x4004 | ||||
| #define EGL_REFRESH_RATE_MESA      0x4005 | ||||
| #define EGL_OPTIMAL_MODE_MESA      0x4006 | ||||
| #define EGL_SCREEN_BIT_MESA        0x08 | ||||
|  | ||||
| GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); | ||||
| GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); | ||||
| GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value); | ||||
| GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); | ||||
| GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | ||||
| GLAPI EGLBoolean APIENTRY eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode); | ||||
| GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); | ||||
| GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); | ||||
| GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface); | ||||
| GLAPI EGLBoolean APIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); | ||||
| GLAPI const char * APIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode); | ||||
|  | ||||
| #endif /* EGL_MESA_screen_surface */ | ||||
|  | ||||
|  | ||||
| #ifndef EGL_MESA_copy_context | ||||
| #define EGL_MESA_copy_context 1 | ||||
|  | ||||
| GLAPI EGLBoolean APIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); | ||||
|  | ||||
| #endif /* EGL_MESA_copy_context */ | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -1,48 +1,45 @@ | ||||
| /* | ||||
|  * egltypes.h - EGL API compatibility | ||||
|  * | ||||
|  * The intention here is to support multiple EGL implementations for the | ||||
|  * various backends - GLX, AGL, WGL, Solo - so we define the EGL types as | ||||
|  * opaque handles.  We also define the Native types as opaque handles for | ||||
|  * now, which should be fine for GLX and Solo but the others who knows. | ||||
|  * They can extend this later. | ||||
|  * | ||||
|  * We require that 'int' be 32 bits.  Other than that this should be pretty | ||||
|  * portable. | ||||
|  * | ||||
|  * Derived from the OpenGL|ES 1.1 egl.h on the Khronos website: | ||||
|  * http://www.khronos.org/opengles/spec_headers/opengles1_1/egl.h | ||||
|  * | ||||
|  */ | ||||
| ** egltypes.h for Mesa | ||||
| ** | ||||
| ** ONLY egl.h SHOULD INCLUDE THIS FILE! | ||||
| ** | ||||
| ** See comments about egltypes.h in the standard egl.h file. | ||||
| */ | ||||
|  | ||||
| #ifndef _EGLTYPES_H | ||||
| #define _EGLTYPES_H | ||||
|  | ||||
| #include <sys/types.h> | ||||
|  | ||||
| /* | ||||
|  * Native types | ||||
|  */ | ||||
| typedef void    *NativeDisplayType; | ||||
| typedef void    *NativePixmapType; | ||||
| typedef void    *NativeWindowType; | ||||
|  | ||||
| /* | ||||
|  * Types and resources | ||||
|  */ | ||||
| typedef GLboolean   EGLBoolean; | ||||
| typedef GLint       EGLint; | ||||
| typedef void        *EGLDisplay; | ||||
| typedef void        *EGLConfig; | ||||
| typedef void        *EGLSurface; | ||||
| typedef void        *EGLContext; | ||||
| ** These opaque EGL types are implemented as unsigned 32-bit integers: | ||||
| */ | ||||
| typedef u_int32_t EGLDisplay; | ||||
| typedef u_int32_t EGLConfig; | ||||
| typedef u_int32_t EGLSurface; | ||||
| typedef u_int32_t EGLContext; | ||||
|  | ||||
| /* EGL_MESA_screen_surface */ | ||||
| typedef u_int32_t EGLModeMESA; | ||||
| typedef u_int32_t EGLScreenMESA; | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * EGL and native handle values | ||||
|  */ | ||||
| #define EGL_DEFAULT_DISPLAY ((NativeDisplayType)0) | ||||
| #define EGL_NO_CONTEXT      ((EGLContext)0) | ||||
| #define EGL_NO_DISPLAY      ((EGLDisplay)0) | ||||
| #define EGL_NO_SURFACE      ((EGLSurface)0) | ||||
| ** Other basic EGL types: | ||||
| */ | ||||
| typedef u_int8_t EGLBoolean; | ||||
| typedef int32_t EGLint; | ||||
|  | ||||
| #endif /* _EGLTYPES_H */ | ||||
| typedef void * NativeDisplayType; | ||||
| typedef int NativePixmapType; | ||||
| typedef int NativeWindowType; | ||||
|  | ||||
| /* | ||||
| ** EGL and native handle null values: | ||||
| */ | ||||
| #define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0) | ||||
| #define EGL_NO_CONTEXT ((EGLContext) 0) | ||||
| #define EGL_NO_DISPLAY ((EGLDisplay) 0) | ||||
| #define EGL_NO_SURFACE ((EGLSurface) 0) | ||||
|  | ||||
| /* EGL_MESA_screen_surface */ | ||||
| #define EGL_NO_MODE_MESA ((EGLModeMESA) 0) | ||||
|   | ||||
| @@ -36,7 +36,6 @@ PROGS = \ | ||||
| 	morph3d \ | ||||
| 	multiarb \ | ||||
| 	occlude \ | ||||
| 	osdemo \ | ||||
| 	paltex \ | ||||
| 	pixeltex \ | ||||
| 	pointblast \ | ||||
| @@ -110,21 +109,7 @@ shadowtex: shadowtex.o showbuffer.o | ||||
| shadowtex.o: shadowtex.c showbuffer.h | ||||
| 	$(CC) -c -I$(INCDIR) $(CFLAGS) shadowtex.c | ||||
|  | ||||
| # special case: need the -lOSMesa library: | ||||
| osdemo: osdemo.c | ||||
| 	$(CC) -I$(INCDIR) $(CFLAGS) osdemo.c $(OSMESA_LIBS) -o $@ | ||||
|  | ||||
| # another special case: need the -lOSMesa16 library: | ||||
| osdemo16: osdemo16.c | ||||
| 	$(CC) -I$(INCDIR) $(CFLAGS) osdemo16.c $(OSMESA16_LIBS) -o $@ | ||||
|  | ||||
| # another special case: need the -lOSMesa32 library: | ||||
| osdemo32: osdemo32.c | ||||
| 	$(CC) -I$(INCDIR) $(CFLAGS) osdemo32.c $(OSMESA32_LIBS) -o $@ | ||||
|  | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	-rm -f $(PROGS) | ||||
| 	-rm -f *.o *~ | ||||
| 	-rm -f readtex.[ch] | ||||
| 	-rm -f readtex.[ch] showbuffer.[ch] | ||||
|   | ||||
| @@ -51,20 +51,16 @@ static void Redisplay( void ) | ||||
|    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); | ||||
|  | ||||
|    if (PixelLight) { | ||||
| #if defined(GL_ARB_fragment_program) | ||||
|       glProgramLocalParameter4fvARB_func(GL_FRAGMENT_PROGRAM_ARB, | ||||
|                                          LIGHTPOS, LightPos); | ||||
|       glEnable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|       glEnable(GL_VERTEX_PROGRAM_ARB); | ||||
| #endif | ||||
|       glDisable(GL_LIGHTING); | ||||
|    } | ||||
|    else { | ||||
|       glLightfv(GL_LIGHT0, GL_POSITION, LightPos); | ||||
| #if defined(GL_ARB_fragment_program) | ||||
|       glDisable(GL_FRAGMENT_PROGRAM_ARB); | ||||
|       glDisable(GL_VERTEX_PROGRAM_ARB); | ||||
| #endif | ||||
|       glEnable(GL_LIGHTING); | ||||
|    } | ||||
|  | ||||
| @@ -302,7 +298,6 @@ static void Init( void ) | ||||
|    glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB"); | ||||
|    assert(glDeleteProgramsARB_func); | ||||
|  | ||||
| #if defined(GL_ARB_fragment_program) | ||||
|    /* | ||||
|     * Fragment program | ||||
|     */ | ||||
| @@ -354,7 +349,6 @@ static void Init( void ) | ||||
|       exit(0); | ||||
|    } | ||||
|    assert(glIsProgramARB_func(VertProg)); | ||||
| #endif | ||||
|  | ||||
|    /* | ||||
|     * Misc init | ||||
| @@ -371,11 +365,9 @@ static void Init( void ) | ||||
|    { | ||||
|       /* Green-ish fog color */ | ||||
|       static const GLfloat fogColor[4] = {0.5, 1.0, 0.5, 0}; | ||||
|       glFogi(GL_FOG_MODE, GL_LINEAR); | ||||
|       glFogfv(GL_FOG_COLOR, fogColor); | ||||
|       glFogf(GL_FOG_START, 5.0); | ||||
|       glFogf(GL_FOG_END, 25.0); | ||||
|       glEnable(GL_FOG); | ||||
|    } | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| # Makefile for GLUT-based demo programs for VMS | ||||
| # contributed by Jouk Jansen  joukj@crys.chem.uva.nl | ||||
|  | ||||
| # contributed by Jouk Jansen  joukj@hrem.stm.tudelft.nl | ||||
| # Last update : 20 May 2005 | ||||
|  | ||||
| .first | ||||
| 	define gl [--.include.gl] | ||||
| @@ -22,7 +22,7 @@ LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB) | ||||
|  | ||||
|  | ||||
| PROGS = bounce.exe;,clearspd.exe;,drawpix.exe;,gamma.exe;,gears.exe;,\ | ||||
| 	glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,osdemo.exe;,\ | ||||
| 	glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,\ | ||||
| 	paltex.exe;,pointblast.exe;,reflect.exe;,spectex.exe;,stex3d.exe;,\ | ||||
| 	tessdemo.exe;,texcyl.exe;,texobj.exe;,trispd.exe;,winpos.exe; | ||||
|  | ||||
| @@ -53,7 +53,6 @@ glutfx.exe; : glutfx.obj $(LIB_DEP) | ||||
| isosurf.exe; : isosurf.obj $(LIB_DEP) [-.util]readtex.obj | ||||
| 	cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS) | ||||
| morph3d.exe; : morph3d.obj $(LIB_DEP) | ||||
| osdemo.exe; : osdemo.obj $(LIB_DEP) | ||||
| paltex.exe; : paltex.obj $(LIB_DEP) | ||||
| pointblast.exe; : pointblast.obj $(LIB_DEP) | ||||
| reflect.exe; : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\ | ||||
| @@ -79,7 +78,6 @@ glinfo.obj : glinfo.c | ||||
| glutfx.obj : glutfx.c | ||||
| isosurf.obj : isosurf.c | ||||
| morph3d.obj : morph3d.c | ||||
| osdemo.obj : osdemo.c | ||||
| paltex.obj : paltex.c | ||||
| pointblast.obj : pointblast.c | ||||
| reflect.obj : reflect.c | ||||
|   | ||||
| @@ -304,7 +304,7 @@ printhelp(void) | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); | ||||
|  | ||||
|    glRasterPos2i(60, 390); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); | ||||
|  | ||||
|    glRasterPos2i(60, 360); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Increase particle size"); | ||||
| @@ -317,9 +317,9 @@ printhelp(void) | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "R - Decrease emission radius"); | ||||
|  | ||||
|    glRasterPos2i(60, 240); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); | ||||
|    glRasterPos2i(60, 210); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Togle shadows"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Toggle shadows"); | ||||
|    glRasterPos2i(60, 180); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); | ||||
|    glRasterPos2i(60, 150); | ||||
| @@ -330,7 +330,7 @@ printhelp(void) | ||||
|    glRasterPos2i(60, 90); | ||||
|    if (joyavailable) | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "j - Togle jostick control (Joystick control available)"); | ||||
| 		  "j - Toggle jostick control (Joystick control available)"); | ||||
|    else | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "(No Joystick control available)"); | ||||
|   | ||||
| @@ -146,10 +146,10 @@ static void printhelp(void) | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help"); | ||||
|  | ||||
|   glRasterPos2i(60,390); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help"); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Toggle Help"); | ||||
|  | ||||
|   glRasterPos2i(60,360); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog"); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Toggle Fog"); | ||||
|   glRasterPos2i(60,330); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate"); | ||||
|   glRasterPos2i(60,300); | ||||
|   | ||||
| @@ -269,13 +269,13 @@ printhelp(void) | ||||
|    printstring(GLUT_BITMAP_HELVETICA_18, "Help"); | ||||
|  | ||||
|    glRasterPos2i(60, 390); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "h - Togle Help"); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "h - Toggle Help"); | ||||
|    glRasterPos2i(60, 370); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "f - Togle Fog"); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "f - Toggle Fog"); | ||||
|    glRasterPos2i(60, 350); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "b - Togle Back face culling"); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "b - Toggle Back face culling"); | ||||
|    glRasterPos2i(60, 330); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "p - Togle Wire frame"); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "p - Toggle Wire frame"); | ||||
|    glRasterPos2i(60, 310); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, "Arrow Keys - Rotate"); | ||||
|    glRasterPos2i(60, 290); | ||||
| @@ -286,7 +286,7 @@ printhelp(void) | ||||
|    glRasterPos2i(60, 250); | ||||
|    if (joyavailable) | ||||
|       printstring(GLUT_BITMAP_HELVETICA_12, | ||||
| 		  "j - Togle jostick control (Joystick control available)"); | ||||
| 		  "j - Toggle jostick control (Joystick control available)"); | ||||
|    else | ||||
|       printstring(GLUT_BITMAP_HELVETICA_12, | ||||
| 		  "(No Joystick control available)"); | ||||
| @@ -300,11 +300,11 @@ printhelp(void) | ||||
|  | ||||
|    glRasterPos2i(60, 190); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, | ||||
| 	       "1 - Togle the plane texture map window"); | ||||
| 	       "1 - Toggle the plane texture map window"); | ||||
|  | ||||
|    glRasterPos2i(60, 170); | ||||
|    printstring(GLUT_BITMAP_HELVETICA_12, | ||||
| 	       "2 - Togle the sphere texture map window"); | ||||
| 	       "2 - Toggle the sphere texture map window"); | ||||
| } | ||||
|  | ||||
| static GLboolean | ||||
|   | ||||
| @@ -39,6 +39,10 @@ static GLenum ReadType = GL_UNSIGNED_BYTE; | ||||
| #endif | ||||
| #if 0 | ||||
| static GLenum ReadFormat = GL_RGB; | ||||
| static GLenum ReadType = GL_UNSIGNED_BYTE; | ||||
| #endif | ||||
| #if 0 | ||||
| static GLenum ReadFormat = GL_RGB; | ||||
| static GLenum ReadType = GL_UNSIGNED_SHORT_5_6_5; | ||||
| #endif | ||||
| #if 0 | ||||
| @@ -96,6 +100,45 @@ SetupPixelTransfer(GLboolean invert) | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Exercise Pixel Pack parameters by reading the image in four pieces. | ||||
|  */ | ||||
| static void | ||||
| ComplexReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, | ||||
|                   GLenum format, GLenum type, GLvoid *pixels) | ||||
| { | ||||
|    const GLsizei width0 = width / 2; | ||||
|    const GLsizei width1 = width - width0; | ||||
|    const GLsizei height0 = height / 2; | ||||
|    const GLsizei height1 = height - height0; | ||||
|  | ||||
|    glPixelStorei(GL_PACK_ROW_LENGTH, width); | ||||
|  | ||||
|    /* lower-left quadrant */ | ||||
|    glReadPixels(x, y, width0, height0, format, type, pixels); | ||||
|  | ||||
|    /* lower-right quadrant */ | ||||
|    glPixelStorei(GL_PACK_SKIP_PIXELS, width0); | ||||
|    glReadPixels(x + width0, y, width1, height0, format, type, pixels); | ||||
|  | ||||
|    /* upper-left quadrant */ | ||||
|    glPixelStorei(GL_PACK_SKIP_PIXELS, 0); | ||||
|    glPixelStorei(GL_PACK_SKIP_ROWS, height0); | ||||
|    glReadPixels(x, y + height0, width0, height1, format, type, pixels); | ||||
|  | ||||
|    /* upper-right quadrant */ | ||||
|    glPixelStorei(GL_PACK_SKIP_PIXELS, width0); | ||||
|    glPixelStorei(GL_PACK_SKIP_ROWS, height0); | ||||
|    glReadPixels(x + width0, y + height0, width1, height1, format, type, pixels); | ||||
|  | ||||
|    /* restore defaults */ | ||||
|    glPixelStorei(GL_PACK_SKIP_PIXELS, 0); | ||||
|    glPixelStorei(GL_PACK_SKIP_ROWS, 0); | ||||
|    glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| static void | ||||
| Display( void ) | ||||
| { | ||||
| @@ -111,8 +154,13 @@ Display( void ) | ||||
|    glRasterPos2i(APosX, APosY); | ||||
|    glEnable(GL_DITHER); | ||||
|    SetupPixelTransfer(GL_FALSE); | ||||
|    glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | ||||
|    glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); | ||||
|  | ||||
|    /* might try alignment=4 here for testing */ | ||||
|    glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | ||||
|    glPixelStorei(GL_PACK_ALIGNMENT, 1); | ||||
|  | ||||
|    /* do readpixels, drawpixels */ | ||||
|    glRasterPos2i(BPosX, 5); | ||||
|    PrintString("Read/DrawPixels"); | ||||
| @@ -138,8 +186,14 @@ Display( void ) | ||||
|    else { | ||||
|       /* clear the temporary image to white (helpful for debugging */ | ||||
|       memset(TempImage, 255, ImgWidth * ImgHeight * 4); | ||||
| #if 0 | ||||
|       /* you might use this when debugging */ | ||||
|       glReadPixels(APosX, APosY, ImgWidth, ImgHeight, | ||||
|                    ReadFormat, ReadType, TempImage); | ||||
| #else | ||||
|       ComplexReadPixels(APosX, APosY, ImgWidth, ImgHeight, | ||||
|                         ReadFormat, ReadType, TempImage); | ||||
| #endif | ||||
|    } | ||||
|    glRasterPos2i(BPosX, BPosY); | ||||
|    glDisable(GL_DITHER); | ||||
| @@ -253,14 +307,14 @@ Init( GLboolean ciMode ) | ||||
|  | ||||
|    printf("Loaded %d by %d image\n", ImgWidth, ImgHeight ); | ||||
|  | ||||
|    glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | ||||
|    glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth); | ||||
|    glPixelStorei(GL_PACK_ALIGNMENT, 1); | ||||
|    glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth); | ||||
|  | ||||
|    Reset(); | ||||
|  | ||||
|    TempImage = (GLubyte *) malloc(ImgWidth * ImgHeight * 4 * sizeof(GLubyte)); | ||||
|    /* allocate an extra 1KB in case we're tinkering with pack alignment */ | ||||
|    TempImage = (GLubyte *) malloc(ImgWidth * ImgHeight * 4 * sizeof(GLubyte) | ||||
|                                   + 1000); | ||||
|    assert(TempImage); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -389,7 +389,7 @@ static void SpecialKey( int key, int x, int y ) | ||||
| int main( int argc, char *argv[] ) | ||||
| { | ||||
|    glutInit(&argc, argv); | ||||
|    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); | ||||
|    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL | GLUT_ALPHA); | ||||
|    glutInitWindowPosition( 0, 0 ); | ||||
|    glutInitWindowSize( Width, Height ); | ||||
|    glutCreateWindow(argv[0]); | ||||
|   | ||||
| @@ -250,13 +250,13 @@ static void printhelp(void) | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help"); | ||||
|  | ||||
|   glRasterPos2i(60,390); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help"); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Toggle Help"); | ||||
|   glRasterPos2i(60,360); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Togle Textures"); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Toggle Textures"); | ||||
|   glRasterPos2i(60,330); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog"); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Toggle Fog"); | ||||
|   glRasterPos2i(60,300); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Togle Back face culling"); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Toggle Back face culling"); | ||||
|   glRasterPos2i(60,270); | ||||
|   printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate"); | ||||
|   glRasterPos2i(60,240); | ||||
| @@ -266,7 +266,7 @@ static void printhelp(void) | ||||
|  | ||||
|   glRasterPos2i(60,180); | ||||
|   if(joyavailable) | ||||
|     printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Togle jostick control (Joystick control available)"); | ||||
|     printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Toggle jostick control (Joystick control available)"); | ||||
|   else | ||||
|     printstring(GLUT_BITMAP_TIMES_ROMAN_24,"(No Joystick control available)"); | ||||
| } | ||||
|   | ||||
| @@ -229,15 +229,15 @@ printhelp(void) | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); | ||||
|  | ||||
|    glRasterPos2i(60, 390); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); | ||||
|    glRasterPos2i(60, 360); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures"); | ||||
|    glRasterPos2i(60, 330); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); | ||||
|    glRasterPos2i(60, 300); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Wire frame"); | ||||
|    glRasterPos2i(60, 270); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling"); | ||||
|    glRasterPos2i(60, 240); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); | ||||
|    glRasterPos2i(60, 210); | ||||
| @@ -248,7 +248,7 @@ printhelp(void) | ||||
|    glRasterPos2i(60, 150); | ||||
|    if (joyavailable) | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "j - Togle jostick control (Joystick control available)"); | ||||
| 		  "j - Toggle jostick control (Joystick control available)"); | ||||
|    else | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "(No Joystick control available)"); | ||||
|   | ||||
| @@ -47,7 +47,6 @@ static GLdouble DownloadRate = 0.0;  /* texels/sec */ | ||||
| static GLuint Mode = 0; | ||||
|  | ||||
|  | ||||
| #define NUM_FORMATS 4 | ||||
| struct FormatRec { | ||||
|    GLenum Format; | ||||
|    GLenum Type; | ||||
| @@ -56,15 +55,20 @@ struct FormatRec { | ||||
| }; | ||||
|  | ||||
|  | ||||
| static const struct FormatRec FormatTable[NUM_FORMATS] = { | ||||
| static const struct FormatRec FormatTable[] = { | ||||
|   /* Format   Type                         IntFormat   TexelSize */ | ||||
|    { GL_BGRA, GL_UNSIGNED_BYTE,            GL_RGBA,        4    }, | ||||
|    { GL_RGB,  GL_UNSIGNED_BYTE,            GL_RGB,         3    }, | ||||
|    { GL_RGBA, GL_UNSIGNED_BYTE,            GL_RGBA,        4    }, | ||||
|    { GL_RGBA, GL_UNSIGNED_BYTE,            GL_RGB,         4    }, | ||||
|    { GL_RGB,  GL_UNSIGNED_SHORT_5_6_5,     GL_RGB,         2    }, | ||||
|    { GL_LUMINANCE, GL_UNSIGNED_BYTE,       GL_LUMINANCE,   1    }, | ||||
|    { GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE_ALPHA,   2    }, | ||||
|    { GL_ALPHA, GL_UNSIGNED_BYTE,           GL_ALPHA,       1    }, | ||||
| }; | ||||
| static GLint Format; | ||||
|  | ||||
| #define NUM_FORMATS (sizeof(FormatTable)/sizeof(FormatTable[0])) | ||||
|  | ||||
| static int | ||||
| BytesPerTexel(GLint format) | ||||
| @@ -81,6 +85,14 @@ FormatStr(GLenum format) | ||||
|          return "GL_RGB"; | ||||
|       case GL_RGBA: | ||||
|          return "GL_RGBA"; | ||||
|       case GL_BGRA: | ||||
|          return "GL_BGRA"; | ||||
|       case GL_LUMINANCE: | ||||
|          return "GL_LUMINANCE"; | ||||
|       case GL_LUMINANCE_ALPHA: | ||||
|          return "GL_LUMINANCE_ALPHA"; | ||||
|       case GL_ALPHA: | ||||
|          return "GL_ALPHA"; | ||||
|       default: | ||||
|          return ""; | ||||
|    } | ||||
| @@ -314,6 +326,11 @@ Key(unsigned char key, int x, int y) | ||||
|          Format = (Format + 1) % NUM_FORMATS; | ||||
|          Mode = 0; | ||||
|          break; | ||||
|       case 'F': | ||||
|          /* change format */ | ||||
|          Format = (Format - 1) % NUM_FORMATS; | ||||
|          Mode = 0; | ||||
|          break; | ||||
|       case 'p': | ||||
|          /* toggle border */ | ||||
|          ScaleAndBias = !ScaleAndBias; | ||||
|   | ||||
| @@ -300,15 +300,15 @@ printhelp(void) | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); | ||||
|  | ||||
|    glRasterPos2i(60, 390); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); | ||||
|    glRasterPos2i(60, 360); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures"); | ||||
|    glRasterPos2i(60, 330); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); | ||||
|    glRasterPos2i(60, 300); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Toggle strips"); | ||||
|    glRasterPos2i(60, 270); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling"); | ||||
|    glRasterPos2i(60, 240); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); | ||||
|    glRasterPos2i(60, 210); | ||||
| @@ -319,7 +319,7 @@ printhelp(void) | ||||
|    glRasterPos2i(60, 150); | ||||
|    if (joyavailable) | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "j - Togle jostick control (Joystick control available)"); | ||||
| 		  "j - Toggle jostick control (Joystick control available)"); | ||||
|    else | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "(No Joystick control available)"); | ||||
|   | ||||
| @@ -324,15 +324,15 @@ printhelp(void) | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); | ||||
|  | ||||
|    glRasterPos2i(60, 390); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); | ||||
|    glRasterPos2i(60, 360); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures"); | ||||
|    glRasterPos2i(60, 330); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); | ||||
|    glRasterPos2i(60, 300); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Toggle strips"); | ||||
|    glRasterPos2i(60, 270); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling"); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling"); | ||||
|    glRasterPos2i(60, 240); | ||||
|    printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); | ||||
|    glRasterPos2i(60, 210); | ||||
| @@ -343,7 +343,7 @@ printhelp(void) | ||||
|    glRasterPos2i(60, 150); | ||||
|    if (joyavailable) | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "j - Togle jostick control (Joystick control available)"); | ||||
| 		  "j - Toggle jostick control (Joystick control available)"); | ||||
|    else | ||||
|       printstring(GLUT_BITMAP_TIMES_ROMAN_24, | ||||
| 		  "(No Joystick control available)"); | ||||
|   | ||||
							
								
								
									
										58
									
								
								progs/egl/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								progs/egl/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| # progs/egl/Makefile | ||||
|  | ||||
| TOP = ../.. | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
|  | ||||
| INCLUDE_DIRS = -I$(TOP)/include | ||||
|  | ||||
| HEADERS = $(TOP)/include/GLES/egl.h | ||||
|  | ||||
| PROGRAMS = \ | ||||
| 	demo1 \ | ||||
| 	demo2 \ | ||||
| 	demo3 \ | ||||
| 	eglinfo | ||||
|  | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ | ||||
|  | ||||
|  | ||||
|  | ||||
| default: $(PROGRAMS) | ||||
|  | ||||
|  | ||||
| demo1: demo1.o $(LIB_DIR)/libEGL.so | ||||
| 	$(CC) demo1.o -L$(LIB_DIR) -lEGL -o $@ | ||||
|  | ||||
| demo1.o: demo1.c $(HEADERS) | ||||
| 	$(CC) -c $(CFLAGS) -I$(TOP)/include demo1.c | ||||
|  | ||||
|  | ||||
| demo2: demo2.o $(LIB_DIR)/libEGL.so | ||||
| 	$(CC) demo2.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@ | ||||
|  | ||||
| demo2.o: demo2.c $(HEADERS) | ||||
| 	$(CC) -c $(CFLAGS) -I$(TOP)/include demo2.c | ||||
|  | ||||
|  | ||||
| demo3: demo3.o $(LIB_DIR)/libEGL.so | ||||
| 	$(CC) demo3.o -L$(LIB_DIR) -lEGL $(APP_LIB_DEPS) -o $@ | ||||
|  | ||||
| demo3.o: demo3.c $(HEADERS) | ||||
| 	$(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c | ||||
|  | ||||
|  | ||||
| eglinfo: eglinfo.o $(LIB_DIR)/libEGL.so | ||||
| 	$(CC) eglinfo.o -L$(LIB_DIR) -lEGL -o $@ | ||||
|  | ||||
| eglinfo.o: eglinfo.c $(HEADERS) | ||||
| 	$(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c | ||||
|  | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	rm -f *.o *~ | ||||
| 	rm -f *.so | ||||
| 	rm -f $(PROGRAMS) | ||||
							
								
								
									
										146
									
								
								progs/egl/demo1.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								progs/egl/demo1.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,146 @@ | ||||
| /* | ||||
|  * Exercise EGL API functions | ||||
|  */ | ||||
|  | ||||
| #include <GLES/egl.h> | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Test EGL_MESA_screen_surface functions | ||||
|  */ | ||||
| static void | ||||
| TestScreens(EGLDisplay dpy) | ||||
| { | ||||
| #define MAX 8 | ||||
|    EGLScreenMESA screens[MAX]; | ||||
|    EGLint numScreens; | ||||
|    EGLint i; | ||||
|  | ||||
|    eglGetScreensMESA(dpy, screens, MAX, &numScreens); | ||||
|    printf("Found %d screens\n", numScreens); | ||||
|    for (i = 0; i < numScreens; i++) { | ||||
|       printf(" Screen %d handle: %d\n", i, (int) screens[i]); | ||||
|    } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Print table of all available configurations. | ||||
|  */ | ||||
| static void | ||||
| PrintConfigs(EGLDisplay d) | ||||
| { | ||||
|    EGLConfig *configs; | ||||
|    EGLint numConfigs, i; | ||||
|  | ||||
|    eglGetConfigs(d, NULL, 0, &numConfigs); | ||||
|    configs = malloc(sizeof(*configs) *numConfigs); | ||||
|    eglGetConfigs(d, configs, numConfigs, &numConfigs); | ||||
|  | ||||
|    printf("Configurations:\n"); | ||||
|    printf("     bf lv d st colorbuffer dp st   supported \n"); | ||||
|    printf("  id sz  l b ro  r  g  b  a th cl   surfaces  \n"); | ||||
|    printf("----------------------------------------------\n"); | ||||
|    for (i = 0; i < numConfigs; i++) { | ||||
|       EGLint id, size, level; | ||||
|       EGLint red, green, blue, alpha; | ||||
|       EGLint depth, stencil; | ||||
|       EGLint surfaces; | ||||
|       EGLint doubleBuf = 1, stereo = 0; | ||||
|       char surfString[100] = ""; | ||||
|  | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level); | ||||
|  | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces); | ||||
|  | ||||
|       if (surfaces & EGL_WINDOW_BIT) | ||||
|          strcat(surfString, "win,"); | ||||
|       if (surfaces & EGL_PBUFFER_BIT) | ||||
|          strcat(surfString, "pb,"); | ||||
|       if (surfaces & EGL_PIXMAP_BIT) | ||||
|          strcat(surfString, "pix,"); | ||||
|       if (strlen(surfString) > 0) | ||||
|          surfString[strlen(surfString) - 1] = 0; | ||||
|  | ||||
|       printf("0x%02x %2d %2d %c  %c %2d %2d %2d %2d %2d %2d   %-12s\n", | ||||
|              id, size, level, | ||||
|              doubleBuf ? 'y' : '.', | ||||
|              stereo ? 'y' : '.', | ||||
|              red, green, blue, alpha, | ||||
|              depth, stencil, surfString); | ||||
|    } | ||||
|    free(configs); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
|    int maj, min; | ||||
|    EGLContext ctx; | ||||
|    EGLSurface pbuffer; | ||||
|    EGLConfig configs[10]; | ||||
|    EGLint numConfigs, i; | ||||
|    EGLBoolean b; | ||||
|    const EGLint pbufAttribs[] = { | ||||
|       EGL_WIDTH, 500, | ||||
|       EGL_HEIGHT, 500, | ||||
|       EGL_NONE | ||||
|    }; | ||||
|  | ||||
|    /* | ||||
|    EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); | ||||
|    */ | ||||
|    EGLDisplay d = eglGetDisplay("!fb_dri"); | ||||
|    assert(d); | ||||
|  | ||||
|    if (!eglInitialize(d, &maj, &min)) { | ||||
|       printf("demo: eglInitialize failed\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|  | ||||
|    printf("EGL version = %d.%d\n", maj, min); | ||||
|    printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); | ||||
|  | ||||
|    PrintConfigs(d); | ||||
|  | ||||
|    ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL); | ||||
|    if (ctx == EGL_NO_CONTEXT) { | ||||
|       printf("failed to create context\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs); | ||||
|    if (pbuffer == EGL_NO_SURFACE) { | ||||
|       printf("failed to create pbuffer\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    b = eglMakeCurrent(d, pbuffer, pbuffer, ctx); | ||||
|    if (!b) { | ||||
|       printf("make current failed\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | ||||
|  | ||||
|    TestScreens(d); | ||||
|  | ||||
|    eglDestroySurface(d, pbuffer); | ||||
|    eglDestroyContext(d, ctx); | ||||
|    eglTerminate(d); | ||||
|  | ||||
|    return 0; | ||||
| } | ||||
							
								
								
									
										190
									
								
								progs/egl/demo2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										190
									
								
								progs/egl/demo2.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,190 @@ | ||||
| /* | ||||
|  * Exercise EGL API functions | ||||
|  */ | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <unistd.h> | ||||
|  | ||||
| #include <GLES/egl.h> | ||||
|  | ||||
| /*#define FRONTBUFFER*/ | ||||
|  | ||||
| static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) | ||||
| { | ||||
|    glBegin( GL_QUADS ); | ||||
|    glVertex2f( x1, y1 ); | ||||
|    glVertex2f( x2, y1 ); | ||||
|    glVertex2f( x2, y2 ); | ||||
|    glVertex2f( x1, y2 ); | ||||
|    glEnd(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void redraw(EGLDisplay dpy, EGLSurface surf, int rot) | ||||
| { | ||||
|    printf("Redraw event\n"); | ||||
|  | ||||
| #ifdef FRONTBUFFER | ||||
|     glDrawBuffer( GL_FRONT );  | ||||
| #else | ||||
|     glDrawBuffer( GL_BACK ); | ||||
| #endif | ||||
|  | ||||
|    glClearColor( rand()/(float)RAND_MAX,  | ||||
| 		 rand()/(float)RAND_MAX,  | ||||
| 		 rand()/(float)RAND_MAX, | ||||
| 		 1); | ||||
|  | ||||
|    glClear( GL_COLOR_BUFFER_BIT );  | ||||
|  | ||||
|    glColor3f( rand()/(float)RAND_MAX,  | ||||
| 	      rand()/(float)RAND_MAX,  | ||||
| 	      rand()/(float)RAND_MAX ); | ||||
|    glPushMatrix(); | ||||
|    glRotatef(rot, 0, 0, 1); | ||||
|    glScalef(.5, .5, .5); | ||||
|    _subset_Rectf( -1, -1, 1, 1 ); | ||||
|    glPopMatrix(); | ||||
|  | ||||
| #ifdef FRONTBUFFER | ||||
|    glFlush(); | ||||
| #else | ||||
|    eglSwapBuffers( dpy, surf );  | ||||
| #endif | ||||
|    glFinish(); | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Test EGL_MESA_screen_surface functions | ||||
|  */ | ||||
| static void | ||||
| TestScreens(EGLDisplay dpy) | ||||
| { | ||||
| #define MAX 8 | ||||
|    EGLScreenMESA screens[MAX]; | ||||
|    EGLint numScreens; | ||||
|    EGLint i; | ||||
|  | ||||
|    eglGetScreensMESA(dpy, screens, MAX, &numScreens); | ||||
|    printf("Found %d screens\n", numScreens); | ||||
|    for (i = 0; i < numScreens; i++) { | ||||
|       printf(" Screen %d handle: %d\n", i, (int) screens[i]); | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
|    int maj, min; | ||||
|    EGLContext ctx; | ||||
|    EGLSurface pbuffer, screen_surf; | ||||
|    EGLConfig configs[10]; | ||||
|    EGLint numConfigs, i; | ||||
|    EGLBoolean b; | ||||
|    const EGLint pbufAttribs[] = { | ||||
|       EGL_WIDTH, 500, | ||||
|       EGL_HEIGHT, 500, | ||||
|       EGL_NONE | ||||
|    }; | ||||
|    const EGLint screenAttribs[] = { | ||||
|       EGL_WIDTH, 1024, | ||||
|       EGL_HEIGHT, 768, | ||||
|       EGL_NONE | ||||
|    }; | ||||
|    EGLModeMESA mode; | ||||
|    EGLScreenMESA screen; | ||||
|    EGLint count; | ||||
|  | ||||
|    /* | ||||
|    EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); | ||||
|    */ | ||||
|    EGLDisplay d = eglGetDisplay("!fb_dri"); | ||||
|    assert(d); | ||||
|  | ||||
|    if (!eglInitialize(d, &maj, &min)) { | ||||
|       printf("demo: eglInitialize failed\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|  | ||||
|    printf("EGL version = %d.%d\n", maj, min); | ||||
|    printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); | ||||
|  | ||||
|    eglGetConfigs(d, configs, 10, &numConfigs); | ||||
|    printf("Got %d EGL configs:\n", numConfigs); | ||||
|    for (i = 0; i < numConfigs; i++) { | ||||
|       EGLint id, red, depth; | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth); | ||||
|       printf("%2d:  Red Size = %d  Depth Size = %d\n", id, red, depth); | ||||
|    } | ||||
|     | ||||
|    eglGetScreensMESA(d, &screen, 1, &count); | ||||
|    eglGetModesMESA(d, screen, &mode, 1, &count); | ||||
|  | ||||
|    ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL); | ||||
|    if (ctx == EGL_NO_CONTEXT) { | ||||
|       printf("failed to create context\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs); | ||||
|    if (pbuffer == EGL_NO_SURFACE) { | ||||
|       printf("failed to create pbuffer\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    b = eglMakeCurrent(d, pbuffer, pbuffer, ctx); | ||||
|    if (!b) { | ||||
|       printf("make current failed\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | ||||
|  | ||||
|    screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs); | ||||
|    if (screen_surf == EGL_NO_SURFACE) { | ||||
|       printf("failed to create screen surface\n"); | ||||
|       return 0; | ||||
|    } | ||||
|     | ||||
|    eglShowSurfaceMESA(d, screen, screen_surf, mode); | ||||
|  | ||||
|    b = eglMakeCurrent(d, screen_surf, screen_surf, ctx); | ||||
|    if (!b) { | ||||
|       printf("make current failed\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    glViewport(0, 0, 1024, 768); | ||||
|    glDrawBuffer( GL_FRONT );  | ||||
|  | ||||
|    glClearColor( 0,  | ||||
| 		 1.0,  | ||||
| 		 0, | ||||
| 		 1); | ||||
|  | ||||
|    glClear( GL_COLOR_BUFFER_BIT );  | ||||
|     | ||||
|        | ||||
|    TestScreens(d); | ||||
|  | ||||
|    glShadeModel( GL_FLAT ); | ||||
|     | ||||
|    for (i = 0; i < 6; i++) { | ||||
|       redraw(d, screen_surf, i*10 ); | ||||
|  | ||||
|       printf("sleep(1)\n");    | ||||
|       sleep(1);   | ||||
|    } | ||||
|  | ||||
|    eglDestroySurface(d, pbuffer); | ||||
|    eglDestroyContext(d, ctx); | ||||
|    eglTerminate(d); | ||||
|  | ||||
|    return 0; | ||||
| } | ||||
							
								
								
									
										635
									
								
								progs/egl/demo3.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										635
									
								
								progs/egl/demo3.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,635 @@ | ||||
| /* | ||||
|  * Exercise EGL API functions | ||||
|  */ | ||||
|  | ||||
| #include <GLES/egl.h> | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| #define PIXEL_CENTER(x) ((long)(x) + 0.5) | ||||
|  | ||||
| #define GAP 10 | ||||
| #define ROWS 3 | ||||
| #define COLS 4 | ||||
|  | ||||
| #define OPENGL_WIDTH 48 | ||||
| #define OPENGL_HEIGHT 13 | ||||
|  | ||||
|  | ||||
| GLenum rgb, doubleBuffer, windType; | ||||
| GLint windW, windH; | ||||
|  | ||||
| GLenum mode1, mode2; | ||||
| GLint boxW, boxH; | ||||
| GLubyte OpenGL_bits[] = { | ||||
|    0x00, 0x03, 0x00, 0x00, 0x00, 0x00,  | ||||
|    0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01, | ||||
|    0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,  | ||||
|    0x00, 0x03, 0x00, 0x00, 0x00, 0x00, | ||||
|    0x3e, 0x8f, 0xb7, 0xf9, 0xfc, 0x01,  | ||||
|    0x63, 0xdb, 0xb0, 0x8d, 0x0d, 0x00, | ||||
|    0x63, 0xdb, 0xb7, 0x8d, 0x0d, 0x00,  | ||||
|    0x63, 0xdb, 0xb6, 0x8d, 0x0d, 0x00, | ||||
|    0x63, 0x8f, 0xf3, 0xcc, 0x0d, 0x00,  | ||||
|    0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0a, | ||||
|    0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0e,  | ||||
|    0x63, 0x00, 0x00, 0x8c, 0xed, 0x0e, | ||||
|    0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00,  | ||||
| }; | ||||
|  | ||||
|  | ||||
| static void Init(void) | ||||
| { | ||||
|  | ||||
|     mode1 = GL_TRUE; | ||||
|     mode2 = GL_TRUE; | ||||
| } | ||||
|  | ||||
| static void Reshape(int width, int height) | ||||
| { | ||||
|  | ||||
|     windW = (GLint)width; | ||||
|     windH = (GLint)height; | ||||
| } | ||||
|  | ||||
| static void RotateColorMask(void) | ||||
| { | ||||
|     static GLint rotation = 0; | ||||
|      | ||||
|     rotation = (rotation + 1) & 0x3; | ||||
|     switch (rotation) { | ||||
|       case 0: | ||||
| 	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | ||||
| 	glIndexMask( 0xff ); | ||||
| 	break; | ||||
|       case 1: | ||||
| 	glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE); | ||||
| 	glIndexMask(0xFE); | ||||
| 	break; | ||||
|       case 2: | ||||
| 	glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE); | ||||
| 	glIndexMask(0xFD); | ||||
| 	break; | ||||
|       case 3: | ||||
| 	glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE); | ||||
| 	glIndexMask(0xFB); | ||||
| 	break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void Viewport(GLint row, GLint column) | ||||
| { | ||||
|     GLint x, y; | ||||
|  | ||||
|     boxW = (windW - (COLS + 1) * GAP) / COLS; | ||||
|     boxH = (windH - (ROWS + 1) * GAP) / ROWS; | ||||
|  | ||||
|     x = GAP + column * (boxW + GAP); | ||||
|     y = GAP + row * (boxH + GAP); | ||||
|  | ||||
|     glViewport(x, y, boxW, boxH); | ||||
|  | ||||
|     glMatrixMode(GL_PROJECTION); | ||||
|     glLoadIdentity(); | ||||
|     glOrtho(-boxW/2, boxW/2, -boxH/2, boxH/2, 0.0, 1.0); | ||||
|     glMatrixMode(GL_MODELVIEW); | ||||
|  | ||||
|     glEnable(GL_SCISSOR_TEST); | ||||
|     glScissor(x, y, boxW, boxH); | ||||
| } | ||||
|  | ||||
| enum { | ||||
|     COLOR_BLACK = 0, | ||||
|     COLOR_RED, | ||||
|     COLOR_GREEN, | ||||
|     COLOR_YELLOW, | ||||
|     COLOR_BLUE, | ||||
|     COLOR_MAGENTA, | ||||
|     COLOR_CYAN, | ||||
|     COLOR_WHITE | ||||
| }; | ||||
|  | ||||
| static float RGBMap[9][3] = { | ||||
|     {0, 0, 0}, | ||||
|     {1, 0, 0}, | ||||
|     {0, 1, 0}, | ||||
|     {1, 1, 0}, | ||||
|     {0, 0, 1}, | ||||
|     {1, 0, 1}, | ||||
|     {0, 1, 1}, | ||||
|     {1, 1, 1}, | ||||
|     {0.5, 0.5, 0.5} | ||||
| }; | ||||
|  | ||||
| static void SetColor(int c) | ||||
| { | ||||
|      glColor3fv(RGBMap[c]); | ||||
| } | ||||
|  | ||||
| static void Point(void) | ||||
| { | ||||
|     GLint i; | ||||
|  | ||||
|     glBegin(GL_POINTS); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2i(0, 0); | ||||
| 	for (i = 1; i < 8; i++) { | ||||
| 	    GLint j = i * 2; | ||||
| 	    SetColor(COLOR_BLACK+i); | ||||
| 	    glVertex2i(-j, -j); | ||||
| 	    glVertex2i(-j, 0); | ||||
| 	    glVertex2i(-j, j); | ||||
| 	    glVertex2i(0, j); | ||||
| 	    glVertex2i(j, j); | ||||
| 	    glVertex2i(j, 0); | ||||
| 	    glVertex2i(j, -j); | ||||
| 	    glVertex2i(0, -j); | ||||
| 	} | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void Lines(void) | ||||
| { | ||||
|     GLint i; | ||||
|  | ||||
|     glPushMatrix(); | ||||
|  | ||||
|     glTranslatef(-12, 0, 0); | ||||
|     for (i = 1; i < 8; i++) { | ||||
| 	SetColor(COLOR_BLACK+i); | ||||
| 	glBegin(GL_LINES); | ||||
| 	    glVertex2i(-boxW/4, -boxH/4); | ||||
| 	    glVertex2i(boxW/4, boxH/4); | ||||
| 	glEnd(); | ||||
| 	glTranslatef(4, 0, 0); | ||||
|     } | ||||
|  | ||||
|     glPopMatrix(); | ||||
|  | ||||
|     glBegin(GL_LINES); | ||||
| 	glVertex2i(0, 0); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void LineStrip(void) | ||||
| { | ||||
|  | ||||
|     glBegin(GL_LINE_STRIP); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4)); | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4)); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4)); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4)); | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_LINE_STRIP); | ||||
| 	glVertex2i(0, 0); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void LineLoop(void) | ||||
| { | ||||
|  | ||||
|     glBegin(GL_LINE_LOOP); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4)); | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4)); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4)); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4)); | ||||
|     glEnd(); | ||||
|  | ||||
|     glEnable(GL_LOGIC_OP); | ||||
|     glLogicOp(GL_XOR); | ||||
|  | ||||
|     glEnable(GL_BLEND); | ||||
|     glBlendFunc(GL_ONE, GL_ONE); | ||||
|  | ||||
|     SetColor(COLOR_MAGENTA); | ||||
|     glBegin(GL_LINE_LOOP); | ||||
| 	glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(-boxH/8)); | ||||
| 	glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8)); | ||||
|     glEnd(); | ||||
|     glBegin(GL_LINE_LOOP); | ||||
| 	glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8+5)); | ||||
| 	glVertex2f(PIXEL_CENTER(boxW/8), PIXEL_CENTER(boxH/8+5)); | ||||
|     glEnd(); | ||||
|     glDisable(GL_LOGIC_OP); | ||||
|     glDisable(GL_BLEND); | ||||
|  | ||||
|     SetColor(COLOR_GREEN); | ||||
|     glBegin(GL_POINTS); | ||||
| 	glVertex2i(0, 0); | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_LINE_LOOP); | ||||
| 	glVertex2i(0, 0); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void Bitmap(void) | ||||
| { | ||||
|  | ||||
|     glBegin(GL_LINES); | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2i(-boxW/2, 0); | ||||
| 	glVertex2i(boxW/2, 0); | ||||
| 	glVertex2i(0, -boxH/2); | ||||
| 	glVertex2i(0, boxH/2); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2i(0, -3); | ||||
| 	glVertex2i(0, -3+OPENGL_HEIGHT); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2i(0, -3); | ||||
| 	glVertex2i(OPENGL_WIDTH, -3); | ||||
|     glEnd(); | ||||
|  | ||||
|     SetColor(COLOR_GREEN); | ||||
|  | ||||
|     glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE); | ||||
|     glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | ||||
|  | ||||
|     glRasterPos2i(0, 0); | ||||
|     glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, 0, 3, 0.0, 0.0, OpenGL_bits); | ||||
| } | ||||
|  | ||||
| static void Triangles(void) | ||||
| { | ||||
|  | ||||
|     glBegin(GL_TRIANGLES); | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2i(-boxW/4, -boxH/4); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2i(-boxW/8, -boxH/16); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2i(boxW/8, -boxH/16); | ||||
|  | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2i(-boxW/4, boxH/4); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2i(-boxW/8, boxH/16); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2i(boxW/8, boxH/16); | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_TRIANGLES); | ||||
| 	glVertex2i(0, 0); | ||||
| 	glVertex2i(-100, 100); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void TriangleStrip(void) | ||||
| { | ||||
|  | ||||
|     glBegin(GL_TRIANGLE_STRIP); | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2i(-boxW/4, -boxH/4); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2i(-boxW/4, boxH/4); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2i(0, -boxH/4); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2i(0, boxH/4); | ||||
| 	SetColor(COLOR_CYAN); | ||||
| 	glVertex2i(boxW/4, -boxH/4); | ||||
| 	SetColor(COLOR_YELLOW); | ||||
| 	glVertex2i(boxW/4, boxH/4); | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_TRIANGLE_STRIP); | ||||
| 	glVertex2i(0, 0); | ||||
| 	glVertex2i(-100, 100); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void TriangleFan(void) | ||||
| { | ||||
|     GLint vx[8][2]; | ||||
|     GLint x0, y0, x1, y1, x2, y2, x3, y3; | ||||
|     GLint i; | ||||
|  | ||||
|     y0 = -boxH/4; | ||||
|     y1 = y0 + boxH/2/3; | ||||
|     y2 = y1 + boxH/2/3; | ||||
|     y3 = boxH/4; | ||||
|     x0 = -boxW/4; | ||||
|     x1 = x0 + boxW/2/3; | ||||
|     x2 = x1 + boxW/2/3; | ||||
|     x3 = boxW/4; | ||||
|  | ||||
|     vx[0][0] = x0; vx[0][1] = y1; | ||||
|     vx[1][0] = x0; vx[1][1] = y2; | ||||
|     vx[2][0] = x1; vx[2][1] = y3; | ||||
|     vx[3][0] = x2; vx[3][1] = y3; | ||||
|     vx[4][0] = x3; vx[4][1] = y2; | ||||
|     vx[5][0] = x3; vx[5][1] = y1; | ||||
|     vx[6][0] = x2; vx[6][1] = y0; | ||||
|     vx[7][0] = x1; vx[7][1] = y0; | ||||
|  | ||||
|     glBegin(GL_TRIANGLE_FAN); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2i(0, 0); | ||||
| 	for (i = 0; i < 8; i++) { | ||||
| 	    SetColor(COLOR_WHITE-i); | ||||
| 	    glVertex2iv(vx[i]); | ||||
| 	} | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_TRIANGLE_FAN); | ||||
| 	glVertex2i(0, 0); | ||||
| 	glVertex2i(-100, 100); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void Rect(void) | ||||
| { | ||||
|  | ||||
|     SetColor(COLOR_GREEN); | ||||
|     glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4); | ||||
| } | ||||
|  | ||||
| static void PolygonFunc(void) | ||||
| { | ||||
|     GLint vx[8][2]; | ||||
|     GLint x0, y0, x1, y1, x2, y2, x3, y3; | ||||
|     GLint i; | ||||
|  | ||||
|     y0 = -boxH/4; | ||||
|     y1 = y0 + boxH/2/3; | ||||
|     y2 = y1 + boxH/2/3; | ||||
|     y3 = boxH/4; | ||||
|     x0 = -boxW/4; | ||||
|     x1 = x0 + boxW/2/3; | ||||
|     x2 = x1 + boxW/2/3; | ||||
|     x3 = boxW/4; | ||||
|  | ||||
|     vx[0][0] = x0; vx[0][1] = y1; | ||||
|     vx[1][0] = x0; vx[1][1] = y2; | ||||
|     vx[2][0] = x1; vx[2][1] = y3; | ||||
|     vx[3][0] = x2; vx[3][1] = y3; | ||||
|     vx[4][0] = x3; vx[4][1] = y2; | ||||
|     vx[5][0] = x3; vx[5][1] = y1; | ||||
|     vx[6][0] = x2; vx[6][1] = y0; | ||||
|     vx[7][0] = x1; vx[7][1] = y0; | ||||
|  | ||||
|     glBegin(GL_POLYGON); | ||||
| 	for (i = 0; i < 8; i++) { | ||||
| 	    SetColor(COLOR_WHITE-i); | ||||
| 	    glVertex2iv(vx[i]); | ||||
| 	} | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_POLYGON); | ||||
| 	glVertex2i(0, 0); | ||||
| 	glVertex2i(100, 100); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void Quads(void) | ||||
| { | ||||
|  | ||||
|     glBegin(GL_QUADS); | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2i(-boxW/4, -boxH/4); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2i(-boxW/8, -boxH/16); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2i(boxW/8, -boxH/16); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2i(boxW/4, -boxH/4); | ||||
|  | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2i(-boxW/4, boxH/4); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2i(-boxW/8, boxH/16); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2i(boxW/8, boxH/16); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2i(boxW/4, boxH/4); | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_QUADS); | ||||
| 	glVertex2i(0, 0); | ||||
| 	glVertex2i(100, 100); | ||||
| 	glVertex2i(-100, 100); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void QuadStrip(void) | ||||
| { | ||||
|  | ||||
|     glBegin(GL_QUAD_STRIP); | ||||
| 	SetColor(COLOR_GREEN); | ||||
| 	glVertex2i(-boxW/4, -boxH/4); | ||||
| 	SetColor(COLOR_RED); | ||||
| 	glVertex2i(-boxW/4, boxH/4); | ||||
| 	SetColor(COLOR_BLUE); | ||||
| 	glVertex2i(0, -boxH/4); | ||||
| 	SetColor(COLOR_WHITE); | ||||
| 	glVertex2i(0, boxH/4); | ||||
| 	SetColor(COLOR_CYAN); | ||||
| 	glVertex2i(boxW/4, -boxH/4); | ||||
| 	SetColor(COLOR_YELLOW); | ||||
| 	glVertex2i(boxW/4, boxH/4); | ||||
|     glEnd(); | ||||
|  | ||||
|     glBegin(GL_QUAD_STRIP); | ||||
| 	glVertex2i(0, 0); | ||||
| 	glVertex2i(100, 100); | ||||
| 	glVertex2i(-100, 100); | ||||
|     glEnd(); | ||||
| } | ||||
|  | ||||
| static void Draw(EGLDisplay dpy, EGLSurface surf) | ||||
| { | ||||
|  | ||||
|     glViewport(0, 0, windW, windH); | ||||
|     glDisable(GL_SCISSOR_TEST); | ||||
|  | ||||
|     glPushAttrib(GL_COLOR_BUFFER_BIT); | ||||
|  | ||||
|     glColorMask(1, 1, 1, 1); | ||||
|     glIndexMask(~0); | ||||
|  | ||||
|     glClearColor(0.0, 0.0, 0.0, 0.0); | ||||
|     glClear(GL_COLOR_BUFFER_BIT); | ||||
|  | ||||
|     glPopAttrib(); | ||||
|  | ||||
|     if (mode1) { | ||||
| 	glShadeModel(GL_SMOOTH); | ||||
|     } else { | ||||
| 	glShadeModel(GL_FLAT); | ||||
|     } | ||||
|  | ||||
|     if (mode2) { | ||||
| 	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); | ||||
|     } else { | ||||
| 	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); | ||||
|     } | ||||
|  | ||||
|     Viewport(0, 0); Point(); | ||||
|     Viewport(0, 1); Lines(); | ||||
|     Viewport(0, 2); LineStrip(); | ||||
|     Viewport(0, 3); LineLoop(); | ||||
|  | ||||
|     Viewport(1, 0); Bitmap(); | ||||
|  | ||||
|     Viewport(1, 1); TriangleFan(); | ||||
|     Viewport(1, 2); Triangles(); | ||||
|     Viewport(1, 3); TriangleStrip(); | ||||
|  | ||||
|     Viewport(2, 0); Rect(); | ||||
|     Viewport(2, 1); PolygonFunc(); | ||||
|     Viewport(2, 2); Quads(); | ||||
|     Viewport(2, 3); QuadStrip(); | ||||
|  | ||||
|     glFlush(); | ||||
|  | ||||
|     if (doubleBuffer) { | ||||
| 	eglSwapBuffers(dpy, surf); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| write_ppm(const char *filename, const GLubyte *buffer, int width, int height) | ||||
| { | ||||
|    const int binary = 0; | ||||
|    FILE *f = fopen( filename, "w" ); | ||||
|    if (f) { | ||||
|       int i, x, y; | ||||
|       const GLubyte *ptr = buffer; | ||||
|       if (binary) { | ||||
|          fprintf(f,"P6\n"); | ||||
|          fprintf(f,"# ppm-file created by osdemo.c\n"); | ||||
|          fprintf(f,"%i %i\n", width,height); | ||||
|          fprintf(f,"255\n"); | ||||
|          fclose(f); | ||||
|          f = fopen( filename, "ab" );  /* reopen in binary append mode */ | ||||
|          for (y=height-1; y>=0; y--) { | ||||
|             for (x=0; x<width; x++) { | ||||
|                i = (y*width + x) * 4; | ||||
|                fputc(ptr[i], f);   /* write red */ | ||||
|                fputc(ptr[i+1], f); /* write green */ | ||||
|                fputc(ptr[i+2], f); /* write blue */ | ||||
|             } | ||||
|          } | ||||
|       } | ||||
|       else { | ||||
|          /*ASCII*/ | ||||
|          int counter = 0; | ||||
|          fprintf(f,"P3\n"); | ||||
|          fprintf(f,"# ascii ppm file created by osdemo.c\n"); | ||||
|          fprintf(f,"%i %i\n", width, height); | ||||
|          fprintf(f,"255\n"); | ||||
|          for (y=height-1; y>=0; y--) { | ||||
|             for (x=0; x<width; x++) { | ||||
|                i = (y*width + x) * 4; | ||||
|                fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]); | ||||
|                counter++; | ||||
|                if (counter % 5 == 0) | ||||
|                   fprintf(f, "\n"); | ||||
|             } | ||||
|          } | ||||
|       } | ||||
|       fclose(f); | ||||
|    } | ||||
| } | ||||
|  | ||||
| #include "../src/egl/main/egldisplay.h" | ||||
|  | ||||
| typedef struct fb_display | ||||
| { | ||||
|    _EGLDisplay Base;  /* base class/object */ | ||||
|    void *pFB; | ||||
| } fbDisplay; | ||||
|  | ||||
|  | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
|    int maj, min; | ||||
|    EGLContext ctx; | ||||
|    EGLSurface screen_surf; | ||||
|    EGLConfig configs[10]; | ||||
|    EGLScreenMESA screen; | ||||
|    EGLModeMESA mode; | ||||
|    EGLint numConfigs, count; | ||||
|    EGLBoolean b; | ||||
|    const EGLint screenAttribs[] = { | ||||
|       EGL_WIDTH, 1024, | ||||
|       EGL_HEIGHT, 768, | ||||
|       EGL_NONE | ||||
|    }; | ||||
|  | ||||
|    /* | ||||
|    EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); | ||||
|    */ | ||||
|    EGLDisplay d = eglGetDisplay("!fb_dri"); | ||||
|    assert(d); | ||||
|  | ||||
|    if (!eglInitialize(d, &maj, &min)) { | ||||
|       printf("demo: eglInitialize failed\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|  | ||||
|    printf("EGL version = %d.%d\n", maj, min); | ||||
|    printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR)); | ||||
|  | ||||
|    eglGetConfigs(d, configs, 10, &numConfigs); | ||||
|    eglGetScreensMESA(d, &screen, 1, &count); | ||||
|    eglGetModesMESA(d, screen, &mode, 1, &count); | ||||
|  | ||||
|    ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL); | ||||
|    if (ctx == EGL_NO_CONTEXT) { | ||||
|       printf("failed to create context\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs); | ||||
|    if (screen_surf == EGL_NO_SURFACE) { | ||||
|       printf("failed to create screen surface\n"); | ||||
|       return 0; | ||||
|    } | ||||
|     | ||||
|    eglShowSurfaceMESA(d, screen, screen_surf, mode); | ||||
|  | ||||
|    b = eglMakeCurrent(d, screen_surf, screen_surf, ctx); | ||||
|    if (!b) { | ||||
|       printf("make current failed\n"); | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    Init();    | ||||
|    Reshape(1024, 768); | ||||
|  | ||||
|    glDrawBuffer( GL_FRONT );  | ||||
|    glClearColor( 0,  | ||||
| 		 1.0,  | ||||
| 		 0, | ||||
| 		 1); | ||||
|  | ||||
|    glClear( GL_COLOR_BUFFER_BIT );  | ||||
|  | ||||
|    doubleBuffer = 1;    | ||||
|    glDrawBuffer( GL_BACK );  | ||||
|  | ||||
|    Draw(d, screen_surf); | ||||
|     | ||||
|    write_ppm("dump.ppm", ((struct fb_display *)_eglLookupDisplay(d))->pFB, 1024, 768); | ||||
|     | ||||
|    eglDestroySurface(d, screen_surf); | ||||
|    eglDestroyContext(d, ctx); | ||||
|    eglTerminate(d); | ||||
|  | ||||
|    return 0; | ||||
| } | ||||
							
								
								
									
										162
									
								
								progs/egl/eglinfo.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										162
									
								
								progs/egl/eglinfo.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,162 @@ | ||||
| /* | ||||
|  * eglinfo - like glxinfo but for EGL | ||||
|  * | ||||
|  * Brian Paul | ||||
|  * 11 March 2005 | ||||
|  * | ||||
|  * Copyright (C) 2005  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. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include <GLES/egl.h> | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #define MAX_CONFIGS 1000 | ||||
| #define MAX_MODES 1000 | ||||
| #define MAX_SCREENS 10 | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Print table of all available configurations. | ||||
|  */ | ||||
| static void | ||||
| PrintConfigs(EGLDisplay d) | ||||
| { | ||||
|    EGLConfig configs[MAX_CONFIGS]; | ||||
|    EGLint numConfigs, i; | ||||
|  | ||||
|    eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs); | ||||
|  | ||||
|    printf("Configurations:\n"); | ||||
|    printf("     bf lv d st colorbuffer dp st   supported \n"); | ||||
|    printf("  id sz  l b ro  r  g  b  a th cl   surfaces  \n"); | ||||
|    printf("----------------------------------------------\n"); | ||||
|    for (i = 0; i < numConfigs; i++) { | ||||
|       EGLint id, size, level; | ||||
|       EGLint red, green, blue, alpha; | ||||
|       EGLint depth, stencil; | ||||
|       EGLint surfaces; | ||||
|       EGLint doubleBuf = 1, stereo = 0; | ||||
|       char surfString[100] = ""; | ||||
|  | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level); | ||||
|  | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil); | ||||
|       eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces); | ||||
|  | ||||
|       if (surfaces & EGL_WINDOW_BIT) | ||||
|          strcat(surfString, "win,"); | ||||
|       if (surfaces & EGL_PBUFFER_BIT) | ||||
|          strcat(surfString, "pb,"); | ||||
|       if (surfaces & EGL_PIXMAP_BIT) | ||||
|          strcat(surfString, "pix,"); | ||||
|       if (strlen(surfString) > 0) | ||||
|          surfString[strlen(surfString) - 1] = 0; | ||||
|  | ||||
|       printf("0x%02x %2d %2d %c  %c %2d %2d %2d %2d %2d %2d   %-12s\n", | ||||
|              id, size, level, | ||||
|              doubleBuf ? 'y' : '.', | ||||
|              stereo ? 'y' : '.', | ||||
|              red, green, blue, alpha, | ||||
|              depth, stencil, surfString); | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Print table of all available configurations. | ||||
|  */ | ||||
| static void | ||||
| PrintModes(EGLDisplay d) | ||||
| { | ||||
| #ifdef EGL_MESA_screen_surface | ||||
|    const char *extensions = eglQueryString(d, EGL_EXTENSIONS); | ||||
|    if (strstr(extensions, "EGL_MESA_screen_surface")) { | ||||
|       EGLScreenMESA screens[MAX_SCREENS]; | ||||
|       EGLint numScreens = 1, scrn; | ||||
|       EGLModeMESA modes[MAX_MODES]; | ||||
|  | ||||
|       eglGetScreensMESA(d, screens, MAX_SCREENS, &numScreens); | ||||
|       printf("Number of Screens: %d\n\n", numScreens); | ||||
|  | ||||
|       for (scrn = 0; scrn < numScreens; scrn++) { | ||||
|          EGLint numModes, i; | ||||
|  | ||||
|          eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes); | ||||
|  | ||||
|          printf("Screen %d Modes:\n", scrn); | ||||
|          printf("  id  width height refresh  name\n"); | ||||
|          printf("-----------------------------------------\n"); | ||||
|          for (i = 0; i < numModes; i++) { | ||||
|             EGLint id, w, h, r; | ||||
|             const char *str; | ||||
|             eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id); | ||||
|             eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w); | ||||
|             eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h); | ||||
|             eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r); | ||||
|             str = eglQueryModeStringMESA(d, modes[i]); | ||||
|             printf("0x%02x %5d  %5d   %.3f  %s\n", id, w, h, r / 1000.0, str); | ||||
|          } | ||||
|       } | ||||
|    } | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
|    int maj, min; | ||||
|    /*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/ | ||||
|    EGLDisplay d = eglGetDisplay("!fb_dri"); | ||||
|  | ||||
|    if (!eglInitialize(d, &maj, &min)) { | ||||
|       printf("eglinfo: eglInitialize failed\n"); | ||||
|       exit(1); | ||||
|    } | ||||
|  | ||||
|    printf("EGL API version: %d.%d\n", maj, min); | ||||
|    printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR)); | ||||
|    printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION)); | ||||
|    printf("EGL extensions string:\n"); | ||||
|    printf("    %s\n", eglQueryString(d, EGL_EXTENSIONS)); | ||||
|    printf("\n"); | ||||
|  | ||||
|    PrintConfigs(d); | ||||
|  | ||||
|    printf("\n"); | ||||
|  | ||||
|    PrintModes(d); | ||||
|  | ||||
|    eglTerminate(d); | ||||
|  | ||||
|    return 0; | ||||
| } | ||||
							
								
								
									
										53
									
								
								progs/fbdev/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								progs/fbdev/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| # Makefile for miniglx demo programs | ||||
|  | ||||
| TOP = ../.. | ||||
|  | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
|  | ||||
| SOURCES = glfbdevtest.c | ||||
|  | ||||
| OBJECTS = $(SOURCES:.c=.o) | ||||
|  | ||||
| PROGS = $(SOURCES:%.c=%) | ||||
|  | ||||
| INCLUDES = \ | ||||
| 	-I. \ | ||||
| 	-I$(TOP)/include | ||||
|  | ||||
|  | ||||
| ##### RULES ##### | ||||
|  | ||||
| .SUFFIXES: | ||||
| .SUFFIXES: .c | ||||
|  | ||||
| .c: | ||||
| 	$(CC) $(INCLUDES) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@ | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ | ||||
|  | ||||
| .S.o: | ||||
| 	$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ | ||||
|  | ||||
|  | ||||
| ##### TARGETS ##### | ||||
|  | ||||
| default:  depend $(PROGS) | ||||
|  | ||||
| clean: | ||||
| 	rm -f $(PROGS) | ||||
| 	rm -f *.o | ||||
|  | ||||
|  | ||||
| depend: $(SOURCES) | ||||
| 	touch depend | ||||
| 	$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null  | ||||
|  | ||||
|  | ||||
| # Emacs tags | ||||
| tags: | ||||
| 	etags `find . -name \*.[ch]` `find ../include` | ||||
|  | ||||
|  | ||||
| include depend | ||||
							
								
								
									
										73
									
								
								progs/osdemos/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								progs/osdemos/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
| # progs/demos/Makefile | ||||
|  | ||||
| TOP = ../.. | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
| INCDIR = $(TOP)/include | ||||
|  | ||||
| OSMESA_LIBS = -L$(LIB_DIR) -lglut -lOSMesa -lGLU -lGL $(APP_LIB_DEPS) | ||||
|  | ||||
| OSMESA16_LIBS = -L$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS) | ||||
|  | ||||
| OSMESA32_LIBS = -L$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS) | ||||
|  | ||||
| LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME) $(LIB_DIR)/$(GLUT_LIB_NAME) | ||||
|  | ||||
| PROGS = \ | ||||
| 	osdemo  | ||||
|  | ||||
|  | ||||
| ##### RULES ##### | ||||
|  | ||||
| .SUFFIXES: | ||||
| .SUFFIXES: .c | ||||
|  | ||||
|  | ||||
| # make executable from .c file: | ||||
| .c: $(LIB_DEP) readtex.o | ||||
| 	$(CC) -I$(INCDIR) $(CFLAGS) $< readtex.o $(APP_LIB_DEPS) -o $@ | ||||
|  | ||||
|  | ||||
| ##### TARGETS ##### | ||||
|  | ||||
| default: readtex.o $(PROGS) | ||||
|  | ||||
|  | ||||
| readtex.c: $(TOP)/progs/util/readtex.c | ||||
| 	cp $< . | ||||
|  | ||||
| readtex.h: $(TOP)/progs/util/readtex.h | ||||
| 	cp $< . | ||||
|  | ||||
| readtex.o: readtex.c readtex.h | ||||
| 	$(CC) -c -I$(INCDIR) $(CFLAGS) readtex.c | ||||
|  | ||||
|  | ||||
| showbuffer.c: $(TOP)/progs/util/showbuffer.c | ||||
| 	cp $< . | ||||
|  | ||||
| showbuffer.h: $(TOP)/progs/util/showbuffer.h | ||||
| 	cp $< . | ||||
|  | ||||
| showbuffer.o: showbuffer.c showbuffer.h | ||||
| 	$(CC) -c -I$(INCDIR) $(CFLAGS) showbuffer.c | ||||
|  | ||||
|  | ||||
| # special case: need the -lOSMesa library: | ||||
| osdemo: osdemo.c | ||||
| 	$(CC) -I$(INCDIR) $(CFLAGS) osdemo.c $(OSMESA_LIBS) -o $@ | ||||
|  | ||||
| # another special case: need the -lOSMesa16 library: | ||||
| osdemo16: osdemo16.c | ||||
| 	$(CC) -I$(INCDIR) $(CFLAGS) osdemo16.c $(OSMESA16_LIBS) -o $@ | ||||
|  | ||||
| # another special case: need the -lOSMesa32 library: | ||||
| osdemo32: osdemo32.c | ||||
| 	$(CC) -I$(INCDIR) $(CFLAGS) osdemo32.c $(OSMESA32_LIBS) -o $@ | ||||
|  | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	-rm -f $(PROGS) | ||||
| 	-rm -f *.o *~ | ||||
| 	-rm -f readtex.[ch] showbuffer.[ch] | ||||
| @@ -45,3 +45,4 @@ readtex.o: readtex.c readtex.h | ||||
| clean: | ||||
| 	-rm -f $(PROGS) | ||||
| 	-rm -f *.o *~ | ||||
| 	-rm -f readtex.c readtex.h | ||||
|   | ||||
| @@ -31,8 +31,6 @@ | ||||
| #  Available options: | ||||
| # | ||||
| #    Environment variables: | ||||
| #	CPU		optimize for the given processor. | ||||
| #			default = pentium | ||||
| #	GLIDE		path to Glide3 SDK; used with FX. | ||||
| #			default = $(TOP)/glide3 | ||||
| #	FX=1		build for 3dfx Glide3. Note that this disables | ||||
| @@ -54,12 +52,11 @@ | ||||
| .SECONDARY: ../util/readtex.o ../util/showbuffer.o | ||||
|  | ||||
| TOP = ../.. | ||||
| CPU ?= pentium | ||||
| GLIDE ?= $(TOP)/glide3 | ||||
|  | ||||
| CC = gcc | ||||
| CFLAGS = -Wall -W -pedantic | ||||
| CFLAGS += -O2 -ffast-math -mtune=$(CPU) | ||||
| CFLAGS += -O2 -ffast-math | ||||
| CFLAGS += -I$(TOP)/include -I../util | ||||
| CFLAGS += -DGLUT_IMPORT_LIB | ||||
| ifeq ($(FX),1) | ||||
|   | ||||
| @@ -31,8 +31,6 @@ | ||||
| #  Available options: | ||||
| # | ||||
| #    Environment variables: | ||||
| #	CPU		optimize for the given processor. | ||||
| #			default = pentium | ||||
| # | ||||
| #    Targets: | ||||
| #	<file.exe>	build a specific file | ||||
| @@ -45,11 +43,10 @@ | ||||
| .SECONDARY: ../util/readtex.o ../util/showbuffer.o | ||||
|  | ||||
| TOP = ../.. | ||||
| CPU ?= pentium | ||||
|  | ||||
| CC = mingw32-gcc | ||||
| CFLAGS = -Wall -W -pedantic | ||||
| CFLAGS += -O2 -ffast-math -mtune=$(CPU) | ||||
| CFLAGS += -O2 -ffast-math | ||||
| CFLAGS += -I$(TOP)/include -I../util | ||||
| ifeq ($(FX),1) | ||||
| CFLAGS += -DFX | ||||
|   | ||||
| @@ -14,7 +14,9 @@ | ||||
| #include <windows.h> | ||||
| #endif | ||||
| #define GL_GLEXT_LEGACY | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <GL/glut.h> | ||||
| #include <GL/glext.h> | ||||
|  | ||||
|  | ||||
| GLenum doubleBuffer; | ||||
|   | ||||
| @@ -37,7 +37,7 @@ static PPMImage *LoadPPM(const char *filename) | ||||
| 	exit(1); | ||||
|     } | ||||
|  | ||||
|     if (fscanf(fp, "%d %d", &result->sizeX, &result->sizeY) != 2) | ||||
|     if (fscanf(fp, "%lu %lu", &result->sizeX, &result->sizeY) != 2) | ||||
|     { | ||||
| 	fprintf(stderr, "Error loading image `%s'\n", filename); | ||||
| 	exit(1); | ||||
|   | ||||
| @@ -26,6 +26,8 @@ SOURCES = antialias.c \ | ||||
| 	cva.c \ | ||||
| 	dinoshade.c \ | ||||
| 	floattex.c \ | ||||
| 	fbotest1.c \ | ||||
| 	fbotexture.c \ | ||||
| 	fogcoord.c \ | ||||
| 	fptest1.c \ | ||||
| 	fptexture.c \ | ||||
|   | ||||
| @@ -83,8 +83,8 @@ static void Display( void ) | ||||
|    DO_FUNC( glTexCoord3fv, (v) ); | ||||
|    DO_FUNC( glMultiTexCoord2fv, (GL_TEXTURE0, v) ); | ||||
|    DO_FUNC( glMultiTexCoord2f, (GL_TEXTURE0, 0.0, 0.0) ); | ||||
|    DO_FUNC( glFogCoordfv, (v) ); | ||||
|    DO_FUNC( glFogCoordf, (0.5) ); | ||||
|    DO_FUNC( glFogCoordfvEXT, (v) ); | ||||
|    DO_FUNC( glFogCoordfEXT, (0.5) ); | ||||
|  | ||||
|    glEnd(); | ||||
|  | ||||
|   | ||||
							
								
								
									
										169
									
								
								progs/tests/fbotest1.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										169
									
								
								progs/tests/fbotest1.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,169 @@ | ||||
| /* | ||||
|  * Test GL_EXT_framebuffer_object | ||||
|  * | ||||
|  * Brian Paul | ||||
|  * 7 Feb 2005 | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <math.h> | ||||
| #include <GL/glut.h> | ||||
|  | ||||
| static int Width = 400, Height = 400; | ||||
| static GLuint MyFB; | ||||
|  | ||||
|  | ||||
| static void | ||||
| CheckError(int line) | ||||
| { | ||||
|    GLenum err = glGetError(); | ||||
|    if (err) { | ||||
|       printf("GL Error 0x%x at line %d\n", (int) err, line); | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Display( void ) | ||||
| { | ||||
|    GLubyte *buffer = malloc(Width * Height * 4); | ||||
|    GLenum status; | ||||
|  | ||||
|    /* draw to user framebuffer */ | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); | ||||
|    glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); | ||||
|    glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); | ||||
|  | ||||
|    status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | ||||
|    if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { | ||||
|       printf("Framebuffer incomplete!!!\n"); | ||||
|    } | ||||
|  | ||||
|    glClearColor(0.5, 0.5, 1.0, 0.0); | ||||
|    glClear( GL_COLOR_BUFFER_BIT ); | ||||
|  | ||||
|    glBegin(GL_POLYGON); | ||||
|    glColor3f(1, 0, 0); | ||||
|    glVertex2f(-1, -1); | ||||
|    glColor3f(0, 1, 0); | ||||
|    glVertex2f(1, -1); | ||||
|    glColor3f(0, 0, 1); | ||||
|    glVertex2f(0, 1); | ||||
|    glEnd(); | ||||
|  | ||||
|    /* read from user framebuffer */ | ||||
|    glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | ||||
|  | ||||
|    /* draw to window */ | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||||
|    glWindowPos2iARB(0, 0); | ||||
|    glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | ||||
|  | ||||
|    free(buffer); | ||||
|    glutSwapBuffers(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Reshape( int width, int height ) | ||||
| { | ||||
|    float ar = (float) width / (float) height; | ||||
|    glViewport( 0, 0, width, height ); | ||||
|    glMatrixMode( GL_PROJECTION ); | ||||
|    glLoadIdentity(); | ||||
| #if 0 | ||||
|    glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 ); | ||||
| #else | ||||
|    glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); | ||||
| #endif | ||||
|    glMatrixMode( GL_MODELVIEW ); | ||||
|    glLoadIdentity(); | ||||
|    glTranslatef( 0.0, 0.0, -15.0 ); | ||||
|    Width = width; | ||||
|    Height = height; | ||||
|    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Key( unsigned char key, int x, int y ) | ||||
| { | ||||
|    (void) x; | ||||
|    (void) y; | ||||
|    switch (key) { | ||||
|       case 27: | ||||
|          exit(0); | ||||
|          break; | ||||
|    } | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Init( void ) | ||||
| { | ||||
|    GLuint rb; | ||||
|    GLint i; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { | ||||
|       printf("GL_EXT_framebuffer_object not found!\n"); | ||||
|       /*exit(0);*/ | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    glGenFramebuffersEXT(1, &MyFB); | ||||
|    assert(MyFB); | ||||
|    assert(glIsFramebufferEXT(MyFB)); | ||||
|    glDeleteFramebuffersEXT(1, &MyFB); | ||||
|    assert(!glIsFramebufferEXT(MyFB)); | ||||
|    /* Note, continue to use MyFB below */ | ||||
|  | ||||
|    glGenRenderbuffersEXT(1, &rb); | ||||
|    assert(rb); | ||||
|    assert(glIsRenderbufferEXT(rb)); | ||||
|    glDeleteRenderbuffersEXT(1, &rb); | ||||
|    assert(!glIsRenderbufferEXT(rb)); | ||||
|    rb = 42; /* an arbitrary ID */ | ||||
|  | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); | ||||
|    assert(glIsFramebufferEXT(MyFB)); | ||||
|    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); | ||||
|    assert(glIsRenderbufferEXT(rb)); | ||||
|  | ||||
|    glGetIntegerv(GL_RENDERBUFFER_BINDING_EXT, &i); | ||||
|    assert(i == rb); | ||||
|  | ||||
|    glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i); | ||||
|    assert(i == MyFB); | ||||
|  | ||||
|    glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, | ||||
|                                 GL_RENDERBUFFER_EXT, rb); | ||||
|  | ||||
|    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); | ||||
|  | ||||
|    CheckError(__LINE__); | ||||
|  | ||||
|    /* restore to default */ | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| main( int argc, char *argv[] ) | ||||
| { | ||||
|    glutInit( &argc, argv ); | ||||
|    glutInitWindowPosition( 0, 0 ); | ||||
|    glutInitWindowSize(Width, Height); | ||||
|    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); | ||||
|    glutCreateWindow(argv[0]); | ||||
|    glutReshapeFunc( Reshape ); | ||||
|    glutKeyboardFunc( Key ); | ||||
|    glutDisplayFunc( Display ); | ||||
|    Init(); | ||||
|    glutMainLoop(); | ||||
|    return 0; | ||||
| } | ||||
							
								
								
									
										276
									
								
								progs/tests/fbotexture.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										276
									
								
								progs/tests/fbotexture.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,276 @@ | ||||
| /* | ||||
|  * Test GL_EXT_framebuffer_object render-to-texture | ||||
|  * | ||||
|  * Draw a teapot into a texture image with stenciling. | ||||
|  * Then draw a textured quad using that texture. | ||||
|  * | ||||
|  * Brian Paul | ||||
|  * 18 Apr 2005 | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #define GL_GLEXT_PROTOTYPES | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <math.h> | ||||
| #include <GL/glut.h> | ||||
|  | ||||
| static int Width = 400, Height = 400; | ||||
| static int TexWidth = 512, TexHeight = 512; | ||||
| static GLuint MyFB; | ||||
| static GLuint TexObj; | ||||
| static GLuint DepthRB, StencilRB; | ||||
| static GLboolean Anim = GL_FALSE; | ||||
| static GLfloat Rot = 0.0; | ||||
|  | ||||
|  | ||||
| static void | ||||
| CheckError(int line) | ||||
| { | ||||
|    GLenum err = glGetError(); | ||||
|    if (err) { | ||||
|       printf("GL Error 0x%x at line %d\n", (int) err, line); | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Idle(void) | ||||
| { | ||||
|    Rot = glutGet(GLUT_ELAPSED_TIME) * 0.05; | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| RenderTexture(void) | ||||
| { | ||||
|    GLint level = 0; | ||||
|    GLenum status; | ||||
|  | ||||
|    glMatrixMode(GL_PROJECTION); | ||||
|    glLoadIdentity(); | ||||
|    glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); | ||||
|    glMatrixMode(GL_MODELVIEW); | ||||
|    glLoadIdentity(); | ||||
|    glTranslatef(0.0, 0.0, -15.0); | ||||
|  | ||||
|    /* draw to texture */ | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); | ||||
|    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, | ||||
|                              GL_TEXTURE_2D, TexObj, level); | ||||
|  | ||||
|    status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | ||||
|    if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { | ||||
|       printf("Framebuffer incomplete!!!\n"); | ||||
|    } | ||||
|  | ||||
|    glViewport(0, 0, TexWidth, TexHeight); | ||||
|  | ||||
|    glClearColor(0.5, 0.5, 1.0, 0.0); | ||||
|    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | ||||
|  | ||||
|    glEnable(GL_DEPTH_TEST); | ||||
|    glEnable(GL_STENCIL_TEST); | ||||
|    glStencilFunc(GL_NEVER, 1, ~0); | ||||
|    glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE); | ||||
|  | ||||
|    /* draw diamond-shaped stencil pattern */ | ||||
|    glColor3f(0, 1, 0); | ||||
|    glBegin(GL_POLYGON); | ||||
|    glVertex2f(-0.2,  0.0); | ||||
|    glVertex2f( 0.0, -0.2); | ||||
|    glVertex2f( 0.2,  0.0); | ||||
|    glVertex2f( 0.0,  0.2); | ||||
|    glEnd(); | ||||
|  | ||||
|    /* draw teapot where stencil != 1 */ | ||||
|    glStencilFunc(GL_NOTEQUAL, 1, ~0); | ||||
|    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); | ||||
|  | ||||
| #if 0 | ||||
|    glBegin(GL_POLYGON); | ||||
|    glColor3f(1, 0, 0); | ||||
|    glVertex2f(-1, -1); | ||||
|    glColor3f(0, 1, 0); | ||||
|    glVertex2f(1, -1); | ||||
|    glColor3f(0, 0, 1); | ||||
|    glVertex2f(0, 1); | ||||
|    glEnd(); | ||||
| #else | ||||
|    glEnable(GL_LIGHTING); | ||||
|    glEnable(GL_LIGHT0); | ||||
|    glPushMatrix(); | ||||
|    glRotatef(0.5 * Rot, 1.0, 0.0, 0.0); | ||||
|    glutSolidTeapot(0.5); | ||||
|    glPopMatrix(); | ||||
|    glDisable(GL_LIGHTING); | ||||
| #endif | ||||
|    glDisable(GL_DEPTH_TEST); | ||||
|    glDisable(GL_STENCIL_TEST); | ||||
|  | ||||
|    /* Bind normal framebuffer */ | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||||
|  | ||||
|    CheckError(__LINE__); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| static void | ||||
| Display(void) | ||||
| { | ||||
|    float ar = (float) Width / (float) Height; | ||||
|  | ||||
|    RenderTexture(); | ||||
|  | ||||
|    /* draw textured quad in the window */ | ||||
|  | ||||
|    glMatrixMode(GL_PROJECTION); | ||||
|    glLoadIdentity(); | ||||
|    glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); | ||||
|    glMatrixMode(GL_MODELVIEW); | ||||
|    glLoadIdentity(); | ||||
|    glTranslatef(0.0, 0.0, -7.0); | ||||
|  | ||||
|    glViewport(0, 0, Width, Height); | ||||
|  | ||||
|    glClearColor(0.25, 0.25, 0.25, 0); | ||||
|    glClear(GL_COLOR_BUFFER_BIT); | ||||
|  | ||||
|    glPushMatrix(); | ||||
|    glRotatef(Rot, 0, 1, 0); | ||||
|    glEnable(GL_TEXTURE_2D); | ||||
|    glBegin(GL_POLYGON); | ||||
|    glColor3f(0.25, 0.25, 0.25); | ||||
|    glTexCoord2f(0, 0); | ||||
|    glVertex2f(-1, -1); | ||||
|    glTexCoord2f(1, 0); | ||||
|    glVertex2f(1, -1); | ||||
|    glColor3f(1.0, 1.0, 1.0); | ||||
|    glTexCoord2f(1, 1); | ||||
|    glVertex2f(1, 1); | ||||
|    glTexCoord2f(0, 1); | ||||
|    glVertex2f(-1, 1); | ||||
|    glEnd(); | ||||
|    glPopMatrix(); | ||||
|    glDisable(GL_TEXTURE_2D); | ||||
|     | ||||
|    glutSwapBuffers(); | ||||
|    CheckError(__LINE__); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Reshape(int width, int height) | ||||
| { | ||||
|    glViewport(0, 0, width, height); | ||||
|    Width = width; | ||||
|    Height = height; | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Key(unsigned char key, int x, int y) | ||||
| { | ||||
|    (void) x; | ||||
|    (void) y; | ||||
|    switch (key) { | ||||
|       case 'a': | ||||
|          Anim = !Anim; | ||||
|          if (Anim) | ||||
|             glutIdleFunc(Idle); | ||||
|          else | ||||
|             glutIdleFunc(NULL); | ||||
|          break; | ||||
|       case 27: | ||||
|          exit(0); | ||||
|          break; | ||||
|    } | ||||
|    glutPostRedisplay(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static void | ||||
| Init(void) | ||||
| { | ||||
|    GLint i; | ||||
|  | ||||
|    if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { | ||||
|       printf("GL_EXT_framebuffer_object not found!\n"); | ||||
|       exit(0); | ||||
|    } | ||||
|    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | ||||
|  | ||||
|    /* make framebuffer */ | ||||
|    glGenFramebuffersEXT(1, &MyFB); | ||||
|    assert(MyFB); | ||||
|    assert(glIsFramebufferEXT(MyFB)); | ||||
|    glDeleteFramebuffersEXT(1, &MyFB); | ||||
|    assert(!glIsFramebufferEXT(MyFB)); | ||||
|    /* Note, continue to use MyFB below */ | ||||
|  | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); | ||||
|    assert(glIsFramebufferEXT(MyFB)); | ||||
|    glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i); | ||||
|    assert(i == MyFB); | ||||
|  | ||||
|    /* make depth renderbuffer */ | ||||
|    glGenRenderbuffersEXT(1, &DepthRB); | ||||
|    assert(DepthRB); | ||||
|    assert(glIsRenderbufferEXT(DepthRB)); | ||||
|    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB); | ||||
|    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, | ||||
|                             TexWidth, TexHeight); | ||||
|  | ||||
|    /* make stencil renderbuffer */ | ||||
|    glGenRenderbuffersEXT(1, &StencilRB); | ||||
|    assert(StencilRB); | ||||
|    assert(glIsRenderbufferEXT(StencilRB)); | ||||
|    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB); | ||||
|    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX, | ||||
|                             TexWidth, TexHeight); | ||||
|  | ||||
|    /* attach DepthRB to MyFB */ | ||||
|    glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, | ||||
|                                 GL_RENDERBUFFER_EXT, DepthRB); | ||||
|  | ||||
|    /* attach StencilRB to MyFB */ | ||||
|    glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, | ||||
|                                 GL_RENDERBUFFER_EXT, StencilRB); | ||||
|  | ||||
|  | ||||
|    /* bind regular framebuffer */ | ||||
|    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||||
|  | ||||
|    /* Make texture object/image */ | ||||
|    glGenTextures(1, &TexObj); | ||||
|    glBindTexture(GL_TEXTURE_2D, TexObj); | ||||
|    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0, | ||||
|                 GL_RGBA, GL_UNSIGNED_BYTE, NULL); | ||||
|    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | ||||
|    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | ||||
|    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | ||||
|  | ||||
|    CheckError(__LINE__); | ||||
| } | ||||
|  | ||||
|  | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
|    glutInit(&argc, argv); | ||||
|    glutInitWindowPosition(0, 0); | ||||
|    glutInitWindowSize(Width, Height); | ||||
|    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); | ||||
|    glutCreateWindow(argv[0]); | ||||
|    glutReshapeFunc(Reshape); | ||||
|    glutKeyboardFunc(Key); | ||||
|    glutDisplayFunc(Display); | ||||
|    if (Anim) | ||||
|       glutIdleFunc(Idle); | ||||
|    Init(); | ||||
|    glutMainLoop(); | ||||
|    return 0; | ||||
| } | ||||
| @@ -288,6 +288,7 @@ check_functions( const char *extensions ) | ||||
|  | ||||
|    for (entry = functions; entry->name; entry++) { | ||||
|       if (entry->name[0] == '-') { | ||||
|          /* XXX update for OpenGL 2.0 */ | ||||
|          if (entry->name[1] == '1') { | ||||
|             /* check GL version X.Y */ | ||||
|             const char *version = (const char *) glGetString(GL_VERSION); | ||||
|   | ||||
| @@ -56,6 +56,9 @@ PFNGLWINDOWPOS2IPROC win_pos_2i = NULL; | ||||
|  | ||||
| static void Display( void ) | ||||
| { | ||||
|    GLint err; | ||||
|  | ||||
|  | ||||
|    glClearColor(0.2, 0.2, 0.8, 0); | ||||
|    glClear( GL_COLOR_BUFFER_BIT ); | ||||
|  | ||||
| @@ -67,11 +70,23 @@ static void Display( void ) | ||||
|    glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, image ); | ||||
|  | ||||
|    glPixelStorei( GL_PACK_INVERT_MESA, GL_FALSE ); | ||||
|    err = glGetError(); | ||||
|    if ( err != GL_NO_ERROR ) { | ||||
|       printf( "Setting PACK_INVERT_MESA to false generated an error (0x%04x).\n", | ||||
| 	      err ); | ||||
|    } | ||||
|  | ||||
|    glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); | ||||
|    (*win_pos_2i)( 5 + 1 * (10 + img_width), 5 ); | ||||
|    glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); | ||||
|  | ||||
|    glPixelStorei( GL_PACK_INVERT_MESA, GL_TRUE ); | ||||
|    err = glGetError(); | ||||
|    if ( err != GL_NO_ERROR ) { | ||||
|       printf( "Setting PACK_INVERT_MESA to true generated an error (0x%04x).\n", | ||||
| 	      err ); | ||||
|    } | ||||
|  | ||||
|    glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); | ||||
|    (*win_pos_2i)( 5 + 2 * (10 + img_width), 5 ); | ||||
|    glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image ); | ||||
|   | ||||
| @@ -11,6 +11,7 @@ LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME) | ||||
| PROGS = glthreads \ | ||||
| 	glxdemo \ | ||||
| 	glxgears \ | ||||
| 	glxgears_fbconfig \ | ||||
| 	glxcontexts \ | ||||
| 	glxheads \ | ||||
| 	glxinfo \ | ||||
| @@ -64,6 +65,11 @@ pbdemo.o: pbdemo.c pbutil.h | ||||
| pbutil.o: pbutil.c pbutil.h | ||||
| 	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbutil.c | ||||
|  | ||||
| glxgears_fbconfig: glxgears_fbconfig.o pbutil.o | ||||
| 	$(CC) glxgears_fbconfig.o pbutil.o $(APP_LIB_DEPS) -o $@ | ||||
|  | ||||
| glxgears_fbconfig.o: glxgears_fbconfig.c pbutil.h | ||||
| 	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) glxgears_fbconfig.c | ||||
|  | ||||
| xrotfontdemo: xrotfontdemo.o xuserotfont.o | ||||
| 	$(CC) xrotfontdemo.o xuserotfont.o $(APP_LIB_DEPS) -o $@ | ||||
|   | ||||
| @@ -32,6 +32,8 @@ | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #define GLX_GLXEXT_PROTOTYPES | ||||
|  | ||||
| #include <math.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| @@ -44,7 +46,7 @@ | ||||
| #include <assert.h> | ||||
| #include "pbutil.h" | ||||
|  | ||||
| /* I had to the the SGIX versions of these because for some reason glxext.h | ||||
| /* I had to use the SGIX versions of these because for some reason glxext.h | ||||
|  * doesn't define the core versions if GLX_VERSION_1_3 is defined, and glx.h | ||||
|  * doesn't define them at all.  One or both header files is clearly broken. | ||||
|  */ | ||||
| @@ -358,19 +360,19 @@ init_fbconfig_functions(Display *dpy, int scrnum) | ||||
|  | ||||
|    if ( glx_1_3_supported ) { | ||||
|       choose_fbconfig = (PFNGLXCHOOSEFBCONFIGSGIXPROC) glXGetProcAddressARB(  | ||||
| 		(GLbyte *) "glXChooseFBConfig"); | ||||
| 		(GLubyte *) "glXChooseFBConfig"); | ||||
|       get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) glXGetProcAddressARB(  | ||||
| 		(GLbyte *) "glXGetVisualFromFBConfig"); | ||||
| 		(GLubyte *) "glXGetVisualFromFBConfig"); | ||||
|       create_new_context = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) glXGetProcAddressARB( | ||||
| 		(GLbyte *) "glXCreateNewContext"); | ||||
| 		(GLubyte *) "glXCreateNewContext"); | ||||
|    } | ||||
|    else if ( ext_version_supported ) { | ||||
|       choose_fbconfig = (PFNGLXCHOOSEFBCONFIGSGIXPROC) glXGetProcAddressARB(  | ||||
| 		(GLbyte *) "glXChooseFBConfigSGIX"); | ||||
| 		(GLubyte *) "glXChooseFBConfigSGIX"); | ||||
|       get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) glXGetProcAddressARB(  | ||||
| 		(GLbyte *) "glXGetVisualFromFBConfigSGIX"); | ||||
| 		(GLubyte *) "glXGetVisualFromFBConfigSGIX"); | ||||
|       create_new_context = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) glXGetProcAddressARB( | ||||
| 		(GLbyte *) "glXCreateContextWithConfigSGIX"); | ||||
| 		(GLubyte *) "glXCreateContextWithConfigSGIX"); | ||||
|    } | ||||
|    else { | ||||
|       printf( "This demo requires either GLX 1.3 or %s be supported.\n", | ||||
| @@ -436,7 +438,7 @@ make_window( Display *dpy, const char *name, | ||||
|    printf("\nThe following fbconfigs meet the requirements.  The first one " | ||||
| 	  "will be used.\n\n"); | ||||
|    for ( i = 0 ; i < num_configs ; i++ ) { | ||||
|       PrintFBConfigInfo(dpy, fbconfig[i], GL_TRUE); | ||||
|       PrintFBConfigInfo(dpy, scrnum, fbconfig[i], GL_TRUE); | ||||
|    } | ||||
|  | ||||
|    /* window attributes */ | ||||
| @@ -557,7 +559,7 @@ main(int argc, char *argv[]) | ||||
|    Display *dpy; | ||||
|    Window win; | ||||
|    GLXContext ctx; | ||||
|    char *dpyName = ":0"; | ||||
|    const char *dpyName = NULL; | ||||
|    GLboolean printInfo = GL_FALSE; | ||||
|    int i; | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,6 @@ | ||||
|  * to the GLX_SGIX_fbconfig/pbuffer extensions. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include "pbutil.h" | ||||
| @@ -89,13 +88,10 @@ GetAllFBConfigs(Display *dpy, int screen, int *nConfigs) | ||||
| #endif | ||||
| #if defined(GLX_SGIX_fbconfig) && defined(GLX_SGIX_pbuffer) | ||||
|    if (pbSupport == 2) { | ||||
|       /* this *seems* to work, but may not be perfect */ | ||||
|       static int fbAttribs[] = { | ||||
|          GLX_RENDER_TYPE, 0, | ||||
|          GLX_DRAWABLE_TYPE, 0, | ||||
|          None | ||||
|       }; | ||||
|       return glXChooseFBConfigSGIX(dpy, screen, fbAttribs, nConfigs); | ||||
|       /* The GLX_SGIX_fbconfig extensions says to pass NULL to get list | ||||
|        * of all available configurations. | ||||
|        */ | ||||
|       return glXChooseFBConfigSGIX(dpy, screen, NULL, nConfigs); | ||||
|    } | ||||
| #endif | ||||
|    return NULL; | ||||
| @@ -296,6 +292,43 @@ PrintFBConfigInfo(Display *dpy, int screen, FBCONFIG config, Bool horizFormat) | ||||
|  | ||||
|  | ||||
|  | ||||
| GLXContext | ||||
| CreateContext(Display *dpy, int screen, FBCONFIG config) | ||||
| { | ||||
|    int pbSupport = QueryPbuffers(dpy, screen); | ||||
| #if defined(GLX_VERSION_1_3) | ||||
|    if (pbSupport == 1) { | ||||
|       /* GLX 1.3 */ | ||||
|       GLXContext c; | ||||
|       c = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, True); | ||||
|       if (!c) { | ||||
|          /* try indirect */ | ||||
|          c = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, False); | ||||
|       } | ||||
|       return c; | ||||
|    } | ||||
| #endif | ||||
| #if defined(GLX_SGIX_fbconfig) && defined(GLX_SGIX_pbuffer) | ||||
|    if (pbSupport == 2) { | ||||
|       GLXContext c; | ||||
|       c = glXCreateContextWithConfigSGIX(dpy, config, GLX_RGBA_TYPE_SGIX, NULL, True); | ||||
|       if (!c) { | ||||
|          c = glXCreateContextWithConfigSGIX(dpy, config, GLX_RGBA_TYPE_SGIX, NULL, False); | ||||
|       } | ||||
|       return c; | ||||
|    } | ||||
| #endif | ||||
|    return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| DestroyContext(Display *dpy, GLXContext ctx) | ||||
| { | ||||
|    glXDestroyContext(dpy, ctx); | ||||
| } | ||||
|  | ||||
|  | ||||
| /* This is only used by CreatePbuffer() */ | ||||
| static int XErrorFlag = 0; | ||||
| static int HandleXError(Display *dpy, XErrorEvent *event) | ||||
|   | ||||
| @@ -46,6 +46,14 @@ extern XVisualInfo * | ||||
| GetVisualFromFBConfig(Display *dpy, int screen, FBCONFIG config); | ||||
|  | ||||
|  | ||||
| extern GLXContext | ||||
| CreateContext(Display *dpy, int screen, FBCONFIG config); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| DestroyContext(Display *dpy, GLXContext ctx); | ||||
|  | ||||
|  | ||||
| extern PBUFFER | ||||
| CreatePbuffer(Display *dpy, int screen, FBCONFIG config, | ||||
| 	      int width, int height, Bool preserve, Bool largest); | ||||
|   | ||||
							
								
								
									
										24
									
								
								src/egl/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/egl/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| # src/egl/Makefile | ||||
|  | ||||
| TOP = ../.. | ||||
|  | ||||
| SUBDIRS = main drivers/demo | ||||
|  | ||||
|  | ||||
| default: subdirs | ||||
|  | ||||
|  | ||||
| subdirs: | ||||
| 	@for dir in $(SUBDIRS) ; do \ | ||||
| 		if [ -d $$dir ] ; then \ | ||||
| 			(cd $$dir ; $(MAKE)) || exit 1 ; \ | ||||
| 		fi \ | ||||
| 	done | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	@for dir in $(SUBDIRS) ; do \ | ||||
| 		if [ -d $$dir ] ; then \ | ||||
| 			(cd $$dir ; $(MAKE) clean) ; \ | ||||
| 		fi \ | ||||
| 	done | ||||
							
								
								
									
										31
									
								
								src/egl/drivers/demo/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/egl/drivers/demo/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| # src/egl/drivers/demo/Makefile | ||||
|  | ||||
| TOP = ../../../.. | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
|  | ||||
| INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main | ||||
|  | ||||
|  | ||||
| SOURCES = demo.c | ||||
|  | ||||
| OBJECTS = $(SOURCES:.c=.o) | ||||
|  | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ | ||||
|  | ||||
|  | ||||
|  | ||||
| default: $(LIB_DIR)/demodriver.so | ||||
|  | ||||
|  | ||||
| $(LIB_DIR)/demodriver.so: $(OBJECTS) | ||||
| 	$(TOP)/bin/mklib -o demodriver.so -noprefix \ | ||||
| 		-install $(LIB_DIR) $(OBJECTS) | ||||
|  | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	rm -f *.o | ||||
| 	rm -f *.so | ||||
							
								
								
									
										328
									
								
								src/egl/drivers/demo/demo.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										328
									
								
								src/egl/drivers/demo/demo.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,328 @@ | ||||
| /* | ||||
|  * Sample driver: Demo | ||||
|  */ | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include "eglconfig.h" | ||||
| #include "eglcontext.h" | ||||
| #include "egldisplay.h" | ||||
| #include "egldriver.h" | ||||
| #include "eglglobals.h" | ||||
| #include "eglmode.h" | ||||
| #include "eglscreen.h" | ||||
| #include "eglsurface.h" | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Demo driver-specific driver class derived from _EGLDriver | ||||
|  */ | ||||
| typedef struct demo_driver | ||||
| { | ||||
|    _EGLDriver Base;  /* base class/object */ | ||||
|    GLuint DemoStuff; | ||||
| } DemoDriver; | ||||
|  | ||||
| #define DEMO_DRIVER(D) ((DemoDriver *) (D)) | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Demo driver-specific surface class derived from _EGLSurface | ||||
|  */ | ||||
| typedef struct demo_surface | ||||
| { | ||||
|    _EGLSurface Base;  /* base class/object */ | ||||
|    GLuint DemoStuff; | ||||
| } DemoSurface; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Demo driver-specific context class derived from _EGLContext | ||||
|  */ | ||||
| typedef struct demo_context | ||||
| { | ||||
|    _EGLContext Base;  /* base class/object */ | ||||
|    GLuint DemoStuff; | ||||
| } DemoContext; | ||||
|  | ||||
|  | ||||
|  | ||||
| static EGLBoolean | ||||
| demoInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor) | ||||
| { | ||||
|    _EGLDisplay *disp = _eglLookupDisplay(dpy); | ||||
|    _EGLScreen *scrn; | ||||
|    EGLint i; | ||||
|  | ||||
|    /* Create a screen */ | ||||
|    scrn = calloc(1, sizeof(*scrn)); | ||||
|    _eglAddScreen(disp, scrn); | ||||
|  | ||||
|    /* Create the screen's modes - silly example */ | ||||
|    _eglAddMode(scrn, 1600, 1200, 72 * 1000, "1600x1200-72"); | ||||
|    _eglAddMode(scrn, 1280, 1024, 72 * 1000, "1280x1024-70"); | ||||
|    _eglAddMode(scrn, 1280, 1024, 70 * 1000, "1280x1024-70"); | ||||
|    _eglAddMode(scrn, 1024,  768, 72 * 1000, "1024x768-72"); | ||||
|  | ||||
|    /* Create the display's visual configs - silly example */ | ||||
|    for (i = 0; i < 4; i++) { | ||||
|       _EGLConfig config; | ||||
|       _eglInitConfig(&config, i + 1); | ||||
|       _eglSetConfigAttrib(&config, EGL_RED_SIZE, 8); | ||||
|       _eglSetConfigAttrib(&config, EGL_GREEN_SIZE, 8); | ||||
|       _eglSetConfigAttrib(&config, EGL_BLUE_SIZE, 8); | ||||
|       _eglSetConfigAttrib(&config, EGL_ALPHA_SIZE, 8); | ||||
|       _eglSetConfigAttrib(&config, EGL_BUFFER_SIZE, 32); | ||||
|       if (i & 1) { | ||||
|          _eglSetConfigAttrib(&config, EGL_DEPTH_SIZE, 32); | ||||
|       } | ||||
|       if (i & 2) { | ||||
|          _eglSetConfigAttrib(&config, EGL_STENCIL_SIZE, 8); | ||||
|       } | ||||
|       _eglSetConfigAttrib(&config, EGL_SURFACE_TYPE, | ||||
|                           (EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT)); | ||||
|       _eglAddConfig(disp, &config); | ||||
|    } | ||||
|  | ||||
|    drv->Initialized = EGL_TRUE; | ||||
|  | ||||
|    *major = 1; | ||||
|    *minor = 0; | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| static EGLBoolean | ||||
| demoTerminate(_EGLDriver *drv, EGLDisplay dpy) | ||||
| { | ||||
|    /*DemoDriver *demo = DEMO_DRIVER(dpy);*/ | ||||
|    free(drv); | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| static DemoContext * | ||||
| LookupDemoContext(EGLContext ctx) | ||||
| { | ||||
|    _EGLContext *c = _eglLookupContext(ctx); | ||||
|    return (DemoContext *) c; | ||||
| } | ||||
|  | ||||
|  | ||||
| static DemoSurface * | ||||
| LookupDemoSurface(EGLSurface surf) | ||||
| { | ||||
|    _EGLSurface *s = _eglLookupSurface(surf); | ||||
|    return (DemoSurface *) s; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| static EGLContext | ||||
| demoCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLConfig *conf; | ||||
|    DemoContext *c; | ||||
|    _EGLDisplay *disp = _eglLookupDisplay(dpy); | ||||
|    int i; | ||||
|  | ||||
|    conf = _eglLookupConfig(drv, dpy, config); | ||||
|    if (!conf) { | ||||
|       _eglError(EGL_BAD_CONFIG, "eglCreateContext"); | ||||
|       return EGL_NO_CONTEXT; | ||||
|    } | ||||
|  | ||||
|    for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { | ||||
|       switch (attrib_list[i]) { | ||||
|          /* no attribs defined for now */ | ||||
|       default: | ||||
|          _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext"); | ||||
|          return EGL_NO_CONTEXT; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    c = (DemoContext *) calloc(1, sizeof(DemoContext)); | ||||
|    if (!c) | ||||
|       return EGL_NO_CONTEXT; | ||||
|  | ||||
|    _eglInitContext(&c->Base); | ||||
|    c->Base.Display = disp; | ||||
|    c->Base.Config = conf; | ||||
|    c->Base.DrawSurface = EGL_NO_SURFACE; | ||||
|    c->Base.ReadSurface = EGL_NO_SURFACE; | ||||
|    c->DemoStuff = 1; | ||||
|    printf("demoCreateContext\n"); | ||||
|  | ||||
|    /* generate handle and insert into hash table */ | ||||
|    _eglSaveContext(&c->Base); | ||||
|    assert(c->Base.Handle); | ||||
|  | ||||
|    return c->Base.Handle; | ||||
| } | ||||
|  | ||||
|  | ||||
| static EGLSurface | ||||
| demoCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list) | ||||
| { | ||||
|    int i; | ||||
|    for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { | ||||
|       switch (attrib_list[i]) { | ||||
|          /* no attribs at this time */ | ||||
|       default: | ||||
|          _eglError(EGL_BAD_ATTRIBUTE, "eglCreateWindowSurface"); | ||||
|          return EGL_NO_SURFACE; | ||||
|       } | ||||
|    } | ||||
|    printf("eglCreateWindowSurface()\n"); | ||||
|    /* XXX unfinished */ | ||||
|  | ||||
|    return EGL_NO_SURFACE; | ||||
| } | ||||
|  | ||||
|  | ||||
| static EGLSurface | ||||
| demoCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLConfig *conf; | ||||
|    EGLint i; | ||||
|  | ||||
|    conf = _eglLookupConfig(drv, dpy, config); | ||||
|    if (!conf) { | ||||
|       _eglError(EGL_BAD_CONFIG, "eglCreatePixmapSurface"); | ||||
|       return EGL_NO_SURFACE; | ||||
|    } | ||||
|  | ||||
|    for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { | ||||
|       switch (attrib_list[i]) { | ||||
|          /* no attribs at this time */ | ||||
|       default: | ||||
|          _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface"); | ||||
|          return EGL_NO_SURFACE; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    if (conf->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] == 0) { | ||||
|       _eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface"); | ||||
|       return EGL_NO_SURFACE; | ||||
|    } | ||||
|  | ||||
|    printf("eglCreatePixmapSurface()\n"); | ||||
|    return EGL_NO_SURFACE; | ||||
| } | ||||
|  | ||||
|  | ||||
| static EGLSurface | ||||
| demoCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, | ||||
|                          const EGLint *attrib_list) | ||||
| { | ||||
|    DemoSurface *surf = (DemoSurface *) calloc(1, sizeof(DemoSurface)); | ||||
|    if (!surf) | ||||
|       return EGL_NO_SURFACE; | ||||
|  | ||||
|    if (_eglInitPbufferSurface(&surf->Base, drv, dpy, config, attrib_list) | ||||
|        == EGL_NO_SURFACE) { | ||||
|       free(surf); | ||||
|       return EGL_NO_SURFACE; | ||||
|    } | ||||
|  | ||||
|    /* a real driver would allocate the pbuffer memory here */ | ||||
|  | ||||
|    return surf->Base.Handle; | ||||
| } | ||||
|  | ||||
|  | ||||
| static EGLBoolean | ||||
| demoDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) | ||||
| { | ||||
|    DemoSurface *fs = LookupDemoSurface(surface); | ||||
|    _eglRemoveSurface(&fs->Base); | ||||
|    if (fs->Base.IsBound) { | ||||
|       fs->Base.DeletePending = EGL_TRUE; | ||||
|    } | ||||
|    else { | ||||
|       free(fs); | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| static EGLBoolean | ||||
| demoDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context) | ||||
| { | ||||
|    DemoContext *fc = LookupDemoContext(context); | ||||
|    _eglRemoveContext(&fc->Base); | ||||
|    if (fc->Base.IsBound) { | ||||
|       fc->Base.DeletePending = EGL_TRUE; | ||||
|    } | ||||
|    else { | ||||
|       free(fc); | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| static EGLBoolean | ||||
| demoMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context) | ||||
| { | ||||
|    /*DemoDriver *demo = DEMO_DRIVER(dpy);*/ | ||||
|    DemoSurface *readSurf = LookupDemoSurface(read); | ||||
|    DemoSurface *drawSurf = LookupDemoSurface(draw); | ||||
|    DemoContext *ctx = LookupDemoContext(context); | ||||
|    EGLBoolean b; | ||||
|  | ||||
|    b = _eglMakeCurrent(drv, dpy, draw, read, context); | ||||
|    if (!b) | ||||
|       return EGL_FALSE; | ||||
|  | ||||
|    /* XXX this is where we'd do the hardware context switch */ | ||||
|    (void) drawSurf; | ||||
|    (void) readSurf; | ||||
|    (void) ctx; | ||||
|  | ||||
|    printf("eglMakeCurrent()\n"); | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Just to silence warning | ||||
|  */ | ||||
| extern _EGLDriver * | ||||
| _eglMain(NativeDisplayType dpy); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * The bootstrap function.  Return a new DemoDriver object and | ||||
|  * plug in API functions. | ||||
|  */ | ||||
| _EGLDriver * | ||||
| _eglMain(NativeDisplayType dpy) | ||||
| { | ||||
|    DemoDriver *demo; | ||||
|  | ||||
|    demo = (DemoDriver *) calloc(1, sizeof(DemoDriver)); | ||||
|    if (!demo) { | ||||
|       return NULL; | ||||
|    } | ||||
|  | ||||
|    /* First fill in the dispatch table with defaults */ | ||||
|    _eglInitDriverFallbacks(&demo->Base); | ||||
|    /* then plug in our Demo-specific functions */ | ||||
|    demo->Base.Initialize = demoInitialize; | ||||
|    demo->Base.Terminate = demoTerminate; | ||||
|    demo->Base.CreateContext = demoCreateContext; | ||||
|    demo->Base.MakeCurrent = demoMakeCurrent; | ||||
|    demo->Base.CreateWindowSurface = demoCreateWindowSurface; | ||||
|    demo->Base.CreatePixmapSurface = demoCreatePixmapSurface; | ||||
|    demo->Base.CreatePbufferSurface = demoCreatePbufferSurface; | ||||
|    demo->Base.DestroySurface = demoDestroySurface; | ||||
|    demo->Base.DestroyContext = demoDestroyContext; | ||||
|  | ||||
|    /* enable supported extensions */ | ||||
|    demo->Base.MESA_screen_surface = EGL_TRUE; | ||||
|    demo->Base.MESA_copy_context = EGL_TRUE; | ||||
|  | ||||
|    return &demo->Base; | ||||
| } | ||||
							
								
								
									
										64
									
								
								src/egl/main/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								src/egl/main/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | ||||
| # src/egl/main/Makefile | ||||
|  | ||||
| TOP = ../../.. | ||||
| include $(TOP)/configs/current | ||||
|  | ||||
|  | ||||
| INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi | ||||
|  | ||||
| HEADERS = \ | ||||
| 	eglconfig.h \ | ||||
| 	eglcontext.h \ | ||||
| 	egldisplay.h \ | ||||
| 	egldriver.h \ | ||||
| 	eglglobals.h \ | ||||
| 	eglhash.h \ | ||||
| 	eglmode.h \ | ||||
| 	eglscreen.h \ | ||||
| 	eglsurface.h | ||||
|  | ||||
| SOURCES = \ | ||||
| 	eglapi.c \ | ||||
| 	eglconfig.c \ | ||||
| 	eglcontext.c \ | ||||
| 	egldisplay.c \ | ||||
| 	egldriver.c \ | ||||
| 	eglglobals.c \ | ||||
| 	eglhash.c \ | ||||
| 	eglmode.c \ | ||||
| 	eglscreen.c \ | ||||
| 	eglsurface.c | ||||
|  | ||||
| OBJECTS = $(SOURCES:.c=.o) | ||||
|  | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ | ||||
|  | ||||
|  | ||||
|  | ||||
| default: depend library | ||||
|  | ||||
|  | ||||
| # EGL Library | ||||
| library: $(LIB_DIR)/libEGL.so | ||||
|  | ||||
| $(LIB_DIR)/libEGL.so: $(OBJECTS) | ||||
| 	$(TOP)/bin/mklib -o EGL -major 1 -minor 0 \ | ||||
| 		-install $(LIB_DIR) -ldl $(OBJECTS) | ||||
|  | ||||
|  | ||||
|  | ||||
| clean: | ||||
| 	rm -f *.o *.so* | ||||
| 	rm -f core.* | ||||
|  | ||||
|  | ||||
| depend: $(SOURCES) $(HEADERS) | ||||
| 	@ echo "running $(MKDEP)" | ||||
| 	@ touch depend | ||||
| 	$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \ | ||||
| 		$(SOURCES) $(HEADERS) > /dev/null  | ||||
|  | ||||
| include depend | ||||
| # DO NOT DELETE | ||||
							
								
								
									
										497
									
								
								src/egl/main/eglapi.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										497
									
								
								src/egl/main/eglapi.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,497 @@ | ||||
| /** | ||||
|  * Public EGL API entrypoints | ||||
|  * | ||||
|  * Generally, we use the EGLDisplay parameter as a key to lookup the | ||||
|  * appropriate device driver handle, then jump though the driver's | ||||
|  * dispatch table to handle the function. | ||||
|  * | ||||
|  * That allows us the option of supporting multiple, simultaneous, | ||||
|  * heterogeneous hardware devices in the future. | ||||
|  * | ||||
|  * The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are | ||||
|  * opaque handles implemented with 32-bit unsigned integers. | ||||
|  * It's up to the driver function or fallback function to look up the | ||||
|  * handle and get an object. | ||||
|  * By using opaque handles, we leave open the possibility of having | ||||
|  * indirect rendering in the future, like GLX. | ||||
|  * | ||||
|  * | ||||
|  * Notes on naming conventions: | ||||
|  * | ||||
|  * eglFooBar    - public EGL function | ||||
|  * EGL_FOO_BAR  - public EGL token | ||||
|  * EGLDatatype  - public EGL datatype | ||||
|  * | ||||
|  * _eglFooBar   - private EGL function | ||||
|  * _EGLDatatype - private EGL datatype, typedef'd struct | ||||
|  * _egl_struct  - private EGL struct, non-typedef'd | ||||
|  * | ||||
|  */ | ||||
|  | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| /**#include "glapi.h"**/ | ||||
| #include "eglcontext.h" | ||||
| #include "egldisplay.h" | ||||
| #include "egltypedefs.h" | ||||
| #include "eglglobals.h" | ||||
| #include "egldriver.h" | ||||
| #include "eglsurface.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * NOTE: displayName is treated as a string in _eglChooseDriver()!!! | ||||
|  * This will probably change! | ||||
|  * See _eglChooseDriver() for details! | ||||
|  */ | ||||
| EGLDisplay APIENTRY | ||||
| eglGetDisplay(NativeDisplayType displayName) | ||||
| { | ||||
|    _EGLDisplay *dpy; | ||||
|    _eglInitGlobals(); | ||||
|    dpy = _eglNewDisplay(displayName); | ||||
|    if (dpy) | ||||
|       return dpy->Handle; | ||||
|    else | ||||
|       return EGL_NO_DISPLAY; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) | ||||
| { | ||||
|    if (dpy) { | ||||
|       _EGLDriver *drv = _eglChooseDriver(dpy); | ||||
|       if (drv) | ||||
|          return drv->Initialize(drv, dpy, major, minor); | ||||
|    } | ||||
|    return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglTerminate(EGLDisplay dpy) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    if (drv) | ||||
|       return _eglCloseDriver(drv, dpy); | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| const char * APIENTRY | ||||
| eglQueryString(EGLDisplay dpy, EGLint name) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    if (drv) | ||||
|       return drv->QueryString(drv, dpy, name); | ||||
|    else | ||||
|       return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    /* XXX check drv for null in remaining functions */ | ||||
|    return drv->GetConfigs(drv, dpy, configs, config_size, num_config); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->ChooseConfig(drv, dpy, attrib_list, configs, config_size, num_config); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->GetConfigAttrib(drv, dpy, config, attribute, value); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLContext APIENTRY | ||||
| eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->CreateContext(drv, dpy, config, share_list, attrib_list); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglDestroyContext(EGLDisplay dpy, EGLContext ctx) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->DestroyContext(drv, dpy, ctx); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->MakeCurrent(drv, dpy, draw, read, ctx); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->QueryContext(drv, dpy, ctx, attribute, value); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLSurface APIENTRY | ||||
| eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->CreateWindowSurface(drv, dpy, config, window, attrib_list); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLSurface APIENTRY | ||||
| eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->CreatePixmapSurface(drv, dpy, config, pixmap, attrib_list); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLSurface APIENTRY | ||||
| eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->CreatePbufferSurface(drv, dpy, config, attrib_list); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglDestroySurface(EGLDisplay dpy, EGLSurface surface) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->DestroySurface(drv, dpy, surface); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->QuerySurface(drv, dpy, surface, attribute, value); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->SurfaceAttrib(drv, dpy, surface, attribute, value); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->BindTexImage(drv, dpy, surface, buffer); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->ReleaseTexImage(drv, dpy, surface, buffer); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglSwapInterval(EGLDisplay dpy, EGLint interval) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->SwapInterval(drv, dpy, interval); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->SwapBuffers(drv, dpy, draw); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->CopyBuffers(drv, dpy, surface, target); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglWaitGL(void) | ||||
| { | ||||
|    EGLDisplay dpy = eglGetCurrentDisplay(); | ||||
|    if (dpy != EGL_NO_DISPLAY) { | ||||
|       _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|       return drv->WaitGL(drv, dpy); | ||||
|    } | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglWaitNative(EGLint engine) | ||||
| { | ||||
|    EGLDisplay dpy = eglGetCurrentDisplay(); | ||||
|    if (dpy != EGL_NO_DISPLAY) { | ||||
|       _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|       return drv->WaitNative(drv, dpy, engine); | ||||
|    } | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLDisplay APIENTRY | ||||
| eglGetCurrentDisplay(void) | ||||
| { | ||||
|    _EGLDisplay *dpy = _eglGetCurrentDisplay(); | ||||
|    if (dpy) | ||||
|       return dpy->Handle; | ||||
|    else | ||||
|       return EGL_NO_DISPLAY; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLContext APIENTRY | ||||
| eglGetCurrentContext(void) | ||||
| { | ||||
|    _EGLContext *ctx = _eglGetCurrentContext(); | ||||
|    if (ctx) | ||||
|       return ctx->Handle; | ||||
|    else | ||||
|       return EGL_NO_CONTEXT; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLSurface APIENTRY | ||||
| eglGetCurrentSurface(EGLint readdraw) | ||||
| { | ||||
|    _EGLSurface *s = _eglGetCurrentSurface(readdraw); | ||||
|    if (s) | ||||
|       return s->Handle; | ||||
|    else | ||||
|       return EGL_NO_SURFACE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLint APIENTRY | ||||
| eglGetError(void) | ||||
| { | ||||
|    EGLint e = _eglGlobal.LastError; | ||||
|    _eglGlobal.LastError = EGL_SUCCESS; | ||||
|    return e; | ||||
| } | ||||
|  | ||||
|  | ||||
| void (* APIENTRY eglGetProcAddress(const char *procname))() | ||||
| { | ||||
|    typedef void (*genericFunc)(); | ||||
|    struct name_function { | ||||
|       const char *name; | ||||
|       _EGLProc function; | ||||
|    }; | ||||
|    static struct name_function egl_functions[] = { | ||||
|       /* alphabetical order */ | ||||
|       { "eglBindTexImage", (_EGLProc) eglBindTexImage }, | ||||
|       { "eglChooseConfig", (_EGLProc) eglChooseConfig }, | ||||
|       { "eglCopyBuffers", (_EGLProc) eglCopyBuffers }, | ||||
|       { "eglCreateContext", (_EGLProc) eglCreateContext }, | ||||
|       { "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface }, | ||||
|       { "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface }, | ||||
|       { "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface }, | ||||
|       { "eglDestroyContext", (_EGLProc) eglDestroyContext }, | ||||
|       { "eglDestroySurface", (_EGLProc) eglDestroySurface }, | ||||
|       { "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib }, | ||||
|       { "eglGetConfigs", (_EGLProc) eglGetConfigs }, | ||||
|       { "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext }, | ||||
|       { "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay }, | ||||
|       { "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface }, | ||||
|       { "eglGetDisplay", (_EGLProc) eglGetDisplay }, | ||||
|       { "eglGetError", (_EGLProc) eglGetError }, | ||||
|       { "eglGetProcAddress", (_EGLProc) eglGetProcAddress }, | ||||
|       { "eglInitialize", (_EGLProc) eglInitialize }, | ||||
|       { "eglMakeCurrent", (_EGLProc) eglMakeCurrent }, | ||||
|       { "eglQueryContext", (_EGLProc) eglQueryContext }, | ||||
|       { "eglQueryString", (_EGLProc) eglQueryString }, | ||||
|       { "eglQuerySurface", (_EGLProc) eglQuerySurface }, | ||||
|       { "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage }, | ||||
|       { "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib }, | ||||
|       { "eglSwapBuffers", (_EGLProc) eglSwapBuffers }, | ||||
|       { "eglSwapInterval", (_EGLProc) eglSwapInterval }, | ||||
|       { "eglTerminate", (_EGLProc) eglTerminate }, | ||||
|       { "eglWaitGL", (_EGLProc) eglWaitGL }, | ||||
|       { "eglWaitNative", (_EGLProc) eglWaitNative }, | ||||
|       /* Extensions */ | ||||
|       { "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA }, | ||||
|       { "eglGetModesMESA", (_EGLProc) eglGetModesMESA }, | ||||
|       { "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA }, | ||||
|       { "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA }, | ||||
|       { "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA }, | ||||
|       { "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA }, | ||||
|       { "eglShowSurfaceMESA", (_EGLProc) eglShowSurfaceMESA }, | ||||
|       { "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA }, | ||||
|       { "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA }, | ||||
|       { "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA }, | ||||
|       { "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA }, | ||||
|       { "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA }, | ||||
|       { NULL, NULL } | ||||
|    }; | ||||
|    EGLint i; | ||||
|    for (i = 0; egl_functions[i].name; i++) { | ||||
|       if (strcmp(egl_functions[i].name, procname) == 0) { | ||||
|          return (genericFunc) egl_functions[i].function; | ||||
|       } | ||||
|    } | ||||
| #if 0 | ||||
|    /* XXX enable this code someday */ | ||||
|    return (genericFunc) _glapi_get_proc_address(procname); | ||||
| #else | ||||
|    return NULL; | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * EGL_MESA_screen extension | ||||
|  */ | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                   const EGLint *attrib_list, EGLModeMESA *modes, | ||||
|                   EGLint modes_size, EGLint *num_modes) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    if (drv) | ||||
|       return drv->ChooseModeMESA(drv, dpy, screen, attrib_list, modes, modes_size, num_modes); | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    if (drv) | ||||
|       return drv->GetModesMESA(drv, dpy, screen, modes, mode_size, num_mode); | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    if (drv) | ||||
|       return drv->GetModeAttribMESA(drv, dpy, mode, attribute, value); | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean APIENTRY | ||||
| eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    if (drv) | ||||
|       return drv->CopyContextMESA(drv, dpy, source, dest, mask); | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    if (drv) | ||||
|       return drv->GetScreensMESA(drv, dpy, screens, max_screens, num_screens); | ||||
|    else | ||||
|       return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLSurface | ||||
| eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->CreateScreenSurfaceMESA(drv, dpy, config, attrib_list); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->ShowSurfaceMESA(drv, dpy, screen, surface, mode); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->ScreenPositionMESA(drv, dpy, screen, x, y); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| eglQueryScreenMESA( EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->QueryScreenMESA(drv, dpy, screen, attribute, value); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->QueryScreenSurfaceMESA(drv, dpy, screen, surface); | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->QueryScreenModeMESA(drv, dpy, screen, mode); | ||||
| } | ||||
|  | ||||
|  | ||||
| const char * | ||||
| eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) | ||||
| { | ||||
|    _EGLDriver *drv = _eglLookupDriver(dpy); | ||||
|    return drv->QueryModeStringMESA(drv, dpy, mode); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
							
								
								
									
										577
									
								
								src/egl/main/eglconfig.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										577
									
								
								src/egl/main/eglconfig.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,577 @@ | ||||
| /** | ||||
|  * EGL Configuration (pixel format) functions. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <assert.h> | ||||
| #include "eglconfig.h" | ||||
| #include "egldisplay.h" | ||||
| #include "egldriver.h" | ||||
| #include "eglglobals.h" | ||||
|  | ||||
|  | ||||
| #define MIN2(A, B)  (((A) < (B)) ? (A) : (B)) | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Convert an _EGLConfig to a __GLcontextModes object. | ||||
|  * NOTE: This routine may be incomplete - we're only making sure that | ||||
|  * the fields needed by Mesa (for _mesa_create_context/framebuffer) are | ||||
|  * set correctly. | ||||
|  */ | ||||
| void | ||||
| _eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode) | ||||
| { | ||||
|    memset(mode, 0, sizeof(*mode)); | ||||
|  | ||||
|    mode->rgbMode = GL_TRUE; /* no color index */ | ||||
|    mode->colorIndexMode = GL_FALSE; | ||||
|    mode->doubleBufferMode = GL_TRUE;  /* always DB for now */ | ||||
|    mode->stereoMode = GL_FALSE; | ||||
|  | ||||
|    mode->redBits = GET_CONFIG_ATTRIB(config, EGL_RED_SIZE); | ||||
|    mode->greenBits = GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE); | ||||
|    mode->blueBits = GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE); | ||||
|    mode->alphaBits = GET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE); | ||||
|    mode->rgbBits = GET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE); | ||||
|  | ||||
|    /* no rgba masks - fix? */ | ||||
|  | ||||
|    mode->depthBits = GET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE); | ||||
|    mode->haveDepthBuffer = mode->depthBits > 0; | ||||
|  | ||||
|    mode->stencilBits = GET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE); | ||||
|    mode->haveStencilBuffer = mode->stencilBits > 0; | ||||
|  | ||||
|    /* no accum */ | ||||
|  | ||||
|    mode->level = GET_CONFIG_ATTRIB(config, EGL_LEVEL); | ||||
|    mode->samples = GET_CONFIG_ATTRIB(config, EGL_SAMPLES); | ||||
|    mode->sampleBuffers = GET_CONFIG_ATTRIB(config, EGL_SAMPLE_BUFFERS); | ||||
|  | ||||
|    /* surface type - not really needed */ | ||||
|    mode->visualType = GLX_TRUE_COLOR; | ||||
|    mode->renderType = GLX_RGBA_BIT; | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val) | ||||
| { | ||||
|    assert(attr >= FIRST_ATTRIB); | ||||
|    assert(attr < FIRST_ATTRIB + MAX_ATTRIBS); | ||||
|    config->Attrib[attr - FIRST_ATTRIB] = val; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Init the given _EGLconfig to default values. | ||||
|  * \param id  the configuration's ID. | ||||
|  */ | ||||
| void | ||||
| _eglInitConfig(_EGLConfig *config, EGLint id) | ||||
| { | ||||
|    memset(config, 0, sizeof(*config)); | ||||
|    config->Handle = id; | ||||
|    _eglSetConfigAttrib(config, EGL_CONFIG_ID,               id); | ||||
|    _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGB,     EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGBA,    EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_CONFIG_CAVEAT,           EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_NATIVE_RENDERABLE,       EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_NATIVE_VISUAL_TYPE,      EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_MIN_SWAP_INTERVAL,       EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_MAX_SWAP_INTERVAL,       EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_SURFACE_TYPE,             | ||||
|                    EGL_SCREEN_BIT_MESA | EGL_PBUFFER_BIT | | ||||
|                    EGL_PIXMAP_BIT | EGL_WINDOW_BIT); | ||||
|    _eglSetConfigAttrib(config, EGL_TRANSPARENT_TYPE,        EGL_NONE); | ||||
|    _eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE,   EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE); | ||||
|    _eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE,  EGL_DONT_CARE); | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Given an EGLConfig handle, return the corresponding _EGLConfig object. | ||||
|  */ | ||||
| _EGLConfig * | ||||
| _eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config) | ||||
| { | ||||
|    EGLint i; | ||||
|    _EGLDisplay *disp = _eglLookupDisplay(dpy); | ||||
|    for (i = 0; i < disp->NumConfigs; i++) { | ||||
|       if (disp->Configs[i].Handle == config) { | ||||
|           return disp->Configs + i; | ||||
|       } | ||||
|    } | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Add the given _EGLConifg to the given display. | ||||
|  */ | ||||
| _EGLConfig * | ||||
| _eglAddConfig(_EGLDisplay *display, const _EGLConfig *config) | ||||
| { | ||||
|    _EGLConfig *newConfigs; | ||||
|    EGLint n; | ||||
|  | ||||
|    n = display->NumConfigs; | ||||
|  | ||||
|    newConfigs = (_EGLConfig *) realloc(display->Configs, | ||||
|                                        (n + 1) * sizeof(_EGLConfig)); | ||||
|    if (newConfigs) { | ||||
|       display->Configs = newConfigs; | ||||
|       display->Configs[n] = *config; /* copy struct */ | ||||
|       display->Configs[n].Handle = n; | ||||
|       display->NumConfigs++; | ||||
|       return display->Configs + n; | ||||
|    } | ||||
|    else { | ||||
|       return NULL; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Parse the attrib_list to fill in the fields of the given _egl_config | ||||
|  * Return EGL_FALSE if any errors, EGL_TRUE otherwise. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list) | ||||
| { | ||||
|    EGLint i; | ||||
|  | ||||
|    /* XXX set all config attribs to EGL_DONT_CARE */ | ||||
|  | ||||
|    for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { | ||||
|       EGLint k = attrib_list[i] - FIRST_ATTRIB; | ||||
|       if (k >= 0 && k < MAX_ATTRIBS) { | ||||
|          config->Attrib[k] = attrib_list[++i]; | ||||
|       } | ||||
|       else { | ||||
|          _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| #define EXACT 1 | ||||
| #define ATLEAST 2 | ||||
| #define MASK 3 | ||||
| #define SMALLER 4 | ||||
| #define SPECIAL 5 | ||||
| #define NONE 6 | ||||
|  | ||||
| struct sort_info { | ||||
|    EGLint Attribute; | ||||
|    EGLint MatchCriteria; | ||||
|    EGLint SortOrder; | ||||
| }; | ||||
|  | ||||
| /* This encodes the info from Table 3.5 of the EGL spec, ordered by | ||||
|  * Sort Priority. | ||||
|  */ | ||||
| static struct sort_info SortInfo[] = { | ||||
|    { EGL_CONFIG_CAVEAT,           EXACT,   SPECIAL }, | ||||
|    { EGL_RED_SIZE,                ATLEAST, SPECIAL }, | ||||
|    { EGL_GREEN_SIZE,              ATLEAST, SPECIAL }, | ||||
|    { EGL_BLUE_SIZE,               ATLEAST, SPECIAL }, | ||||
|    { EGL_ALPHA_SIZE,              ATLEAST, SPECIAL }, | ||||
|    { EGL_BUFFER_SIZE,             ATLEAST, SMALLER }, | ||||
|    { EGL_SAMPLE_BUFFERS,          ATLEAST, SMALLER }, | ||||
|    { EGL_SAMPLES,                 ATLEAST, SMALLER }, | ||||
|    { EGL_DEPTH_SIZE,              ATLEAST, SMALLER }, | ||||
|    { EGL_STENCIL_SIZE,            ATLEAST, SMALLER }, | ||||
|    { EGL_NATIVE_VISUAL_TYPE,      EXACT,   SPECIAL }, | ||||
|    { EGL_CONFIG_ID,               EXACT,   SMALLER }, | ||||
|    { EGL_BIND_TO_TEXTURE_RGB,     EXACT,   NONE    }, | ||||
|    { EGL_BIND_TO_TEXTURE_RGBA,    EXACT,   NONE    }, | ||||
|    { EGL_LEVEL,                   EXACT,   NONE    }, | ||||
|    { EGL_NATIVE_RENDERABLE,       EXACT,   NONE    }, | ||||
|    { EGL_MAX_SWAP_INTERVAL,       EXACT,   NONE    }, | ||||
|    { EGL_MIN_SWAP_INTERVAL,       EXACT,   NONE    }, | ||||
|    { EGL_SURFACE_TYPE,            MASK,    NONE    }, | ||||
|    { EGL_TRANSPARENT_TYPE,        EXACT,   NONE    }, | ||||
|    { EGL_TRANSPARENT_RED_VALUE,   EXACT,   NONE    }, | ||||
|    { EGL_TRANSPARENT_GREEN_VALUE, EXACT,   NONE    }, | ||||
|    { EGL_TRANSPARENT_BLUE_VALUE,  EXACT,   NONE    }, | ||||
|    { 0, 0, 0 } | ||||
| }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Return EGL_TRUE if the attributes of c meet or exceed the minimums | ||||
|  * specified by min. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglConfigQualifies(const _EGLConfig *c, const _EGLConfig *min) | ||||
| { | ||||
|    EGLint i; | ||||
|    for (i = 0; SortInfo[i].Attribute != 0; i++) { | ||||
|       const EGLint mv = GET_CONFIG_ATTRIB(min, SortInfo[i].Attribute); | ||||
|       if (mv != EGL_DONT_CARE) { | ||||
|          const EGLint cv = GET_CONFIG_ATTRIB(c, SortInfo[i].Attribute); | ||||
|          if (SortInfo[i].MatchCriteria == EXACT) { | ||||
|             if (cv != mv) { | ||||
|                return EGL_FALSE; | ||||
|             } | ||||
|          } | ||||
|          else if (SortInfo[i].MatchCriteria == ATLEAST) { | ||||
|             if (cv < mv) { | ||||
|                return EGL_FALSE; | ||||
|             } | ||||
|          } | ||||
|          else { | ||||
|             assert(SortInfo[i].MatchCriteria == MASK); | ||||
|             if ((mv & cv) != mv) { | ||||
|                return EGL_FALSE; | ||||
|             } | ||||
|          } | ||||
|       } | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Compare configs 'a' and 'b' and return -1 if a belongs before b, | ||||
|  * 1 if a belongs after b, or 0 if they're equal. | ||||
|  */ | ||||
| EGLint | ||||
| _eglCompareConfigs(const _EGLConfig *a, const _EGLConfig *b) | ||||
| { | ||||
|    EGLint i; | ||||
|    for (i = 0; SortInfo[i].Attribute != 0; i++) { | ||||
|       const EGLint av = GET_CONFIG_ATTRIB(a, SortInfo[i].Attribute); | ||||
|       const EGLint bv = GET_CONFIG_ATTRIB(b, SortInfo[i].Attribute); | ||||
|       if (SortInfo[i].SortOrder == SMALLER) { | ||||
|          if (av < bv) | ||||
|             return -1; | ||||
|          else if (av > bv) | ||||
|             return 1; | ||||
|          /* else, continue examining attribute values */ | ||||
|       } | ||||
|       else if (SortInfo[i].SortOrder == SPECIAL) { | ||||
|          if (SortInfo[i].Attribute == EGL_CONFIG_CAVEAT) { | ||||
|             /* values are EGL_NONE, SLOW_CONFIG, or NON_CONFORMANT_CONFIG */ | ||||
|             if (av < bv) | ||||
|                return -1; | ||||
|             else if (av > bv) | ||||
|                return 1; | ||||
|          } | ||||
|          else if (SortInfo[i].Attribute == EGL_RED_SIZE || | ||||
|                   SortInfo[i].Attribute == EGL_GREEN_SIZE || | ||||
|                   SortInfo[i].Attribute == EGL_BLUE_SIZE || | ||||
|                   SortInfo[i].Attribute == EGL_ALPHA_SIZE) { | ||||
|             if (av > bv) | ||||
|                return -1; | ||||
|             else if (av < bv) | ||||
|                return 1; | ||||
|          } | ||||
|          else { | ||||
|             assert(SortInfo[i].Attribute == EGL_NATIVE_VISUAL_TYPE); | ||||
|             if (av < bv) | ||||
|                return -1; | ||||
|             else if (av > bv) | ||||
|                return 1; | ||||
|          } | ||||
|       } | ||||
|       else { | ||||
|          assert(SortInfo[i].SortOrder == NONE); | ||||
|          /* continue examining attribute values */ | ||||
|       } | ||||
|    } | ||||
|    return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Typical fallback routine for eglChooseConfig | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) | ||||
| { | ||||
|    _EGLDisplay *disp = _eglLookupDisplay(dpy); | ||||
|    _EGLConfig criteria; | ||||
|    EGLint i; | ||||
|  | ||||
|    /* parse the attrib_list to initialize criteria */ | ||||
|    if (!_eglParseConfigAttribs(&criteria, attrib_list)) { | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    *num_config = 0; | ||||
|    for (i = 0; i < disp->NumConfigs; i++) { | ||||
|       const _EGLConfig *conf = disp->Configs + i; | ||||
|       if (_eglConfigQualifies(conf, &criteria)) { | ||||
|          if (*num_config < config_size) { | ||||
|             /* save */ | ||||
|             configs[*num_config] = conf->Handle; | ||||
|             (*num_config)++; | ||||
|          } | ||||
|          else { | ||||
|             break; | ||||
|          } | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    /* XXX sort the list here */ | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Fallback for eglGetConfigAttrib. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    const _EGLConfig *conf = _eglLookupConfig(drv, dpy, config); | ||||
|    const EGLint k = attribute - FIRST_ATTRIB; | ||||
|    if (k >= 0 && k < MAX_ATTRIBS) { | ||||
|       *value = conf->Attrib[k]; | ||||
|       return EGL_TRUE; | ||||
|    } | ||||
|    else { | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Fallback for eglGetConfigs. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) | ||||
| { | ||||
|    _EGLDisplay *disp = _eglLookupDisplay(dpy); | ||||
|  | ||||
|    if (!drv->Initialized) { | ||||
|       _eglError(EGL_NOT_INITIALIZED, "eglGetConfigs"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    if (configs) { | ||||
|       EGLint i; | ||||
|       *num_config = MIN2(disp->NumConfigs, config_size); | ||||
|       for (i = 0; i < *num_config; i++) { | ||||
|          configs[i] = disp->Configs[i].Handle; | ||||
|       } | ||||
|    } else | ||||
|       *num_config = disp->NumConfigs; | ||||
|        | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Creates a set of \c __GLcontextModes that a driver will expose. | ||||
|  *  | ||||
|  * A set of \c __GLcontextModes will be created based on the supplied | ||||
|  * parameters.  The number of modes processed will be 2 * | ||||
|  * \c num_depth_stencil_bits * \c num_db_modes. | ||||
|  *  | ||||
|  * For the most part, data is just copied from \c depth_bits, \c stencil_bits, | ||||
|  * \c db_modes, and \c visType into each \c __GLcontextModes element. | ||||
|  * However, the meanings of \c fb_format and \c fb_type require further | ||||
|  * explanation.  The \c fb_format specifies which color components are in | ||||
|  * each pixel and what the default order is.  For example, \c GL_RGB specifies | ||||
|  * that red, green, blue are available and red is in the "most significant" | ||||
|  * position and blue is in the "least significant".  The \c fb_type specifies | ||||
|  * the bit sizes of each component and the actual ordering.  For example, if | ||||
|  * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11] | ||||
|  * are the blue value, bits [10:5] are the green value, and bits [4:0] are | ||||
|  * the red value. | ||||
|  *  | ||||
|  * One sublte issue is the combination of \c GL_RGB  or \c GL_BGR and either | ||||
|  * of the \c GL_UNSIGNED_INT_8_8_8_8 modes.  The resulting mask values in the | ||||
|  * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or | ||||
|  * \c GL_BGRA case, except the \c alphaMask is zero.  This means that, as | ||||
|  * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8 | ||||
|  * still uses 32-bits. | ||||
|  * | ||||
|  * If in doubt, look at the tables used in the function. | ||||
|  *  | ||||
|  * \param ptr_to_modes  Pointer to a pointer to a linked list of | ||||
|  *                      \c __GLcontextModes.  Upon completion, a pointer to | ||||
|  *                      the next element to be process will be stored here. | ||||
|  *                      If the function fails and returns \c GL_FALSE, this | ||||
|  *                      value will be unmodified, but some elements in the | ||||
|  *                      linked list may be modified. | ||||
|  * \param fb_format     Format of the framebuffer.  Currently only \c GL_RGB, | ||||
|  *                      \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported. | ||||
|  * \param fb_type       Type of the pixels in the framebuffer.  Currently only | ||||
|  *                      \c GL_UNSIGNED_SHORT_5_6_5,  | ||||
|  *                      \c GL_UNSIGNED_SHORT_5_6_5_REV, | ||||
|  *                      \c GL_UNSIGNED_INT_8_8_8_8, and | ||||
|  *                      \c GL_UNSIGNED_INT_8_8_8_8_REV are supported. | ||||
|  * \param depth_bits    Array of depth buffer sizes to be exposed. | ||||
|  * \param stencil_bits  Array of stencil buffer sizes to be exposed. | ||||
|  * \param num_depth_stencil_bits  Number of entries in both \c depth_bits and | ||||
|  *                      \c stencil_bits. | ||||
|  * \param db_modes      Array of buffer swap modes.  If an element has a | ||||
|  *                      value of \c GLX_NONE, then it represents a | ||||
|  *                      single-buffered mode.  Other valid values are | ||||
|  *                      \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and | ||||
|  *                      \c GLX_SWAP_UNDEFINED_OML.  See the | ||||
|  *                      GLX_OML_swap_method extension spec for more details. | ||||
|  * \param num_db_modes  Number of entries in \c db_modes. | ||||
|  * \param visType       GLX visual type.  Usually either \c GLX_TRUE_COLOR or | ||||
|  *                      \c GLX_DIRECT_COLOR. | ||||
|  *  | ||||
|  * \returns | ||||
|  * \c GL_TRUE on success or \c GL_FALSE on failure.  Currently the only | ||||
|  * cause of failure is a bad parameter (i.e., unsupported \c fb_format or | ||||
|  * \c fb_type). | ||||
|  *  | ||||
|  * \todo | ||||
|  * There is currently no way to support packed RGB modes (i.e., modes with | ||||
|  * exactly 3 bytes per pixel) or floating-point modes.  This could probably | ||||
|  * be done by creating some new, private enums with clever names likes | ||||
|  * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32,  | ||||
|  * \c GL_4HALF_16_16_16_16, etc.  We can cross that bridge when we come to it. | ||||
|  */ | ||||
| GLboolean | ||||
| _eglFillInConfigs(_EGLConfig * configs, | ||||
|                 GLenum fb_format, GLenum fb_type, | ||||
|                 const u_int8_t * depth_bits, const u_int8_t * stencil_bits, | ||||
|                 unsigned num_depth_stencil_bits, | ||||
|                 const GLenum * db_modes, unsigned num_db_modes, | ||||
|                 int visType) { | ||||
|    static const u_int8_t bits_table[3][4] = { | ||||
|             /* R  G  B  A */ | ||||
|             { 5, 6, 5, 0 },  /* Any GL_UNSIGNED_SHORT_5_6_5 */ | ||||
|             { 8, 8, 8, 0 },  /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */ | ||||
|             { 8, 8, 8, 8 }  /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ | ||||
|          }; | ||||
|  | ||||
|    /* The following arrays are all indexed by the fb_type masked with 0x07. | ||||
|     * Given the four supported fb_type values, this results in valid array | ||||
|     * indices of 3, 4, 5, and 7. | ||||
|     */ | ||||
|    static const u_int32_t masks_table_rgb[8][4] = { | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000},  /* 5_6_5       */ | ||||
|             {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000},  /* 5_6_5_REV   */ | ||||
|             {0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000},  /* 8_8_8_8     */ | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000}  /* 8_8_8_8_REV */ | ||||
|          }; | ||||
|  | ||||
|    static const u_int32_t masks_table_rgba[8][4] = { | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000},  /* 5_6_5       */ | ||||
|             {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000},  /* 5_6_5_REV   */ | ||||
|             {0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF},  /* 8_8_8_8     */ | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000},  /* 8_8_8_8_REV */ | ||||
|          }; | ||||
|  | ||||
|    static const u_int32_t masks_table_bgr[8][4] = { | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000},  /* 5_6_5       */ | ||||
|             {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000},  /* 5_6_5_REV   */ | ||||
|             {0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000},  /* 8_8_8_8     */ | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000},  /* 8_8_8_8_REV */ | ||||
|          }; | ||||
|  | ||||
|    static const u_int32_t masks_table_bgra[8][4] = { | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000},  /* 5_6_5       */ | ||||
|             {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000},  /* 5_6_5_REV   */ | ||||
|             {0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF},  /* 8_8_8_8     */ | ||||
|             {0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||||
|             {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000},  /* 8_8_8_8_REV */ | ||||
|          }; | ||||
|  | ||||
|    static const u_int8_t bytes_per_pixel[8] = { | ||||
|             0, 0, 0, 2, 2, 4, 0, 4 | ||||
|          }; | ||||
|  | ||||
|    const u_int8_t * bits; | ||||
|    const u_int32_t * masks; | ||||
|    const int index = fb_type & 0x07; | ||||
|    _EGLConfig *config; | ||||
|    unsigned i; | ||||
|    unsigned j; | ||||
|    unsigned k; | ||||
|  | ||||
|    if ( bytes_per_pixel[index] == 0 ) { | ||||
|       fprintf(stderr, "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.\n", | ||||
|                __FUNCTION__, __LINE__, fb_type); | ||||
|       return GL_FALSE; | ||||
|    } | ||||
|  | ||||
|    /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and | ||||
|     * the _REV versions. | ||||
|     * | ||||
|     * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA. | ||||
|     */ | ||||
|    switch ( fb_format ) { | ||||
|    case GL_RGB: | ||||
|       bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1]; | ||||
|       masks = masks_table_rgb[index]; | ||||
|       break; | ||||
|  | ||||
|    case GL_RGBA: | ||||
|       bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2]; | ||||
|       masks = masks_table_rgba[index]; | ||||
|       break; | ||||
|  | ||||
|    case GL_BGR: | ||||
|       bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1]; | ||||
|       masks = masks_table_bgr[index]; | ||||
|       break; | ||||
|  | ||||
|    case GL_BGRA: | ||||
|       bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2]; | ||||
|       masks = masks_table_bgra[index]; | ||||
|       break; | ||||
|  | ||||
|    default: | ||||
|       fprintf(stderr, "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.\n", | ||||
|                __FUNCTION__, __LINE__, fb_format); | ||||
|       return GL_FALSE; | ||||
|    } | ||||
|  | ||||
|    config = configs; | ||||
|    for (k = 0; k < num_depth_stencil_bits; k++) { | ||||
|       for (i = 0; i < num_db_modes; i++)  { | ||||
|          for (j = 0; j < 2; j++) { | ||||
|             _eglSetConfigAttrib(config, EGL_RED_SIZE, bits[0]); | ||||
|             _eglSetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]); | ||||
|             _eglSetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]); | ||||
|             _eglSetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]); | ||||
|             _eglSetConfigAttrib(config, EGL_BUFFER_SIZE, | ||||
|                                 bits[0] + bits[1] + bits[2] + bits[3]); | ||||
|  | ||||
|             _eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]); | ||||
|             _eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[i]); | ||||
|  | ||||
|             _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA | | ||||
|                          EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT); | ||||
|  | ||||
|             config++; | ||||
|          } | ||||
|       } | ||||
|    } | ||||
|    return GL_TRUE; | ||||
| } | ||||
							
								
								
									
										75
									
								
								src/egl/main/eglconfig.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								src/egl/main/eglconfig.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | ||||
| #ifndef EGLCONFIG_INCLUDED | ||||
| #define EGLCONFIG_INCLUDED | ||||
|  | ||||
|  | ||||
| #include "egltypedefs.h" | ||||
| #include "GL/internal/glcore.h" | ||||
|  | ||||
|  | ||||
| #define MAX_ATTRIBS 100 | ||||
| #define FIRST_ATTRIB EGL_BUFFER_SIZE | ||||
|  | ||||
|  | ||||
| struct _egl_config | ||||
| { | ||||
|    EGLConfig Handle;   /* the public/opaque handle which names this config */ | ||||
|    EGLint Attrib[MAX_ATTRIBS]; | ||||
| }; | ||||
|  | ||||
|  | ||||
| #define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB] = VAL) | ||||
| #define GET_CONFIG_ATTRIB(CONF, ATTR) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB]) | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglInitConfig(_EGLConfig *config, EGLint id); | ||||
|  | ||||
|  | ||||
| extern _EGLConfig * | ||||
| _eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config); | ||||
|  | ||||
|  | ||||
| extern _EGLConfig * | ||||
| _eglAddConfig(_EGLDisplay *display, const _EGLConfig *config); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglConfigQualifies(const _EGLConfig *c, const _EGLConfig *min); | ||||
|  | ||||
|  | ||||
| extern EGLint | ||||
| _eglCompareConfigs(const _EGLConfig *a, const _EGLConfig *b); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val); | ||||
|  | ||||
| extern GLboolean | ||||
| _eglFillInConfigs( _EGLConfig *configs, | ||||
| 		GLenum fb_format, GLenum fb_type, | ||||
| 		const u_int8_t * depth_bits, const u_int8_t * stencil_bits, | ||||
| 		unsigned num_depth_stencil_bits, | ||||
| 		const GLenum * db_modes, unsigned num_db_modes, | ||||
| 		int visType ); | ||||
|                  | ||||
| extern void | ||||
| _eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode); | ||||
|  | ||||
|  | ||||
| #endif /* EGLCONFIG_INCLUDED */ | ||||
							
								
								
									
										240
									
								
								src/egl/main/eglcontext.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										240
									
								
								src/egl/main/eglcontext.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,240 @@ | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include "eglconfig.h" | ||||
| #include "eglcontext.h" | ||||
| #include "egldriver.h" | ||||
| #include "eglglobals.h" | ||||
| #include "eglhash.h" | ||||
| #include "eglsurface.h" | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Initialize the given _EGLContext object to defaults. | ||||
|  */ | ||||
| void | ||||
| _eglInitContext(_EGLContext *ctx) | ||||
| { | ||||
|    /* just init to zero for now */ | ||||
|    memset(ctx, 0, sizeof(_EGLContext)); | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Assign an EGLContext handle to the _EGLContext object then put it into | ||||
|  * the hash table. | ||||
|  */ | ||||
| void | ||||
| _eglSaveContext(_EGLContext *ctx) | ||||
| { | ||||
|    assert(ctx); | ||||
|    ctx->Handle = _eglHashGenKey(_eglGlobal.Contexts); | ||||
|    _eglHashInsert(_eglGlobal.Contexts, ctx->Handle, ctx); | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Remove the given _EGLContext object from the hash table. | ||||
|  */ | ||||
| void | ||||
| _eglRemoveContext(_EGLContext *ctx) | ||||
| { | ||||
|    _eglHashRemove(_eglGlobal.Contexts, ctx->Handle); | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Return the _EGLContext object that corresponds to the given | ||||
|  * EGLContext handle. | ||||
|  */ | ||||
| _EGLContext * | ||||
| _eglLookupContext(EGLContext ctx) | ||||
| { | ||||
|    _EGLContext *c = (_EGLContext *) _eglHashLookup(_eglGlobal.Contexts, ctx); | ||||
|    return c; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Return the currently bound _EGLContext object, or NULL. | ||||
|  */ | ||||
| _EGLContext * | ||||
| _eglGetCurrentContext(void) | ||||
| { | ||||
|    /* XXX this should be per-thread someday */ | ||||
|    return _eglGlobal.CurrentContext; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Just a placeholder/demo function.  Real driver will never use this! | ||||
|  */ | ||||
| EGLContext | ||||
| _eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLConfig *conf = _eglLookupConfig(drv, dpy, config); | ||||
|    if (!conf) { | ||||
|       _eglError(EGL_BAD_CONFIG, "eglCreateContext"); | ||||
|       return EGL_NO_CONTEXT; | ||||
|    } | ||||
|  | ||||
|    if (share_list != EGL_NO_CONTEXT) { | ||||
|       _EGLContext *shareCtx = _eglLookupContext(share_list); | ||||
|       if (!shareCtx) { | ||||
|          _eglError(EGL_BAD_CONTEXT, "eglCreateContext(share_list)"); | ||||
|          return EGL_NO_CONTEXT; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    return EGL_NO_CONTEXT; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Default fallback routine - drivers should usually override this. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx) | ||||
| { | ||||
|    _EGLContext *context = _eglLookupContext(ctx); | ||||
|    if (context) { | ||||
|       _eglHashRemove(_eglGlobal.Contexts, ctx); | ||||
|       if (context->IsBound) { | ||||
|          context->DeletePending = EGL_TRUE; | ||||
|       } | ||||
|       else { | ||||
|          free(context); | ||||
|       } | ||||
|       return EGL_TRUE; | ||||
|    } | ||||
|    else { | ||||
|       _eglError(EGL_BAD_CONTEXT, "eglDestroyContext"); | ||||
|       return EGL_TRUE; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLContext *c = _eglLookupContext(ctx); | ||||
|  | ||||
|    (void) drv; | ||||
|    (void) dpy; | ||||
|  | ||||
|    if (!c) { | ||||
|       _eglError(EGL_BAD_CONTEXT, "eglQueryContext"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    switch (attribute) { | ||||
|    case EGL_CONFIG_ID: | ||||
|       *value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID); | ||||
|       return EGL_TRUE; | ||||
|    default: | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Drivers will typically call this to do the error checking and | ||||
|  * update the various IsBound and DeletePending flags. | ||||
|  * Then, the driver will do its device-dependent Make-Current stuff. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d, EGLSurface r, EGLContext context) | ||||
| { | ||||
|    _EGLContext *ctx = _eglLookupContext(context); | ||||
|    _EGLSurface *draw = _eglLookupSurface(d); | ||||
|    _EGLSurface *read = _eglLookupSurface(r); | ||||
|  | ||||
|    _EGLContext *oldContext = _eglGetCurrentContext(); | ||||
|    _EGLSurface *oldDrawSurface = _eglGetCurrentSurface(EGL_DRAW); | ||||
|    _EGLSurface *oldReadSurface = _eglGetCurrentSurface(EGL_READ); | ||||
|  | ||||
|    /* error checking */ | ||||
|    if (ctx) { | ||||
|       if (draw == NULL || read == NULL) { | ||||
|          _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|       if (draw->Config != ctx->Config) { | ||||
|          _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|       if (read->Config != ctx->Config) { | ||||
|          _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    /* | ||||
|     * check if the old context or surfaces need to be deleted | ||||
|     */ | ||||
|    if (oldDrawSurface != NULL) { | ||||
|       oldDrawSurface->IsBound = EGL_FALSE; | ||||
|       if (oldDrawSurface->DeletePending) { | ||||
|          /* make sure we don't try to rebind a deleted surface */ | ||||
|          if (draw == oldDrawSurface || draw == oldReadSurface) { | ||||
|             draw = NULL; | ||||
|          } | ||||
|          /* really delete surface now */ | ||||
|          drv->DestroySurface(drv, dpy, oldDrawSurface->Handle); | ||||
|       } | ||||
|    } | ||||
|    if (oldReadSurface != NULL && oldReadSurface != oldDrawSurface) { | ||||
|       oldReadSurface->IsBound = EGL_FALSE; | ||||
|       if (oldReadSurface->DeletePending) { | ||||
|          /* make sure we don't try to rebind a deleted surface */ | ||||
|          if (read == oldDrawSurface || read == oldReadSurface) { | ||||
|             read = NULL; | ||||
|          } | ||||
|          /* really delete surface now */ | ||||
|          drv->DestroySurface(drv, dpy, oldReadSurface->Handle); | ||||
|       } | ||||
|    } | ||||
|    if (oldContext != NULL) { | ||||
|       oldContext->IsBound = EGL_FALSE; | ||||
|       if (oldContext->DeletePending) { | ||||
|          /* make sure we don't try to rebind a deleted context */ | ||||
|          if (ctx == oldContext) { | ||||
|             ctx = NULL; | ||||
|          } | ||||
|          /* really delete context now */ | ||||
|          drv->DestroyContext(drv, dpy, oldContext->Handle); | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    if (ctx) { | ||||
|       /* check read/draw again, in case we deleted them above */ | ||||
|       if (draw == NULL || read == NULL) { | ||||
|          _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|       ctx->DrawSurface = draw; | ||||
|       ctx->ReadSurface = read; | ||||
|       ctx->IsBound = EGL_TRUE; | ||||
|       draw->IsBound = EGL_TRUE; | ||||
|       read->IsBound = EGL_TRUE; | ||||
|    } | ||||
|  | ||||
|    _eglGlobal.CurrentContext = ctx; | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * This is defined by the EGL_MESA_copy_context extension. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, | ||||
|                     EGLContext dest, EGLint mask) | ||||
| { | ||||
|    /* This function will always have to be overridden/implemented in the | ||||
|     * device driver.  If the driver is based on Mesa, use _mesa_copy_context(). | ||||
|     */ | ||||
|    return EGL_FALSE; | ||||
| } | ||||
							
								
								
									
										67
									
								
								src/egl/main/eglcontext.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								src/egl/main/eglcontext.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
|  | ||||
| #ifndef EGLCONTEXT_INCLUDED | ||||
| #define EGLCONTEXT_INCLUDED | ||||
|  | ||||
|  | ||||
| #include "egltypedefs.h" | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * "Base" class for device driver contexts. | ||||
|  */ | ||||
| struct _egl_context | ||||
| { | ||||
|    EGLContext Handle;  /* The public/opaque handle which names this object */ | ||||
|  | ||||
|    _EGLDisplay *Display; /* who do I belong to? */ | ||||
|  | ||||
|    _EGLConfig *Config; | ||||
|  | ||||
|    _EGLSurface *DrawSurface; | ||||
|    _EGLSurface *ReadSurface; | ||||
|  | ||||
|    EGLBoolean IsBound; | ||||
|    EGLBoolean DeletePending; | ||||
| }; | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglInitContext(_EGLContext *ctx); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglSaveContext(_EGLContext *ctx); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglRemoveContext(_EGLContext *ctx); | ||||
|  | ||||
|  | ||||
| extern _EGLContext * | ||||
| _eglLookupContext(EGLContext ctx); | ||||
|   | ||||
|  | ||||
| extern _EGLContext * | ||||
| _eglGetCurrentContext(void); | ||||
|  | ||||
|  | ||||
| extern EGLContext | ||||
| _eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); | ||||
|  | ||||
| #endif /* EGLCONTEXT_INCLUDED */ | ||||
							
								
								
									
										71
									
								
								src/egl/main/egldisplay.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								src/egl/main/egldisplay.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,71 @@ | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include "eglcontext.h" | ||||
| #include "egldisplay.h" | ||||
| #include "eglglobals.h" | ||||
| #include "eglhash.h" | ||||
|  | ||||
|  | ||||
| static char * | ||||
| my_strdup(const char *s) | ||||
| { | ||||
|    int l = strlen(s); | ||||
|    char *s2 = malloc(l + 1); | ||||
|    strcpy(s2, s); | ||||
|    return s2; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * We're assuming that the NativeDisplayType parameter is actually | ||||
|  * a string. | ||||
|  * Return a new _EGLDisplay object for the given displayName | ||||
|  */ | ||||
| _EGLDisplay * | ||||
| _eglNewDisplay(NativeDisplayType displayName) | ||||
| { | ||||
|    _EGLDisplay *dpy = (_EGLDisplay *) malloc(sizeof(_EGLDisplay)); | ||||
|    if (dpy) { | ||||
|       dpy->Handle = _eglHashGenKey(_eglGlobal.Displays); | ||||
|       _eglHashInsert(_eglGlobal.Displays, dpy->Handle, dpy); | ||||
|       if (displayName) | ||||
|          dpy->Name = my_strdup(displayName); | ||||
|       else | ||||
|          dpy->Name = NULL; | ||||
|       dpy->Driver = NULL;  /* this gets set later */ | ||||
|    } | ||||
|    return dpy; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Return the _EGLDisplay object that corresponds to the given public/ | ||||
|  * opaque display handle. | ||||
|  */ | ||||
| _EGLDisplay * | ||||
| _eglLookupDisplay(EGLDisplay dpy) | ||||
| { | ||||
|    _EGLDisplay *d = (_EGLDisplay *) _eglHashLookup(_eglGlobal.Displays, dpy); | ||||
|    return d; | ||||
| } | ||||
|  | ||||
|  | ||||
| _EGLDisplay * | ||||
| _eglGetCurrentDisplay(void) | ||||
| { | ||||
|    _EGLContext *ctx = _eglGetCurrentContext(); | ||||
|    if (ctx) | ||||
|       return ctx->Display; | ||||
|    else | ||||
|       return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _eglCleanupDisplay(_EGLDisplay *disp) | ||||
| { | ||||
|    /* XXX incomplete */ | ||||
|    free(disp->Configs); | ||||
|    free(disp->Name); | ||||
|    /* driver deletes _EGLDisplay */ | ||||
| } | ||||
							
								
								
									
										44
									
								
								src/egl/main/egldisplay.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/egl/main/egldisplay.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| #ifndef EGLDISPLAY_INCLUDED | ||||
| #define EGLDISPLAY_INCLUDED | ||||
|  | ||||
|  | ||||
| #include "egltypedefs.h" | ||||
|  | ||||
|  | ||||
| struct _egl_display  | ||||
| { | ||||
|    EGLDisplay Handle; | ||||
|  | ||||
|    char *Name; | ||||
|    _EGLDriver *Driver; | ||||
|  | ||||
|    EGLint NumScreens; | ||||
|    _EGLScreen **Screens;  /* array [NumScreens] */ | ||||
|  | ||||
|    EGLint NumConfigs; | ||||
|    _EGLConfig *Configs;  /* array [NumConfigs] */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| extern _EGLDisplay * | ||||
| _eglNewDisplay(NativeDisplayType displayName); | ||||
|  | ||||
|  | ||||
| extern _EGLDisplay * | ||||
| _eglLookupDisplay(EGLDisplay dpy); | ||||
|  | ||||
|  | ||||
| extern _EGLDisplay * | ||||
| _eglGetCurrentDisplay(void); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglCleanupDisplay(_EGLDisplay *disp); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean  | ||||
| _eglQueryDisplayMESA(_EGLDriver *drv, EGLDisplay dpy, EGLint attrib, EGLint *value); | ||||
|  | ||||
|  | ||||
|  | ||||
| #endif /* EGLDISPLAY_INCLUDED */ | ||||
							
								
								
									
										255
									
								
								src/egl/main/egldriver.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										255
									
								
								src/egl/main/egldriver.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,255 @@ | ||||
| #include <assert.h> | ||||
| #include <dlfcn.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include "eglconfig.h" | ||||
| #include "eglcontext.h" | ||||
| #include "egldisplay.h" | ||||
| #include "egldriver.h" | ||||
| #include "eglglobals.h" | ||||
| #include "eglmode.h" | ||||
| #include "eglscreen.h" | ||||
| #include "eglsurface.h" | ||||
|  | ||||
|  | ||||
| const char *DefaultDriverName = "demodriver"; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Choose and open/init the hardware driver for the given EGLDisplay. | ||||
|  * Previously, the EGLDisplay was created with _eglNewDisplay() where | ||||
|  * we recorded the user's NativeDisplayType parameter. | ||||
|  * | ||||
|  * Now we'll use the NativeDisplayType value. | ||||
|  * | ||||
|  * Currently, the native display value is treated as a string. | ||||
|  * If the first character is ':' we interpret it as a screen or card index | ||||
|  * number (i.e. ":0" or ":1", etc) | ||||
|  * Else if the first character is '!' we interpret it as specific driver name | ||||
|  * (i.e. "!r200" or "!i830". | ||||
|  */ | ||||
| _EGLDriver * | ||||
| _eglChooseDriver(EGLDisplay display) | ||||
| { | ||||
|    _EGLDisplay *dpy = _eglLookupDisplay(display); | ||||
|    _EGLDriver *drv; | ||||
|    const char *driverName = DefaultDriverName; | ||||
|    const char *name; | ||||
|  | ||||
|    assert(dpy); | ||||
|  | ||||
|    name = dpy->Name; | ||||
|    if (!name) { | ||||
|       /* use default */ | ||||
|    } | ||||
|    else if (name[0] == ':' && (name[1] >= '0' && name[1] <= '9') && !name[2]) { | ||||
|       printf("EGL: Use driver for screen: %s\n", name); | ||||
|       /* XXX probe hardware here to determine which driver to open */ | ||||
|       /* driverName = "something"; */ | ||||
|    } | ||||
|    else if (name[0] == '!') { | ||||
|       /* use specified driver name */ | ||||
|       driverName = name + 1; | ||||
|       printf("EGL: Use driver named %s\n", driverName); | ||||
|    } | ||||
|    else { | ||||
|       /* Maybe display was returned by XOpenDisplay? */ | ||||
|       printf("EGL: can't parse display pointer\n"); | ||||
|    } | ||||
|  | ||||
|    drv = _eglOpenDriver(dpy, driverName); | ||||
|    dpy->Driver = drv; | ||||
|  | ||||
|    return drv; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Open/load the named driver and call its bootstrap function: _eglMain(). | ||||
|  * \return  new _EGLDriver object. | ||||
|  */ | ||||
| _EGLDriver * | ||||
| _eglOpenDriver(_EGLDisplay *dpy, const char *driverName) | ||||
| { | ||||
|    void *lib; | ||||
|    char driverFilename[1000]; | ||||
|  | ||||
|    /* XXX also prepend a directory path??? */ | ||||
|    sprintf(driverFilename, "%s.so", driverName); | ||||
|  | ||||
| #if 1 | ||||
|    lib = dlopen(driverFilename, RTLD_NOW); | ||||
|    if (lib) { | ||||
|       _EGLDriver *drv; | ||||
|       _EGLMain_t mainFunc; | ||||
|  | ||||
|       mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); | ||||
|       if (!mainFunc) { | ||||
|          fprintf(stderr, "_eglMain not found in %s", (char *) driverFilename); | ||||
|          dlclose(lib); | ||||
|          return NULL; | ||||
|       } | ||||
|  | ||||
|       drv = mainFunc(dpy); | ||||
|       if (!drv) { | ||||
|          dlclose(lib); | ||||
|          return NULL; | ||||
|       } | ||||
|  | ||||
|       drv->LibHandle = lib; | ||||
|       drv->Display = dpy; | ||||
|       return drv; | ||||
|    } | ||||
|    else { | ||||
|       fprintf(stderr, "EGLdebug: Error opening %s: %s\n", | ||||
|               driverFilename, dlerror()); | ||||
|       return NULL; | ||||
|    } | ||||
| #else | ||||
|    /* use built-in driver */ | ||||
|    return _eglDefaultMain(d); | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy) | ||||
| { | ||||
|    void *handle = drv->LibHandle; | ||||
|    EGLBoolean b; | ||||
|    fprintf(stderr, "EGL debug: Closing driver\n"); | ||||
|  | ||||
|    /* | ||||
|     * XXX check for currently bound context/surfaces and delete them? | ||||
|     */ | ||||
|  | ||||
|    b = drv->Terminate(drv, dpy); | ||||
|    dlclose(handle); | ||||
|    return b; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Given a display handle, return the _EGLDriver for that display. | ||||
|  */ | ||||
| _EGLDriver * | ||||
| _eglLookupDriver(EGLDisplay dpy) | ||||
| { | ||||
|    _EGLDisplay *d = _eglLookupDisplay(dpy); | ||||
|    if (d) | ||||
|       return d->Driver; | ||||
|    else | ||||
|       return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Plug all the available fallback routines into the given driver's | ||||
|  * dispatch table. | ||||
|  */ | ||||
| void | ||||
| _eglInitDriverFallbacks(_EGLDriver *drv) | ||||
| { | ||||
|    /* If a pointer is set to NULL, then the device driver _really_ has | ||||
|     * to implement it. | ||||
|     */ | ||||
|    drv->Initialize = NULL; | ||||
|    drv->Terminate = NULL; | ||||
|  | ||||
|    drv->GetConfigs = _eglGetConfigs; | ||||
|    drv->ChooseConfig = _eglChooseConfig; | ||||
|    drv->GetConfigAttrib = _eglGetConfigAttrib; | ||||
|  | ||||
|    drv->CreateContext = _eglCreateContext; | ||||
|    drv->DestroyContext = _eglDestroyContext; | ||||
|    drv->MakeCurrent = _eglMakeCurrent; | ||||
|    drv->QueryContext = _eglQueryContext; | ||||
|  | ||||
|    drv->CreateWindowSurface = _eglCreateWindowSurface; | ||||
|    drv->CreatePixmapSurface = _eglCreatePixmapSurface; | ||||
|    drv->CreatePbufferSurface = _eglCreatePbufferSurface; | ||||
|    drv->DestroySurface = _eglDestroySurface; | ||||
|    drv->QuerySurface = _eglQuerySurface; | ||||
|    drv->SurfaceAttrib = _eglSurfaceAttrib; | ||||
|    drv->BindTexImage = _eglBindTexImage; | ||||
|    drv->ReleaseTexImage = _eglReleaseTexImage; | ||||
|    drv->SwapInterval = _eglSwapInterval; | ||||
|    drv->SwapBuffers = _eglSwapBuffers; | ||||
|    drv->CopyBuffers = _eglCopyBuffers; | ||||
|  | ||||
|    drv->QueryString = _eglQueryString; | ||||
|    drv->WaitGL = _eglWaitGL; | ||||
|    drv->WaitNative = _eglWaitNative; | ||||
|  | ||||
|    /* EGL_MESA_screen */ | ||||
|    drv->ChooseModeMESA = _eglChooseModeMESA;  | ||||
|    drv->GetModesMESA = _eglGetModesMESA; | ||||
|    drv->GetModeAttribMESA = _eglGetModeAttribMESA; | ||||
|    drv->GetScreensMESA = _eglGetScreensMESA; | ||||
|    drv->CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA; | ||||
|    drv->ShowSurfaceMESA = _eglShowSurfaceMESA; | ||||
|    drv->ScreenPositionMESA = _eglScreenPositionMESA; | ||||
|    drv->QueryScreenMESA = _eglQueryScreenMESA; | ||||
|    drv->QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA; | ||||
|    drv->QueryScreenModeMESA = _eglQueryScreenModeMESA; | ||||
|    drv->QueryModeStringMESA = _eglQueryModeStringMESA; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Examine the individual extension enable/disable flags and recompute | ||||
|  * the driver's Extensions string. | ||||
|  */ | ||||
| static void | ||||
| UpdateExtensionsString(_EGLDriver *drv) | ||||
| { | ||||
|    drv->Extensions[0] = 0; | ||||
|  | ||||
|    if (drv->MESA_screen_surface) | ||||
|       strcat(drv->Extensions, "EGL_MESA_screen_surface "); | ||||
|    if (drv->MESA_copy_context) | ||||
|       strcat(drv->Extensions, "EGL_MESA_copy_context "); | ||||
|    assert(strlen(drv->Extensions) < MAX_EXTENSIONS_LEN); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| const char * | ||||
| _eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name) | ||||
| { | ||||
|    (void) drv; | ||||
|    (void) dpy; | ||||
|    switch (name) { | ||||
|    case EGL_VENDOR: | ||||
|       return "Mesa Project"; | ||||
|    case EGL_VERSION: | ||||
|       return "1.0"; | ||||
|    case EGL_EXTENSIONS: | ||||
|       UpdateExtensionsString(drv); | ||||
|       return drv->Extensions; | ||||
|    default: | ||||
|       _eglError(EGL_BAD_PARAMETER, "eglQueryString"); | ||||
|       return NULL; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglWaitGL(_EGLDriver *drv, EGLDisplay dpy) | ||||
| { | ||||
|    /* just a placeholder */ | ||||
|    (void) drv; | ||||
|    (void) dpy; | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine) | ||||
| { | ||||
|    /* just a placeholder */ | ||||
|    (void) drv; | ||||
|    (void) dpy; | ||||
|    (void) engine; | ||||
|    return EGL_TRUE; | ||||
| } | ||||
							
								
								
									
										167
									
								
								src/egl/main/egldriver.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								src/egl/main/egldriver.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,167 @@ | ||||
| #ifndef EGLDRIVER_INCLUDED | ||||
| #define EGLDRIVER_INCLUDED | ||||
|  | ||||
|  | ||||
| #include "egltypedefs.h" | ||||
|  | ||||
| /* should probably use a dynamic-lengh string, but this will do */ | ||||
| #define MAX_EXTENSIONS_LEN 1000 | ||||
|  | ||||
|  | ||||
| /* driver funcs */ | ||||
| typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor); | ||||
| typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy); | ||||
|  | ||||
| /* config funcs */ | ||||
| typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); | ||||
| typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); | ||||
| typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); | ||||
|  | ||||
| /* context funcs */ | ||||
| typedef EGLContext (*CreateContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list); | ||||
| typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx); | ||||
| typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); | ||||
| typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); | ||||
|  | ||||
| /* surface funcs */ | ||||
| typedef EGLSurface (*CreateWindowSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); | ||||
| typedef EGLSurface (*CreatePixmapSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list); | ||||
| typedef EGLSurface (*CreatePbufferSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | ||||
| typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface); | ||||
| typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); | ||||
| typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); | ||||
| typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); | ||||
| typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); | ||||
| typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint interval); | ||||
| typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw); | ||||
| typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target); | ||||
|  | ||||
| /* misc funcs */ | ||||
| typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint name); | ||||
| typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy); | ||||
| typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine); | ||||
|  | ||||
|  | ||||
| /* EGL_MESA_screen extension */ | ||||
| typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); | ||||
| typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode); | ||||
| typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value); | ||||
| typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); | ||||
| typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); | ||||
| typedef EGLSurface (*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | ||||
| typedef EGLBoolean (*ShowSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode); | ||||
| typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); | ||||
| typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); | ||||
| typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface); | ||||
| typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); | ||||
| typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Base class for device drivers. | ||||
|  */ | ||||
| struct _egl_driver | ||||
| { | ||||
|    EGLBoolean Initialized; /* set by driver after initialized */ | ||||
|  | ||||
|    void *LibHandle; /* dlopen handle */ | ||||
|  | ||||
|    _EGLDisplay *Display; | ||||
|  | ||||
|    int ABIversion; | ||||
|    int APImajor, APIminor; /* returned through eglInitialize */ | ||||
|  | ||||
|    /* | ||||
|     * The API dispatcher jumps through these functions | ||||
|     */ | ||||
|    Initialize_t Initialize; | ||||
|    Terminate_t Terminate; | ||||
|  | ||||
|    GetConfigs_t GetConfigs; | ||||
|    ChooseConfig_t ChooseConfig; | ||||
|    GetConfigAttrib_t GetConfigAttrib; | ||||
|  | ||||
|    CreateContext_t CreateContext; | ||||
|    DestroyContext_t DestroyContext; | ||||
|    MakeCurrent_t MakeCurrent; | ||||
|    QueryContext_t QueryContext; | ||||
|  | ||||
|    CreateWindowSurface_t CreateWindowSurface; | ||||
|    CreatePixmapSurface_t CreatePixmapSurface; | ||||
|    CreatePbufferSurface_t CreatePbufferSurface; | ||||
|    DestroySurface_t DestroySurface; | ||||
|    QuerySurface_t QuerySurface; | ||||
|    SurfaceAttrib_t SurfaceAttrib; | ||||
|    BindTexImage_t BindTexImage; | ||||
|    ReleaseTexImage_t ReleaseTexImage; | ||||
|    SwapInterval_t SwapInterval; | ||||
|    SwapBuffers_t SwapBuffers; | ||||
|    CopyBuffers_t CopyBuffers; | ||||
|  | ||||
|    QueryString_t QueryString; | ||||
|    WaitGL_t WaitGL; | ||||
|    WaitNative_t WaitNative; | ||||
|  | ||||
|    /* EGL_MESA_screen extension */ | ||||
|    ChooseModeMESA_t ChooseModeMESA; | ||||
|    GetModesMESA_t GetModesMESA; | ||||
|    GetModeAttribMESA_t GetModeAttribMESA; | ||||
|    CopyContextMESA_t CopyContextMESA; | ||||
|    GetScreensMESA_t GetScreensMESA; | ||||
|    CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA; | ||||
|    ShowSurfaceMESA_t ShowSurfaceMESA; | ||||
|    ScreenPositionMESA_t ScreenPositionMESA; | ||||
|    QueryScreenMESA_t QueryScreenMESA; | ||||
|    QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA; | ||||
|    QueryScreenModeMESA_t QueryScreenModeMESA; | ||||
|    QueryModeStringMESA_t QueryModeStringMESA; | ||||
|  | ||||
|    /* Extension enable flags */ | ||||
|    EGLBoolean MESA_screen_surface; | ||||
|    EGLBoolean MESA_copy_context; | ||||
|  | ||||
|    /* Extensions string */ | ||||
|    char Extensions[MAX_EXTENSIONS_LEN]; | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| extern _EGLDriver * | ||||
| _eglDefaultMain(NativeDisplayType d); | ||||
|  | ||||
|  | ||||
| extern _EGLDriver * | ||||
| _eglChooseDriver(EGLDisplay dpy); | ||||
|  | ||||
|  | ||||
| extern _EGLDriver * | ||||
| _eglOpenDriver(_EGLDisplay *dpy, const char *driverName); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy); | ||||
|  | ||||
|  | ||||
| extern _EGLDriver * | ||||
| _eglLookupDriver(EGLDisplay d); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglInitDriverFallbacks(_EGLDriver *drv); | ||||
|  | ||||
|  | ||||
| extern const char * | ||||
| _eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglWaitGL(_EGLDriver *drv, EGLDisplay dpy); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine); | ||||
|  | ||||
|  | ||||
|  | ||||
| #endif /* EGLDRIVER_INCLUDED */ | ||||
							
								
								
									
										65
									
								
								src/egl/main/eglglobals.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								src/egl/main/eglglobals.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| #include <stdio.h> | ||||
| #include "eglglobals.h" | ||||
|  | ||||
|  | ||||
| struct _egl_global _eglGlobal = { EGL_FALSE }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Init the fields in the _eglGlobal struct | ||||
|  * May be safely called more than once. | ||||
|  */ | ||||
| void | ||||
| _eglInitGlobals(void) | ||||
| { | ||||
|    if (!_eglGlobal.Initialized) { | ||||
|       _eglGlobal.Displays = _eglNewHashTable(); | ||||
|       _eglGlobal.Contexts = _eglNewHashTable(); | ||||
|       _eglGlobal.Surfaces = _eglNewHashTable(); | ||||
|       _eglGlobal.FreeScreenHandle = 1; | ||||
|       _eglGlobal.CurrentContext = EGL_NO_CONTEXT; | ||||
|       _eglGlobal.LastError = EGL_SUCCESS; | ||||
|       _eglGlobal.Initialized = EGL_TRUE; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Should call this via an atexit handler. | ||||
|  */ | ||||
| void | ||||
| _eglDestroyGlobals(void) | ||||
| { | ||||
|    /* XXX TODO walk over table entries, deleting each */ | ||||
|    _eglDeleteHashTable(_eglGlobal.Displays); | ||||
|    _eglDeleteHashTable(_eglGlobal.Contexts); | ||||
|    _eglDeleteHashTable(_eglGlobal.Surfaces); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Record EGL error code. | ||||
|  */ | ||||
| void | ||||
| _eglError(EGLint errCode, const char *msg) | ||||
| { | ||||
|    if (_eglGlobal.LastError == EGL_SUCCESS) { | ||||
|       _eglGlobal.LastError = errCode; | ||||
|       /* XXX temporary */ | ||||
|       fprintf(stderr, "EGL Error 0x%x in %s\n", errCode, msg); | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Return a new screen handle/ID. | ||||
|  * NOTE: we never reuse these! | ||||
|  */ | ||||
| EGLScreenMESA | ||||
| _eglAllocScreenHandle(void) | ||||
| { | ||||
|    EGLScreenMESA s = _eglGlobal.FreeScreenHandle; | ||||
|    _eglGlobal.FreeScreenHandle++; | ||||
|    return s; | ||||
| } | ||||
							
								
								
									
										44
									
								
								src/egl/main/eglglobals.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/egl/main/eglglobals.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| #ifndef EGLGLOBALS_INCLUDED | ||||
| #define EGLGLOBALS_INCLUDED | ||||
|  | ||||
| #include "egltypedefs.h" | ||||
| #include "eglhash.h" | ||||
|  | ||||
|  | ||||
| struct _egl_global | ||||
| { | ||||
|    EGLBoolean Initialized; | ||||
|  | ||||
|    _EGLHashtable *Displays; | ||||
|    _EGLHashtable *Contexts; | ||||
|    _EGLHashtable *Surfaces; | ||||
|  | ||||
|    EGLScreenMESA FreeScreenHandle; | ||||
|  | ||||
|    EGLint LastError; | ||||
|  | ||||
|    /* XXX this should be per-thread someday */ | ||||
|    _EGLContext *CurrentContext; | ||||
| }; | ||||
|  | ||||
|  | ||||
| extern struct _egl_global _eglGlobal; | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglInitGlobals(void); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglDestroyGlobals(void); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglError(EGLint errCode, const char *msg); | ||||
|  | ||||
|  | ||||
| extern EGLScreenMESA | ||||
| _eglAllocScreenHandle(void); | ||||
|  | ||||
|  | ||||
| #endif /* EGLGLOBALS_INCLUDED */ | ||||
							
								
								
									
										347
									
								
								src/egl/main/eglhash.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										347
									
								
								src/egl/main/eglhash.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,347 @@ | ||||
| /** | ||||
|  * \file hash.c | ||||
|  * Generic hash table.  | ||||
|  * | ||||
|  * This code taken from Mesa and adapted. | ||||
|  */ | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include "eglhash.h" | ||||
|  | ||||
|  | ||||
| #define TABLE_SIZE 1023  /**< Size of lookup table/array */ | ||||
|  | ||||
| #define HASH_FUNC(K)  ((K) % TABLE_SIZE) | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Unfinished mutex stuff | ||||
|  */ | ||||
|  | ||||
| typedef int _EGLMutex; | ||||
|  | ||||
| static void | ||||
| _eglInitMutex(_EGLMutex m) | ||||
| { | ||||
| } | ||||
|  | ||||
| static void | ||||
| _eglDestroyMutex(_EGLMutex m) | ||||
| { | ||||
| } | ||||
|  | ||||
| static void | ||||
| _eglLockMutex(_EGLMutex m) | ||||
| { | ||||
| } | ||||
|  | ||||
| static void | ||||
| _eglUnlockMutex(_EGLMutex m) | ||||
| { | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| typedef struct _egl_hashentry _EGLHashentry; | ||||
|  | ||||
| struct _egl_hashentry | ||||
| { | ||||
|    EGLuint Key;            /**< the entry's key */ | ||||
|    void *Data;             /**< the entry's data */ | ||||
|    _EGLHashentry *Next;    /**< pointer to next entry */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| struct _egl_hashtable | ||||
| { | ||||
|    _EGLHashentry *Table[TABLE_SIZE];  /**< the lookup table */ | ||||
|    EGLuint MaxKey;                    /**< highest key inserted so far */ | ||||
|    _EGLMutex Mutex;                   /**< mutual exclusion lock */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Create a new hash table. | ||||
|  *  | ||||
|  * \return pointer to a new, empty hash table. | ||||
|  */ | ||||
| _EGLHashtable * | ||||
| _eglNewHashTable(void) | ||||
| { | ||||
|    _EGLHashtable *table = (_EGLHashtable *) calloc(1, sizeof(_EGLHashtable)); | ||||
|    if (table) { | ||||
|       _eglInitMutex(table->Mutex); | ||||
|       table->MaxKey = 1; | ||||
|    } | ||||
|    return table; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Delete a hash table. | ||||
|  * Frees each entry on the hash table and then the hash table structure itself. | ||||
|  * Note that the caller should have already traversed the table and deleted | ||||
|  * the objects in the table (i.e. We don't free the entries' data pointer). | ||||
|  * | ||||
|  * \param table the hash table to delete. | ||||
|  */ | ||||
| void | ||||
| _eglDeleteHashTable(_EGLHashtable *table) | ||||
| { | ||||
|    EGLuint i; | ||||
|    assert(table); | ||||
|    for (i = 0; i < TABLE_SIZE; i++) { | ||||
|       _EGLHashentry *entry = table->Table[i]; | ||||
|       while (entry) { | ||||
| 	 _EGLHashentry *next = entry->Next; | ||||
| 	 free(entry); | ||||
| 	 entry = next; | ||||
|       } | ||||
|    } | ||||
|    _eglDestroyMutex(table->Mutex); | ||||
|    free(table); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Lookup an entry in the hash table. | ||||
|  *  | ||||
|  * \param table the hash table. | ||||
|  * \param key the key. | ||||
|  *  | ||||
|  * \return pointer to user's data or NULL if key not in table | ||||
|  */ | ||||
| void * | ||||
| _eglHashLookup(const _EGLHashtable *table, EGLuint key) | ||||
| { | ||||
|    EGLuint pos; | ||||
|    const _EGLHashentry *entry; | ||||
|  | ||||
|    assert(table); | ||||
|  | ||||
|    if (!key) | ||||
|       return NULL; | ||||
|  | ||||
|    pos = HASH_FUNC(key); | ||||
|    entry = table->Table[pos]; | ||||
|    while (entry) { | ||||
|       if (entry->Key == key) { | ||||
| 	 return entry->Data; | ||||
|       } | ||||
|       entry = entry->Next; | ||||
|    } | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Insert a key/pointer pair into the hash table.   | ||||
|  * If an entry with this key already exists we'll replace the existing entry. | ||||
|  *  | ||||
|  * \param table the hash table. | ||||
|  * \param key the key (not zero). | ||||
|  * \param data pointer to user data. | ||||
|  */ | ||||
| void | ||||
| _eglHashInsert(_EGLHashtable *table, EGLuint key, void *data) | ||||
| { | ||||
|    /* search for existing entry with this key */ | ||||
|    EGLuint pos; | ||||
|    _EGLHashentry *entry; | ||||
|  | ||||
|    assert(table); | ||||
|    assert(key); | ||||
|  | ||||
|    _eglLockMutex(table->Mutex); | ||||
|  | ||||
|    if (key > table->MaxKey) | ||||
|       table->MaxKey = key; | ||||
|  | ||||
|    pos = HASH_FUNC(key); | ||||
|    entry = table->Table[pos]; | ||||
|    while (entry) { | ||||
|       if (entry->Key == key) { | ||||
|          /* replace entry's data */ | ||||
| 	 entry->Data = data; | ||||
|          _eglUnlockMutex(table->Mutex); | ||||
| 	 return; | ||||
|       } | ||||
|       entry = entry->Next; | ||||
|    } | ||||
|  | ||||
|    /* alloc and insert new table entry */ | ||||
|    entry = (_EGLHashentry *) malloc(sizeof(_EGLHashentry)); | ||||
|    entry->Key = key; | ||||
|    entry->Data = data; | ||||
|    entry->Next = table->Table[pos]; | ||||
|    table->Table[pos] = entry; | ||||
|  | ||||
|    _eglUnlockMutex(table->Mutex); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Remove an entry from the hash table. | ||||
|  *  | ||||
|  * \param table the hash table. | ||||
|  * \param key key of entry to remove. | ||||
|  * | ||||
|  * While holding the hash table's lock, searches the entry with the matching | ||||
|  * key and unlinks it. | ||||
|  */ | ||||
| void | ||||
| _eglHashRemove(_EGLHashtable *table, EGLuint key) | ||||
| { | ||||
|    EGLuint pos; | ||||
|    _EGLHashentry *entry, *prev; | ||||
|  | ||||
|    assert(table); | ||||
|    assert(key); | ||||
|  | ||||
|    _eglLockMutex(table->Mutex); | ||||
|  | ||||
|    pos = HASH_FUNC(key); | ||||
|    prev = NULL; | ||||
|    entry = table->Table[pos]; | ||||
|    while (entry) { | ||||
|       if (entry->Key == key) { | ||||
|          /* found it! */ | ||||
|          if (prev) { | ||||
|             prev->Next = entry->Next; | ||||
|          } | ||||
|          else { | ||||
|             table->Table[pos] = entry->Next; | ||||
|          } | ||||
|          free(entry); | ||||
|          _eglUnlockMutex(table->Mutex); | ||||
| 	 return; | ||||
|       } | ||||
|       prev = entry; | ||||
|       entry = entry->Next; | ||||
|    } | ||||
|  | ||||
|    _eglUnlockMutex(table->Mutex); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Get the key of the "first" entry in the hash table. | ||||
|  *  | ||||
|  * This is used in the course of deleting all display lists when | ||||
|  * a context is destroyed. | ||||
|  *  | ||||
|  * \param table the hash table | ||||
|  *  | ||||
|  * \return key for the "first" entry in the hash table. | ||||
|  * | ||||
|  * While holding the lock, walks through all table positions until finding | ||||
|  * the first entry of the first non-empty one. | ||||
|  */ | ||||
| EGLuint | ||||
| _eglHashFirstEntry(_EGLHashtable *table) | ||||
| { | ||||
|    EGLuint pos; | ||||
|    assert(table); | ||||
|    _eglLockMutex(table->Mutex); | ||||
|    for (pos = 0; pos < TABLE_SIZE; pos++) { | ||||
|       if (table->Table[pos]) { | ||||
|          _eglUnlockMutex(table->Mutex); | ||||
|          return table->Table[pos]->Key; | ||||
|       } | ||||
|    } | ||||
|    _eglUnlockMutex(table->Mutex); | ||||
|    return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Given a hash table key, return the next key.  This is used to walk | ||||
|  * over all entries in the table.  Note that the keys returned during | ||||
|  * walking won't be in any particular order. | ||||
|  * \return next hash key or 0 if end of table. | ||||
|  */ | ||||
| EGLuint | ||||
| _eglHashNextEntry(const _EGLHashtable *table, EGLuint key) | ||||
| { | ||||
|    const _EGLHashentry *entry; | ||||
|    EGLuint pos; | ||||
|  | ||||
|    assert(table); | ||||
|    assert(key); | ||||
|  | ||||
|    /* Find the entry with given key */ | ||||
|    pos = HASH_FUNC(key); | ||||
|    entry = table->Table[pos]; | ||||
|    while (entry) { | ||||
|       if (entry->Key == key) { | ||||
|          break; | ||||
|       } | ||||
|       entry = entry->Next; | ||||
|    } | ||||
|  | ||||
|    if (!entry) { | ||||
|       /* the key was not found, we can't find next entry */ | ||||
|       return 0; | ||||
|    } | ||||
|  | ||||
|    if (entry->Next) { | ||||
|       /* return next in linked list */ | ||||
|       return entry->Next->Key; | ||||
|    } | ||||
|    else { | ||||
|       /* look for next non-empty table slot */ | ||||
|       pos++; | ||||
|       while (pos < TABLE_SIZE) { | ||||
|          if (table->Table[pos]) { | ||||
|             return table->Table[pos]->Key; | ||||
|          } | ||||
|          pos++; | ||||
|       } | ||||
|       return 0; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Dump contents of hash table for debugging. | ||||
|  *  | ||||
|  * \param table the hash table. | ||||
|  */ | ||||
| void | ||||
| _eglHashPrint(const _EGLHashtable *table) | ||||
| { | ||||
|    EGLuint i; | ||||
|    assert(table); | ||||
|    for (i = 0; i < TABLE_SIZE; i++) { | ||||
|       const _EGLHashentry *entry = table->Table[i]; | ||||
|       while (entry) { | ||||
| 	 printf("%u %p\n", entry->Key, entry->Data); | ||||
| 	 entry = entry->Next; | ||||
|       } | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Return a new, unused hash key. | ||||
|  */ | ||||
| EGLuint | ||||
| _eglHashGenKey(_EGLHashtable *table) | ||||
| { | ||||
|    EGLuint k; | ||||
|  | ||||
|    _eglLockMutex(table->Mutex); | ||||
|    k = table->MaxKey; | ||||
|    table->MaxKey++; | ||||
|    _eglUnlockMutex(table->Mutex); | ||||
|    return k; | ||||
| } | ||||
|  | ||||
							
								
								
									
										39
									
								
								src/egl/main/eglhash.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/egl/main/eglhash.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| /** | ||||
|  * \file eglhash.h | ||||
|  * Generic hash table.  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #ifndef EGLHASH_INCLUDED | ||||
| #define EGLHASH_INCLUDED | ||||
|  | ||||
|  | ||||
| /* XXX move this? */ | ||||
| typedef unsigned int EGLuint; | ||||
|  | ||||
|  | ||||
| typedef struct _egl_hashtable _EGLHashtable; | ||||
|  | ||||
|  | ||||
| extern _EGLHashtable *_eglNewHashTable(void); | ||||
|  | ||||
| extern void _eglDeleteHashTable(_EGLHashtable *table); | ||||
|  | ||||
| extern void *_eglHashLookup(const _EGLHashtable *table, EGLuint key); | ||||
|  | ||||
| extern void _eglHashInsert(_EGLHashtable *table, EGLuint key, void *data); | ||||
|  | ||||
| extern void _eglHashRemove(_EGLHashtable *table, EGLuint key); | ||||
|  | ||||
| extern EGLuint _eglHashFirstEntry(_EGLHashtable *table); | ||||
|  | ||||
| extern EGLuint _eglHashNextEntry(const _EGLHashtable *table, EGLuint key); | ||||
|  | ||||
| extern void _eglHashPrint(const _EGLHashtable *table); | ||||
|  | ||||
| extern EGLuint _eglHashGenKey(_EGLHashtable *table); | ||||
|  | ||||
| extern void _egltest_hash_functions(void); | ||||
|  | ||||
|  | ||||
| #endif /* EGLHASH_INCLUDED */ | ||||
							
								
								
									
										199
									
								
								src/egl/main/eglmode.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								src/egl/main/eglmode.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,199 @@ | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "egldisplay.h" | ||||
| #include "egldriver.h" | ||||
| #include "eglmode.h" | ||||
| #include "eglglobals.h" | ||||
| #include "eglscreen.h" | ||||
|  | ||||
|  | ||||
| #define MIN2(A, B)  (((A) < (B)) ? (A) : (B)) | ||||
|  | ||||
|  | ||||
| static char * | ||||
| my_strdup(const char *s) | ||||
| { | ||||
|    int l = strlen(s); | ||||
|    char *s2 = malloc(l + 1); | ||||
|    strcpy(s2, s); | ||||
|    return s2; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Given an EGLModeMESA handle, return the corresponding _EGLMode object | ||||
|  * or null if non-existant. | ||||
|  */ | ||||
| _EGLMode * | ||||
| _eglLookupMode(EGLDisplay dpy, EGLModeMESA mode) | ||||
| { | ||||
|    const _EGLDisplay *disp = _eglLookupDisplay(dpy); | ||||
|    EGLint scrnum; | ||||
|  | ||||
|    /* loop over all screens on the display */ | ||||
|    for (scrnum = 0; scrnum < disp->NumScreens; scrnum++) { | ||||
|       const _EGLScreen *scrn = disp->Screens[scrnum]; | ||||
|       EGLint i; | ||||
|       /* search list of modes for handle */ | ||||
|       for (i = 0; i < scrn->NumModes; i++) { | ||||
|          if (scrn->Modes[i].Handle == mode) { | ||||
|             return scrn->Modes + i; | ||||
|          } | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Add a new mode with the given attributes (width, height, depth, refreshRate) | ||||
|  * to the given screen. | ||||
|  * Assign a new mode ID/handle to the mode as well. | ||||
|  * \return pointer to the new _EGLMode | ||||
|  */ | ||||
| _EGLMode * | ||||
| _eglAddMode(_EGLScreen *screen, EGLint width, EGLint height, | ||||
|             EGLint refreshRate, const char *name) | ||||
| { | ||||
|    EGLint n; | ||||
|    _EGLMode *newModes; | ||||
|  | ||||
|    assert(screen); | ||||
|    assert(width > 0); | ||||
|    assert(height > 0); | ||||
|    assert(refreshRate > 0); | ||||
|  | ||||
|    n = screen->NumModes; | ||||
|    newModes = (_EGLMode *) realloc(screen->Modes, (n+1) * sizeof(_EGLMode)); | ||||
|    if (newModes) { | ||||
|       screen->Modes = newModes; | ||||
|       screen->Modes[n].Handle = n + 1; | ||||
|       screen->Modes[n].Width = width; | ||||
|       screen->Modes[n].Height = height; | ||||
|       screen->Modes[n].RefreshRate = refreshRate; | ||||
|       screen->Modes[n].Stereo = EGL_FALSE; | ||||
|       screen->Modes[n].Name = my_strdup(name); | ||||
|       screen->NumModes++; | ||||
|       return screen->Modes + n; | ||||
|    } | ||||
|    else { | ||||
|       return NULL; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Search for the EGLMode that best matches the given attribute list. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                    const EGLint *attrib_list, EGLModeMESA *modes, | ||||
|                    EGLint modes_size, EGLint *num_modes) | ||||
| { | ||||
|    EGLint i; | ||||
|  | ||||
|    /* XXX incomplete */ | ||||
|  | ||||
|    for (i = 0; attrib_list[i] != EGL_NONE; i++) { | ||||
|       switch (attrib_list[i]) { | ||||
|       case EGL_WIDTH: | ||||
|          i++; | ||||
|          break; | ||||
|       case EGL_HEIGHT: | ||||
|          i++; | ||||
|          break; | ||||
|       case EGL_REFRESH_RATE_MESA: | ||||
|          i++; | ||||
|          break; | ||||
| #if 0 | ||||
|       case EGL_STEREO_MESA: | ||||
|          i++; | ||||
|          break; | ||||
| #endif | ||||
|       default: | ||||
|          _eglError(EGL_BAD_ATTRIBUTE, "eglChooseMode"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Return all possible modes for the given screen | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                  EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes) | ||||
| { | ||||
|    _EGLScreen *scrn = _eglLookupScreen(dpy, screen); | ||||
|    EGLint i; | ||||
|  | ||||
|    if (!scrn) { | ||||
|       _eglError(EGL_BAD_SCREEN_MESA, "eglGetModes"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    *num_modes = MIN2(modes_size, scrn->NumModes); | ||||
|    for (i = 0; i < *num_modes; i++) { | ||||
|       modes[i] = scrn->Modes[i].Handle; | ||||
|    } | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Query an attribute of a mode. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, | ||||
|                       EGLModeMESA mode, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLMode *m = _eglLookupMode(dpy, mode); | ||||
|  | ||||
|    switch (attribute) { | ||||
|    case EGL_MODE_ID_MESA: | ||||
|       *value = m->Handle; | ||||
|       break; | ||||
|    case EGL_WIDTH: | ||||
|       *value = m->Width; | ||||
|       break; | ||||
|    case EGL_HEIGHT: | ||||
|       *value = m->Height; | ||||
|       break; | ||||
| #if 0 | ||||
|    case EGL_DEPTH_MESA: | ||||
|       *value = m->Depth; | ||||
|       break; | ||||
| #endif | ||||
|    case EGL_REFRESH_RATE_MESA: | ||||
|       *value = m->RefreshRate; | ||||
|       break; | ||||
| #if 0 | ||||
|    case EGL_STEREO_MESA: | ||||
|       *value = m->Stereo; | ||||
|       break; | ||||
| #endif | ||||
|    default: | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, "eglGetModeAttrib"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| const char * | ||||
| _eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode) | ||||
| { | ||||
|    _EGLMode *m = _eglLookupMode(dpy, mode); | ||||
|    return m->Name; | ||||
| } | ||||
|  | ||||
|  | ||||
							
								
								
									
										53
									
								
								src/egl/main/eglmode.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/egl/main/eglmode.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| #ifndef EGLMODE_INCLUDED | ||||
| #define EGLMODE_INCLUDED | ||||
|  | ||||
| #include "egltypedefs.h" | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Data structure which corresponds to an EGLModeMESA. | ||||
|  */ | ||||
| struct _egl_mode | ||||
| { | ||||
|    EGLModeMESA Handle;     /* the public/opaque handle which names this mode */ | ||||
|    EGLint Width, Height;   /* size in pixels */ | ||||
|    EGLint RefreshRate;     /* rate * 1000.0 */ | ||||
|    EGLBoolean Stereo; | ||||
|    const char *Name; | ||||
|  | ||||
|    /* Other possible attributes */ | ||||
|    /* interlaced */ | ||||
|    /* external sync */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| extern _EGLMode * | ||||
| _eglLookupMode(EGLDisplay dpy, EGLModeMESA mode); | ||||
|  | ||||
|  | ||||
| extern _EGLMode * | ||||
| _eglAddMode(_EGLScreen *screen, EGLint width, EGLint height, | ||||
|             EGLint refreshRate, const char *name); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                    const EGLint *attrib_list, EGLModeMESA *modes, | ||||
|                    EGLint modes_size, EGLint *num_modes); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                  EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, | ||||
|                       EGLint attribute, EGLint *value); | ||||
|  | ||||
|  | ||||
| extern const char * | ||||
| _eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode); | ||||
|  | ||||
|  | ||||
| #endif /* EGLMODE_INCLUDED */ | ||||
							
								
								
									
										334
									
								
								src/egl/main/eglscreen.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										334
									
								
								src/egl/main/eglscreen.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,334 @@ | ||||
| /* | ||||
|  * Ideas for screen management extension to EGL. | ||||
|  * | ||||
|  * Each EGLDisplay has one or more screens (CRTs, Flat Panels, etc). | ||||
|  * The screens' handles can be obtained with eglGetScreensMESA(). | ||||
|  * | ||||
|  * A new kind of EGLSurface is possible- one which can be directly scanned | ||||
|  * out on a screen.  Such a surface is created with eglCreateScreenSurface(). | ||||
|  * | ||||
|  * To actually display a screen surface on a screen, the eglShowSurface() | ||||
|  * function is called. | ||||
|  */ | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "egldisplay.h" | ||||
| #include "eglglobals.h" | ||||
| #include "eglmode.h" | ||||
| #include "eglconfig.h" | ||||
| #include "eglsurface.h" | ||||
| #include "eglscreen.h" | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Initialize an _EGLScreen object to default values. | ||||
|  */ | ||||
| void | ||||
| _eglInitScreen(_EGLScreen *screen) | ||||
| { | ||||
|    /* just init to zero for now */ | ||||
|    memset(screen, 0, sizeof(_EGLScreen)); | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Given a public screen handle, return the internal _EGLScreen object. | ||||
|  */ | ||||
| _EGLScreen * | ||||
| _eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen) | ||||
| { | ||||
|    EGLint i; | ||||
|    _EGLDisplay *display = _eglLookupDisplay(dpy); | ||||
|  | ||||
|    if (!display) | ||||
|       return NULL; | ||||
|  | ||||
|    for (i = 0; i < display->NumScreens; i++) { | ||||
|       if (display->Screens[i]->Handle == screen) | ||||
|          return display->Screens[i]; | ||||
|    } | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Add the given _EGLScreen to the display's list of screens. | ||||
|  */ | ||||
| void | ||||
| _eglAddScreen(_EGLDisplay *display, _EGLScreen *screen) | ||||
| { | ||||
|    EGLint n; | ||||
|  | ||||
|    assert(display); | ||||
|    assert(screen); | ||||
|  | ||||
|    screen->Handle = _eglAllocScreenHandle(); | ||||
|    n = display->NumScreens; | ||||
|    display->Screens = realloc(display->Screens, (n+1) * sizeof(_EGLScreen *)); | ||||
|    display->Screens[n] = screen; | ||||
|    display->NumScreens++; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, | ||||
|                    EGLint max_screens, EGLint *num_screens) | ||||
| { | ||||
|    _EGLDisplay *display = _eglLookupDisplay(dpy); | ||||
|    EGLint n; | ||||
|  | ||||
|    if (!display) { | ||||
|       _eglError(EGL_BAD_DISPLAY, "eglGetScreensMESA"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    if (display->NumScreens > max_screens) { | ||||
|       n = max_screens; | ||||
|    } | ||||
|    else { | ||||
|       n = display->NumScreens; | ||||
|    } | ||||
|  | ||||
|    if (screens) { | ||||
|       EGLint i; | ||||
|       for (i = 0; i < n; i++) | ||||
|          screens[i] = display->Screens[i]->Handle; | ||||
|    } | ||||
|    if (num_screens) | ||||
|       *num_screens = n; | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Initialize the given _EGLSurface object.  Do error checking. | ||||
|  * Assign it an EGLSurface handle and insert into hash table. | ||||
|  * \return EGLSurface handle or EGL_NO_SURFACE if error. | ||||
|  */ | ||||
| EGLSurface | ||||
| _eglInitScreenSurface(_EGLSurface *surf, _EGLDriver *drv, EGLDisplay dpy, | ||||
|                       EGLConfig config, const EGLint *attrib_list) | ||||
| { | ||||
|    EGLint width = 0, height = 0; | ||||
|    EGLint i; | ||||
|  | ||||
|    for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { | ||||
|       switch (attrib_list[i]) { | ||||
|       case EGL_WIDTH: | ||||
|          width = attrib_list[++i]; | ||||
|          break; | ||||
|       case EGL_HEIGHT: | ||||
|          height = attrib_list[++i]; | ||||
|          break; | ||||
|       default: | ||||
|          _eglError(EGL_BAD_ATTRIBUTE, "eglCreateScreenSurfaceMESA"); | ||||
|          return EGL_NO_SURFACE; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    if (width <= 0 || height <= 0) { | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, | ||||
|                 "eglCreateScreenSurfaceMESA(width or height)"); | ||||
|       return EGL_NO_SURFACE; | ||||
|    } | ||||
|  | ||||
|    _eglInitSurface(surf); | ||||
|    surf->Width = width; | ||||
|    surf->Height = height; | ||||
|    surf->Type = EGL_SCREEN_BIT_MESA; | ||||
|    surf->Config =  _eglLookupConfig(drv, dpy, config); | ||||
|  | ||||
|    /* insert into hash table */ | ||||
|    _eglSaveSurface(surf); | ||||
|    assert(surf->Handle); | ||||
|  | ||||
|    return surf->Handle; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Create a drawing surface which can be directly displayed on a screen. | ||||
|  */ | ||||
| EGLSurface | ||||
| _eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, | ||||
|                             const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLSurface *surf; | ||||
|    EGLSurface surface; | ||||
|     | ||||
|    surf = (_EGLSurface *) malloc(sizeof(_EGLSurface)); | ||||
|    surface = _eglInitScreenSurface(surf, drv, dpy, config, attrib_list); | ||||
|    if (surface == EGL_NO_SURFACE) | ||||
|       free(surf); | ||||
|  | ||||
|    return surface; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Show the given surface on the named screen. | ||||
|  * If surface is EGL_NO_SURFACE, disable the screen's output. | ||||
|  *  | ||||
|  * This is just a placeholder function; drivers will always override | ||||
|  * this with code that _really_ shows the surface. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                     EGLSurface surface, EGLModeMESA m) | ||||
| { | ||||
|    _EGLScreen *scrn = _eglLookupScreen(dpy, screen); | ||||
|    _EGLMode *mode = _eglLookupMode(dpy, m); | ||||
|  | ||||
|    if (!scrn) { | ||||
|       _eglError(EGL_BAD_SCREEN_MESA, "eglShowSurfaceMESA"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|    if (!mode && (m != EGL_NO_MODE_MESA )) { | ||||
|       _eglError(EGL_BAD_MODE_MESA, "eglShowSurfaceMESA"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    if (surface == EGL_NO_SURFACE) { | ||||
|       scrn->CurrentSurface = NULL; | ||||
|    } else { | ||||
|       _EGLSurface *surf = _eglLookupSurface(surface); | ||||
|       if (!surf || surf->Type != EGL_SCREEN_BIT_MESA) { | ||||
|          _eglError(EGL_BAD_SURFACE, "eglShowSurfaceMESA"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|       if (surf->Width < mode->Width || surf->Height < mode->Height) { | ||||
|          _eglError(EGL_BAD_SURFACE, | ||||
|                    "eglShowSurfaceMESA(surface smaller than screen size)"); | ||||
|          return EGL_FALSE; | ||||
|       } | ||||
|  | ||||
|       scrn->CurrentSurface = surf; | ||||
|       scrn->CurrentMode = mode; | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Set a screen's current display mode. | ||||
|  * Note: mode = EGL_NO_MODE is valid (turns off the screen) | ||||
|  * | ||||
|  * This is just a placeholder function; drivers will always override | ||||
|  * this with code that _really_ sets the mode. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                    EGLModeMESA mode) | ||||
| { | ||||
|    _EGLScreen *scrn = _eglLookupScreen(dpy, screen); | ||||
|  | ||||
|    if (!scrn) { | ||||
|       _eglError(EGL_BAD_SCREEN_MESA, "eglScreenModeMESA"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    scrn->CurrentMode = _eglLookupMode(dpy, mode); | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Set a screen's surface origin. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy, | ||||
|                        EGLScreenMESA screen, EGLint x, EGLint y) | ||||
| { | ||||
|    _EGLScreen *scrn = _eglLookupScreen(dpy, screen); | ||||
|    if (!scrn) { | ||||
|       _eglError(EGL_BAD_SCREEN_MESA, "eglScreenPositionMESA"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    scrn->OriginX = x; | ||||
|    scrn->OriginY = y; | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Query a screen's current surface. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, | ||||
|                            EGLScreenMESA screen, EGLSurface *surface) | ||||
| { | ||||
|    const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); | ||||
|    if (scrn->CurrentSurface) | ||||
|       *surface = scrn->CurrentSurface->Handle; | ||||
|    else | ||||
|       *surface = EGL_NO_SURFACE; | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Query a screen's current mode. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                         EGLModeMESA *mode) | ||||
| { | ||||
|    const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); | ||||
|    if (scrn->CurrentMode) | ||||
|       *mode = scrn->CurrentMode->Handle; | ||||
|    else | ||||
|       *mode = EGL_NO_MODE_MESA; | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, | ||||
|                     EGLint attribute, EGLint *value) | ||||
| { | ||||
|    const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); | ||||
|  | ||||
|    if (!scrn) { | ||||
|       _eglError(EGL_BAD_SCREEN_MESA, "eglQueryScreenMESA"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    switch (attribute) { | ||||
|    case EGL_SCREEN_POSITION_MESA: | ||||
|       value[0] = scrn->OriginX; | ||||
|       value[1] = scrn->OriginY; | ||||
|       break; | ||||
|    default: | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, "eglQueryScreenMESA"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _eglDestroyScreenModes(_EGLScreen *scrn) | ||||
| { | ||||
|    free(scrn->Modes); | ||||
| } | ||||
|  | ||||
|        | ||||
| /** | ||||
|  * Default fallback routine - drivers should usually override this. | ||||
|  */ | ||||
| void | ||||
| _eglDestroyScreen(_EGLScreen *scrn) | ||||
| { | ||||
|    _eglDestroyScreenModes(scrn); | ||||
|    free(scrn); | ||||
| } | ||||
|  | ||||
							
								
								
									
										83
									
								
								src/egl/main/eglscreen.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								src/egl/main/eglscreen.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| #ifndef EGLSCREEN_INCLUDED | ||||
| #define EGLSCREEN_INCLUDED | ||||
|  | ||||
|  | ||||
| /* NOTE: there is no public EGLScreen type, we refers to screens with | ||||
|  * an integer. | ||||
|  */ | ||||
|  | ||||
| struct _egl_screen | ||||
| { | ||||
|    EGLScreenMESA Handle; /* The public/opaque handle which names this object */ | ||||
|  | ||||
|    _EGLMode *CurrentMode; | ||||
|    _EGLSurface *CurrentSurface; | ||||
|    EGLint OriginX, OriginY; | ||||
|  | ||||
|    EGLint NumModes; | ||||
|    _EGLMode *Modes;  /* array [NumModes] */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglInitScreen(_EGLScreen *screen); | ||||
|  | ||||
|  | ||||
| extern _EGLScreen * | ||||
| _eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglAddScreen(_EGLDisplay *display, _EGLScreen *screen); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); | ||||
|  | ||||
|  | ||||
| extern EGLSurface | ||||
| _eglInitScreenSurface(_EGLSurface *surf, _EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | ||||
|  | ||||
|                              | ||||
| extern EGLSurface | ||||
| _eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA mode); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglQueryDisplayMESA(_EGLDriver *drv, EGLDisplay dpy, EGLint attribute, EGLint *value); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, | ||||
|                            EGLScreenMESA screen, EGLSurface *surface); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglDestroyScreenModes(_EGLScreen *scrn); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglDestroyScreen(_EGLScreen *scrn); | ||||
|  | ||||
|  | ||||
| #endif /* EGLSCREEN_INCLUDED */ | ||||
							
								
								
									
										323
									
								
								src/egl/main/eglsurface.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										323
									
								
								src/egl/main/eglsurface.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,323 @@ | ||||
| /** | ||||
|  * Surface-related functions. | ||||
|  * | ||||
|  * See the eglcontext.c file for comments that also apply here. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include "eglcontext.h" | ||||
| #include "eglconfig.h" | ||||
| #include "eglsurface.h" | ||||
| #include "eglglobals.h" | ||||
| #include "eglhash.h" | ||||
|  | ||||
|  | ||||
| void | ||||
| _eglInitSurface(_EGLSurface *surf) | ||||
| { | ||||
|    /* XXX fix this up */ | ||||
|    memset(surf, 0, sizeof(_EGLSurface)); | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _eglSaveSurface(_EGLSurface *surf) | ||||
| { | ||||
|    assert(surf); | ||||
|    surf->Handle = _eglHashGenKey(_eglGlobal.Contexts); | ||||
|    _eglHashInsert(_eglGlobal.Surfaces, surf->Handle, surf); | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _eglRemoveSurface(_EGLSurface *surf) | ||||
| { | ||||
|    _eglHashRemove(_eglGlobal.Surfaces, surf->Handle); | ||||
| } | ||||
|  | ||||
|  | ||||
| _EGLSurface * | ||||
| _eglLookupSurface(EGLSurface surf) | ||||
| { | ||||
|    _EGLSurface *c = (_EGLSurface *) _eglHashLookup(_eglGlobal.Surfaces, surf); | ||||
|    return c; | ||||
| } | ||||
|  | ||||
|  | ||||
| _EGLSurface * | ||||
| _eglGetCurrentSurface(EGLint readdraw) | ||||
| { | ||||
|    _EGLContext *ctx = _eglGetCurrentContext(); | ||||
|    if (ctx) { | ||||
|       switch (readdraw) { | ||||
|       case EGL_DRAW: | ||||
|          return ctx->DrawSurface; | ||||
|       case EGL_READ: | ||||
|          return ctx->ReadSurface; | ||||
|       default: | ||||
|          return NULL; | ||||
|       } | ||||
|    } | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw) | ||||
| { | ||||
|    /* Basically just do error checking */ | ||||
|    _EGLContext *context = _eglGetCurrentContext(); | ||||
|    _EGLSurface *surface = _eglLookupSurface(draw); | ||||
|    if (context && context->DrawSurface != surface) { | ||||
|       _eglError(EGL_BAD_SURFACE, "eglSwapBuffers"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|    if (surface == NULL) { | ||||
|       _eglError(EGL_BAD_SURFACE, "eglSwapBuffers"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target) | ||||
| { | ||||
|    /* XXX unfinished */ | ||||
|    return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf, EGLint attribute, EGLint *value) | ||||
| { | ||||
|    _EGLSurface *surface = _eglLookupSurface(surf); | ||||
|    if (surface == NULL) { | ||||
|       _eglError(EGL_BAD_SURFACE, "eglQuerySurface"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|    switch (attribute) { | ||||
|    case EGL_WIDTH: | ||||
|       *value = surface->Width; | ||||
|       return EGL_TRUE; | ||||
|    case EGL_HEIGHT: | ||||
|       *value = surface->Height; | ||||
|       return EGL_TRUE; | ||||
|    case EGL_CONFIG_ID: | ||||
|       *value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID); | ||||
|       return EGL_TRUE; | ||||
|    case EGL_TEXTURE_FORMAT: | ||||
|       /* texture attributes: only for pbuffers, no error otherwise */ | ||||
|       if (surface->Type == EGL_PBUFFER_BIT) | ||||
|          *value = surface->TextureFormat; | ||||
|       return EGL_TRUE; | ||||
|    case EGL_TEXTURE_TARGET: | ||||
|       if (surface->Type == EGL_PBUFFER_BIT) | ||||
|          *value = surface->TextureTarget; | ||||
|       return EGL_TRUE; | ||||
|    case EGL_MIPMAP_TEXTURE: | ||||
|       if (surface->Type == EGL_PBUFFER_BIT) | ||||
|          *value = surface->MipmapTexture; | ||||
|       return EGL_TRUE; | ||||
|    case EGL_MIPMAP_LEVEL: | ||||
|       if (surface->Type == EGL_PBUFFER_BIT) | ||||
|          *value = surface->MipmapLevel; | ||||
|       return EGL_TRUE; | ||||
|    case EGL_SURFACE_TYPE: | ||||
|       *value = surface->Type; | ||||
|       return EGL_TRUE; | ||||
|    default: | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Default fallback routine - drivers should usually override this. | ||||
|  */ | ||||
| EGLSurface | ||||
| _eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list) | ||||
| { | ||||
|    /* nothing - just a placeholder */ | ||||
|    return EGL_NO_SURFACE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Default fallback routine - drivers should usually override this. | ||||
|  */ | ||||
| EGLSurface | ||||
| _eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list) | ||||
| { | ||||
|    /* nothing - just a placeholder */ | ||||
|    return EGL_NO_SURFACE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Default fallback routine - drivers should usually override this. | ||||
|  */ | ||||
| EGLSurface | ||||
| _eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) | ||||
| { | ||||
|    /* nothing - just a placeholder */ | ||||
|    return EGL_NO_SURFACE; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Default fallback routine - drivers should usually override this. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) | ||||
| { | ||||
|    _EGLSurface *surf = _eglLookupSurface(surface); | ||||
|    if (surf) { | ||||
|       _eglHashRemove(_eglGlobal.Surfaces, surface); | ||||
|       if (surf->IsBound) { | ||||
|          surf->DeletePending = EGL_TRUE; | ||||
|       } | ||||
|       else { | ||||
|          free(surf); | ||||
|       } | ||||
|       return EGL_TRUE; | ||||
|    } | ||||
|    else { | ||||
|       _eglError(EGL_BAD_SURFACE, "eglDestroySurface"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Default fallback routine - drivers might override this. | ||||
|  */ | ||||
| EGLBoolean | ||||
| _eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf, EGLint attribute, EGLint value) | ||||
| { | ||||
|    _EGLSurface *surface = _eglLookupSurface(surf); | ||||
|  | ||||
|    if (surface == NULL) { | ||||
|       _eglError(EGL_BAD_SURFACE, "eglSurfaceAttrib"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|  | ||||
|    switch (attribute) { | ||||
|    case EGL_MIPMAP_LEVEL: | ||||
|       surface->MipmapLevel = value; | ||||
|       break; | ||||
|    default: | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, "eglSurfaceAttrib"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer) | ||||
| { | ||||
|    /* XXX unfinished */ | ||||
|    return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer) | ||||
| { | ||||
|    /* XXX unfinished */ | ||||
|    return EGL_FALSE; | ||||
| } | ||||
|  | ||||
|  | ||||
| EGLBoolean | ||||
| _eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval) | ||||
| { | ||||
|    _EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW); | ||||
|    if (surf == NULL) { | ||||
|       _eglError(EGL_BAD_SURFACE, "eglSwapInterval"); | ||||
|       return EGL_FALSE; | ||||
|    } | ||||
|    surf->SwapInterval = interval; | ||||
|    return EGL_TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  ** EGL Surface Utility Functions.  This could be handy for device drivers. | ||||
|  **/ | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Initialize the fields of the given _EGLSurface object from the other | ||||
|  * parameters.  Do error checking too.  Allocate EGLSurface handle and | ||||
|  * insert into hash table. | ||||
|  * \return EGLSurface handle or EGL_NO_SURFACE if any error | ||||
|  */ | ||||
| EGLSurface | ||||
| _eglInitPbufferSurface(_EGLSurface *surface, _EGLDriver *drv, EGLDisplay dpy, | ||||
|                        EGLConfig config, const EGLint *attrib_list) | ||||
| { | ||||
|    _EGLConfig *conf; | ||||
|    EGLint width = 0, height = 0, largest = 0; | ||||
|    EGLint texFormat = 0, texTarget = 0, mipmapTex = 0; | ||||
|    EGLint i; | ||||
|  | ||||
|    conf = _eglLookupConfig(drv, dpy, config); | ||||
|    if (!conf) { | ||||
|       _eglError(EGL_BAD_CONFIG, "eglCreatePbufferSurface"); | ||||
|       return EGL_NO_SURFACE; | ||||
|    } | ||||
|  | ||||
|    for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { | ||||
|       switch (attrib_list[i]) { | ||||
|       case EGL_WIDTH: | ||||
|          width = attrib_list[++i]; | ||||
|          break; | ||||
|       case EGL_HEIGHT: | ||||
|          height = attrib_list[++i]; | ||||
|          break; | ||||
|       case EGL_LARGEST_PBUFFER: | ||||
|          largest = attrib_list[++i]; | ||||
|          break; | ||||
|       case EGL_TEXTURE_FORMAT: | ||||
|          texFormat = attrib_list[++i]; | ||||
|          break; | ||||
|       case EGL_TEXTURE_TARGET: | ||||
|          texTarget = attrib_list[++i]; | ||||
|          break; | ||||
|       case EGL_MIPMAP_TEXTURE: | ||||
|          mipmapTex = attrib_list[++i]; | ||||
|          break; | ||||
|       default: | ||||
|          _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface"); | ||||
|          return EGL_NO_SURFACE; | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    if (width <= 0 || height <= 0) { | ||||
|       _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface(width or height)"); | ||||
|       return EGL_NO_SURFACE; | ||||
|    } | ||||
|  | ||||
|    surface->Config = conf; | ||||
|    surface->Type = EGL_PBUFFER_BIT; | ||||
|    surface->Width = width; | ||||
|    surface->Height = height; | ||||
|    surface->TextureFormat = texFormat; | ||||
|    surface->TextureTarget = texTarget; | ||||
|    surface->MipmapTexture = mipmapTex; | ||||
|    surface->MipmapLevel = 0; | ||||
|    surface->SwapInterval = 0; | ||||
|  | ||||
|    /* insert into hash table */ | ||||
|    _eglSaveSurface(surface); | ||||
|    assert(surface->Handle); | ||||
|  | ||||
|    return surface->Handle; | ||||
| } | ||||
							
								
								
									
										100
									
								
								src/egl/main/eglsurface.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								src/egl/main/eglsurface.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | ||||
| #ifndef EGLSURFACE_INCLUDED | ||||
| #define EGLSURFACE_INCLUDED | ||||
|  | ||||
|  | ||||
| #include "egltypedefs.h" | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * "Base" class for device driver surfaces. | ||||
|  */ | ||||
| struct _egl_surface | ||||
| { | ||||
|    EGLSurface Handle;  /* The public/opaque handle which names this object */ | ||||
|    _EGLConfig *Config; | ||||
|  | ||||
|    /* May need reference counting here */ | ||||
|    EGLBoolean IsBound; | ||||
|    EGLBoolean DeletePending; | ||||
|  | ||||
|    EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */ | ||||
|    EGLint Width, Height; | ||||
|    EGLint TextureFormat, TextureTarget; | ||||
|    EGLint MipmapTexture, MipmapLevel; | ||||
|    EGLint SwapInterval; | ||||
|  | ||||
|    /* If type == EGL_SCREEN_BIT: */ | ||||
|    EGLint VisibleRefCount; /* number of screens I'm displayed on */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglInitSurface(_EGLSurface *surf); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglSaveSurface(_EGLSurface *surf); | ||||
|  | ||||
|  | ||||
| extern void | ||||
| _eglRemoveSurface(_EGLSurface *surf); | ||||
|  | ||||
|  | ||||
| extern _EGLSurface * | ||||
| _eglLookupSurface(EGLSurface surf); | ||||
|   | ||||
|  | ||||
| extern _EGLSurface * | ||||
| _eglGetCurrentSurface(EGLint readdraw); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); | ||||
|  | ||||
|  | ||||
| extern EGLSurface | ||||
| _eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); | ||||
|  | ||||
|  | ||||
| extern EGLSurface | ||||
| _eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list); | ||||
|  | ||||
|  | ||||
| extern EGLSurface | ||||
| _eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer); | ||||
|  | ||||
|  | ||||
| extern EGLBoolean | ||||
| _eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval); | ||||
|  | ||||
|  | ||||
|  | ||||
| extern EGLSurface | ||||
| _eglInitPbufferSurface(_EGLSurface *surface, _EGLDriver *drv, EGLDisplay dpy, | ||||
|                        EGLConfig config, const EGLint *attrib_list); | ||||
|  | ||||
| #endif /* EGLSURFACE_INCLUDED */ | ||||
							
								
								
									
										28
									
								
								src/egl/main/egltypedefs.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/egl/main/egltypedefs.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| #ifndef EGLTYPEDEFS_INCLUDED | ||||
| #define EGLTYPEDEFS_INCLUDED | ||||
|  | ||||
|  | ||||
| #include <GLES/egl.h> | ||||
|  | ||||
|  | ||||
| typedef struct _egl_config _EGLConfig; | ||||
|  | ||||
| typedef struct _egl_context _EGLContext; | ||||
|  | ||||
| typedef struct _egl_display _EGLDisplay; | ||||
|  | ||||
| typedef struct _egl_driver _EGLDriver; | ||||
|  | ||||
| typedef struct _egl_mode _EGLMode; | ||||
|  | ||||
| typedef struct _egl_screen _EGLScreen; | ||||
|  | ||||
| typedef struct _egl_surface _EGLSurface; | ||||
|  | ||||
|  | ||||
| typedef void (*_EGLProc)(); | ||||
|  | ||||
| typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy); | ||||
|  | ||||
|  | ||||
| #endif /* EGLTYPEDEFS_INCLUDED */ | ||||
| @@ -1,82 +0,0 @@ | ||||
| /nologo /W2 /GX- /ZI /Od /c /TP  | ||||
| /I "../../../include"  | ||||
| /I "./include"  | ||||
| /I "./libnurbs/interface" | ||||
| /I "./libnurbs/internals" | ||||
| /I "./libnurbs/nurbtess" | ||||
| /D "WIN32"  /D "_DEBUG"  /D "_WINDOWS"  /D "_MBCS"  | ||||
| /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD"  | ||||
| /Fo"Debug/" /Fd"Debug/" /GZ  | ||||
| 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 | ||||
| @@ -1,82 +0,0 @@ | ||||
| /nologo /W2 /GX- /O2 /c /TP  | ||||
| /I "../../../include"  | ||||
| /I "./include"  | ||||
| /I "./libnurbs/interface" | ||||
| /I "./libnurbs/internals" | ||||
| /I "./libnurbs/nurbtess" | ||||
| /D "WIN32"  /D "_WINDOWS"  /D "_MBCS"  | ||||
| /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD"  | ||||
| /Fo"Release/"  | ||||
| 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 | ||||
| @@ -1,888 +0,0 @@ | ||||
| # Microsoft Developer Studio Project File - Name="glu" - Package Owner=<4> | ||||
| # Microsoft Developer Studio Generated Build File, Format Version 6.00 | ||||
| # ** DO NOT EDIT ** | ||||
|  | ||||
| # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 | ||||
|  | ||||
| CFG=glu - Win32 Debug | ||||
| !MESSAGE This is not a valid makefile. To build this project using NMAKE, | ||||
| !MESSAGE use the Export Makefile command and run | ||||
| !MESSAGE  | ||||
| !MESSAGE NMAKE /f "glu.mak". | ||||
| !MESSAGE  | ||||
| !MESSAGE You can specify a configuration when running NMAKE | ||||
| !MESSAGE by defining the macro CFG on the command line. For example: | ||||
| !MESSAGE  | ||||
| !MESSAGE NMAKE /f "glu.mak" CFG="glu - Win32 Debug" | ||||
| !MESSAGE  | ||||
| !MESSAGE Possible choices for configuration are: | ||||
| !MESSAGE  | ||||
| !MESSAGE "glu - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") | ||||
| !MESSAGE "glu - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") | ||||
| !MESSAGE  | ||||
|  | ||||
| # Begin Project | ||||
| # PROP AllowPerConfigDependencies 0 | ||||
| # PROP Scc_ProjName "" | ||||
| # PROP Scc_LocalPath "" | ||||
| CPP=cl.exe | ||||
| MTL=midl.exe | ||||
| RSC=rc.exe | ||||
|  | ||||
| !IF  "$(CFG)" == "glu - Win32 Release" | ||||
|  | ||||
| # PROP BASE Use_MFC 0 | ||||
| # PROP BASE Use_Debug_Libraries 0 | ||||
| # PROP BASE Output_Dir "Release" | ||||
| # PROP BASE Intermediate_Dir "Release" | ||||
| # PROP BASE Target_Dir "" | ||||
| # PROP Use_MFC 0 | ||||
| # PROP Use_Debug_Libraries 0 | ||||
| # PROP Output_Dir "Release" | ||||
| # PROP Intermediate_Dir "Release" | ||||
| # PROP Ignore_Export_Lib 0 | ||||
| # PROP Target_Dir "" | ||||
| # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /c | ||||
| # ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../include" /I "./include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /YX /FD /c | ||||
| # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| # ADD BASE RSC /l 0x409 /d "NDEBUG" | ||||
| # ADD RSC /l 0x409 /d "NDEBUG" | ||||
| BSC32=bscmake.exe | ||||
| # ADD BASE BSC32 /nologo | ||||
| # ADD BSC32 /nologo | ||||
| LINK32=link.exe | ||||
| # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 | ||||
| # ADD LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/OPENGL32.LIB Release/GLUCC.LIB /nologo /dll /machine:I386 /nodefaultlib /out:"Release/GLU32.DLL" | ||||
| # Begin Special Build Tool | ||||
| SOURCE="$(InputPath)" | ||||
| PreLink_Cmds=cl @ccRelease.txt	LIB /OUT:Release/GLUCC.LIB @ccReleaseObj.txt | ||||
| PostBuild_Desc=Copy import lib and dll | ||||
| PostBuild_Cmds=if not exist ..\..\..\lib md ..\..\..\lib	copy Release\GLU32.LIB ..\..\..\lib	copy Release\GLU32.DLL ..\..\..\lib | ||||
| # End Special Build Tool | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "glu - Win32 Debug" | ||||
|  | ||||
| # PROP BASE Use_MFC 0 | ||||
| # PROP BASE Use_Debug_Libraries 1 | ||||
| # PROP BASE Output_Dir "Debug" | ||||
| # PROP BASE Intermediate_Dir "Debug" | ||||
| # PROP BASE Target_Dir "" | ||||
| # PROP Use_MFC 0 | ||||
| # PROP Use_Debug_Libraries 1 | ||||
| # PROP Output_Dir "Debug" | ||||
| # PROP Intermediate_Dir "Debug" | ||||
| # PROP Ignore_Export_Lib 0 | ||||
| # PROP Target_Dir "" | ||||
| # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /GZ /c | ||||
| # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "./include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FR /YX /FD /GZ /c | ||||
| # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 | ||||
| # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 | ||||
| # ADD BASE RSC /l 0x409 /d "_DEBUG" | ||||
| # ADD RSC /l 0x409 /d "_DEBUG" | ||||
| BSC32=bscmake.exe | ||||
| # ADD BASE BSC32 /nologo | ||||
| # ADD BSC32 /nologo | ||||
| LINK32=link.exe | ||||
| # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept | ||||
| # ADD LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/OPENGL32.LIB Debug/GLUCC.LIB /nologo /dll /debug /machine:I386 /nodefaultlib /out:"Debug/GLU32.DLL" /pdbtype:sept | ||||
| # Begin Special Build Tool | ||||
| SOURCE="$(InputPath)" | ||||
| PreLink_Desc=C++ compilations | ||||
| PreLink_Cmds=cl @ccDebug.txt	LIB /OUT:Debug/GLUCC.LIB @ccDebugObj.txt | ||||
| PostBuild_Desc=Copy import lib and dll | ||||
| PostBuild_Cmds=if not exist ..\..\..\lib md ..\..\..\lib	copy Debug\GLU32.LIB ..\..\..\lib	copy Debug\GLU32.DLL ..\..\..\lib | ||||
| # End Special Build Tool | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # Begin Target | ||||
|  | ||||
| # Name "glu - Win32 Release" | ||||
| # Name "glu - Win32 Debug" | ||||
| # Begin Group "Source Files" | ||||
|  | ||||
| # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\arc.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\arcsorter.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\arctess.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\backend.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\basiccrveval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\basicsurfeval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\bezierEval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\bezierPatch.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\bezierPatchMesh.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\bin.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\bufpool.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\cachingeval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\ccw.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\coveandtiler.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\curve.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\curvelist.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\curvesub.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\dataTransform.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\dict.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\directedLine.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\displaylist.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libutil\error.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\flist.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\flistsorter.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\geom.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glcurveval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glinterface.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glrenderer.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glsurfeval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\glu.def | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libutil\glue.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\gridWrap.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\hull.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\incurveeval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\insurfeval.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\intersect.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\knotvector.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mapdesc.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mapdescv.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\maplist.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\memalloc.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\mesh.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mesher.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libutil\mipmap.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\monoChain.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\monoPolyPart.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\monotonizer.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\monoTriangulation.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\monoTriangulationBackend.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mycode.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\normal.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\nurbsinterfac.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\nurbstess.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\partitionX.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\partitionY.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\patch.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\patchlist.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\polyDBG.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\polyUtil.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\primitiveStream.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\priorityq.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libutil\project.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libutil\quad.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\quicksort.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\quilt.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\reader.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\rectBlock.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libutil\registry.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\render.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\renderhints.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleComp.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleCompBot.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleCompRight.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleCompTop.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampledLine.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleMonoPoly.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\searchTree.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\slicer.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\sorter.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\splitarcs.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\subdivider.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\sweep.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\tess.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\tessmono.c | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\tobezier.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\trimline.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\trimregion.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\trimvertpool.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\uarray.cc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\varray.cc | ||||
| # End Source File | ||||
| # End Group | ||||
| # Begin Group "Header Files" | ||||
|  | ||||
| # PROP Default_Filter "h;hpp;hxx;hm;inl" | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\arc.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\arcsorter.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\arctess.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\backend.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\basiccrveval.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\basicsurfeval.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\bezierarc.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\bezierEval.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\bezierPatch.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\bezierPatchMesh.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\bin.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\bufpool.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\cachingeval.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\coveandtiler.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\curve.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\curvelist.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\dataTransform.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\defines.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\definitions.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=".\libtess\dict-list.h" | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\dict.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\directedLine.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\displaylist.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\displaymode.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\flist.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\flistsorter.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\geom.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glcurveval.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glimports.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\glimports.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glrenderer.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\glsurfeval.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libutil\gluint.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\include\gluos.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\gridline.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\gridtrimvertex.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\gridvertex.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\gridWrap.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\hull.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\jarcloc.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\knotvector.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mapdesc.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\maplist.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\memalloc.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\mesh.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mesher.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\monoChain.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\monoPolyPart.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\monotonizer.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\monoTriangulation.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\myassert.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mymath.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mysetjmp.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\mystdio.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\mystdio.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\interface\mystdlib.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\mystdlib.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\mystring.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\normal.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\nurbsconsts.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\nurbstess.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\partitionX.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\partitionY.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\patch.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\patchlist.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\polyDBG.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\polyUtil.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\primitiveStream.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=".\libtess\priorityq-sort.h" | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\priorityq.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\pwlarc.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\quicksort.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\quilt.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\reader.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\rectBlock.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\render.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\renderhints.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleComp.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleCompBot.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleCompRight.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleCompTop.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampledLine.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\sampleMonoPoly.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\searchTree.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\simplemath.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\slicer.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\sorter.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\subdivider.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\sweep.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\tess.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libtess\tessmono.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\trimline.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\trimregion.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\trimvertex.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\trimvertpool.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\types.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\uarray.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\internals\varray.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\libnurbs\nurbtess\zlassert.h | ||||
| # End Source File | ||||
| # End Group | ||||
| # Begin Group "Resource Files" | ||||
|  | ||||
| # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" | ||||
| # End Group | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\ccDebug.txt | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\ccDebugObj.txt | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\ccRelease.txt | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\ccReleaseObj.txt | ||||
| # End Source File | ||||
| # End Target | ||||
| # End Project | ||||
| @@ -1169,15 +1169,15 @@ static void halveImage_float(GLint components, GLuint width, GLuint height, | ||||
|     for (i = 0; i < newheight; i++) { | ||||
| 	for (j = 0; j < newwidth; j++) { | ||||
| 	    for (k = 0; k < components; k++) { | ||||
| 		GLuint b; | ||||
| 		b = __GLU_SWAP_4_BYTES(t); | ||||
| 		s[0] = *(GLfloat*)&b; | ||||
| 		b = __GLU_SWAP_4_BYTES(t+group_size); | ||||
| 		s[0] += *(GLfloat*)&b; | ||||
| 		b = __GLU_SWAP_4_BYTES(t+ysize); | ||||
| 		s[0] += *(GLfloat*)&b; | ||||
| 		b = __GLU_SWAP_4_BYTES(t+ysize+group_size); | ||||
| 		s[0] += *(GLfloat*)&b; | ||||
| 		union { GLuint b; GLfloat f; } swapbuf; | ||||
| 		swapbuf.b = __GLU_SWAP_4_BYTES(t); | ||||
| 		s[0] = swapbuf.f; | ||||
| 		swapbuf.b = __GLU_SWAP_4_BYTES(t+group_size); | ||||
| 		s[0] += swapbuf.f; | ||||
| 		swapbuf.b = __GLU_SWAP_4_BYTES(t+ysize); | ||||
| 		s[0] += swapbuf.f; | ||||
| 		swapbuf.b = __GLU_SWAP_4_BYTES(t+ysize+group_size); | ||||
| 		s[0] += swapbuf.f; | ||||
| 		s[0] /= 4; | ||||
| 		s++; t += element_size; | ||||
| 	    } | ||||
| @@ -2980,7 +2980,7 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
|     int l, m; | ||||
|     const char *left, *right; | ||||
|  | ||||
|     GLuint swapbuf;	/* unsigned buffer */ | ||||
|     union { GLuint b; GLfloat f; } swapbuf; | ||||
|  | ||||
|     if (widthin == widthout*2 && heightin == heightout*2) { | ||||
| 	halveImage_float(components, widthin, heightin, | ||||
| @@ -3029,8 +3029,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3041,8 +3041,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		    for (k = 0, temp_index = temp; k < components; | ||||
| 			 k++, temp_index += element_size) { | ||||
| 			if (myswap_bytes) { | ||||
| 			    swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += *(const GLfloat*)&swapbuf * y_percent; | ||||
| 			    swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += swapbuf.f * y_percent; | ||||
| 			} else { | ||||
| 			    totals[k] += *(const GLfloat*)temp_index * y_percent; | ||||
| 			} | ||||
| @@ -3054,8 +3054,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3068,8 +3068,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3079,8 +3079,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		    for (k = 0, temp_index = temp; k < components; | ||||
| 			 k++, temp_index += element_size) { | ||||
| 			if (myswap_bytes) { | ||||
| 			    swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += *(const GLfloat*)&swapbuf * y_percent; | ||||
| 			    swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += swapbuf.f * y_percent; | ||||
| 			} else { | ||||
| 			    totals[k] += *(const GLfloat*)temp_index * y_percent; | ||||
| 			} | ||||
| @@ -3091,8 +3091,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3105,10 +3105,10 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		    for (k = 0; k < components; | ||||
| 			 k++, left += element_size, right += element_size) { | ||||
| 			if (myswap_bytes) { | ||||
| 			    swapbuf = __GLU_SWAP_4_BYTES(left); | ||||
| 			    totals[k] += *(const GLfloat*)&swapbuf * (1-lowx_float); | ||||
| 			    swapbuf = __GLU_SWAP_4_BYTES(right); | ||||
| 			    totals[k] += *(const GLfloat*)&swapbuf * highx_float; | ||||
| 			    swapbuf.b = __GLU_SWAP_4_BYTES(left); | ||||
| 			    totals[k] += swapbuf.f * (1-lowx_float); | ||||
| 			    swapbuf.b = __GLU_SWAP_4_BYTES(right); | ||||
| 			    totals[k] += swapbuf.f * highx_float; | ||||
| 			} else { | ||||
| 			    totals[k] += *(const GLfloat*)left * (1-lowx_float) | ||||
| 				       + *(const GLfloat*)right * highx_float; | ||||
| @@ -3122,8 +3122,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3133,8 +3133,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		    for (k = 0, temp_index = temp; k < components; | ||||
| 			 k++, temp_index += element_size) { | ||||
| 			if (myswap_bytes) { | ||||
| 			    swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += *(const GLfloat*)&swapbuf * x_percent; | ||||
| 			    swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += swapbuf.f * x_percent; | ||||
| 			} else { | ||||
| 			    totals[k] += *(const GLfloat*)temp_index * x_percent; | ||||
| 			} | ||||
| @@ -3145,8 +3145,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3159,8 +3159,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3170,8 +3170,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		    for (k = 0, temp_index = temp; k < components; | ||||
| 			 k++, temp_index += element_size) { | ||||
| 			if (myswap_bytes) { | ||||
| 			    swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += *(const GLfloat*)&swapbuf * y_percent; | ||||
| 			    swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += swapbuf.f * y_percent; | ||||
| 			} else { | ||||
| 			    totals[k] += *(const GLfloat*)temp_index * y_percent; | ||||
| 			} | ||||
| @@ -3182,8 +3182,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3194,8 +3194,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		for (k = 0, temp_index = temp; k < components; | ||||
| 		     k++, temp_index += element_size) { | ||||
| 		    if (myswap_bytes) { | ||||
| 			swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += *(const GLfloat*)&swapbuf * percent; | ||||
| 			swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			totals[k] += swapbuf.f * percent; | ||||
| 		    } else { | ||||
| 			totals[k] += *(const GLfloat*)temp_index * percent; | ||||
| 		    } | ||||
| @@ -3211,8 +3211,8 @@ static void scale_internal_float(GLint components, GLint widthin, | ||||
| 		    for (k = 0, temp_index = temp; k < components; | ||||
| 			 k++, temp_index += element_size) { | ||||
| 			if (myswap_bytes) { | ||||
| 			    swapbuf = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += *(const GLfloat*)&swapbuf; | ||||
| 			    swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); | ||||
| 			    totals[k] += swapbuf.f; | ||||
| 			} else { | ||||
| 			    totals[k] += *(const GLfloat*)temp_index; | ||||
| 			} | ||||
| @@ -7397,19 +7397,17 @@ static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth, | ||||
|       GLint depthAtLevelOne= (depthPowerOf2 > 1) ? | ||||
| 			      depthPowerOf2 >> 1 : | ||||
| 			      depthPowerOf2; | ||||
|       GLenum proxyTarget; | ||||
|       GLenum proxyTarget = GL_PROXY_TEXTURE_3D; | ||||
|       assert(widthAtLevelOne > 0); | ||||
|       assert(heightAtLevelOne > 0); | ||||
|       assert(depthAtLevelOne > 0); | ||||
|  | ||||
|       /* does width x height x depth at level 1 & all their mipmaps fit? */ | ||||
|       if (target == GL_TEXTURE_3D || target == GL_PROXY_TEXTURE_3D) { | ||||
| 	 proxyTarget = GL_PROXY_TEXTURE_3D; | ||||
|       assert(target == GL_TEXTURE_3D || target == GL_PROXY_TEXTURE_3D); | ||||
|       gluTexImage3D(proxyTarget, 1, /* must be non-zero */ | ||||
|                     internalFormat, | ||||
|                     widthAtLevelOne,heightAtLevelOne,depthAtLevelOne, | ||||
|                     0,format,type,NULL); | ||||
|       } | ||||
|       glGetTexLevelParameteriv(proxyTarget, 1,GL_TEXTURE_WIDTH,&proxyWidth); | ||||
|       /* does it fit??? */ | ||||
|       if (proxyWidth == 0) { /* nope, so try again with these sizes */ | ||||
|   | ||||
| @@ -101,7 +101,7 @@ clean: | ||||
| 	-rm -f *.lo | ||||
| 	-rm -f *.la | ||||
| 	-rm -rf .libs | ||||
| 	-rm -rf depend | ||||
| 	-rm -rf depend depend.bak | ||||
|  | ||||
|  | ||||
| depend: $(SOURCES) | ||||
|   | ||||
| @@ -61,7 +61,7 @@ getFullCrosshairCursor(void) | ||||
|   Atom crosshairAtom, actualType; | ||||
|   int rc, actualFormat; | ||||
|   unsigned long n, left; | ||||
|   unsigned long *value; | ||||
|   unsigned char *value; | ||||
|  | ||||
|   if (fullCrosshairCusor == None) { | ||||
|     crosshairAtom = XInternAtom(__glutDisplay, | ||||
| @@ -70,9 +70,9 @@ getFullCrosshairCursor(void) | ||||
|       value = 0;        /* Make compiler happy. */ | ||||
|       rc = XGetWindowProperty(__glutDisplay, __glutRoot, | ||||
|         crosshairAtom, 0, 1, False, XA_CURSOR, &actualType, | ||||
|         &actualFormat, &n, &left, (unsigned char **) &value); | ||||
|         &actualFormat, &n, &left, &value); | ||||
|       if (rc == Success && actualFormat == 32 && n >= 1) { | ||||
|         cursor = value[0]; | ||||
|         cursor = ((unsigned long *)value)[0]; | ||||
|         XFree(value); | ||||
|         return cursor; | ||||
|       } | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user