Compare commits

...

36 Commits

Author SHA1 Message Date
Brian Paul
419353dc2f mesa: Makefile: 7.2 release candidate 1 2008-09-13 16:06:12 -06:00
Brian Paul
38d3b2262b mesa: documentation updates for 7.2 release 2008-09-13 14:43:54 -06:00
Brian Paul
4db2a7f36c updated Cell driver info 2008-09-13 14:39:39 -06:00
Brian Paul
1145042fd2 Mesa: version bumps for 7.2 release 2008-09-13 14:36:35 -06:00
Brian Paul
772131280a document 7.2 bug fixes, etc 2008-09-13 14:36:17 -06:00
Jakub Bogusz
ee913c0fcc tdfx: fix crash and lack of visuals bug 2008-09-13 14:34:51 -06:00
Guillaume Melquiond
cd1804c43a i915: fix himask constant init for 64-bit build 2008-09-13 14:26:35 -06:00
Guillaume Melquiond
253784d45e glx: fix 64-bit datatype issue 2008-09-13 14:26:25 -06:00
Guillaume Melquiond
463d19d477 mesa: return after _mesa_problem() calls 2008-09-13 14:26:18 -06:00
Guillaume Melquiond
6e4fd90ca5 mesa: #include <stdio.h> 2008-09-13 14:26:13 -06:00
Guillaume Melquiond
06188c0c5c remove invalid XDestroyWindow() call 2008-09-13 14:26:06 -06:00
Guillaume Melquiond
dec9097647 silence warning 2008-09-13 14:25:59 -06:00
Guillaume Melquiond
e234339dba GLU: fix asst warnings 2008-09-13 14:25:53 -06:00
Ian Romanick
bb09d23e92 Remove DRI2 support
Remove support for the original incarnation of DRI2.  This version has
since been abandoned and will never ship.  This eliminates a build
dependency on a component that only exists in Fedora 9 and in now-dead
up-stream development trees.

I also recommend that we spin a Mesa 7.1.1 release with this patch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2008-09-12 13:48:14 -07:00
Xiang, Haihao
1ffbcddb6f i965: Add support for G41 chipset which is another 4 series.
(cherry picked from commit b2e083eba2)
2008-09-12 09:29:00 +08:00
Shane Blackett
33cf8f5c06 added 24bpp support 2008-09-11 08:35:37 -06:00
Shane Blackett
7b8d878bed Fixes for Mingw 2008-09-10 08:23:19 -06:00
Brian Paul
86ae34fbb4 mesa: replace MALLOC w/ CALLOC to fix memory error in glPushClientAttrib() 2008-09-05 08:07:07 -06:00
Brian Paul
16f3461fd6 mesa: improved gl_buffer_object reference counting
Use new _mesa_reference_buffer_object() function wherever possible.
Fixes buffer object/display list crash reported in ParaView.
2008-09-04 15:26:07 -06:00
Xiang, Haihao
0ac8886b51 intel: Fix depth_stencil texture.
(cherry picked from commit 0adfd10210)
2008-09-04 11:54:31 +08:00
Xiang, Haihao
1729d37223 mesa: merge stencil values into depth values for MESA_FORMAT_S8_Z24
(cherry picked from commit 218df7f9c5)
2008-09-04 11:54:21 +08:00
Jakob Bornecrantz
81edef6f9f mesa: Support for MESA_FORMAT_S8_Z24 texture
cherry-picked from gallium-0.1
(cherry picked from commit dc44bb8e92)
2008-09-04 11:54:08 +08:00
Brian Paul
e040e18c7b fix BUFFER_DEPTH/BUFFER_ACCUM mix-up 2008-09-02 18:13:53 -06:00
Roland Scheidegger
14d186644b fix no error generated when calling glLight{if}[v] inside begin/end (bug 17408) 2008-09-02 15:49:35 +02:00
Xiang, Haihao
e4535e4d5e i965: force thread switch after IF/ELSE/ENDIF. partial fix for #16882.
A thread switch is implicitly invoked after the issuance of an IF/ELSE/ENDIF
instruction if necessary. Unfortunately it seems sometimes a forced thread
switch is needed.
2008-08-29 10:30:12 +08:00
Xiang, Haihao
a008813890 i965: mask control for BREAK/CONT/DO/WHILE. partial fix fox #16882 2008-08-29 10:30:03 +08:00
Xiang, Haihao
da50dc7bb3 i965: Push/pop instruction state. partial fix for #16882 2008-08-29 10:29:57 +08:00
Brian Paul
7f628d9cbc mesa: bump MAX_INSN to 350 2008-08-28 15:16:33 -06:00
Brian Paul
b2ffd0be03 placeholder for upcoming 7.2 release notes 2008-08-26 16:24:37 -06:00
Brian Paul
912b16c689 added 7.1 MD5 sums 2008-08-26 16:11:56 -06:00
Brian Paul
6d9b25e522 mesa: don't check for GLSL 1.2 to advertise GL 2.1
The GLSL 1.2 features are minor...
2008-08-26 15:50:11 -06:00
Corbin Simpson
31bad23f0f note ATI R500 series support 2008-08-26 12:39:27 -06:00
Timo Jyrinki
29b9b25e72 asst. html doc updates 2008-08-26 12:36:23 -06:00
Brian Paul
e794f496c6 mesa: assorted updates/prep for 7.1 release 2008-08-25 14:09:14 -06:00
Brian Paul
68067c66d3 mesa: glsl: regenerated file 2008-08-25 09:16:21 -06:00
Brian Paul
ad5474e995 mesa: glsl: grab latest fixes from gallium-0.1 branch
Includes:
1. Fixes failed asserting about bad swizzles in src reg emit.
2. Tracks uniform var usage.
3. Emit exp() in terms of EXP2 instruction.
2008-08-25 09:15:16 -06:00
73 changed files with 1620 additions and 1661 deletions

View File

@@ -174,10 +174,10 @@ ultrix-gcc:
# Rules for making release tarballs
DIRECTORY = Mesa-7.1-rc4
LIB_NAME = MesaLib-7.1-rc4
DEMO_NAME = MesaDemos-7.1-rc4
GLUT_NAME = MesaGLUT-7.1-rc4
DIRECTORY = Mesa-7.2-rc1
LIB_NAME = MesaLib-7.2-rc1
DEMO_NAME = MesaDemos-7.2-rc1
GLUT_NAME = MesaGLUT-7.2-rc1
MAIN_FILES = \
$(DIRECTORY)/Makefile* \

View File

@@ -86,7 +86,6 @@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
LIBDRM_LIB = @LIBDRM_LIBS@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
EXPAT_INCLUDES = @EXPAT_INCLUDES@
# Autoconf directories

View File

@@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=1
MESA_MINOR=2
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)

View File

@@ -23,7 +23,6 @@ AC_CANONICAL_HOST
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.3.1
DRI2PROTO_REQUIRED=1.1
dnl Check for progs
AC_PROG_CPP
@@ -531,7 +530,6 @@ dri)
# Check for libdrm
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
# find the DRI deps for libGL
if test "$x11_pkgconfig" = yes; then

View File

@@ -6,7 +6,7 @@
<BODY>
<H1>Mesa Cell Driver</H1>
<H1>Mesa/Gallium Cell Driver</H1>
<p>
The Mesa
@@ -23,18 +23,19 @@ Two phases are planned.
First, to implement the framework for parallel rasterization using the Cell
SPEs, including texture mapping.
Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
The second phase is now underway.
</p>
<H2>Source Code</H2>
<p>
The Cell driver source code is on the <code>gallium-0.1</code> branch of the
git repository.
The latest Cell driver source code is on the <code>gallium-0.2</code> branch
of the Mesa git repository.
After you've cloned the repository, check out the branch with:
</p>
<pre>
git-checkout -b gallium-0.1 origin/gallium-0.1
git-checkout -b gallium-0.2 origin/gallium-0.2
</pre>
<p>
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>
If using Cell SDK 3.0, first edit configs/linux-cell and add
<code>-DSPU_MAIN_PARAM_LONG_LONG</code> to the SPU_CFLAGS.
If using Cell SDK 2.1, see the configs/linux-cell file for some
special changes.
</p>
<p>
To compile the code, run <code>make linux-cell</code>.
To build in debug mode, run <code>make linux-cell-debug</code>.
</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>
and looking for:
<pre>
OpenGL renderer string: Gallium 0.1, Cell on Xlib
OpenGL renderer string: Gallium 0.2, Cell on Xlib
</pre>
@@ -77,21 +79,49 @@ SPU local store as needed.
Similarly, textures are tiled and brought into local store as needed.
</p>
<p>
More recently, vertex transformation has been parallelized across the SPUs
as well.
</p>
<H2>Status</H2>
<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.
Simple demos like gears run successfully.
To test texture mapping, try progs/demos/texcyl (press right mouse button for
rendering options).
</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>

View File

@@ -48,6 +48,7 @@ a:visited {
<li><a href="lists.html" target="MainFrame">Mailing Lists</a>
<li><a href="bugs.html" target="MainFrame">Bug Database</a>
<li><a href="webmaster.html" target="MainFrame">Webmaster</a>
<li><a href="http://dri.freedesktop.org/" target="MainFrame">Wiki</a>
</ul>
<b>User Topics</b>

View File

@@ -9,7 +9,9 @@
<H1>Downloading</H1>
<p>
Last stable release: <b>7.0.4</b>
Current stable release: <b>7.2</b>
<br>
Current development: Mesa git/master
</p>
<p>

View File

@@ -22,9 +22,10 @@ for modern GPUs.
<p>
Mesa ties into several other open-source projects: the
<a href="http://dri.sf.net/" target="_parent">Direct Rendering Infrastructure</a>
and <a href="http://x.org" target="_parent">X.org</a> to provide OpenGL
support to users of X on Linux, FreeBSD and other operating systems.
<a href="http://dri.freedesktop.org/" target="_parent">Direct Rendering
Infrastructure</a> and <a href="http://x.org" target="_parent">X.org</a> to
provide OpenGL support to users of X on Linux, FreeBSD and other operating
systems.
</p>

View File

@@ -9,7 +9,7 @@
<H1>Mailing Lists</H1>
<p>There are four Mesa mailing lists:
<p>There are four Mesa 3D / DRI mailing lists:
</p>
<ul>
@@ -19,14 +19,14 @@ versions are sent to this list.
</li>
<br>
<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
resources and Mesa documentation first.
resources and Mesa/DRI documentation first.
</li>
<br>
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev"
target="_parent">mesa3d-dev</a> - for discussion of Mesa development.
Not for beginners.
target="_parent">mesa3d-dev</a> - for discussion of Mesa and Direct Rendering
Infrastructure development. Not for beginners.
</li>
<br>
<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>
</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>
<b>Notice</b>: non-member posts to any of these lists will be automatically
rejected.

View File

@@ -11,6 +11,23 @@
<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>
<p>
<a href="relnotes-7.0.4.html">Mesa 7.0.4</a> is released.

View File

@@ -8,28 +8,46 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.1 Release Notes / May XX, 2008</H1>
<H1>Mesa 7.1 Release Notes / August 26, 2008</H1>
<p>
Mesa 7.1 is a new development release.
There have been many internal code changes since Mesa 7.0.x.
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>
<h2>MD5 checksums</h2>
<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>
<h2>New features</h2>
<ul>
<li>autoconf-based configuration (and clean-up of Makefiles)
<li>Assorted DRI driver enhancements
<li>Reduced dependencies between X server and Mesa
<li>GL_EXT_texture_from_pixmap extension for Xlib driver
<li>Support for the GL shading language with i965 driver (implemented by Intel)
<li>ATI R500 series support (Radeon X1300&#8211;X1950) in r300 DRI driver
</ul>
@@ -37,6 +55,7 @@ TBD
<ul>
<li>Numerous GLSL fixes
<li>Fixed some error code/detection bugs in the GLSL-related API functions
<li>Lots of DRI driver fixes.
</ul>

86
docs/relnotes-7.2.html Normal file
View 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>

View File

@@ -20,6 +20,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<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.0.4.html">7.0.4 release notes</A>
<LI><A HREF="relnotes-7.0.3.html">7.0.3 release notes</A>

View File

@@ -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);
}
static void printstring(void *font, char *string)
static void printstring(void *font, const char *string)
{
int len,i;

View File

@@ -447,7 +447,6 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
if (!ctx) {
fprintf(stderr, "Error: glXCreateContext failed\n");
XFree(visinfo);
XDestroyWindow(dpy, win);
return;
}

View File

@@ -43,7 +43,7 @@
#define __glumystdio_h_
#ifdef STANDALONE
inline void _glu_dprintf( char *, ... ) { }
inline void _glu_dprintf( const char *, ... ) { }
#endif
#ifdef LIBRARYBUILD
@@ -51,12 +51,12 @@ inline void _glu_dprintf( char *, ... ) { }
#include <stdio.h>
#define _glu_dprintf printf
#else
inline void _glu_dprintf( char *, ... ) { }
inline void _glu_dprintf( const char *, ... ) { }
#endif
#endif
#ifdef GLBUILD
inline void _glu_dprintf( char *, ... ) { }
inline void _glu_dprintf( const char *, ... ) { }
#endif
#ifndef NULL

View File

@@ -246,7 +246,7 @@ Backend::evalVStrip(int n_left, REAL u_left, REAL* left_val,
*-------------------------------------------------------------------------
*/
void
Backend::bgntmesh( char * )
Backend::bgntmesh( const char * )
{
#ifndef NOWIREFRAME

View File

@@ -65,7 +65,7 @@ public:
void surfbbox( long, REAL *, REAL * );
void surfgrid( REAL, REAL, long, REAL, REAL, long );
void surfmesh( long, long, long, long );
void bgntmesh( char * );
void bgntmesh( const char * );
void endtmesh( void );
void swaptmesh( void );
void tmeshvert( GridTrimVertex * );

View File

@@ -48,7 +48,7 @@
* 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))
buffersize = sizeof(Buffer);

View File

@@ -55,7 +55,7 @@ class Buffer {
class Pool {
public:
Pool( int, int, char * );
Pool( int, int, const char * );
~Pool( void );
inline void* new_buffer( void );
inline void free_buffer( void * );
@@ -74,7 +74,7 @@ protected:
int nextfree; /* byte offset past next free buffer */
int initsize;
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 */
};

View File

@@ -126,7 +126,7 @@ int Knotvector::validate( void )
return 0;
}
void Knotvector::show( char *msg )
void Knotvector::show( const char *msg )
{
#ifndef NDEBUG
_glu_dprintf( "%s\n", msg );

View File

@@ -49,7 +49,7 @@ struct Knotvector { /* a knot vector */
~Knotvector( void );
void init( long, long, long, INREAL * );
int validate( void );
void show( char * );
void show( const char * );
long order; /* order of spline */
long knotcount; /* number of knots */

View File

@@ -677,7 +677,7 @@ NurbsTessellator::do_nurbserror( int msg )
}
int
NurbsTessellator::do_check_knots( Knotvector *knots, char *msg )
NurbsTessellator::do_check_knots( Knotvector *knots, const char *msg )
{
int status = knots->validate();
if( status ) {

View File

@@ -112,7 +112,7 @@ protected:
private:
void resetObjects( void );
int do_check_knots( Knotvector *, char * );
int do_check_knots( Knotvector *, const char * );
void do_nurbserror( int );
void do_bgncurve( O_curve * );
void do_endcurve( void );

View File

@@ -35,9 +35,7 @@ SOURCES = \
dri_common.c \
dri_glx.c \
XF86dri.c \
glxhash.c \
dri2_glx.c \
dri2.c
glxhash.c
include $(TOP)/src/mesa/sources
@@ -53,7 +51,6 @@ INCLUDES = -I. \
-I$(TOP)/src/mesa/main \
-I$(TOP)/src/mesa/glapi \
$(LIBDRM_CFLAGS) \
$(DRI2PROTO_CFLAGS) \
$(X11_INCLUDES)

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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 */

View File

@@ -151,7 +151,6 @@ struct __GLXDRIdrawableRec {
*/
extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy);
extern __GLXDRIdisplay *driCreateDisplay(Display *dpy);
extern __GLXDRIdisplay *dri2CreateDisplay(Display *dpy);
extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
@@ -570,7 +569,6 @@ struct __GLXdisplayPrivateRec {
*/
__GLXDRIdisplay *driswDisplay;
__GLXDRIdisplay *driDisplay;
__GLXDRIdisplay *dri2Display;
#endif
};

View File

@@ -207,10 +207,6 @@ static int __glXFreeDisplayPrivate(XExtData *extension)
if (priv->driDisplay)
(*priv->driDisplay->destroyDisplay)(priv->driDisplay);
priv->driDisplay = NULL;
if (priv->dri2Display)
(*priv->dri2Display->destroyDisplay)(priv->dri2Display);
priv->dri2Display = NULL;
#endif
Xfree((char*) priv);
@@ -608,9 +604,6 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
if (psc->drawHash == NULL)
continue;
if (priv->dri2Display)
psc->driScreen = (*priv->dri2Display->createScreen)(psc, i, priv);
if (psc->driScreen == NULL && priv->driDisplay)
psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
@@ -716,7 +709,6 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy)
** (e.g., those called in AllocAndFetchScreenConfigs).
*/
if (glx_direct && glx_accel) {
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
dpyPriv->driDisplay = driCreateDisplay(dpy);
}
if (glx_direct)

View File

@@ -193,7 +193,13 @@ void __indirect_glGetVertexAttribivARB( GLuint index, GLenum pname,
get_vertex_attrib( gc, 1303, index, pname, (xReply *) & reply );
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) {
*params = (GLint) reply.pad3;
}

View File

@@ -154,7 +154,7 @@ DRIVER_SOURCES = \
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)))

View File

@@ -177,7 +177,7 @@ static GLboolean debug_variable_length_prim( struct debug_stream *stream )
#define BITS( dw, hi, lo, ... ) \
do { \
unsigned himask = ~0UL >> (31 - (hi)); \
unsigned himask = 0xffffffffU >> (31 - (hi)); \
PRINTF("\t\t "); \
PRINTF(__VA_ARGS__); \
PRINTF(": 0x%x\n", ((dw) & himask) >> (lo)); \

View File

@@ -78,7 +78,7 @@ translate_texture_format(GLuint mesa_format, GLenum DepthMode)
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
case MESA_FORMAT_RGBA_DXT5:
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
case MESA_FORMAT_Z24_S8:
case MESA_FORMAT_S8_Z24:
return (MAPSURF_32BIT | MT_32BIT_xI824);
default:
fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format);

View File

@@ -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.predicate_control = BRW_PREDICATE_NORMAL;
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;
@@ -538,6 +540,8 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p,
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.execution_size = if_insn->header.execution_size;
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.
*/
@@ -579,6 +583,7 @@ void brw_ENDIF(struct brw_compile *p,
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.execution_size = patch_insn->header.execution_size;
insn->header.mask_control = BRW_MASK_ENABLE;
insn->header.thread_control = BRW_THREAD_SWITCH;
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));
insn->header.compression_control = BRW_COMPRESSION_NONE;
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;
return insn;
}
@@ -631,7 +636,7 @@ struct brw_instruction *brw_CONT(struct brw_compile *p)
brw_set_src1(insn, brw_imm_d(0x0));
insn->header.compression_control = BRW_COMPRESSION_NONE;
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;
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.predicate_control = BRW_PREDICATE_NONE;
/* insn->header.mask_control = BRW_MASK_ENABLE; */
insn->header.mask_control = BRW_MASK_DISABLE;
/* insn->header.mask_control = BRW_MASK_DISABLE; */
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_DISABLE;
/* insn->header.mask_control = BRW_MASK_DISABLE; */
p->current->header.predicate_control = BRW_PREDICATE_NONE;
return insn;
}

View File

@@ -850,20 +850,20 @@ static void emit_sop(struct brw_wm_compile *c,
struct brw_reg dst, src0, src1;
int i;
brw_push_insn_state(p);
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
dst = get_dst_reg(c, inst, i, 1);
src0 = get_src_reg(c, &inst->SrcReg[0], 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_set_predicate_control(p, BRW_PREDICATE_NONE);
brw_MOV(p, dst, brw_imm_f(0.0));
brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
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,

View File

@@ -138,7 +138,7 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum depth_mode )
case MESA_FORMAT_SRGB_DXT1:
return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
case MESA_FORMAT_Z24_S8:
case MESA_FORMAT_S8_Z24:
return BRW_SURFACEFORMAT_I24X8_UNORM;
default:

View File

@@ -58,6 +58,7 @@
#define PCI_CHIP_IGD_E_G 0x2E02
#define PCI_CHIP_Q45_G 0x2E12
#define PCI_CHIP_G45_G 0x2E22
#define PCI_CHIP_G41_G 0x2E32
#define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \
devid == PCI_CHIP_I915_GM || \
@@ -70,7 +71,8 @@
#define IS_GM45_GM(devid) (devid == PCI_CHIP_GM45_GM)
#define IS_G4X(devid) (devid == PCI_CHIP_IGD_E_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 || \
devid == PCI_CHIP_E7221_G || \

View File

@@ -178,6 +178,9 @@ intelGetString(GLcontext * ctx, GLenum name)
case PCI_CHIP_Q45_G:
chipset = "Intel(R) Q45/Q43";
break;
case PCI_CHIP_G41_G:
chipset = "Intel(R) G41";
break;
default:
chipset = "Unknown Intel Chipset";
break;

View File

@@ -138,7 +138,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
return &_mesa_texformat_z24_s8;
return &_mesa_texformat_s8_z24;
#ifndef I915
case GL_SRGB_EXT:

View File

@@ -65,6 +65,7 @@ DRI_CONF_END;
static const __DRIextension *tdfxExtensions[] = {
&driReadDrawableExtension,
NULL
};
static const GLuint __driNConfigOptions = 1;
@@ -350,12 +351,7 @@ tdfxFillInModes(__DRIscreenPrivate *psp,
unsigned stencil_bits,
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 i, db, depth, accum, stencil;
/* 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
@@ -363,55 +359,32 @@ tdfxFillInModes(__DRIscreenPrivate *psp,
* will never be used.
*/
num_modes = (depth_bits == 16) ? 32 : 16;
configs = _mesa_malloc(num_modes * sizeof *configs);
c = configs;
for (i = 0; i <= 1; i++) {
for (db = 0; db <= 1; db++) {
for (depth = 0; depth <= 1; depth++) {
for (accum = 0; accum <= 1; accum++) {
for (stencil = 0; stencil <= !deep; stencil++) {
*c = _mesa_malloc(sizeof **c);
m = &(*c++)->modes;
if (deep) stencil = depth;
m->redBits = deep ? 8 : 5;
m->greenBits = deep ? 8 : 6;
m->blueBits = deep ? 8 : 5;
m->alphaBits = deep ? 8 : 0;
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;
}
}
}
}
static const GLenum db_modes[2] = { GLX_NONE, GLX_SWAP_UNDEFINED_OML };
uint8_t depth_bits_array[4];
uint8_t stencil_bits_array[4];
if(deep) {
depth_bits_array[0] = 0;
depth_bits_array[1] = 24;
stencil_bits_array[0] = 0;
stencil_bits_array[1] = 8;
} else {
depth_bits_array[0] = depth_bits;
depth_bits_array[1] = 0;
depth_bits_array[2] = depth_bits;
depth_bits_array[3] = 0;
stencil_bits_array[0] = 0;
stencil_bits_array[1] = 0;
stencil_bits_array[2] = 8;
stencil_bits_array[3] = 8;
}
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);
}
/**

View File

@@ -118,6 +118,7 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC)
/* Only 16 and 32 bit targets are supported now */
assert(pwfb->cColorBits == 0 ||
pwfb->cColorBits == 16 ||
pwfb->cColorBits == 24 ||
pwfb->cColorBits == 32);
switch(pwfb->cColorBits){
@@ -127,6 +128,7 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC)
case 16:
pwfb->pixelformat = PF_5R6G5B;
break;
case 24:
case 32:
pwfb->pixelformat = PF_8R8G8B;
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 */
@@ -1077,7 +1268,7 @@ wmesa_renderbuffer_storage(GLcontext *ctx,
* on if we're drawing to the front or back color buffer.
*/
void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
int double_buffer)
BYTE cColorBits, int double_buffer)
{
if (double_buffer) {
/* back buffer */
@@ -1097,16 +1288,32 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->BlueBits = 5;
break;
case PF_8R8G8B:
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;
if (cColorBits == 24)
{
rb->PutRow = write_rgba_span_24;
rb->PutRowRGB = write_rgb_span_24;
rb->PutMonoRow = write_mono_rgba_span_24;
rb->PutValues = write_rgba_pixels_24;
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->GreenBits = 8;
rb->BlueBits = 8;
}
break;
default:
break;
@@ -1413,11 +1620,11 @@ void WMesaMakeCurrent(WMesaContext c, HDC hdc)
if (visual->doubleBufferMode == 1) {
rb = wmesa_new_renderbuffer();
_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();
_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 */
_mesa_add_soft_renderbuffers(&pwfb->Base,

View File

@@ -34,6 +34,7 @@
#endif
#include <stdlib.h>
#include <stdio.h>
#include "glthread.h"

View File

@@ -1,8 +1,8 @@
/*
* 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
*
* 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 *
_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)
_mesa_initialize_array_object(ctx, obj, name);
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 */
/**********************************************************************/
@@ -311,18 +320,18 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids)
/* Unbind any buffer objects that might be bound to arrays in
* this array object.
*/
_mesa_unbind_buffer_object( ctx, obj->Vertex.BufferObj );
_mesa_unbind_buffer_object( ctx, obj->Normal.BufferObj );
_mesa_unbind_buffer_object( ctx, obj->Color.BufferObj );
_mesa_unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj );
_mesa_unbind_buffer_object( ctx, obj->FogCoord.BufferObj );
_mesa_unbind_buffer_object( ctx, obj->Index.BufferObj );
unbind_buffer_object( ctx, obj->Vertex.BufferObj );
unbind_buffer_object( ctx, obj->Normal.BufferObj );
unbind_buffer_object( ctx, obj->Color.BufferObj );
unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj );
unbind_buffer_object( ctx, obj->FogCoord.BufferObj );
unbind_buffer_object( ctx, obj->Index.BufferObj );
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++) {
_mesa_unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj );
unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj );
}
#endif

View File

@@ -1,8 +1,8 @@
/*
* 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
* 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_UNPACK_BIT (1<<21)
@@ -1292,31 +1315,29 @@ _mesa_PushClientAttrib(GLbitfield mask)
return;
}
/* Build linked list of attribute nodes which save all attribute */
/* groups specified by the mask. */
/* Build linked list of attribute nodes which save all attribute
* groups specified by the mask.
*/
head = NULL;
if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
struct gl_pixelstore_attrib *attr;
#if FEATURE_EXT_pixel_buffer_object
ctx->Pack.BufferObj->RefCount++;
ctx->Unpack.BufferObj->RefCount++;
#endif
/* packing attribs */
attr = MALLOC_STRUCT( gl_pixelstore_attrib );
MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) );
attr = CALLOC_STRUCT( gl_pixelstore_attrib );
copy_pixelstore(ctx, attr, &ctx->Pack);
newnode = new_attrib_node( GL_CLIENT_PACK_BIT );
newnode->data = attr;
newnode->next = head;
head = newnode;
/* unpacking attribs */
attr = MALLOC_STRUCT( gl_pixelstore_attrib );
MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) );
attr = CALLOC_STRUCT( gl_pixelstore_attrib );
copy_pixelstore(ctx, attr, &ctx->Unpack);
newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT );
newnode->data = attr;
newnode->next = head;
head = newnode;
}
if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
struct gl_array_attrib *attr;
struct gl_array_object *obj;
@@ -1353,7 +1374,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
void GLAPIENTRY
_mesa_PopClientAttrib(void)
{
struct gl_attrib_node *attr, *next;
struct gl_attrib_node *node, *next;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -1364,37 +1385,31 @@ _mesa_PopClientAttrib(void)
}
ctx->ClientAttribStackDepth--;
attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth];
node = ctx->ClientAttribStack[ctx->ClientAttribStackDepth];
while (attr) {
switch (attr->kind) {
while (node) {
switch (node->kind) {
case GL_CLIENT_PACK_BIT:
#if FEATURE_EXT_pixel_buffer_object
ctx->Pack.BufferObj->RefCount--;
if (ctx->Pack.BufferObj->RefCount <= 0) {
_mesa_remove_buffer_object( ctx, ctx->Pack.BufferObj );
(*ctx->Driver.DeleteBuffer)( ctx, ctx->Pack.BufferObj );
{
struct gl_pixelstore_attrib *store =
(struct gl_pixelstore_attrib *) node->data;
copy_pixelstore(ctx, &ctx->Pack, store);
_mesa_reference_buffer_object(ctx, &store->BufferObj, NULL);
}
#endif
MEMCPY( &ctx->Pack, attr->data,
sizeof(struct gl_pixelstore_attrib) );
ctx->NewState |= _NEW_PACKUNPACK;
break;
case GL_CLIENT_UNPACK_BIT:
#if FEATURE_EXT_pixel_buffer_object
ctx->Unpack.BufferObj->RefCount--;
if (ctx->Unpack.BufferObj->RefCount <= 0) {
_mesa_remove_buffer_object( ctx, ctx->Unpack.BufferObj );
(*ctx->Driver.DeleteBuffer)( ctx, ctx->Unpack.BufferObj );
{
struct gl_pixelstore_attrib *store =
(struct gl_pixelstore_attrib *) node->data;
copy_pixelstore(ctx, &ctx->Unpack, store);
_mesa_reference_buffer_object(ctx, &store->BufferObj, NULL);
}
#endif
MEMCPY( &ctx->Unpack, attr->data,
sizeof(struct gl_pixelstore_attrib) );
ctx->NewState |= _NEW_PACKUNPACK;
break;
case GL_CLIENT_VERTEX_ARRAY_BIT: {
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);
@@ -1431,10 +1446,10 @@ _mesa_PopClientAttrib(void)
break;
}
next = attr->next;
FREE( attr->data );
FREE( attr );
attr = next;
next = node->next;
FREE( node->data );
FREE( node );
node = next;
}
}

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
* Version: 7.2
*
* 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)
_mesa_free(bufObj->Data);
/* assign strange values here to help w/ debugging */
bufObj->RefCount = -1000;
bufObj->Name = ~0;
_mesa_free(bufObj);
}
/**
* Set ptr to bufObj w/ reference counting.
*/
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) {
bufObj->RefCount--;
if (bufObj->RefCount <= 0) {
if (*ptr == bufObj)
return;
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.ElementArrayBufferObj != bufObj);
ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj);
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
* 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
* 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);
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");
return;
}
_mesa_save_buffer_object(ctx, newBufObj);
_mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj);
}
}
/* Make new binding */
*bindTarget = newBufObj;
newBufObj->RefCount++;
/* bind new buffer */
_mesa_reference_buffer_object(ctx, bindTarget, newBufObj);
/* Pass BindBuffer call to device driver */
if (ctx->Driver.BindBuffer && 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 */
@@ -759,54 +791,18 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
ASSERT(bufObj->Name == ids[i]);
if (ctx->Array.ArrayObj->Vertex.BufferObj == bufObj) {
bufObj->RefCount--;
ctx->Array.ArrayObj->Vertex.BufferObj = ctx->Array.NullBufferObj;
ctx->Array.NullBufferObj->RefCount++;
}
if (ctx->Array.ArrayObj->Normal.BufferObj == bufObj) {
bufObj->RefCount--;
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++;
}
unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->Color.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->SecondaryColor.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->FogCoord.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->Index.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->EdgeFlag.BufferObj, bufObj);
for (j = 0; j < MAX_TEXTURE_UNITS; j++) {
if (ctx->Array.ArrayObj->TexCoord[j].BufferObj == bufObj) {
bufObj->RefCount--;
ctx->Array.ArrayObj->TexCoord[j].BufferObj = ctx->Array.NullBufferObj;
ctx->Array.NullBufferObj->RefCount++;
}
unbind(ctx, &ctx->Array.ArrayObj->TexCoord[j].BufferObj, bufObj);
}
for (j = 0; j < VERT_ATTRIB_MAX; j++) {
if (ctx->Array.ArrayObj->VertexAttrib[j].BufferObj == bufObj) {
bufObj->RefCount--;
ctx->Array.ArrayObj->VertexAttrib[j].BufferObj = ctx->Array.NullBufferObj;
ctx->Array.NullBufferObj->RefCount++;
}
unbind(ctx, &ctx->Array.ArrayObj->VertexAttrib[j].BufferObj, 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 */
_mesa_remove_buffer_object(ctx, bufObj);
_mesa_unbind_buffer_object(ctx, bufObj);
_mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name);
_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");
return;
}
_mesa_save_buffer_object(ctx, bufObj);
_mesa_HashInsert(ctx->Shared->BufferObjects, first + i, bufObj);
buffer[i] = first + i;
}

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
* Version: 7.2
*
* 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 );
extern void
_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj );
extern void
_mesa_remove_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);
extern void
_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);
extern void
_mesa_unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj );
/*
* API functions

View File

@@ -1,8 +1,8 @@
/*
* 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
* copy of this software and associated documentation files (the "Software"),

View File

@@ -1,8 +1,8 @@
/*
* 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
* 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) {
fb->Visual.haveAccumBuffer = GL_TRUE;
fb->Visual.accumRedBits
= fb->Attachment[BUFFER_DEPTH].Renderbuffer->RedBits;
= fb->Attachment[BUFFER_ACCUM].Renderbuffer->RedBits;
fb->Visual.accumGreenBits
= fb->Attachment[BUFFER_DEPTH].Renderbuffer->GreenBits;
= fb->Attachment[BUFFER_ACCUM].Renderbuffer->GreenBits;
fb->Visual.accumBlueBits
= fb->Attachment[BUFFER_DEPTH].Renderbuffer->BlueBits;
= fb->Attachment[BUFFER_ACCUM].Renderbuffer->BlueBits;
fb->Visual.accumAlphaBits
= fb->Attachment[BUFFER_DEPTH].Renderbuffer->AlphaBits;
= fb->Attachment[BUFFER_ACCUM].Renderbuffer->AlphaBits;
}
compute_depth_max(fb);

View File

@@ -85,7 +85,7 @@ compute_version(const GLcontext *ctx)
ctx->Extensions.ARB_texture_non_power_of_two &&
ctx->Extensions.EXT_blend_equation_separate);
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_texture_sRGB);
if (ver_2_1)
@@ -121,12 +121,6 @@ _mesa_GetString( GLenum name )
static const char *vendor = "Brian Paul";
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)
return NULL;
@@ -154,8 +148,10 @@ _mesa_GetString( GLenum name )
return (const GLubyte *) ctx->Extensions.String;
#if FEATURE_ARB_shading_language_100
case GL_SHADING_LANGUAGE_VERSION_ARB:
if (ctx->Extensions.ARB_shading_language_100)
return (const GLubyte *) sl_version;
if (ctx->Extensions.ARB_shading_language_120)
return (const GLubyte *) "1.20";
else if (ctx->Extensions.ARB_shading_language_100)
return (const GLubyte *) "1.10";
goto error;
#endif
#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \

View File

@@ -559,7 +559,7 @@ _mesa_pow(double x, double y)
int
_mesa_ffs(int i)
{
#if (defined(_WIN32) && !defined(__MINGW32__) ) || defined(__IBMC__) || defined(__IBMCPP__)
#if (defined(_WIN32) ) || defined(__IBMC__) || defined(__IBMCPP__)
register int bit = 0;
if (i != 0) {
if ((i & 0xffff) == 0) {

View File

@@ -184,6 +184,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
GET_CURRENT_CONTEXT(ctx);
GLint i = (GLint) (light - GL_LIGHT0);
GLfloat temp[4];
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (i < 0 || i >= (GLint) ctx->Const.MaxLights) {
_mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light );

View File

@@ -1207,6 +1207,30 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = {
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 = {
MESA_FORMAT_Z16, /* MesaFormat */
GL_DEPTH_COMPONENT, /* BaseFormat */

View File

@@ -84,6 +84,7 @@ enum _format {
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
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_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_ci8;
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_z32;
/*@}*/

View File

@@ -1117,6 +1117,7 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage,
break;;
default:
_mesa_problem(ctx, "Bad palette format in fetch_texel_ci8");
return;
}
#if CHAN_TYPE == GL_UNSIGNED_BYTE
COPY_4UBV(texel, texelUB);
@@ -1363,6 +1364,32 @@ static void store_texel_z24_s8(struct gl_texture_image *texImage,
#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 DIM

View File

@@ -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:

View File

@@ -57,6 +57,7 @@ extern GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_ycbcr(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_z32(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS);

View File

@@ -1,8 +1,8 @@
/*
* 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
* 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->Ptr = (const GLubyte *) ptr;
#if FEATURE_ARB_vertex_buffer_object
array->BufferObj->RefCount--;
if (array->BufferObj->RefCount <= 0) {
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++;
_mesa_reference_buffer_object(ctx, &array->BufferObj,
ctx->Array.ArrayBufferObj);
/* Compute the index of the last array element that's inside the buffer.
* Later in glDrawArrays we'll check if start + count > _MaxElement to
* be sure we won't go out of bounds.

View File

@@ -1,8 +1,8 @@
/*
* 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
* copy of this software and associated documentation files (the "Software"),
@@ -29,9 +29,9 @@
/* Mesa version */
#define MESA_MAJOR 7
#define MESA_MINOR 1
#define MESA_MINOR 2
#define MESA_PATCH 0
#define MESA_VERSION_STRING "7.1 rc4"
#define MESA_VERSION_STRING "7.2"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

View File

@@ -29,9 +29,9 @@
*/
#include "glheader.h"
#include "imports.h"
#include "macros.h"
#include "main/glheader.h"
#include "main/imports.h"
#include "main/macros.h"
#include "prog_instruction.h"
#include "prog_parameter.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.
* \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 */
for (i = 0; i < list->NumParameters; i++) {
struct gl_program_parameter *p = list->Parameters + i;
struct gl_program_parameter *pCopy;
GLuint size = MIN2(p->Size, 4);
GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType,
list->ParameterValues[i], NULL);
ASSERT(j >= 0);
pCopy = clone->Parameters + j;
pCopy->Used = p->Used;
/* copy state indexes */
if (p->Type == PROGRAM_STATE_VAR) {
GLint k;
struct gl_program_parameter *q = clone->Parameters + j;
for (k = 0; k < STATE_LENGTH; k++) {
q->StateIndexes[k] = p->StateIndexes[k];
pCopy->StateIndexes[k] = p->StateIndexes[k];
}
}
else {
clone->Parameters[j].Size = p->Size;
}
}
clone->StateFlags = list->StateFlags;

View File

@@ -31,7 +31,7 @@
#ifndef PROG_PARAMETER_H
#define PROG_PARAMETER_H
#include "mtypes.h"
#include "main/mtypes.h"
#include "prog_statevars.h"
@@ -48,6 +48,7 @@ struct gl_program_parameter
enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */
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.
*/
@@ -112,6 +113,10 @@ extern GLint
_mesa_add_uniform(struct gl_program_parameter_list *paramList,
const char *name, GLuint size, GLenum datatype);
extern void
_mesa_use_uniform(struct gl_program_parameter_list *paramList,
const char *name);
extern GLint
_mesa_add_sampler(struct gl_program_parameter_list *paramList,
const char *name, GLenum datatype);

View File

@@ -473,32 +473,33 @@ vec4 pow(const vec4 a, const vec4 b)
float exp(const float a)
{
const float e = 2.71828;
__asm float_power __retVal, e, a;
// NOTE: log2(e) = 1.44269502
float t = a * 1.44269502;
__asm float_exp2 __retVal, t;
}
vec2 exp(const vec2 a)
{
const float e = 2.71828;
__asm float_power __retVal.x, e, a.x;
__asm float_power __retVal.y, e, a.y;
vec2 t = a * 1.44269502;
__asm float_exp2 __retVal.x, t.x;
__asm float_exp2 __retVal.y, t.y;
}
vec3 exp(const vec3 a)
{
const float e = 2.71828;
__asm float_power __retVal.x, e, a.x;
__asm float_power __retVal.y, e, a.y;
__asm float_power __retVal.z, e, a.z;
vec3 t = a * 1.44269502;
__asm float_exp2 __retVal.x, t.x;
__asm float_exp2 __retVal.y, t.y;
__asm float_exp2 __retVal.z, t.z;
}
vec4 exp(const vec4 a)
{
const float e = 2.71828;
__asm float_power __retVal.x, e, a.x;
__asm float_power __retVal.y, e, a.y;
__asm float_power __retVal.z, e, a.z;
__asm float_power __retVal.w, e, a.w;
vec4 t = a * 1.44269502;
__asm float_exp2 __retVal.x, t.x;
__asm float_exp2 __retVal.y, t.y;
__asm float_exp2 __retVal.z, t.z;
__asm float_exp2 __retVal.w, t.w;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1481,7 +1481,7 @@ _slang_simple_writemask(GLuint writemask, GLuint swizzle)
* \return GL_FALSE for simple writemasks, GL_TRUE for non-simple
*/
static GLboolean
swizzle_to_writemask(GLuint swizzle,
swizzle_to_writemask(slang_assemble_ctx *A, GLuint swizzle,
GLuint *writemaskOut, GLuint *swizzleOut)
{
GLuint mask = 0x0, newSwizzle[4];
@@ -1495,6 +1495,18 @@ swizzle_to_writemask(GLuint swizzle,
break;
}
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);
}
assert(mask <= 0xf);
@@ -1590,11 +1602,11 @@ resolve_swizzle(const slang_operation *oper)
* As above, but produce a writemask.
*/
static GLuint
resolve_writemask(const slang_operation *oper)
resolve_writemask(slang_assemble_ctx *A, const slang_operation *oper)
{
GLuint swizzle = resolve_swizzle(oper);
GLuint writemask, swizzleOut;
swizzle_to_writemask(swizzle, &writemask, &swizzleOut);
swizzle_to_writemask(A, swizzle, &writemask, &swizzleOut);
return writemask;
}
@@ -1668,7 +1680,7 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper,
dest_oper = &oper->children[0];
writemask = resolve_writemask(dest_oper);
writemask = resolve_writemask(A, dest_oper);
n0 = _slang_gen_operation(A, dest_oper);
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);
}
/*
* 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)) {
/* Next, if this call looks like a vec() or mat() constructor call,
* 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 */
int numArgs = oper->num_children;
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);
}
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);
if (n && !n->Store && !dest
@@ -2716,7 +2741,11 @@ _slang_assignment_compatible(slang_assemble_ctx *A,
slang_typeinfo t0, t1;
GLuint sz0, sz1;
if (op0->type == SLANG_OPER_POSTINCREMENT ||
op0->type == SLANG_OPER_POSTDECREMENT) {
return GL_FALSE;
}
slang_typeinfo_construct(&t0);
_slang_typeof_operation(A, op0, &t0);
@@ -3020,7 +3049,7 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
if (lhs && rhs) {
/* convert lhs swizzle into writemask */
GLuint writemask, newSwizzle;
if (!swizzle_to_writemask(lhs->Store->Swizzle,
if (!swizzle_to_writemask(A, lhs->Store->Swizzle,
&writemask, &newSwizzle)) {
/* Non-simple writemask, need to swizzle right hand side in
* order to put components into the right place.

View File

@@ -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
_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) {
st = st->Parent;
index += st->Index;
swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle);
swizzle = _slang_swizzle_swizzle(fix_swizzle(st->Swizzle), swizzle);
}
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 *
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:
/* Variable declaration - allocate a register for it */
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;
inst = emit_var_decl(emitInfo, n);
return inst;
case IR_VAR:
/* Reference to a variable
* Storage should have already been resolved/allocated.
*/
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);
}
if (n->Store->Index < 0) {
/* probably ran out of registers */
return NULL;
}
assert(n->Store->Size > 0);
break;
return emit_var_ref(emitInfo, n);
case IR_ELEMENT:
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);
GLboolean success;
slang_emit_info emitInfo;
GLuint maxUniforms;
emitInfo.log = log;
emitInfo.vt = vt;
@@ -1955,6 +1990,19 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt,
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);
/* finish up by adding the END opcode to program */

View File

@@ -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.
*/
if (p->Type == PROGRAM_UNIFORM ||
if ((p->Type == PROGRAM_UNIFORM && p->Used) ||
p->Type == PROGRAM_SAMPLER) {
_mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i);
}

View File

@@ -342,6 +342,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c,
break; \
default: \
_mesa_problem(ctx, "Bad wrap mode"); \
return; \
} \
}
@@ -462,6 +463,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c,
break; \
default: \
_mesa_problem(ctx, "Bad wrap mode"); \
return; \
} \
}

View File

@@ -235,7 +235,7 @@ static struct state_key *make_state_key( GLcontext *ctx )
*/
#define PREFER_DP4 0
#define MAX_INSN 256
#define MAX_INSN 350
/* Use uregs to represent registers internally, translate to Mesa's
* expected formats on emit.

View File

@@ -1,6 +1,6 @@
/**************************************************************************
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
Copyright 2002-2008 Tungsten Graphics Inc., Cedar Park, Texas.
All Rights Reserved.
@@ -31,6 +31,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/context.h"
#include "main/macros.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
* 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);
vbo_exec_vtxfmt_init( exec );

View File

@@ -1,8 +1,8 @@
/*
* 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
* copy of this software and associated documentation files (the "Software"),
@@ -26,6 +26,7 @@
*/
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/state.h"
@@ -155,8 +156,12 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
*/
switch (get_program_mode(exec->ctx)) {
case VP_NONE:
memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
memcpy(arrays + 16, vbo->mat_currval, MAT_ATTRIB_MAX * sizeof(arrays[0]));
for (attr = 0; attr < 16; attr++) {
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;
break;
case VP_NV:
@@ -165,8 +170,10 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
* occurred. NV vertex programs cannot access material values,
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
for (attr = 0; attr < 16; attr++) {
exec->vtx.inputs[attr] = &vbo->legacy_currval[attr];
exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr];
}
map = vbo->map_vp_arb;
break;
}
@@ -178,13 +185,18 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
GLuint src = map[attr];
if (exec->vtx.attrsz[src]) {
/* override the default array set above */
exec->vtx.inputs[attr] = &arrays[attr];
arrays[attr].Ptr = (void *)data;
arrays[attr].Size = exec->vtx.attrsz[src];
arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Type = GL_FLOAT;
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; /* ??? */
data += exec->vtx.attrsz[src] * sizeof(GLfloat);

View File

@@ -1,8 +1,8 @@
/*
* 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
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,7 @@
#include "main/mtypes.h"
#include "main/bufferobj.h"
#include "main/dlist.h"
#include "main/vtxfmt.h"
#include "main/imports.h"
@@ -71,19 +72,24 @@ void vbo_save_destroy( GLcontext *ctx )
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_save_context *save = &vbo->save;
GLuint i;
if (save->prim_store) {
if ( --save->prim_store->refcount == 0 ) {
FREE( save->prim_store );
save->prim_store = NULL;
}
if ( --save->vertex_store->refcount == 0 ) {
if (save->vertex_store->bufferobj)
ctx->Driver.DeleteBuffer( ctx, save->vertex_store->bufferobj );
_mesa_reference_buffer_object(ctx,
&save->vertex_store->bufferobj, NULL);
FREE( save->vertex_store );
save->vertex_store = NULL;
}
}
for (i = 0; i < VBO_ATTRIB_MAX; i++) {
_mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL);
}
}

View File

@@ -1,6 +1,6 @@
/**************************************************************************
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
Copyright 2002-2008 Tungsten Graphics Inc., Cedar Park, Texas.
All Rights Reserved.
@@ -68,6 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/context.h"
#include "main/dlist.h"
#include "main/enums.h"
@@ -85,6 +86,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#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
* 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
* 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,
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);
if (vertex_store->bufferobj)
ctx->Driver.DeleteBuffer( ctx, vertex_store->bufferobj );
if (vertex_store->bufferobj) {
_mesa_reference_buffer_object(ctx, &vertex_store->bufferobj, NULL);
}
FREE( vertex_store );
}
@@ -1139,6 +1147,7 @@ void vbo_save_api_init( struct vbo_save_context *save )
_save_vtxfmt_init( ctx );
_save_current_init( ctx );
/* These will actually get set again when binding/drawing */
for (i = 0; i < VBO_ATTRIB_MAX; i++)
save->inputs[i] = &save->arrays[i];

View File

@@ -1,8 +1,8 @@
/*
* 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
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,7 @@
*/
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/context.h"
#include "main/imports.h"
#include "main/mtypes.h"
@@ -115,8 +116,12 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
*/
switch (get_program_mode(ctx)) {
case VP_NONE:
memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
memcpy(arrays + 16, vbo->mat_currval, MAT_ATTRIB_MAX * sizeof(arrays[0]));
for (attr = 0; attr < 16; attr++) {
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;
break;
case VP_NV:
@@ -125,8 +130,10 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
* occurred. NV vertex programs cannot access material values,
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
for (attr = 0; attr < 16; attr++) {
save->inputs[attr] = &vbo->legacy_currval[attr];
save->inputs[attr + 16] = &vbo->generic_currval[attr];
}
map = vbo->map_vp_arb;
break;
}
@@ -135,13 +142,18 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
GLuint src = map[attr];
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].StrideB = node->vertex_size * sizeof(GLfloat);
arrays[attr].Stride = node->vertex_size * sizeof(GLfloat);
arrays[attr].Type = GL_FLOAT;
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; /* ??? */
assert(arrays[attr].BufferObj->Name);