Compare commits

...

39 Commits

Author SHA1 Message Date
Ian Romanick
85396d8ef4 intel: Bump driver date 2009-04-15 15:12:48 -07:00
Ian Romanick
f11b84998d docs: more bug fixes for Mesa 7.4.1 2009-04-15 15:10:33 -07:00
Brian Paul
d2f6791062 glx: added null pointer check in glXGetFBConfigs()
Fixes segfault seen with glxinfo with NVIDIA OpenGL.

(cherry picked from master, commit 05471828dc)
2009-04-15 08:02:38 -06:00
Ian Romanick
49e0c74ddd DRI2: Don't fault on NULL DrawBuffer
It is possible for ctx->DrawBuffer to be NULL, so don't fault when
that happens.  This change is not being committed to master because it
doesn't appear to be necessary there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2009-04-11 20:24:15 -07:00
Eric Anholt
83e14773c5 dri2: Don't crash if the server returns more buffers than expected.
(cherry picked from commit f967e8b507)
2009-04-09 15:15:33 -07:00
Ian Romanick
4605937843 intel / DRI2: Accept fake front-buffer from loader
Handle the loader returning a fake front-buffer.  Since the driver
never specifically requests a fake front-buffer, the driver assumes
that it will never receive both a fake and a real front-buffer.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit 6a6e478e55)
2009-04-09 14:44:53 -07:00
Ian Romanick
b8ef30c45c DRI2: Assume that there is always a front buffer
Assume that the front-buffer exists even if the server didn't tell the
client that it exists.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit e6386e0d9a)
2009-04-09 14:44:44 -07:00
Ian Romanick
4f17040cb1 intel / DRI2: Track and flush front-buffer rendering
Track two flags:  whether or not front-buffer rendering is currently
enabled and whether or not front-buffer rendering has been enabled
since the last glFlush.  If the second flag is set, the front-buffer
is flushed via a loader call back.  If the first flag is cleared, the
second flag is cleared at this time.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit 43cf0d1eeb)
2009-04-09 14:44:34 -07:00
Ian Romanick
98c2c9ef8c DRI2: Provide an interface for drivers to flush front-buffer rendering
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit 82634ee8df)
2009-04-09 14:44:17 -07:00
Brian Paul
d805c82068 mesa: fix potential recursive locking deadlock in _mesa_HashWalk()
If the walk callback called _mesa_HashRemove() we'd deadlock.

(cherry picked from master, commit deff099215)
2009-04-09 10:55:06 -06:00
Brian Paul
6c3bec4387 swrast: fix point rendering function selection
Need to clamp default point size to min/max range before checking if it's one.
Fixes glean pointAtten test.

(cherry picked from master, commit 228f20e324)
2009-04-07 13:44:50 -06:00
Brian Paul
7d3561c871 docs: more bug fixes for Mesa 7.4.1 2009-04-07 08:37:22 -06:00
Brian Paul
5c47d53924 mesa: in mesa_add_named_constant(), avoid adding duplicate constants
(cherry picked from master, commit 80197a0c1b)
2009-04-07 08:35:01 -06:00
Brian Paul
a18216308a mesa: fix parameter counting in ARB vertex/fragment program parsing
Duplicated unnamed constants were getting counted more than once.

(cherry picked from master, commit 866bdd0509)
2009-04-07 08:34:32 -06:00
Brian Paul
14f13fbcfa mesa: replace >= with > when testing if we've exceeded max local params
Now a program that uses 256 locals works as it should.

(cherry picked from master, commit a4173956eb)
2009-04-07 08:34:04 -06:00
Brian Paul
ca24095c1e mesa: only clear matrix MAT_DIRTY_INVERSE flag when we actually compute the inverse
If _math_matrix_analyse() got called before we allocated the inverse
matrix array we could lose the flag indicating that we needed to compute
the inverse.  This could happen with certain vertex shader cases.

(cherry picked from master, commit ce461ffc5a)
2009-04-07 08:33:43 -06:00
Brian Paul
d5e0e03d43 mesa: for OPCODE_LIT, use _mesa_pow() instead of exp() and log()
Also, s/pow/_mesa_pow/

(cherry picked from master, commit b8a200ac9d)
2009-04-07 08:32:42 -06:00
Michel Dänzer
775ca8e3fa radeon: Expose a 32 bit RGBA fbconfig even when the screen depth is 16.
Otherwise current xserver / libGL no longer expose a 32 bit RGBA GLX visual,
and compiz fails.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20479 .

(Cherry picked from commit e798bf8053)
2009-04-06 09:27:17 +02:00
Brian Paul
39345a4928 mesa: don't normalize spot light direction until validation time
In glLight() we're only supposed to transform the direction by the modelview
matrix, not normalized it too.

(cherry picked from commit 650d147289)
2009-04-03 10:16:31 -06:00
Roland Scheidegger
7be149cfd1 mesa: fix TexParameter functions
premature return in TexParameterf caused mesa to never call Driver.TexParameter
breaking drivers relying on this (fix bug #20966).
While here, also fix using ctx->ErrorValue when deciding to call
Driver.TexParameter. Errors are sticky and uncleared errors thus would cause
this to no longer get called. Since we thus need return value of
set_tex_parameter[if] can also optimize this to only call when value changed.
2009-04-03 00:00:40 +02:00
Brian Paul
8c9d7b2474 docs: fix TXB texture unit bias error 2009-04-02 13:11:56 -06:00
Brian Paul
6ef0951b17 mesa: don't call ctx->Driver.ReadPixels() if width or height is zero
(cherry picked from commit master, 7b9bf39543)
2009-04-02 13:11:33 -06:00
Brian Paul
2b33b77337 mesa: don't call ctx->Driver.Draw/CopyPixels() if width or height is zero
(cherry picked from master, commit f6a3f1f52a)
2009-04-02 13:10:41 -06:00
Brian Paul
0590edeea0 mesa: use correct tex unit lod bias for TXB instruction
(cherry picked from master, commit 1ab225017e)
2009-04-02 13:09:32 -06:00
Brian Paul
7511d76bd7 swrast: fix glDrawBuffer(GL_FRONT_AND_BACK)
We weren't putting the right colors into the back buffer in this mode.

(cherry picked from master, commit 9cc79fc2dc)
2009-04-02 13:07:53 -06:00
Brian Paul
7f30aba920 docs: fix bug 20986 2009-04-01 07:39:43 -06:00
Brian Paul
4fa700260e glsl: fix texgen state variable tokens in emit_statevars()
This fixes broken variable indexing into the gl_Eye/ObjectPlaneS/T/R/Q arrays.
See bug 20986.

(cherry picked from master, commit f8dd6594bf)
2009-04-01 07:39:26 -06:00
Brian Paul
781fb79c59 docs: first 7.4.1 bug fixes 2009-03-31 16:29:23 -06:00
Brian Paul
5b7e9f2f3a mesa: fix bug in GPU codegen for fixed-function two-sided lighting
The 'dots' register wasn't getting properly un-negated and un-swizzled
after emitting the code for back-face lighting.  So, if more than one
light source was enabled, the specular exponent for the next light source
was wrong.

During execution we were evaluating pow(x, y) where y was negative instead
of positive.  This led to the outcome being zero or NaN.

This fixes the occasional black triangles seen in isosurf when hacked to
enable two-sided lighting.

(cherry picked from master, commit 919f57078b)
2009-03-31 16:28:17 -06:00
Brian Paul
d4d4b63d7f docs: prep for Mesa 7.4.1 release notes 2009-03-31 16:26:24 -06:00
Jeremy Huddleston
9e9fe51acd Updated CPU_TO_LE32 to work on darwin 2009-03-31 14:59:28 -07:00
Jeremy Huddleston
b65bc1b6cb Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined 2009-03-31 14:48:19 -07:00
Jeremy Huddleston
6cb796f6fc Updated darwin config for when X11 is not in the same location as we're installing to
(cherry picked from commit 7817fea0b6)
2009-03-31 14:37:27 -07:00
Brian Paul
de197cf991 docs: 7.4 release md5 sums 2009-03-27 19:12:16 -06:00
Brian Paul
bf1e6581a5 docs: set 7.4 release date 2009-03-27 18:57:39 -06:00
Brian Paul
80ec7843bc mesa: set VERSION=7.4 2009-03-27 18:57:23 -06:00
Brian Paul
366d6e8cd1 mesa: set version to 7.4 2009-03-27 18:57:07 -06:00
Ian Romanick
63ed288396 intel: Add extra, stronger flushes around CopyTexSubImage blits 2009-03-27 15:22:27 -07:00
Eric Anholt
88ce34f400 swrast: Add support for x8r8g8b8 fbconfig.
This lets swrast produce an fbconfig suitable for the root visual now that
the server's not allowing mismatched fbconfigs.
(cherry picked from commit 529d1d720e)
2009-03-27 15:20:09 -07:00
34 changed files with 585 additions and 194 deletions

View File

@@ -174,7 +174,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.4-rc2
VERSION=7.4
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)

View File

@@ -6,6 +6,8 @@ CONFIG_NAME = darwin
INSTALL_DIR = /usr/X11
X11_DIR = $(INSTALL_DIR)
# Compiler and flags
CC = gcc
CXX = gcc
@@ -21,9 +23,9 @@ DEFINES = -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \
ARCH_FLAGS += $(RC_CFLAGS)
CFLAGS = -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing \
-I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing \
-I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
# Library names (actual file names)
GL_LIB_NAME = libGL.dylib
@@ -39,12 +41,12 @@ GLUT_LIB_GLOB = libglut.*dylib
GLW_LIB_GLOB = libGLw.*dylib
OSMESA_LIB_GLOB = libOSMesa.*dylib
GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXt
APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
# omit glw lib for now:
SRC_DIRS = glx/x11 mesa glu glut/glx

View File

@@ -11,7 +11,7 @@
<H1>News</H1>
<h2>March ??, 2009</h2>
<h2>March 27, 2009</h2>
<p>
<a href="relnotes-7.4.html">Mesa 7.4</a> is released.
This is a stable release fixing bugs since the 7.3 release.

79
docs/relnotes-7.4.1.html Normal file
View File

@@ -0,0 +1,79 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.1 Release Notes / (date TBD)</H1>
<p>
Mesa 7.4.1 is a stable development release fixing bugs since the 7.4 release.
</p>
<p>
Mesa 7.4.1 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>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI ardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<ul>
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Fixed a two-sided lighting bug in fixed-function-to-GPU code generation
<li>Fixed some Darwin issues (Jeremy Huddleston)
<li>Indexing the GLSL gl_EyePlane[] or gl_ObjectPlane[] arrays with a variable
was broken, bug 20986
<li>Fixed incorrect texture unit bias in TXB instruction
<li>glTexParameter settings weren't always propogated to drivers
<li>Assorted vertex/fragment program bug fixes
<li>Fixed point rendering in software rasterizer
<li>Fixed potential deadlock in object hash functions
<li>Fix a couple bugs surrounding front-buffer rendering with DRI2, but this
is not quite complete.
</ul>
<h2>Changes</h2>
<ul>
</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

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.4 Release Notes / date TBD</H1>
<H1>Mesa 7.4 Release Notes / 27 March 2009</H1>
<p>
Mesa 7.4 is a stable development release fixing bugs since the 7.3 release.
@@ -26,7 +26,15 @@ for DRI ardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
ed6bd7437177307e51e16d0c7c381dfa MesaLib-7.4.tar.gz
7ecddb341a2691e0dfdb02f697109834 MesaLib-7.4.tar.bz2
433e823f8245f9fd5f397e7b719a8e47 MesaLib-7.4.zip
656eee6128016fb237e01aa8dabbc703 MesaDemos-7.4.tar.gz
02816f10f30b1dc5e069e0f68c177c98 MesaDemos-7.4.tar.bz2
44a70d6db4aa4c64ecc47871b6aceee8 MesaDemos-7.4.zip
25f80db4f8645cd3e58e2c9af53ec341 MesaGLUT-7.4.tar.gz
04ec01caebde44f5b0d619f00716b368 MesaGLUT-7.4.tar.bz2
019dc213baecaa3cb1278847d41b8591 MesaGLUT-7.4.zip
</pre>

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.4.1.html">7.4.1 release notes</A>
<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>
<LI><A HREF="relnotes-7.3.html">7.3 release notes</A>
<LI><A HREF="relnotes-7.2.html">7.2 release notes</A>

View File

@@ -636,7 +636,7 @@ struct __DRIbufferRec {
};
#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
#define __DRI_DRI2_LOADER_VERSION 1
#define __DRI_DRI2_LOADER_VERSION 2
struct __DRIdri2LoaderExtensionRec {
__DRIextension base;
@@ -644,6 +644,19 @@ struct __DRIdri2LoaderExtensionRec {
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, void *loaderPrivate);
/**
* Flush pending front-buffer rendering
*
* Any rendering that has been performed to the
* \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
* \c __DRI_BUFFER_FRONT_LEFT.
*
* \param driDrawable Drawable whose front-buffer is to be flushed
* \param loaderPrivate Loader's private data that was previously passed
* into __DRIdri2ExtensionRec::createNewDrawable
*/
void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
};
/**

View File

@@ -253,7 +253,7 @@ DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable,
*height = rep.height;
*outCount = rep.count;
buffers = Xmalloc(count * sizeof buffers[0]);
buffers = Xmalloc(rep.count * sizeof buffers[0]);
if (buffers == NULL) {
_XEatData(dpy, rep.count * sizeof repBuffer);
UnlockDisplay(dpy);

View File

@@ -74,7 +74,6 @@ struct __GLXDRIdrawablePrivateRec {
int bufferCount;
int width, height;
int have_back;
int have_front;
int have_fake_front;
};
@@ -195,7 +194,7 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
XserverRegion region;
/* Check we have the right attachments */
if (!(priv->have_front && priv->have_back))
if (!priv->have_back)
return;
xrect.x = x;
@@ -223,7 +222,7 @@ static void dri2WaitX(__GLXDRIdrawable *pdraw)
XserverRegion region;
/* Check we have the right attachments */
if (!(priv->have_fake_front && priv->have_front))
if (!priv->have_fake_front)
return;
xrect.x = 0;
@@ -243,7 +242,7 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw)
XRectangle xrect;
XserverRegion region;
if (!(priv->have_fake_front && priv->have_front))
if (!priv->have_fake_front)
return;
xrect.x = 0;
@@ -257,6 +256,15 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw)
XFixesDestroyRegion(pdraw->psc->dpy, region);
}
static void dri2FlushFrontBuffer(__DRIdrawable *driDrawable,
void *loaderPrivate)
{
(void) driDrawable;
dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
}
static void dri2DestroyScreen(__GLXscreenConfigs *psc)
{
/* Free the direct rendering per screen data */
@@ -283,7 +291,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
pdraw->width = *width;
pdraw->height = *height;
pdraw->bufferCount = *out_count;
pdraw->have_front = 0;
pdraw->have_fake_front = 0;
pdraw->have_back = 0;
@@ -295,8 +302,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
pdraw->buffers[i].pitch = buffers[i].pitch;
pdraw->buffers[i].cpp = buffers[i].cpp;
pdraw->buffers[i].flags = buffers[i].flags;
if (pdraw->buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT)
pdraw->have_front = 1;
if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
pdraw->have_fake_front = 1;
if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
@@ -311,6 +316,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
static const __DRIdri2LoaderExtension dri2LoaderExtension = {
{ __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
dri2GetBuffers,
dri2FlushFrontBuffer
};
static const __DRIextension *loader_extensions[] = {

View File

@@ -1702,7 +1702,8 @@ PUBLIC GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements)
int i;
*nelements = 0;
if ( (priv->screenConfigs != NULL)
if ( priv
&& (priv->screenConfigs != NULL)
&& (screen >= 0) && (screen <= ScreenCount(dpy))
&& (priv->screenConfigs[screen].configs != NULL)
&& (priv->screenConfigs[screen].configs->fbconfigID != GLX_DONT_CARE) ) {

View File

@@ -5198,9 +5198,13 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
@@ -5266,9 +5270,13 @@ glGenTexturesEXT(GLsizei n, GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GenTextures(GET_DISPATCH(), (n, textures));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4;
@@ -5328,9 +5336,13 @@ glIsTextureEXT(GLuint texture)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
return CALL_IsTexture(GET_DISPATCH(), (texture));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
@@ -5641,9 +5653,13 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -5714,10 +5730,14 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetColorTableParameterfv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -5784,10 +5804,14 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetColorTableParameteriv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6107,10 +6131,14 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetConvolutionFilter(GET_DISPATCH(),
(target, format, type, image));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6182,10 +6210,14 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetConvolutionParameterfv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6252,10 +6284,14 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetConvolutionParameteriv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6329,10 +6365,14 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetHistogram(GET_DISPATCH(),
(target, reset, format, type, values));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6403,9 +6443,13 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6471,9 +6515,13 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6543,9 +6591,13 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6614,9 +6666,13 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6679,9 +6735,13 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;

View File

@@ -204,6 +204,8 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
intel_batchbuffer_flush(intel->batch);
intel->front_cliprects = GL_TRUE;
colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
intel->front_buffer_dirty = GL_TRUE;
}
else {
if (!intel->constant_cliprect && intel->front_cliprects)
@@ -328,6 +330,12 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
static void
intelDrawBuffer(GLcontext * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT);
}
intel_draw_buffer(ctx, ctx->DrawBuffer);
}

View File

@@ -97,7 +97,7 @@ int INTEL_DEBUG = (0);
#include "extension_helper.h"
#define DRIVER_DATE "20090326 2009Q1 RC2"
#define DRIVER_DATE "20090415 2009Q1 RC3"
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
static const GLubyte *
@@ -265,6 +265,11 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
region_name = "dri2 front buffer";
break;
case __DRI_BUFFER_FAKE_FRONT_LEFT:
rb = intel_fb->color_rb[0];
region_name = "dri2 fake front buffer";
break;
case __DRI_BUFFER_BACK_LEFT:
rb = intel_fb->color_rb[1];
region_name = "dri2 back buffer";
@@ -525,6 +530,26 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
if (intel->batch->map != intel->batch->ptr)
intel_batchbuffer_flush(intel->batch);
if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) {
__DRIscreen *const screen = intel->intelScreen->driScrnPriv;
if ((screen->dri2.loader->base.version >= 2)
&& (screen->dri2.loader->flushFrontBuffer != NULL)) {
(*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable,
intel->driDrawable->loaderPrivate);
/* Only clear the dirty bit if front-buffer rendering is no longer
* enabled. This is done so that the dirty bit can only be set in
* glDrawBuffer. Otherwise the dirty bit would have to be set at
* each of N places that do rendering. This has worse performances,
* but it is much easier to get correct.
*/
if (intel->is_front_buffer_rendering) {
intel->front_buffer_dirty = GL_FALSE;
}
}
}
}
void
@@ -533,7 +558,7 @@ intelFlush(GLcontext * ctx)
intel_flush(ctx, GL_FALSE);
}
static void
void
intel_glFlush(GLcontext *ctx)
{
intel_flush(ctx, GL_TRUE);

View File

@@ -260,11 +260,29 @@ struct intel_context
* flush time while the lock is held.
*/
GLboolean constant_cliprect;
/**
* In !constant_cliprect mode, set to true if the front cliprects should be
* used instead of back.
*/
GLboolean front_cliprects;
/**
* Set if rendering has occured to the drawable's front buffer.
*
* This is used in the DRI2 case to detect that glFlush should also copy
* the contents of the fake front buffer to the real front buffer.
*/
GLboolean front_buffer_dirty;
/**
* Track whether front-buffer rendering is currently enabled
*
* A separate flag is used to track this in order to support MRT more
* easily.
*/
GLboolean is_front_buffer_rendering;
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
int perf_boxes;
@@ -440,6 +458,7 @@ extern void intelGetLock(struct intel_context *intel, GLuint flags);
extern void intelFinish(GLcontext * ctx);
extern void intelFlush(GLcontext * ctx);
extern void intel_glFlush(GLcontext *ctx);
extern void intelInitDriverFunctions(struct dd_function_table *functions);
extern void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging);

View File

@@ -104,7 +104,7 @@ do_copy_texsubimage(struct intel_context *intel,
return GL_FALSE;
}
intelFlush(ctx);
intel_glFlush(ctx);
LOCK_HARDWARE(intel);
{
GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
@@ -155,6 +155,7 @@ do_copy_texsubimage(struct intel_context *intel,
}
UNLOCK_HARDWARE(intel);
intel_glFlush(ctx);
/* GL_SGIS_generate_mipmap */
if (intelImage->level == texObj->BaseLevel && texObj->GenerateMipmap) {

View File

@@ -259,8 +259,6 @@ radeonFillInModes( __DRIscreenPrivate *psp,
__GLcontextModes *m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
GLenum fb_type;
int i;
/* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
@@ -289,19 +287,24 @@ radeonFillInModes( __DRIscreenPrivate *psp,
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
back_buffer_factor = (have_back_buffer) ? 2 : 1;
if ( pixel_bits == 16 ) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
}
else {
fb_format = GL_BGRA;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
if (pixel_bits == 16) {
__DRIconfig **configs_a8r8g8b8;
__DRIconfig **configs_r5g6b5;
configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor);
configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array, stencil_bits_array,
1, back_buffer_modes, 1);
configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8);
} else
configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor);
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor);
if (configs == NULL) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__ );

View File

@@ -166,17 +166,27 @@ swrastFillInModes(__DRIscreen *psp,
depth_buffer_factor = 4;
back_buffer_factor = 2;
if (pixel_bits == 8) {
switch (pixel_bits) {
case 8:
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_BYTE_2_3_3_REV;
}
else if (pixel_bits == 16) {
break;
case 16:
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
}
else {
break;
case 24:
fb_format = GL_BGR;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
break;
case 32:
fb_format = GL_BGRA;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
break;
default:
fprintf(stderr, "[%s:%u] bad depth %d\n", __func__, __LINE__,
pixel_bits);
return NULL;
}
configs = driCreateConfigs(fb_format, fb_type,
@@ -198,7 +208,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
{
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
__DRIconfig **configs8, **configs16, **configs32;
const __DRIconfig **configs8, **configs16, **configs24, **configs32;
(void) data;
@@ -215,11 +225,12 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
configs8 = swrastFillInModes(psp, 8, 8, 0, 1);
configs16 = swrastFillInModes(psp, 16, 16, 0, 1);
configs24 = swrastFillInModes(psp, 24, 24, 8, 1);
configs32 = swrastFillInModes(psp, 32, 24, 8, 1);
configs16 = (__DRIconfig **)driConcatConfigs(configs8, configs16);
*driver_configs = driConcatConfigs(configs16, configs32);
configs16 = driConcatConfigs(configs8, configs16);
configs24 = driConcatConfigs(configs16, configs24);
*driver_configs = driConcatConfigs(configs24, configs32);
driInitExtensions( NULL, card_extensions, GL_FALSE );
@@ -251,19 +262,24 @@ static GLuint
choose_pixel_format(const GLvisual *v)
{
if (v->rgbMode) {
int bpp = v->rgbBits;
int depth = v->rgbBits;
if (bpp == 32
if (depth == 32
&& v->redMask == 0xff0000
&& v->greenMask == 0x00ff00
&& v->blueMask == 0x0000ff)
return PF_A8R8G8B8;
else if (bpp == 16
else if (depth == 24
&& v->redMask == 0xff0000
&& v->greenMask == 0x00ff00
&& v->blueMask == 0x0000ff)
return PF_X8R8G8B8;
else if (depth == 16
&& v->redMask == 0xf800
&& v->greenMask == 0x07e0
&& v->blueMask == 0x001f)
return PF_R5G6B5;
else if (bpp == 8
else if (depth == 8
&& v->redMask == 0x07
&& v->greenMask == 0x38
&& v->blueMask == 0xc0)
@@ -292,7 +308,6 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
int bpp;
unsigned mask = PITCH_ALIGN_BITS - 1;
TRACE;
@@ -301,23 +316,8 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->Width = width;
rb->Height = height;
switch (internalFormat) {
case GL_RGB:
bpp = rb->RedBits + rb->GreenBits + rb->BlueBits;
break;
case GL_RGBA:
bpp = rb->RedBits + rb->GreenBits + rb->BlueBits + rb->AlphaBits;
break;
case GL_COLOR_INDEX8_EXT:
bpp = rb->IndexBits;
break;
default:
_mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ );
return GL_FALSE;
}
/* always pad to PITCH_ALIGN_BITS */
xrb->pitch = ((width * bpp + mask) & ~mask) / 8;
xrb->pitch = ((width * xrb->bpp + mask) & ~mask) / 8;
return GL_TRUE;
}
@@ -373,6 +373,17 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
xrb->Base.GreenBits = 8 * sizeof(GLubyte);
xrb->Base.BlueBits = 8 * sizeof(GLubyte);
xrb->Base.AlphaBits = 8 * sizeof(GLubyte);
xrb->bpp = 32;
break;
case PF_X8R8G8B8:
xrb->Base.InternalFormat = GL_RGB;
xrb->Base._BaseFormat = GL_RGB;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->Base.RedBits = 8 * sizeof(GLubyte);
xrb->Base.GreenBits = 8 * sizeof(GLubyte);
xrb->Base.BlueBits = 8 * sizeof(GLubyte);
xrb->Base.AlphaBits = 0;
xrb->bpp = 32;
break;
case PF_R5G6B5:
xrb->Base.InternalFormat = GL_RGB;
@@ -382,6 +393,7 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
xrb->Base.GreenBits = 6 * sizeof(GLubyte);
xrb->Base.BlueBits = 5 * sizeof(GLubyte);
xrb->Base.AlphaBits = 0;
xrb->bpp = 16;
break;
case PF_R3G3B2:
xrb->Base.InternalFormat = GL_RGB;
@@ -391,12 +403,14 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
xrb->Base.GreenBits = 3 * sizeof(GLubyte);
xrb->Base.BlueBits = 2 * sizeof(GLubyte);
xrb->Base.AlphaBits = 0;
xrb->bpp = 8;
break;
case PF_CI8:
xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
xrb->Base._BaseFormat = GL_COLOR_INDEX;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->Base.IndexBits = 8 * sizeof(GLubyte);
xrb->bpp = 8;
break;
default:
return NULL;

View File

@@ -90,6 +90,8 @@ struct swrast_renderbuffer {
/* renderbuffer pitch (in bytes) */
GLuint pitch;
/* bits per pixel of storage */
GLuint bpp;
};
static INLINE __DRIcontext *
@@ -115,10 +117,10 @@ swrast_renderbuffer(struct gl_renderbuffer *rb)
* Pixel formats we support
*/
#define PF_CI8 1 /**< Color Index mode */
#define PF_A8R8G8B8 2 /**< 32-bit TrueColor: 8-A, 8-R, 8-G, 8-B bits */
#define PF_R5G6B5 3 /**< 16-bit TrueColor: 5-R, 6-G, 5-B bits */
#define PF_R3G3B2 4 /**< 8-bit TrueColor: 3-R, 3-G, 2-B bits */
#define PF_A8R8G8B8 2 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */
#define PF_R5G6B5 3 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */
#define PF_R3G3B2 4 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
#define PF_X8R8G8B8 5 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
/**
* Renderbuffer pitch alignment (in bits).

View File

@@ -79,6 +79,24 @@ static const GLubyte kernel[16] = {
DST[BCOMP] = SRC[0]
/* 32-bit BGRX */
#define STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) \
DST[3] = 0xff; \
DST[2] = VALUE[RCOMP]; \
DST[1] = VALUE[GCOMP]; \
DST[0] = VALUE[BCOMP]
#define STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) \
DST[3] = 0xff; \
DST[2] = VALUE[RCOMP]; \
DST[1] = VALUE[GCOMP]; \
DST[0] = VALUE[BCOMP]
#define FETCH_PIXEL_X8R8G8B8(DST, SRC) \
DST[ACOMP] = 0xff; \
DST[RCOMP] = SRC[2]; \
DST[GCOMP] = SRC[1]; \
DST[BCOMP] = SRC[0]
/* 16-bit BGR */
#define STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) \
do { \
@@ -139,6 +157,24 @@ static const GLubyte kernel[16] = {
#include "swrast/s_spantemp.h"
/* 32-bit BGRX */
#define NAME(FUNC) FUNC##_X8R8G8B8
#define RB_TYPE GLubyte
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 4;
#define INC_PIXEL_PTR(P) P += 4
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE)
#define FETCH_PIXEL(DST, SRC) \
FETCH_PIXEL_X8R8G8B8(DST, SRC)
#include "swrast/s_spantemp.h"
/* 16-bit BGR */
#define NAME(FUNC) FUNC##_R5G6B5
#define RB_TYPE GLubyte
@@ -210,6 +246,24 @@ static const GLubyte kernel[16] = {
#include "swrast_spantemp.h"
/* 32-bit BGRX */
#define NAME(FUNC) FUNC##_X8R8G8B8_front
#define RB_TYPE GLubyte
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
GLubyte *P = (GLubyte *)row;
#define INC_PIXEL_PTR(P) P += 4
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE)
#define FETCH_PIXEL(DST, SRC) \
FETCH_PIXEL_X8R8G8B8(DST, SRC)
#include "swrast_spantemp.h"
/* 16-bit BGR */
#define NAME(FUNC) FUNC##_R5G6B5_front
#define RB_TYPE GLubyte
@@ -279,6 +333,15 @@ swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_A8R8G8B8;
xrb->Base.PutMonoValues = put_mono_values_A8R8G8B8;
break;
case PF_X8R8G8B8:
xrb->Base.GetRow = get_row_X8R8G8B8;
xrb->Base.GetValues = get_values_X8R8G8B8;
xrb->Base.PutRow = put_row_X8R8G8B8;
xrb->Base.PutRowRGB = put_row_rgb_X8R8G8B8;
xrb->Base.PutMonoRow = put_mono_row_X8R8G8B8;
xrb->Base.PutValues = put_values_X8R8G8B8;
xrb->Base.PutMonoValues = put_mono_values_X8R8G8B8;
break;
case PF_R5G6B5:
xrb->Base.GetRow = get_row_R5G6B5;
xrb->Base.GetValues = get_values_R5G6B5;
@@ -334,6 +397,15 @@ swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_A8R8G8B8_front;
xrb->Base.PutMonoValues = put_mono_values_A8R8G8B8_front;
break;
case PF_X8R8G8B8:
xrb->Base.GetRow = get_row_X8R8G8B8_front;
xrb->Base.GetValues = get_values_X8R8G8B8_front;
xrb->Base.PutRow = put_row_X8R8G8B8_front;
xrb->Base.PutRowRGB = put_row_rgb_X8R8G8B8_front;
xrb->Base.PutMonoRow = put_mono_row_X8R8G8B8_front;
xrb->Base.PutValues = put_values_X8R8G8B8_front;
xrb->Base.PutMonoValues = put_mono_values_X8R8G8B8_front;
break;
case PF_R5G6B5:
xrb->Base.GetRow = get_row_R5G6B5_front;
xrb->Base.GetValues = get_values_R5G6B5_front;

View File

@@ -77,28 +77,30 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
}
if (ctx->RenderMode == GL_RENDER) {
/* Round, to satisfy conformance tests (matches SGI's OpenGL) */
GLint x = IROUND(ctx->Current.RasterPos[0]);
GLint y = IROUND(ctx->Current.RasterPos[1]);
if (width > 0 && height > 0) {
/* Round, to satisfy conformance tests (matches SGI's OpenGL) */
GLint x = IROUND(ctx->Current.RasterPos[0]);
GLint y = IROUND(ctx->Current.RasterPos[1]);
if (ctx->Unpack.BufferObj->Name) {
/* unpack from PBO */
if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");
return;
}
if (ctx->Unpack.BufferObj->Pointer) {
/* buffer is mapped - that's an error */
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(PBO is mapped)");
return;
if (ctx->Unpack.BufferObj->Name) {
/* unpack from PBO */
if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");
return;
}
if (ctx->Unpack.BufferObj->Pointer) {
/* buffer is mapped - that's an error */
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(PBO is mapped)");
return;
}
}
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
&ctx->Unpack, pixels);
}
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
&ctx->Unpack, pixels);
}
else if (ctx->RenderMode == GL_FEEDBACK) {
/* Feedback the current raster pos info */
@@ -159,10 +161,12 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
if (ctx->RenderMode == GL_RENDER) {
/* Round to satisfy conformance tests (matches SGI's OpenGL) */
GLint destx = IROUND(ctx->Current.RasterPos[0]);
GLint desty = IROUND(ctx->Current.RasterPos[1]);
ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
type );
if (width > 0 && height > 0) {
GLint destx = IROUND(ctx->Current.RasterPos[0]);
GLint desty = IROUND(ctx->Current.RasterPos[1]);
ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
type );
}
}
else if (ctx->RenderMode == GL_FEEDBACK) {
FLUSH_CURRENT( ctx, 0 );

View File

@@ -1104,6 +1104,9 @@ static void build_lighting( struct tnl_program *p )
if (twoside) {
if (!p->state->material_shininess_is_zero) {
/* Note that we negate the back-face specular exponent here.
* The negation will be un-done later in the back-face code below.
*/
struct ureg shininess = get_material(p, 1, STATE_SHININESS);
emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
negate(swizzle1(shininess,X)));
@@ -1309,6 +1312,11 @@ static void build_lighting( struct tnl_program *p )
mask1 = 0;
}
/* For the back face we need to negate the X and Y component
* dot products. dots.Z has the negated back-face specular
* exponent. We swizzle that into the W position. This
* negation makes the back-face specular term positive again.
*/
dots = negate(swizzle(dots,X,Y,W,Z));
if (!is_undef(att)) {
@@ -1327,8 +1335,10 @@ static void build_lighting( struct tnl_program *p )
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0);
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1);
/* restore negate flag for next lighting */
dots = negate(dots);
/* restore dots to its original state for subsequent lights
* by negating and swizzling again.
*/
dots = negate(swizzle(dots,X,Y,W,Z));
release_temp(p, ambient);
release_temp(p, diffuse);

View File

@@ -145,7 +145,10 @@
#if defined(__linux__)
#include <byteswap.h>
#define CPU_TO_LE32( x ) bswap_32( x )
#else /*__linux__*/
#elif defined(__APPLE__)
#include <CoreFoundation/CFByteOrder.h>
#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
#else /*__linux__ __APPLE__*/
#include <sys/endian.h>
#define CPU_TO_LE32( x ) bswap32( x )
#endif /*__linux__*/

View File

@@ -63,6 +63,7 @@ struct _mesa_HashTable {
struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */
GLuint MaxKey; /**< highest key inserted so far */
_glthread_Mutex Mutex; /**< mutual exclusion lock */
_glthread_Mutex WalkMutex; /**< for _mesa_HashWalk() */
GLboolean InDeleteAll; /**< Debug check */
};
@@ -79,6 +80,7 @@ _mesa_NewHashTable(void)
struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable);
if (table) {
_glthread_INIT_MUTEX(table->Mutex);
_glthread_INIT_MUTEX(table->WalkMutex);
}
return table;
}
@@ -111,6 +113,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
}
}
_glthread_DESTROY_MUTEX(table->Mutex);
_glthread_DESTROY_MUTEX(table->WalkMutex);
_mesa_free(table);
}
@@ -285,6 +288,11 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
/**
* Walk over all entries in a hash table, calling callback function for each.
* Note: we use a separate mutex in this function to avoid a recursive
* locking deadlock (in case the callback calls _mesa_HashRemove()) and to
* prevent multiple threads/contexts from getting tangled up.
* A lock-less version of this function could be used when the table will
* not be modified.
* \param table the hash table to walk
* \param callback the callback function
* \param userData arbitrary pointer to pass along to the callback
@@ -300,14 +308,16 @@ _mesa_HashWalk(const struct _mesa_HashTable *table,
GLuint pos;
ASSERT(table);
ASSERT(callback);
_glthread_LOCK_MUTEX(table2->Mutex);
_glthread_LOCK_MUTEX(table2->WalkMutex);
for (pos = 0; pos < TABLE_SIZE; pos++) {
struct HashEntry *entry;
for (entry = table->Table[pos]; entry; entry = entry->Next) {
struct HashEntry *entry, *next;
for (entry = table->Table[pos]; entry; entry = next) {
/* save 'next' pointer now in case the callback deletes the entry */
next = entry->Next;
callback(entry->Key, entry->Data, userData);
}
}
_glthread_UNLOCK_MUTEX(table2->Mutex);
_glthread_UNLOCK_MUTEX(table2->WalkMutex);
}

View File

@@ -209,7 +209,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
}
TRANSFORM_DIRECTION(temp, params, ctx->ModelviewMatrixStack.Top->m);
NORMALIZE_3FV(temp);
params = temp;
break;
case GL_SPOT_EXPONENT:
@@ -1137,12 +1136,18 @@ compute_light_positions( GLcontext *ctx )
}
if (light->_Flags & LIGHT_SPOT) {
/* Note: we normalize the spot direction now */
if (ctx->_NeedEyeCoords) {
COPY_3V( light->_NormDirection, light->EyeDirection );
NORMALIZE_3FV( light->_NormDirection );
}
else {
GLfloat spotDir[3];
COPY_3V(spotDir, light->EyeDirection);
NORMALIZE_3FV(spotDir);
TRANSFORM_NORMAL( light->_NormDirection,
light->EyeDirection,
spotDir,
ctx->ModelviewMatrixStack.Top->m);
}

View File

@@ -170,6 +170,9 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
if (width == 0 || height == 0)
return; /* nothing to do */
if (ctx->Pack.BufferObj->Name) {
if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
format, type, pixels)) {

View File

@@ -139,8 +139,11 @@ flush(GLcontext *ctx, struct gl_texture_object *texObj)
}
/** Set an integer-valued texture parameter */
static void
/**
* Set an integer-valued texture parameter
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
*/
static GLboolean
set_tex_parameteri(GLcontext *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLint *params)
@@ -148,13 +151,13 @@ set_tex_parameteri(GLcontext *ctx,
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
if (texObj->MinFilter == params[0])
return;
return GL_FALSE;
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
flush(ctx, texObj);
texObj->MinFilter = params[0];
return;
return GL_TRUE;
case GL_NEAREST_MIPMAP_NEAREST:
case GL_LINEAR_MIPMAP_NEAREST:
case GL_NEAREST_MIPMAP_LINEAR:
@@ -162,77 +165,80 @@ set_tex_parameteri(GLcontext *ctx,
if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
flush(ctx, texObj);
texObj->MinFilter = params[0];
return;
return GL_TRUE;
}
/* fall-through */
default:
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
}
return;
return GL_FALSE;
case GL_TEXTURE_MAG_FILTER:
if (texObj->MagFilter == params[0])
return;
return GL_FALSE;
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
flush(ctx, texObj);
texObj->MagFilter = params[0];
return;
return GL_TRUE;
default:
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
}
return;
return GL_FALSE;
case GL_TEXTURE_WRAP_S:
if (texObj->WrapS == params[0])
return;
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx, texObj);
texObj->WrapS = params[0];
return GL_TRUE;
}
return;
return GL_FALSE;
case GL_TEXTURE_WRAP_T:
if (texObj->WrapT == params[0])
return;
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx, texObj);
texObj->WrapT = params[0];
return GL_TRUE;
}
return;
return GL_FALSE;
case GL_TEXTURE_WRAP_R:
if (texObj->WrapR == params[0])
return;
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx, texObj);
texObj->WrapR = params[0];
return GL_TRUE;
}
return;
return GL_FALSE;
case GL_TEXTURE_BASE_LEVEL:
if (texObj->BaseLevel == params[0])
return;
return GL_FALSE;
if (params[0] < 0 ||
(texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
return;
return GL_FALSE;
}
flush(ctx, texObj);
texObj->BaseLevel = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_MAX_LEVEL:
if (texObj->MaxLevel == params[0])
return;
return GL_FALSE;
if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
return;
return GL_FALSE;
}
flush(ctx, texObj);
texObj->MaxLevel = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_COMPARE_SGIX:
if (ctx->Extensions.SGIX_shadow) {
@@ -243,7 +249,7 @@ set_tex_parameteri(GLcontext *ctx,
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)");
}
return;
return GL_TRUE;
case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
if (ctx->Extensions.SGIX_shadow &&
@@ -256,20 +262,22 @@ set_tex_parameteri(GLcontext *ctx,
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(GL_TEXTURE_COMPARE_OPERATOR_SGIX)");
}
return;
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
if (texObj->GenerateMipmap != params[0]) {
flush(ctx, texObj);
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
return GL_TRUE;
}
return GL_FALSE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)");
}
return;
return GL_FALSE;
case GL_TEXTURE_COMPARE_MODE_ARB:
if (ctx->Extensions.ARB_shadow &&
@@ -278,24 +286,26 @@ set_tex_parameteri(GLcontext *ctx,
if (texObj->CompareMode != params[0]) {
flush(ctx, texObj);
texObj->CompareMode = params[0];
return GL_TRUE;
}
return GL_FALSE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(GL_TEXTURE_COMPARE_MODE_ARB)");
}
return;
return GL_FALSE;
case GL_TEXTURE_COMPARE_FUNC_ARB:
if (ctx->Extensions.ARB_shadow) {
if (texObj->CompareFunc == params[0])
return;
return GL_FALSE;
switch (params[0]) {
case GL_LEQUAL:
case GL_GEQUAL:
flush(ctx, texObj);
texObj->CompareFunc = params[0];
return;
return GL_TRUE;
case GL_EQUAL:
case GL_NOTEQUAL:
case GL_LESS:
@@ -305,7 +315,7 @@ set_tex_parameteri(GLcontext *ctx,
if (ctx->Extensions.EXT_shadow_funcs) {
flush(ctx, texObj);
texObj->CompareFunc = params[0];
return;
return GL_TRUE;
}
/* fall-through */
default:
@@ -316,7 +326,7 @@ set_tex_parameteri(GLcontext *ctx,
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
}
return;
return GL_FALSE;
case GL_DEPTH_TEXTURE_MODE_ARB:
if (ctx->Extensions.ARB_depth_texture &&
@@ -326,13 +336,14 @@ set_tex_parameteri(GLcontext *ctx,
if (texObj->DepthMode != params[0]) {
flush(ctx, texObj);
texObj->DepthMode = params[0];
return GL_TRUE;
}
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(GL_DEPTH_TEXTURE_MODE_ARB)");
}
return;
return GL_FALSE;
#ifdef FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
@@ -340,17 +351,21 @@ set_tex_parameteri(GLcontext *ctx,
texObj->CropRect[1] = params[1];
texObj->CropRect[2] = params[2];
texObj->CropRect[3] = params[3];
break;
return GL_TRUE;
#endif
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
}
return GL_FALSE;
}
/** Set a float-valued texture parameter */
static void
/**
* Set a float-valued texture parameter
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
*/
static GLboolean
set_tex_parameterf(GLcontext *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params)
@@ -358,54 +373,56 @@ set_tex_parameterf(GLcontext *ctx,
switch (pname) {
case GL_TEXTURE_MIN_LOD:
if (texObj->MinLod == params[0])
return;
return GL_FALSE;
flush(ctx, texObj);
texObj->MinLod = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_MAX_LOD:
if (texObj->MaxLod == params[0])
return;
return GL_FALSE;
flush(ctx, texObj);
texObj->MaxLod = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_PRIORITY:
flush(ctx, texObj);
texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
return;
return GL_TRUE;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
if (texObj->MaxAnisotropy == params[0])
return;
return GL_FALSE;
if (params[0] < 1.0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
return GL_FALSE;
}
flush(ctx, texObj);
/* clamp to max, that's what NVIDIA does */
texObj->MaxAnisotropy = MIN2(params[0],
ctx->Const.MaxTextureMaxAnisotropy);
return GL_TRUE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
}
return;
return GL_FALSE;
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
if (ctx->Extensions.SGIX_shadow_ambient) {
if (texObj->ShadowAmbient != params[0]) {
flush(ctx, texObj);
texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F);
return GL_TRUE;
}
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)");
}
return;
return GL_FALSE;
case GL_TEXTURE_LOD_BIAS:
/* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
@@ -413,7 +430,9 @@ set_tex_parameterf(GLcontext *ctx,
if (texObj->LodBias != params[0]) {
flush(ctx, texObj);
texObj->LodBias = params[0];
return GL_TRUE;
}
return GL_FALSE;
}
break;
@@ -427,17 +446,19 @@ set_tex_parameterf(GLcontext *ctx,
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]);
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]);
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]);
return;
return GL_TRUE;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
}
return GL_FALSE;
}
void GLAPIENTRY
_mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -463,15 +484,15 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
{
/* convert float param to int */
GLint p = (GLint) param;
set_tex_parameteri(ctx, texObj, pname, &p);
need_update = set_tex_parameteri(ctx, texObj, pname, &p);
}
return;
break;
default:
/* this will generate an error if pname is illegal */
set_tex_parameterf(ctx, texObj, pname, &param);
need_update = set_tex_parameterf(ctx, texObj, pname, &param);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
ctx->Driver.TexParameter(ctx, target, texObj, pname, &param);
}
}
@@ -480,6 +501,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
void GLAPIENTRY
_mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -505,7 +527,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
/* convert float param to int */
GLint p = (GLint) params[0];
set_tex_parameteri(ctx, texObj, pname, &p);
need_update = set_tex_parameteri(ctx, texObj, pname, &p);
}
break;
@@ -518,17 +540,17 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
iparams[1] = (GLint) params[1];
iparams[2] = (GLint) params[2];
iparams[3] = (GLint) params[3];
set_tex_parameteri(ctx, target, iparams);
need_update = set_tex_parameteri(ctx, target, iparams);
}
break;
#endif
default:
/* this will generate an error if pname is illegal */
set_tex_parameterf(ctx, texObj, pname, params);
need_update = set_tex_parameterf(ctx, texObj, pname, params);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
ctx->Driver.TexParameter(ctx, target, texObj, pname, params);
}
}
@@ -537,6 +559,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
void GLAPIENTRY
_mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -555,15 +578,15 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
{
GLfloat fparam = (GLfloat) param;
/* convert int param to float */
set_tex_parameterf(ctx, texObj, pname, &fparam);
need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
}
break;
default:
/* this will generate an error if pname is illegal */
set_tex_parameteri(ctx, texObj, pname, &param);
need_update = set_tex_parameteri(ctx, texObj, pname, &param);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
GLfloat fparam = (GLfloat) param;
ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam);
}
@@ -573,6 +596,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
void GLAPIENTRY
_mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -590,7 +614,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
fparams[1] = INT_TO_FLOAT(params[1]);
fparams[2] = INT_TO_FLOAT(params[2]);
fparams[3] = INT_TO_FLOAT(params[3]);
set_tex_parameterf(ctx, texObj, pname, fparams);
need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
}
break;
case GL_TEXTURE_MIN_LOD:
@@ -602,15 +626,15 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
{
/* convert int param to float */
GLfloat fparam = (GLfloat) params[0];
set_tex_parameterf(ctx, texObj, pname, &fparam);
need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
}
break;
default:
/* this will generate an error if pname is illegal */
set_tex_parameteri(ctx, texObj, pname, params);
need_update = set_tex_parameteri(ctx, texObj, pname, params);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
GLfloat fparams[4];
fparams[0] = INT_TO_FLOAT(params[0]);
if (pname == GL_TEXTURE_BORDER_COLOR ||

View File

@@ -31,7 +31,7 @@
#define MESA_MAJOR 7
#define MESA_MINOR 4
#define MESA_PATCH 0
#define MESA_VERSION_STRING "7.4-rc2"
#define MESA_VERSION_STRING "7.4"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

View File

@@ -1379,11 +1379,10 @@ _math_matrix_analyse( GLmatrix *mat )
if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) {
matrix_invert( mat );
mat->flags &= ~MAT_DIRTY_INVERSE;
}
mat->flags &= ~(MAT_DIRTY_FLAGS|
MAT_DIRTY_TYPE|
MAT_DIRTY_INVERSE);
mat->flags &= ~(MAT_DIRTY_FLAGS | MAT_DIRTY_TYPE);
}
/*@}*/

View File

@@ -1823,7 +1823,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
if (param_var->param_binding_begin == ~0U)
param_var->param_binding_begin = idx;
param_var->param_binding_length++;
Program->Base.NumParameters++;
}
}
else {
@@ -1832,7 +1831,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
if (param_var->param_binding_begin == ~0U)
param_var->param_binding_begin = idx;
param_var->param_binding_length++;
Program->Base.NumParameters++;
}
break;
@@ -1843,7 +1841,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
if (param_var->param_binding_begin == ~0U)
param_var->param_binding_begin = idx;
param_var->param_binding_length++;
Program->Base.NumParameters++;
/* Check if there is more: 0 -> we're done, else its an integer */
if (**inst) {
@@ -1879,7 +1876,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
idx = _mesa_add_state_reference(Program->Base.Parameters,
state_tokens);
param_var->param_binding_length++;
Program->Base.NumParameters++;
}
}
else {
@@ -1897,7 +1893,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
param_var->param_binding_begin = idx;
param_var->param_binding_type = PROGRAM_CONSTANT;
param_var->param_binding_length++;
Program->Base.NumParameters++;
break;
default:
@@ -1906,12 +1901,14 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
return 1;
}
Program->Base.NumParameters = Program->Base.Parameters->NumParameters;
/* Make sure we haven't blown past our parameter limits */
if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
(Program->Base.NumParameters >=
(Program->Base.NumParameters >
ctx->Const.VertexProgram.MaxLocalParams))
|| ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
&& (Program->Base.NumParameters >=
&& (Program->Base.NumParameters >
ctx->Const.FragmentProgram.MaxLocalParams))) {
program_error(ctx, Program->Position, "Too many parameter variables");
return 1;

View File

@@ -873,7 +873,7 @@ _mesa_execute_program(GLcontext * ctx,
* result.z = result.x * APPX(result.y)
* We do what the ARB extension says.
*/
q[2] = (GLfloat) pow(2.0, t[0]);
q[2] = (GLfloat) _mesa_pow(2.0, t[0]);
}
q[1] = t[0] - floor_t0;
q[3] = 1.0F;
@@ -986,7 +986,7 @@ _mesa_execute_program(GLcontext * ctx,
if (a[1] == 0.0 && a[3] == 0.0)
result[2] = 1.0;
else
result[2] = EXPF(a[3] * LOGF(a[1]));
result[2] = (GLfloat) _mesa_pow(a[1], a[3]);
}
else {
result[2] = 0.0;
@@ -1577,8 +1577,8 @@ _mesa_execute_program(GLcontext * ctx,
case OPCODE_TXB: /* GL_ARB_fragment_program only */
/* Texel lookup with LOD bias */
{
const struct gl_texture_unit *texUnit
= &ctx->Texture.Unit[inst->TexSrcUnit];
const GLuint unit = machine->Samplers[inst->TexSrcUnit];
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLfloat texcoord[4], color[4], lodBias;
fetch_vector4(&inst->SrcReg[0], machine, texcoord);

View File

@@ -178,15 +178,20 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
const char *name, const GLfloat values[4],
GLuint size)
{
#if 0 /* disable this for now -- we need to save the name! */
/* first check if this is a duplicate constant */
GLint pos;
GLuint swizzle;
ASSERT(size == 4); /* XXX future feature */
/* check if we already have this constant */
if (_mesa_lookup_parameter_constant(paramList, values, 4, &pos, &swizzle)) {
return pos;
for (pos = 0; pos < paramList->NumParameters; pos++) {
const GLfloat *pvals = paramList->ParameterValues[pos];
if (pvals[0] == values[0] &&
pvals[1] == values[1] &&
pvals[2] == values[2] &&
pvals[3] == values[3] &&
_mesa_strcmp(paramList->Parameters[pos].Name, name) == 0) {
/* Same name and value is already in the param list - reuse it */
return pos;
}
}
#endif
/* not found, add new parameter */
return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name,
size, GL_NONE, values, NULL, 0x0);
}

View File

@@ -457,28 +457,36 @@ emit_statevars(const char *name, int array_len,
tokens[0] = STATE_TEXENV_COLOR;
}
else if (strcmp(name, "gl_EyePlaneS") == 0) {
tokens[0] = STATE_TEXGEN_EYE_S;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_S;
}
else if (strcmp(name, "gl_EyePlaneT") == 0) {
tokens[0] = STATE_TEXGEN_EYE_T;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_T;
}
else if (strcmp(name, "gl_EyePlaneR") == 0) {
tokens[0] = STATE_TEXGEN_EYE_R;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_R;
}
else if (strcmp(name, "gl_EyePlaneQ") == 0) {
tokens[0] = STATE_TEXGEN_EYE_Q;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_Q;
}
else if (strcmp(name, "gl_ObjectPlaneS") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_S;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_S;
}
else if (strcmp(name, "gl_ObjectPlaneT") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_T;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_T;
}
else if (strcmp(name, "gl_ObjectPlaneR") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_R;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_R;
}
else if (strcmp(name, "gl_ObjectPlaneQ") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_Q;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_Q;
}
else {
return -1; /* invalid array name */

View File

@@ -570,6 +570,9 @@ void
_swrast_choose_point(GLcontext *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat size = CLAMP(ctx->Point.Size,
ctx->Point.MinSize,
ctx->Point.MaxSize);
if (ctx->RenderMode == GL_RENDER) {
if (ctx->Point.PointSprite) {
@@ -578,7 +581,7 @@ _swrast_choose_point(GLcontext *ctx)
else if (ctx->Point.SmoothFlag) {
swrast->Point = smooth_point;
}
else if (ctx->Point.Size > 1.0 ||
else if (size > 1.0 ||
ctx->Point._Attenuated ||
ctx->VertexProgram.PointSizeEnabled) {
swrast->Point = large_point;

View File

@@ -1399,11 +1399,17 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
}
/*
* Write to renderbuffers
* Write to renderbuffers.
* Depending on glDrawBuffer() state and the which color outputs are
* written by the fragment shader, we may either replicate one color to
* all renderbuffers or write a different color to each renderbuffer.
* multiFragOutputs=TRUE for the later case.
*/
{
const GLuint numBuffers = fb->_NumColorDrawBuffers;
const GLboolean multiFragOutputs = numBuffers > 1;
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
const GLboolean multiFragOutputs =
(fp && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0));
GLuint buf;
for (buf = 0; buf < numBuffers; buf++) {