Compare commits
	
		
			36 Commits
		
	
	
		
			mesa-10.6.
			...
			mesa_7_2_r
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 419353dc2f | ||
|  | 38d3b2262b | ||
|  | 4db2a7f36c | ||
|  | 1145042fd2 | ||
|  | 772131280a | ||
|  | ee913c0fcc | ||
|  | cd1804c43a | ||
|  | 253784d45e | ||
|  | 463d19d477 | ||
|  | 6e4fd90ca5 | ||
|  | 06188c0c5c | ||
|  | dec9097647 | ||
|  | e234339dba | ||
|  | bb09d23e92 | ||
|  | 1ffbcddb6f | ||
|  | 33cf8f5c06 | ||
|  | 7b8d878bed | ||
|  | 86ae34fbb4 | ||
|  | 16f3461fd6 | ||
|  | 0ac8886b51 | ||
|  | 1729d37223 | ||
|  | 81edef6f9f | ||
|  | e040e18c7b | ||
|  | 14d186644b | ||
|  | e4535e4d5e | ||
|  | a008813890 | ||
|  | da50dc7bb3 | ||
|  | 7f628d9cbc | ||
|  | b2ffd0be03 | ||
|  | 912b16c689 | ||
|  | 6d9b25e522 | ||
|  | 31bad23f0f | ||
|  | 29b9b25e72 | ||
|  | e794f496c6 | ||
|  | 68067c66d3 | ||
|  | ad5474e995 | 
							
								
								
									
										8
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Makefile
									
									
									
									
									
								
							| @@ -174,10 +174,10 @@ ultrix-gcc: | |||||||
|  |  | ||||||
| # Rules for making release tarballs | # Rules for making release tarballs | ||||||
|  |  | ||||||
| DIRECTORY = Mesa-7.1-rc4 | DIRECTORY = Mesa-7.2-rc1 | ||||||
| LIB_NAME = MesaLib-7.1-rc4 | LIB_NAME = MesaLib-7.2-rc1 | ||||||
| DEMO_NAME = MesaDemos-7.1-rc4 | DEMO_NAME = MesaDemos-7.2-rc1 | ||||||
| GLUT_NAME = MesaGLUT-7.1-rc4 | GLUT_NAME = MesaGLUT-7.2-rc1 | ||||||
|  |  | ||||||
| MAIN_FILES = \ | MAIN_FILES = \ | ||||||
| 	$(DIRECTORY)/Makefile*						\ | 	$(DIRECTORY)/Makefile*						\ | ||||||
|   | |||||||
| @@ -86,7 +86,6 @@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@ | |||||||
| DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ | DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ | ||||||
| LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ | LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ | ||||||
| LIBDRM_LIB = @LIBDRM_LIBS@ | LIBDRM_LIB = @LIBDRM_LIBS@ | ||||||
| DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ |  | ||||||
| EXPAT_INCLUDES = @EXPAT_INCLUDES@ | EXPAT_INCLUDES = @EXPAT_INCLUDES@ | ||||||
|  |  | ||||||
| # Autoconf directories | # Autoconf directories | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ CONFIG_NAME = default | |||||||
|  |  | ||||||
| # Version info | # Version info | ||||||
| MESA_MAJOR=7 | MESA_MAJOR=7 | ||||||
| MESA_MINOR=1 | MESA_MINOR=2 | ||||||
| MESA_TINY=0 | MESA_TINY=0 | ||||||
| MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) | MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,7 +23,6 @@ AC_CANONICAL_HOST | |||||||
|  |  | ||||||
| dnl Versions for external dependencies | dnl Versions for external dependencies | ||||||
| LIBDRM_REQUIRED=2.3.1 | LIBDRM_REQUIRED=2.3.1 | ||||||
| DRI2PROTO_REQUIRED=1.1 |  | ||||||
|  |  | ||||||
| dnl Check for progs | dnl Check for progs | ||||||
| AC_PROG_CPP | AC_PROG_CPP | ||||||
| @@ -531,7 +530,6 @@ dri) | |||||||
|  |  | ||||||
|     # Check for libdrm |     # Check for libdrm | ||||||
|     PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) |     PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) | ||||||
|     PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) |  | ||||||
|  |  | ||||||
|     # find the DRI deps for libGL |     # find the DRI deps for libGL | ||||||
|     if test "$x11_pkgconfig" = yes; then |     if test "$x11_pkgconfig" = yes; then | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ | |||||||
|  |  | ||||||
| <BODY> | <BODY> | ||||||
|  |  | ||||||
| <H1>Mesa Cell Driver</H1> | <H1>Mesa/Gallium Cell Driver</H1> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| The Mesa | The Mesa | ||||||
| @@ -23,18 +23,19 @@ Two phases are planned. | |||||||
| First, to implement the framework for parallel rasterization using the Cell | First, to implement the framework for parallel rasterization using the Cell | ||||||
| SPEs, including texture mapping. | SPEs, including texture mapping. | ||||||
| Second, to implement a full-featured OpenGL driver with support for GLSL, etc. | Second, to implement a full-featured OpenGL driver with support for GLSL, etc. | ||||||
|  | The second phase is now underway. | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
| <H2>Source Code</H2> | <H2>Source Code</H2> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| The Cell driver source code is on the <code>gallium-0.1</code> branch of the | The latest Cell driver source code is on the <code>gallium-0.2</code> branch | ||||||
| git repository. | of the Mesa git repository. | ||||||
| After you've cloned the repository, check out the branch with: | After you've cloned the repository, check out the branch with: | ||||||
| </p> | </p> | ||||||
| <pre> | <pre> | ||||||
|    git-checkout -b gallium-0.1 origin/gallium-0.1 |    git-checkout -b gallium-0.2 origin/gallium-0.2 | ||||||
| </pre> | </pre> | ||||||
| <p> | <p> | ||||||
| To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0). | To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0). | ||||||
| @@ -43,12 +44,13 @@ or the Cell Simulator (untested, though). | |||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| If using Cell SDK 3.0, first edit configs/linux-cell and add | If using Cell SDK 2.1, see the configs/linux-cell file for some | ||||||
| <code>-DSPU_MAIN_PARAM_LONG_LONG</code> to the SPU_CFLAGS. | special changes. | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| To compile the code, run <code>make linux-cell</code>. | To compile the code, run <code>make linux-cell</code>. | ||||||
|  | To build in debug mode, run <code>make linux-cell-debug</code>. | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| @@ -60,7 +62,7 @@ directory that contains <code>libGL.so</code>. | |||||||
| Verify that the Cell driver is being used by running <code>glxinfo</code> | Verify that the Cell driver is being used by running <code>glxinfo</code> | ||||||
| and looking for: | and looking for: | ||||||
| <pre> | <pre> | ||||||
|   OpenGL renderer string: Gallium 0.1, Cell on Xlib |   OpenGL renderer string: Gallium 0.2, Cell on Xlib | ||||||
| </pre> | </pre> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -77,21 +79,49 @@ SPU local store as needed. | |||||||
| Similarly, textures are tiled and brought into local store as needed. | Similarly, textures are tiled and brought into local store as needed. | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <p> |  | ||||||
| More recently, vertex transformation has been parallelized across the SPUs |  | ||||||
| as well. |  | ||||||
| </p> |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <H2>Status</H2> | <H2>Status</H2> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| As of February 2008 the driver supports smooth/flat shaded triangle rendering | As of September 2008, the driver supports smooth/flat shaded triangle rendering | ||||||
| with Z testing and simple texture mapping. | with Z testing and simple texture mapping. | ||||||
| Simple demos like gears run successfully. | Simple demos like gears run successfully. | ||||||
| To test texture mapping, try progs/demos/texcyl (press right mouse button for | To test texture mapping, try progs/demos/texcyl (press right mouse button for | ||||||
| rendering options). | rendering options). | ||||||
| </p> | </p> | ||||||
|  | <p> | ||||||
|  | Runtime/dynamic code generation is being done for per-fragment | ||||||
|  | operations (Z test, blend, etc) and for fragment programs (though only a | ||||||
|  | few opcodes are implemented now). | ||||||
|  | </p> | ||||||
|  | <p> | ||||||
|  | In general, however, the driver is rather slow because all vertex | ||||||
|  | transformation is being done by an interpreter running on the PPU. | ||||||
|  | Programs with many vertices or complex vertex shaders will run especially | ||||||
|  | slow. | ||||||
|  | This will be addressed in the future. | ||||||
|  | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <H2>Debug Options</H2> | ||||||
|  |  | ||||||
|  | <p> | ||||||
|  | The CELL_DEBUG env var can be set to a comma-separated list of one or | ||||||
|  | more of the following debug options: | ||||||
|  | </p> | ||||||
|  | <ul> | ||||||
|  | <li><b>checker</b> - use a different background clear color for each SPU. | ||||||
|  |    This lets you see which SPU is rendering which screen tiles. | ||||||
|  | <li><b>sync</b> - wait/synchronize after each DMA transfer | ||||||
|  | </ul> | ||||||
|  |  | ||||||
|  | <p> | ||||||
|  | If the GALLIUM_NOCELL env var is set, the softpipe driver will be used | ||||||
|  | intead of the Cell driver. | ||||||
|  | This is useful for comparison/validation. | ||||||
|  | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <H2>Contributing</H2> | <H2>Contributing</H2> | ||||||
|   | |||||||
| @@ -48,6 +48,7 @@ a:visited { | |||||||
| <li><a href="lists.html" target="MainFrame">Mailing Lists</a> | <li><a href="lists.html" target="MainFrame">Mailing Lists</a> | ||||||
| <li><a href="bugs.html" target="MainFrame">Bug Database</a> | <li><a href="bugs.html" target="MainFrame">Bug Database</a> | ||||||
| <li><a href="webmaster.html" target="MainFrame">Webmaster</a> | <li><a href="webmaster.html" target="MainFrame">Webmaster</a> | ||||||
|  | <li><a href="http://dri.freedesktop.org/" target="MainFrame">Wiki</a> | ||||||
| </ul> | </ul> | ||||||
|  |  | ||||||
| <b>User Topics</b> | <b>User Topics</b> | ||||||
|   | |||||||
| @@ -9,7 +9,9 @@ | |||||||
| <H1>Downloading</H1> | <H1>Downloading</H1> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| Last stable release: <b>7.0.4</b> | Current stable release: <b>7.2</b> | ||||||
|  | <br> | ||||||
|  | Current development: Mesa git/master | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
|   | |||||||
| @@ -22,9 +22,10 @@ for modern GPUs. | |||||||
|  |  | ||||||
| <p> | <p> | ||||||
| Mesa ties into several other open-source projects: the  | Mesa ties into several other open-source projects: the  | ||||||
| <a href="http://dri.sf.net/" target="_parent">Direct Rendering Infrastructure</a> | <a href="http://dri.freedesktop.org/" target="_parent">Direct Rendering  | ||||||
| and <a href="http://x.org" target="_parent">X.org</a> to provide OpenGL | Infrastructure</a> and <a href="http://x.org" target="_parent">X.org</a> to  | ||||||
| support to users of X on Linux, FreeBSD and other operating systems. | provide OpenGL support to users of X on Linux, FreeBSD and other operating  | ||||||
|  | systems. | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
| <H1>Mailing Lists</H1> | <H1>Mailing Lists</H1> | ||||||
|  |  | ||||||
|  |  | ||||||
| <p>There are four Mesa mailing lists: | <p>There are four Mesa 3D / DRI mailing lists: | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <ul> | <ul> | ||||||
| @@ -19,14 +19,14 @@ versions are sent to this list. | |||||||
| </li> | </li> | ||||||
| <br> | <br> | ||||||
| <li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-users" | <li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-users" | ||||||
| target="_parent">mesa3d-users</a> - intended for users of the Mesa library. | target="_parent">mesa3d-users</a> - intended for users of the Mesa and DRI. | ||||||
| Newbie questions are appropriate, but please try the general OpenGL | Newbie questions are appropriate, but please try the general OpenGL | ||||||
| resources and Mesa documentation first. | resources and Mesa/DRI documentation first. | ||||||
| </li> | </li> | ||||||
| <br> | <br> | ||||||
| <li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev" | <li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev" | ||||||
| target="_parent">mesa3d-dev</a> - for discussion of Mesa development. | target="_parent">mesa3d-dev</a> - for discussion of Mesa and Direct Rendering  | ||||||
| Not for beginners. | Infrastructure development. Not for beginners. | ||||||
| </li> | </li> | ||||||
| <br> | <br> | ||||||
| <li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-commit" | <li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-commit" | ||||||
| @@ -37,6 +37,9 @@ Note: the old mesa3d-cvs list is no longer in use. | |||||||
| </li> | </li> | ||||||
| </ul> | </ul> | ||||||
|  |  | ||||||
|  | <p>For mailing lists about Direct Rendering Modules (drm) in Linux/BSD  | ||||||
|  | kernels, see <a href="http://dri.freedesktop.org/wiki/MailingLists">wiki</a>. | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| <b>Notice</b>: non-member posts to any of these lists will be automatically | <b>Notice</b>: non-member posts to any of these lists will be automatically | ||||||
| rejected. | rejected. | ||||||
|   | |||||||
| @@ -11,6 +11,23 @@ | |||||||
| <H1>News</H1> | <H1>News</H1> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h2>September 15, 2008</h2> | ||||||
|  | <p> | ||||||
|  | <a href="relnotes-7.2.html">Mesa 7.2</a> is released. | ||||||
|  | This is stable, bug-fix release. | ||||||
|  | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h2>August 26, 2008</h2> | ||||||
|  | <p> | ||||||
|  | <a href="relnotes-7.1.html">Mesa 7.1</a> is released. | ||||||
|  | This is a new development release. | ||||||
|  | It should be relatively stable, but those especially concerned about | ||||||
|  | stability should wait for the 7.2 release or use Mesa 7.0.4 (the | ||||||
|  | previous stable release). | ||||||
|  | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
| <h2>August 16, 2008</h2> | <h2>August 16, 2008</h2> | ||||||
| <p> | <p> | ||||||
| <a href="relnotes-7.0.4.html">Mesa 7.0.4</a> is released. | <a href="relnotes-7.0.4.html">Mesa 7.0.4</a> is released. | ||||||
|   | |||||||
| @@ -8,28 +8,46 @@ | |||||||
|  |  | ||||||
| <body bgcolor="#eeeeee"> | <body bgcolor="#eeeeee"> | ||||||
|  |  | ||||||
| <H1>Mesa 7.1 Release Notes / May XX, 2008</H1> | <H1>Mesa 7.1 Release Notes / August 26, 2008</H1> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
| Mesa 7.1 is a new development release. | Mesa 7.1 is a new development release. | ||||||
| There have been many internal code changes since Mesa 7.0.x. | There have been many internal code changes since Mesa 7.0.x. | ||||||
| It should be relatively stable, but those who are especially concerned about | It should be relatively stable, but those who are especially concerned about | ||||||
| stability should wait for Mesa 7.2. | stability should wait for Mesa 7.2 or use Mesa 7.0.4 (the previous stable | ||||||
|  | release). | ||||||
|  | </p> | ||||||
|  | </> | ||||||
|  | Note that this version of Mesa does not use the GEM memory manager. | ||||||
|  | The master branch of git uses GEM. | ||||||
|  | </p> | ||||||
|  | <p> | ||||||
|  | DRM version 2.3.1 should be used with Mesa 7.1 | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
| <h2>MD5 checksums</h2> | <h2>MD5 checksums</h2> | ||||||
| <pre> | <pre> | ||||||
| TBD | 971c2fe6e6949dc5ba200a6f97a6dc81  MesaLib-7.1.tar.gz | ||||||
|  | 6bff7f532d16f90f944a400c8bd7074d  MesaLib-7.1.tar.bz2 | ||||||
|  | d48224bf9d54c3da6776adb4869ba024  MesaLib-7.1.zip | ||||||
|  | 3de268420efca43e9a19ab506cdfc993  MesaDemos-7.1.tar.gz | ||||||
|  | abfc9775e1462363af8ec160d1feb01f  MesaDemos-7.1.tar.bz2 | ||||||
|  | f7b3623387c4036e9895cd9ac0dfad99  MesaDemos-7.1.zip | ||||||
|  | fdf348f78cd09304b6ff801ef8acc8eb  MesaGLUT-7.1.tar.gz | ||||||
|  | f6d88a4eeb02e98c7e92f1c895d3c76b  MesaGLUT-7.1.tar.bz2 | ||||||
|  | 4dc102a5ca51e1c41dde87d3f8c7b22a  MesaGLUT-7.1.zip | ||||||
| </pre> | </pre> | ||||||
|  |  | ||||||
|  |  | ||||||
| <h2>New features</h2> | <h2>New features</h2> | ||||||
| <ul> | <ul> | ||||||
| <li>autoconf-based configuration (and clean-up of Makefiles) | <li>autoconf-based configuration (and clean-up of Makefiles) | ||||||
|  | <li>Assorted DRI driver enhancements | ||||||
| <li>Reduced dependencies between X server and Mesa | <li>Reduced dependencies between X server and Mesa | ||||||
| <li>GL_EXT_texture_from_pixmap extension for Xlib driver | <li>GL_EXT_texture_from_pixmap extension for Xlib driver | ||||||
| <li>Support for the GL shading language with i965 driver (implemented by Intel) | <li>Support for the GL shading language with i965 driver (implemented by Intel) | ||||||
|  | <li>ATI R500 series support (Radeon X1300–X1950) in r300 DRI driver | ||||||
| </ul> | </ul> | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -37,6 +55,7 @@ TBD | |||||||
| <ul> | <ul> | ||||||
| <li>Numerous GLSL fixes | <li>Numerous GLSL fixes | ||||||
| <li>Fixed some error code/detection bugs in the GLSL-related API functions | <li>Fixed some error code/detection bugs in the GLSL-related API functions | ||||||
|  | <li>Lots of DRI driver fixes. | ||||||
| </ul> | </ul> | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										86
									
								
								docs/relnotes-7.2.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								docs/relnotes-7.2.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,86 @@ | |||||||
|  | <HTML> | ||||||
|  |  | ||||||
|  | <TITLE>Mesa Release Notes</TITLE> | ||||||
|  |  | ||||||
|  | <head><link rel="stylesheet" type="text/css" href="mesa.css"></head> | ||||||
|  |  | ||||||
|  | <BODY> | ||||||
|  |  | ||||||
|  | <body bgcolor="#eeeeee"> | ||||||
|  |  | ||||||
|  | <H1>Mesa 7.2 Release Notes / (date tbd)</H1> | ||||||
|  |  | ||||||
|  | <p> | ||||||
|  | Mesa 7.2 is a stable release fixing bugs found in 7.1, which was a | ||||||
|  | new development release. | ||||||
|  | </p> | ||||||
|  | <p> | ||||||
|  | Mesa 7.2 implements the OpenGL 2.1 API, but the version reported by | ||||||
|  | glGetString(GL_VERSION) depends on the particular driver being used. | ||||||
|  | Some drivers don't support all the features required in OpenGL 2.1. | ||||||
|  | </p> | ||||||
|  | <p> | ||||||
|  | Note that this version of Mesa does not use the GEM memory manager. | ||||||
|  | The master branch of git uses GEM. | ||||||
|  | The prototype DRI2 code that was in 7.1 has also been removed. | ||||||
|  | </p> | ||||||
|  | <p> | ||||||
|  | DRM version 2.3.1 should be used with Mesa 7.2 | ||||||
|  | </p> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h2>MD5 checksums</h2> | ||||||
|  | <pre> | ||||||
|  | tbd | ||||||
|  | </pre> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h2>New features</h2> | ||||||
|  | <ul> | ||||||
|  | <li>i965 driver: added support for G41 chipset (Intel) | ||||||
|  | </ul> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h2>Bug fixes</h2> | ||||||
|  | <ul> | ||||||
|  | <li>Assorted bug fixes for Ming build | ||||||
|  | <li>Fixed some vertex/pixel buffer object reference counting bugs | ||||||
|  | <li>Fixed depth/stencil bug in i915/945 driver | ||||||
|  | <li>Fixed some shader flow control bugs in i965 driver | ||||||
|  | <li>Fixed a few tdfx driver bugs which prevented driver from working | ||||||
|  | </ul> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h2>To Do (someday) items</h2> | ||||||
|  | <ul> | ||||||
|  | <li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy(). | ||||||
|  | Probably do the same for malloc, calloc, etc. | ||||||
|  | The wrappers were useful in the past for memory debugging but now we | ||||||
|  | have valgrind.  Not worried about SunOS 4 support anymore either... | ||||||
|  | <li>Switch to freeglut | ||||||
|  | <li>Fix linux-glide target/driver. | ||||||
|  | <li>Improved lambda and derivative calculation for frag progs. | ||||||
|  | </ul> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <h2>Driver Status</h2> | ||||||
|  |  | ||||||
|  | <pre> | ||||||
|  | Driver			Status | ||||||
|  | ----------------------	---------------------- | ||||||
|  | DRI drivers		varies with the driver | ||||||
|  | XMesa/GLX (on Xlib)	implements OpenGL 2.1 | ||||||
|  | OSMesa (off-screen)	implements OpenGL 2.1 | ||||||
|  | Windows/Win32		implements OpenGL 2.1 | ||||||
|  | Glide (3dfx Voodoo1/2)	implements OpenGL 1.3 | ||||||
|  | SVGA			unsupported | ||||||
|  | Wind River UGL		unsupported | ||||||
|  | DJGPP			unsupported | ||||||
|  | GGI			unsupported | ||||||
|  | BeOS			unsupported | ||||||
|  | Allegro			unsupported | ||||||
|  | D3D			unsupported | ||||||
|  | </pre> | ||||||
|  |  | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
| @@ -20,6 +20,7 @@ The release notes summarize what's new or changed in each Mesa release. | |||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <UL> | <UL> | ||||||
|  | <LI><A HREF="relnotes-7.2.html">7.2 release notes</A> | ||||||
| <LI><A HREF="relnotes-7.1.html">7.1 release notes</A> | <LI><A HREF="relnotes-7.1.html">7.1 release notes</A> | ||||||
| <LI><A HREF="relnotes-7.0.4.html">7.0.4 release notes</A> | <LI><A HREF="relnotes-7.0.4.html">7.0.4 release notes</A> | ||||||
| <LI><A HREF="relnotes-7.0.3.html">7.0.3 release notes</A> | <LI><A HREF="relnotes-7.0.3.html">7.0.3 release notes</A> | ||||||
|   | |||||||
| @@ -114,7 +114,7 @@ static void calcposobs(void) | |||||||
|   rainParticle::setRainingArea(obs[0]-7.0f,-0.2f,obs[2]-7.0f,obs[0]+7.0f,8.0f,obs[2]+7.0f); |   rainParticle::setRainingArea(obs[0]-7.0f,-0.2f,obs[2]-7.0f,obs[0]+7.0f,8.0f,obs[2]+7.0f); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void printstring(void *font, char *string) | static void printstring(void *font, const char *string) | ||||||
| { | { | ||||||
|   int len,i; |   int len,i; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -447,7 +447,6 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) | |||||||
|    if (!ctx) { |    if (!ctx) { | ||||||
|       fprintf(stderr, "Error: glXCreateContext failed\n"); |       fprintf(stderr, "Error: glXCreateContext failed\n"); | ||||||
|       XFree(visinfo); |       XFree(visinfo); | ||||||
|       XDestroyWindow(dpy, win); |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ | |||||||
| #define __glumystdio_h_ | #define __glumystdio_h_ | ||||||
|  |  | ||||||
| #ifdef STANDALONE | #ifdef STANDALONE | ||||||
| inline void _glu_dprintf( char *, ... ) { } | inline void _glu_dprintf( const char *, ... ) { } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef LIBRARYBUILD | #ifdef LIBRARYBUILD | ||||||
| @@ -51,12 +51,12 @@ inline void _glu_dprintf( char *, ... ) { } | |||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #define _glu_dprintf printf | #define _glu_dprintf printf | ||||||
| #else | #else | ||||||
| inline void _glu_dprintf( char *, ... ) { } | inline void _glu_dprintf( const char *, ... ) { } | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef GLBUILD | #ifdef GLBUILD | ||||||
| inline void _glu_dprintf( char *, ... ) { } | inline void _glu_dprintf( const char *, ... ) { } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifndef NULL | #ifndef NULL | ||||||
|   | |||||||
| @@ -246,7 +246,7 @@ Backend::evalVStrip(int n_left, REAL u_left, REAL* left_val, | |||||||
|  *------------------------------------------------------------------------- |  *------------------------------------------------------------------------- | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| Backend::bgntmesh( char * )		 | Backend::bgntmesh( const char * )		 | ||||||
| { | { | ||||||
| #ifndef NOWIREFRAME | #ifndef NOWIREFRAME | ||||||
|  |  | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ public: | |||||||
|     void		surfbbox( long, REAL *, REAL * ); |     void		surfbbox( long, REAL *, REAL * ); | ||||||
|     void		surfgrid( REAL, REAL, long, REAL, REAL, long );  |     void		surfgrid( REAL, REAL, long, REAL, REAL, long );  | ||||||
|     void		surfmesh( long, long, long, long );  |     void		surfmesh( long, long, long, long );  | ||||||
|     void		bgntmesh( char * ); |     void		bgntmesh( const char * ); | ||||||
|     void		endtmesh( void ); |     void		endtmesh( void ); | ||||||
|     void		swaptmesh( void ); |     void		swaptmesh( void ); | ||||||
|     void		tmeshvert( GridTrimVertex * ); |     void		tmeshvert( GridTrimVertex * ); | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ | |||||||
|  * Pool - allocate a new pool of buffers |  * Pool - allocate a new pool of buffers | ||||||
|  *----------------------------------------------------------------------------- |  *----------------------------------------------------------------------------- | ||||||
|  */ |  */ | ||||||
| Pool::Pool( int _buffersize, int initpoolsize, char *n ) | Pool::Pool( int _buffersize, int initpoolsize, const char *n ) | ||||||
| { | { | ||||||
|     if((unsigned)_buffersize < sizeof(Buffer)) |     if((unsigned)_buffersize < sizeof(Buffer)) | ||||||
|         buffersize = sizeof(Buffer); |         buffersize = sizeof(Buffer); | ||||||
|   | |||||||
| @@ -55,7 +55,7 @@ class Buffer { | |||||||
|  |  | ||||||
| class Pool { | class Pool { | ||||||
| public: | public: | ||||||
| 			Pool( int, int, char * ); | 			Pool( int, int, const char * ); | ||||||
| 			~Pool( void ); | 			~Pool( void ); | ||||||
|     inline void*	new_buffer( void ); |     inline void*	new_buffer( void ); | ||||||
|     inline void		free_buffer( void * ); |     inline void		free_buffer( void * ); | ||||||
| @@ -74,7 +74,7 @@ protected: | |||||||
|     int			nextfree;		/* byte offset past next free buffer */ |     int			nextfree;		/* byte offset past next free buffer */ | ||||||
|     int			initsize; |     int			initsize; | ||||||
|     enum Magic { is_allocated = 0xf3a1, is_free = 0xf1a2 }; |     enum Magic { is_allocated = 0xf3a1, is_free = 0xf1a2 }; | ||||||
|     char		*name;			/* name of the pool */ |     const char		*name;			/* name of the pool */ | ||||||
|     Magic		magic;			/* marker for valid pool */ |     Magic		magic;			/* marker for valid pool */ | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -126,7 +126,7 @@ int Knotvector::validate( void ) | |||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| void Knotvector::show( char *msg ) | void Knotvector::show( const char *msg ) | ||||||
| { | { | ||||||
| #ifndef NDEBUG | #ifndef NDEBUG | ||||||
|     _glu_dprintf( "%s\n", msg ); |     _glu_dprintf( "%s\n", msg ); | ||||||
|   | |||||||
| @@ -49,7 +49,7 @@ struct Knotvector { /* a knot vector */ | |||||||
| 			~Knotvector( void ); | 			~Knotvector( void ); | ||||||
|     void		init( long, long, long, INREAL * ); |     void		init( long, long, long, INREAL * ); | ||||||
|     int			validate( void ); |     int			validate( void ); | ||||||
|     void 		show( char * ); |     void 		show( const char * ); | ||||||
|  |  | ||||||
|     long		order;		/* order of spline  */ |     long		order;		/* order of spline  */ | ||||||
|     long		knotcount;	/* number of knots  */ |     long		knotcount;	/* number of knots  */ | ||||||
|   | |||||||
| @@ -677,7 +677,7 @@ NurbsTessellator::do_nurbserror( int msg ) | |||||||
| } | } | ||||||
|  |  | ||||||
| int  | int  | ||||||
| NurbsTessellator::do_check_knots( Knotvector *knots, char *msg ) | NurbsTessellator::do_check_knots( Knotvector *knots, const char *msg ) | ||||||
| { | { | ||||||
|     int status = knots->validate(); |     int status = knots->validate(); | ||||||
|     if( status ) { |     if( status ) { | ||||||
|   | |||||||
| @@ -112,7 +112,7 @@ protected: | |||||||
| private: | private: | ||||||
|  |  | ||||||
|     void		resetObjects( void ); |     void		resetObjects( void ); | ||||||
|     int			do_check_knots( Knotvector *, char * ); |     int			do_check_knots( Knotvector *, const char * ); | ||||||
|     void		do_nurbserror( int ); |     void		do_nurbserror( int ); | ||||||
|     void		do_bgncurve( O_curve * ); |     void		do_bgncurve( O_curve * ); | ||||||
|     void		do_endcurve( void ); |     void		do_endcurve( void ); | ||||||
|   | |||||||
| @@ -35,9 +35,7 @@ SOURCES = \ | |||||||
| 	  dri_common.c \ | 	  dri_common.c \ | ||||||
| 	  dri_glx.c \ | 	  dri_glx.c \ | ||||||
| 	  XF86dri.c \ | 	  XF86dri.c \ | ||||||
| 	  glxhash.c \ | 	  glxhash.c | ||||||
| 	  dri2_glx.c \ |  | ||||||
| 	  dri2.c |  | ||||||
|  |  | ||||||
| include $(TOP)/src/mesa/sources | include $(TOP)/src/mesa/sources | ||||||
|  |  | ||||||
| @@ -53,7 +51,6 @@ INCLUDES = -I. \ | |||||||
| 	-I$(TOP)/src/mesa/main \ | 	-I$(TOP)/src/mesa/main \ | ||||||
| 	-I$(TOP)/src/mesa/glapi \ | 	-I$(TOP)/src/mesa/glapi \ | ||||||
| 	$(LIBDRM_CFLAGS) \ | 	$(LIBDRM_CFLAGS) \ | ||||||
| 	$(DRI2PROTO_CFLAGS) \ |  | ||||||
| 	$(X11_INCLUDES) | 	$(X11_INCLUDES) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,252 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright © 2008 Red Hat, Inc. |  | ||||||
|  * |  | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  | ||||||
|  * copy of this software and associated documentation files (the "Soft- |  | ||||||
|  * ware"), to deal in the Software without restriction, including without |  | ||||||
|  * limitation the rights to use, copy, modify, merge, publish, distribute, |  | ||||||
|  * and/or sell copies of the Software, and to permit persons to whom the |  | ||||||
|  * Software is furnished to do so, provided that the above copyright |  | ||||||
|  * notice(s) and this permission notice appear in all copies of the Soft- |  | ||||||
|  * ware and that both the above copyright notice(s) and this permission |  | ||||||
|  * notice appear in supporting documentation. |  | ||||||
|  * |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |  | ||||||
|  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |  | ||||||
|  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY |  | ||||||
|  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN |  | ||||||
|  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- |  | ||||||
|  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |  | ||||||
|  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |  | ||||||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- |  | ||||||
|  * MANCE OF THIS SOFTWARE. |  | ||||||
|  * |  | ||||||
|  * Except as contained in this notice, the name of a copyright holder shall |  | ||||||
|  * not be used in advertising or otherwise to promote the sale, use or |  | ||||||
|  * other dealings in this Software without prior written authorization of |  | ||||||
|  * the copyright holder. |  | ||||||
|  * |  | ||||||
|  * Authors: |  | ||||||
|  *   Kristian Høgsberg (krh@redhat.com) |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #define NEED_REPLIES |  | ||||||
| #include <X11/Xlibint.h> |  | ||||||
| #include <X11/extensions/Xext.h> |  | ||||||
| #include <X11/extensions/extutil.h> |  | ||||||
| #include <X11/extensions/dri2proto.h> |  | ||||||
| #include "glheader.h" |  | ||||||
| #include "xf86drm.h" |  | ||||||
| #include "dri2.h" |  | ||||||
|  |  | ||||||
| static char dri2ExtensionName[] = DRI2_NAME; |  | ||||||
| static XExtensionInfo *dri2Info; |  | ||||||
| static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info) |  | ||||||
| static /* const */ XExtensionHooks dri2ExtensionHooks = { |  | ||||||
|     NULL,				/* create_gc */ |  | ||||||
|     NULL,				/* copy_gc */ |  | ||||||
|     NULL,				/* flush_gc */ |  | ||||||
|     NULL,				/* free_gc */ |  | ||||||
|     NULL,				/* create_font */ |  | ||||||
|     NULL,				/* free_font */ |  | ||||||
|     DRI2CloseDisplay,			/* close_display */ |  | ||||||
|     NULL,				/* wire_to_event */ |  | ||||||
|     NULL,				/* event_to_wire */ |  | ||||||
|     NULL,				/* error */ |  | ||||||
|     NULL,				/* error_string */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, dri2Info,  |  | ||||||
| 				   dri2ExtensionName,  |  | ||||||
| 				   &dri2ExtensionHooks,  |  | ||||||
| 				   0, NULL) |  | ||||||
|  |  | ||||||
| Bool DRI2QueryExtension(Display *dpy, int *eventBase, int *errorBase) |  | ||||||
| { |  | ||||||
|     XExtDisplayInfo *info = DRI2FindDisplay(dpy); |  | ||||||
|  |  | ||||||
|     if (XextHasExtension(info)) { |  | ||||||
| 	*eventBase = info->codes->first_event; |  | ||||||
| 	*errorBase = info->codes->first_error; |  | ||||||
| 	return True; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return False; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Bool DRI2QueryVersion(Display *dpy, int *major, int *minor) |  | ||||||
| { |  | ||||||
|     XExtDisplayInfo *info = DRI2FindDisplay (dpy); |  | ||||||
|     xDRI2QueryVersionReply rep; |  | ||||||
|     xDRI2QueryVersionReq *req; |  | ||||||
|  |  | ||||||
|     XextCheckExtension (dpy, info, dri2ExtensionName, False); |  | ||||||
|  |  | ||||||
|     LockDisplay(dpy); |  | ||||||
|     GetReq(DRI2QueryVersion, req); |  | ||||||
|     req->reqType = info->codes->major_opcode; |  | ||||||
|     req->dri2ReqType = X_DRI2QueryVersion; |  | ||||||
|     req->majorVersion = DRI2_MAJOR; |  | ||||||
|     req->minorVersion = DRI2_MINOR; |  | ||||||
|     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { |  | ||||||
| 	UnlockDisplay(dpy); |  | ||||||
| 	SyncHandle(); |  | ||||||
| 	return False; |  | ||||||
|     } |  | ||||||
|     *major = rep.majorVersion; |  | ||||||
|     *minor = rep.minorVersion; |  | ||||||
|     UnlockDisplay(dpy); |  | ||||||
|     SyncHandle(); |  | ||||||
|  |  | ||||||
|     return True; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Bool DRI2Connect(Display *dpy, int screen, |  | ||||||
| 		 char **driverName, char **busId, unsigned int *sareaHandle) |  | ||||||
| { |  | ||||||
|     XExtDisplayInfo *info = DRI2FindDisplay(dpy); |  | ||||||
|     xDRI2ConnectReply rep; |  | ||||||
|     xDRI2ConnectReq *req; |  | ||||||
|  |  | ||||||
|     XextCheckExtension (dpy, info, dri2ExtensionName, False); |  | ||||||
|  |  | ||||||
|     LockDisplay(dpy); |  | ||||||
|     GetReq(DRI2Connect, req); |  | ||||||
|     req->reqType = info->codes->major_opcode; |  | ||||||
|     req->dri2ReqType = X_DRI2Connect; |  | ||||||
|     req->screen = screen; |  | ||||||
|     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { |  | ||||||
| 	UnlockDisplay(dpy); |  | ||||||
| 	SyncHandle(); |  | ||||||
| 	return False; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     *sareaHandle = rep.sareaHandle; |  | ||||||
|  |  | ||||||
|     *driverName = Xmalloc(rep.driverNameLength + 1); |  | ||||||
|     if (*driverName == NULL) { |  | ||||||
| 	_XEatData(dpy,  |  | ||||||
| 		  ((rep.driverNameLength + 3) & ~3) + |  | ||||||
| 		  ((rep.busIdLength + 3) & ~3)); |  | ||||||
| 	UnlockDisplay(dpy); |  | ||||||
| 	SyncHandle(); |  | ||||||
| 	return False; |  | ||||||
|     } |  | ||||||
|     _XReadPad(dpy, *driverName, rep.driverNameLength); |  | ||||||
|     (*driverName)[rep.driverNameLength] = '\0'; |  | ||||||
|  |  | ||||||
|     *busId = Xmalloc(rep.busIdLength + 1); |  | ||||||
|     if (*busId == NULL) { |  | ||||||
| 	Xfree(*driverName); |  | ||||||
| 	_XEatData(dpy, ((rep.busIdLength + 3) & ~3)); |  | ||||||
| 	UnlockDisplay(dpy); |  | ||||||
| 	SyncHandle(); |  | ||||||
| 	return False; |  | ||||||
|     } |  | ||||||
|     _XReadPad(dpy, *busId, rep.busIdLength); |  | ||||||
|     (*busId)[rep.busIdLength] = '\0'; |  | ||||||
|  |  | ||||||
|     UnlockDisplay(dpy); |  | ||||||
|     SyncHandle(); |  | ||||||
|  |  | ||||||
|     return rep.sareaHandle != 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Bool DRI2AuthConnection(Display *dpy, int screen, drm_magic_t magic) |  | ||||||
| { |  | ||||||
|     XExtDisplayInfo *info = DRI2FindDisplay(dpy); |  | ||||||
|     xDRI2AuthConnectionReq *req; |  | ||||||
|     xDRI2AuthConnectionReply rep; |  | ||||||
|  |  | ||||||
|     XextCheckExtension (dpy, info, dri2ExtensionName, False); |  | ||||||
|  |  | ||||||
|     LockDisplay(dpy); |  | ||||||
|     GetReq(DRI2AuthConnection, req); |  | ||||||
|     req->reqType = info->codes->major_opcode; |  | ||||||
|     req->dri2ReqType = X_DRI2AuthConnection; |  | ||||||
|     req->screen = screen; |  | ||||||
|     req->magic = magic; |  | ||||||
|     rep.authenticated = 0; |  | ||||||
|     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { |  | ||||||
| 	UnlockDisplay(dpy); |  | ||||||
| 	SyncHandle(); |  | ||||||
| 	return False; |  | ||||||
|     } |  | ||||||
|     UnlockDisplay(dpy); |  | ||||||
|     SyncHandle(); |  | ||||||
|  |  | ||||||
|     return rep.authenticated; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Bool DRI2CreateDrawable(Display *dpy, XID drawable, |  | ||||||
| 			unsigned int *handle, unsigned int *head) |  | ||||||
| { |  | ||||||
|     XExtDisplayInfo *info = DRI2FindDisplay(dpy); |  | ||||||
|     xDRI2CreateDrawableReply rep; |  | ||||||
|     xDRI2CreateDrawableReq *req; |  | ||||||
|  |  | ||||||
|     XextCheckExtension (dpy, info, dri2ExtensionName, False); |  | ||||||
|  |  | ||||||
|     LockDisplay(dpy); |  | ||||||
|     GetReq(DRI2CreateDrawable, req); |  | ||||||
|     req->reqType = info->codes->major_opcode; |  | ||||||
|     req->dri2ReqType = X_DRI2CreateDrawable; |  | ||||||
|     req->drawable = drawable; |  | ||||||
|     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { |  | ||||||
| 	UnlockDisplay(dpy); |  | ||||||
| 	SyncHandle(); |  | ||||||
| 	return False; |  | ||||||
|     } |  | ||||||
|     UnlockDisplay(dpy); |  | ||||||
|     SyncHandle(); |  | ||||||
|  |  | ||||||
|     *handle = rep.handle; |  | ||||||
|     *head = rep.head; |  | ||||||
|  |  | ||||||
|     return True; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void DRI2DestroyDrawable(Display *dpy, XID drawable) |  | ||||||
| { |  | ||||||
|     XExtDisplayInfo *info = DRI2FindDisplay(dpy); |  | ||||||
|     xDRI2DestroyDrawableReq *req; |  | ||||||
|  |  | ||||||
|     XextSimpleCheckExtension (dpy, info, dri2ExtensionName); |  | ||||||
|  |  | ||||||
|     XSync(dpy, GL_FALSE); |  | ||||||
|  |  | ||||||
|     LockDisplay(dpy); |  | ||||||
|     GetReq(DRI2DestroyDrawable, req); |  | ||||||
|     req->reqType = info->codes->major_opcode; |  | ||||||
|     req->dri2ReqType = X_DRI2DestroyDrawable; |  | ||||||
|     req->drawable = drawable; |  | ||||||
|     UnlockDisplay(dpy); |  | ||||||
|     SyncHandle(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Bool DRI2ReemitDrawableInfo(Display *dpy, XID drawable, unsigned int *head) |  | ||||||
| { |  | ||||||
|     XExtDisplayInfo *info = DRI2FindDisplay(dpy); |  | ||||||
|     xDRI2ReemitDrawableInfoReply rep; |  | ||||||
|     xDRI2ReemitDrawableInfoReq *req; |  | ||||||
|  |  | ||||||
|     XextCheckExtension (dpy, info, dri2ExtensionName, False); |  | ||||||
|  |  | ||||||
|     LockDisplay(dpy); |  | ||||||
|     GetReq(DRI2ReemitDrawableInfo, req); |  | ||||||
|     req->reqType = info->codes->major_opcode; |  | ||||||
|     req->dri2ReqType = X_DRI2ReemitDrawableInfo; |  | ||||||
|     req->drawable = drawable; |  | ||||||
|     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { |  | ||||||
| 	UnlockDisplay(dpy); |  | ||||||
| 	SyncHandle(); |  | ||||||
| 	return False; |  | ||||||
|     } |  | ||||||
|     UnlockDisplay(dpy); |  | ||||||
|     SyncHandle(); |  | ||||||
|  |  | ||||||
|     *head = rep.head; |  | ||||||
|  |  | ||||||
|     return True; |  | ||||||
| } |  | ||||||
| @@ -1,53 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright © 2007,2008 Red Hat, Inc. |  | ||||||
|  * |  | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  | ||||||
|  * copy of this software and associated documentation files (the "Soft- |  | ||||||
|  * ware"), to deal in the Software without restriction, including without |  | ||||||
|  * limitation the rights to use, copy, modify, merge, publish, distribute, |  | ||||||
|  * and/or sell copies of the Software, and to permit persons to whom the |  | ||||||
|  * Software is furnished to do so, provided that the above copyright |  | ||||||
|  * notice(s) and this permission notice appear in all copies of the Soft- |  | ||||||
|  * ware and that both the above copyright notice(s) and this permission |  | ||||||
|  * notice appear in supporting documentation. |  | ||||||
|  * |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |  | ||||||
|  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |  | ||||||
|  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY |  | ||||||
|  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN |  | ||||||
|  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- |  | ||||||
|  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |  | ||||||
|  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |  | ||||||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- |  | ||||||
|  * MANCE OF THIS SOFTWARE. |  | ||||||
|  * |  | ||||||
|  * Except as contained in this notice, the name of a copyright holder shall |  | ||||||
|  * not be used in advertising or otherwise to promote the sale, use or |  | ||||||
|  * other dealings in this Software without prior written authorization of |  | ||||||
|  * the copyright holder. |  | ||||||
|  * |  | ||||||
|  * Authors: |  | ||||||
|  *   Kristian Høgsberg (krh@redhat.com) |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _DRI2_H_ |  | ||||||
| #define _DRI2_H_ |  | ||||||
|  |  | ||||||
| extern Bool |  | ||||||
| DRI2QueryExtension(Display *display, int *eventBase, int *errorBase); |  | ||||||
| extern Bool |  | ||||||
| DRI2QueryVersion(Display *display, int *major, int *minor); |  | ||||||
| extern Bool |  | ||||||
| DRI2Connect(Display *display, int screen, |  | ||||||
| 	    char **driverName, char **busId, unsigned int *sareaHandle); |  | ||||||
| extern Bool |  | ||||||
| DRI2AuthConnection(Display *display, int screen, drm_magic_t magic); |  | ||||||
| extern Bool |  | ||||||
| DRI2CreateDrawable(Display *display, XID drawable, |  | ||||||
| 		   unsigned int *handle, unsigned int *head); |  | ||||||
| extern void |  | ||||||
| DRI2DestroyDrawable(Display *display, XID handle); |  | ||||||
| extern Bool |  | ||||||
| DRI2ReemitDrawableInfo(Display *dpy, XID handle, unsigned int *head); |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| @@ -1,371 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright © 2008 Red Hat, Inc. |  | ||||||
|  * |  | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  | ||||||
|  * copy of this software and associated documentation files (the "Soft- |  | ||||||
|  * ware"), to deal in the Software without restriction, including without |  | ||||||
|  * limitation the rights to use, copy, modify, merge, publish, distribute, |  | ||||||
|  * and/or sell copies of the Software, and to permit persons to whom the |  | ||||||
|  * Software is furnished to do so, provided that the above copyright |  | ||||||
|  * notice(s) and this permission notice appear in all copies of the Soft- |  | ||||||
|  * ware and that both the above copyright notice(s) and this permission |  | ||||||
|  * notice appear in supporting documentation. |  | ||||||
|  * |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |  | ||||||
|  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |  | ||||||
|  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY |  | ||||||
|  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN |  | ||||||
|  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- |  | ||||||
|  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |  | ||||||
|  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |  | ||||||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- |  | ||||||
|  * MANCE OF THIS SOFTWARE. |  | ||||||
|  * |  | ||||||
|  * Except as contained in this notice, the name of a copyright holder shall |  | ||||||
|  * not be used in advertising or otherwise to promote the sale, use or |  | ||||||
|  * other dealings in this Software without prior written authorization of |  | ||||||
|  * the copyright holder. |  | ||||||
|  * |  | ||||||
|  * Authors: |  | ||||||
|  *   Kristian Høgsberg (krh@redhat.com) |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifdef GLX_DIRECT_RENDERING |  | ||||||
|  |  | ||||||
| #include <X11/Xlib.h> |  | ||||||
| #include <X11/extensions/Xfixes.h> |  | ||||||
| #include <X11/extensions/Xdamage.h> |  | ||||||
| #include "glheader.h" |  | ||||||
| #include "glxclient.h" |  | ||||||
| #include "glcontextmodes.h" |  | ||||||
| #include "xf86dri.h" |  | ||||||
| #include "sarea.h" |  | ||||||
| #include <dlfcn.h> |  | ||||||
| #include <sys/types.h> |  | ||||||
| #include <sys/mman.h> |  | ||||||
| #include "xf86drm.h" |  | ||||||
| #include "dri2.h" |  | ||||||
| #include "dri_common.h" |  | ||||||
|  |  | ||||||
| typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate; |  | ||||||
| typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate; |  | ||||||
|  |  | ||||||
| struct __GLXDRIdisplayPrivateRec { |  | ||||||
|     __GLXDRIdisplay base; |  | ||||||
|  |  | ||||||
|     /* |  | ||||||
|     ** XFree86-DRI version information |  | ||||||
|     */ |  | ||||||
|     int driMajor; |  | ||||||
|     int driMinor; |  | ||||||
|     int driPatch; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| struct __GLXDRIcontextPrivateRec { |  | ||||||
|     __GLXDRIcontext base; |  | ||||||
|     __DRIcontext *driContext; |  | ||||||
|     __GLXscreenConfigs *psc; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static void dri2DestroyContext(__GLXDRIcontext *context, |  | ||||||
| 			      __GLXscreenConfigs *psc, Display *dpy) |  | ||||||
| { |  | ||||||
|     __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context; |  | ||||||
|     const __DRIcoreExtension *core = pcp->psc->core; |  | ||||||
|  |  | ||||||
|     (*core->destroyContext)(pcp->driContext); |  | ||||||
|  |  | ||||||
|     Xfree(pcp); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static Bool dri2BindContext(__GLXDRIcontext *context, |  | ||||||
| 			   __GLXDRIdrawable *draw, __GLXDRIdrawable *read) |  | ||||||
| { |  | ||||||
|     __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context; |  | ||||||
|     const __DRIcoreExtension *core = pcp->psc->core; |  | ||||||
|  |  | ||||||
|     return (*core->bindContext)(pcp->driContext, |  | ||||||
| 				draw->driDrawable, |  | ||||||
| 				read->driDrawable); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void dri2UnbindContext(__GLXDRIcontext *context) |  | ||||||
| { |  | ||||||
|     __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context; |  | ||||||
|     const __DRIcoreExtension *core = pcp->psc->core; |  | ||||||
|  |  | ||||||
|     (*core->unbindContext)(pcp->driContext); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static __GLXDRIcontext *dri2CreateContext(__GLXscreenConfigs *psc, |  | ||||||
| 					 const __GLcontextModes *mode, |  | ||||||
| 					 GLXContext gc, |  | ||||||
| 					 GLXContext shareList, int renderType) |  | ||||||
| { |  | ||||||
|     __GLXDRIcontextPrivate *pcp, *pcp_shared; |  | ||||||
|     __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; |  | ||||||
|     const __DRIcoreExtension *core = psc->core; |  | ||||||
|     __DRIcontext *shared = NULL; |  | ||||||
|  |  | ||||||
|     if (shareList) { |  | ||||||
| 	pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext; |  | ||||||
| 	shared = pcp_shared->driContext; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     pcp = Xmalloc(sizeof *pcp); |  | ||||||
|     if (pcp == NULL) |  | ||||||
| 	return NULL; |  | ||||||
|  |  | ||||||
|     pcp->psc = psc; |  | ||||||
|     pcp->driContext =  |  | ||||||
| 	(*core->createNewContext)(psc->__driScreen, |  | ||||||
| 				  config->driConfig, shared, pcp); |  | ||||||
|     gc->__driContext = pcp->driContext; |  | ||||||
|  |  | ||||||
|     if (pcp->driContext == NULL) { |  | ||||||
| 	Xfree(pcp); |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     pcp->base.destroyContext = dri2DestroyContext; |  | ||||||
|     pcp->base.bindContext = dri2BindContext; |  | ||||||
|     pcp->base.unbindContext = dri2UnbindContext; |  | ||||||
|  |  | ||||||
|     return &pcp->base; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void dri2DestroyDrawable(__GLXDRIdrawable *pdraw) |  | ||||||
| { |  | ||||||
|     const __DRIcoreExtension *core = pdraw->psc->core; |  | ||||||
|  |  | ||||||
|     (*core->destroyDrawable)(pdraw->driDrawable); |  | ||||||
|     DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->drawable); |  | ||||||
|     Xfree(pdraw); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc, |  | ||||||
| 					    XID xDrawable, |  | ||||||
| 					    GLXDrawable drawable, |  | ||||||
| 					    const __GLcontextModes *modes) |  | ||||||
| { |  | ||||||
|     __GLXDRIdrawable *pdraw; |  | ||||||
|     __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; |  | ||||||
|     unsigned int handle, head; |  | ||||||
|     const __DRIcoreExtension *core = psc->core; |  | ||||||
|  |  | ||||||
|     pdraw = Xmalloc(sizeof(*pdraw)); |  | ||||||
|     if (!pdraw) |  | ||||||
| 	return NULL; |  | ||||||
|  |  | ||||||
|     pdraw->destroyDrawable = dri2DestroyDrawable; |  | ||||||
|     pdraw->xDrawable = xDrawable; |  | ||||||
|     pdraw->drawable = drawable; |  | ||||||
|     pdraw->psc = psc; |  | ||||||
|  |  | ||||||
|     fprintf(stderr, "calling DRI2CreateDrawable, XID 0x%lx, GLX ID 0x%lx\n", |  | ||||||
| 	    xDrawable, drawable); |  | ||||||
|  |  | ||||||
|     if (!DRI2CreateDrawable(psc->dpy, xDrawable, &handle, &head)) { |  | ||||||
| 	Xfree(pdraw); |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     fprintf(stderr, "success, head 0x%x, handle 0x%x\n", head, handle); |  | ||||||
|  |  | ||||||
|     /* Create a new drawable */ |  | ||||||
|     pdraw->driDrawable = |  | ||||||
| 	(*core->createNewDrawable)(psc->__driScreen, |  | ||||||
| 				   config->driConfig, |  | ||||||
| 				   handle, |  | ||||||
| 				   head, |  | ||||||
| 				   pdraw); |  | ||||||
|  |  | ||||||
|     if (!pdraw->driDrawable) { |  | ||||||
| 	DRI2DestroyDrawable(psc->dpy, drawable); |  | ||||||
| 	Xfree(pdraw); |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return pdraw; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void dri2DestroyScreen(__GLXscreenConfigs *psc) |  | ||||||
| { |  | ||||||
|     /* Free the direct rendering per screen data */ |  | ||||||
|     (*psc->core->destroyScreen)(psc->__driScreen); |  | ||||||
|     drmClose(psc->fd); |  | ||||||
|     psc->__driScreen = NULL; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static void dri2ReemitDrawableInfo(__DRIdrawable *draw, unsigned int *tail, |  | ||||||
| 				    void *loaderPrivate) |  | ||||||
| { |  | ||||||
|     __GLXDRIdrawable *pdraw = loaderPrivate; |  | ||||||
|  |  | ||||||
|     DRI2ReemitDrawableInfo(pdraw->psc->dpy, pdraw->drawable, tail); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void dri2PostDamage(__DRIdrawable *draw, |  | ||||||
| 			   struct drm_clip_rect *rects, |  | ||||||
| 			   int numRects, void *loaderPrivate) |  | ||||||
| {  |  | ||||||
|     XRectangle *xrects; |  | ||||||
|     XserverRegion region; |  | ||||||
|     __GLXDRIdrawable *glxDraw = loaderPrivate; |  | ||||||
|     __GLXscreenConfigs *psc = glxDraw->psc; |  | ||||||
|     Display *dpy = psc->dpy; |  | ||||||
|     int i; |  | ||||||
|  |  | ||||||
|     xrects = malloc(sizeof(XRectangle) * numRects); |  | ||||||
|     if (xrects == NULL) |  | ||||||
| 	return; |  | ||||||
|  |  | ||||||
|     for (i = 0; i < numRects; i++) { |  | ||||||
| 	xrects[i].x = rects[i].x1; |  | ||||||
| 	xrects[i].y = rects[i].y1; |  | ||||||
| 	xrects[i].width = rects[i].x2 - rects[i].x1; |  | ||||||
| 	xrects[i].height = rects[i].y2 - rects[i].y1; |  | ||||||
|     } |  | ||||||
|     region = XFixesCreateRegion(dpy, xrects, numRects); |  | ||||||
|     free(xrects); |  | ||||||
|     XDamageAdd(dpy, glxDraw->xDrawable, region); |  | ||||||
|     XFixesDestroyRegion(dpy, region); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static const __DRIloaderExtension dri2LoaderExtension = { |  | ||||||
|     { __DRI_LOADER, __DRI_LOADER_VERSION }, |  | ||||||
|     dri2ReemitDrawableInfo, |  | ||||||
|     dri2PostDamage |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static const __DRIextension *loader_extensions[] = { |  | ||||||
|     &dri2LoaderExtension.base, |  | ||||||
|     &systemTimeExtension.base, |  | ||||||
|     NULL |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, |  | ||||||
| 					__GLXdisplayPrivate *priv) |  | ||||||
| { |  | ||||||
|     const __DRIconfig **driver_configs; |  | ||||||
|     const __DRIextension **extensions; |  | ||||||
|     __GLXDRIscreen *psp; |  | ||||||
|     unsigned int sareaHandle; |  | ||||||
|     char *driverName, *busID; |  | ||||||
|     drm_magic_t magic; |  | ||||||
|     int i; |  | ||||||
|  |  | ||||||
|     psp = Xmalloc(sizeof *psp); |  | ||||||
|     if (psp == NULL) |  | ||||||
| 	return NULL; |  | ||||||
|  |  | ||||||
|     /* Initialize per screen dynamic client GLX extensions */ |  | ||||||
|     psc->ext_list_first_time = GL_TRUE; |  | ||||||
|  |  | ||||||
|     if (!DRI2Connect(psc->dpy, screen, &driverName, &busID, &sareaHandle)) |  | ||||||
| 	return NULL; |  | ||||||
|  |  | ||||||
|     psc->driver = driOpenDriver(driverName); |  | ||||||
|     if (psc->driver == NULL) |  | ||||||
| 	goto handle_error; |  | ||||||
|  |  | ||||||
|     extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS); |  | ||||||
|     if (extensions == NULL) { |  | ||||||
| 	ErrorMessageF("driver exports no extensions (%s)\n", dlerror()); |  | ||||||
| 	goto handle_error; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     for (i = 0; extensions[i]; i++) { |  | ||||||
| 	if (strcmp(extensions[i]->name, __DRI_CORE) == 0) |  | ||||||
| 	    psc->core = (__DRIcoreExtension *) extensions[i]; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (psc->core == NULL) { |  | ||||||
| 	ErrorMessageF("core dri extension not found\n"); |  | ||||||
| 	goto handle_error; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     psc->fd = drmOpen(NULL, busID); |  | ||||||
|     if (psc->fd < 0) { |  | ||||||
| 	ErrorMessageF("failed to open drm device: %s\n", strerror(errno)); |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (drmGetMagic(psc->fd, &magic)) |  | ||||||
| 	return NULL; |  | ||||||
|  |  | ||||||
|     if (!DRI2AuthConnection(psc->dpy, screen, magic)) { |  | ||||||
| 	ErrorMessageF("failed to authenticate drm access\n"); |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     psc->__driScreen =  |  | ||||||
| 	psc->core->createNewScreen(screen, psc->fd, sareaHandle, |  | ||||||
| 				   loader_extensions, &driver_configs, psc); |  | ||||||
|     if (psc->__driScreen == NULL) { |  | ||||||
| 	ErrorMessageF("failed to create dri screen\n"); |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     driBindExtensions(psc, 1); |  | ||||||
|  |  | ||||||
|     psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); |  | ||||||
|     psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); |  | ||||||
|  |  | ||||||
|     psp->destroyScreen = dri2DestroyScreen; |  | ||||||
|     psp->createContext = dri2CreateContext; |  | ||||||
|     psp->createDrawable = dri2CreateDrawable; |  | ||||||
|  |  | ||||||
|     Xfree(driverName); |  | ||||||
|     Xfree(busID); |  | ||||||
|  |  | ||||||
|     return psp; |  | ||||||
|  |  | ||||||
|  handle_error: |  | ||||||
|     Xfree(driverName); |  | ||||||
|     Xfree(busID); |  | ||||||
|  |  | ||||||
|     /* FIXME: clean up here */ |  | ||||||
|  |  | ||||||
|     return NULL; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* Called from __glXFreeDisplayPrivate. |  | ||||||
|  */ |  | ||||||
| static void dri2DestroyDisplay(__GLXDRIdisplay *dpy) |  | ||||||
| { |  | ||||||
|     Xfree(dpy); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Allocate, initialize and return a __DRIdisplayPrivate object. |  | ||||||
|  * This is called from __glXInitialize() when we are given a new |  | ||||||
|  * display pointer. |  | ||||||
|  */ |  | ||||||
| _X_HIDDEN __GLXDRIdisplay *dri2CreateDisplay(Display *dpy) |  | ||||||
| { |  | ||||||
|     __GLXDRIdisplayPrivate *pdp; |  | ||||||
|     int eventBase, errorBase; |  | ||||||
|  |  | ||||||
|     if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) |  | ||||||
| 	return NULL; |  | ||||||
|  |  | ||||||
|     pdp = Xmalloc(sizeof *pdp); |  | ||||||
|     if (pdp == NULL) |  | ||||||
| 	return NULL; |  | ||||||
|  |  | ||||||
|     if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) { |  | ||||||
| 	Xfree(pdp); |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     pdp->driPatch = 0; |  | ||||||
|  |  | ||||||
|     pdp->base.destroyDisplay = dri2DestroyDisplay; |  | ||||||
|     pdp->base.createScreen = dri2CreateScreen; |  | ||||||
|  |  | ||||||
|     return &pdp->base; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #endif /* GLX_DIRECT_RENDERING */ |  | ||||||
| @@ -151,7 +151,6 @@ struct __GLXDRIdrawableRec { | |||||||
| */ | */ | ||||||
| extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy); | extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy); | ||||||
| extern __GLXDRIdisplay *driCreateDisplay(Display *dpy); | extern __GLXDRIdisplay *driCreateDisplay(Display *dpy); | ||||||
| extern __GLXDRIdisplay *dri2CreateDisplay(Display *dpy); |  | ||||||
|  |  | ||||||
| extern void DRI_glXUseXFont( Font font, int first, int count, int listbase ); | extern void DRI_glXUseXFont( Font font, int first, int count, int listbase ); | ||||||
|  |  | ||||||
| @@ -570,7 +569,6 @@ struct __GLXdisplayPrivateRec { | |||||||
|      */ |      */ | ||||||
|     __GLXDRIdisplay *driswDisplay; |     __GLXDRIdisplay *driswDisplay; | ||||||
|     __GLXDRIdisplay *driDisplay; |     __GLXDRIdisplay *driDisplay; | ||||||
|     __GLXDRIdisplay *dri2Display; |  | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -207,10 +207,6 @@ static int __glXFreeDisplayPrivate(XExtData *extension) | |||||||
|     if (priv->driDisplay) |     if (priv->driDisplay) | ||||||
| 	(*priv->driDisplay->destroyDisplay)(priv->driDisplay); | 	(*priv->driDisplay->destroyDisplay)(priv->driDisplay); | ||||||
|     priv->driDisplay = NULL; |     priv->driDisplay = NULL; | ||||||
|  |  | ||||||
|     if (priv->dri2Display) |  | ||||||
| 	(*priv->dri2Display->destroyDisplay)(priv->dri2Display); |  | ||||||
|     priv->dri2Display = NULL; |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     Xfree((char*) priv); |     Xfree((char*) priv); | ||||||
| @@ -608,9 +604,6 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) | |||||||
| 	if (psc->drawHash == NULL) | 	if (psc->drawHash == NULL) | ||||||
| 	    continue; | 	    continue; | ||||||
|  |  | ||||||
| 	if (priv->dri2Display) |  | ||||||
| 	    psc->driScreen = (*priv->dri2Display->createScreen)(psc, i, priv); |  | ||||||
|  |  | ||||||
| 	if (psc->driScreen == NULL && priv->driDisplay) | 	if (psc->driScreen == NULL && priv->driDisplay) | ||||||
| 	    psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv); | 	    psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv); | ||||||
|  |  | ||||||
| @@ -716,7 +709,6 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy) | |||||||
|     ** (e.g., those called in AllocAndFetchScreenConfigs). |     ** (e.g., those called in AllocAndFetchScreenConfigs). | ||||||
|     */ |     */ | ||||||
|     if (glx_direct && glx_accel) { |     if (glx_direct && glx_accel) { | ||||||
| 	dpyPriv->dri2Display = dri2CreateDisplay(dpy); |  | ||||||
| 	dpyPriv->driDisplay = driCreateDisplay(dpy); | 	dpyPriv->driDisplay = driCreateDisplay(dpy); | ||||||
|     } |     } | ||||||
|     if (glx_direct) |     if (glx_direct) | ||||||
|   | |||||||
| @@ -193,7 +193,13 @@ void __indirect_glGetVertexAttribivARB( GLuint index, GLenum pname, | |||||||
|     get_vertex_attrib( gc, 1303, index, pname, (xReply *) & reply ); |     get_vertex_attrib( gc, 1303, index, pname, (xReply *) & reply ); | ||||||
|  |  | ||||||
|     if ( reply.size != 0 ) { |     if ( reply.size != 0 ) { | ||||||
| 	if ( ! get_attrib_array_data( state, index, pname, params ) ) { | 	GLintptr data; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	if ( get_attrib_array_data( state, index, pname, & data ) ) { | ||||||
|  | 	    *params = (GLint) data; | ||||||
|  | 	} | ||||||
|  | 	else { | ||||||
| 	    if (reply.size == 1) { | 	    if (reply.size == 1) { | ||||||
| 		*params = (GLint) reply.pad3; | 		*params = (GLint) reply.pad3; | ||||||
| 	    }  | 	    }  | ||||||
|   | |||||||
| @@ -154,7 +154,7 @@ DRIVER_SOURCES = \ | |||||||
| endif | endif | ||||||
| endif | endif | ||||||
|  |  | ||||||
| SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES) | SOURCES = $(MESA_SOURCES) $(GLAPI_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES) | ||||||
|  |  | ||||||
| OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) | OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -177,7 +177,7 @@ static GLboolean debug_variable_length_prim( struct debug_stream *stream ) | |||||||
|  |  | ||||||
| #define BITS( dw, hi, lo, ... )				\ | #define BITS( dw, hi, lo, ... )				\ | ||||||
| do {							\ | do {							\ | ||||||
|    unsigned himask = ~0UL >> (31 - (hi));		\ |    unsigned himask = 0xffffffffU >> (31 - (hi));		\ | ||||||
|    PRINTF("\t\t ");				\ |    PRINTF("\t\t ");				\ | ||||||
|    PRINTF(__VA_ARGS__);			\ |    PRINTF(__VA_ARGS__);			\ | ||||||
|    PRINTF(": 0x%x\n", ((dw) & himask) >> (lo));	\ |    PRINTF(": 0x%x\n", ((dw) & himask) >> (lo));	\ | ||||||
|   | |||||||
| @@ -78,7 +78,7 @@ translate_texture_format(GLuint mesa_format, GLenum DepthMode) | |||||||
|       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); |       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); | ||||||
|    case MESA_FORMAT_RGBA_DXT5: |    case MESA_FORMAT_RGBA_DXT5: | ||||||
|       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); |       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); | ||||||
|    case MESA_FORMAT_Z24_S8: |    case MESA_FORMAT_S8_Z24: | ||||||
|       return (MAPSURF_32BIT | MT_32BIT_xI824); |       return (MAPSURF_32BIT | MT_32BIT_xI824); | ||||||
|    default: |    default: | ||||||
|       fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format); |       fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format); | ||||||
|   | |||||||
| @@ -513,6 +513,8 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) | |||||||
|    insn->header.compression_control = BRW_COMPRESSION_NONE; |    insn->header.compression_control = BRW_COMPRESSION_NONE; | ||||||
|    insn->header.predicate_control = BRW_PREDICATE_NORMAL; |    insn->header.predicate_control = BRW_PREDICATE_NORMAL; | ||||||
|    insn->header.mask_control = BRW_MASK_ENABLE; |    insn->header.mask_control = BRW_MASK_ENABLE; | ||||||
|  |    if (!p->single_program_flow) | ||||||
|  |        insn->header.thread_control = BRW_THREAD_SWITCH; | ||||||
|  |  | ||||||
|    p->current->header.predicate_control = BRW_PREDICATE_NONE; |    p->current->header.predicate_control = BRW_PREDICATE_NONE; | ||||||
|  |  | ||||||
| @@ -538,6 +540,8 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, | |||||||
|    insn->header.compression_control = BRW_COMPRESSION_NONE; |    insn->header.compression_control = BRW_COMPRESSION_NONE; | ||||||
|    insn->header.execution_size = if_insn->header.execution_size; |    insn->header.execution_size = if_insn->header.execution_size; | ||||||
|    insn->header.mask_control = BRW_MASK_ENABLE; |    insn->header.mask_control = BRW_MASK_ENABLE; | ||||||
|  |    if (!p->single_program_flow) | ||||||
|  |        insn->header.thread_control = BRW_THREAD_SWITCH; | ||||||
|  |  | ||||||
|    /* Patch the if instruction to point at this instruction. |    /* Patch the if instruction to point at this instruction. | ||||||
|     */ |     */ | ||||||
| @@ -579,6 +583,7 @@ void brw_ENDIF(struct brw_compile *p, | |||||||
|       insn->header.compression_control = BRW_COMPRESSION_NONE; |       insn->header.compression_control = BRW_COMPRESSION_NONE; | ||||||
|       insn->header.execution_size = patch_insn->header.execution_size; |       insn->header.execution_size = patch_insn->header.execution_size; | ||||||
|       insn->header.mask_control = BRW_MASK_ENABLE; |       insn->header.mask_control = BRW_MASK_ENABLE; | ||||||
|  |       insn->header.thread_control = BRW_THREAD_SWITCH; | ||||||
|  |  | ||||||
|       assert(patch_insn->bits3.if_else.jump_count == 0); |       assert(patch_insn->bits3.if_else.jump_count == 0); | ||||||
|  |  | ||||||
| @@ -617,7 +622,7 @@ struct brw_instruction *brw_BREAK(struct brw_compile *p) | |||||||
|    brw_set_src1(insn, brw_imm_d(0x0)); |    brw_set_src1(insn, brw_imm_d(0x0)); | ||||||
|    insn->header.compression_control = BRW_COMPRESSION_NONE; |    insn->header.compression_control = BRW_COMPRESSION_NONE; | ||||||
|    insn->header.execution_size = BRW_EXECUTE_8; |    insn->header.execution_size = BRW_EXECUTE_8; | ||||||
|    insn->header.mask_control = BRW_MASK_DISABLE; |    /* insn->header.mask_control = BRW_MASK_DISABLE; */ | ||||||
|    insn->bits3.if_else.pad0 = 0; |    insn->bits3.if_else.pad0 = 0; | ||||||
|    return insn; |    return insn; | ||||||
| } | } | ||||||
| @@ -631,7 +636,7 @@ struct brw_instruction *brw_CONT(struct brw_compile *p) | |||||||
|    brw_set_src1(insn, brw_imm_d(0x0)); |    brw_set_src1(insn, brw_imm_d(0x0)); | ||||||
|    insn->header.compression_control = BRW_COMPRESSION_NONE; |    insn->header.compression_control = BRW_COMPRESSION_NONE; | ||||||
|    insn->header.execution_size = BRW_EXECUTE_8; |    insn->header.execution_size = BRW_EXECUTE_8; | ||||||
|    insn->header.mask_control = BRW_MASK_DISABLE; |    /* insn->header.mask_control = BRW_MASK_DISABLE; */ | ||||||
|    insn->bits3.if_else.pad0 = 0; |    insn->bits3.if_else.pad0 = 0; | ||||||
|    return insn; |    return insn; | ||||||
| } | } | ||||||
| @@ -655,7 +660,7 @@ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) | |||||||
|       insn->header.execution_size = execute_size; |       insn->header.execution_size = execute_size; | ||||||
|       insn->header.predicate_control = BRW_PREDICATE_NONE; |       insn->header.predicate_control = BRW_PREDICATE_NONE; | ||||||
|       /* insn->header.mask_control = BRW_MASK_ENABLE; */ |       /* insn->header.mask_control = BRW_MASK_ENABLE; */ | ||||||
|       insn->header.mask_control = BRW_MASK_DISABLE; |       /* insn->header.mask_control = BRW_MASK_DISABLE; */ | ||||||
|  |  | ||||||
|       return insn; |       return insn; | ||||||
|    } |    } | ||||||
| @@ -694,7 +699,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, | |||||||
|  |  | ||||||
| /*    insn->header.mask_control = BRW_MASK_ENABLE; */ | /*    insn->header.mask_control = BRW_MASK_ENABLE; */ | ||||||
|  |  | ||||||
|    insn->header.mask_control = BRW_MASK_DISABLE; |    /* insn->header.mask_control = BRW_MASK_DISABLE; */ | ||||||
|    p->current->header.predicate_control = BRW_PREDICATE_NONE;    |    p->current->header.predicate_control = BRW_PREDICATE_NONE;    | ||||||
|    return insn; |    return insn; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -850,20 +850,20 @@ static void emit_sop(struct brw_wm_compile *c, | |||||||
|     struct brw_reg dst, src0, src1; |     struct brw_reg dst, src0, src1; | ||||||
|     int i; |     int i; | ||||||
|  |  | ||||||
|     brw_push_insn_state(p); |  | ||||||
|     for (i = 0; i < 4; i++) { |     for (i = 0; i < 4; i++) { | ||||||
| 	if (mask & (1<<i)) { | 	if (mask & (1<<i)) { | ||||||
| 	    dst = get_dst_reg(c, inst, i, 1); | 	    dst = get_dst_reg(c, inst, i, 1); | ||||||
| 	    src0 = get_src_reg(c, &inst->SrcReg[0], i, 1); | 	    src0 = get_src_reg(c, &inst->SrcReg[0], i, 1); | ||||||
| 	    src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); | 	    src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); | ||||||
|  | 	    brw_push_insn_state(p); | ||||||
| 	    brw_CMP(p, brw_null_reg(), cond, src0, src1); | 	    brw_CMP(p, brw_null_reg(), cond, src0, src1); | ||||||
| 	    brw_set_predicate_control(p, BRW_PREDICATE_NONE); | 	    brw_set_predicate_control(p, BRW_PREDICATE_NONE); | ||||||
| 	    brw_MOV(p, dst, brw_imm_f(0.0)); | 	    brw_MOV(p, dst, brw_imm_f(0.0)); | ||||||
| 	    brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); | 	    brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); | ||||||
| 	    brw_MOV(p, dst, brw_imm_f(1.0)); | 	    brw_MOV(p, dst, brw_imm_f(1.0)); | ||||||
|  | 	    brw_pop_insn_state(p); | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|     brw_pop_insn_state(p); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static void emit_slt(struct brw_wm_compile *c, | static void emit_slt(struct brw_wm_compile *c, | ||||||
|   | |||||||
| @@ -138,7 +138,7 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum depth_mode ) | |||||||
|    case MESA_FORMAT_SRGB_DXT1: |    case MESA_FORMAT_SRGB_DXT1: | ||||||
|       return BRW_SURFACEFORMAT_BC1_UNORM_SRGB; |       return BRW_SURFACEFORMAT_BC1_UNORM_SRGB; | ||||||
|  |  | ||||||
|    case MESA_FORMAT_Z24_S8: |    case MESA_FORMAT_S8_Z24: | ||||||
|       return BRW_SURFACEFORMAT_I24X8_UNORM; |       return BRW_SURFACEFORMAT_I24X8_UNORM; | ||||||
|  |  | ||||||
|    default: |    default: | ||||||
|   | |||||||
| @@ -58,6 +58,7 @@ | |||||||
| #define PCI_CHIP_IGD_E_G                0x2E02 | #define PCI_CHIP_IGD_E_G                0x2E02 | ||||||
| #define PCI_CHIP_Q45_G                  0x2E12 | #define PCI_CHIP_Q45_G                  0x2E12 | ||||||
| #define PCI_CHIP_G45_G                  0x2E22 | #define PCI_CHIP_G45_G                  0x2E22 | ||||||
|  | #define PCI_CHIP_G41_G                  0x2E32 | ||||||
|  |  | ||||||
| #define IS_MOBILE(devid)	(devid == PCI_CHIP_I855_GM || \ | #define IS_MOBILE(devid)	(devid == PCI_CHIP_I855_GM || \ | ||||||
| 				 devid == PCI_CHIP_I915_GM || \ | 				 devid == PCI_CHIP_I915_GM || \ | ||||||
| @@ -70,7 +71,8 @@ | |||||||
| #define IS_GM45_GM(devid)       (devid == PCI_CHIP_GM45_GM) | #define IS_GM45_GM(devid)       (devid == PCI_CHIP_GM45_GM) | ||||||
| #define IS_G4X(devid)           (devid == PCI_CHIP_IGD_E_G || \ | #define IS_G4X(devid)           (devid == PCI_CHIP_IGD_E_G || \ | ||||||
|                                  devid == PCI_CHIP_Q45_G || \ |                                  devid == PCI_CHIP_Q45_G || \ | ||||||
|                                  devid == PCI_CHIP_G45_G) |                                  devid == PCI_CHIP_G45_G || \ | ||||||
|  |                                  devid == PCI_CHIP_G41_G) | ||||||
|  |  | ||||||
| #define IS_915(devid)		(devid == PCI_CHIP_I915_G || \ | #define IS_915(devid)		(devid == PCI_CHIP_I915_G || \ | ||||||
| 				 devid == PCI_CHIP_E7221_G || \ | 				 devid == PCI_CHIP_E7221_G || \ | ||||||
|   | |||||||
| @@ -178,6 +178,9 @@ intelGetString(GLcontext * ctx, GLenum name) | |||||||
|       case PCI_CHIP_Q45_G: |       case PCI_CHIP_Q45_G: | ||||||
|          chipset = "Intel(R) Q45/Q43"; |          chipset = "Intel(R) Q45/Q43"; | ||||||
|          break; |          break; | ||||||
|  |       case PCI_CHIP_G41_G: | ||||||
|  |          chipset = "Intel(R) G41"; | ||||||
|  |          break; | ||||||
|       default: |       default: | ||||||
|          chipset = "Unknown Intel Chipset"; |          chipset = "Unknown Intel Chipset"; | ||||||
|          break; |          break; | ||||||
|   | |||||||
| @@ -138,7 +138,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, | |||||||
|  |  | ||||||
|    case GL_DEPTH_STENCIL_EXT: |    case GL_DEPTH_STENCIL_EXT: | ||||||
|    case GL_DEPTH24_STENCIL8_EXT: |    case GL_DEPTH24_STENCIL8_EXT: | ||||||
|       return &_mesa_texformat_z24_s8; |       return &_mesa_texformat_s8_z24; | ||||||
|  |  | ||||||
| #ifndef I915 | #ifndef I915 | ||||||
|    case GL_SRGB_EXT: |    case GL_SRGB_EXT: | ||||||
|   | |||||||
| @@ -65,6 +65,7 @@ DRI_CONF_END; | |||||||
|  |  | ||||||
| static const __DRIextension *tdfxExtensions[] = { | static const __DRIextension *tdfxExtensions[] = { | ||||||
|     &driReadDrawableExtension, |     &driReadDrawableExtension, | ||||||
|  |     NULL | ||||||
| }; | }; | ||||||
|  |  | ||||||
| static const GLuint __driNConfigOptions = 1; | static const GLuint __driNConfigOptions = 1; | ||||||
| @@ -350,12 +351,7 @@ tdfxFillInModes(__DRIscreenPrivate *psp, | |||||||
| 		unsigned stencil_bits, | 		unsigned stencil_bits, | ||||||
| 		GLboolean have_back_buffer) | 		GLboolean have_back_buffer) | ||||||
| { | { | ||||||
| 	__DRIconfig **configs, **c; |  | ||||||
| 	__GLcontextModes *m; |  | ||||||
| 	unsigned num_modes; |  | ||||||
| 	unsigned vis[2] = { GLX_TRUE_COLOR, GLX_DIRECT_COLOR }; |  | ||||||
| 	unsigned deep = (depth_bits > 17); | 	unsigned deep = (depth_bits > 17); | ||||||
| 	unsigned i, db, depth, accum, stencil; |  | ||||||
|  |  | ||||||
| 	/* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy | 	/* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy | ||||||
| 	 * enough to add support.  Basically, if a context is created with an | 	 * enough to add support.  Basically, if a context is created with an | ||||||
| @@ -363,55 +359,32 @@ tdfxFillInModes(__DRIscreenPrivate *psp, | |||||||
| 	 * will never be used. | 	 * will never be used. | ||||||
| 	 */ | 	 */ | ||||||
|  |  | ||||||
| 	num_modes = (depth_bits == 16) ? 32 : 16; | 	static const GLenum db_modes[2] = { GLX_NONE, GLX_SWAP_UNDEFINED_OML }; | ||||||
|  | 	uint8_t depth_bits_array[4]; | ||||||
| 	configs = _mesa_malloc(num_modes * sizeof *configs); | 	uint8_t stencil_bits_array[4]; | ||||||
| 	c = configs; | 	if(deep) { | ||||||
|  | 		depth_bits_array[0] = 0; | ||||||
| 	for (i = 0; i <= 1; i++) { | 		depth_bits_array[1] = 24; | ||||||
| 	    for (db = 0; db <= 1; db++) { | 		stencil_bits_array[0] = 0; | ||||||
| 		for (depth = 0; depth <= 1; depth++) { | 		stencil_bits_array[1] = 8; | ||||||
| 		    for (accum = 0; accum <= 1; accum++) { | 	} else { | ||||||
| 			for (stencil = 0; stencil <= !deep; stencil++) { | 		depth_bits_array[0] = depth_bits; | ||||||
| 			    *c = _mesa_malloc(sizeof **c); | 		depth_bits_array[1] = 0; | ||||||
| 			    m = &(*c++)->modes; | 		depth_bits_array[2] = depth_bits; | ||||||
| 			    if (deep) stencil = depth; | 		depth_bits_array[3] = 0; | ||||||
| 			    m->redBits		= deep ? 8 : 5; | 		stencil_bits_array[0] = 0; | ||||||
| 			    m->greenBits	= deep ? 8 : 6; | 		stencil_bits_array[1] = 0; | ||||||
| 			    m->blueBits		= deep ? 8 : 5; | 		stencil_bits_array[2] = 8; | ||||||
| 			    m->alphaBits	= deep ? 8 : 0; | 		stencil_bits_array[3] = 8; | ||||||
| 			    m->redMask		= deep ?0xFF000000 :0x0000F800; |  | ||||||
| 			    m->greenMask	= deep ?0x00FF0000 :0x000007E0; |  | ||||||
| 			    m->blueMask		= deep ?0x0000FF00 :0x0000001F; |  | ||||||
| 			    m->alphaMask	= deep ? 0x000000FF : 0; |  | ||||||
| 			    m->rgbBits		= m->redBits + m->greenBits + |  | ||||||
| 			    			  m->blueBits + m->alphaBits; |  | ||||||
| 			    m->accumRedBits	= accum ? 16 : 0; |  | ||||||
| 			    m->accumGreenBits	= accum ? 16 : 0; |  | ||||||
| 			    m->accumBlueBits	= accum ? 16 : 0; |  | ||||||
| 			    m->accumAlphaBits	= (accum && deep) ? 16 : 0; |  | ||||||
| 			    m->stencilBits	= stencil ? 8 : 0; |  | ||||||
| 			    m->depthBits	= deep |  | ||||||
| 			    			  ? (depth ? 24 : 0) |  | ||||||
| 			    			  : (depth ? 0 : depth_bits); |  | ||||||
| 			    m->visualType	= vis[i]; |  | ||||||
| 			    m->renderType	= GLX_RGBA_BIT; |  | ||||||
| 			    m->drawableType	= GLX_WINDOW_BIT; |  | ||||||
| 			    m->rgbMode		= GL_TRUE; |  | ||||||
| 			    m->doubleBufferMode = db ? GL_TRUE : GL_FALSE; |  | ||||||
| 			    if (db) |  | ||||||
| 			    	m->swapMethod = GLX_SWAP_UNDEFINED_OML; |  | ||||||
| 			    m->visualRating	= ((stencil && !deep) || accum) |  | ||||||
| 			    			  ? GLX_SLOW_CONFIG |  | ||||||
| 						  : GLX_NONE; |  | ||||||
| 			    if (deep) stencil = 0; |  | ||||||
| 			} |  | ||||||
| 		    } |  | ||||||
| 		} |  | ||||||
| 	    } |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return (const __DRIconfig **) configs; | 	return driCreateConfigs( | ||||||
|  | 		deep ? GL_RGBA : GL_RGB, | ||||||
|  | 		deep ? GL_UNSIGNED_INT_8_8_8_8 : GL_UNSIGNED_SHORT_5_6_5, | ||||||
|  | 		depth_bits_array, | ||||||
|  | 		stencil_bits_array, | ||||||
|  | 		deep ? 2 : 4, | ||||||
|  | 		db_modes, 2); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -118,6 +118,7 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC) | |||||||
|     /* Only 16 and 32 bit targets are supported now */ |     /* Only 16 and 32 bit targets are supported now */ | ||||||
|     assert(pwfb->cColorBits == 0 || |     assert(pwfb->cColorBits == 0 || | ||||||
| 	   pwfb->cColorBits == 16 ||  | 	   pwfb->cColorBits == 16 ||  | ||||||
|  | 	   pwfb->cColorBits == 24 ||  | ||||||
| 	   pwfb->cColorBits == 32); | 	   pwfb->cColorBits == 32); | ||||||
|  |  | ||||||
|     switch(pwfb->cColorBits){ |     switch(pwfb->cColorBits){ | ||||||
| @@ -127,6 +128,7 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC) | |||||||
|     case 16: |     case 16: | ||||||
| 	pwfb->pixelformat = PF_5R6G5B; | 	pwfb->pixelformat = PF_5R6G5B; | ||||||
| 	break; | 	break; | ||||||
|  |     case 24: | ||||||
|     case 32: |     case 32: | ||||||
| 	pwfb->pixelformat = PF_8R8G8B; | 	pwfb->pixelformat = PF_8R8G8B; | ||||||
| 	break; | 	break; | ||||||
| @@ -854,6 +856,195 @@ static void read_rgba_pixels_32(const GLcontext *ctx, | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /*********************************************************************/ | ||||||
|  |  | ||||||
|  | /* DOUBLE BUFFER 24-bit */ | ||||||
|  |  | ||||||
|  | #define WMSETPIXEL24(pwc, y, x, r, g, b) { \ | ||||||
|  | LPBYTE lpb = ((LPBYTE)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (3 * x)); \ | ||||||
|  | lpb[0] = (b); \ | ||||||
|  | lpb[1] = (g); \ | ||||||
|  | lpb[2] = (r); } | ||||||
|  |  | ||||||
|  | /* Write a horizontal span of RGBA color pixels with a boolean mask. */ | ||||||
|  | static void write_rgba_span_24(const GLcontext *ctx,  | ||||||
|  | 			       struct gl_renderbuffer *rb,  | ||||||
|  | 			       GLuint n, GLint x, GLint y, | ||||||
|  | 			       const GLubyte rgba[][4],  | ||||||
|  | 			       const GLubyte mask[] ) | ||||||
|  | { | ||||||
|  |     WMesaContext pwc = wmesa_context(ctx); | ||||||
|  |     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); | ||||||
|  |     GLuint i; | ||||||
|  |     LPBYTE lpb; | ||||||
|  |  | ||||||
|  |     (void) ctx; | ||||||
|  |      | ||||||
|  |     y=FLIP(y); | ||||||
|  |     lpb = ((LPBYTE)(pwfb->pbPixels + pwfb->ScanWidth * y)) + (3 * x); | ||||||
|  |     if (mask) { | ||||||
|  | 	for (i=0; i<n; i++) | ||||||
|  | 	    if (mask[i]) { | ||||||
|  |                 lpb[3*i] = rgba[i][BCOMP]; | ||||||
|  |                 lpb[3*i+1] = rgba[i][GCOMP]; | ||||||
|  |                 lpb[3*i+2] = rgba[i][RCOMP]; | ||||||
|  | 	    } | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  | 	    for (i=0; i<n; i++) { | ||||||
|  |             *lpb++ = rgba[i][BCOMP]; | ||||||
|  |             *lpb++ = rgba[i][GCOMP]; | ||||||
|  |             *lpb++ = rgba[i][RCOMP]; | ||||||
|  | 	    } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Write a horizontal span of RGB color pixels with a boolean mask. */ | ||||||
|  | static void write_rgb_span_24(const GLcontext *ctx,  | ||||||
|  | 			      struct gl_renderbuffer *rb,  | ||||||
|  | 			      GLuint n, GLint x, GLint y, | ||||||
|  | 			      const GLubyte rgb[][3],  | ||||||
|  | 			      const GLubyte mask[] ) | ||||||
|  | { | ||||||
|  |     WMesaContext pwc = wmesa_context(ctx); | ||||||
|  |     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); | ||||||
|  |     GLuint i; | ||||||
|  |     LPBYTE lpb; | ||||||
|  |  | ||||||
|  |     (void) ctx; | ||||||
|  |      | ||||||
|  |     y=FLIP(y); | ||||||
|  |     lpb = ((LPBYTE)(pwfb->pbPixels + pwfb->ScanWidth * y)) + (3 * x); | ||||||
|  |     if (mask) { | ||||||
|  | 	for (i=0; i<n; i++) | ||||||
|  | 	    if (mask[i]) { | ||||||
|  |             lpb[3*i] = rgb[i][BCOMP]; | ||||||
|  |             lpb[3*i+1] = rgb[i][GCOMP]; | ||||||
|  |             lpb[3*i+2] = rgb[i][RCOMP]; | ||||||
|  | 	    } | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |     	for (i=0; i<n; i++) { | ||||||
|  |     		*lpb++ = rgb[i][BCOMP]; | ||||||
|  |     		*lpb++ = rgb[i][GCOMP]; | ||||||
|  |     		*lpb++ = rgb[i][RCOMP]; | ||||||
|  |     	} | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Write a horizontal span of pixels with a boolean mask.  The current color | ||||||
|  |  * is used for all pixels. | ||||||
|  |  */ | ||||||
|  | static void write_mono_rgba_span_24(const GLcontext *ctx,  | ||||||
|  | 				    struct gl_renderbuffer *rb, | ||||||
|  | 				    GLuint n, GLint x, GLint y, | ||||||
|  | 				    const GLchan color[4],  | ||||||
|  | 				    const GLubyte mask[]) | ||||||
|  | { | ||||||
|  |     LPBYTE lpb; | ||||||
|  |     GLuint i; | ||||||
|  |     WMesaContext pwc = wmesa_context(ctx); | ||||||
|  |     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); | ||||||
|  |     lpb = ((LPBYTE)(pwfb->pbPixels + pwfb->ScanWidth * y)) + (3 * x); | ||||||
|  |     y=FLIP(y); | ||||||
|  |     if (mask) { | ||||||
|  | 	for (i=0; i<n; i++) | ||||||
|  | 	    if (mask[i]) { | ||||||
|  | 	    	lpb[3*i] = color[BCOMP]; | ||||||
|  | 	    	lpb[3*i+1] = color[GCOMP]; | ||||||
|  | 	    	lpb[3*i+2] = color[RCOMP]; | ||||||
|  | 	    } | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  | 	for (i=0; i<n; i++) { | ||||||
|  | 		*lpb++ = color[BCOMP]; | ||||||
|  | 		*lpb++ = color[GCOMP]; | ||||||
|  | 		*lpb++ = color[RCOMP];		 | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* Write an array of RGBA pixels with a boolean mask. */ | ||||||
|  | static void write_rgba_pixels_24(const GLcontext *ctx,  | ||||||
|  | 				 struct gl_renderbuffer *rb, | ||||||
|  | 				 GLuint n, const GLint x[], const GLint y[], | ||||||
|  | 				 const GLubyte rgba[][4],  | ||||||
|  | 				 const GLubyte mask[]) | ||||||
|  | { | ||||||
|  |     GLuint i; | ||||||
|  |     WMesaContext pwc = wmesa_context(ctx); | ||||||
|  |     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); | ||||||
|  |     for (i=0; i<n; i++) | ||||||
|  | 	if (mask[i]) | ||||||
|  | 	    WMSETPIXEL24(pwfb, FLIP(y[i]), x[i], | ||||||
|  | 			 rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Write an array of pixels with a boolean mask.  The current color | ||||||
|  |  * is used for all pixels. | ||||||
|  |  */ | ||||||
|  | static void write_mono_rgba_pixels_24(const GLcontext *ctx,  | ||||||
|  | 				      struct gl_renderbuffer *rb, | ||||||
|  | 				      GLuint n, | ||||||
|  | 				      const GLint x[], const GLint y[], | ||||||
|  | 				      const GLchan color[4], | ||||||
|  | 				      const GLubyte mask[]) | ||||||
|  | { | ||||||
|  |     GLuint i; | ||||||
|  |     WMesaContext pwc = wmesa_context(ctx); | ||||||
|  |     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); | ||||||
|  |     for (i=0; i<n; i++) | ||||||
|  | 	if (mask[i]) | ||||||
|  | 	    WMSETPIXEL24(pwfb, FLIP(y[i]),x[i],color[RCOMP], | ||||||
|  | 			 color[GCOMP], color[BCOMP]); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* Read a horizontal span of color pixels. */ | ||||||
|  | static void read_rgba_span_24(const GLcontext *ctx,  | ||||||
|  | 			      struct gl_renderbuffer *rb, | ||||||
|  | 			      GLuint n, GLint x, GLint y, | ||||||
|  | 			      GLubyte rgba[][4] ) | ||||||
|  | { | ||||||
|  |     GLuint i; | ||||||
|  |     LPBYTE lpb; | ||||||
|  |     WMesaContext pwc = wmesa_context(ctx); | ||||||
|  |     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); | ||||||
|  |      | ||||||
|  |     y = FLIP(y); | ||||||
|  |     lpb = ((LPBYTE)(pwfb->pbPixels + pwfb->ScanWidth * y)) + (3 * x); | ||||||
|  |     for (i=0; i<n; i++) { | ||||||
|  | 	rgba[i][RCOMP] = lpb[3*i+2]; | ||||||
|  | 	rgba[i][GCOMP] = lpb[3*i+1]; | ||||||
|  | 	rgba[i][BCOMP] = lpb[3*i]; | ||||||
|  | 	rgba[i][ACOMP] = 255; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Read an array of color pixels. */ | ||||||
|  | static void read_rgba_pixels_24(const GLcontext *ctx,  | ||||||
|  | 				struct gl_renderbuffer *rb, | ||||||
|  | 				GLuint n, const GLint x[], const GLint y[], | ||||||
|  | 				GLubyte rgba[][4]) | ||||||
|  | { | ||||||
|  |     GLuint i; | ||||||
|  |     LPBYTE lpb; | ||||||
|  |     WMesaContext pwc = wmesa_context(ctx); | ||||||
|  |     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); | ||||||
|  |  | ||||||
|  |     for (i=0; i<n; i++) { | ||||||
|  | 	GLint y2 = FLIP(y[i]); | ||||||
|  | 	lpb = ((LPBYTE)(pwfb->pbPixels + pwfb->ScanWidth * y2)) + (3 * x[i]); | ||||||
|  | 	rgba[i][RCOMP] = lpb[3*i+2]; | ||||||
|  | 	rgba[i][GCOMP] = lpb[3*i+1]; | ||||||
|  | 	rgba[i][BCOMP] = lpb[3*i]; | ||||||
|  | 	rgba[i][ACOMP] = 255; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
|  |  | ||||||
| /* DOUBLE BUFFER 16-bit */ | /* DOUBLE BUFFER 16-bit */ | ||||||
| @@ -1077,7 +1268,7 @@ wmesa_renderbuffer_storage(GLcontext *ctx, | |||||||
|  * on if we're drawing to the front or back color buffer. |  * on if we're drawing to the front or back color buffer. | ||||||
|  */ |  */ | ||||||
| void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat, | void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat, | ||||||
|                                   int double_buffer) |                                   BYTE cColorBits, int double_buffer) | ||||||
| { | { | ||||||
|     if (double_buffer) { |     if (double_buffer) { | ||||||
|         /* back buffer */ |         /* back buffer */ | ||||||
| @@ -1097,16 +1288,32 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat, | |||||||
|             rb->BlueBits = 5; |             rb->BlueBits = 5; | ||||||
| 	    break; | 	    break; | ||||||
| 	case PF_8R8G8B: | 	case PF_8R8G8B: | ||||||
| 	    rb->PutRow = write_rgba_span_32; | 		if (cColorBits == 24) | ||||||
| 	    rb->PutRowRGB = write_rgb_span_32; | 		{ | ||||||
| 	    rb->PutMonoRow = write_mono_rgba_span_32; | 		    rb->PutRow = write_rgba_span_24; | ||||||
| 	    rb->PutValues = write_rgba_pixels_32; | 		    rb->PutRowRGB = write_rgb_span_24; | ||||||
| 	    rb->PutMonoValues = write_mono_rgba_pixels_32; | 		    rb->PutMonoRow = write_mono_rgba_span_24; | ||||||
| 	    rb->GetRow = read_rgba_span_32; | 		    rb->PutValues = write_rgba_pixels_24; | ||||||
| 	    rb->GetValues = read_rgba_pixels_32; | 		    rb->PutMonoValues = write_mono_rgba_pixels_24; | ||||||
|  | 		    rb->GetRow = read_rgba_span_24; | ||||||
|  | 		    rb->GetValues = read_rgba_pixels_24; | ||||||
|  | 	        rb->RedBits = 8; | ||||||
|  | 	        rb->GreenBits = 8; | ||||||
|  | 	        rb->BlueBits = 8;		 | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 	        rb->PutRow = write_rgba_span_32; | ||||||
|  | 	        rb->PutRowRGB = write_rgb_span_32; | ||||||
|  | 	        rb->PutMonoRow = write_mono_rgba_span_32; | ||||||
|  | 	        rb->PutValues = write_rgba_pixels_32; | ||||||
|  | 	        rb->PutMonoValues = write_mono_rgba_pixels_32; | ||||||
|  | 	        rb->GetRow = read_rgba_span_32; | ||||||
|  | 	        rb->GetValues = read_rgba_pixels_32; | ||||||
|             rb->RedBits = 8; |             rb->RedBits = 8; | ||||||
|             rb->GreenBits = 8; |             rb->GreenBits = 8; | ||||||
|             rb->BlueBits = 8; |             rb->BlueBits = 8; | ||||||
|  | 		} | ||||||
| 	    break; | 	    break; | ||||||
| 	default: | 	default: | ||||||
| 	    break; | 	    break; | ||||||
| @@ -1413,11 +1620,11 @@ void WMesaMakeCurrent(WMesaContext c, HDC hdc) | |||||||
|         if (visual->doubleBufferMode == 1) { |         if (visual->doubleBufferMode == 1) { | ||||||
|             rb = wmesa_new_renderbuffer(); |             rb = wmesa_new_renderbuffer(); | ||||||
|             _mesa_add_renderbuffer(&pwfb->Base, BUFFER_BACK_LEFT, rb); |             _mesa_add_renderbuffer(&pwfb->Base, BUFFER_BACK_LEFT, rb); | ||||||
|             wmesa_set_renderbuffer_funcs(rb, pwfb->pixelformat, 1); |             wmesa_set_renderbuffer_funcs(rb, pwfb->pixelformat, pwfb->cColorBits, 1); | ||||||
| 	} | 	} | ||||||
|         rb = wmesa_new_renderbuffer(); |         rb = wmesa_new_renderbuffer(); | ||||||
|         _mesa_add_renderbuffer(&pwfb->Base, BUFFER_FRONT_LEFT, rb); |         _mesa_add_renderbuffer(&pwfb->Base, BUFFER_FRONT_LEFT, rb); | ||||||
|         wmesa_set_renderbuffer_funcs(rb, pwfb->pixelformat, 0); |         wmesa_set_renderbuffer_funcs(rb, pwfb->pixelformat, pwfb->cColorBits, 0); | ||||||
|  |  | ||||||
| 	/* Let Mesa own the Depth, Stencil, and Accum buffers */ | 	/* Let Mesa own the Depth, Stencil, and Accum buffers */ | ||||||
|         _mesa_add_soft_renderbuffers(&pwfb->Base, |         _mesa_add_soft_renderbuffers(&pwfb->Base, | ||||||
|   | |||||||
| @@ -34,6 +34,7 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
|  | #include <stdio.h> | ||||||
| #include "glthread.h" | #include "glthread.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  6.5 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * (C) Copyright IBM Corporation 2006 |  * (C) Copyright IBM Corporation 2006 | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
| @@ -77,7 +77,7 @@ lookup_arrayobj(GLcontext *ctx, GLuint id) | |||||||
| struct gl_array_object * | struct gl_array_object * | ||||||
| _mesa_new_array_object( GLcontext *ctx, GLuint name ) | _mesa_new_array_object( GLcontext *ctx, GLuint name ) | ||||||
| { | { | ||||||
|    struct gl_array_object *obj = MALLOC_STRUCT(gl_array_object); |    struct gl_array_object *obj = CALLOC_STRUCT(gl_array_object); | ||||||
|    if (obj) |    if (obj) | ||||||
|       _mesa_initialize_array_object(ctx, obj, name); |       _mesa_initialize_array_object(ctx, obj, name); | ||||||
|    return obj; |    return obj; | ||||||
| @@ -210,6 +210,15 @@ _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) | ||||||
|  | { | ||||||
|  |    if (bufObj != ctx->Array.NullBufferObj) { | ||||||
|  |       _mesa_reference_buffer_object(ctx, &bufObj, NULL); | ||||||
|  |    } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /**********************************************************************/ | /**********************************************************************/ | ||||||
| /* API Functions                                                      */ | /* API Functions                                                      */ | ||||||
| /**********************************************************************/ | /**********************************************************************/ | ||||||
| @@ -311,18 +320,18 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) | |||||||
| 	 /* Unbind any buffer objects that might be bound to arrays in | 	 /* Unbind any buffer objects that might be bound to arrays in | ||||||
| 	  * this array object. | 	  * this array object. | ||||||
| 	  */ | 	  */ | ||||||
| 	 _mesa_unbind_buffer_object( ctx, obj->Vertex.BufferObj ); | 	 unbind_buffer_object( ctx, obj->Vertex.BufferObj ); | ||||||
| 	 _mesa_unbind_buffer_object( ctx, obj->Normal.BufferObj ); | 	 unbind_buffer_object( ctx, obj->Normal.BufferObj ); | ||||||
| 	 _mesa_unbind_buffer_object( ctx, obj->Color.BufferObj ); | 	 unbind_buffer_object( ctx, obj->Color.BufferObj ); | ||||||
| 	 _mesa_unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj ); | 	 unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj ); | ||||||
| 	 _mesa_unbind_buffer_object( ctx, obj->FogCoord.BufferObj ); | 	 unbind_buffer_object( ctx, obj->FogCoord.BufferObj ); | ||||||
| 	 _mesa_unbind_buffer_object( ctx, obj->Index.BufferObj ); | 	 unbind_buffer_object( ctx, obj->Index.BufferObj ); | ||||||
| 	 for (i = 0; i < MAX_TEXTURE_UNITS; i++) { | 	 for (i = 0; i < MAX_TEXTURE_UNITS; i++) { | ||||||
| 	    _mesa_unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj ); | 	    unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj ); | ||||||
| 	 } | 	 } | ||||||
| 	 _mesa_unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj ); | 	 unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj ); | ||||||
| 	 for (i = 0; i < VERT_ATTRIB_MAX; i++) { | 	 for (i = 0; i < VERT_ATTRIB_MAX; i++) { | ||||||
| 	    _mesa_unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj ); | 	    unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj ); | ||||||
| 	 } | 	 } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  7.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -1274,6 +1274,29 @@ adjust_buffer_object_ref_counts(struct gl_array_attrib *array, GLint step) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Copy gl_pixelstore_attrib from src to dst, updating buffer | ||||||
|  |  * object refcounts. | ||||||
|  |  */ | ||||||
|  | static void | ||||||
|  | copy_pixelstore(GLcontext *ctx, | ||||||
|  |                 struct gl_pixelstore_attrib *dst, | ||||||
|  |                 const struct gl_pixelstore_attrib *src) | ||||||
|  | { | ||||||
|  |    dst->Alignment = src->Alignment; | ||||||
|  |    dst->RowLength = src->RowLength; | ||||||
|  |    dst->SkipPixels = src->SkipPixels; | ||||||
|  |    dst->SkipRows = src->SkipRows; | ||||||
|  |    dst->ImageHeight = src->ImageHeight; | ||||||
|  |    dst->SkipImages = src->SkipImages; | ||||||
|  |    dst->SwapBytes = src->SwapBytes; | ||||||
|  |    dst->LsbFirst = src->LsbFirst; | ||||||
|  |    dst->ClientStorage = src->ClientStorage; | ||||||
|  |    dst->Invert = src->Invert; | ||||||
|  |    _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| #define GL_CLIENT_PACK_BIT (1<<20) | #define GL_CLIENT_PACK_BIT (1<<20) | ||||||
| #define GL_CLIENT_UNPACK_BIT (1<<21) | #define GL_CLIENT_UNPACK_BIT (1<<21) | ||||||
|  |  | ||||||
| @@ -1292,31 +1315,29 @@ _mesa_PushClientAttrib(GLbitfield mask) | |||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    /* Build linked list of attribute nodes which save all attribute */ |    /* Build linked list of attribute nodes which save all attribute | ||||||
|    /* groups specified by the mask. */ |     * groups specified by the mask. | ||||||
|  |     */ | ||||||
|    head = NULL; |    head = NULL; | ||||||
|  |  | ||||||
|    if (mask & GL_CLIENT_PIXEL_STORE_BIT) { |    if (mask & GL_CLIENT_PIXEL_STORE_BIT) { | ||||||
|       struct gl_pixelstore_attrib *attr; |       struct gl_pixelstore_attrib *attr; | ||||||
| #if FEATURE_EXT_pixel_buffer_object |  | ||||||
|       ctx->Pack.BufferObj->RefCount++; |  | ||||||
|       ctx->Unpack.BufferObj->RefCount++; |  | ||||||
| #endif |  | ||||||
|       /* packing attribs */ |       /* packing attribs */ | ||||||
|       attr = MALLOC_STRUCT( gl_pixelstore_attrib ); |       attr = CALLOC_STRUCT( gl_pixelstore_attrib ); | ||||||
|       MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) ); |       copy_pixelstore(ctx, attr, &ctx->Pack); | ||||||
|       newnode = new_attrib_node( GL_CLIENT_PACK_BIT ); |       newnode = new_attrib_node( GL_CLIENT_PACK_BIT ); | ||||||
|       newnode->data = attr; |       newnode->data = attr; | ||||||
|       newnode->next = head; |       newnode->next = head; | ||||||
|       head = newnode; |       head = newnode; | ||||||
|       /* unpacking attribs */ |       /* unpacking attribs */ | ||||||
|       attr = MALLOC_STRUCT( gl_pixelstore_attrib ); |       attr = CALLOC_STRUCT( gl_pixelstore_attrib ); | ||||||
|       MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) ); |       copy_pixelstore(ctx, attr, &ctx->Unpack); | ||||||
|       newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); |       newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); | ||||||
|       newnode->data = attr; |       newnode->data = attr; | ||||||
|       newnode->next = head; |       newnode->next = head; | ||||||
|       head = newnode; |       head = newnode; | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { |    if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { | ||||||
|       struct gl_array_attrib *attr; |       struct gl_array_attrib *attr; | ||||||
|       struct gl_array_object *obj; |       struct gl_array_object *obj; | ||||||
| @@ -1353,7 +1374,7 @@ _mesa_PushClientAttrib(GLbitfield mask) | |||||||
| void GLAPIENTRY | void GLAPIENTRY | ||||||
| _mesa_PopClientAttrib(void) | _mesa_PopClientAttrib(void) | ||||||
| { | { | ||||||
|    struct gl_attrib_node *attr, *next; |    struct gl_attrib_node *node, *next; | ||||||
|  |  | ||||||
|    GET_CURRENT_CONTEXT(ctx); |    GET_CURRENT_CONTEXT(ctx); | ||||||
|    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); | ||||||
| @@ -1364,37 +1385,31 @@ _mesa_PopClientAttrib(void) | |||||||
|    } |    } | ||||||
|  |  | ||||||
|    ctx->ClientAttribStackDepth--; |    ctx->ClientAttribStackDepth--; | ||||||
|    attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth]; |    node = ctx->ClientAttribStack[ctx->ClientAttribStackDepth]; | ||||||
|  |  | ||||||
|    while (attr) { |    while (node) { | ||||||
|       switch (attr->kind) { |       switch (node->kind) { | ||||||
|          case GL_CLIENT_PACK_BIT: |          case GL_CLIENT_PACK_BIT: | ||||||
| #if FEATURE_EXT_pixel_buffer_object |             { | ||||||
|             ctx->Pack.BufferObj->RefCount--; |                struct gl_pixelstore_attrib *store = | ||||||
|             if (ctx->Pack.BufferObj->RefCount <= 0) { |                   (struct gl_pixelstore_attrib *) node->data; | ||||||
|                _mesa_remove_buffer_object( ctx, ctx->Pack.BufferObj ); |                copy_pixelstore(ctx, &ctx->Pack, store); | ||||||
|                (*ctx->Driver.DeleteBuffer)( ctx, ctx->Pack.BufferObj ); |                _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL); | ||||||
|             } |             } | ||||||
| #endif |  | ||||||
|             MEMCPY( &ctx->Pack, attr->data, |  | ||||||
|                     sizeof(struct gl_pixelstore_attrib) ); |  | ||||||
| 	    ctx->NewState |= _NEW_PACKUNPACK; | 	    ctx->NewState |= _NEW_PACKUNPACK; | ||||||
|             break; |             break; | ||||||
|          case GL_CLIENT_UNPACK_BIT: |          case GL_CLIENT_UNPACK_BIT: | ||||||
| #if FEATURE_EXT_pixel_buffer_object |             { | ||||||
|             ctx->Unpack.BufferObj->RefCount--; |                struct gl_pixelstore_attrib *store = | ||||||
|             if (ctx->Unpack.BufferObj->RefCount <= 0) { |                   (struct gl_pixelstore_attrib *) node->data; | ||||||
|                _mesa_remove_buffer_object( ctx, ctx->Unpack.BufferObj ); |                copy_pixelstore(ctx, &ctx->Unpack, store); | ||||||
|                (*ctx->Driver.DeleteBuffer)( ctx, ctx->Unpack.BufferObj ); |                _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL); | ||||||
|             } |             } | ||||||
| #endif |  | ||||||
|             MEMCPY( &ctx->Unpack, attr->data, |  | ||||||
|                     sizeof(struct gl_pixelstore_attrib) ); |  | ||||||
| 	    ctx->NewState |= _NEW_PACKUNPACK; | 	    ctx->NewState |= _NEW_PACKUNPACK; | ||||||
|             break; |             break; | ||||||
|          case GL_CLIENT_VERTEX_ARRAY_BIT: { |          case GL_CLIENT_VERTEX_ARRAY_BIT: { | ||||||
| 	    struct gl_array_attrib * data = | 	    struct gl_array_attrib * data = | ||||||
| 	      (struct gl_array_attrib *) attr->data; | 	      (struct gl_array_attrib *) node->data; | ||||||
|  |  | ||||||
|             adjust_buffer_object_ref_counts(&ctx->Array, -1); |             adjust_buffer_object_ref_counts(&ctx->Array, -1); | ||||||
| 	  | 	  | ||||||
| @@ -1431,10 +1446,10 @@ _mesa_PopClientAttrib(void) | |||||||
|             break; |             break; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       next = attr->next; |       next = node->next; | ||||||
|       FREE( attr->data ); |       FREE( node->data ); | ||||||
|       FREE( attr ); |       FREE( node ); | ||||||
|       attr = next; |       node = next; | ||||||
|    } |    } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  7.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
| @@ -166,22 +166,75 @@ _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) | |||||||
|  |  | ||||||
|    if (bufObj->Data) |    if (bufObj->Data) | ||||||
|       _mesa_free(bufObj->Data); |       _mesa_free(bufObj->Data); | ||||||
|  |  | ||||||
|  |    /* assign strange values here to help w/ debugging */ | ||||||
|  |    bufObj->RefCount = -1000; | ||||||
|  |    bufObj->Name = ~0; | ||||||
|  |  | ||||||
|    _mesa_free(bufObj); |    _mesa_free(bufObj); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Set ptr to bufObj w/ reference counting. | ||||||
|  |  */ | ||||||
| void | void | ||||||
| _mesa_unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) | _mesa_reference_buffer_object(GLcontext *ctx, | ||||||
|  |                               struct gl_buffer_object **ptr, | ||||||
|  |                               struct gl_buffer_object *bufObj) | ||||||
| { | { | ||||||
|    if (bufObj != ctx->Array.NullBufferObj) { |    if (*ptr == bufObj) | ||||||
|       bufObj->RefCount--; |       return; | ||||||
|       if (bufObj->RefCount <= 0) { |  | ||||||
|  |    if (*ptr) { | ||||||
|  |       /* Unreference the old texture */ | ||||||
|  |       GLboolean deleteFlag = GL_FALSE; | ||||||
|  |       struct gl_buffer_object *oldObj = *ptr; | ||||||
|  |  | ||||||
|  |       /*_glthread_LOCK_MUTEX(oldObj->Mutex);*/ | ||||||
|  |       ASSERT(oldObj->RefCount > 0); | ||||||
|  |       oldObj->RefCount--; | ||||||
|  | #if 0 | ||||||
|  |       printf("BufferObj %p %d DECR to %d\n", | ||||||
|  |              (void *) oldObj, oldObj->Name, oldObj->RefCount); | ||||||
|  | #endif | ||||||
|  |       deleteFlag = (oldObj->RefCount == 0); | ||||||
|  |       /*_glthread_UNLOCK_MUTEX(oldObj->Mutex);*/ | ||||||
|  |  | ||||||
|  |       if (deleteFlag) { | ||||||
|  |  | ||||||
|  |          /* some sanity checking: don't delete a buffer still in use */ | ||||||
| 	 ASSERT(ctx->Array.ArrayBufferObj != bufObj); | 	 ASSERT(ctx->Array.ArrayBufferObj != bufObj); | ||||||
| 	 ASSERT(ctx->Array.ElementArrayBufferObj != bufObj); | 	 ASSERT(ctx->Array.ElementArrayBufferObj != bufObj); | ||||||
| 	 ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj); | 	 ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj); | ||||||
| 	 ASSERT(ctx->Driver.DeleteBuffer); | 	 ASSERT(ctx->Driver.DeleteBuffer); | ||||||
| 	 ctx->Driver.DeleteBuffer(ctx, bufObj); |  | ||||||
|  |          ctx->Driver.DeleteBuffer(ctx, oldObj); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |       *ptr = NULL; | ||||||
|  |    } | ||||||
|  |    ASSERT(!*ptr); | ||||||
|  |  | ||||||
|  |    if (bufObj) { | ||||||
|  |       /* reference new texture */ | ||||||
|  |       /*_glthread_LOCK_MUTEX(tex->Mutex);*/ | ||||||
|  |       if (bufObj->RefCount == 0) { | ||||||
|  |          /* this buffer's being deleted (look just above) */ | ||||||
|  |          /* Not sure this can every really happen.  Warn if it does. */ | ||||||
|  |          _mesa_problem(NULL, "referencing deleted buffer object"); | ||||||
|  |          *ptr = NULL; | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |          bufObj->RefCount++; | ||||||
|  | #if 0 | ||||||
|  |          printf("BufferObj %p %d INCR to %d\n", | ||||||
|  |                 (void *) bufObj, bufObj->Name, bufObj->RefCount); | ||||||
|  | #endif | ||||||
|  |          *ptr = bufObj; | ||||||
|  |       } | ||||||
|  |       /*_glthread_UNLOCK_MUTEX(tex->Mutex);*/ | ||||||
|    } |    } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -203,33 +256,6 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Add the given buffer object to the buffer object pool. |  | ||||||
|  */ |  | ||||||
| void |  | ||||||
| _mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ) |  | ||||||
| { |  | ||||||
|    if (obj->Name > 0) { |  | ||||||
|       /* insert into hash table */ |  | ||||||
|       _mesa_HashInsert(ctx->Shared->BufferObjects, obj->Name, obj); |  | ||||||
|    } |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Remove the given buffer object from the buffer object pool. |  | ||||||
|  * Do not deallocate the buffer object though. |  | ||||||
|  */ |  | ||||||
| void |  | ||||||
| _mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) |  | ||||||
| { |  | ||||||
|    if (bufObj->Name > 0) { |  | ||||||
|       /* remove from hash table */ |  | ||||||
|       _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name); |  | ||||||
|    } |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Allocate space for and store data in a buffer object.  Any data that was |  * Allocate space for and store data in a buffer object.  Any data that was | ||||||
|  * previously stored in the buffer object is lost.  If \c data is \c NULL, |  * previously stored in the buffer object is lost.  If \c data is \c NULL, | ||||||
| @@ -400,6 +426,7 @@ _mesa_init_buffer_objects( GLcontext *ctx ) | |||||||
| { | { | ||||||
|    /* Allocate the default buffer object and set refcount so high that |    /* Allocate the default buffer object and set refcount so high that | ||||||
|     * it never gets deleted. |     * it never gets deleted. | ||||||
|  |     * XXX with recent/improved refcounting this may not longer be needed. | ||||||
|     */ |     */ | ||||||
|    ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); |    ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); | ||||||
|    if (ctx->Array.NullBufferObj) |    if (ctx->Array.NullBufferObj) | ||||||
| @@ -462,28 +489,16 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) | |||||||
|             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB"); |             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB"); | ||||||
|             return; |             return; | ||||||
|          } |          } | ||||||
|          _mesa_save_buffer_object(ctx, newBufObj); |          _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj); | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|     |     | ||||||
|    /* Make new binding */ |    /* bind new buffer */ | ||||||
|    *bindTarget = newBufObj; |    _mesa_reference_buffer_object(ctx, bindTarget, newBufObj); | ||||||
|    newBufObj->RefCount++; |  | ||||||
|  |  | ||||||
|    /* Pass BindBuffer call to device driver */ |    /* Pass BindBuffer call to device driver */ | ||||||
|    if (ctx->Driver.BindBuffer && newBufObj) |    if (ctx->Driver.BindBuffer && newBufObj) | ||||||
|       ctx->Driver.BindBuffer( ctx, target, newBufObj ); |       ctx->Driver.BindBuffer( ctx, target, newBufObj ); | ||||||
|  |  | ||||||
|    /* decr ref count on old buffer obj, delete if needed */ |  | ||||||
|    if (oldBufObj) { |  | ||||||
|       oldBufObj->RefCount--; |  | ||||||
|       assert(oldBufObj->RefCount >= 0); |  | ||||||
|       if (oldBufObj->RefCount == 0) { |  | ||||||
|          assert(oldBufObj->Name != 0); |  | ||||||
|          ASSERT(ctx->Driver.DeleteBuffer); |  | ||||||
|          ctx->Driver.DeleteBuffer( ctx, oldBufObj ); |  | ||||||
|       } |  | ||||||
|    } |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -716,6 +731,23 @@ _mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * If *ptr points to obj, set ptr = the Null/default buffer object. | ||||||
|  |  * This is a helper for buffer object deletion. | ||||||
|  |  * The GL spec says that deleting a buffer object causes it to get | ||||||
|  |  * unbound from all arrays in the current context. | ||||||
|  |  */ | ||||||
|  | static void | ||||||
|  | unbind(GLcontext *ctx, | ||||||
|  |        struct gl_buffer_object **ptr, | ||||||
|  |        struct gl_buffer_object *obj) | ||||||
|  | { | ||||||
|  |    if (*ptr == obj) { | ||||||
|  |       _mesa_reference_buffer_object(ctx, ptr, ctx->Array.NullBufferObj); | ||||||
|  |    } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /**********************************************************************/ | /**********************************************************************/ | ||||||
| /* API Functions                                                      */ | /* API Functions                                                      */ | ||||||
| @@ -759,54 +791,18 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) | |||||||
|  |  | ||||||
|          ASSERT(bufObj->Name == ids[i]); |          ASSERT(bufObj->Name == ids[i]); | ||||||
|  |  | ||||||
|          if (ctx->Array.ArrayObj->Vertex.BufferObj == bufObj) { |          unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj); | ||||||
|             bufObj->RefCount--; |          unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj); | ||||||
|             ctx->Array.ArrayObj->Vertex.BufferObj = ctx->Array.NullBufferObj; |          unbind(ctx, &ctx->Array.ArrayObj->Color.BufferObj, bufObj); | ||||||
|             ctx->Array.NullBufferObj->RefCount++; |          unbind(ctx, &ctx->Array.ArrayObj->SecondaryColor.BufferObj, bufObj); | ||||||
|          } |          unbind(ctx, &ctx->Array.ArrayObj->FogCoord.BufferObj, bufObj); | ||||||
|          if (ctx->Array.ArrayObj->Normal.BufferObj == bufObj) { |          unbind(ctx, &ctx->Array.ArrayObj->Index.BufferObj, bufObj); | ||||||
|             bufObj->RefCount--; |          unbind(ctx, &ctx->Array.ArrayObj->EdgeFlag.BufferObj, bufObj); | ||||||
|             ctx->Array.ArrayObj->Normal.BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|             ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|          } |  | ||||||
|          if (ctx->Array.ArrayObj->Color.BufferObj == bufObj) { |  | ||||||
|             bufObj->RefCount--; |  | ||||||
|             ctx->Array.ArrayObj->Color.BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|             ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|          } |  | ||||||
|          if (ctx->Array.ArrayObj->SecondaryColor.BufferObj == bufObj) { |  | ||||||
|             bufObj->RefCount--; |  | ||||||
|             ctx->Array.ArrayObj->SecondaryColor.BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|             ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|          } |  | ||||||
|          if (ctx->Array.ArrayObj->FogCoord.BufferObj == bufObj) { |  | ||||||
|             bufObj->RefCount--; |  | ||||||
|             ctx->Array.ArrayObj->FogCoord.BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|             ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|          } |  | ||||||
|          if (ctx->Array.ArrayObj->Index.BufferObj == bufObj) { |  | ||||||
|             bufObj->RefCount--; |  | ||||||
|             ctx->Array.ArrayObj->Index.BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|             ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|          } |  | ||||||
|          if (ctx->Array.ArrayObj->EdgeFlag.BufferObj == bufObj) { |  | ||||||
|             bufObj->RefCount--; |  | ||||||
|             ctx->Array.ArrayObj->EdgeFlag.BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|             ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|          } |  | ||||||
|          for (j = 0; j < MAX_TEXTURE_UNITS; j++) { |          for (j = 0; j < MAX_TEXTURE_UNITS; j++) { | ||||||
|             if (ctx->Array.ArrayObj->TexCoord[j].BufferObj == bufObj) { |             unbind(ctx, &ctx->Array.ArrayObj->TexCoord[j].BufferObj, bufObj); | ||||||
|                bufObj->RefCount--; |  | ||||||
|                ctx->Array.ArrayObj->TexCoord[j].BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|                ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|             } |  | ||||||
|          } |          } | ||||||
|          for (j = 0; j < VERT_ATTRIB_MAX; j++) { |          for (j = 0; j < VERT_ATTRIB_MAX; j++) { | ||||||
|             if (ctx->Array.ArrayObj->VertexAttrib[j].BufferObj == bufObj) { |             unbind(ctx, &ctx->Array.ArrayObj->VertexAttrib[j].BufferObj, bufObj); | ||||||
|                bufObj->RefCount--; |  | ||||||
|                ctx->Array.ArrayObj->VertexAttrib[j].BufferObj = ctx->Array.NullBufferObj; |  | ||||||
|                ctx->Array.NullBufferObj->RefCount++; |  | ||||||
|             } |  | ||||||
|          } |          } | ||||||
|  |  | ||||||
|          if (ctx->Array.ArrayBufferObj == bufObj) { |          if (ctx->Array.ArrayBufferObj == bufObj) { | ||||||
| @@ -824,8 +820,8 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) | |||||||
|          } |          } | ||||||
|  |  | ||||||
|          /* The ID is immediately freed for re-use */ |          /* The ID is immediately freed for re-use */ | ||||||
|          _mesa_remove_buffer_object(ctx, bufObj); |          _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name); | ||||||
|          _mesa_unbind_buffer_object(ctx, bufObj); |          _mesa_reference_buffer_object(ctx, &bufObj, NULL); | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
| @@ -874,7 +870,7 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer) | |||||||
|          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB"); |          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB"); | ||||||
|          return; |          return; | ||||||
|       } |       } | ||||||
|       _mesa_save_buffer_object(ctx, bufObj); |       _mesa_HashInsert(ctx->Shared->BufferObjects, first + i, bufObj); | ||||||
|       buffer[i] = first + i; |       buffer[i] = first + i; | ||||||
|    } |    } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  7.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
| @@ -55,10 +55,9 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, | |||||||
| 				GLuint name, GLenum target ); | 				GLuint name, GLenum target ); | ||||||
|  |  | ||||||
| extern void | extern void | ||||||
| _mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ); | _mesa_reference_buffer_object(GLcontext *ctx, | ||||||
|  |                               struct gl_buffer_object **ptr, | ||||||
| extern void |                               struct gl_buffer_object *bufObj); | ||||||
| _mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); |  | ||||||
|  |  | ||||||
| extern void | extern void | ||||||
| _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, | _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, | ||||||
| @@ -118,8 +117,6 @@ _mesa_unmap_readpix_pbo(GLcontext *ctx, | |||||||
|                         const struct gl_pixelstore_attrib *pack); |                         const struct gl_pixelstore_attrib *pack); | ||||||
|  |  | ||||||
|  |  | ||||||
| extern void |  | ||||||
| _mesa_unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * API functions |  * API functions | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  6.5.1 |  * Version:  7.1 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  6.5.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -491,13 +491,13 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) | |||||||
|    if (fb->Attachment[BUFFER_ACCUM].Renderbuffer) { |    if (fb->Attachment[BUFFER_ACCUM].Renderbuffer) { | ||||||
|       fb->Visual.haveAccumBuffer = GL_TRUE; |       fb->Visual.haveAccumBuffer = GL_TRUE; | ||||||
|       fb->Visual.accumRedBits |       fb->Visual.accumRedBits | ||||||
|          = fb->Attachment[BUFFER_DEPTH].Renderbuffer->RedBits; |          = fb->Attachment[BUFFER_ACCUM].Renderbuffer->RedBits; | ||||||
|       fb->Visual.accumGreenBits |       fb->Visual.accumGreenBits | ||||||
|          = fb->Attachment[BUFFER_DEPTH].Renderbuffer->GreenBits; |          = fb->Attachment[BUFFER_ACCUM].Renderbuffer->GreenBits; | ||||||
|       fb->Visual.accumBlueBits |       fb->Visual.accumBlueBits | ||||||
|          = fb->Attachment[BUFFER_DEPTH].Renderbuffer->BlueBits; |          = fb->Attachment[BUFFER_ACCUM].Renderbuffer->BlueBits; | ||||||
|       fb->Visual.accumAlphaBits |       fb->Visual.accumAlphaBits | ||||||
|          = fb->Attachment[BUFFER_DEPTH].Renderbuffer->AlphaBits; |          = fb->Attachment[BUFFER_ACCUM].Renderbuffer->AlphaBits; | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    compute_depth_max(fb); |    compute_depth_max(fb); | ||||||
|   | |||||||
| @@ -85,7 +85,7 @@ compute_version(const GLcontext *ctx) | |||||||
|                               ctx->Extensions.ARB_texture_non_power_of_two && |                               ctx->Extensions.ARB_texture_non_power_of_two && | ||||||
|                               ctx->Extensions.EXT_blend_equation_separate); |                               ctx->Extensions.EXT_blend_equation_separate); | ||||||
|    const GLboolean ver_2_1 = (ver_2_0 && |    const GLboolean ver_2_1 = (ver_2_0 && | ||||||
|                               ctx->Extensions.ARB_shading_language_120 && |                               /*ctx->Extensions.ARB_shading_language_120 &&*/ | ||||||
|                               ctx->Extensions.EXT_pixel_buffer_object && |                               ctx->Extensions.EXT_pixel_buffer_object && | ||||||
|                               ctx->Extensions.EXT_texture_sRGB); |                               ctx->Extensions.EXT_texture_sRGB); | ||||||
|    if (ver_2_1) |    if (ver_2_1) | ||||||
| @@ -121,12 +121,6 @@ _mesa_GetString( GLenum name ) | |||||||
|    static const char *vendor = "Brian Paul"; |    static const char *vendor = "Brian Paul"; | ||||||
|    static const char *renderer = "Mesa"; |    static const char *renderer = "Mesa"; | ||||||
|  |  | ||||||
| #if FEATURE_ARB_shading_language_120_foo /* support not complete! */ |  | ||||||
|    static const char *sl_version = "1.20"; |  | ||||||
| #elif FEATURE_ARB_shading_language_100 |  | ||||||
|    static const char *sl_version = "1.10"; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|    if (!ctx) |    if (!ctx) | ||||||
|       return NULL; |       return NULL; | ||||||
|  |  | ||||||
| @@ -154,8 +148,10 @@ _mesa_GetString( GLenum name ) | |||||||
|          return (const GLubyte *) ctx->Extensions.String; |          return (const GLubyte *) ctx->Extensions.String; | ||||||
| #if FEATURE_ARB_shading_language_100 | #if FEATURE_ARB_shading_language_100 | ||||||
|       case GL_SHADING_LANGUAGE_VERSION_ARB: |       case GL_SHADING_LANGUAGE_VERSION_ARB: | ||||||
|          if (ctx->Extensions.ARB_shading_language_100) |          if (ctx->Extensions.ARB_shading_language_120) | ||||||
|             return (const GLubyte *) sl_version; |             return (const GLubyte *) "1.20"; | ||||||
|  |          else if (ctx->Extensions.ARB_shading_language_100) | ||||||
|  |             return (const GLubyte *) "1.10"; | ||||||
|          goto error; |          goto error; | ||||||
| #endif | #endif | ||||||
| #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ | #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ | ||||||
|   | |||||||
| @@ -559,7 +559,7 @@ _mesa_pow(double x, double y) | |||||||
| int | int | ||||||
| _mesa_ffs(int i) | _mesa_ffs(int i) | ||||||
| { | { | ||||||
| #if (defined(_WIN32) && !defined(__MINGW32__) ) || defined(__IBMC__) || defined(__IBMCPP__) | #if (defined(_WIN32) ) || defined(__IBMC__) || defined(__IBMCPP__) | ||||||
|    register int bit = 0; |    register int bit = 0; | ||||||
|    if (i != 0) { |    if (i != 0) { | ||||||
|       if ((i & 0xffff) == 0) { |       if ((i & 0xffff) == 0) { | ||||||
|   | |||||||
| @@ -184,6 +184,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) | |||||||
|    GET_CURRENT_CONTEXT(ctx); |    GET_CURRENT_CONTEXT(ctx); | ||||||
|    GLint i = (GLint) (light - GL_LIGHT0); |    GLint i = (GLint) (light - GL_LIGHT0); | ||||||
|    GLfloat temp[4]; |    GLfloat temp[4]; | ||||||
|  |    ASSERT_OUTSIDE_BEGIN_END(ctx); | ||||||
|  |  | ||||||
|    if (i < 0 || i >= (GLint) ctx->Const.MaxLights) { |    if (i < 0 || i >= (GLint) ctx->Const.MaxLights) { | ||||||
|       _mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light ); |       _mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light ); | ||||||
|   | |||||||
| @@ -1207,6 +1207,30 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { | |||||||
|    store_texel_z24_s8			/* StoreTexel */ |    store_texel_z24_s8			/* StoreTexel */ | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | const struct gl_texture_format _mesa_texformat_s8_z24 = { | ||||||
|  |    MESA_FORMAT_S8_Z24,			/* MesaFormat */ | ||||||
|  |    GL_DEPTH_STENCIL_EXT,		/* BaseFormat */ | ||||||
|  |    GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */ | ||||||
|  |    0,					/* RedBits */ | ||||||
|  |    0,					/* GreenBits */ | ||||||
|  |    0,					/* BlueBits */ | ||||||
|  |    0,					/* AlphaBits */ | ||||||
|  |    0,					/* LuminanceBits */ | ||||||
|  |    0,					/* IntensityBits */ | ||||||
|  |    0,					/* IndexBits */ | ||||||
|  |    24,					/* DepthBits */ | ||||||
|  |    8,					/* StencilBits */ | ||||||
|  |    4,					/* TexelBytes */ | ||||||
|  |    _mesa_texstore_s8_z24,		/* StoreTexImageFunc */ | ||||||
|  |    NULL,				/* FetchTexel1D */ | ||||||
|  |    NULL,				/* FetchTexel2D */ | ||||||
|  |    NULL,				/* FetchTexel3D */ | ||||||
|  |    fetch_texel_1d_f_s8_z24,		/* FetchTexel1Df */ | ||||||
|  |    fetch_texel_2d_f_s8_z24,		/* FetchTexel2Df */ | ||||||
|  |    fetch_texel_3d_f_s8_z24,		/* FetchTexel3Df */ | ||||||
|  |    store_texel_s8_z24			/* StoreTexel */ | ||||||
|  | }; | ||||||
|  |  | ||||||
| const struct gl_texture_format _mesa_texformat_z16 = { | const struct gl_texture_format _mesa_texformat_z16 = { | ||||||
|    MESA_FORMAT_Z16,			/* MesaFormat */ |    MESA_FORMAT_Z16,			/* MesaFormat */ | ||||||
|    GL_DEPTH_COMPONENT,			/* BaseFormat */ |    GL_DEPTH_COMPONENT,			/* BaseFormat */ | ||||||
|   | |||||||
| @@ -84,6 +84,7 @@ enum _format { | |||||||
|    MESA_FORMAT_YCBCR,		/*                     YYYY YYYY UorV UorV */ |    MESA_FORMAT_YCBCR,		/*                     YYYY YYYY UorV UorV */ | ||||||
|    MESA_FORMAT_YCBCR_REV,	/*                     UorV UorV YYYY YYYY */ |    MESA_FORMAT_YCBCR_REV,	/*                     UorV UorV YYYY YYYY */ | ||||||
|    MESA_FORMAT_Z24_S8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ |    MESA_FORMAT_Z24_S8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ | ||||||
|  |    MESA_FORMAT_S8_Z24,          /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ | ||||||
|    MESA_FORMAT_Z16,             /*                     ZZZZ ZZZZ ZZZZ ZZZZ */ |    MESA_FORMAT_Z16,             /*                     ZZZZ ZZZZ ZZZZ ZZZZ */ | ||||||
|    MESA_FORMAT_Z32,             /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ |    MESA_FORMAT_Z32,             /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ | ||||||
|    /*@}*/ |    /*@}*/ | ||||||
| @@ -211,6 +212,7 @@ extern const struct gl_texture_format _mesa_texformat_l8; | |||||||
| extern const struct gl_texture_format _mesa_texformat_i8; | extern const struct gl_texture_format _mesa_texformat_i8; | ||||||
| extern const struct gl_texture_format _mesa_texformat_ci8; | extern const struct gl_texture_format _mesa_texformat_ci8; | ||||||
| extern const struct gl_texture_format _mesa_texformat_z24_s8; | extern const struct gl_texture_format _mesa_texformat_z24_s8; | ||||||
|  | extern const struct gl_texture_format _mesa_texformat_s8_z24; | ||||||
| extern const struct gl_texture_format _mesa_texformat_z16; | extern const struct gl_texture_format _mesa_texformat_z16; | ||||||
| extern const struct gl_texture_format _mesa_texformat_z32; | extern const struct gl_texture_format _mesa_texformat_z32; | ||||||
| /*@}*/ | /*@}*/ | ||||||
|   | |||||||
| @@ -1117,6 +1117,7 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage, | |||||||
|          break;; |          break;; | ||||||
|       default: |       default: | ||||||
|          _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8"); |          _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8"); | ||||||
|  |          return; | ||||||
|       } |       } | ||||||
| #if CHAN_TYPE == GL_UNSIGNED_BYTE | #if CHAN_TYPE == GL_UNSIGNED_BYTE | ||||||
|       COPY_4UBV(texel, texelUB); |       COPY_4UBV(texel, texelUB); | ||||||
| @@ -1363,6 +1364,32 @@ static void store_texel_z24_s8(struct gl_texture_image *texImage, | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* MESA_TEXFORMAT_S8_Z24 ***************************************************/ | ||||||
|  |  | ||||||
|  | static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage, | ||||||
|  |                              GLint i, GLint j, GLint k, GLfloat *texel ) | ||||||
|  | { | ||||||
|  |    /* only return Z, not stencil data */ | ||||||
|  |    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); | ||||||
|  |    const GLfloat scale = 1.0F / (GLfloat) 0xffffff; | ||||||
|  |    texel[0] = ((*src) & 0x00ffffff) * scale; | ||||||
|  |    ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24); | ||||||
|  |    ASSERT(texel[0] >= 0.0F); | ||||||
|  |    ASSERT(texel[0] <= 1.0F); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if DIM == 3 | ||||||
|  | static void store_texel_s8_z24(struct gl_texture_image *texImage, | ||||||
|  |                                GLint i, GLint j, GLint k, const void *texel) | ||||||
|  | { | ||||||
|  |    /* only store Z, not stencil */ | ||||||
|  |    GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); | ||||||
|  |    GLfloat depth = *((GLfloat *) texel); | ||||||
|  |    GLuint zi = (GLuint) (depth * 0xffffff); | ||||||
|  |    *dst = zi | (*dst & 0xff000000); | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| #undef TEXEL_ADDR | #undef TEXEL_ADDR | ||||||
| #undef DIM | #undef DIM | ||||||
|   | |||||||
| @@ -2445,6 +2445,87 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Store a combined depth/stencil texture image. | ||||||
|  |  */ | ||||||
|  | GLboolean | ||||||
|  | _mesa_texstore_s8_z24(TEXSTORE_PARAMS) | ||||||
|  | { | ||||||
|  |    const GLuint depthScale = 0xffffff; | ||||||
|  |    const GLint srcRowStride | ||||||
|  |       = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) | ||||||
|  |       / sizeof(GLuint); | ||||||
|  |    GLint img, row; | ||||||
|  |  | ||||||
|  |    ASSERT(dstFormat == &_mesa_texformat_s8_z24); | ||||||
|  |    ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); | ||||||
|  |    ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); | ||||||
|  |  | ||||||
|  |    /* Incase we only upload depth we need to preserve the stencil */ | ||||||
|  |    if (srcFormat == GL_DEPTH_COMPONENT) { | ||||||
|  |       for (img = 0; img < srcDepth; img++) { | ||||||
|  |          GLuint *dstRow = (GLuint *) dstAddr | ||||||
|  |             + dstImageOffsets[dstZoffset + img] | ||||||
|  |             + dstYoffset * dstRowStride / sizeof(GLuint) | ||||||
|  |             + dstXoffset; | ||||||
|  |          const GLuint *src | ||||||
|  |             = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, | ||||||
|  |                   srcWidth, srcHeight, | ||||||
|  |                   srcFormat, srcType, | ||||||
|  |                   img, 0, 0); | ||||||
|  |          for (row = 0; row < srcHeight; row++) { | ||||||
|  |             GLuint depth[MAX_WIDTH]; | ||||||
|  |             GLint i; | ||||||
|  |             _mesa_unpack_depth_span(ctx, srcWidth, | ||||||
|  |                                     GL_UNSIGNED_INT, /* dst type */ | ||||||
|  |                                     depth, /* dst addr */ | ||||||
|  |                                     depthScale, | ||||||
|  |                                     srcType, src, srcPacking); | ||||||
|  |  | ||||||
|  |             for (i = 0; i < srcWidth; i++) | ||||||
|  |                dstRow[i] = depth[i] | (dstRow[i] & 0xFF000000); | ||||||
|  |  | ||||||
|  |             src += srcRowStride; | ||||||
|  |             dstRow += dstRowStride / sizeof(GLuint); | ||||||
|  |          } | ||||||
|  |       } | ||||||
|  |    } else { | ||||||
|  |       for (img = 0; img < srcDepth; img++) { | ||||||
|  |          GLuint *dstRow = (GLuint *) dstAddr | ||||||
|  |             + dstImageOffsets[dstZoffset + img] | ||||||
|  |             + dstYoffset * dstRowStride / sizeof(GLuint) | ||||||
|  |             + dstXoffset; | ||||||
|  |          const GLuint *src | ||||||
|  |             = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, | ||||||
|  |                   srcWidth, srcHeight, | ||||||
|  |                   srcFormat, srcType, | ||||||
|  |                   img, 0, 0); | ||||||
|  |          for (row = 0; row < srcHeight; row++) { | ||||||
|  |             GLubyte stencil[MAX_WIDTH]; | ||||||
|  |             GLint i; | ||||||
|  |             /* the 24 depth bits will be in the low position: */ | ||||||
|  |             _mesa_unpack_depth_span(ctx, srcWidth, | ||||||
|  |                                     GL_UNSIGNED_INT, /* dst type */ | ||||||
|  |                                     dstRow, /* dst addr */ | ||||||
|  |                                     depthScale, | ||||||
|  |                                     srcType, src, srcPacking); | ||||||
|  |             /* get the 8-bit stencil values */ | ||||||
|  |             _mesa_unpack_stencil_span(ctx, srcWidth, | ||||||
|  |                                       GL_UNSIGNED_BYTE, /* dst type */ | ||||||
|  |                                       stencil, /* dst addr */ | ||||||
|  |                                       srcType, src, srcPacking, | ||||||
|  |                                       ctx->_ImageTransferState); | ||||||
|  |             /* merge stencil values into depth values */ | ||||||
|  |             for (i = 0; i < srcWidth; i++) | ||||||
|  |                dstRow[i] |= stencil[i] << 24; | ||||||
|  |  | ||||||
|  |             src += srcRowStride; | ||||||
|  |             dstRow += dstRowStride / sizeof(GLuint); | ||||||
|  |          } | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  |    return GL_TRUE; | ||||||
|  | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Store an image in any of the formats: |  * Store an image in any of the formats: | ||||||
|   | |||||||
| @@ -57,6 +57,7 @@ extern GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS); | |||||||
| extern GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS); | extern GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS); | ||||||
| extern GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS); | extern GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS); | ||||||
| extern GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS); | extern GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS); | ||||||
|  | extern GLboolean _mesa_texstore_s8_z24(TEXSTORE_PARAMS); | ||||||
| extern GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS); | extern GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS); | ||||||
| extern GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS); | extern GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS); | ||||||
| extern GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS); | extern GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS); | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  6.5.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -62,14 +62,9 @@ update_array(GLcontext *ctx, struct gl_client_array *array, | |||||||
|    array->Normalized = normalized; |    array->Normalized = normalized; | ||||||
|    array->Ptr = (const GLubyte *) ptr; |    array->Ptr = (const GLubyte *) ptr; | ||||||
| #if FEATURE_ARB_vertex_buffer_object | #if FEATURE_ARB_vertex_buffer_object | ||||||
|    array->BufferObj->RefCount--; |    _mesa_reference_buffer_object(ctx, &array->BufferObj, | ||||||
|    if (array->BufferObj->RefCount <= 0) { |                                  ctx->Array.ArrayBufferObj); | ||||||
|       ASSERT(array->BufferObj->Name); |  | ||||||
|       _mesa_remove_buffer_object( ctx, array->BufferObj ); |  | ||||||
|       (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj ); |  | ||||||
|    } |  | ||||||
|    array->BufferObj = ctx->Array.ArrayBufferObj; |  | ||||||
|    array->BufferObj->RefCount++; |  | ||||||
|    /* Compute the index of the last array element that's inside the buffer. |    /* Compute the index of the last array element that's inside the buffer. | ||||||
|     * Later in glDrawArrays we'll check if start + count > _MaxElement to |     * Later in glDrawArrays we'll check if start + count > _MaxElement to | ||||||
|     * be sure we won't go out of bounds. |     * be sure we won't go out of bounds. | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  7.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -29,9 +29,9 @@ | |||||||
|  |  | ||||||
| /* Mesa version */ | /* Mesa version */ | ||||||
| #define MESA_MAJOR 7 | #define MESA_MAJOR 7 | ||||||
| #define MESA_MINOR 1 | #define MESA_MINOR 2 | ||||||
| #define MESA_PATCH 0 | #define MESA_PATCH 0 | ||||||
| #define MESA_VERSION_STRING "7.1 rc4" | #define MESA_VERSION_STRING "7.2" | ||||||
|  |  | ||||||
| /* To make version comparison easy */ | /* To make version comparison easy */ | ||||||
| #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||||||
|   | |||||||
| @@ -29,9 +29,9 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "glheader.h" | #include "main/glheader.h" | ||||||
| #include "imports.h" | #include "main/imports.h" | ||||||
| #include "macros.h" | #include "main/macros.h" | ||||||
| #include "prog_instruction.h" | #include "prog_instruction.h" | ||||||
| #include "prog_parameter.h" | #include "prog_parameter.h" | ||||||
| #include "prog_statevars.h" | #include "prog_statevars.h" | ||||||
| @@ -277,6 +277,26 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Mark the named uniform as 'used'. | ||||||
|  |  */ | ||||||
|  | void | ||||||
|  | _mesa_use_uniform(struct gl_program_parameter_list *paramList, | ||||||
|  |                   const char *name) | ||||||
|  | { | ||||||
|  |    GLuint i; | ||||||
|  |    for (i = 0; i < paramList->NumParameters; i++) { | ||||||
|  |       struct gl_program_parameter *p = paramList->Parameters + i; | ||||||
|  |       if (p->Type == PROGRAM_UNIFORM && _mesa_strcmp(p->Name, name) == 0) { | ||||||
|  |          p->Used = GL_TRUE; | ||||||
|  |          /* Note that large uniforms may occupy several slots so we're | ||||||
|  |           * not done searching yet. | ||||||
|  |           */ | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Add a sampler to the parameter list. |  * Add a sampler to the parameter list. | ||||||
|  * \param name  uniform's name |  * \param name  uniform's name | ||||||
| @@ -591,21 +611,24 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list) | |||||||
|    /** Not too efficient, but correct */ |    /** Not too efficient, but correct */ | ||||||
|    for (i = 0; i < list->NumParameters; i++) { |    for (i = 0; i < list->NumParameters; i++) { | ||||||
|       struct gl_program_parameter *p = list->Parameters + i; |       struct gl_program_parameter *p = list->Parameters + i; | ||||||
|  |       struct gl_program_parameter *pCopy; | ||||||
|       GLuint size = MIN2(p->Size, 4); |       GLuint size = MIN2(p->Size, 4); | ||||||
|       GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType, |       GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType, | ||||||
|                                     list->ParameterValues[i], NULL); |                                     list->ParameterValues[i], NULL); | ||||||
|       ASSERT(j >= 0); |       ASSERT(j >= 0); | ||||||
|  |       pCopy = clone->Parameters + j; | ||||||
|  |       pCopy->Used = p->Used; | ||||||
|       /* copy state indexes */ |       /* copy state indexes */ | ||||||
|       if (p->Type == PROGRAM_STATE_VAR) { |       if (p->Type == PROGRAM_STATE_VAR) { | ||||||
|          GLint k; |          GLint k; | ||||||
|          struct gl_program_parameter *q = clone->Parameters + j; |  | ||||||
|          for (k = 0; k < STATE_LENGTH; k++) { |          for (k = 0; k < STATE_LENGTH; k++) { | ||||||
|             q->StateIndexes[k] = p->StateIndexes[k]; |             pCopy->StateIndexes[k] = p->StateIndexes[k]; | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|       else { |       else { | ||||||
|          clone->Parameters[j].Size = p->Size; |          clone->Parameters[j].Size = p->Size; | ||||||
|       } |       } | ||||||
|  |        | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    clone->StateFlags = list->StateFlags; |    clone->StateFlags = list->StateFlags; | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ | |||||||
| #ifndef PROG_PARAMETER_H | #ifndef PROG_PARAMETER_H | ||||||
| #define PROG_PARAMETER_H | #define PROG_PARAMETER_H | ||||||
|  |  | ||||||
| #include "mtypes.h" | #include "main/mtypes.h" | ||||||
| #include "prog_statevars.h" | #include "prog_statevars.h" | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -48,6 +48,7 @@ struct gl_program_parameter | |||||||
|    enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ |    enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ | ||||||
|    GLenum DataType;         /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ |    GLenum DataType;         /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ | ||||||
|    GLuint Size;             /**< Number of components (1..4) */ |    GLuint Size;             /**< Number of components (1..4) */ | ||||||
|  |    GLboolean Used;          /**< Helper flag for GLSL uniform tracking */ | ||||||
|    /** |    /** | ||||||
|     * A sequence of STATE_* tokens and integers to identify GL state. |     * A sequence of STATE_* tokens and integers to identify GL state. | ||||||
|     */ |     */ | ||||||
| @@ -112,6 +113,10 @@ extern GLint | |||||||
| _mesa_add_uniform(struct gl_program_parameter_list *paramList, | _mesa_add_uniform(struct gl_program_parameter_list *paramList, | ||||||
|                   const char *name, GLuint size, GLenum datatype); |                   const char *name, GLuint size, GLenum datatype); | ||||||
|  |  | ||||||
|  | extern void | ||||||
|  | _mesa_use_uniform(struct gl_program_parameter_list *paramList, | ||||||
|  |                   const char *name); | ||||||
|  |  | ||||||
| extern GLint | extern GLint | ||||||
| _mesa_add_sampler(struct gl_program_parameter_list *paramList, | _mesa_add_sampler(struct gl_program_parameter_list *paramList, | ||||||
|                   const char *name, GLenum datatype); |                   const char *name, GLenum datatype); | ||||||
|   | |||||||
| @@ -473,32 +473,33 @@ vec4 pow(const vec4 a, const vec4 b) | |||||||
|  |  | ||||||
| float exp(const float a) | float exp(const float a) | ||||||
| { | { | ||||||
|    const float e = 2.71828; |    // NOTE: log2(e) = 1.44269502 | ||||||
|    __asm float_power __retVal, e, a; |    float t = a * 1.44269502; | ||||||
|  |    __asm float_exp2 __retVal, t; | ||||||
| } | } | ||||||
|  |  | ||||||
| vec2 exp(const vec2 a) | vec2 exp(const vec2 a) | ||||||
| { | { | ||||||
|    const float e = 2.71828; |    vec2 t = a * 1.44269502; | ||||||
|    __asm float_power __retVal.x, e, a.x; |    __asm float_exp2 __retVal.x, t.x; | ||||||
|    __asm float_power __retVal.y, e, a.y; |    __asm float_exp2 __retVal.y, t.y; | ||||||
| } | } | ||||||
|  |  | ||||||
| vec3 exp(const vec3 a) | vec3 exp(const vec3 a) | ||||||
| { | { | ||||||
|    const float e = 2.71828; |    vec3 t = a * 1.44269502; | ||||||
|    __asm float_power __retVal.x, e, a.x; |    __asm float_exp2 __retVal.x, t.x; | ||||||
|    __asm float_power __retVal.y, e, a.y; |    __asm float_exp2 __retVal.y, t.y; | ||||||
|    __asm float_power __retVal.z, e, a.z; |    __asm float_exp2 __retVal.z, t.z; | ||||||
| } | } | ||||||
|  |  | ||||||
| vec4 exp(const vec4 a) | vec4 exp(const vec4 a) | ||||||
| { | { | ||||||
|    const float e = 2.71828; |    vec4 t = a * 1.44269502; | ||||||
|    __asm float_power __retVal.x, e, a.x; |    __asm float_exp2 __retVal.x, t.x; | ||||||
|    __asm float_power __retVal.y, e, a.y; |    __asm float_exp2 __retVal.y, t.y; | ||||||
|    __asm float_power __retVal.z, e, a.z; |    __asm float_exp2 __retVal.z, t.z; | ||||||
|    __asm float_power __retVal.w, e, a.w; |    __asm float_exp2 __retVal.w, t.w; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1481,7 +1481,7 @@ _slang_simple_writemask(GLuint writemask, GLuint swizzle) | |||||||
|  * \return GL_FALSE for simple writemasks, GL_TRUE for non-simple |  * \return GL_FALSE for simple writemasks, GL_TRUE for non-simple | ||||||
|  */ |  */ | ||||||
| static GLboolean | static GLboolean | ||||||
| swizzle_to_writemask(GLuint swizzle, | swizzle_to_writemask(slang_assemble_ctx *A, GLuint swizzle, | ||||||
|                      GLuint *writemaskOut, GLuint *swizzleOut) |                      GLuint *writemaskOut, GLuint *swizzleOut) | ||||||
| { | { | ||||||
|    GLuint mask = 0x0, newSwizzle[4]; |    GLuint mask = 0x0, newSwizzle[4]; | ||||||
| @@ -1495,6 +1495,18 @@ swizzle_to_writemask(GLuint swizzle, | |||||||
|          break; |          break; | ||||||
|       } |       } | ||||||
|       assert(swz >= 0 && swz <= 3); |       assert(swz >= 0 && swz <= 3); | ||||||
|  |  | ||||||
|  |       if (swizzle != SWIZZLE_XXXX && | ||||||
|  |           swizzle != SWIZZLE_YYYY && | ||||||
|  |           swizzle != SWIZZLE_ZZZZ && | ||||||
|  |           swizzle != SWIZZLE_WWWW && | ||||||
|  |           (mask & (1 << swz))) { | ||||||
|  |          /* a channel can't be specified twice (ex: ".xyyz") */ | ||||||
|  |          slang_info_log_error(A->log, "Invalid writemask '%s'", | ||||||
|  |                               _mesa_swizzle_string(swizzle, 0, 0)); | ||||||
|  |          return GL_FALSE; | ||||||
|  |       } | ||||||
|  |  | ||||||
|       mask |= (1 << swz); |       mask |= (1 << swz); | ||||||
|    } |    } | ||||||
|    assert(mask <= 0xf); |    assert(mask <= 0xf); | ||||||
| @@ -1590,11 +1602,11 @@ resolve_swizzle(const slang_operation *oper) | |||||||
|  * As above, but produce a writemask. |  * As above, but produce a writemask. | ||||||
|  */ |  */ | ||||||
| static GLuint | static GLuint | ||||||
| resolve_writemask(const slang_operation *oper) | resolve_writemask(slang_assemble_ctx *A, const slang_operation *oper) | ||||||
| { | { | ||||||
|    GLuint swizzle = resolve_swizzle(oper); |    GLuint swizzle = resolve_swizzle(oper); | ||||||
|    GLuint writemask, swizzleOut; |    GLuint writemask, swizzleOut; | ||||||
|    swizzle_to_writemask(swizzle, &writemask, &swizzleOut); |    swizzle_to_writemask(A, swizzle, &writemask, &swizzleOut); | ||||||
|    return writemask; |    return writemask; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1668,7 +1680,7 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper, | |||||||
|  |  | ||||||
|       dest_oper = &oper->children[0]; |       dest_oper = &oper->children[0]; | ||||||
|  |  | ||||||
|       writemask = resolve_writemask(dest_oper); |       writemask = resolve_writemask(A, dest_oper); | ||||||
|  |  | ||||||
|       n0 = _slang_gen_operation(A, dest_oper); |       n0 = _slang_gen_operation(A, dest_oper); | ||||||
|       if (!n0) |       if (!n0) | ||||||
| @@ -1980,6 +1992,12 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, | |||||||
|       fun = _slang_locate_struct_constructor(A, name); |       fun = _slang_locate_struct_constructor(A, name); | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  |    /* | ||||||
|  |     * At this point, some heuristics are used to try to find a function | ||||||
|  |     * that matches the calling signature by means of casting or "unrolling" | ||||||
|  |     * of constructors. | ||||||
|  |     */ | ||||||
|  |  | ||||||
|    if (!fun && _slang_is_vec_mat_type(name)) { |    if (!fun && _slang_is_vec_mat_type(name)) { | ||||||
|       /* Next, if this call looks like a vec() or mat() constructor call, |       /* Next, if this call looks like a vec() or mat() constructor call, | ||||||
|        * try "unwinding" the args to satisfy a constructor. |        * try "unwinding" the args to satisfy a constructor. | ||||||
| @@ -1995,7 +2013,7 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, | |||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    if (!fun) { |    if (!fun && _slang_is_vec_mat_type(name)) { | ||||||
|       /* Next, try casting args to the types of the formal parameters */ |       /* Next, try casting args to the types of the formal parameters */ | ||||||
|       int numArgs = oper->num_children; |       int numArgs = oper->num_children; | ||||||
|       fun = _slang_find_function_by_argc(A->space.funcs, name, numArgs); |       fun = _slang_find_function_by_argc(A->space.funcs, name, numArgs); | ||||||
| @@ -2008,6 +2026,13 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, | |||||||
|       assert(fun); |       assert(fun); | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  |    if (!fun) { | ||||||
|  |       slang_info_log_error(A->log, | ||||||
|  |                            "Function '%s' not found (check argument types)", | ||||||
|  |                            name); | ||||||
|  |       return NULL; | ||||||
|  |    } | ||||||
|  |  | ||||||
|    n = _slang_gen_function_call(A, fun, oper, dest); |    n = _slang_gen_function_call(A, fun, oper, dest); | ||||||
|  |  | ||||||
|    if (n && !n->Store && !dest |    if (n && !n->Store && !dest | ||||||
| @@ -2716,7 +2741,11 @@ _slang_assignment_compatible(slang_assemble_ctx *A, | |||||||
|    slang_typeinfo t0, t1; |    slang_typeinfo t0, t1; | ||||||
|    GLuint sz0, sz1; |    GLuint sz0, sz1; | ||||||
|  |  | ||||||
|     |    if (op0->type == SLANG_OPER_POSTINCREMENT || | ||||||
|  |        op0->type == SLANG_OPER_POSTDECREMENT) { | ||||||
|  |       return GL_FALSE; | ||||||
|  |    } | ||||||
|  |  | ||||||
|    slang_typeinfo_construct(&t0); |    slang_typeinfo_construct(&t0); | ||||||
|    _slang_typeof_operation(A, op0, &t0); |    _slang_typeof_operation(A, op0, &t0); | ||||||
|  |  | ||||||
| @@ -3020,7 +3049,7 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) | |||||||
|       if (lhs && rhs) { |       if (lhs && rhs) { | ||||||
|          /* convert lhs swizzle into writemask */ |          /* convert lhs swizzle into writemask */ | ||||||
|          GLuint writemask, newSwizzle; |          GLuint writemask, newSwizzle; | ||||||
|          if (!swizzle_to_writemask(lhs->Store->Swizzle, |          if (!swizzle_to_writemask(A, lhs->Store->Swizzle, | ||||||
|                                    &writemask, &newSwizzle)) { |                                    &writemask, &newSwizzle)) { | ||||||
|             /* Non-simple writemask, need to swizzle right hand side in |             /* Non-simple writemask, need to swizzle right hand side in | ||||||
|              * order to put components into the right place. |              * order to put components into the right place. | ||||||
|   | |||||||
| @@ -108,7 +108,9 @@ writemask_to_swizzle(GLuint writemask) | |||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Swizzle a swizzle.  That is, return swz2(swz1) |  * Swizzle a swizzle (function composition). | ||||||
|  |  * That is, return swz2(swz1), or said another way: swz1.szw2 | ||||||
|  |  * Example: swizzle_swizzle(".zwxx", ".xxyw") yields ".zzwx" | ||||||
|  */ |  */ | ||||||
| GLuint | GLuint | ||||||
| _slang_swizzle_swizzle(GLuint swz1, GLuint swz2) | _slang_swizzle_swizzle(GLuint swz1, GLuint swz2) | ||||||
| @@ -279,7 +281,7 @@ storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st) | |||||||
|    while (st->Parent) { |    while (st->Parent) { | ||||||
|       st = st->Parent; |       st = st->Parent; | ||||||
|       index += st->Index; |       index += st->Index; | ||||||
|       swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle); |       swizzle = _slang_swizzle_swizzle(fix_swizzle(st->Swizzle), swizzle); | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    assert(st->File >= 0); |    assert(st->File >= 0); | ||||||
| @@ -1636,6 +1638,88 @@ emit_struct_field(slang_emit_info *emitInfo, slang_ir_node *n) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Emit code for a variable declaration. | ||||||
|  |  * This usually doesn't result in any code generation, but just | ||||||
|  |  * memory allocation. | ||||||
|  |  */ | ||||||
|  | static struct prog_instruction * | ||||||
|  | emit_var_decl(slang_emit_info *emitInfo, slang_ir_node *n) | ||||||
|  | { | ||||||
|  |    struct prog_instruction *inst; | ||||||
|  |  | ||||||
|  |    assert(n->Store); | ||||||
|  |    assert(n->Store->File != PROGRAM_UNDEFINED); | ||||||
|  |    assert(n->Store->Size > 0); | ||||||
|  |    /*assert(n->Store->Index < 0);*/ | ||||||
|  |  | ||||||
|  |    if (!n->Var || n->Var->isTemp) { | ||||||
|  |       /* a nameless/temporary variable, will be freed after first use */ | ||||||
|  |       /*NEW*/ | ||||||
|  |       if (n->Store->Index < 0 && !_slang_alloc_temp(emitInfo->vt, n->Store)) { | ||||||
|  |          slang_info_log_error(emitInfo->log, | ||||||
|  |                               "Ran out of registers, too many temporaries"); | ||||||
|  |          return NULL; | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  |    else { | ||||||
|  |       /* a regular variable */ | ||||||
|  |       _slang_add_variable(emitInfo->vt, n->Var); | ||||||
|  |       if (!_slang_alloc_var(emitInfo->vt, n->Store)) { | ||||||
|  |          slang_info_log_error(emitInfo->log, | ||||||
|  |                               "Ran out of registers, too many variables"); | ||||||
|  |          return NULL; | ||||||
|  |       } | ||||||
|  |       /* | ||||||
|  |         printf("IR_VAR_DECL %s %d store %p\n", | ||||||
|  |         (char*) n->Var->a_name, n->Store->Index, (void*) n->Store); | ||||||
|  |       */ | ||||||
|  |       assert(n->Var->aux == n->Store); | ||||||
|  |    } | ||||||
|  |    if (emitInfo->EmitComments) { | ||||||
|  |       /* emit NOP with comment describing the variable's storage location */ | ||||||
|  |       char s[1000]; | ||||||
|  |       sprintf(s, "TEMP[%d]%s = variable %s (size %d)", | ||||||
|  |               n->Store->Index, | ||||||
|  |               _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE),  | ||||||
|  |               (n->Var ? (char *) n->Var->a_name : "anonymous"), | ||||||
|  |               n->Store->Size); | ||||||
|  |       inst = emit_comment(emitInfo, s); | ||||||
|  |       return inst; | ||||||
|  |    } | ||||||
|  |    return NULL; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Emit code for a reference to a variable. | ||||||
|  |  * Actually, no code is generated but we may do some memory alloation. | ||||||
|  |  * In particular, state vars (uniforms) are allocated on an as-needed basis. | ||||||
|  |  */ | ||||||
|  | static struct prog_instruction * | ||||||
|  | emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) | ||||||
|  | { | ||||||
|  |    assert(n->Store); | ||||||
|  |    assert(n->Store->File != PROGRAM_UNDEFINED); | ||||||
|  |  | ||||||
|  |    if (n->Store->File == PROGRAM_STATE_VAR && n->Store->Index < 0) { | ||||||
|  |       n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters); | ||||||
|  |    } | ||||||
|  |    else if (n->Store->File == PROGRAM_UNIFORM) { | ||||||
|  |       /* mark var as used */ | ||||||
|  |       _mesa_use_uniform(emitInfo->prog->Parameters, (char *) n->Var->a_name); | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    if (n->Store->Index < 0) { | ||||||
|  |       /* probably ran out of registers */ | ||||||
|  |       return NULL; | ||||||
|  |    } | ||||||
|  |    assert(n->Store->Size > 0); | ||||||
|  |  | ||||||
|  |    return NULL; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static struct prog_instruction * | static struct prog_instruction * | ||||||
| emit(slang_emit_info *emitInfo, slang_ir_node *n) | emit(slang_emit_info *emitInfo, slang_ir_node *n) | ||||||
| { | { | ||||||
| @@ -1671,64 +1755,14 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n) | |||||||
|  |  | ||||||
|    case IR_VAR_DECL: |    case IR_VAR_DECL: | ||||||
|       /* Variable declaration - allocate a register for it */ |       /* Variable declaration - allocate a register for it */ | ||||||
|       assert(n->Store); |       inst = emit_var_decl(emitInfo, n); | ||||||
|       assert(n->Store->File != PROGRAM_UNDEFINED); |       return inst; | ||||||
|       assert(n->Store->Size > 0); |  | ||||||
|       /*assert(n->Store->Index < 0);*/ |  | ||||||
|       if (!n->Var || n->Var->isTemp) { |  | ||||||
|          /* a nameless/temporary variable, will be freed after first use */ |  | ||||||
|          /*NEW*/ |  | ||||||
|          if (n->Store->Index < 0 && !_slang_alloc_temp(emitInfo->vt, n->Store)) { |  | ||||||
|             slang_info_log_error(emitInfo->log, |  | ||||||
|                                  "Ran out of registers, too many temporaries"); |  | ||||||
|             return NULL; |  | ||||||
|          } |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|          /* a regular variable */ |  | ||||||
|          _slang_add_variable(emitInfo->vt, n->Var); |  | ||||||
|          if (!_slang_alloc_var(emitInfo->vt, n->Store)) { |  | ||||||
|             slang_info_log_error(emitInfo->log, |  | ||||||
|                                  "Ran out of registers, too many variables"); |  | ||||||
|             return NULL; |  | ||||||
|          } |  | ||||||
|          /* |  | ||||||
|          printf("IR_VAR_DECL %s %d store %p\n", |  | ||||||
|                 (char*) n->Var->a_name, n->Store->Index, (void*) n->Store); |  | ||||||
|          */ |  | ||||||
|          assert(n->Var->aux == n->Store); |  | ||||||
|       } |  | ||||||
|       if (emitInfo->EmitComments) { |  | ||||||
|          /* emit NOP with comment describing the variable's storage location */ |  | ||||||
|          char s[1000]; |  | ||||||
|          sprintf(s, "TEMP[%d]%s = variable %s (size %d)", |  | ||||||
|                  n->Store->Index, |  | ||||||
|                  _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE),  |  | ||||||
|                  (n->Var ? (char *) n->Var->a_name : "anonymous"), |  | ||||||
|                  n->Store->Size); |  | ||||||
|          inst = emit_comment(emitInfo, s); |  | ||||||
|          return inst; |  | ||||||
|       } |  | ||||||
|       return NULL; |  | ||||||
|  |  | ||||||
|    case IR_VAR: |    case IR_VAR: | ||||||
|       /* Reference to a variable |       /* Reference to a variable | ||||||
|        * Storage should have already been resolved/allocated. |        * Storage should have already been resolved/allocated. | ||||||
|        */ |        */ | ||||||
|       assert(n->Store); |       return emit_var_ref(emitInfo, n); | ||||||
|       assert(n->Store->File != PROGRAM_UNDEFINED); |  | ||||||
|  |  | ||||||
|       if (n->Store->File == PROGRAM_STATE_VAR && |  | ||||||
|           n->Store->Index < 0) { |  | ||||||
|          n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters); |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       if (n->Store->Index < 0) { |  | ||||||
|          /* probably ran out of registers */ |  | ||||||
|          return NULL; |  | ||||||
|       } |  | ||||||
|       assert(n->Store->Size > 0); |  | ||||||
|       break; |  | ||||||
|  |  | ||||||
|    case IR_ELEMENT: |    case IR_ELEMENT: | ||||||
|       return emit_array_element(emitInfo, n); |       return emit_array_element(emitInfo, n); | ||||||
| @@ -1939,6 +1973,7 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, | |||||||
|    GET_CURRENT_CONTEXT(ctx); |    GET_CURRENT_CONTEXT(ctx); | ||||||
|    GLboolean success; |    GLboolean success; | ||||||
|    slang_emit_info emitInfo; |    slang_emit_info emitInfo; | ||||||
|  |    GLuint maxUniforms; | ||||||
|  |  | ||||||
|    emitInfo.log = log; |    emitInfo.log = log; | ||||||
|    emitInfo.vt = vt; |    emitInfo.vt = vt; | ||||||
| @@ -1955,6 +1990,19 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, | |||||||
|       emitInfo.EmitHighLevelInstructions = GL_TRUE; |       emitInfo.EmitHighLevelInstructions = GL_TRUE; | ||||||
|    }       |    }       | ||||||
|  |  | ||||||
|  |    /* Check uniform/constant limits */ | ||||||
|  |    if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { | ||||||
|  |       maxUniforms = ctx->Const.FragmentProgram.MaxUniformComponents / 4; | ||||||
|  |    } | ||||||
|  |    else { | ||||||
|  |       assert(prog->Target == GL_VERTEX_PROGRAM_ARB); | ||||||
|  |       maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4; | ||||||
|  |    } | ||||||
|  |    if (prog->Parameters->NumParameters > maxUniforms) { | ||||||
|  |       slang_info_log_error(log, "Constant/uniform register limit exceeded"); | ||||||
|  |       return GL_FALSE; | ||||||
|  |    } | ||||||
|  |  | ||||||
|    (void) emit(&emitInfo, n); |    (void) emit(&emitInfo, n); | ||||||
|  |  | ||||||
|    /* finish up by adding the END opcode to program */ |    /* finish up by adding the END opcode to program */ | ||||||
|   | |||||||
| @@ -173,7 +173,7 @@ link_uniform_vars(struct gl_shader_program *shProg, | |||||||
|        * Furthermore, we'll need to fix the state-var's size/datatype info. |        * Furthermore, we'll need to fix the state-var's size/datatype info. | ||||||
|        */ |        */ | ||||||
|  |  | ||||||
|       if (p->Type == PROGRAM_UNIFORM || |       if ((p->Type == PROGRAM_UNIFORM && p->Used) || | ||||||
|           p->Type == PROGRAM_SAMPLER) { |           p->Type == PROGRAM_SAMPLER) { | ||||||
|          _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); |          _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -342,6 +342,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c, | |||||||
|       break;								\ |       break;								\ | ||||||
|    default:								\ |    default:								\ | ||||||
|       _mesa_problem(ctx, "Bad wrap mode");				\ |       _mesa_problem(ctx, "Bad wrap mode");				\ | ||||||
|  |       return;								\ | ||||||
|    }									\ |    }									\ | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -462,6 +463,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c, | |||||||
|       break;								\ |       break;								\ | ||||||
|    default:								\ |    default:								\ | ||||||
|       _mesa_problem(ctx, "Bad wrap mode");				\ |       _mesa_problem(ctx, "Bad wrap mode");				\ | ||||||
|  |       return;								\ | ||||||
|    }									\ |    }									\ | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -235,7 +235,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) | |||||||
|  */ |  */ | ||||||
| #define PREFER_DP4 0 | #define PREFER_DP4 0 | ||||||
|  |  | ||||||
| #define MAX_INSN 256 | #define MAX_INSN 350 | ||||||
|  |  | ||||||
| /* Use uregs to represent registers internally, translate to Mesa's | /* Use uregs to represent registers internally, translate to Mesa's | ||||||
|  * expected formats on emit.   |  * expected formats on emit.   | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /************************************************************************** | /************************************************************************** | ||||||
|  |  | ||||||
| Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. | Copyright 2002-2008 Tungsten Graphics Inc., Cedar Park, Texas. | ||||||
|  |  | ||||||
| All Rights Reserved. | All Rights Reserved. | ||||||
|  |  | ||||||
| @@ -31,6 +31,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "main/glheader.h" | #include "main/glheader.h" | ||||||
|  | #include "main/bufferobj.h" | ||||||
| #include "main/context.h" | #include "main/context.h" | ||||||
| #include "main/macros.h" | #include "main/macros.h" | ||||||
| #include "main/vtxfmt.h" | #include "main/vtxfmt.h" | ||||||
| @@ -655,7 +656,10 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) | |||||||
|    /* Allocate a buffer object.  Will just reuse this object |    /* Allocate a buffer object.  Will just reuse this object | ||||||
|     * continuously. |     * continuously. | ||||||
|     */ |     */ | ||||||
|    exec->vtx.bufferobj = ctx->Array.NullBufferObj; |    _mesa_reference_buffer_object(ctx, | ||||||
|  |                                  &exec->vtx.bufferobj, | ||||||
|  |                                  ctx->Array.NullBufferObj); | ||||||
|  |  | ||||||
|    exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64); |    exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64); | ||||||
|  |  | ||||||
|    vbo_exec_vtxfmt_init( exec ); |    vbo_exec_vtxfmt_init( exec ); | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  5.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -26,6 +26,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "main/glheader.h" | #include "main/glheader.h" | ||||||
|  | #include "main/bufferobj.h" | ||||||
| #include "main/context.h" | #include "main/context.h" | ||||||
| #include "main/enums.h" | #include "main/enums.h" | ||||||
| #include "main/state.h" | #include "main/state.h" | ||||||
| @@ -155,8 +156,12 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) | |||||||
|     */ |     */ | ||||||
|    switch (get_program_mode(exec->ctx)) { |    switch (get_program_mode(exec->ctx)) { | ||||||
|    case VP_NONE: |    case VP_NONE: | ||||||
|       memcpy(arrays,      vbo->legacy_currval, 16 * sizeof(arrays[0])); |       for (attr = 0; attr < 16; attr++) { | ||||||
|       memcpy(arrays + 16, vbo->mat_currval,    MAT_ATTRIB_MAX * sizeof(arrays[0])); |          exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; | ||||||
|  |       } | ||||||
|  |       for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { | ||||||
|  |          exec->vtx.inputs[attr + 16] = &vbo->mat_currval[attr]; | ||||||
|  |       } | ||||||
|       map = vbo->map_vp_none; |       map = vbo->map_vp_none; | ||||||
|       break; |       break; | ||||||
|    case VP_NV: |    case VP_NV: | ||||||
| @@ -165,8 +170,10 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) | |||||||
|        * occurred.  NV vertex programs cannot access material values, |        * occurred.  NV vertex programs cannot access material values, | ||||||
|        * nor attributes greater than VERT_ATTRIB_TEX7.   |        * nor attributes greater than VERT_ATTRIB_TEX7.   | ||||||
|        */ |        */ | ||||||
|       memcpy(arrays,      vbo->legacy_currval,  16 * sizeof(arrays[0])); |       for (attr = 0; attr < 16; attr++) { | ||||||
|       memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0])); |          exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; | ||||||
|  |          exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr]; | ||||||
|  |       } | ||||||
|       map = vbo->map_vp_arb; |       map = vbo->map_vp_arb; | ||||||
|       break; |       break; | ||||||
|    } |    } | ||||||
| @@ -178,13 +185,18 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) | |||||||
|       GLuint src = map[attr]; |       GLuint src = map[attr]; | ||||||
|  |  | ||||||
|       if (exec->vtx.attrsz[src]) { |       if (exec->vtx.attrsz[src]) { | ||||||
|  |          /* override the default array set above */ | ||||||
|  |          exec->vtx.inputs[attr] = &arrays[attr]; | ||||||
|  |  | ||||||
| 	 arrays[attr].Ptr = (void *)data; | 	 arrays[attr].Ptr = (void *)data; | ||||||
| 	 arrays[attr].Size = exec->vtx.attrsz[src]; | 	 arrays[attr].Size = exec->vtx.attrsz[src]; | ||||||
| 	 arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat); | 	 arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat); | ||||||
| 	 arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat); | 	 arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat); | ||||||
| 	 arrays[attr].Type = GL_FLOAT; | 	 arrays[attr].Type = GL_FLOAT; | ||||||
| 	 arrays[attr].Enabled = 1; | 	 arrays[attr].Enabled = 1; | ||||||
| 	 arrays[attr].BufferObj = exec->vtx.bufferobj; /* NullBufferObj */ |          _mesa_reference_buffer_object(ctx, | ||||||
|  |                                        &arrays[attr].BufferObj, | ||||||
|  |                                        exec->vtx.bufferobj); | ||||||
| 	 arrays[attr]._MaxElement = count; /* ??? */ | 	 arrays[attr]._MaxElement = count; /* ??? */ | ||||||
|  |  | ||||||
| 	 data += exec->vtx.attrsz[src] * sizeof(GLfloat); | 	 data += exec->vtx.attrsz[src] * sizeof(GLfloat); | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  6.3 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -27,6 +27,7 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| #include "main/mtypes.h" | #include "main/mtypes.h" | ||||||
|  | #include "main/bufferobj.h" | ||||||
| #include "main/dlist.h" | #include "main/dlist.h" | ||||||
| #include "main/vtxfmt.h" | #include "main/vtxfmt.h" | ||||||
| #include "main/imports.h" | #include "main/imports.h" | ||||||
| @@ -71,19 +72,24 @@ void vbo_save_destroy( GLcontext *ctx ) | |||||||
| { | { | ||||||
|    struct vbo_context *vbo = vbo_context(ctx); |    struct vbo_context *vbo = vbo_context(ctx); | ||||||
|    struct vbo_save_context *save = &vbo->save; |    struct vbo_save_context *save = &vbo->save; | ||||||
|  |    GLuint i; | ||||||
|  |  | ||||||
|    if (save->prim_store) { |    if (save->prim_store) { | ||||||
|       if ( --save->prim_store->refcount == 0 ) { |       if ( --save->prim_store->refcount == 0 ) { | ||||||
|          FREE( save->prim_store ); |          FREE( save->prim_store ); | ||||||
|          save->prim_store = NULL; |          save->prim_store = NULL; | ||||||
|       } |       } | ||||||
|       if ( --save->vertex_store->refcount == 0 ) { |       if ( --save->vertex_store->refcount == 0 ) { | ||||||
|          if (save->vertex_store->bufferobj) |          _mesa_reference_buffer_object(ctx, | ||||||
|             ctx->Driver.DeleteBuffer( ctx, save->vertex_store->bufferobj ); |                                        &save->vertex_store->bufferobj, NULL); | ||||||
|  |  | ||||||
|          FREE( save->vertex_store ); |          FREE( save->vertex_store ); | ||||||
|          save->vertex_store = NULL; |          save->vertex_store = NULL; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  |    for (i = 0; i < VBO_ATTRIB_MAX; i++) { | ||||||
|  |       _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL); | ||||||
|  |    } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /************************************************************************** | /************************************************************************** | ||||||
|  |  | ||||||
| Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. | Copyright 2002-2008 Tungsten Graphics Inc., Cedar Park, Texas. | ||||||
|  |  | ||||||
| All Rights Reserved. | All Rights Reserved. | ||||||
|  |  | ||||||
| @@ -68,6 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||||||
|  |  | ||||||
|  |  | ||||||
| #include "main/glheader.h" | #include "main/glheader.h" | ||||||
|  | #include "main/bufferobj.h" | ||||||
| #include "main/context.h" | #include "main/context.h" | ||||||
| #include "main/dlist.h" | #include "main/dlist.h" | ||||||
| #include "main/enums.h" | #include "main/enums.h" | ||||||
| @@ -85,6 +86,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* An interesting VBO number/name to help with debugging */ | ||||||
|  | #define VBO_BUF_ID  12345 | ||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * NOTE: Old 'parity' issue is gone, but copying can still be |  * NOTE: Old 'parity' issue is gone, but copying can still be | ||||||
|  * wrong-footed on replay. |  * wrong-footed on replay. | ||||||
| @@ -170,7 +175,9 @@ static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx ) | |||||||
|     * user.  Perhaps there could be a special number for internal |     * user.  Perhaps there could be a special number for internal | ||||||
|     * buffers: |     * buffers: | ||||||
|     */ |     */ | ||||||
|    vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB); |    vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, | ||||||
|  |                                                          VBO_BUF_ID, | ||||||
|  |                                                          GL_ARRAY_BUFFER_ARB); | ||||||
|  |  | ||||||
|    ctx->Driver.BufferData( ctx,  |    ctx->Driver.BufferData( ctx,  | ||||||
| 			   GL_ARRAY_BUFFER_ARB,  | 			   GL_ARRAY_BUFFER_ARB,  | ||||||
| @@ -190,8 +197,9 @@ static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *ver | |||||||
| { | { | ||||||
|    assert(!vertex_store->buffer); |    assert(!vertex_store->buffer); | ||||||
|  |  | ||||||
|    if (vertex_store->bufferobj) |    if (vertex_store->bufferobj) { | ||||||
|       ctx->Driver.DeleteBuffer( ctx, vertex_store->bufferobj ); |       _mesa_reference_buffer_object(ctx, &vertex_store->bufferobj, NULL); | ||||||
|  |    } | ||||||
|  |  | ||||||
|    FREE( vertex_store ); |    FREE( vertex_store ); | ||||||
| } | } | ||||||
| @@ -1139,6 +1147,7 @@ void vbo_save_api_init( struct vbo_save_context *save ) | |||||||
|    _save_vtxfmt_init( ctx ); |    _save_vtxfmt_init( ctx ); | ||||||
|    _save_current_init( ctx ); |    _save_current_init( ctx ); | ||||||
|  |  | ||||||
|  |    /* These will actually get set again when binding/drawing */ | ||||||
|    for (i = 0; i < VBO_ATTRIB_MAX; i++) |    for (i = 0; i < VBO_ATTRIB_MAX; i++) | ||||||
|       save->inputs[i] = &save->arrays[i]; |       save->inputs[i] = &save->arrays[i]; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  6.1 |  * Version:  7.2 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -27,6 +27,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "main/glheader.h" | #include "main/glheader.h" | ||||||
|  | #include "main/bufferobj.h" | ||||||
| #include "main/context.h" | #include "main/context.h" | ||||||
| #include "main/imports.h" | #include "main/imports.h" | ||||||
| #include "main/mtypes.h" | #include "main/mtypes.h" | ||||||
| @@ -115,8 +116,12 @@ static void vbo_bind_vertex_list( GLcontext *ctx, | |||||||
|     */ |     */ | ||||||
|    switch (get_program_mode(ctx)) { |    switch (get_program_mode(ctx)) { | ||||||
|    case VP_NONE: |    case VP_NONE: | ||||||
|       memcpy(arrays,      vbo->legacy_currval, 16 * sizeof(arrays[0])); |       for (attr = 0; attr < 16; attr++) { | ||||||
|       memcpy(arrays + 16, vbo->mat_currval,    MAT_ATTRIB_MAX * sizeof(arrays[0])); |          save->inputs[attr] = &vbo->legacy_currval[attr]; | ||||||
|  |       } | ||||||
|  |       for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { | ||||||
|  |          save->inputs[attr + 16] = &vbo->mat_currval[attr]; | ||||||
|  |       } | ||||||
|       map = vbo->map_vp_none; |       map = vbo->map_vp_none; | ||||||
|       break; |       break; | ||||||
|    case VP_NV: |    case VP_NV: | ||||||
| @@ -125,8 +130,10 @@ static void vbo_bind_vertex_list( GLcontext *ctx, | |||||||
|        * occurred.  NV vertex programs cannot access material values, |        * occurred.  NV vertex programs cannot access material values, | ||||||
|        * nor attributes greater than VERT_ATTRIB_TEX7.   |        * nor attributes greater than VERT_ATTRIB_TEX7.   | ||||||
|        */ |        */ | ||||||
|       memcpy(arrays,      vbo->legacy_currval,  16 * sizeof(arrays[0])); |       for (attr = 0; attr < 16; attr++) { | ||||||
|       memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0])); |          save->inputs[attr] = &vbo->legacy_currval[attr]; | ||||||
|  |          save->inputs[attr + 16] = &vbo->generic_currval[attr]; | ||||||
|  |       } | ||||||
|       map = vbo->map_vp_arb; |       map = vbo->map_vp_arb; | ||||||
|       break; |       break; | ||||||
|    } |    } | ||||||
| @@ -135,13 +142,18 @@ static void vbo_bind_vertex_list( GLcontext *ctx, | |||||||
|       GLuint src = map[attr]; |       GLuint src = map[attr]; | ||||||
|  |  | ||||||
|       if (node->attrsz[src]) { |       if (node->attrsz[src]) { | ||||||
| 	 arrays[attr].Ptr = (const GLubyte *)data; |          /* override the default array set above */ | ||||||
|  |          save->inputs[attr] = &arrays[attr]; | ||||||
|  |  | ||||||
|  | 	 arrays[attr].Ptr = (const GLubyte *) data; | ||||||
| 	 arrays[attr].Size = node->attrsz[src]; | 	 arrays[attr].Size = node->attrsz[src]; | ||||||
| 	 arrays[attr].StrideB = node->vertex_size * sizeof(GLfloat); | 	 arrays[attr].StrideB = node->vertex_size * sizeof(GLfloat); | ||||||
| 	 arrays[attr].Stride = node->vertex_size * sizeof(GLfloat); | 	 arrays[attr].Stride = node->vertex_size * sizeof(GLfloat); | ||||||
| 	 arrays[attr].Type = GL_FLOAT; | 	 arrays[attr].Type = GL_FLOAT; | ||||||
| 	 arrays[attr].Enabled = 1; | 	 arrays[attr].Enabled = 1; | ||||||
| 	 arrays[attr].BufferObj = node->vertex_store->bufferobj; |          _mesa_reference_buffer_object(ctx, | ||||||
|  |                                        &arrays[attr].BufferObj, | ||||||
|  |                                        node->vertex_store->bufferobj); | ||||||
| 	 arrays[attr]._MaxElement = node->count; /* ??? */ | 	 arrays[attr]._MaxElement = node->count; /* ??? */ | ||||||
| 	  | 	  | ||||||
| 	 assert(arrays[attr].BufferObj->Name); | 	 assert(arrays[attr].BufferObj->Name); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user