summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa
diff options
context:
space:
mode:
Diffstat (limited to 'xc/extras/Mesa')
-rw-r--r--xc/extras/Mesa/include/GL/gl.h6
-rw-r--r--xc/extras/Mesa/include/GL/glext.h8
-rw-r--r--xc/extras/Mesa/src/OSmesa/osmesa.c3
-rw-r--r--xc/extras/Mesa/src/X/fakeglx.c8
-rw-r--r--xc/extras/Mesa/src/X/xmesa1.c145
-rw-r--r--xc/extras/Mesa/src/X/xmesa2.c12
-rw-r--r--xc/extras/Mesa/src/X/xmesa3.c8
-rw-r--r--xc/extras/Mesa/src/X/xmesa4.c103
-rw-r--r--xc/extras/Mesa/src/X/xmesaP.h7
-rw-r--r--xc/extras/Mesa/src/X86/3dnow.c4
-rw-r--r--xc/extras/Mesa/src/X86/3dnow_norm_raw.S419
-rw-r--r--xc/extras/Mesa/src/X86/katmai.c4
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_masked1.S5
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_masked2.S5
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_masked3.S5
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_masked4.S5
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_raw1.S5
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_raw2.S5
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_raw3.S5
-rw-r--r--xc/extras/Mesa/src/X86/katmai_xform_raw4.S5
-rw-r--r--xc/extras/Mesa/src/X86/x86.c10
-rw-r--r--xc/extras/Mesa/src/X86/x86a.S4
-rw-r--r--xc/extras/Mesa/src/accum.c5
-rw-r--r--xc/extras/Mesa/src/attrib.c12
-rw-r--r--xc/extras/Mesa/src/blend.c6
-rw-r--r--xc/extras/Mesa/src/buffers.c11
-rw-r--r--xc/extras/Mesa/src/clip_funcs.h42
-rw-r--r--xc/extras/Mesa/src/colortab.c167
-rw-r--r--xc/extras/Mesa/src/config.c8
-rw-r--r--xc/extras/Mesa/src/config.h6
-rw-r--r--xc/extras/Mesa/src/context.c109
-rw-r--r--xc/extras/Mesa/src/copypix.c15
-rw-r--r--xc/extras/Mesa/src/dd.h61
-rw-r--r--xc/extras/Mesa/src/debug_xform.c25
-rw-r--r--xc/extras/Mesa/src/dlist.c7
-rw-r--r--xc/extras/Mesa/src/drawpix.c131
-rw-r--r--xc/extras/Mesa/src/enums.c27
-rw-r--r--xc/extras/Mesa/src/eval.c55
-rw-r--r--xc/extras/Mesa/src/extensions.c8
-rw-r--r--xc/extras/Mesa/src/fog.c3
-rw-r--r--xc/extras/Mesa/src/get.c46
-rw-r--r--xc/extras/Mesa/src/glapinoop.c15
-rw-r--r--xc/extras/Mesa/src/glheader.h20
-rw-r--r--xc/extras/Mesa/src/image.c24
-rw-r--r--xc/extras/Mesa/src/imaging.c11
-rw-r--r--xc/extras/Mesa/src/light.c284
-rw-r--r--xc/extras/Mesa/src/light.h6
-rw-r--r--xc/extras/Mesa/src/lines.c201
-rw-r--r--xc/extras/Mesa/src/linetemp.h10
-rw-r--r--xc/extras/Mesa/src/lnaatemp.h14
-rw-r--r--xc/extras/Mesa/src/logic.c4
-rw-r--r--xc/extras/Mesa/src/matrix.c27
-rw-r--r--xc/extras/Mesa/src/matrix.h6
-rw-r--r--xc/extras/Mesa/src/mem.c84
-rw-r--r--xc/extras/Mesa/src/mem.h13
-rw-r--r--xc/extras/Mesa/src/mmath.h12
-rw-r--r--xc/extras/Mesa/src/pb.c19
-rw-r--r--xc/extras/Mesa/src/points.c132
-rw-r--r--xc/extras/Mesa/src/readpix.c5
-rw-r--r--xc/extras/Mesa/src/rect.c19
-rw-r--r--xc/extras/Mesa/src/render_tmp.h5
-rw-r--r--xc/extras/Mesa/src/shade.c65
-rw-r--r--xc/extras/Mesa/src/shade_tmp.h274
-rw-r--r--xc/extras/Mesa/src/span.c59
-rw-r--r--xc/extras/Mesa/src/stages.c33
-rw-r--r--xc/extras/Mesa/src/state.c26
-rw-r--r--xc/extras/Mesa/src/texgen_tmp.h9
-rw-r--r--xc/extras/Mesa/src/teximage.c465
-rw-r--r--xc/extras/Mesa/src/teximage.h8
-rw-r--r--xc/extras/Mesa/src/texobj.c63
-rw-r--r--xc/extras/Mesa/src/texstate.c480
-rw-r--r--xc/extras/Mesa/src/texture.c633
-rw-r--r--xc/extras/Mesa/src/texture.h7
-rw-r--r--xc/extras/Mesa/src/texutil.c72
-rw-r--r--xc/extras/Mesa/src/texutil.h10
-rw-r--r--xc/extras/Mesa/src/triangle.c5
-rw-r--r--xc/extras/Mesa/src/tritemp.h13
-rw-r--r--xc/extras/Mesa/src/types.h84
-rw-r--r--xc/extras/Mesa/src/varray.c2
-rw-r--r--xc/extras/Mesa/src/vb.c63
-rw-r--r--xc/extras/Mesa/src/vbcull.c7
-rw-r--r--xc/extras/Mesa/src/vbfill.c83
-rw-r--r--xc/extras/Mesa/src/vbrender.c51
-rw-r--r--xc/extras/Mesa/src/vector.c40
-rw-r--r--xc/extras/Mesa/src/xform.h15
-rw-r--r--xc/extras/Mesa/src/xform_tmp.h195
86 files changed, 3659 insertions, 1539 deletions
diff --git a/xc/extras/Mesa/include/GL/gl.h b/xc/extras/Mesa/include/GL/gl.h
index 7266dbc29..5a31ddebd 100644
--- a/xc/extras/Mesa/include/GL/gl.h
+++ b/xc/extras/Mesa/include/GL/gl.h
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/include/GL/gl.h,v 1.6 2000/08/11 16:36:41 dawes Exp $ */
+/* $XFree86: xc/extras/Mesa/include/GL/gl.h,v 1.7 2000/09/24 13:50:05 alanh Exp $ */
#ifndef __gl_h_
@@ -851,7 +851,7 @@ typedef double GLclampd; /* double precision float in [0,1] */
#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
-#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
+#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
diff --git a/xc/extras/Mesa/include/GL/glext.h b/xc/extras/Mesa/include/GL/glext.h
index 3ee1cef05..3df22a373 100644
--- a/xc/extras/Mesa/include/GL/glext.h
+++ b/xc/extras/Mesa/include/GL/glext.h
@@ -1,3 +1,5 @@
+/* $XFree86: xc/extras/Mesa/include/GL/glext.h,v 1.4 2000/09/26 15:56:28 tsi Exp $ */
+
#ifndef __glext_h_
#define __glext_h_
@@ -2712,6 +2714,12 @@ extern void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum,
extern void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum);
extern void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *);
extern void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *);
+#ifdef VMS
+ #define glGetCombinerOutputParameterfvNV glGetCombinerOutputParameterfvN
+ #define glGetCombinerOutputParameterivNV glGetCombinerOutputParameterivN
+ #define glGetFinalCombinerInputParameterfvNV glGetFinalCombinerInputParafvNV
+ #define glGetFinalCombinerInputParameterivNV glGetFinalCombinerInputParaivNV
+#endif
extern void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *);
extern void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *);
extern void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *);
diff --git a/xc/extras/Mesa/src/OSmesa/osmesa.c b/xc/extras/Mesa/src/OSmesa/osmesa.c
index 62b18f9e6..e489f2553 100644
--- a/xc/extras/Mesa/src/OSmesa/osmesa.c
+++ b/xc/extras/Mesa/src/OSmesa/osmesa.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/OSmesa/osmesa.c,v 1.3 2000/09/26 15:56:38 tsi Exp $ */
/*
* Off-Screen Mesa rendering / Rendering into client memory space
@@ -225,6 +225,7 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
}
gl_extensions_enable(&(osmesa->gl_ctx),"GL_HP_occlusion_test");
gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map");
+ gl_extensions_enable(&(osmesa->gl_ctx), "GL_EXT_texture_env_combine");
osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual,
osmesa->gl_visual->DepthBits > 0,
diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c
index 67e49aba5..f7dde2533 100644
--- a/xc/extras/Mesa/src/X/fakeglx.c
+++ b/xc/extras/Mesa/src/X/fakeglx.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/X/fakeglx.c,v 1.7 2000/09/26 15:56:38 tsi Exp $ */
/*
* This is an emulation of the GLX API which allows Mesa/GLX-based programs
@@ -30,7 +30,7 @@
*
* Thanks to the contributors:
*
- * Initial version: Philip Brown (philb@CSUA.Berkeley.EDU)
+ * Initial version: Philip Brown (phil@bolthole.com)
* Better glXGetConfig() support: Armin Liebchen (liebchen@asylum.cs.utah.edu)
* Further visual-handling refinements: Wolfram Gloger
* (wmglo@Dent.MED.Uni-Muenchen.DE).
@@ -64,7 +64,7 @@
#define SERVER_MINOR_VERSION 3
/* This is appended onto the glXGetClient/ServerString version strings. */
-#define MESA_GLX_VERSION "Mesa 3.3"
+#define MESA_GLX_VERSION "Mesa 3.4"
/* Who implemented this GLX? */
#define VENDOR "Brian Paul"
diff --git a/xc/extras/Mesa/src/X/xmesa1.c b/xc/extras/Mesa/src/X/xmesa1.c
index 7261194bd..8a84ca9a4 100644
--- a/xc/extras/Mesa/src/X/xmesa1.c
+++ b/xc/extras/Mesa/src/X/xmesa1.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/X/xmesa1.c,v 1.6 2000/08/09 23:40:10 dawes Exp $ */
+/* $XFree86: xc/extras/Mesa/src/X/xmesa1.c,v 1.7 2000/09/24 13:50:53 alanh Exp $ */
/*
@@ -70,6 +70,7 @@
#include "xmesaP.h"
#include "context.h"
#include "extensions.h"
+#include "glthread.h"
#include "matrix.h"
#include "mem.h"
#include "types.h"
@@ -84,9 +85,9 @@
/*
- * Current X/Mesa context pointer:
+ * Global X driver lock
*/
-static XMesaContext XMesa = NULL;
+_glthread_Mutex _xmesa_lock;
/*
@@ -242,7 +243,9 @@ static void get_drawable_size( XMesaDisplay *dpy, XMesaDrawable d,
int x, y;
unsigned int bw, depth;
+ _glthread_LOCK_MUTEX(_xmesa_lock);
XGetGeometry( dpy, d, &root, &x, &y, width, height, &bw, &depth );
+ _glthread_UNLOCK_MUTEX(_xmesa_lock);
#endif
}
@@ -1464,10 +1467,14 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
/* For debugging only */
if (getenv("MESA_XSYNC")) {
+ /* This makes debugging X easier.
+ * In your debugger, set a breakpoint on _XError to stop when an
+ * X protocol error is generated.
+ */
#ifdef XFree86Server
/* NOT_NEEDED */
#else
- XSynchronize( display, 1 ); /* This makes debugging X easier */
+ XSynchronize( display, 1 );
#endif
}
@@ -1558,6 +1565,9 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
}
}
+ if (alpha_flag && alpha_bits == 0)
+ alpha_bits = 8;
+
v->gl_visual = _mesa_create_visual( rgb_flag, db_flag, stereo_flag,
red_bits, green_bits,
blue_bits, alpha_bits,
@@ -1608,6 +1618,12 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
XMesaContext c;
GLboolean direct = GL_TRUE; /* XXXX */
/* NOT_DONE: should this be GL_FALSE??? */
+ static GLboolean firstTime = GL_TRUE;
+
+ if (firstTime) {
+ _glthread_INIT_MUTEX(_xmesa_lock);
+ firstTime = GL_FALSE;
+ }
c = (XMesaContext) CALLOC_STRUCT(xmesa_context);
if (!c) {
@@ -1624,6 +1640,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
gl_extensions_enable(c->gl_ctx, "GL_HP_occlusion_test");
gl_extensions_enable(c->gl_ctx, "GL_ARB_texture_cube_map");
+ gl_extensions_enable(c->gl_ctx, "GL_EXT_texture_env_combine");
if (CHECK_BYTE_ORDER(v)) {
c->swapbytes = GL_FALSE;
@@ -1687,10 +1704,6 @@ void XMesaDestroyContext( XMesaContext c )
}
}
- /* Set current context ptr to NULL if we freed it */
- if (XMesa == c)
- XMesa = NULL;
-
FREE( c );
}
@@ -2017,7 +2030,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
#ifdef FX
if (drawBuffer->FXctx) {
fxMesaMakeCurrent(drawBuffer->FXctx);
- XMesa = c;
/* Disassociate old buffer from this context */
if (c->xm_buffer)
@@ -2051,7 +2063,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
c->use_read_buffer = (drawBuffer != readBuffer);
gl_make_current2(c->gl_ctx, drawBuffer->gl_buffer, readBuffer->gl_buffer);
- XMesa = c;
if (c->gl_ctx->Viewport.Width == 0) {
/* initialize viewport to window size */
@@ -2083,7 +2094,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
else {
/* Detach */
gl_make_current2( NULL, NULL, NULL );
- XMesa = NULL;
}
return GL_TRUE;
}
@@ -2101,14 +2111,23 @@ GLboolean XMesaUnbindContext( XMesaContext c )
XMesaContext XMesaGetCurrentContext( void )
{
- return XMesa;
+ GET_CURRENT_CONTEXT(ctx);
+ if (ctx) {
+ XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+ return xmesa;
+ }
+ else {
+ return 0;
+ }
}
XMesaBuffer XMesaGetCurrentBuffer( void )
{
- if (XMesa) {
- return XMesa->xm_buffer;
+ GET_CURRENT_CONTEXT(ctx);
+ if (ctx) {
+ XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+ return xmesa->xm_buffer;
}
else {
return 0;
@@ -2119,8 +2138,10 @@ XMesaBuffer XMesaGetCurrentBuffer( void )
/* New in Mesa 3.1 */
XMesaBuffer XMesaGetCurrentReadBuffer( void )
{
- if (XMesa) {
- return XMesa->xm_buffer;
+ GET_CURRENT_CONTEXT(ctx);
+ if (ctx) {
+ XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+ return xmesa->xm_buffer;
}
else {
return 0;
@@ -2133,12 +2154,10 @@ GLboolean XMesaForceCurrent(XMesaContext c)
if (c) {
if (c->gl_ctx != gl_get_current_context()) {
gl_make_current(c->gl_ctx, c->xm_buffer->gl_buffer);
- XMesa = c;
}
}
else {
gl_make_current(NULL, NULL);
- XMesa = NULL;
}
return GL_TRUE;
}
@@ -2148,7 +2167,6 @@ GLboolean XMesaLoseCurrent(XMesaContext c)
{
(void) c;
gl_make_current(NULL, NULL);
- XMesa = NULL;
return GL_TRUE;
}
@@ -2161,6 +2179,7 @@ GLboolean XMesaSetFXmode( GLint mode )
#ifdef FX
const char *fx = getenv("MESA_GLX_FX");
if (fx && fx[0] != 'd') {
+ GET_CURRENT_CONTEXT(ctx);
GrHwConfiguration hw;
if (!FX_grSstQueryHardware(&hw)) {
/*fprintf(stderr, "!grSstQueryHardware\n");*/
@@ -2170,17 +2189,18 @@ GLboolean XMesaSetFXmode( GLint mode )
/*fprintf(stderr, "hw.num_sst < 1\n");*/
return GL_FALSE;
}
- if (XMesa) {
+ if (ctx) {
+ XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
if (mode == XMESA_FX_WINDOW) {
- if (XMesa->xm_buffer->FXisHackUsable) {
+ if (xmesa->xm_buffer->FXisHackUsable) {
FX_grSstControl(GR_CONTROL_DEACTIVATE);
- XMesa->xm_buffer->FXwindowHack = GL_TRUE;
+ xmesa->xm_buffer->FXwindowHack = GL_TRUE;
return GL_TRUE;
}
}
else if (mode == XMESA_FX_FULLSCREEN) {
FX_grSstControl(GR_CONTROL_ACTIVATE);
- XMesa->xm_buffer->FXwindowHack = GL_FALSE;
+ xmesa->xm_buffer->FXwindowHack = GL_FALSE;
return GL_TRUE;
}
else {
@@ -2207,8 +2227,9 @@ static void FXgetImage( XMesaBuffer b )
int x, y;
XMesaWindow root;
unsigned int bw, depth, width, height;
+ XMesaContext xmesa = (XMesaContext) b->xm_context->gl_ctx->DriverCtx;
- assert(XMesa->xm_buffer->FXctx);
+ assert(xmesa->xm_buffer->FXctx);
#ifdef XFree86Server
x = b->frontbuffer->x;
@@ -2217,30 +2238,29 @@ static void FXgetImage( XMesaBuffer b )
height = b->frontbuffer->height;
depth = b->frontbuffer->depth;
#else
- XGetGeometry( XMesa->xm_visual->display, b->frontbuffer,
+ XGetGeometry( xmesa->xm_visual->display, b->frontbuffer,
&root, &x, &y, &width, &height, &bw, &depth);
#endif
if (b->width != width || b->height != height) {
- b->width = MIN2((int)width, XMesa->xm_buffer->FXctx->width);
- b->height = MIN2((int)height, XMesa->xm_buffer->FXctx->height);
+ b->width = MIN2((int)width, xmesa->xm_buffer->FXctx->width);
+ b->height = MIN2((int)height, xmesa->xm_buffer->FXctx->height);
if (b->width & 1)
b->width--; /* prevent odd width */
xmesa_alloc_back_buffer( b );
}
grLfbWriteColorFormat(GR_COLORFORMAT_ARGB);
- if (XMesa->xm_visual->undithered_pf==PF_5R6G5B) {
+ if (xmesa->xm_visual->undithered_pf==PF_5R6G5B) {
/* Special case: 16bpp RGB */
grLfbReadRegion( GR_BUFFER_FRONTBUFFER, /* src buffer */
- 0, XMesa->xm_buffer->FXctx->height - b->height, /*pos*/
+ 0, xmesa->xm_buffer->FXctx->height - b->height, /*pos*/
b->width, b->height, /* size */
b->width * sizeof(GLushort), /* stride */
b->backimage->data); /* dest buffer */
}
- else if (XMesa->xm_visual->dithered_pf==PF_DITHER
- && GET_VISUAL_DEPTH(XMesa->xm_visual)==8) {
+ else if (xmesa->xm_visual->dithered_pf==PF_DITHER
+ && GET_VISUAL_DEPTH(xmesa->xm_visual)==8) {
/* Special case: 8bpp RGB */
- XMesaContext xmesa = XMesa; /* Needed for DITHER macros */
for (y=0;y<b->height;y++) {
GLubyte *ptr = (GLubyte*) xmesa->xm_buffer->backimage->data
+ xmesa->xm_buffer->backimage->bytes_per_line * y;
@@ -2248,7 +2268,7 @@ static void FXgetImage( XMesaBuffer b )
/* read row from 3Dfx frame buffer */
grLfbReadRegion( GR_BUFFER_FRONTBUFFER,
- 0, XMesa->xm_buffer->FXctx->height-(b->height-y),
+ 0, xmesa->xm_buffer->FXctx->height-(b->height-y),
b->width, 1,
0,
pixbuf );
@@ -2267,7 +2287,7 @@ static void FXgetImage( XMesaBuffer b )
for (y=0;y<b->height;y++) {
/* read row from 3Dfx frame buffer */
grLfbReadRegion( GR_BUFFER_FRONTBUFFER,
- 0, XMesa->xm_buffer->FXctx->height-(b->height-y),
+ 0, xmesa->xm_buffer->FXctx->height-(b->height-y),
b->width, 1,
0,
pixbuf );
@@ -2275,11 +2295,11 @@ static void FXgetImage( XMesaBuffer b )
/* write to XImage back buffer */
for (x=0;x<b->width;x++) {
XMesaPutPixel(b->backimage,x,y,
- xmesa_color_to_pixel(XMesa,
+ xmesa_color_to_pixel(xmesa,
(pixbuf[x] & 0xf800) >> 8,
(pixbuf[x] & 0x07e0) >> 3,
(pixbuf[x] & 0x001f) << 3,
- 0xff, XMesa->pixelformat));
+ 0xff, xmesa->pixelformat));
}
}
}
@@ -2294,18 +2314,20 @@ static void FXgetImage( XMesaBuffer b )
*/
void XMesaSwapBuffers( XMesaBuffer b )
{
-#ifdef PROFILE
- GLdouble t0 = gl_time();
-#endif
+ GET_CURRENT_CONTEXT(ctx);
- _mesa_swapbuffers(XMesa->gl_ctx);
+ /* If we're swapping the buffer associated with the current context
+ * we have to flush any pending rendering commands first.
+ */
+ if (b->xm_context && b->xm_context->gl_ctx == ctx)
+ _mesa_swapbuffers(ctx);
if (b->db_state) {
#ifdef FX
- if (XMesa->xm_buffer->FXctx) {
+ if (b->FXctx) {
fxMesaSwapBuffers();
- if (XMesa->xm_buffer->FXwindowHack)
+ if (b->FXwindowHack)
FXgetImage(b);
else
return;
@@ -2315,11 +2337,12 @@ void XMesaSwapBuffers( XMesaBuffer b )
/* Copy Ximage from host's memory to server's window */
#if defined(USE_XSHM) && !defined(XFree86Server)
if (b->shm) {
+ /*_glthread_LOCK_MUTEX(_xmesa_lock);*/
XShmPutImage( b->xm_visual->display, b->frontbuffer,
b->cleargc,
b->backimage, 0, 0,
0, 0, b->width, b->height, False );
- /* wait for finished event??? */
+ /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/
}
else
#endif
@@ -2327,15 +2350,18 @@ void XMesaSwapBuffers( XMesaBuffer b )
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
XMesaDriSwapBuffers( b );
#else
+ /*_glthread_LOCK_MUTEX(_xmesa_lock);*/
XMesaPutImage( b->xm_visual->display, b->frontbuffer,
b->cleargc,
b->backimage, 0, 0,
0, 0, b->width, b->height );
+ /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/
#endif
}
}
else {
/* Copy pixmap to window on server */
+ /*_glthread_LOCK_MUTEX(_xmesa_lock);*/
XMesaCopyArea( b->xm_visual->display,
b->backpixmap, /* source drawable */
b->frontbuffer, /* dest. drawable */
@@ -2343,17 +2369,12 @@ void XMesaSwapBuffers( XMesaBuffer b )
0, 0, b->width, b->height, /* source region */
0, 0 /* dest region */
);
+ /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/
}
}
-#if defined(GLX_DIRECT_RENDERING) || defined(XFree86Server)
- /* NOT_NEEDED */
-#else
+#if !defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
XSync( b->xm_visual->display, False );
#endif
-#ifdef PROFILE
- XMesa->gl_ctx->SwapCount++;
- XMesa->gl_ctx->SwapTime += gl_time() - t0;
-#endif
}
@@ -2363,18 +2384,20 @@ void XMesaSwapBuffers( XMesaBuffer b )
*/
void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
{
-#ifdef PROFILE
- GLdouble t0 = gl_time();
-#endif
+ GET_CURRENT_CONTEXT(ctx);
- FLUSH_VB( XMesa->gl_ctx, "swap buffers" );
+ /* If we're swapping the buffer associated with the current context
+ * we have to flush any pending rendering commands first.
+ */
+ if (b->xm_context->gl_ctx == ctx)
+ _mesa_swapbuffers(ctx);
if (b->db_state) {
int yTop = b->bottom - y - height;
#ifdef FX
- if (XMesa->xm_buffer->FXctx) {
+ if (b->FXctx) {
fxMesaSwapBuffers();
- if (XMesa->xm_buffer->FXwindowHack)
+ if (b->FXwindowHack)
FXgetImage(b);
else
return;
@@ -2412,15 +2435,6 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
);
}
}
-#ifdef XFree86Server
- /* NOT_NEEDED */
-#else
- XSync( b->xm_visual->display, False );
-#endif
-#ifdef PROFILE
- XMesa->gl_ctx->SwapCount++;
- XMesa->gl_ctx->SwapTime += gl_time() - t0;
-#endif
}
@@ -2550,7 +2564,6 @@ void XMesaReset( void )
XMesaDestroyBuffer(XMesaBufferList);
XMesaBufferList = NULL;
- XMesa = NULL;
}
diff --git a/xc/extras/Mesa/src/X/xmesa2.c b/xc/extras/Mesa/src/X/xmesa2.c
index 77b8d4b05..48cea9497 100644
--- a/xc/extras/Mesa/src/X/xmesa2.c
+++ b/xc/extras/Mesa/src/X/xmesa2.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/X/xmesa2.c,v 1.7 2000/09/26 15:56:38 tsi Exp $ */
/*
* Mesa/X11 interface, part 2.
@@ -150,8 +150,10 @@ static void get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
int winx, winy;
unsigned int bw, d;
+ _glthread_LOCK_MUTEX(_xmesa_lock);
XGetGeometry( xmesa->display, xmesa->xm_buffer->frontbuffer, &root,
&winx, &winy, &winwidth, &winheight, &bw, &d );
+ _glthread_UNLOCK_MUTEX(_xmesa_lock);
#else
winwidth = xmesa->xm_buffer->frontbuffer->width;
@@ -209,7 +211,9 @@ static void finish( GLcontext *ctx )
#else
const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
if (xmesa) {
+ _glthread_LOCK_MUTEX(_xmesa_lock);
XSync( xmesa->display, False );
+ _glthread_UNLOCK_MUTEX(_xmesa_lock);
}
#endif
}
@@ -222,7 +226,9 @@ static void flush( GLcontext *ctx )
#else
const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
if (xmesa) {
+ _glthread_LOCK_MUTEX(_xmesa_lock);
XFlush( xmesa->display );
+ _glthread_UNLOCK_MUTEX(_xmesa_lock);
}
#endif
}
@@ -353,8 +359,10 @@ static void clear_color( GLcontext *ctx,
xmesa->clearcolor[3] = a;
xmesa->clearpixel = xmesa_color_to_pixel( xmesa, r, g, b, a,
xmesa->xm_visual->undithered_pf );
+ _glthread_LOCK_MUTEX(_xmesa_lock);
XMesaSetForeground( xmesa->display, xmesa->xm_buffer->cleargc,
xmesa->clearpixel );
+ _glthread_UNLOCK_MUTEX(_xmesa_lock);
}
@@ -528,8 +536,10 @@ static GLboolean logicop( GLcontext *ctx, GLenum op )
case GL_OR_INVERTED: func = GXorInverted; break;
default: return GL_FALSE;
}
+ _glthread_LOCK_MUTEX(_xmesa_lock);
XMesaSetFunction( xmesa->display, xmesa->xm_buffer->gc1, func );
XMesaSetFunction( xmesa->display, xmesa->xm_buffer->gc2, func );
+ _glthread_UNLOCK_MUTEX(_xmesa_lock);
return GL_TRUE;
}
diff --git a/xc/extras/Mesa/src/X/xmesa3.c b/xc/extras/Mesa/src/X/xmesa3.c
index c7e4c21c8..3f6f507c6 100644
--- a/xc/extras/Mesa/src/X/xmesa3.c
+++ b/xc/extras/Mesa/src/X/xmesa3.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/X/xmesa3.c,v 1.6 2000/09/26 15:56:39 tsi Exp $ */
/*
* Mesa/X11 interface, part 3.
@@ -731,9 +731,15 @@ line_func xmesa_get_line_func( GLcontext *ctx )
return NULL;
}
}
+#if 0
+ /* XXX have to disable this because X's rasterization rules don't match
+ * software Mesa's. This causes the linehv.c conformance test to fail.
+ * In the future, we might provide a config option to enable this.
+ */
if (xmesa->xm_buffer->buffer!=XIMAGE && ctx->RasterMask==0) {
setup_x_line_options( ctx );
return flat_pixmap_line;
}
+#endif
return NULL;
}
diff --git a/xc/extras/Mesa/src/X/xmesa4.c b/xc/extras/Mesa/src/X/xmesa4.c
index 195a531f0..2211eaffc 100644
--- a/xc/extras/Mesa/src/X/xmesa4.c
+++ b/xc/extras/Mesa/src/X/xmesa4.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/X/xmesa4.c,v 1.6 2000/09/26 15:56:39 tsi Exp $ */
/*
* Mesa/X11 interface, part 4.
@@ -1439,6 +1439,98 @@ static void setup_x_polygon_options( GLcontext *ctx )
}
+#ifdef DEBUG
+void
+_xmesa_print_triangle_func( triangle_func triFunc )
+{
+ printf("XMesa tri func = ");
+ if (triFunc ==smooth_TRUECOLOR_z_triangle)
+ printf("smooth_TRUECOLOR_z_triangle\n");
+ else if (triFunc ==smooth_8A8B8G8R_z_triangle)
+ printf("smooth_8A8B8G8R_z_triangle\n");
+ else if (triFunc ==smooth_8R8G8B_z_triangle)
+ printf("smooth_8R8G8B_z_triangle\n");
+ else if (triFunc ==smooth_8R8G8B24_z_triangle)
+ printf("smooth_8R8G8B24_z_triangle\n");
+ else if (triFunc ==smooth_TRUEDITHER_z_triangle)
+ printf("smooth_TRUEDITHER_z_triangle\n");
+ else if (triFunc ==smooth_5R6G5B_z_triangle)
+ printf("smooth_5R6G5B_z_triangle\n");
+ else if (triFunc ==smooth_DITHER_5R6G5B_z_triangle)
+ printf("smooth_DITHER_5R6G5B_z_triangle\n");
+ else if (triFunc ==smooth_HPCR_z_triangle)
+ printf("smooth_HPCR_z_triangle\n");
+ else if (triFunc ==smooth_DITHER8_z_triangle)
+ printf("smooth_DITHER8_z_triangle\n");
+ else if (triFunc ==smooth_LOOKUP8_z_triangle)
+ printf("smooth_LOOKUP8_z_triangle\n");
+ else if (triFunc ==flat_TRUECOLOR_z_triangle)
+ printf("flat_TRUECOLOR_z_triangle\n");
+ else if (triFunc ==flat_8A8B8G8R_z_triangle)
+ printf("flat_8A8B8G8R_z_triangle\n");
+ else if (triFunc ==flat_8R8G8B_z_triangle)
+ printf("flat_8R8G8B_z_triangle\n");
+ else if (triFunc ==flat_8R8G8B24_z_triangle)
+ printf("flat_8R8G8B24_z_triangle\n");
+ else if (triFunc ==flat_TRUEDITHER_z_triangle)
+ printf("flat_TRUEDITHER_z_triangle\n");
+ else if (triFunc ==flat_5R6G5B_z_triangle)
+ printf("flat_5R6G5B_z_triangle\n");
+ else if (triFunc ==flat_DITHER_5R6G5B_z_triangle)
+ printf("flat_DITHER_5R6G5B_z_triangle\n");
+ else if (triFunc ==flat_HPCR_z_triangle)
+ printf("flat_HPCR_z_triangle\n");
+ else if (triFunc ==flat_DITHER8_z_triangle)
+ printf("flat_DITHER8_z_triangle\n");
+ else if (triFunc ==flat_LOOKUP8_z_triangle)
+ printf("flat_LOOKUP8_z_triangle\n");
+ else if (triFunc ==smooth_TRUECOLOR_triangle)
+ printf("smooth_TRUECOLOR_triangle\n");
+ else if (triFunc ==smooth_8A8B8G8R_triangle)
+ printf("smooth_8A8B8G8R_triangle\n");
+ else if (triFunc ==smooth_8R8G8B_triangle)
+ printf("smooth_8R8G8B_triangle\n");
+ else if (triFunc ==smooth_8R8G8B24_triangle)
+ printf("smooth_8R8G8B24_triangle\n");
+ else if (triFunc ==smooth_TRUEDITHER_triangle)
+ printf("smooth_TRUEDITHER_triangle\n");
+ else if (triFunc ==smooth_5R6G5B_triangle)
+ printf("smooth_5R6G5B_triangle\n");
+ else if (triFunc ==smooth_DITHER_5R6G5B_triangle)
+ printf("smooth_DITHER_5R6G5B_triangle\n");
+ else if (triFunc ==smooth_HPCR_triangle)
+ printf("smooth_HPCR_triangle\n");
+ else if (triFunc ==smooth_DITHER8_triangle)
+ printf("smooth_DITHER8_triangle\n");
+ else if (triFunc ==smooth_LOOKUP8_triangle)
+ printf("smooth_LOOKUP8_triangle\n");
+ else if (triFunc ==flat_TRUECOLOR_triangle)
+ printf("flat_TRUECOLOR_triangle\n");
+ else if (triFunc ==flat_TRUEDITHER_triangle)
+ printf("flat_TRUEDITHER_triangle\n");
+ else if (triFunc ==flat_8A8B8G8R_triangle)
+ printf("flat_8A8B8G8R_triangle\n");
+ else if (triFunc ==flat_8R8G8B_triangle)
+ printf("flat_8R8G8B_triangle\n");
+ else if (triFunc ==flat_8R8G8B24_triangle)
+ printf("flat_8R8G8B24_triangle\n");
+ else if (triFunc ==flat_5R6G5B_triangle)
+ printf("flat_5R6G5B_triangle\n");
+ else if (triFunc ==flat_DITHER_5R6G5B_triangle)
+ printf("flat_DITHER_5R6G5B_triangle\n");
+ else if (triFunc ==flat_HPCR_triangle)
+ printf("flat_HPCR_triangle\n");
+ else if (triFunc ==flat_DITHER8_triangle)
+ printf("flat_DITHER8_triangle\n");
+ else if (triFunc ==flat_LOOKUP8_triangle)
+ printf("flat_LOOKUP8_triangle\n");
+ else if (triFunc ==flat_pixmap_triangle)
+ printf("flat_pixmap_triangle\n");
+ else
+ printf("???\n");
+}
+#endif
+
triangle_func xmesa_get_triangle_func( GLcontext *ctx )
{
@@ -1578,13 +1670,20 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx )
return NULL;
}
else {
- /* pixmap */
+ /* draw to pixmap */
+#if 0
+ /* XXX have to disable this because X's rasterization rules
+ * don't match software Mesa's. This causes a buffer invariance
+ * test failure in the conformance tests.
+ * In the future, we might provide a config option to enable this.
+ */
if (ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0) {
if (ctx->Color.DitherFlag && depth < 24)
return NULL;
setup_x_polygon_options( ctx );
return flat_pixmap_triangle;
}
+#endif
return NULL;
}
}
diff --git a/xc/extras/Mesa/src/X/xmesaP.h b/xc/extras/Mesa/src/X/xmesaP.h
index 987877509..8d8000874 100644
--- a/xc/extras/Mesa/src/X/xmesaP.h
+++ b/xc/extras/Mesa/src/X/xmesaP.h
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/X/xmesaP.h,v 1.7 2000/09/26 15:56:39 tsi Exp $ */
#ifndef XMESAP_H
#define XMESAP_H
@@ -56,6 +56,9 @@
#endif
+extern _glthread_Mutex _xmesa_lock;
+
+
/* for PF_8R8G8B24 pixel format */
typedef struct {
GLubyte b;
@@ -223,7 +226,7 @@ struct xmesa_buffer {
/* Used to do XAllocColor/XFreeColors accounting: */
int num_alloced;
- unsigned long alloced_colors[256];
+ Pixel alloced_colors[256];
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
__DRIdrawablePrivate *driDrawPriv; /* back pointer to DRI drawable
diff --git a/xc/extras/Mesa/src/X86/3dnow.c b/xc/extras/Mesa/src/X86/3dnow.c
index 5255a8c7f..ef92d27c0 100644
--- a/xc/extras/Mesa/src/X86/3dnow.c
+++ b/xc/extras/Mesa/src/X86/3dnow.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/X86/3dnow.c,v 1.6 2000/09/26 15:56:39 tsi Exp $ */
/*
* 3DNow! optimizations contributed by
@@ -49,7 +49,7 @@
#define XFORM_ARGS GLvector4f *to_vec, \
- const GLmatrix *mat, \
+ const GLfloat m[16], \
const GLvector4f *from_vec, \
const GLubyte *mask, \
const GLubyte flag
diff --git a/xc/extras/Mesa/src/X86/3dnow_norm_raw.S b/xc/extras/Mesa/src/X86/3dnow_norm_raw.S
index 7d4eed85b..e074c3337 100644
--- a/xc/extras/Mesa/src/X86/3dnow_norm_raw.S
+++ b/xc/extras/Mesa/src/X86/3dnow_norm_raw.S
@@ -21,6 +21,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/X86/3dnow_norm_raw.S,v 1.4 2000/09/26 15:56:39 tsi Exp $ */
/*
* 3Dnow assembly code by Holger Waechtler
@@ -61,7 +62,7 @@
#define V3F_COUNT 8
#define V3F_STRIDE 12
-#define MAT_INV 64
+#define MAT_INV 4
#define M(i) REGOFF(i * 4, ECX)
#define STRIDE REGOFF(12, ESI)
@@ -72,28 +73,24 @@ GLOBL GLNAME(gl_3dnow_transform_normalize_normals_raw)
GLNAME(gl_3dnow_transform_normalize_normals_raw):
#define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L ( ARG_LENGTHS, EDI )
- MOV_L ( ARG_IN, EAX )
- MOV_L ( ARG_DEST, EDX )
- MOV_L ( REGOFF(V3F_COUNT, EAX), EAX ) /* dest->count = in->count */
- MOV_L ( EAX, REGOFF(V3F_COUNT, EDX) )
- MOV_L ( ARG_IN, ESI )
- MOV_L ( ARG_MAT, ECX )
- MOV_L ( REGOFF(V3F_START, EDX), EAX ) /* dest->start */
- MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
- MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
+ PUSH_L ( EBP )
-ALIGNTEXT32
-
- CMP_L ( CONST(0), REGOFF (V3F_COUNT, ESI ) ) /* count > 0 ?? */
+ MOV_L ( ARG_LENGTHS, EDI )
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_DEST, EAX )
+ MOV_L ( REGOFF(V3F_COUNT, ESI), EBP ) /* dest->count = in->count */
+ MOV_L ( EBP, REGOFF(V3F_COUNT, EAX) )
+ MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+ MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */
+ MOV_L ( ARG_MAT, ECX )
+ MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
+
+ CMP_L ( CONST(0), EBP ) /* count > 0 ?? */
JE ( LLBL (G3TN_end) )
- PUSH_L ( EBP )
MOV_L ( REGOFF (V3F_COUNT, ESI), EBP )
FEMMS
@@ -101,7 +98,8 @@ ALIGNTEXT32
PUSH_L ( EAX )
PUSH_L ( EDX ) /* save counter & pointer for */
/* the normalize pass */
-
+ #undef FRAME_OFFSET
+ #define FRAME_OFFSET 24
MOVQ ( M(0), MM3 ) /* m1 | m0 */
MOVQ ( M(4), MM4 ) /* m5 | m4 */
@@ -115,8 +113,6 @@ ALIGNTEXT32
CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */
JNE ( LLBL (G3TN_scale_end ) )
- #undef FRAME_OFFSET
- #define FRAME_OFFSET 28
MOVD ( ARG_SCALE, MM0 ) /* | scale */
PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */
@@ -138,6 +134,8 @@ LLBL (G3TN_transform):
PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */
ADD_L ( CONST(12), EAX ) /* next r */
+ PREFETCHW ( REGIND(EAX) )
+
PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */
PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */
@@ -156,6 +154,8 @@ LLBL (G3TN_transform):
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m*/
ADD_L ( STRIDE, EDX ) /* next normal */
+ PREFETCH ( REGIND(EDX) )
+
MOVD ( MM1, REGOFF(-4, EAX) ) /* write r2 */
MOVQ ( REGIND (EDX), MM0 ) /* x1 | x0 */
@@ -177,19 +177,24 @@ LLBL (G3TN_transform):
ALIGNTEXT32
LLBL (G3TN_norm_w_lengths):
+
+ PREFETCHW ( REGOFF(12,EAX) )
+
MOVD ( REGIND (EDI), MM3 ) /* | length (x) */
PFMUL ( MM3, MM1 ) /* | x2 (normalize*/
PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */
PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalize*/
+ ADD_L ( STRIDE, EDX ) /* next normal */
+ ADD_L ( CONST(4), EDI ) /* next length */
+
+ PREFETCH ( REGIND(EDI) )
+
MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */
MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */
- ADD_L ( STRIDE, EDX ) /* next normal */
ADD_L ( CONST(12), EAX ) /* next r */
-
- ADD_L ( CONST(4), EDI ) /* next length */
DEC_L ( EBP ) /* decrement normal counter */
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */
@@ -199,6 +204,9 @@ LLBL (G3TN_norm_w_lengths):
ALIGNTEXT32
LLBL (G3TN_norm):
+
+ PREFETCHW ( REGIND(EAX) )
+
MOVQ ( MM0, MM3 ) /* x1 | x0 */
MOVQ ( MM1, MM4 ) /* | x2 */
@@ -233,46 +241,39 @@ LLBL (G3TN_norm):
LLBL (G3TN_exit_3dnow):
FEMMS
- POP_L ( EBP )
LLBL (G3TN_end):
+ POP_L ( EBP )
POP_L ( ESI )
POP_L ( EDI )
- POP_L ( ECX )
RET
ALIGNTEXT16
-
GLOBL GLNAME(gl_3dnow_transform_normalize_normals_no_rot_raw)
GLNAME(gl_3dnow_transform_normalize_normals_no_rot_raw):
#undef FRAME_OFFSET
#define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L ( ARG_LENGTHS, EDI )
- MOV_L ( ARG_IN, EAX )
- MOV_L ( ARG_DEST, EDX )
- MOV_L ( REGOFF(V3F_COUNT, EAX), EAX ) /* dest->count = in->count */
- MOV_L ( EAX, REGOFF(V3F_COUNT, EDX) )
- MOV_L ( ARG_IN, ESI )
- MOV_L ( ARG_MAT, ECX )
- MOV_L ( REGOFF(V3F_START, EDX), EAX ) /* dest->start */
- MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
- MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
+ PUSH_L ( EBP )
-ALIGNTEXT32
-
- CMP_L ( CONST(0), REGOFF (V3F_COUNT, ESI ) ) /* count > 0 ?? */
+ MOV_L ( ARG_LENGTHS, EDI )
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_DEST, EAX )
+ MOV_L ( REGOFF(V3F_COUNT, ESI), EBP ) /* dest->count = in->count */
+ MOV_L ( EBP, REGOFF(V3F_COUNT, EAX) )
+ MOV_L ( ARG_MAT, ECX )
+ MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */
+ MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
+ MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+
+ CMP_L ( CONST(0), EBP ) /* count > 0 ?? */
JE ( LLBL (G3TNNR_end) )
- PUSH_L ( EBP )
- MOV_L ( REGOFF (V3F_COUNT, ESI), EBP )
FEMMS
MOVD ( M(0), MM0 ) /* | m0 */
@@ -284,14 +285,13 @@ ALIGNTEXT32
CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */
JNE ( LLBL (G3TNNR_scale_end ) )
- #undef FRAME_OFFSET
- #define FRAME_OFFSET 16
MOVD ( ARG_SCALE, MM7 ) /* | scale */
PUNPCKLDQ ( MM7, MM7 ) /* scale | scale */
PFMUL ( MM7, MM0 ) /* scale * m5 | scale * m0 */
PFMUL ( MM7, MM2 ) /* scale * m10 | scale * m10 */
+ALIGNTEXT32
LLBL (G3TNNR_scale_end):
MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */
MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */
@@ -302,10 +302,16 @@ LLBL (G3TNNR_scale_end):
MOVD ( REGIND(EDI), MM3 ) /* | length (x) */
+ALIGNTEXT32
LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */
+
+ PREFETCHW ( REGIND(EAX) )
+
PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */
ADD_L ( STRIDE, EDX ) /* next normal */
+ PREFETCH ( REGIND(EDX) )
+
PFMUL ( MM2, MM7 ) /* | x2*m10 */
ADD_L ( CONST(12), EAX ) /* next r */
@@ -327,7 +333,11 @@ LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */
JA ( LLBL (G3TNNR_norm_w_lengths) )
JMP ( LLBL (G3TNNR_exit_3dnow) )
+ALIGNTEXT32
LLBL (G3TNNR_norm): /* need to calculate lengths */
+
+ PREFETCHW ( REGIND(EAX) )
+
PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */
ADD_L ( CONST(12), EAX ) /* next r */
@@ -337,12 +347,15 @@ LLBL (G3TNNR_norm): /* need to calculate lengths */
MOVQ ( MM7, MM4 ) /* | x2 (transformed) */
PFMUL ( MM6, MM3 ) /* x1*x1 | x0*x0 */
+
PFMUL ( MM7, MM4 ) /* | x2*x2 */
PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1 */
PFADD ( MM4, MM3 ) /* | x0*x0+x1*x1+x2*x2*/
ADD_L ( STRIDE, EDX ) /* next normal */
+ PREFETCH ( REGIND(EDX) )
+
PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */
MOVQ ( MM5, MM4 )
@@ -367,12 +380,11 @@ LLBL (G3TNNR_norm): /* need to calculate lengths */
LLBL (G3TNNR_exit_3dnow):
FEMMS
- POP_L ( EBP )
LLBL (G3TNNR_end):
+ POP_L ( EBP )
POP_L ( ESI )
POP_L ( EDI )
- POP_L ( ECX )
RET
@@ -381,38 +393,31 @@ LLBL (G3TNNR_end):
ALIGNTEXT16
-
GLOBL GLNAME(gl_3dnow_transform_rescale_normals_no_rot_raw)
GLNAME(gl_3dnow_transform_rescale_normals_no_rot_raw):
#undef FRAME_OFFSET
#define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L ( ARG_IN, EAX )
- MOV_L ( ARG_DEST, EDX )
- MOV_L ( REGOFF(V3F_COUNT, EAX), EAX ) /* dest->count = in->count */
- MOV_L ( EAX, REGOFF(V3F_COUNT, EDX) )
- MOV_L ( ARG_IN, ESI )
- MOV_L ( ARG_MAT, ECX )
- MOV_L ( REGOFF(V3F_START, EDX), EAX ) /* dest->start */
- MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
- MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
+ PUSH_L ( EBP )
-ALIGNTEXT32
-
- CMP_L ( CONST(0), REGOFF (V3F_COUNT, ESI) )
+ MOV_L ( ARG_IN, EAX )
+ MOV_L ( ARG_DEST, EDX )
+ MOV_L ( REGOFF(V3F_COUNT, EAX), EBP ) /* dest->count = in->count */
+ MOV_L ( EBP, REGOFF(V3F_COUNT, EDX) )
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_MAT, ECX )
+ MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
+ MOV_L ( REGOFF(V3F_START, EDX), EAX ) /* dest->start */
+ MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+
+ CMP_L ( CONST(0), EBP )
JE ( LLBL (G3TRNR_end) )
- PUSH_L ( EBP )
- MOV_L ( REGOFF (V3F_COUNT, ESI), EBP )
FEMMS
- #undef FRAME_OFFSET
- #define FRAME_OFFSET 16
MOVD ( ARG_SCALE, MM6 ) /* | scale */
PUNPCKLDQ ( MM6, MM6 ) /* scale | scale */
@@ -428,11 +433,15 @@ ALIGNTEXT32
MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */
ALIGNTEXT32
-
LLBL (G3TRNR_rescale):
+
+ PREFETCHW ( REGIND(EAX) )
+
PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */
ADD_L ( STRIDE, EDX ) /* next normal */
+ PREFETCH ( REGIND(EDX) )
+
PFMUL ( MM2, MM5 ) /* | x2*m10 */
ADD_L ( CONST(12), EAX ) /* next r */
@@ -446,12 +455,11 @@ LLBL (G3TRNR_rescale):
JA ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */
FEMMS
- POP_L ( EBP )
LLBL (G3TRNR_end):
+ POP_L ( EBP )
POP_L ( ESI )
POP_L ( EDI )
- POP_L ( ECX )
RET
@@ -463,24 +471,19 @@ GLOBL GLNAME(gl_3dnow_transform_rescale_normals_raw)
GLNAME(gl_3dnow_transform_rescale_normals_raw):
#undef FRAME_OFFSET
- #define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L (REGOFF(24,ESP), EAX)
- MOV_L (REGOFF(36,ESP), EDX)
- MOV_L (REGOFF(8,EAX), EAX)
- MOV_L (EAX, REGOFF(8,EDX))
- MOV_L (REGOFF(24,ESP), EDI)
- MOV_L (REGOFF(4,EDX), EAX)
- MOV_L (REGOFF(16,ESP), ECX)
- MOV_L (REGOFF(24,ESP), ESI)
- MOV_L (REGOFF(64,ECX), ECX)
- MOV_L (REGOFF(4,EDI), EDX)
- MOV_L (REGOFF(8,EDI), EDI)
+ #define FRAME_OFFSET 8
-ALIGNTEXT32
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
+
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_DEST, EAX )
+ MOV_L ( ARG_MAT, ECX )
+ MOV_L ( REGOFF(V3F_COUNT, ESI), EDI ) /* dest->count = in->count */
+ MOV_L ( EDI, REGOFF(V3F_COUNT, EAX) )
+ MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */
+ MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+ MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
CMP_L ( CONST(0), EDI )
JE ( LLBL (G3TR_end) )
@@ -490,12 +493,12 @@ ALIGNTEXT32
MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */
MOVQ ( REGOFF(16,ECX), MM4 ) /* m5 | m4 */
- MOVD ( REGOFF(20, ESP), MM0 ) /* scale */
+ MOVD ( ARG_SCALE, MM0 ) /* scale */
MOVD ( REGOFF(8,ECX), MM5 ) /* | m2 */
PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */
- PUNPCKLDQ ( REGOFF(24, ECX), MM5 )
+ PUNPCKLDQ ( REGOFF(24, ECX), MM5 )
PFMUL ( MM0, MM3 ) /* scale*m1 | scale*m0 */
MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8*/
@@ -510,7 +513,11 @@ ALIGNTEXT32
PFMUL ( MM0, MM7 ) /* | scale*m10 */
MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */
+ALIGNTEXT32
LLBL (G3TR_rescale):
+
+ PREFETCHW ( REGIND(EAX) )
+
MOVQ ( MM0, MM1 ) /* x1 | x0 */
PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */
@@ -520,25 +527,28 @@ LLBL (G3TR_rescale):
PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */
PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */
+ MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */
+
PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */
PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */
- MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */
- MOVQ ( MM0, REGOFF(-12, EAX) ) /* write r0, r1 */
+ MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */
+ ADD_L ( STRIDE, EDX ) /* next normal */
+
+ PREFETCH ( REGIND(EDX) )
+ MOVQ ( MM0, REGOFF(-12, EAX) ) /* write r0, r1 */
PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */
- MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */
PFMUL ( MM7, MM2 ) /* | x2*m10 */
PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */
- ADD_L ( REGOFF(12, ESI), EDX ) /* next normal */
-
MOVD ( MM1, REGOFF(-4, EAX) ) /* write r2 */
- MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */
+ MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */
MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */
+
DEC_L ( EDI ) /* decrement normal counter */
JA ( LLBL (G3TR_rescale) )
@@ -547,7 +557,6 @@ LLBL (G3TR_rescale):
LLBL (G3TR_end):
POP_L ( ESI )
POP_L ( EDI )
- POP_L ( ECX )
RET
@@ -560,25 +569,20 @@ ALIGNTEXT16
GLOBL GLNAME(gl_3dnow_transform_normals_no_rot_raw)
GLNAME(gl_3dnow_transform_normals_no_rot_raw):
- #define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L (REGOFF(24,ESP), EAX)
- MOV_L (REGOFF(36,ESP), EDX)
- MOV_L (REGOFF(8,EAX), EAX)
- MOV_L (EAX, REGOFF(8,EDX))
- MOV_L (REGOFF(24,ESP), EDI)
- MOV_L (REGOFF(4,EDX), EAX)
- MOV_L (REGOFF(16,ESP), ECX)
- MOV_L (REGOFF(24,ESP), ESI)
- MOV_L (REGOFF(64,ECX), ECX)
- MOV_L (REGOFF(4,EDI), EDX)
- MOV_L (REGOFF(8,EDI), EDI)
-
-
-ALIGNTEXT32
+ #undef FRAME_OFFSET
+ #define FRAME_OFFSET 8
+
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
+
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_DEST, EAX )
+ MOV_L ( ARG_MAT, ECX )
+ MOV_L ( REGOFF(V3F_COUNT, ESI), EDI ) /* dest->count = in->count */
+ MOV_L ( EDI, REGOFF(V3F_COUNT, EAX) )
+ MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */
+ MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+ MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
CMP_L ( CONST(0), EDI )
JE ( LLBL (G3TNR_end) )
@@ -595,10 +599,14 @@ ALIGNTEXT32
MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */
ALIGNTEXT32
-
LLBL (G3TNR_transform):
+
+ PREFETCHW ( REGIND(EAX) )
+
PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */
- ADD_L ( REGOFF(12, ESI), EDX) /* next normal */
+ ADD_L ( STRIDE, EDX) /* next normal */
+
+ PREFETCH ( REGIND(EDX) )
PFMUL ( MM2, MM5 ) /* | x2*m10 */
ADD_L ( CONST(12), EAX ) /* next r */
@@ -617,7 +625,6 @@ LLBL (G3TNR_transform):
LLBL (G3TNR_end):
POP_L ( ESI )
POP_L ( EDI )
- POP_L ( ECX )
RET
@@ -631,24 +638,20 @@ ALIGNTEXT16
GLOBL GLNAME(gl_3dnow_transform_normals_raw)
GLNAME(gl_3dnow_transform_normals_raw):
- #define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L (REGOFF(24,ESP), EAX)
- MOV_L (REGOFF(36,ESP), EDX)
- MOV_L (REGOFF(8,EAX), EAX)
- MOV_L (EAX, REGOFF(8,EDX))
- MOV_L (REGOFF(24,ESP), EDI)
- MOV_L (REGOFF(4,EDX), EAX)
- MOV_L (REGOFF(16,ESP), ECX)
- MOV_L (REGOFF(24,ESP), ESI)
- MOV_L (REGOFF(64,ECX), ECX)
- MOV_L (REGOFF(4,EDI), EDX)
- MOV_L (REGOFF(8,EDI), EDI)
-
-ALIGNTEXT32
+ #undef FRAME_OFFSET
+ #define FRAME_OFFSET 8
+
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
+
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_DEST, EAX )
+ MOV_L ( ARG_MAT, ECX )
+ MOV_L ( REGOFF(V3F_COUNT, ESI), EDI ) /* dest->count = in->count */
+ MOV_L ( EDI, REGOFF(V3F_COUNT, EAX) )
+ MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */
+ MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */
+ MOV_L ( REGOFF(MAT_INV, ECX), ECX ) /* mat->inv */
CMP_L ( CONST(0), EDI ) /* count > 0 ?? */
JE ( LLBL (G3T_end) )
@@ -659,15 +662,19 @@ ALIGNTEXT32
MOVQ ( REGOFF(16, ECX), MM4 ) /* m5 | m4 */
MOVD ( REGOFF(8, ECX), MM5 ) /* | m2 */
- PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) /* m6 | m2*/
+ PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) /* m6 | m2 */
- MOVQ ( REGOFF(32,ECX), MM6 ) /* m9 | m8 */
- MOVD ( REGOFF(40,ECX), MM7 ) /* | m10 */
+ MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8 */
+ MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */
MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */
MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */
+ALIGNTEXT32
LLBL (G3T_transform):
+
+ PREFETCHW ( REGIND(EAX) )
+
MOVQ ( MM0, MM1 ) /* x1 | x0 */
PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */
@@ -687,10 +694,12 @@ LLBL (G3T_transform):
MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */
PFMUL ( MM7, MM2 ) /* | x2*m10 */
- PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */
+ ADD_L ( STRIDE, EDX ) /* next normal */
+ PREFETCH ( REGIND(EDX) )
+
+ PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */
- ADD_L ( REGOFF(12, ESI), EDX ) /* next normal */
MOVD ( MM1, REGOFF(-4, EAX) ) /* write r2 */
MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */
@@ -704,7 +713,6 @@ LLBL (G3T_transform):
LLBL (G3T_end):
POP_L ( ESI )
POP_L ( EDI )
- POP_L ( ECX )
RET
@@ -716,30 +724,23 @@ ALIGNTEXT16
GLOBL GLNAME(gl_3dnow_normalize_normals_raw)
GLNAME(gl_3dnow_normalize_normals_raw):
+ #undef FRAME_OFFSET
#define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L (REGOFF(16,ESP), ESI)
- MOV_L (REGOFF(24,ESP), EAX)
- MOV_L (REGOFF(36,ESP), EDX)
- MOV_L (REGOFF(8,EAX), EAX)
- MOV_L (EAX, REGOFF(8,EDX))
- MOV_L (REGOFF(4,EDX), EAX)
- MOV_L (REGOFF(24,ESP), ECX)
- MOV_L (REGOFF(28,ESP), EDX)
- MOV_L (REGOFF(24,ESP), EDI)
- MOV_L (REGOFF(4,ECX), ECX)
-
-
-ALIGNTEXT32
-
- CMP_L ( CONST(0), REGOFF(8, EDI) ) /* count > 0 ?? */
- JE ( LLBL (G3N_end) )
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
PUSH_L ( EBP )
- MOV_L (REGOFF(8,EDI), EBP)
+
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_DEST, EAX )
+ MOV_L ( REGOFF(V3F_COUNT, ESI), EBP ) /* dest->count = in->count */
+ MOV_L ( EBP, REGOFF(V3F_COUNT, EAX) )
+ MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */
+ MOV_L ( REGOFF(V3F_START, ESI), ECX ) /* in->start */
+ MOV_L ( ARG_LENGTHS, EDX )
+
+ CMP_L ( CONST(0), EBP ) /* count > 0 ?? */
+ JE ( LLBL (G3N_end) )
FEMMS
@@ -749,17 +750,23 @@ ALIGNTEXT32
CMP_L ( CONST(0), EDX ) /* lengths == 0 ? */
JE ( LLBL (G3N_norm2) ) /* calculate lengths */
+ALIGNTEXT32
LLBL (G3N_norm1): /* use precalculated lengths */
+
+ PREFETCH ( REGIND(EAX) )
+
MOVD ( REGIND(EDX), MM3 ) /* | length (x) */
PFMUL ( MM3, MM1 ) /* | x2 (normalized) */
PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */
- PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalized) */
+ ADD_L ( STRIDE, ECX ) /* next normal */
+
+ PREFETCH ( REGIND(ECX) )
+ PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalized) */
MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */
- MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */
- ADD_L ( REGOFF(12, EDI), ECX ) /* next normal */
+ MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */
ADD_L ( CONST(12), EAX ) /* next r */
ADD_L ( CONST(4), EDX ) /* next length */
@@ -771,10 +778,15 @@ LLBL (G3N_norm1): /* use precalculated lengths */
JMP ( LLBL (G3N_end1) )
-LLBL (G3N_norm2):
- /* need to calculate lengths */
+ALIGNTEXT32
+LLBL (G3N_norm2): /* need to calculate lengths */
+
+ PREFETCHW ( REGIND(EAX) )
+
MOVQ ( MM0, MM3 ) /* x1 | x0 */
- ADD_L ( REGOFF(12, EDI), ECX ) /* next normal */
+ ADD_L ( STRIDE, ECX ) /* next normal */
+
+ PREFETCH ( REGIND(ECX) )
PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */
MOVQ ( MM1, MM4 ) /* | x2 */
@@ -808,12 +820,11 @@ LLBL (G3N_norm2):
LLBL (G3N_end1):
FEMMS
- POP_L ( EBP )
LLBL (G3N_end):
- POP_L ( ESI )
- POP_L ( EDI )
- POP_L ( ECX )
+ POP_L ( EBP )
+ POP_L ( ESI )
+ POP_L ( EDI )
RET
@@ -825,48 +836,46 @@ ALIGNTEXT16
GLOBL GLNAME(gl_3dnow_rescale_normals_raw)
GLNAME(gl_3dnow_rescale_normals_raw):
- #define FRAME_OFFSET 12
- SUB_L ( CONST(4), ESP )
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- MOV_L (REGOFF(20,ESP), ESI)
- MOV_L (REGOFF(24,ESP), EAX)
- MOV_L (REGOFF(36,ESP), EDX)
- MOV_L (REGOFF(8,EAX), EAX)
- MOV_L (EAX, REGOFF(8,EDX))
- MOV_L (REGOFF(24,ESP), EDI)
- MOV_L (EDI, ECX)
- MOV_L (REGOFF(4,EDX), EAX)
- MOV_L (REGOFF(4,ECX), ECX)
- MOV_L (REGOFF(8,EDI), EDX)
+ #undef FRAME_OFFSET
+ #define FRAME_OFFSET 8
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
-ALIGNTEXT32
+ MOV_L ( ARG_IN, ESI )
+ MOV_L ( ARG_DEST, EAX )
+ MOV_L ( REGOFF(V3F_COUNT, ESI), EDX ) /* dest->count = in->count */
+ MOV_L ( EDX, REGOFF(V3F_COUNT, EAX) )
+ MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */
+ MOV_L ( REGOFF(V3F_START, ESI), ECX ) /* in->start */
CMP_L ( CONST(0), EDX )
JE ( LLBL (G3R_end) )
FEMMS
- MOVD ( ESI, MM0 ) /* scale */
+ MOVD ( ARG_SCALE, MM0 ) /* scale */
PUNPCKLDQ ( MM0, MM0 )
MOVQ ( REGIND(ECX), MM1 ) /* x1 | x0 */
MOVD ( REGOFF(8, ECX), MM2 ) /* | x2 */
ALIGNTEXT32
-
LLBL (G3R_rescale):
+
+ PREFETCHW ( REGIND(EAX) )
+
PFMUL ( MM0, MM1 ) /* x1*scale | x0*scale */
- ADD_L ( REGOFF(12, EDI), ECX ) /* next normal */
+ ADD_L ( STRIDE, ECX ) /* next normal */
+
+ PREFETCH ( REGIND(ECX) )
PFMUL ( MM0, MM2 ) /* | x2*scale */
ADD_L ( CONST(12), EAX ) /* next r */
- DEC_L ( EDX ) /* decrement normal counter */
MOVQ ( MM1, REGOFF(-12, EAX) ) /* write r0, r1 */
-
MOVD ( MM2, REGOFF(-4, EAX) ) /* write r2 */
+
+ DEC_L ( EDX ) /* decrement normal counter */
MOVQ ( REGIND(ECX), MM1 ) /* x1 | x0 */
MOVD ( REGOFF(8, ECX), MM2 ) /* | x2 */
@@ -875,17 +884,9 @@ LLBL (G3R_rescale):
FEMMS
LLBL (G3R_end):
- POP_L ( ESI )
- POP_L ( EDI )
- POP_L ( ECX )
+ POP_L ( ESI )
+ POP_L ( EDI )
RET
-
-
-
-
-
-
-
diff --git a/xc/extras/Mesa/src/X86/katmai.c b/xc/extras/Mesa/src/X86/katmai.c
index 1dfa0f7fc..507a7208c 100644
--- a/xc/extras/Mesa/src/X86/katmai.c
+++ b/xc/extras/Mesa/src/X86/katmai.c
@@ -21,7 +21,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/X86/katmai.c,v 1.4 2000/09/26 15:56:39 tsi Exp $ */
/*
* PentiumIII-SIMD (SSE) optimizations contributed by
@@ -49,7 +49,7 @@
#define XFORM_ARGS GLvector4f *to_vec, \
- const GLmatrix *mat, \
+ const GLfloat m[16], \
const GLvector4f *from_vec, \
const GLubyte *mask, \
const GLubyte flag
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_masked1.S b/xc/extras/Mesa/src/X86/katmai_xform_masked1.S
index f3e11c803..0408fcf81 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_masked1.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_masked1.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_masked1.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_masked2.S b/xc/extras/Mesa/src/X86/katmai_xform_masked2.S
index a4936fa6a..bfaaa5400 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_masked2.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_masked2.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_masked2.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_masked3.S b/xc/extras/Mesa/src/X86/katmai_xform_masked3.S
index 10f3c41b5..cace27fc1 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_masked3.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_masked3.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_masked3.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_masked4.S b/xc/extras/Mesa/src/X86/katmai_xform_masked4.S
index 4a0bf5c05..d5d591bbb 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_masked4.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_masked4.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_masked4.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_raw1.S b/xc/extras/Mesa/src/X86/katmai_xform_raw1.S
index 4ca992d2c..b8e9dcda8 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_raw1.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_raw1.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_raw1.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_raw2.S b/xc/extras/Mesa/src/X86/katmai_xform_raw2.S
index 61845034c..c330b0783 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_raw2.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_raw2.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_raw2.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_raw3.S b/xc/extras/Mesa/src/X86/katmai_xform_raw3.S
index 49918de95..d9ed22be3 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_raw3.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_raw3.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_raw3.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/katmai_xform_raw4.S b/xc/extras/Mesa/src/X86/katmai_xform_raw4.S
index d0867da7c..eabec45bc 100644
--- a/xc/extras/Mesa/src/X86/katmai_xform_raw4.S
+++ b/xc/extras/Mesa/src/X86/katmai_xform_raw4.S
@@ -1,4 +1,7 @@
+/* $XFree86: xc/extras/Mesa/src/X86/katmai_xform_raw4.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
+
/** TODO:
* - insert PREFETCH instructions to avoid cache-misses !
* - some more optimizations are possible...
@@ -32,7 +35,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/X86/x86.c b/xc/extras/Mesa/src/X86/x86.c
index 1b24811d4..0e531b8df 100644
--- a/xc/extras/Mesa/src/X86/x86.c
+++ b/xc/extras/Mesa/src/X86/x86.c
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/X86/x86.c,v 1.6 2000/09/26 15:56:40 tsi Exp $ */
/*
* Intel x86 assembly code by Josh Vanderhoof
@@ -36,23 +37,23 @@
#include "x86.h"
#ifdef USE_X86_ASM
-extern void _ASMAPI gl_v16_x86_cliptest_points4(GLfloat *first_vert,
+extern void _ASMAPI gl_v16_x86_cliptest_points4( GLfloat *first_vert,
GLfloat *last_vert,
GLubyte *or_mask,
GLubyte *and_mask,
GLubyte *clip_mask );
-extern void _ASMAPI gl_v16_x86_general_xform(GLfloat *dest,
+extern void _ASMAPI gl_v16_x86_general_xform( GLfloat *dest,
const GLfloat *m,
const GLfloat *src,
GLuint src_stride,
- GLuint count);
+ GLuint count );
#endif
#define XFORM_ARGS GLvector4f *to_vec, \
- const GLmatrix *mat, \
+ const GLfloat m[16], \
const GLvector4f *from_vec, \
const GLubyte *mask, \
const GLubyte flag
@@ -117,7 +118,6 @@ void gl_init_x86_asm_transforms( void )
gl_test_all_transform_functions("x86");
#endif
-
gl_cliptest_points4_v16 = gl_v16_x86_cliptest_points4;
gl_xform_points3_v16_general = gl_v16_x86_general_xform;
#endif
diff --git a/xc/extras/Mesa/src/X86/x86a.S b/xc/extras/Mesa/src/X86/x86a.S
index 621bc1f1a..ac12457ee 100644
--- a/xc/extras/Mesa/src/X86/x86a.S
+++ b/xc/extras/Mesa/src/X86/x86a.S
@@ -1,3 +1,5 @@
+/* $XFree86: xc/extras/Mesa/src/X86/x86a.S,v 1.4 2000/09/26 15:56:40 tsi Exp $ */
+
#include "assyntax.h"
SEG_TEXT
@@ -28,7 +30,7 @@
* Offsets for transform_func arguments
*
* typedef void (*transform_func)( GLvector4f *to_vec,
- * const GLmatrix *mat,
+ * const GLfloat m[16],
* const GLvector4f *from_vec,
* const GLubyte *clipmask,
* const GLubyte flag );
diff --git a/xc/extras/Mesa/src/accum.c b/xc/extras/Mesa/src/accum.c
index 71475eefb..da658df0c 100644
--- a/xc/extras/Mesa/src/accum.c
+++ b/xc/extras/Mesa/src/accum.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/accum.c,v 1.7 2000/09/26 15:56:29 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -353,9 +353,8 @@ _mesa_Accum( GLenum op, GLfloat value )
static GLchan multTable[32768];
static GLfloat prevMult = 0.0;
GLuint j;
- const GLint max = (GLint) (256 / mult);
+ const GLint max = MIN2((GLint) (256 / mult), 32767);
if (mult != prevMult) {
- assert(max <= 32768);
for (j = 0; j < max; j++)
multTable[j] = (GLint) ((GLfloat) j * mult + 0.5F);
prevMult = mult;
diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c
index 2e750ffdb..a464f0905 100644
--- a/xc/extras/Mesa/src/attrib.c
+++ b/xc/extras/Mesa/src/attrib.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.3
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/attrib.c,v 1.6 2000/09/26 15:56:29 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -358,6 +358,7 @@ _mesa_PushAttrib(GLbitfield mask)
copy_texobj_state(&attr->Unit[u].Saved1D, attr->Unit[u].CurrentD[1]);
copy_texobj_state(&attr->Unit[u].Saved2D, attr->Unit[u].CurrentD[2]);
copy_texobj_state(&attr->Unit[u].Saved3D, attr->Unit[u].CurrentD[3]);
+ copy_texobj_state(&attr->Unit[u].SavedCubeMap, attr->Unit[u].CurrentCubeMap);
}
newnode = new_attrib_node( GL_TEXTURE_BIT );
newnode->data = attr;
@@ -473,11 +474,14 @@ _mesa_PopAttrib(void)
break;
case GL_DEPTH_BUFFER_BIT:
{
+ GLboolean oldDepthTest = ctx->Depth.Test;
GLenum oldDepthFunc = ctx->Depth.Func;
GLboolean oldDepthMask = ctx->Depth.Mask;
GLfloat oldDepthClear = ctx->Depth.Clear;
MEMCPY( &ctx->Depth, attr->data,
sizeof(struct gl_depthbuffer_attrib) );
+ if (ctx->Depth.Test != oldDepthTest && ctx->Driver.Enable)
+ (*ctx->Driver.Enable)( ctx, GL_DEPTH_TEST, ctx->Depth.Test);
if (ctx->Depth.Func != oldDepthFunc && ctx->Driver.DepthFunc)
(*ctx->Driver.DepthFunc)( ctx, ctx->Depth.Func );
if (ctx->Depth.Mask != oldDepthMask && ctx->Driver.DepthMask)
@@ -769,9 +773,13 @@ _mesa_PopAttrib(void)
&(ctx->Texture.Unit[u].Saved2D) );
copy_texobj_state( ctx->Texture.Unit[u].CurrentD[3],
&(ctx->Texture.Unit[u].Saved3D) );
+ copy_texobj_state( ctx->Texture.Unit[u].CurrentCubeMap,
+ &(ctx->Texture.Unit[u].SavedCubeMap) );
+
gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentD[1] );
gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentD[2] );
gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentD[3] );
+ gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentCubeMap );
}
}
diff --git a/xc/extras/Mesa/src/blend.c b/xc/extras/Mesa/src/blend.c
index 9419393f6..70c114ef9 100644
--- a/xc/extras/Mesa/src/blend.c
+++ b/xc/extras/Mesa/src/blend.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/blend.c,v 1.7 2000/09/26 15:56:29 tsi Exp $ */
#ifdef PC_HEADER
@@ -663,7 +663,7 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
dR = dG = dB = ctx->Color.BlendColor[3];
break;
case GL_ONE_MINUS_CONSTANT_ALPHA:
- dR = dG = dB = 1.0F - ctx->Color.BlendColor[3] * ascale;
+ dR = dG = dB = 1.0F - ctx->Color.BlendColor[3];
break;
case GL_DST_COLOR: /* GL_NV_blend_square */
dR = (GLfloat) Rd * rscale;
@@ -717,7 +717,7 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
dA = ctx->Color.BlendColor[3];
break;
case GL_ONE_MINUS_CONSTANT_ALPHA:
- dA = 1.0F - ctx->Color.BlendColor[3] * ascale;
+ dA = 1.0F - ctx->Color.BlendColor[3];
break;
case GL_DST_COLOR: /* GL_NV_blend_square */
dA = (GLfloat) Ad * ascale;
diff --git a/xc/extras/Mesa/src/buffers.c b/xc/extras/Mesa/src/buffers.c
index 086dc9345..e334265a6 100644
--- a/xc/extras/Mesa/src/buffers.c
+++ b/xc/extras/Mesa/src/buffers.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/buffers.c,v 1.4 2000/09/26 15:56:29 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -151,10 +151,9 @@ clear_color_buffer(GLcontext *ctx)
const GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
GLubyte span[MAX_WIDTH][4];
GLint i;
- ASSERT(ctx->Color.ColorMask[0] &&
- ctx->Color.ColorMask[1] &&
- ctx->Color.ColorMask[2] &&
- ctx->Color.ColorMask[3]);
+
+ ASSERT(!ctx->Color.SWmasking);
+
for (i = 0; i < width; i++) {
span[i][RCOMP] = r;
span[i][GCOMP] = g;
@@ -299,7 +298,7 @@ _mesa_Clear( GLbitfield mask )
/* clear software-based alpha buffer(s) */
if ( (mask & GL_COLOR_BUFFER_BIT)
&& ctx->DrawBuffer->UseSoftwareAlphaBuffers
- && ctx->Color.ColorMask[RCOMP]) {
+ && ctx->Color.ColorMask[ACOMP]) {
_mesa_clear_alpha_buffers( ctx );
}
diff --git a/xc/extras/Mesa/src/clip_funcs.h b/xc/extras/Mesa/src/clip_funcs.h
index 5f0591872..d2bb45280 100644
--- a/xc/extras/Mesa/src/clip_funcs.h
+++ b/xc/extras/Mesa/src/clip_funcs.h
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/clip_funcs.h,v 1.6 2000/09/26 15:56:29 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -162,14 +163,18 @@ static GLuint TAG(viewclip_polygon)( struct vertex_buffer *VB,
clipmask[idxPrev] |= (PLANE&CLIP_ALL_BITS); \
\
if (!NEGATIVE(dpPrev)) { \
+ if (IND&CLIP_TAB_EDGEFLAG) { \
+ if (outcount) \
+ VB->EdgeFlagPtr->data[outlist[outcount-1]] &= ~2; \
+ } \
outlist[outcount++] = idxPrev; \
clipmask[idxPrev] &= ~(PLANE&CLIP_ALL_BITS); \
} \
\
if (DIFFERENT_SIGNS(dp, dpPrev)) { \
- if (NEGATIVE(dp)) { \
- /* Coming back in. Avoid division by zero as we know \
- * dp != dpPrev from DIFFERENT_SIGNS, above. \
+ if (NEGATIVE(dp)) { \
+ /* Going out of bounds. Avoid division by zero as we \
+ * know dp != dpPrev from DIFFERENT_SIGNS, above. \
*/ \
GLfloat t = dp / (dp - dpPrev); \
INTERP_SZ( t, VB->ClipPtr->data, vb_free, \
@@ -177,26 +182,26 @@ static GLuint TAG(viewclip_polygon)( struct vertex_buffer *VB,
interp( VB, vb_free, t, idx, idxPrev ); \
\
if (IND&CLIP_TAB_EDGEFLAG) \
- VB->EdgeFlagPtr->data[vb_free] = \
- VB->EdgeFlagPtr->data[idxPrev]; \
+ VB->EdgeFlagPtr->data[vb_free] = 3; \
} else { \
- /* Going out of bounds \
+ /* Coming back in. \
*/ \
GLfloat t = dpPrev / (dpPrev - dp); \
- INTERP_SZ( t, VB->ClipPtr->data, vb_free, \
+ INTERP_SZ( t, VB->ClipPtr->data, vb_free, \
idxPrev, idx, SIZE ); \
interp( VB, vb_free, t, idxPrev, idx ); \
\
- if (IND&CLIP_TAB_EDGEFLAG) \
- VB->EdgeFlagPtr->data[vb_free] = 3; \
+ if (IND&CLIP_TAB_EDGEFLAG) { \
+ VB->EdgeFlagPtr->data[vb_free] = \
+ VB->EdgeFlagPtr->data[idxPrev]; \
+ } \
} \
\
- if (IND&CLIP_TAB_EDGEFLAG) { \
/* Demote trailing edge to internal edge. \
*/ \
- if (outcount && \
- (VB->EdgeFlagPtr->data[outlist[outcount-1]] & 0x2)) \
- VB->EdgeFlagPtr->data[outlist[outcount-1]] = 1; \
+ if (IND&CLIP_TAB_EDGEFLAG) { \
+ if (outcount) \
+ VB->EdgeFlagPtr->data[outlist[outcount-1]] &= ~2; \
} \
\
outlist[outcount++] = vb_free; \
@@ -210,6 +215,7 @@ static GLuint TAG(viewclip_polygon)( struct vertex_buffer *VB,
if (outcount < 3) \
return 0; \
\
+ \
{ \
GLuint *tmp = inlist; \
inlist = outlist; \
@@ -218,7 +224,6 @@ static GLuint TAG(viewclip_polygon)( struct vertex_buffer *VB,
} \
}
-
#include "general_clip.h"
if (inlist != vlist)
@@ -365,6 +370,8 @@ static GLuint TAG(userclip_polygon)( struct vertex_buffer *VB,
GLuint flagI = INSIDE(dpI);
if (flagJ) {
+ if ((IND&CLIP_TAB_EDGEFLAG) && outcount)
+ VB->EdgeFlagPtr->data[outlist[outcount-1]] &= ~2;
outlist[outcount++] = prevj;
} else {
VB->ClipMask[prevj] |= CLIP_USER_BIT;
@@ -392,12 +399,11 @@ static GLuint TAG(userclip_polygon)( struct vertex_buffer *VB,
VB->EdgeFlagPtr->data[vb_free] = 3;
}
- if (IND&CLIP_TAB_EDGEFLAG) {
/* Demote trailing edge to internal edge.
*/
- if (outcount &&
- (VB->EdgeFlagPtr->data[outlist[outcount-1]] & 0x2))
- VB->EdgeFlagPtr->data[outlist[outcount-1]] = 1;
+ if (IND&CLIP_TAB_EDGEFLAG) {
+ if (outcount)
+ VB->EdgeFlagPtr->data[outlist[outcount-1]] &= ~2;
}
INTERP_SZ( t, coord, vb_free, in, out, SIZE );
diff --git a/xc/extras/Mesa/src/colortab.c b/xc/extras/Mesa/src/colortab.c
index e15014dfe..dff9feae9 100644
--- a/xc/extras/Mesa/src/colortab.c
+++ b/xc/extras/Mesa/src/colortab.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/colortab.c,v 1.7 2000/09/26 15:56:29 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -300,7 +300,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
assert(table);
- if (!_mesa_is_legal_format_and_type(format, type)) {
+ if (!_mesa_is_legal_format_and_type(format, type) ||
+ format == GL_INTENSITY) {
gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)");
return;
}
@@ -311,17 +312,30 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
return;
}
- if (width < 1 || width > ctx->Const.MaxColorTableSize
- || _mesa_bitcount(width) != 1) {
- if (width > ctx->Const.MaxColorTableSize)
- gl_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)");
- else
+ if (width < 0 || _mesa_bitcount(width) != 1) {
+ if (proxy) {
+ table->Size = 0;
+ table->IntFormat = (GLenum) 0;
+ table->Format = (GLenum) 0;
+ }
+ else {
gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)");
+ }
+ return;
+ }
+
+ if (width > ctx->Const.MaxColorTableSize) {
if (proxy) {
table->Size = 0;
table->IntFormat = (GLenum) 0;
table->Format = (GLenum) 0;
}
+ else {
+ if (width > ctx->Const.MaxColorTableSize)
+ gl_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)");
+ else
+ gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)");
+ }
return;
}
@@ -339,14 +353,14 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
FREE(table->Table);
}
if (floatTable) {
- GLubyte tableUB[MAX_COLOR_TABLE_SIZE * 4];
+ GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4];
GLfloat *tableF;
GLuint i;
- _mesa_unpack_ubyte_color_span(ctx, width, table->Format,
- tableUB, /* dest */
+ _mesa_unpack_float_color_span(ctx, width, table->Format,
+ tempTab, /* dest */
format, type, data,
- &ctx->Unpack, GL_TRUE);
+ &ctx->Unpack, GL_TRUE, GL_FALSE);
table->TableType = GL_FLOAT;
table->Table = MALLOC(comps * width * sizeof(GLfloat));
@@ -355,50 +369,43 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
return;
}
- /* Apply scale and bias and convert GLubyte values to GLfloats
- * in [0, 1]. Store results in the tableF[].
- */
- rScale /= 255.0;
- gScale /= 255.0;
- bScale /= 255.0;
- aScale /= 255.0;
tableF = (GLfloat *) table->Table;
switch (table->Format) {
case GL_INTENSITY:
for (i = 0; i < width; i++) {
- tableF[i] = tableUB[i] * rScale + rBias;
+ tableF[i] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F);
}
break;
case GL_LUMINANCE:
for (i = 0; i < width; i++) {
- tableF[i] = tableUB[i] * rScale + rBias;
+ tableF[i] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F);
}
break;
case GL_ALPHA:
for (i = 0; i < width; i++) {
- tableF[i] = tableUB[i] * aScale + aBias;
+ tableF[i] = CLAMP(tempTab[i] * aScale + aBias, 0.0F, 1.0F);
}
break;
case GL_LUMINANCE_ALPHA:
for (i = 0; i < width; i++) {
- tableF[i*2+0] = tableUB[i*2+0] * rScale + rBias;
- tableF[i*2+1] = tableUB[i*2+1] * aScale + aBias;
+ tableF[i*2+0] = CLAMP(tempTab[i*2+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[i*2+1] = CLAMP(tempTab[i*2+1] * aScale + aBias, 0.0F, 1.0F);
}
break;
case GL_RGB:
for (i = 0; i < width; i++) {
- tableF[i*3+0] = tableUB[i*3+0] * rScale + rBias;
- tableF[i*3+1] = tableUB[i*3+1] * gScale + gBias;
- tableF[i*3+2] = tableUB[i*3+2] * bScale + bBias;
+ tableF[i*3+0] = CLAMP(tempTab[i*3+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[i*3+1] = CLAMP(tempTab[i*3+1] * gScale + gBias, 0.0F, 1.0F);
+ tableF[i*3+2] = CLAMP(tempTab[i*3+2] * bScale + bBias, 0.0F, 1.0F);
}
break;
case GL_RGBA:
for (i = 0; i < width; i++) {
- tableF[i*4+0] = tableUB[i*4+0] * rScale + rBias;
- tableF[i*4+1] = tableUB[i*4+1] * gScale + gBias;
- tableF[i*4+2] = tableUB[i*4+2] * bScale + bBias;
- tableF[i*4+3] = tableUB[i*4+3] * aScale + aBias;
+ tableF[i*4+0] = CLAMP(tempTab[i*4+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[i*4+1] = CLAMP(tempTab[i*4+1] * gScale + gBias, 0.0F, 1.0F);
+ tableF[i*4+2] = CLAMP(tempTab[i*4+2] * bScale + bBias, 0.0F, 1.0F);
+ tableF[i*4+3] = CLAMP(tempTab[i*4+3] * aScale + aBias, 0.0F, 1.0F);
}
break;
default:
@@ -440,6 +447,8 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj = NULL;
struct gl_color_table *table = NULL;
+ GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
+ GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
GLint comps;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable");
@@ -462,12 +471,36 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
break;
case GL_COLOR_TABLE:
table = &ctx->ColorTable;
+ rScale = ctx->Pixel.ColorTableScale[0];
+ gScale = ctx->Pixel.ColorTableScale[1];
+ bScale = ctx->Pixel.ColorTableScale[2];
+ aScale = ctx->Pixel.ColorTableScale[3];
+ rBias = ctx->Pixel.ColorTableBias[0];
+ gBias = ctx->Pixel.ColorTableBias[1];
+ bBias = ctx->Pixel.ColorTableBias[2];
+ aBias = ctx->Pixel.ColorTableBias[3];
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
+ rScale = ctx->Pixel.PCCTscale[0];
+ gScale = ctx->Pixel.PCCTscale[1];
+ bScale = ctx->Pixel.PCCTscale[2];
+ aScale = ctx->Pixel.PCCTscale[3];
+ rBias = ctx->Pixel.PCCTbias[0];
+ gBias = ctx->Pixel.PCCTbias[1];
+ bBias = ctx->Pixel.PCCTbias[2];
+ aBias = ctx->Pixel.PCCTbias[3];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
table = &ctx->PostColorMatrixColorTable;
+ rScale = ctx->Pixel.PCMCTscale[0];
+ gScale = ctx->Pixel.PCMCTscale[1];
+ bScale = ctx->Pixel.PCMCTscale[2];
+ aScale = ctx->Pixel.PCMCTscale[3];
+ rBias = ctx->Pixel.PCMCTbias[0];
+ gBias = ctx->Pixel.PCMCTbias[1];
+ bBias = ctx->Pixel.PCMCTbias[2];
+ aBias = ctx->Pixel.PCMCTbias[3];
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
@@ -476,7 +509,8 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
assert(table);
- if (!_mesa_is_legal_format_and_type(format, type)) {
+ if (!_mesa_is_legal_format_and_type(format, type) ||
+ format == GL_INTENSITY) {
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)");
return;
}
@@ -505,11 +539,66 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
format, type, data, &ctx->Unpack, GL_TRUE);
}
else {
- GLfloat *dest = (GLfloat *) table->Table + start * comps * sizeof(GLfloat);
+ GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4];
+ GLfloat *tableF;
+ GLuint i;
+
ASSERT(table->TableType == GL_FLOAT);
- _mesa_unpack_float_color_span(ctx, count, table->Format, dest,
- format, type, data, &ctx->Unpack,
- GL_FALSE, GL_TRUE);
+
+ _mesa_unpack_float_color_span(ctx, count, table->Format,
+ tempTab, /* dest */
+ format, type, data,
+ &ctx->Unpack, GL_TRUE, GL_FALSE);
+
+ tableF = (GLfloat *) table->Table;
+
+ switch (table->Format) {
+ case GL_INTENSITY:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_LUMINANCE:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_ALPHA:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j] = CLAMP(tempTab[i] * aScale + aBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j*2+0] = CLAMP(tempTab[i*2+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[j*2+1] = CLAMP(tempTab[i*2+1] * aScale + aBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_RGB:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j*3+0] = CLAMP(tempTab[i*3+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[j*3+1] = CLAMP(tempTab[i*3+1] * gScale + gBias, 0.0F, 1.0F);
+ tableF[j*3+2] = CLAMP(tempTab[i*3+2] * bScale + bBias, 0.0F, 1.0F);
+ }
+ break;
+ case GL_RGBA:
+ for (i = 0; i < count; i++) {
+ GLuint j = start + i;
+ tableF[j*4+0] = CLAMP(tempTab[i*4+0] * rScale + rBias, 0.0F, 1.0F);
+ tableF[j*4+1] = CLAMP(tempTab[i*4+1] * gScale + gBias, 0.0F, 1.0F);
+ tableF[j*4+2] = CLAMP(tempTab[i*4+2] * bScale + bBias, 0.0F, 1.0F);
+ tableF[j*4+3] = CLAMP(tempTab[i*4+3] * aScale + aBias, 0.0F, 1.0F);
+ }
+ break;
+ default:
+ gl_problem(ctx, "Bad format in _mesa_ColorSubTable");
+ return;
+ }
}
if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) {
@@ -725,10 +814,10 @@ _mesa_GetColorTable( GLenum target, GLenum format,
if (table->TableType == GL_FLOAT) {
const GLfloat *tableF = (const GLfloat *) table->Table;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * 255.0F);
- rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * 255.0F);
- rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * 255.0F);
- rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * 255.0F);
+ rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * 255.0F + 0.5F);
+ rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * 255.0F + 0.5F);
+ rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * 255.0F + 0.5F);
+ rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * 255.0F + 0.5F);
}
}
else {
diff --git a/xc/extras/Mesa/src/config.c b/xc/extras/Mesa/src/config.c
index 8f8a79aae..9e50ff4b0 100644
--- a/xc/extras/Mesa/src/config.c
+++ b/xc/extras/Mesa/src/config.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/config.c,v 1.5 2000/08/09 23:40:10 dawes Exp $ */
+/* $XFree86: xc/extras/Mesa/src/config.c,v 1.6 2000/09/24 13:50:08 alanh Exp $ */
/* Mesa config file parse and execute code.
@@ -447,8 +447,10 @@ void gl_read_config_file( GLcontext *ctx )
if (!run_init( ctx, default_config, list )) {
- fprintf(stderr, "No default configuration '%s' in init file\n",
- default_config);
+ if (getenv("MESA_DEBUG")) {
+ fprintf(stderr, "No default configuration '%s' in init file\n",
+ default_config);
+ }
}
free_list( list );
diff --git a/xc/extras/Mesa/src/config.h b/xc/extras/Mesa/src/config.h
index 3ff5e5f78..1d93ae611 100644
--- a/xc/extras/Mesa/src/config.h
+++ b/xc/extras/Mesa/src/config.h
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/config.h,v 1.7 2000/09/26 15:56:30 tsi Exp $ */
/*
* Tunable configuration parameters.
@@ -104,8 +104,8 @@
/* Number of texture units - GL_ARB_multitexture */
#define MAX_TEXTURE_UNITS 2
-/* Maximum viewport size: */
-#define MAX_WIDTH 1600
+/* Maximum viewport/image size: */
+#define MAX_WIDTH 2048
#define MAX_HEIGHT 1200
/* Maxmimum size for CVA. May be overridden by the drivers. */
diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c
index 0138ae6b3..f8a4ef90b 100644
--- a/xc/extras/Mesa/src/context.c
+++ b/xc/extras/Mesa/src/context.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/context.c,v 1.6 2000/09/26 15:56:30 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -593,12 +593,34 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
texUnit->EnvMode = GL_MODULATE;
+ texUnit->CombineModeRGB = GL_MODULATE;
+ texUnit->CombineModeA = GL_MODULATE;
+ texUnit->CombineSourceRGB[0] = GL_TEXTURE;
+ texUnit->CombineSourceRGB[1] = GL_PREVIOUS_EXT;
+ texUnit->CombineSourceRGB[2] = GL_CONSTANT_EXT;
+ texUnit->CombineSourceA[0] = GL_TEXTURE;
+ texUnit->CombineSourceA[1] = GL_PREVIOUS_EXT;
+ texUnit->CombineSourceA[2] = GL_CONSTANT_EXT;
+ texUnit->CombineOperandRGB[0] = GL_SRC_COLOR;
+ texUnit->CombineOperandRGB[1] = GL_SRC_COLOR;
+ texUnit->CombineOperandRGB[2] = GL_SRC_ALPHA;
+ texUnit->CombineOperandA[0] = GL_SRC_ALPHA;
+ texUnit->CombineOperandA[1] = GL_SRC_ALPHA;
+ texUnit->CombineOperandA[2] = GL_SRC_ALPHA;
+ texUnit->CombineScaleShiftRGB = 0;
+ texUnit->CombineScaleShiftA = 0;
+
ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 );
texUnit->TexGenEnabled = 0;
texUnit->GenModeS = GL_EYE_LINEAR;
texUnit->GenModeT = GL_EYE_LINEAR;
texUnit->GenModeR = GL_EYE_LINEAR;
texUnit->GenModeQ = GL_EYE_LINEAR;
+ texUnit->GenBitS = TEXGEN_EYE_LINEAR;
+ texUnit->GenBitT = TEXGEN_EYE_LINEAR;
+ texUnit->GenBitR = TEXGEN_EYE_LINEAR;
+ texUnit->GenBitQ = TEXGEN_EYE_LINEAR;
+
/* Yes, these plane coefficients are correct! */
ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 );
ASSIGN_4V( texUnit->ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 );
@@ -762,10 +784,11 @@ init_attrib_groups( GLcontext *ctx )
}
/* Texture matrix */
- for (i=0; i<MAX_TEXTURE_UNITS; i++) {
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
gl_matrix_ctr( &ctx->TextureMatrix[i] );
ctx->TextureStackDepth[i] = 0;
for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) {
+ gl_matrix_ctr( &ctx->TextureStack[i][j] );
ctx->TextureStack[i][j].inv = 0;
}
}
@@ -987,6 +1010,11 @@ init_attrib_groups( GLcontext *ctx )
ctx->ShineTable[i]->refcount++;
}
+ gl_compute_shine_table( ctx, 0, ctx->Light.Material[0].Shininess );
+ gl_compute_shine_table( ctx, 2, ctx->Light.Material[0].Shininess * .5 );
+ gl_compute_shine_table( ctx, 1, ctx->Light.Material[1].Shininess );
+ gl_compute_shine_table( ctx, 3, ctx->Light.Material[1].Shininess * .5 );
+
/* Line group */
ctx->Line.SmoothFlag = GL_FALSE;
@@ -1049,6 +1077,10 @@ init_attrib_groups( GLcontext *ctx )
ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0);
ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0);
ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(ctx->Pixel.PCCTscale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.PCCTbias, 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(ctx->Pixel.PCMCTscale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.PCMCTbias, 0.0, 0.0, 0.0, 0.0);
ctx->Pixel.ColorTableEnabled = GL_FALSE;
ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE;
ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE;
@@ -1066,6 +1098,7 @@ init_attrib_groups( GLcontext *ctx )
/* Point group */
ctx->Point.SmoothFlag = GL_FALSE;
+ ctx->Point.UserSize = 1.0;
ctx->Point.Size = 1.0;
ctx->Point.Params[0] = 1.0;
ctx->Point.Params[1] = 0.0;
@@ -1342,7 +1375,8 @@ alloc_proxy_textures( GLcontext *ctx )
/*
- * Initialize a GLcontext struct.
+ * Initialize a GLcontext struct. This includes allocating all the
+ * other structs and arrays which hang off of the context by pointers.
*/
GLboolean
_mesa_initialize_context( GLcontext *ctx,
@@ -1365,15 +1399,13 @@ _mesa_initialize_context( GLcontext *ctx,
ctx->VB = gl_vb_create_for_immediate( ctx );
if (!ctx->VB) {
- FREE( ctx );
return GL_FALSE;
}
ctx->input = ctx->VB->IM;
ctx->PB = gl_alloc_pb();
if (!ctx->PB) {
- FREE( ctx->VB );
- FREE( ctx );
+ ALIGN_FREE( ctx->VB );
return GL_FALSE;
}
@@ -1385,9 +1417,8 @@ _mesa_initialize_context( GLcontext *ctx,
/* allocate new group of display lists */
ctx->Shared = alloc_shared_state();
if (!ctx->Shared) {
- FREE(ctx->VB);
- FREE(ctx->PB);
- FREE(ctx);
+ ALIGN_FREE( ctx->VB );
+ FREE( ctx->PB );
return GL_FALSE;
}
}
@@ -1417,9 +1448,8 @@ _mesa_initialize_context( GLcontext *ctx,
if (!alloc_proxy_textures(ctx)) {
free_shared_state(ctx, ctx->Shared);
- FREE(ctx->VB);
- FREE(ctx->PB);
- FREE(ctx);
+ ALIGN_FREE( ctx->VB );
+ FREE( ctx->PB );
return GL_FALSE;
}
@@ -1446,11 +1476,10 @@ _mesa_initialize_context( GLcontext *ctx,
ctx->Save = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*));
if (!ctx->Exec || !ctx->Save) {
free_shared_state(ctx, ctx->Shared);
- FREE(ctx->VB);
- FREE(ctx->PB);
+ ALIGN_FREE( ctx->VB );
+ FREE( ctx->PB );
if (ctx->Exec)
- FREE(ctx->Exec);
- FREE(ctx);
+ FREE( ctx->Exec );
}
_mesa_init_exec_table(ctx->Exec, dispatchSize);
_mesa_init_dlist_table(ctx->Save, dispatchSize);
@@ -1593,7 +1622,7 @@ gl_free_context_data( GLcontext *ctx )
/* Free cache of immediate buffers. */
while (ctx->nr_im_queued-- > 0) {
struct immediate * next = ctx->freed_im_queue->next;
- FREE( ctx->freed_im_queue );
+ ALIGN_FREE( ctx->freed_im_queue );
ctx->freed_im_queue = next;
}
gl_extensions_dtr(ctx);
@@ -1896,57 +1925,63 @@ void gl_compile_error( GLcontext *ctx, GLenum error, const char *s )
* of the current error value. If Mesa is compiled with -DDEBUG or if the
* environment variable "MESA_DEBUG" is defined then a real error message
* is printed to stderr.
- * Input: error - the error value
- * s - a diagnostic string
+ * Input: ctx - the GL context
+ * error - the error value
+ * where - usually the name of function where error was detected
*/
-void gl_error( GLcontext *ctx, GLenum error, const char *s )
+void
+gl_error( GLcontext *ctx, GLenum error, const char *where )
{
+ const char *debugEnv = getenv("MESA_DEBUG");
GLboolean debug;
#ifdef DEBUG
- debug = GL_TRUE;
+ if (debugEnv && strstr(debugEnv, "silent"))
+ debug = GL_FALSE;
+ else
+ debug = GL_TRUE;
#else
- if (getenv("MESA_DEBUG")) {
+ if (debugEnv)
debug = GL_TRUE;
- }
- else {
+ else
debug = GL_FALSE;
- }
#endif
if (debug) {
- char errstr[1000];
-
+ const char *errstr;
switch (error) {
case GL_NO_ERROR:
- strcpy( errstr, "GL_NO_ERROR" );
+ errstr = "GL_NO_ERROR";
break;
case GL_INVALID_VALUE:
- strcpy( errstr, "GL_INVALID_VALUE" );
+ errstr = "GL_INVALID_VALUE";
break;
case GL_INVALID_ENUM:
- strcpy( errstr, "GL_INVALID_ENUM" );
+ errstr = "GL_INVALID_ENUM";
break;
case GL_INVALID_OPERATION:
- strcpy( errstr, "GL_INVALID_OPERATION" );
+ errstr = "GL_INVALID_OPERATION";
break;
case GL_STACK_OVERFLOW:
- strcpy( errstr, "GL_STACK_OVERFLOW" );
+ errstr = "GL_STACK_OVERFLOW";
break;
case GL_STACK_UNDERFLOW:
- strcpy( errstr, "GL_STACK_UNDERFLOW" );
+ errstr = "GL_STACK_UNDERFLOW";
break;
case GL_OUT_OF_MEMORY:
- strcpy( errstr, "GL_OUT_OF_MEMORY" );
+ errstr = "GL_OUT_OF_MEMORY";
break;
+ case GL_TABLE_TOO_LARGE:
+ errstr = "GL_TABLE_TOO_LARGE";
+ break;
default:
- strcpy( errstr, "unknown" );
+ errstr = "unknown";
break;
}
- fprintf( stderr, "Mesa user error: %s in %s\n", errstr, s );
+ fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where);
}
- if (ctx->ErrorValue==GL_NO_ERROR) {
+ if (ctx->ErrorValue == GL_NO_ERROR) {
ctx->ErrorValue = error;
}
diff --git a/xc/extras/Mesa/src/copypix.c b/xc/extras/Mesa/src/copypix.c
index e76c170f6..8b40a8711 100644
--- a/xc/extras/Mesa/src/copypix.c
+++ b/xc/extras/Mesa/src/copypix.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/copypix.c,v 1.6 2000/09/26 15:56:30 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -166,6 +166,7 @@ static void copy_rgba_pixels( GLcontext *ctx,
ctx->Pixel.ScaleOrBiasRGBApcm ||
ctx->Pixel.ColorTableEnabled ||
ctx->Pixel.PostColorMatrixColorTableEnabled ||
+ ctx->Pixel.PostConvolutionColorTableEnabled ||
ctx->Pixel.MinMaxEnabled ||
ctx->Pixel.HistogramEnabled;
@@ -224,6 +225,11 @@ static void copy_rgba_pixels( GLcontext *ctx,
if (ctx->Pixel.ColorTableEnabled) {
_mesa_lookup_rgba(&ctx->ColorTable, width, rgbaFloat);
}
+ /* XXX convolution here */
+ /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
+ if (ctx->Pixel.PostConvolutionColorTableEnabled) {
+ _mesa_lookup_rgba(&ctx->PostConvolutionColorTable, width, rgbaFloat);
+ }
/* color matrix */
if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
ctx->Pixel.ScaleOrBiasRGBApcm) {
@@ -256,12 +262,17 @@ static void copy_rgba_pixels( GLcontext *ctx,
if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) {
GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH];
+ GLubyte primary_rgba[MAX_WIDTH][4];
GLuint unit;
/* XXX not sure how multitexture is supposed to work here */
+
+ MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLubyte));
+
for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) {
_mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba,
s, t, r, q);
- gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba);
+ gl_texture_pixels(ctx, unit, width, s, t, r, NULL,
+ primary_rgba, rgba);
}
}
diff --git a/xc/extras/Mesa/src/dd.h b/xc/extras/Mesa/src/dd.h
index ad389df4a..90ff664ed 100644
--- a/xc/extras/Mesa/src/dd.h
+++ b/xc/extras/Mesa/src/dd.h
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/dd.h,v 1.7 2000/09/26 15:56:30 tsi Exp $ */
#ifndef DD_INCLUDED
@@ -641,17 +641,20 @@ struct dd_function_table {
*/
GLboolean (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
- GLint level, const GLvoid *data,
+ GLint level, GLsizei imageSize,
+ const GLvoid *data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLboolean *retainInternalCopy);
GLboolean (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
- GLint level, const GLvoid *data,
+ GLint level, GLsizei imageSize,
+ const GLvoid *data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLboolean *retainInternalCopy);
GLboolean (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
- GLint level, const GLvoid *data,
+ GLint level, GLsizei imageSize,
+ const GLvoid *data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLboolean *retainInternalCopy);
@@ -699,6 +702,42 @@ struct dd_function_table {
* should do the job.
*/
+ GLint (*BaseCompressedTexFormat)(GLcontext *ctx,
+ GLint internalFormat);
+ /* Called to compute the base format for a specific compressed
+ * format. Return -1 if the internalFormat is not a specific
+ * compressed format that the driver recognizes. Note the
+ * return value differences between this function and
+ * SpecificCompressedTexFormat below.
+ */
+
+ GLint (*SpecificCompressedTexFormat)(GLcontext *ctx,
+ GLint internalFormat,
+ GLint numDimensions);
+ /* Called to turn a generic texture format into a specific
+ * texture format. For example, if a driver implements
+ * GL_3DFX_texture_compression_FXT1, this would map
+ * GL_COMPRESSED_RGBA_ARB to GL_COMPRESSED_RGBA_FXT1_3DFX.
+ *
+ * If the driver does not know how to handle the compressed
+ * format, then just return the generic format, and Mesa will
+ * do the right thing with it.
+ */
+
+ GLboolean (*IsCompressedFormat)(GLcontext *ctx, GLint internalFormat);
+ /* Called to tell if a format is a compressed format.
+ */
+
+ GLsizei (*CompressedImageSize)(GLcontext *ctx,
+ GLenum internalFormat,
+ GLuint numDimensions,
+ GLuint width,
+ GLuint height,
+ GLuint depth);
+ /* Calculate the size of a compressed image, given the image's
+ * format and dimensions.
+ */
+
void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
GLint lod, void *image,
const struct gl_texture_object *texObj,
@@ -759,7 +798,7 @@ struct dd_function_table {
/***
- *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions:
+ *** Accelerated point, line, polygon, quad and rect functions:
***/
points_func PointsFunc;
@@ -906,6 +945,16 @@ struct dd_function_table {
void (*StencilMask)(GLcontext *ctx, GLuint mask);
void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+
+ /* State-query functions
+ *
+ * Return GL_TRUE if query was completed, GL_FALSE otherwise.
+ */
+ GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
+ GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
+ GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
+ GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
+ GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
};
diff --git a/xc/extras/Mesa/src/debug_xform.c b/xc/extras/Mesa/src/debug_xform.c
index 28d1b9625..5926ba191 100644
--- a/xc/extras/Mesa/src/debug_xform.c
+++ b/xc/extras/Mesa/src/debug_xform.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/debug_xform.c,v 1.5 2000/09/26 15:56:30 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -30,6 +30,7 @@
#include "glheader.h"
#include "context.h"
#include "types.h"
+#include "mem.h"
#include "xform.h"
#include "debug_xform.h"
#endif
@@ -234,7 +235,7 @@ static int test_transform_function( transform_func fn, int psize, int mtype,
GLvector4f source[1], dest[1], ref[1];
GLmatrix mat[1];
GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4];
- GLfloat *m = mat->m;
+ GLfloat *m;
GLubyte mask[TEST_COUNT];
int i, j;
#ifdef RUN_XFORM_BENCHMARK
@@ -248,8 +249,11 @@ static int test_transform_function( transform_func fn, int psize, int mtype,
return 0;
}
+ mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
mat->type = mtypes[mtype];
+ m = mat->m;
+
m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0;
m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0;
m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0;
@@ -311,19 +315,19 @@ static int test_transform_function( transform_func fn, int psize, int mtype,
if (mesa_profile) {
if (masked) {
BEGIN_RACE (*cycles);
- fn(dest, mat, source, mask, 1);
+ fn(dest, mat->m, source, mask, 1);
END_RACE (*cycles);
} else {
BEGIN_RACE (*cycles);
- fn(dest, mat, source, NULL, 0);
+ fn(dest, mat->m, source, NULL, 0);
END_RACE (*cycles);
}
}
else {
if (masked) {
- fn(dest, mat, source, mask, 1);
+ fn(dest, mat->m, source, mask, 1);
} else {
- fn(dest, mat, source, NULL, 0);
+ fn(dest, mat->m, source, NULL, 0);
}
}
@@ -351,6 +355,8 @@ static int test_transform_function( transform_func fn, int psize, int mtype,
}
}
}
+
+ ALIGN_FREE( mat->m );
return 1;
}
@@ -583,7 +589,7 @@ static int test_norm_function( normal_func fn, int mtype,
GLfloat s [TEST_COUNT][5], d [TEST_COUNT][3], r [TEST_COUNT][3];
GLfloat d2 [TEST_COUNT][3], r2 [TEST_COUNT][3], length [TEST_COUNT];
GLfloat scale;
- GLfloat *m = mat->m;
+ GLfloat *m;
GLubyte mask[TEST_COUNT];
int i, j;
#ifdef RUN_XFORM_BENCHMARK
@@ -592,7 +598,8 @@ static int test_norm_function( normal_func fn, int mtype,
(void) cycles;
- mat->inv = mat->m;
+ mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
+ mat->inv = m = mat->m;
m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0;
m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0;
@@ -728,6 +735,8 @@ static int test_norm_function( normal_func fn, int mtype,
}
}
}
+
+ ALIGN_FREE( mat->m );
return 1;
}
diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c
index e56593887..5c26ba403 100644
--- a/xc/extras/Mesa/src/dlist.c
+++ b/xc/extras/Mesa/src/dlist.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/dlist.c,v 1.7 2000/09/26 15:56:30 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -4055,7 +4055,7 @@ static void execute_list( GLcontext *ctx, GLuint list )
break;
case OPCODE_VERTEX_CASSETTE: {
struct immediate *IM;
-
+
if (ctx->NewState)
gl_update_state(ctx);
if (ctx->CompileCVAFlag) {
@@ -4515,6 +4515,7 @@ static void execute_list( GLcontext *ctx, GLuint list )
break;
case OPCODE_RECTF:
(*ctx->Exec->Rectf)( n[1].f, n[2].f, n[3].f, n[4].f );
+ FLUSH_VB( ctx, "dlist rectf" );
break;
case OPCODE_RESET_HISTOGRAM:
(*ctx->Exec->ResetHistogram)( n[1].e );
@@ -4968,8 +4969,6 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
ctx->CurrentDispatch = ctx->Save;
_glapi_set_dispatch( ctx->CurrentDispatch );
}
-
-/* RESET_IMMEDIATE( ctx ); */
}
diff --git a/xc/extras/Mesa/src/drawpix.c b/xc/extras/Mesa/src/drawpix.c
index 7fb93abcc..ecb1b22af 100644
--- a/xc/extras/Mesa/src/drawpix.c
+++ b/xc/extras/Mesa/src/drawpix.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/drawpix.c,v 1.6 2000/09/26 15:56:31 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -121,6 +121,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
&& ctx->ColorMatrix.type == MATRIX_IDENTITY
&& !ctx->Pixel.ColorTableEnabled
&& !ctx->Pixel.PostColorMatrixColorTableEnabled
+ && !ctx->Pixel.PostConvolutionColorTableEnabled
&& !ctx->Pixel.MinMaxEnabled
&& !ctx->Pixel.HistogramEnabled
&& ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0
@@ -138,7 +139,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
GLint skipRows = unpack->SkipRows;
GLint rowLength;
GLdepth zSpan[MAX_WIDTH]; /* only used when zooming */
- GLint zoomY0;
+ GLint zoomY0 = 0;
if (unpack->RowLength > 0)
rowLength = unpack->RowLength;
@@ -171,14 +172,36 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
drawHeight -= (destY + drawHeight - ctx->DrawBuffer->Ymax - 1);
if (drawHeight <= 0)
return GL_TRUE;
+ }
+ else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) {
+ /* upside-down image */
+ /* horizontal clipping */
+ if (destX < ctx->DrawBuffer->Xmin) {
+ skipPixels += (ctx->DrawBuffer->Xmin - destX);
+ drawWidth -= (ctx->DrawBuffer->Xmin - destX);
+ destX = ctx->DrawBuffer->Xmin;
+ }
+ if (destX + drawWidth > ctx->DrawBuffer->Xmax)
+ drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax - 1);
+ if (drawWidth <= 0)
+ return GL_TRUE;
- zoomY0 = 0; /* not used - silence compiler warning */
+ /* vertical clipping */
+ if (destY > ctx->DrawBuffer->Ymax) {
+ skipRows += (destY - ctx->DrawBuffer->Ymax - 1);
+ drawHeight -= (destY - ctx->DrawBuffer->Ymax - 1);
+ destY = ctx->DrawBuffer->Ymax + 1;
+ }
+ if (destY - drawHeight < ctx->DrawBuffer->Ymin)
+ drawHeight -= (ctx->DrawBuffer->Ymin - (destY - drawHeight));
+ if (drawHeight <= 0)
+ return GL_TRUE;
}
else {
/* setup array of fragment Z value to pass to zoom function */
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF);
GLint i;
- assert(drawWidth < MAX_WIDTH);
+ ASSERT(drawWidth < MAX_WIDTH);
for (i=0; i<drawWidth; i++)
zSpan[i] = z;
@@ -209,6 +232,16 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
destY++;
}
}
+ else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) {
+ /* upside-down */
+ GLint row;
+ for (row=0; row<drawHeight; row++) {
+ destY--;
+ (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (void *) src, NULL);
+ src += rowLength * 4;
+ }
+ }
else {
/* with zooming */
GLint row;
@@ -235,6 +268,16 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
destY++;
}
}
+ else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) {
+ /* upside-down */
+ GLint row;
+ for (row=0; row<drawHeight; row++) {
+ destY--;
+ (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (void *) src, NULL);
+ src += rowLength * 3;
+ }
+ }
else {
/* with zooming */
GLint row;
@@ -255,7 +298,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
GLint row;
- assert(drawWidth < MAX_WIDTH);
+ ASSERT(drawWidth < MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLint i;
for (i=0;i<drawWidth;i++) {
@@ -269,10 +312,27 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
destY++;
}
}
+ else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) {
+ /* upside-down */
+ GLint row;
+ ASSERT(drawWidth < MAX_WIDTH);
+ for (row=0; row<drawHeight; row++) {
+ GLint i;
+ for (i=0;i<drawWidth;i++) {
+ rgb[i][0] = src[i];
+ rgb[i][1] = src[i];
+ rgb[i][2] = src[i];
+ }
+ destY--;
+ (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (void *) rgb, NULL);
+ src += rowLength;
+ }
+ }
else {
/* with zooming */
GLint row;
- assert(drawWidth < MAX_WIDTH);
+ ASSERT(drawWidth < MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLint i;
for (i=0;i<drawWidth;i++) {
@@ -296,7 +356,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
GLint row;
- assert(drawWidth < MAX_WIDTH);
+ ASSERT(drawWidth < MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLint i;
GLubyte *ptr = src;
@@ -312,10 +372,29 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
destY++;
}
}
+ else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) {
+ /* upside-down */
+ GLint row;
+ ASSERT(drawWidth < MAX_WIDTH);
+ for (row=0; row<drawHeight; row++) {
+ GLint i;
+ GLubyte *ptr = src;
+ for (i=0;i<drawWidth;i++) {
+ rgba[i][0] = *ptr;
+ rgba[i][1] = *ptr;
+ rgba[i][2] = *ptr++;
+ rgba[i][3] = *ptr++;
+ }
+ destY--;
+ (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (void *) rgba, NULL);
+ src += rowLength*2;
+ }
+ }
else {
/* with zooming */
GLint row;
- assert(drawWidth < MAX_WIDTH);
+ ASSERT(drawWidth < MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLubyte *ptr = src;
GLint i;
@@ -342,7 +421,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
/* no zooming */
GLint row;
for (row=0; row<drawHeight; row++) {
- assert(drawWidth < MAX_WIDTH);
+ ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
(*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(const GLubyte (*)[4])rgba,
@@ -352,11 +431,25 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
}
return GL_TRUE;
}
+ else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) {
+ /* upside-down */
+ GLint row;
+ for (row=0; row<drawHeight; row++) {
+ ASSERT(drawWidth < MAX_WIDTH);
+ _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
+ destY--;
+ (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (const GLubyte (*)[4])rgba,
+ NULL);
+ src += rowLength;
+ }
+ return GL_TRUE;
+ }
else {
/* with zooming */
GLint row;
for (row=0; row<drawHeight; row++) {
- assert(drawWidth < MAX_WIDTH);
+ ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY,
zSpan, (void *) rgba, zoomY0);
@@ -511,11 +604,11 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
GLuint ispan[MAX_WIDTH];
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
- if (type != GL_UNSIGNED_BYTE
+ if (type != GL_BYTE
&& type != GL_UNSIGNED_BYTE
+ && type != GL_SHORT
&& type != GL_UNSIGNED_SHORT
- && type != GL_UNSIGNED_SHORT
- && type != GL_UNSIGNED_INT
+ && type != GL_INT
&& type != GL_UNSIGNED_INT
&& type != GL_FLOAT) {
gl_error(ctx, GL_INVALID_ENUM, "glDrawPixels(type)");
@@ -652,17 +745,23 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
pixels, width, height, format, type, 0, row, 0);
_mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba,
format, type, source, unpack, GL_TRUE);
- if (ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink)
+ if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) ||
+ (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink))
continue;
if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) {
GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH];
+ GLubyte primary_rgba[MAX_WIDTH][4];
GLuint unit;
/* XXX not sure how multitexture is supposed to work here */
+
+ MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLubyte));
+
for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) {
_mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba,
s, t, r, q);
- gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba);
+ gl_texture_pixels(ctx, unit, width, s, t, r, NULL,
+ primary_rgba, rgba);
}
}
diff --git a/xc/extras/Mesa/src/enums.c b/xc/extras/Mesa/src/enums.c
index a9daa3569..2de4ef06e 100644
--- a/xc/extras/Mesa/src/enums.c
+++ b/xc/extras/Mesa/src/enums.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/enums.c,v 1.6 2000/09/26 15:56:31 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -804,7 +804,30 @@ enum_elt all_enums[] =
{ "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", 0x81A9},
/* GL_EXT_clip_volume_hint */
- { "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0}
+ { "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0},
+
+ /* GL_EXT_texture_env_combine */
+ { "GL_COMBINE_EXT", 0x8570 },
+ { "GL_COMBINE_RGB_EXT", 0x8571 },
+ { "GL_COMBINE_ALPHA_EXT", 0x8572 },
+ { "GL_SOURCE0_RGB_EXT", 0x8580 },
+ { "GL_SOURCE1_RGB_EXT", 0x8581 },
+ { "GL_SOURCE2_RGB_EXT", 0x8582 },
+ { "GL_SOURCE0_ALPHA_EXT", 0x8588 },
+ { "GL_SOURCE1_ALPHA_EXT", 0x8589 },
+ { "GL_SOURCE2_ALPHA_EXT", 0x858A },
+ { "GL_OPERAND0_RGB_EXT", 0x8590 },
+ { "GL_OPERAND1_RGB_EXT", 0x8591 },
+ { "GL_OPERAND2_RGB_EXT", 0x8592 },
+ { "GL_OPERAND0_ALPHA_EXT", 0x8598 },
+ { "GL_OPERAND1_ALPHA_EXT", 0x8599 },
+ { "GL_OPERAND2_ALPHA_EXT", 0x859A },
+ { "GL_RGB_SCALE_EXT", 0x8573 },
+ { "GL_ADD_SIGNED_EXT", 0x8574 },
+ { "GL_INTERPOLATE_EXT", 0x8575 },
+ { "GL_CONSTANT_EXT", 0x8576 },
+ { "GL_PRIMARY_COLOR_EXT", 0x8577 },
+ { "GL_PREVIOUS_EXT", 0x8578 }
};
diff --git a/xc/extras/Mesa/src/eval.c b/xc/extras/Mesa/src/eval.c
index 2b9d8e8e9..2c29dcc27 100644
--- a/xc/extras/Mesa/src/eval.c
+++ b/xc/extras/Mesa/src/eval.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/eval.c,v 1.5 2000/09/26 15:56:31 tsi Exp $ */
/*
* eval.c was written by
@@ -2452,7 +2452,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
if (ctx->Eval.Map1Color4 && any_eval1)
VB->ColorPtr = eval1_color( out_color, coord, flags, IM->Start,
- &ctx->EvalMap.Map1Color4 );
+ &ctx->EvalMap.Map1Color4 );
if (ctx->Eval.Map2Color4 && any_eval2)
VB->ColorPtr = eval2_color( out_color, coord, flags, IM->Start,
@@ -2481,8 +2481,9 @@ void gl_eval_vb( struct vertex_buffer *VB )
VB->NormalPtr = eval2_norm( out_normal, coord, flags, IM->Start,
&ctx->EvalMap.Map2Normal );
+ new_flags |= VERT_NORM;
+
if (VB->NormalPtr != in_normal) {
- new_flags |= VERT_NORM;
if (!all_eval)
VB->NormalPtr = copy_3f( out_normal, in_normal, flags, IM->Start );
}
@@ -2550,26 +2551,42 @@ void gl_eval_vb( struct vertex_buffer *VB )
}
if (any_eval2) {
+ GLvector3f *in_normal = VB->NormalPtr;
+ GLvector3f *out_normal = &IM->v.Normal;
+
if (ctx->Eval.Map2Vertex4)
{
- if (ctx->Eval.AutoNormal && (req & VERT_NORM))
- obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, IM->Start,
- 4, &ctx->EvalMap.Map2Vertex4 );
+ if (ctx->Eval.AutoNormal && (req & VERT_NORM)) {
+ obj = eval2_obj_norm( out, out_normal, coord, flags,
+ IM->Start, 4, &ctx->EvalMap.Map2Vertex4 );
+ VB->NormalPtr = out_normal;
+ new_flags |= VERT_NORM;
+ }
else
obj = eval2_4f( out, coord, flags, IM->Start,
- 4, &ctx->EvalMap.Map2Vertex4);
+ 4, &ctx->EvalMap.Map2Vertex4 );
}
else if (ctx->Eval.Map2Vertex3)
{
- if (ctx->Eval.AutoNormal && (req & VERT_NORM))
- obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, IM->Start,
- 3, &ctx->EvalMap.Map2Vertex3 );
+ if (ctx->Eval.AutoNormal && (req & VERT_NORM)) {
+ obj = eval2_obj_norm( out, out_normal, coord, flags,
+ IM->Start, 3, &ctx->EvalMap.Map2Vertex3 );
+ VB->NormalPtr = out_normal;
+ new_flags |= VERT_NORM;
+ }
else
obj = eval2_4f( out, coord, flags, IM->Start,
3, &ctx->EvalMap.Map2Vertex3 );
}
- }
+
+ if (VB->NormalPtr != in_normal) {
+ if (!all_eval)
+ VB->NormalPtr = copy_3f( out_normal, in_normal, flags,
+ IM->Start );
+ }
+ }
+
if (obj != in && !all_eval)
obj = copy_4f( out, in, flags, IM->Start );
@@ -2581,6 +2598,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
GLuint *flags = VB->Flag = VB->EvaluatedFlags;
GLuint i;
GLuint count = VB->Count;
+ GLuint andflag = VB->IM->AndFlag;
if (!flags) {
VB->EvaluatedFlags = (GLuint *) MALLOC(VB->Size * sizeof(GLuint));
@@ -2588,16 +2606,21 @@ void gl_eval_vb( struct vertex_buffer *VB )
}
if (all_eval) {
- for (i = 0 ; i < count ; i++)
+ for (i = 0 ; i <= count ; i++)
flags[i] = oldflags[i] | new_flags;
+ andflag |= new_flags;
} else {
- GLuint andflag = ~0;
- for (i = 0 ; i < count ; i++) {
- if (oldflags[i] & VERT_EVAL_ANY)
- flags[i] = oldflags[i] | new_flags;
+ andflag = ~0;
+ for (i = 0 ; i <= count ; i++) {
+ flags[i] = oldflags[i];
+ if (flags[i] & VERT_EVAL_ANY)
+ flags[i] |= new_flags;
andflag &= flags[i];
}
}
+
+ VB->OrFlag |= new_flags;
+ VB->CullMode = (GLubyte) ((andflag & VERT_NORM) ? 0 : COMPACTED_NORMALS);
}
}
diff --git a/xc/extras/Mesa/src/extensions.c b/xc/extras/Mesa/src/extensions.c
index d242b2a7d..a9522bbd8 100644
--- a/xc/extras/Mesa/src/extensions.c
+++ b/xc/extras/Mesa/src/extensions.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/extensions.c,v 1.7 2000/09/26 15:56:31 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -50,7 +50,7 @@ struct extension {
static struct { int enabled; const char *name; } default_extensions[] = {
{ DEFAULT_OFF, "GL_ARB_imaging" }, /* in progress */
{ DEFAULT_ON, "GL_ARB_multitexture" },
- { DEFAULT_OFF, "GL_ARB_texture_compression" }, /* in progress */
+ { DEFAULT_OFF, "GL_ARB_texture_compression" },
{ DEFAULT_OFF, "GL_ARB_texture_cube_map" }, /* in progress */
{ ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
{ ALWAYS_ENABLED, "GL_EXT_abgr" },
@@ -74,6 +74,7 @@ static struct { int enabled; const char *name; } default_extensions[] = {
{ DEFAULT_OFF, "GL_EXT_texture_compression_s3tc" },
{ DEFAULT_OFF, "GL_EXT_texture_env" },
{ DEFAULT_ON, "GL_EXT_texture_env_add" },
+ { DEFAULT_OFF, "GL_EXT_texture_env_combine" },
{ ALWAYS_ENABLED, "GL_EXT_texture_object" },
{ DEFAULT_ON, "GL_EXT_texture_lod_bias" },
{ ALWAYS_ENABLED, "GL_EXT_vertex_array" },
@@ -102,6 +103,7 @@ update_extension_flags( GLcontext *ctx )
{
/* Update flags */
ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add");
+ ctx->Extensions.HaveTextureEnvCombine = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_combine");
ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias");
ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test");
ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map");
diff --git a/xc/extras/Mesa/src/fog.c b/xc/extras/Mesa/src/fog.c
index c3d023727..e98e67644 100644
--- a/xc/extras/Mesa/src/fog.c
+++ b/xc/extras/Mesa/src/fog.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/fog.c,v 1.7 2000/08/23 22:10:00 tsi Exp $ */
+/* $XFree86: xc/extras/Mesa/src/fog.c,v 1.8 2000/09/24 13:50:10 alanh Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -426,4 +426,3 @@ _mesa_fog_ci_pixels( const GLcontext *ctx,
return;
}
}
-
diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c
index 21b5b639a..a12e6be24 100644
--- a/xc/extras/Mesa/src/get.c
+++ b/xc/extras/Mesa/src/get.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/get.c,v 1.7 2000/09/26 15:56:31 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -91,9 +91,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetBooleanv");
+ if (!params)
+ return;
+
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetBooleanv %s\n", gl_lookup_enum_by_nr(pname));
+ if (ctx->Driver.GetBooleanv
+ && (*ctx->Driver.GetBooleanv)(ctx, pname, params))
+ return;
+
switch (pname) {
case GL_ACCUM_RED_BITS:
*params = INT_TO_BOOL(ctx->Visual->AccumRedBits);
@@ -1234,9 +1241,15 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetDoublev");
+ if (!params)
+ return;
+
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetDoublev %s\n", gl_lookup_enum_by_nr(pname));
+ if (ctx->Driver.GetDoublev && (*ctx->Driver.GetDoublev)(ctx, pname, params))
+ return;
+
switch (pname) {
case GL_ACCUM_RED_BITS:
*params = (GLdouble) ctx->Visual->AccumRedBits;
@@ -2377,9 +2390,15 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetFloatv");
+ if (!params)
+ return;
+
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetFloatv %s\n", gl_lookup_enum_by_nr(pname));
+ if (ctx->Driver.GetFloatv && (*ctx->Driver.GetFloatv)(ctx, pname, params))
+ return;
+
switch (pname) {
case GL_ACCUM_RED_BITS:
*params = (GLfloat) ctx->Visual->AccumRedBits;
@@ -3491,9 +3510,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetIntegerv");
+ if (!params)
+ return;
+
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetIntegerv %s\n", gl_lookup_enum_by_nr(pname));
+ if (ctx->Driver.GetIntegerv
+ && (*ctx->Driver.GetIntegerv)(ctx, pname, params))
+ return;
+
switch (pname) {
case GL_ACCUM_RED_BITS:
*params = (GLint) ctx->Visual->AccumRedBits;
@@ -4628,11 +4654,19 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint texUnit = ctx->Texture.CurrentUnit;
- /*GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;*/
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetPointerv");
+
+ if (!params)
+ return;
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetPointerv %s\n", gl_lookup_enum_by_nr(pname));
+ if (ctx->Driver.GetPointerv
+ && (*ctx->Driver.GetPointerv)(ctx, pname, params))
+ return;
+
switch (pname) {
case GL_VERTEX_ARRAY_POINTER:
*params = ctx->Array.Vertex.Ptr;
@@ -4670,9 +4704,9 @@ const GLubyte *
_mesa_GetString( GLenum name )
{
GET_CURRENT_CONTEXT(ctx);
- static char *vendor = "Brian Paul";
- static char *renderer = "Mesa";
- static char *version = "1.2 Mesa 3.3 beta";
+ static const char *vendor = "Brian Paul";
+ static const char *renderer = "Mesa";
+ static const char *version = "1.2 Mesa 3.4";
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0);
diff --git a/xc/extras/Mesa/src/glapinoop.c b/xc/extras/Mesa/src/glapinoop.c
index 94d4a11f1..43a68c773 100644
--- a/xc/extras/Mesa/src/glapinoop.c
+++ b/xc/extras/Mesa/src/glapinoop.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/glapinoop.c,v 1.9 2000/09/26 15:56:31 tsi Exp $ */
/*
* This is part of the reusable GL dispather, see glapi.c for details.
@@ -690,7 +690,16 @@ void *__glapi_noop_table[] = {
(void *) NoOpGetColorTableEXT,
(void *) NoOpGetColorTableParameterivEXT,
(void *) NoOpGetColorTableParameterfvEXT,
-
+ /* GL_3DFX_tbuffer */
+ (void *) NoOpTbufferMask3DFX,
+ /* GL_ARB_texture_compression */
+ (void *) NoOpCompressedTexImage3DARB,
+ (void *) NoOpCompressedTexImage2DARB,
+ (void *) NoOpCompressedTexImage1DARB,
+ (void *) NoOpCompressedTexSubImage3DARB,
+ (void *) NoOpCompressedTexSubImage2DARB,
+ (void *) NoOpCompressedTexSubImage1DARB,
+ (void *) NoOpGetCompressedTexImageARB,
/* A whole bunch of no-op functions. These might be called
* when someone tries to call a dynamically-registered extension
* function without a current rendering context.
diff --git a/xc/extras/Mesa/src/glheader.h b/xc/extras/Mesa/src/glheader.h
index 8276f518a..705c25c74 100644
--- a/xc/extras/Mesa/src/glheader.h
+++ b/xc/extras/Mesa/src/glheader.h
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/glheader.h,v 1.8 2000/08/11 17:01:49 dawes Exp $ */
+/* $XFree86: xc/extras/Mesa/src/glheader.h,v 1.11 2000/10/26 17:57:48 dawes Exp $ */
#ifndef GLHEADER_H
@@ -47,7 +47,12 @@
#else
#include <assert.h>
#include <ctype.h>
+/* If we can use Compaq's Fast Math Library on Alpha */
+#if defined(__alpha__) && defined(CCPML)
+#include <cpml.h>
+#else
#include <math.h>
+#endif
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
@@ -139,7 +144,12 @@ typedef void *HDC;
typedef unsigned long COLORREF;
#endif
-#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
+
+/* Make sure we include glext.h from gl.h */
+#define GL_GLEXT_PROTOTYPES
+
+
+#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
# define WGL_FONT_LINES 0
# define WGL_FONT_POLYGONS 1
#ifndef _GNU_H_WINDOWS32_FUNCTIONS
@@ -154,14 +164,14 @@ typedef unsigned long COLORREF;
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
+#if 0
#include <gl/mesa_wgl.h>
#endif
+#endif
-/* Make sure we include glext.h */
-#define GL_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "GL/glext.h"
diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c
index 825ce7ed5..f1781326d 100644
--- a/xc/extras/Mesa/src/image.c
+++ b/xc/extras/Mesa/src/image.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/image.c,v 1.7 2000/09/26 15:56:32 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -329,6 +329,7 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type )
case GL_GREEN:
case GL_BLUE:
case GL_ALPHA:
+ case GL_INTENSITY:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
case GL_DEPTH_COMPONENT:
@@ -617,6 +618,7 @@ _mesa_pack_rgba_span( GLcontext *ctx,
ctx->Pixel.ScaleOrBiasRGBApcm ||
ctx->Pixel.ColorTableEnabled ||
ctx->Pixel.PostColorMatrixColorTableEnabled ||
+ ctx->Pixel.PostConvolutionColorTableEnabled ||
ctx->Pixel.MinMaxEnabled ||
ctx->Pixel.HistogramEnabled);
@@ -673,8 +675,11 @@ _mesa_pack_rgba_span( GLcontext *ctx,
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba);
}
/* XXX convolution here */
- /* XXX post-convolution color table look-up here */
- /* color matrix */
+ /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
+ if (ctx->Pixel.PostConvolutionColorTableEnabled) {
+ _mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba);
+ }
+ /* color matrix transform */
if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
ctx->Pixel.ScaleOrBiasRGBApcm) {
_mesa_transform_rgba(ctx, n, rgba);
@@ -2200,6 +2205,7 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx,
ctx->Pixel.ScaleOrBiasRGBApcm ||
ctx->Pixel.ColorTableEnabled ||
ctx->Pixel.PostColorMatrixColorTableEnabled ||
+ ctx->Pixel.PostConvolutionColorTableEnabled ||
ctx->Pixel.MinMaxEnabled ||
ctx->Pixel.HistogramEnabled);
@@ -2317,7 +2323,10 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx,
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba);
}
/* XXX convolution here */
- /* XXX post-convolution color table look-up here */
+ /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
+ if (ctx->Pixel.PostConvolutionColorTableEnabled) {
+ _mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba);
+ }
/* color matrix transform */
if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
ctx->Pixel.ScaleOrBiasRGBApcm) {
@@ -2515,6 +2524,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx,
ctx->Pixel.ScaleOrBiasRGBApcm ||
ctx->Pixel.ColorTableEnabled ||
ctx->Pixel.PostColorMatrixColorTableEnabled ||
+ ctx->Pixel.PostConvolutionColorTableEnabled ||
ctx->Pixel.MinMaxEnabled ||
ctx->Pixel.HistogramEnabled);
@@ -2582,7 +2592,10 @@ _mesa_unpack_float_color_span( GLcontext *ctx,
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba);
}
/* XXX convolution here */
- /* XXX post-convolution color table look-up here */
+ /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
+ if (ctx->Pixel.PostConvolutionColorTableEnabled) {
+ _mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba);
+ }
/* color matrix transform */
if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
ctx->Pixel.ScaleOrBiasRGBApcm) {
@@ -2994,6 +3007,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
break;
default:
gl_problem(NULL, "bad type in _mesa_unpack_depth_span()");
+ FREE(depth);
return;
}
diff --git a/xc/extras/Mesa/src/imaging.c b/xc/extras/Mesa/src/imaging.c
index 1dd37112d..5d2250cbc 100644
--- a/xc/extras/Mesa/src/imaging.c
+++ b/xc/extras/Mesa/src/imaging.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/imaging.c,v 1.6 2000/09/26 15:56:32 tsi Exp $ */
/*
* Histogram, Min/max and convolution for GL_ARB_imaging subset
@@ -938,6 +938,7 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G
format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
type == GL_BITMAP) {
gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)");
return;
@@ -1007,6 +1008,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G
format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
type == GL_BITMAP) {
gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)");
return;
@@ -1353,6 +1355,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im
format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
type == GL_BITMAP) {
gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)");
return;
@@ -1460,7 +1463,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]);
break;
case GL_CONVOLUTION_BORDER_MODE:
- *params = (GLint) ctx->Pixel.ConvolutionBorderMode;
+ *params = (GLint) ctx->Pixel.ConvolutionBorderMode[c];
break;
case GL_CONVOLUTION_FILTER_SCALE:
params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0];
@@ -1511,6 +1514,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row,
format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
type == GL_BITMAP) {
gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)");
return;
@@ -1554,6 +1558,7 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLs
format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT ||
+ format == GL_INTENSITY ||
type == GL_BITMAP) {
gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)");
return;
diff --git a/xc/extras/Mesa/src/light.c b/xc/extras/Mesa/src/light.c
index ed41e2311..9d73e6814 100644
--- a/xc/extras/Mesa/src/light.c
+++ b/xc/extras/Mesa/src/light.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/light.c,v 1.5 2000/09/26 15:56:32 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -512,9 +512,6 @@ GLuint gl_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
-
-
-
/*
* Check if the global material has to be updated with info that was
* associated with a vertex via glMaterial.
@@ -522,6 +519,8 @@ GLuint gl_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
* glBegin/glEnd either by calling glMaterial() or by calling glColor()
* when GL_COLOR_MATERIAL is enabled.
*
+ * src[0] is front material, src[1] is back material
+ *
* KW: Added code here to keep the precomputed variables uptodate.
* This means we can use the faster shade functions when using
* GL_COLOR_MATERIAL, and we can also now use the precomputed
@@ -529,41 +528,62 @@ GLuint gl_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
* the cost of doing this here.
*/
void gl_update_material( GLcontext *ctx,
- struct gl_material *src,
+ const struct gl_material src[2],
GLuint bitmask )
{
struct gl_light *light, *list = &ctx->Light.EnabledList;
- GLfloat tmp[4];
if (ctx->Light.ColorMaterialEnabled)
bitmask &= ~ctx->Light.ColorMaterialBitmask;
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- fprintf(stderr, "gl_update_material, mask %x\n", bitmask);
+ fprintf(stderr, "gl_update_material, mask 0x%x\n", bitmask);
if (!bitmask)
return;
+ /* update material emission */
+ if (bitmask & FRONT_EMISSION_BIT) {
+ struct gl_material *mat = &ctx->Light.Material[0];
+ COPY_4FV( mat->Emission, src[0].Emission );
+ }
+ if (bitmask & BACK_EMISSION_BIT) {
+ struct gl_material *mat = &ctx->Light.Material[1];
+ COPY_4FV( mat->Emission, src[1].Emission );
+ }
+
+ /* update material ambience */
if (bitmask & FRONT_AMBIENT_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
- SUB_3V( tmp, src[0].Ambient, mat->Ambient );
- ACC_SCALE_3V( ctx->Light.BaseColor[0], ctx->Light.Model.Ambient, tmp);
+ COPY_4FV( mat->Ambient, src[0].Ambient );
foreach (light, list) {
- ACC_SCALE_3V( ctx->Light.BaseColor[0], light->Ambient, tmp );
+ SCALE_3V( light->MatAmbient[0], light->Ambient, src[0].Ambient);
}
- COPY_4FV( mat->Ambient, src[0].Ambient );
}
if (bitmask & BACK_AMBIENT_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
- SUB_3V( tmp, src[1].Ambient, mat->Ambient );
- ACC_SCALE_3V( ctx->Light.BaseColor[1], ctx->Light.Model.Ambient, tmp);
+ COPY_4FV( mat->Ambient, src[1].Ambient );
foreach (light, list) {
- ACC_SCALE_3V( ctx->Light.BaseColor[0], light->Ambient, tmp );
+ SCALE_3V( light->MatAmbient[1], light->Ambient, src[1].Ambient);
}
- COPY_4FV( mat->Ambient, src[1].Ambient );
}
+
+ /* update BaseColor = emission + scene's ambience * material's ambience */
+ if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) {
+ struct gl_material *mat = &ctx->Light.Material[0];
+ COPY_3V( ctx->Light.BaseColor[0], mat->Emission );
+ ACC_SCALE_3V( ctx->Light.BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient );
+ }
+ if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) {
+ struct gl_material *mat = &ctx->Light.Material[1];
+ COPY_3V( ctx->Light.BaseColor[1], mat->Emission );
+ ACC_SCALE_3V( ctx->Light.BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient );
+ }
+
+ /* update material diffuse values */
if (bitmask & FRONT_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
+ GLfloat tmp[4];
SUB_3V( tmp, src[0].Diffuse, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->MatDiffuse[0], light->Diffuse, tmp );
@@ -573,6 +593,7 @@ void gl_update_material( GLcontext *ctx,
}
if (bitmask & BACK_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
+ GLfloat tmp[4];
SUB_3V( tmp, src[1].Diffuse, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->MatDiffuse[1], light->Diffuse, tmp );
@@ -580,8 +601,11 @@ void gl_update_material( GLcontext *ctx,
COPY_4FV( mat->Diffuse, src[1].Diffuse );
FLOAT_COLOR_TO_UBYTE_COLOR(ctx->Light.BaseAlpha[1], mat->Diffuse[3]);
}
+
+ /* update material specular values */
if (bitmask & FRONT_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
+ GLfloat tmp[4];
SUB_3V( tmp, src[0].Specular, mat->Specular );
foreach (light, list) {
if (light->Flags & LIGHT_SPECULAR) {
@@ -594,6 +618,7 @@ void gl_update_material( GLcontext *ctx,
}
if (bitmask & BACK_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
+ GLfloat tmp[4];
SUB_3V( tmp, src[1].Specular, mat->Specular );
foreach (light, list) {
if (light->Flags & LIGHT_SPECULAR) {
@@ -604,18 +629,7 @@ void gl_update_material( GLcontext *ctx,
}
COPY_4FV( mat->Specular, src[1].Specular );
}
- if (bitmask & FRONT_EMISSION_BIT) {
- struct gl_material *mat = &ctx->Light.Material[0];
- SUB_3V( tmp, src[0].Emission, mat->Emission );
- ACC_3V( ctx->Light.BaseColor[0], tmp );
- COPY_4FV( mat->Emission, src[0].Emission );
- }
- if (bitmask & BACK_EMISSION_BIT) {
- struct gl_material *mat = &ctx->Light.Material[1];
- SUB_3V( tmp, src[1].Emission, mat->Emission );
- ACC_3V( ctx->Light.BaseColor[1], tmp );
- COPY_4FV( mat->Emission, src[1].Emission );
- }
+
if (bitmask & FRONT_SHININESS_BIT) {
GLfloat shininess = ctx->Light.Material[0].Shininess = src[0].Shininess;
gl_compute_shine_table( ctx, 0, shininess );
@@ -626,6 +640,7 @@ void gl_update_material( GLcontext *ctx,
gl_compute_shine_table( ctx, 1, shininess );
gl_compute_shine_table( ctx, 3, shininess * .5 );
}
+
if (bitmask & FRONT_INDEXES_BIT) {
ctx->Light.Material[0].AmbientIndex = src[0].AmbientIndex;
ctx->Light.Material[0].DiffuseIndex = src[0].DiffuseIndex;
@@ -662,43 +677,68 @@ void gl_update_material( GLcontext *ctx,
-
-
+/*
+ * Update the current materials from the given rgba color
+ * according to the bitmask in ColorMaterialBitmask, which is
+ * set by glColorMaterial().
+ */
void gl_update_color_material( GLcontext *ctx,
const GLubyte rgba[4] )
{
struct gl_light *light, *list = &ctx->Light.EnabledList;
GLuint bitmask = ctx->Light.ColorMaterialBitmask;
- GLfloat tmp[4], color[4];
+ GLfloat color[4];
UBYTE_RGBA_TO_FLOAT_RGBA( color, rgba );
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- fprintf(stderr, "gl_update_color_material, mask %x\n", bitmask);
+ fprintf(stderr, "gl_update_color_material, mask 0x%x\n", bitmask);
+
+ /* update emissive colors */
+ if (bitmask & FRONT_EMISSION_BIT) {
+ struct gl_material *mat = &ctx->Light.Material[0];
+ COPY_4FV( mat->Emission, color );
+ }
+ if (bitmask & BACK_EMISSION_BIT) {
+ struct gl_material *mat = &ctx->Light.Material[1];
+ COPY_4FV( mat->Emission, color );
+ }
+ /* update light->MatAmbient = light's ambient * material's ambient */
if (bitmask & FRONT_AMBIENT_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
- SUB_3V( tmp, color, mat->Ambient );
- ACC_SCALE_3V( ctx->Light.BaseColor[0], ctx->Light.Model.Ambient, tmp);
foreach (light, list) {
- ACC_SCALE_3V( ctx->Light.BaseColor[0], light->Ambient, tmp );
+ SCALE_3V( light->MatAmbient[0], light->Ambient, color);
}
COPY_4FV( mat->Ambient, color );
}
if (bitmask & BACK_AMBIENT_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
- SUB_3V( tmp, color, mat->Ambient );
- ACC_SCALE_3V( ctx->Light.BaseColor[1], ctx->Light.Model.Ambient, tmp);
foreach (light, list) {
- ACC_SCALE_3V( ctx->Light.BaseColor[0], light->Ambient, tmp );
+ SCALE_3V( light->MatAmbient[1], light->Ambient, color);
}
COPY_4FV( mat->Ambient, color );
}
+ /* update BaseColor = emission + scene's ambience * material's ambience */
+ if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) {
+ struct gl_material *mat = &ctx->Light.Material[0];
+ COPY_3V( ctx->Light.BaseColor[0], mat->Emission );
+ ACC_SCALE_3V( ctx->Light.BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient );
+ }
+
+ if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) {
+ struct gl_material *mat = &ctx->Light.Material[1];
+ COPY_3V( ctx->Light.BaseColor[1], mat->Emission );
+ ACC_SCALE_3V( ctx->Light.BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient );
+ }
+
+ /* update light->MatDiffuse = light's diffuse * material's diffuse */
if (bitmask & FRONT_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
+ GLfloat tmp[4];
SUB_3V( tmp, color, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->MatDiffuse[0], light->Diffuse, tmp );
@@ -709,6 +749,7 @@ void gl_update_color_material( GLcontext *ctx,
if (bitmask & BACK_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
+ GLfloat tmp[4];
SUB_3V( tmp, color, mat->Diffuse );
foreach (light, list) {
ACC_SCALE_3V( light->MatDiffuse[1], light->Diffuse, tmp );
@@ -717,8 +758,10 @@ void gl_update_color_material( GLcontext *ctx,
FLOAT_COLOR_TO_UBYTE_COLOR(ctx->Light.BaseAlpha[1], mat->Diffuse[3]);
}
+ /* update light->MatSpecular = light's specular * material's specular */
if (bitmask & FRONT_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
+ GLfloat tmp[4];
SUB_3V( tmp, color, mat->Specular );
foreach (light, list) {
if (light->Flags & LIGHT_SPECULAR) {
@@ -729,8 +772,10 @@ void gl_update_color_material( GLcontext *ctx,
}
COPY_4FV( mat->Specular, color );
}
+
if (bitmask & BACK_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
+ GLfloat tmp[4];
SUB_3V( tmp, color, mat->Specular );
foreach (light, list) {
if (light->Flags & LIGHT_SPECULAR) {
@@ -741,18 +786,6 @@ void gl_update_color_material( GLcontext *ctx,
}
COPY_4FV( mat->Specular, color );
}
- if (bitmask & FRONT_EMISSION_BIT) {
- struct gl_material *mat = &ctx->Light.Material[0];
- SUB_3V( tmp, color, mat->Emission );
- ACC_3V( ctx->Light.BaseColor[0], tmp );
- COPY_4FV( mat->Emission, color );
- }
- if (bitmask & BACK_EMISSION_BIT) {
- struct gl_material *mat = &ctx->Light.Material[1];
- SUB_3V( tmp, color, mat->Emission );
- ACC_3V( ctx->Light.BaseColor[1], tmp );
- COPY_4FV( mat->Emission, color );
- }
if (0)
{
@@ -1085,26 +1118,27 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
* Whenever the spotlight exponent for a light changes we must call
* this function to recompute the exponent lookup table.
*/
-void gl_compute_spot_exp_table( struct gl_light *l )
+void
+gl_compute_spot_exp_table( struct gl_light *l )
{
- int i;
- double exponent = l->SpotExponent;
- double tmp = 0;
- int clamp = 0;
+ GLint i;
+ GLdouble exponent = l->SpotExponent;
+ GLdouble tmp = 0;
+ GLint clamp = 0;
l->SpotExpTable[0][0] = 0.0;
- for (i=EXP_TABLE_SIZE-1;i>0;i--) {
+ for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) {
if (clamp == 0) {
- tmp = pow(i/(double)(EXP_TABLE_SIZE-1), exponent);
- if (tmp < FLT_MIN*100.0) {
+ tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
+ if (tmp < FLT_MIN * 100.0) {
tmp = 0.0;
clamp = 1;
}
}
l->SpotExpTable[i][0] = tmp;
}
- for (i=0;i<EXP_TABLE_SIZE-1;i++) {
+ for (i = 0; i < EXP_TABLE_SIZE - 1; i++) {
l->SpotExpTable[i][1] = l->SpotExpTable[i+1][0] - l->SpotExpTable[i][0];
}
l->SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0;
@@ -1117,30 +1151,36 @@ void gl_compute_spot_exp_table( struct gl_light *l )
* lighting, and the cost of doing it early may be partially offset
* by keeping a MRU cache of shine tables for various shine values.
*/
-static void compute_shine_table( struct gl_shine_tab *tab, GLfloat shininess )
+static void
+compute_shine_table( struct gl_shine_tab *tab, GLfloat shininess )
{
- int i;
+ GLint i;
GLfloat *m = tab->tab;
- m[0] = 0;
- if (shininess == 0) {
+ m[0] = 0.0;
+ if (shininess == 0.0) {
for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++)
- m[i] = 1;
- } else {
- for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++) {
- double t = pow( i/(GLfloat)SHINE_TABLE_SIZE, shininess );
- m[i] = 0;
- if (t > 1e-20) m[i] = t;
+ m[i] = 1.0;
+ }
+ else {
+ for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) {
+ GLdouble t = pow(i / (GLfloat) (SHINE_TABLE_SIZE - 1), shininess);
+ if (t > 1e-20)
+ m[i] = t;
+ else
+ m[i] = 0.0;
}
+ m[SHINE_TABLE_SIZE] = 1.0;
}
tab->shininess = shininess;
}
-#define DISTSQR(a,b) ((a-b)*(a-b))
-void gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
+void
+gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
{
+#define DISTSQR(a,b) ((a-b)*(a-b))
struct gl_shine_tab *list = ctx->ShineTabList;
struct gl_shine_tab *s;
@@ -1148,10 +1188,10 @@ void gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
if ( DISTSQR(s->shininess, shininess) < 1e-4 )
break;
- if (s == list)
- {
+ if (s == list) {
foreach(s, list)
- if (s->refcount == 0) break;
+ if (s->refcount == 0)
+ break;
compute_shine_table( s, shininess );
}
@@ -1160,12 +1200,14 @@ void gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
ctx->ShineTable[i] = s;
move_to_tail( list, s );
s->refcount++;
+#undef DISTSQR
}
#if 0
-static void gl_reinit_light_attrib( GLcontext *ctx, struct gl_light_attrib *l )
+static void
+gl_reinit_light_attrib( GLcontext *ctx, struct gl_light_attrib *l )
{
GLuint i;
@@ -1194,7 +1236,8 @@ static void gl_reinit_light_attrib( GLcontext *ctx, struct gl_light_attrib *l )
* Also, precompute some lighting values such as the products of light
* source and material ambient, diffuse and specular coefficients.
*/
-void gl_update_lighting( GLcontext *ctx )
+void
+gl_update_lighting( GLcontext *ctx )
{
struct gl_light *light;
@@ -1224,13 +1267,12 @@ void gl_update_lighting( GLcontext *ctx )
/* Precompute some shading values.
*/
- if (ctx->Visual->RGBAflag)
- {
+ if (ctx->Visual->RGBAflag) {
GLuint sides = ((ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) ? 2 : 1);
GLuint side;
for (side=0; side < sides; side++) {
struct gl_material *mat = &ctx->Light.Material[side];
-
+
COPY_3V(ctx->Light.BaseColor[side], mat->Emission);
ACC_SCALE_3V(ctx->Light.BaseColor[side],
ctx->Light.Model.Ambient,
@@ -1242,12 +1284,10 @@ void gl_update_lighting( GLcontext *ctx )
foreach (light, &ctx->Light.EnabledList) {
for (side=0; side< sides; side++) {
- struct gl_material *mat = &ctx->Light.Material[side];
- SCALE_3V( light->MatDiffuse[side], light->Diffuse, mat->Diffuse );
- SCALE_3V( light->MatAmbient[side], light->Ambient, mat->Ambient );
- ACC_3V( ctx->Light.BaseColor[side], light->MatAmbient[side] );
- if (light->Flags & LIGHT_SPECULAR)
- {
+ const struct gl_material *mat = &ctx->Light.Material[side];
+ SCALE_3V( light->MatDiffuse[side], light->Diffuse, mat->Diffuse );
+ SCALE_3V( light->MatAmbient[side], light->Ambient, mat->Ambient );
+ if (light->Flags & LIGHT_SPECULAR) {
SCALE_3V( light->MatSpecular[side], light->Specular,
mat->Specular);
light->IsMatSpecular[side] =
@@ -1258,10 +1298,8 @@ void gl_update_lighting( GLcontext *ctx )
}
}
}
- else
- {
- static GLfloat ci[3] = { .30, .59, .11 };
-
+ else {
+ static const GLfloat ci[3] = { .30, .59, .11 };
foreach(light, &ctx->Light.EnabledList) {
light->dli = DOT3(ci, light->Diffuse);
light->sli = DOT3(ci, light->Specular);
@@ -1269,52 +1307,54 @@ void gl_update_lighting( GLcontext *ctx )
}
}
+
+
/* Need to seriously restrict the circumstances under which these
* calc's are performed.
*/
-void gl_compute_light_positions( GLcontext *ctx )
+void
+gl_compute_light_positions( GLcontext *ctx )
{
struct gl_light *light;
- if (ctx->Light.NeedVertices && !ctx->Light.Model.LocalViewer) {
- GLfloat eye_z[3] = { 0, 0, 1 };
- if (!ctx->NeedEyeCoords) {
- TRANSFORM_NORMAL( ctx->EyeZDir, eye_z, ctx->ModelView.m );
- } else {
+ if (1 /*ctx->Light.NeedVertices && !ctx->Light.Model.LocalViewer*/) {
+ static const GLfloat eye_z[3] = { 0, 0, 1 };
+ if (ctx->NeedEyeCoords) {
COPY_3V( ctx->EyeZDir, eye_z );
}
+ else {
+ TRANSFORM_NORMAL( ctx->EyeZDir, eye_z, ctx->ModelView.m );
+ }
}
foreach (light, &ctx->Light.EnabledList) {
- if (!ctx->NeedEyeCoords) {
+ if (ctx->NeedEyeCoords) {
+ COPY_4FV( light->Position, light->EyePosition );
+ }
+ else {
TRANSFORM_POINT( light->Position, ctx->ModelView.inv,
light->EyePosition );
- } else {
- COPY_4FV( light->Position, light->EyePosition );
}
- if (!(light->Flags & LIGHT_POSITIONAL))
- {
+ if (!(light->Flags & LIGHT_POSITIONAL)) {
/* VP (VP) = Normalize( Position ) */
COPY_3V( light->VP_inf_norm, light->Position );
NORMALIZE_3FV( light->VP_inf_norm );
- if (!ctx->Light.Model.LocalViewer)
- {
+ if (!ctx->Light.Model.LocalViewer) {
/* h_inf_norm = Normalize( V_to_P + <0,0,1> ) */
ADD_3V( light->h_inf_norm, light->VP_inf_norm, ctx->EyeZDir);
NORMALIZE_3FV( light->h_inf_norm );
}
-
light->VP_inf_spot_attenuation = 1.0;
}
- if (light->Flags & LIGHT_SPOT)
- {
+ if (light->Flags & LIGHT_SPOT) {
if (ctx->NeedEyeNormals) {
COPY_3V( light->NormDirection, light->EyeDirection );
- } else {
+ }
+ else {
TRANSFORM_NORMAL( light->NormDirection,
light->EyeDirection,
ctx->ModelView.m);
@@ -1336,18 +1376,17 @@ void gl_compute_light_positions( GLcontext *ctx )
(light->SpotExpTable[k][0] +
(x-k)*light->SpotExpTable[k][1]);
}
- else
+ else {
light->VP_inf_spot_attenuation = 0;
+ }
}
}
}
}
-
-
-
-void gl_update_normal_transform( GLcontext *ctx )
+void
+gl_update_normal_transform( GLcontext *ctx )
{
GLuint new_flag = 0;
normal_func *last = ctx->NormalTransform;
@@ -1368,20 +1407,18 @@ void gl_update_normal_transform( GLcontext *ctx )
new_flag = ctx->NewState & NEW_MODELVIEW;
ctx->vb_rescale_factor = ctx->rescale_factor;
- if (ctx->Transform.Normalize)
- {
+ if (ctx->Transform.Normalize) {
ctx->NormalTransform = gl_normal_tab[transform | NORM_NORMALIZE];
}
else if (ctx->Transform.RescaleNormals &&
- ctx->rescale_factor != 1.0)
- {
+ ctx->rescale_factor != 1.0) {
ctx->NormalTransform = gl_normal_tab[transform | NORM_RESCALE];
}
- else
- {
+ else {
ctx->NormalTransform = gl_normal_tab[transform];
}
- } else {
+ }
+ else {
ctx->NormalTransform = 0;
}
}
@@ -1389,20 +1426,18 @@ void gl_update_normal_transform( GLcontext *ctx )
if (ctx->NeedNormals) {
ctx->vb_rescale_factor = 1.0/ctx->rescale_factor;
- if (ctx->Transform.Normalize)
- {
+ if (ctx->Transform.Normalize) {
ctx->NormalTransform = gl_normal_tab[NORM_NORMALIZE];
}
else if (!ctx->Transform.RescaleNormals &&
- ctx->rescale_factor != 1.0)
- {
+ ctx->rescale_factor != 1.0) {
ctx->NormalTransform = gl_normal_tab[NORM_RESCALE];
}
- else
- {
+ else {
ctx->NormalTransform = 0;
}
- } else {
+ }
+ else {
ctx->NormalTransform = 0;
}
}
@@ -1410,4 +1445,3 @@ void gl_update_normal_transform( GLcontext *ctx )
if (last != ctx->NormalTransform || new_flag)
ctx->NewState |= NEW_NORMAL_TRANSFORM;
}
-
diff --git a/xc/extras/Mesa/src/light.h b/xc/extras/Mesa/src/light.h
index aa7ded40c..1a4fa4174 100644
--- a/xc/extras/Mesa/src/light.h
+++ b/xc/extras/Mesa/src/light.h
@@ -3,7 +3,7 @@
* Mesa 3-D graphics library
* Version: 3.3
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 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"),
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/light.h,v 1.5 2000/09/26 15:56:32 tsi Exp $ */
#ifndef LIGHT_H
#define LIGHT_H
@@ -114,7 +114,7 @@ extern void gl_compute_light_positions( GLcontext *ctx );
extern void gl_update_normal_transform( GLcontext *ctx );
extern void gl_update_material( GLcontext *ctx,
- struct gl_material *m,
+ const struct gl_material src[2],
GLuint bitmask );
extern void gl_update_color_material( GLcontext *ctx, const GLubyte rgba[4] );
diff --git a/xc/extras/Mesa/src/lines.c b/xc/extras/Mesa/src/lines.c
index dd0649ba0..24b9d5feb 100644
--- a/xc/extras/Mesa/src/lines.c
+++ b/xc/extras/Mesa/src/lines.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/lines.c,v 1.6 2000/09/26 15:56:32 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -556,13 +556,8 @@ static void general_smooth_rgba_line( GLcontext *ctx,
static void general_flat_rgba_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert )
{
- GLint count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLubyte *color = ctx->VB->ColorPtr->data[pvert];
+ const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
- count = ctx->PB->count;
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -570,12 +565,7 @@ static void general_flat_rgba_line( GLcontext *ctx,
#define INTERP_Z 1
#define WIDE 1
#define STIPPLE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- count++; \
- CHECK_FULL(count);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
#include "linetemp.h"
}
else {
@@ -584,18 +574,10 @@ static void general_flat_rgba_line( GLcontext *ctx,
/* special case: unstippled and width=2 */
#define INTERP_XY 1
#define INTERP_Z 1
-#define XMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X; \
- pby[count] = Y; pby[count+1] = Y+1; \
- pbz[count] = Z; pbz[count+1] = Z; \
- count += 2; \
- CHECK_FULL(count);
-#define YMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X+1; \
- pby[count] = Y; pby[count+1] = Y; \
- pbz[count] = Z; pbz[count+1] = Z; \
- count += 2; \
- CHECK_FULL(count);
+#define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); \
+ PB_WRITE_PIXEL(ctx->PB, X, Y+1, Z);
+#define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); \
+ PB_WRITE_PIXEL(ctx->PB, X+1, Y, Z);
#include "linetemp.h"
}
else {
@@ -603,17 +585,11 @@ static void general_flat_rgba_line( GLcontext *ctx,
#define INTERP_XY 1
#define INTERP_Z 1
#define WIDE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- count++; \
- CHECK_FULL(count);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
#include "linetemp.h"
}
}
- ctx->PB->count = count;
gl_flush_pb(ctx);
}
@@ -847,6 +823,104 @@ static void smooth_multitextured_line( GLcontext *ctx,
}
+/* Flat-shaded, multitextured, any width, maybe stippled, separate specular
+ * color interpolation.
+ */
+static void flat_multitextured_line( GLcontext *ctx,
+ GLuint vert0, GLuint vert1, GLuint pvert )
+{
+ GLint count = ctx->PB->count;
+ GLint *pbx = ctx->PB->x;
+ GLint *pby = ctx->PB->y;
+ GLdepth *pbz = ctx->PB->z;
+ GLfloat *pbs = ctx->PB->s[0];
+ GLfloat *pbt = ctx->PB->t[0];
+ GLfloat *pbu = ctx->PB->u[0];
+ GLfloat *pbs1 = ctx->PB->s[1];
+ GLfloat *pbt1 = ctx->PB->t[1];
+ GLfloat *pbu1 = ctx->PB->u[1];
+ GLubyte (*pbrgba)[4] = ctx->PB->rgba;
+ GLubyte (*pbspec)[3] = ctx->PB->spec;
+ GLubyte *color = ctx->VB->ColorPtr->data[pvert];
+ GLubyte sRed = ctx->VB->Specular ? ctx->VB->Specular[pvert][0] : 0;
+ GLubyte sGreen = ctx->VB->Specular ? ctx->VB->Specular[pvert][1] : 0;
+ GLubyte sBlue = ctx->VB->Specular ? ctx->VB->Specular[pvert][2] : 0;
+
+ (void) pvert;
+
+ ctx->PB->mono = GL_FALSE;
+
+ if (ctx->Line.StippleFlag) {
+ /* stippled */
+#define INTERP_XY 1
+#define INTERP_Z 1
+#define INTERP_ALPHA 1
+#define INTERP_STUV0 1
+#define INTERP_STUV1 1
+#define WIDE 1
+#define STIPPLE 1
+#define PLOT(X,Y) \
+ { \
+ pbx[count] = X; \
+ pby[count] = Y; \
+ pbz[count] = Z; \
+ pbs[count] = s; \
+ pbt[count] = t; \
+ pbu[count] = u; \
+ pbs1[count] = s1; \
+ pbt1[count] = t1; \
+ pbu1[count] = u1; \
+ pbrgba[count][RCOMP] = color[0]; \
+ pbrgba[count][GCOMP] = color[1]; \
+ pbrgba[count][BCOMP] = color[2]; \
+ pbrgba[count][ACOMP] = color[3]; \
+ pbspec[count][RCOMP] = sRed; \
+ pbspec[count][GCOMP] = sGreen; \
+ pbspec[count][BCOMP] = sBlue; \
+ count++; \
+ CHECK_FULL(count); \
+ }
+#include "linetemp.h"
+ }
+ else {
+ /* unstippled */
+#define INTERP_XY 1
+#define INTERP_Z 1
+#define INTERP_ALPHA 1
+#define INTERP_STUV0 1
+#define INTERP_STUV1 1
+#define WIDE 1
+#define PLOT(X,Y) \
+ { \
+ pbx[count] = X; \
+ pby[count] = Y; \
+ pbz[count] = Z; \
+ pbs[count] = s; \
+ pbt[count] = t; \
+ pbu[count] = u; \
+ pbs1[count] = s1; \
+ pbt1[count] = t1; \
+ pbu1[count] = u1; \
+ pbrgba[count][RCOMP] = color[0]; \
+ pbrgba[count][GCOMP] = color[1]; \
+ pbrgba[count][BCOMP] = color[2]; \
+ pbrgba[count][ACOMP] = color[3]; \
+ pbspec[count][RCOMP] = sRed; \
+ pbspec[count][GCOMP] = sGreen; \
+ pbspec[count][BCOMP] = sBlue; \
+ count++; \
+ CHECK_FULL(count); \
+ }
+#include "linetemp.h"
+ }
+
+ ctx->PB->count = count;
+ gl_flush_pb(ctx);
+}
+
+
+
+
/*
* Antialiased RGBA line
*
@@ -934,6 +1008,61 @@ static void null_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
}
+
+#ifdef DEBUG
+void
+_mesa_print_line_function(GLcontext *ctx)
+{
+ printf("Line Func == ");
+ if (ctx->Driver.LineFunc == flat_ci_line)
+ printf("flat_ci_line\n");
+ else if (ctx->Driver.LineFunc == flat_ci_z_line)
+ printf("flat_ci_z_line\n");
+ else if (ctx->Driver.LineFunc == flat_rgba_line)
+ printf("flat_rgba_line\n");
+ else if (ctx->Driver.LineFunc == flat_rgba_z_line)
+ printf("flat_rgba_z_line\n");
+ else if (ctx->Driver.LineFunc == smooth_ci_line)
+ printf("smooth_ci_line\n");
+ else if (ctx->Driver.LineFunc == smooth_ci_z_line)
+ printf("smooth_ci_z_line\n");
+ else if (ctx->Driver.LineFunc == smooth_rgba_line)
+ printf("smooth_rgba_line\n");
+ else if (ctx->Driver.LineFunc == smooth_rgba_z_line)
+ printf("smooth_rgba_z_line\n");
+ else if (ctx->Driver.LineFunc == general_smooth_ci_line)
+ printf("general_smooth_ci_line\n");
+ else if (ctx->Driver.LineFunc == general_flat_ci_line)
+ printf("general_flat_ci_line\n");
+ else if (ctx->Driver.LineFunc == general_smooth_rgba_line)
+ printf("general_smooth_rgba_line\n");
+ else if (ctx->Driver.LineFunc == general_flat_rgba_line)
+ printf("general_flat_rgba_line\n");
+ else if (ctx->Driver.LineFunc == flat_textured_line)
+ printf("flat_textured_line\n");
+ else if (ctx->Driver.LineFunc == smooth_textured_line)
+ printf("smooth_textured_line\n");
+ else if (ctx->Driver.LineFunc == smooth_multitextured_line)
+ printf("smooth_multitextured_line\n");
+ else if (ctx->Driver.LineFunc == flat_multitextured_line)
+ printf("flat_multitextured_line\n");
+ else if (ctx->Driver.LineFunc == aa_rgba_line)
+ printf("aa_rgba_line\n");
+ else if (ctx->Driver.LineFunc == aa_tex_rgba_line)
+ printf("aa_tex_rgba_line\n");
+ else if (ctx->Driver.LineFunc == aa_multitex_rgba_line)
+ printf("aa_multitex_rgba_line\n");
+ else if (ctx->Driver.LineFunc == aa_ci_line)
+ printf("aa_ci_line\n");
+ else if (ctx->Driver.LineFunc == null_line)
+ printf("null_line\n");
+ else
+ printf("Driver func %p\n", ctx->Driver.PointsFunc);
+}
+#endif
+
+
+
/*
* Determine which line drawing function to use given the current
* rendering context.
@@ -975,7 +1104,10 @@ void gl_set_line_function( GLcontext *ctx )
if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D
|| ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
/* multi-texture and/or separate specular color */
- ctx->Driver.LineFunc = smooth_multitextured_line;
+ if (ctx->Light.ShadeModel==GL_SMOOTH)
+ ctx->Driver.LineFunc = smooth_multitextured_line;
+ else
+ ctx->Driver.LineFunc = flat_multitextured_line;
}
else {
if (ctx->Light.ShadeModel==GL_SMOOTH) {
@@ -1041,5 +1173,6 @@ void gl_set_line_function( GLcontext *ctx )
/* GL_SELECT mode */
ctx->Driver.LineFunc = gl_select_line;
}
-}
+ /*_mesa_print_line_function(ctx);*/
+}
diff --git a/xc/extras/Mesa/src/linetemp.h b/xc/extras/Mesa/src/linetemp.h
index 9e0fbd301..ab0f6657e 100644
--- a/xc/extras/Mesa/src/linetemp.h
+++ b/xc/extras/Mesa/src/linetemp.h
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/linetemp.h,v 1.8 2000/06/17 00:02:13 martin Exp $ */
+/* $XFree86: xc/extras/Mesa/src/linetemp.h,v 1.9 2000/09/24 13:50:12 alanh Exp $ */
/*
* Line Rasterizer Template
@@ -223,12 +223,12 @@
zPtr = (DEPTH_TYPE *) _mesa_zbuffer_address(ctx, x0, y0);
# endif
if (depthBits <= 16) {
- z0 = FloatToFixed(VB->Win.data[vert0][2]);
- z1 = FloatToFixed(VB->Win.data[vert1][2]);
+ z0 = FloatToFixed(VB->Win.data[vert0][2] + ctx->LineZoffset);
+ z1 = FloatToFixed(VB->Win.data[vert1][2] + ctx->LineZoffset);
}
else {
- z0 = (int) VB->Win.data[vert0][2];
- z1 = (int) VB->Win.data[vert1][2];
+ z0 = (int) VB->Win.data[vert0][2] + ctx->LineZoffset;
+ z1 = (int) VB->Win.data[vert1][2] + ctx->LineZoffset;
}
#endif
#ifdef PIXEL_ADDRESS
diff --git a/xc/extras/Mesa/src/lnaatemp.h b/xc/extras/Mesa/src/lnaatemp.h
index 118ffb675..872fe09b9 100644
--- a/xc/extras/Mesa/src/lnaatemp.h
+++ b/xc/extras/Mesa/src/lnaatemp.h
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.3
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 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"),
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/lnaatemp.h,v 1.10 2000/06/21 20:18:13 tsi Exp $ */
+/* $XFree86: xc/extras/Mesa/src/lnaatemp.h,v 1.11 2000/09/24 13:50:12 alanh Exp $ */
/*
* Antialiased Line Rasterizer Template
@@ -103,12 +103,12 @@
ctx->PB->mono = GL_FALSE;
if (depthBits <= 16) {
- z0 = FloatToFixed(VB->Win.data[vert0][2]);
- z1 = FloatToFixed(VB->Win.data[vert1][2]);
+ z0 = FloatToFixed(VB->Win.data[vert0][2] + ctx->LineZoffset);
+ z1 = FloatToFixed(VB->Win.data[vert1][2] + ctx->LineZoffset);
}
else {
- z0 = (int) VB->Win.data[vert0][2];
- z1 = (int) VB->Win.data[vert1][2];
+ z0 = (int) VB->Win.data[vert0][2] + ctx->LineZoffset;
+ z1 = (int) VB->Win.data[vert1][2] + ctx->LineZoffset;
}
#ifdef INTERP_STUV0
diff --git a/xc/extras/Mesa/src/logic.c b/xc/extras/Mesa/src/logic.c
index 1078cca68..2a4bd3aed 100644
--- a/xc/extras/Mesa/src/logic.c
+++ b/xc/extras/Mesa/src/logic.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/logic.c,v 1.6 2000/09/26 15:56:32 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -63,7 +63,7 @@ _mesa_LogicOp( GLenum opcode )
case GL_OR_INVERTED:
ctx->Color.LogicOp = opcode;
ctx->NewState |= NEW_RASTER_OPS;
- return;
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glLogicOp" );
return;
diff --git a/xc/extras/Mesa/src/matrix.c b/xc/extras/Mesa/src/matrix.c
index 5c66ef0e3..3dcc61ad9 100644
--- a/xc/extras/Mesa/src/matrix.c
+++ b/xc/extras/Mesa/src/matrix.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/matrix.c,v 1.7 2000/09/26 15:56:32 tsi Exp $ */
/*
* Matrix operations
@@ -596,7 +596,7 @@ void gl_rotation_matrix( GLfloat angle, GLfloat x, GLfloat y, GLfloat z,
mag = GL_SQRT( x*x + y*y + z*z );
- if (mag == 0.0) {
+ if (mag <= 1.0e-4) {
/* generate an identity matrix and return */
MEMCPY(m, Identity, sizeof(GLfloat)*16);
return;
@@ -1561,16 +1561,23 @@ void gl_calculate_model_project_matrix( GLcontext *ctx )
void gl_matrix_ctr( GLmatrix *m )
{
+ if ( m->m == 0 ) {
+ m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
+ }
+ MEMCPY( m->m, Identity, sizeof(Identity) );
m->inv = 0;
- MEMCPY( m->m, Identity, sizeof(Identity));
m->type = MATRIX_IDENTITY;
m->flags = MAT_DIRTY_DEPENDENTS;
}
void gl_matrix_dtr( GLmatrix *m )
{
- if (m->inv != 0) {
- FREE(m->inv);
+ if ( m->m != 0 ) {
+ ALIGN_FREE( m->m );
+ m->m = 0;
+ }
+ if ( m->inv != 0 ) {
+ ALIGN_FREE( m->inv );
m->inv = 0;
}
}
@@ -1578,7 +1585,7 @@ void gl_matrix_dtr( GLmatrix *m )
#if 0
void gl_matrix_set_identity( GLmatrix *m )
{
- MEMCPY( m->m, Identity, sizeof(Identity));
+ MEMCPY( m->m, Identity, sizeof(Identity) );
m->type = MATRIX_IDENTITY;
m->flags = MAT_DIRTY_DEPENDENTS;
}
@@ -1586,15 +1593,15 @@ void gl_matrix_set_identity( GLmatrix *m )
void gl_matrix_alloc_inv( GLmatrix *m )
{
- if (m->inv == 0) {
- m->inv = (GLfloat *)MALLOC(16*sizeof(GLfloat));
+ if ( m->inv == 0 ) {
+ m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) );
}
}
void gl_matrix_copy( GLmatrix *to, const GLmatrix *from )
{
- MEMCPY( to->m, from->m, sizeof(Identity));
+ MEMCPY( to->m, from->m, sizeof(Identity) );
to->flags = from->flags | MAT_DIRTY_DEPENDENTS;
to->type = from->type;
diff --git a/xc/extras/Mesa/src/matrix.h b/xc/extras/Mesa/src/matrix.h
index 44d7cefab..2da7687c9 100644
--- a/xc/extras/Mesa/src/matrix.h
+++ b/xc/extras/Mesa/src/matrix.h
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/matrix.h,v 1.5 2000/09/26 15:56:32 tsi Exp $ */
#ifndef MATRIX_H
#define MATRIX_H
@@ -33,8 +33,8 @@
typedef struct {
- GLfloat m[16];
- GLfloat *inv; /* optional */
+ GLfloat *m; /* 16-byte aligned */
+ GLfloat *inv; /* optional, 16-byte aligned */
GLuint flags;
GLuint type;
} GLmatrix;
diff --git a/xc/extras/Mesa/src/mem.c b/xc/extras/Mesa/src/mem.c
index fff2bb163..9e6a5c2b1 100644
--- a/xc/extras/Mesa/src/mem.c
+++ b/xc/extras/Mesa/src/mem.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/mem.c,v 1.4 2000/09/26 15:56:32 tsi Exp $ */
/*
* Memory allocation functions. Called via the MALLOC, CALLOC and
@@ -36,6 +36,7 @@
#include "all.h"
#else
#include "glheader.h"
+#include "macros.h"
#include "mem.h"
#endif
@@ -71,3 +72,84 @@ _mesa_free(void *ptr)
}
+
+/*
+ * N-byte aligned memory allocation functions. Called via the ALIGN_MALLOC,
+ * ALIGN_CALLOC and ALIGN_FREE macros. Debug versions?
+ * These functions allow dynamically allocated memory to be correctly
+ * aligned for improved cache utilization and specialized assembly
+ * support.
+ */
+
+
+/*
+ * Allocate N-byte aligned memory (uninitialized)
+ */
+void *
+_mesa_align_malloc(size_t bytes, unsigned long alignment)
+{
+ unsigned long ptr, buf;
+
+ ASSERT( alignment > 0 );
+
+ ptr = (unsigned long) MALLOC( bytes + alignment );
+
+ buf = (ptr + alignment) & ~(unsigned long)(alignment - 1);
+ *(unsigned long *)(buf - sizeof(void *)) = ptr;
+
+#ifdef DEBUG
+ /* mark the non-aligned area */
+ while ( ptr < buf - sizeof(void *) ) {
+ *(unsigned long *)ptr = 0xcdcdcdcd;
+ ptr += sizeof(unsigned long);
+ }
+#endif
+
+ return (void *)buf;
+}
+
+
+/*
+ * Allocate N-byte aligned memory and initialize to zero
+ */
+void *
+_mesa_align_calloc(size_t bytes, unsigned long alignment)
+{
+ unsigned long ptr, buf;
+
+ ASSERT( alignment > 0 );
+
+ ptr = (unsigned long) CALLOC( bytes + alignment );
+
+ buf = (ptr + alignment) & ~(unsigned long)(alignment - 1);
+ *(unsigned long *)(buf - sizeof(void *)) = ptr;
+
+#ifdef DEBUG
+ /* mark the non-aligned area */
+ while ( ptr < buf - sizeof(void *) ) {
+ *(unsigned long *)ptr = 0xcdcdcdcd;
+ ptr += sizeof(unsigned long);
+ }
+#endif
+
+ return (void *)buf;
+}
+
+
+/*
+ * Free N-byte aligned memory
+ */
+void
+_mesa_align_free(void *ptr)
+{
+#if 0
+ FREE( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) );
+#else
+ /* The actuall address to free is stuffed in the word immediately
+ * before the address the client sees.
+ */
+ void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
+ void *realAddr = *cubbyHole;
+ FREE(realAddr);
+#endif
+}
diff --git a/xc/extras/Mesa/src/mem.h b/xc/extras/Mesa/src/mem.h
index 794aa13ef..e9b1f3136 100644
--- a/xc/extras/Mesa/src/mem.h
+++ b/xc/extras/Mesa/src/mem.h
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/mem.h,v 1.5 2000/09/26 15:56:32 tsi Exp $ */
#ifndef MEM_H
#define MEM_H
@@ -38,6 +38,10 @@ extern void *_mesa_malloc(size_t bytes);
extern void *_mesa_calloc(size_t bytes);
extern void _mesa_free(void *ptr);
+extern void *_mesa_align_malloc(size_t bytes, unsigned long alignment);
+extern void *_mesa_align_calloc(size_t bytes, unsigned long alignment);
+extern void _mesa_align_free(void *ptr);
+
#ifdef DEBUG
@@ -59,6 +63,13 @@ extern void _mesa_free(void *ptr);
#endif
+/* call Mesa N-byte aligned memory functions */
+#define ALIGN_MALLOC(BYTES, N) (void *) _mesa_align_malloc(BYTES, N)
+#define ALIGN_CALLOC(BYTES, N) (void *) _mesa_align_calloc(BYTES, N)
+#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N)
+#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N)
+#define ALIGN_FREE(PTR) _mesa_align_free(PTR)
+
/* Memory copy: */
#ifdef SUNOS4
diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h
index 773e77645..dae66eac6 100644
--- a/xc/extras/Mesa/src/mmath.h
+++ b/xc/extras/Mesa/src/mmath.h
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/mmath.h,v 1.6 2000/08/09 23:40:10 dawes Exp $ */
+/* $XFree86: xc/extras/Mesa/src/mmath.h,v 1.7 2000/09/24 13:50:14 alanh Exp $ */
/*
* Faster arithmetic functions. If the FAST_MATH preprocessor symbol is
@@ -47,7 +47,7 @@
* In the worst case, we force the compiler to use a memory access to
* truncate the float, by specifying the 'volatile' keyword.
*/
-#if defined(__linux__) && defined(__i386__)
+#if defined(__linux__) && defined(__i386__)
#include <fpu_control.h>
#if !defined(_FPU_SETCW)
@@ -232,14 +232,14 @@ do { \
* GLubyte b = FloatToInt(CLAMP(f, 0, 1) * 255)
*/
-#if defined(__i386__) || defined(__sparc__)
+#if defined(__i386__) || defined(__sparc__) || ( defined(__alpha__) && \
+ ( defined( __IEEE_FLOAT ) || !defined( VMS ) ) )
#define USE_IEEE
+#define IEEE_ONE 0x3f7f0000
#endif
#if defined(USE_IEEE) && !defined(DEBUG)
-#define IEEE_ONE 0x3f7f0000
-
#define CLAMP_FLOAT_COLOR(f) \
do { \
if (*(GLuint *)&f >= IEEE_ONE) \
diff --git a/xc/extras/Mesa/src/pb.c b/xc/extras/Mesa/src/pb.c
index 78ff5d07e..454882d5b 100644
--- a/xc/extras/Mesa/src/pb.c
+++ b/xc/extras/Mesa/src/pb.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/pb.c,v 1.6 2000/09/26 15:56:32 tsi Exp $ */
/*
@@ -254,17 +254,22 @@ void gl_flush_pb( GLcontext *ctx )
if ((ctx->RasterMask & modBits) || !PB->mono) {
if (ctx->Texture.ReallyEnabled) {
- int texUnit;
+ GLubyte primary_rgba[PB_SIZE][4];
+ GLint texUnit;
+
+ /* must make a copy of primary colors since they may be modified */
+ MEMCPY(primary_rgba, PB->rgba, 4 * PB->count * sizeof(GLubyte));
+
for (texUnit=0;texUnit<MAX_TEXTURE_UNITS;texUnit++) {
- gl_texture_pixels( ctx, texUnit,
- PB->count, PB->s[texUnit], PB->t[texUnit],
- PB->u[texUnit], PB->lambda[texUnit],
- PB->rgba);
+ gl_texture_pixels( ctx, texUnit,
+ PB->count, PB->s[texUnit], PB->t[texUnit],
+ PB->u[texUnit], PB->lambda[texUnit],
+ primary_rgba, PB->rgba );
}
}
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR
- && ctx->Light.Enabled) {
+ && ctx->Light.Enabled && ctx->Texture.ReallyEnabled) {
/* add specular color to primary color */
add_colors( PB->count, PB->rgba, (const GLubyte (*)[3]) PB->spec );
}
diff --git a/xc/extras/Mesa/src/points.c b/xc/extras/Mesa/src/points.c
index 77d1e0de0..cd73dd1c3 100644
--- a/xc/extras/Mesa/src/points.c
+++ b/xc/extras/Mesa/src/points.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/points.c,v 1.6 2000/09/26 15:56:32 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -358,7 +358,7 @@ textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
green = VB->ColorPtr->data[i][1];
blue = VB->ColorPtr->data[i][2];
alpha = VB->ColorPtr->data[i][3];
-
+
switch (VB->TexCoordPtr[0]->size) {
case 4:
s = VB->TexCoordPtr[0]->data[i][0]/VB->TexCoordPtr[0]->data[i][3];
@@ -386,15 +386,13 @@ textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
gl_problem(ctx, "unexpected texcoord size in textured_rgba_points()");
}
-/* don't think this is needed
- PB_SET_COLOR( red, green, blue, alpha );
-*/
-
for (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) {
- PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u );
+ PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha,
+ s, t, u );
}
}
+
PB_CHECK_FLUSH(ctx, PB);
}
}
@@ -417,6 +415,7 @@ multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
GLint ix, iy;
GLint radius;
GLint red, green, blue, alpha;
+ GLint sRed, sGreen, sBlue;
GLfloat s, t, u;
GLfloat s1, t1, u1;
@@ -449,6 +448,9 @@ multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
green = VB->ColorPtr->data[i][1];
blue = VB->ColorPtr->data[i][2];
alpha = VB->ColorPtr->data[i][3];
+ sRed = VB->Specular ? VB->Specular[i][0] : 0;
+ sGreen = VB->Specular ? VB->Specular[i][1] : 0;
+ sBlue = VB->Specular ? VB->Specular[i][2] : 0;
switch (VB->TexCoordPtr[0]->size) {
case 4:
@@ -506,8 +508,10 @@ multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
for (iy=y0;iy<=y1;iy++) {
for (ix=x0;ix<=x1;ix++) {
- PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha,
- s, t, u, s1, t1, u1 );
+ PB_WRITE_MULTITEX_SPEC_PIXEL( PB, ix, iy, z,
+ red, green, blue, alpha,
+ sRed, sGreen, sBlue,
+ s, t, u, s1, t1, u1 );
}
}
PB_CHECK_FLUSH(ctx, PB);
@@ -516,6 +520,17 @@ multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
}
+/*
+ * NOTES on aa point rasterization:
+ *
+ * Let d = distance of fragment center from vertex.
+ * if d < rmin2 then
+ * fragment has 100% coverage
+ * else if d > rmax2 then
+ * fragment has 0% coverage
+ * else
+ * fragement has % coverage = (d - rmin2) / (rmax2 - rmin2)
+ */
/*
@@ -529,7 +544,7 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
const GLfloat radius = ctx->Point.Size * 0.5F;
const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
const GLfloat rmax = radius + 0.7071F;
- const GLfloat rmin2 = rmin * rmin;
+ const GLfloat rmin2 = MAX2(0.0, rmin * rmin);
const GLfloat rmax2 = rmax * rmax;
const GLfloat cscale = 256.0F / (rmax2 - rmin2);
GLuint i;
@@ -539,13 +554,15 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
if (VB->ClipMask[i] == 0) {
GLint x, y;
GLint red, green, blue, alpha;
- GLfloat s, t, u;
- GLfloat s1, t1, u1;
-
- GLint xmin = (GLint) (VB->Win.data[i][0] - radius);
- GLint xmax = (GLint) (VB->Win.data[i][0] + radius);
- GLint ymin = (GLint) (VB->Win.data[i][1] - radius);
- GLint ymax = (GLint) (VB->Win.data[i][1] + radius);
+ GLfloat s = 0.0F, t = 0.0F, u = 0.0F;
+ GLfloat s1 = 0.0F, t1 = 0.0F, u1 = 0.0F;
+ GLfloat vx = VB->Win.data[i][0];
+ GLfloat vy = VB->Win.data[i][1];
+
+ GLint xmin = (GLint) (vx - radius);
+ GLint xmax = (GLint) (vx + radius);
+ GLint ymin = (GLint) (vy - radius);
+ GLint ymax = (GLint) (vy + radius);
GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
red = VB->ColorPtr->data[i][0];
@@ -616,15 +633,19 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
}
}
- for (y=ymin;y<=ymax;y++) {
- for (x=xmin;x<=xmax;x++) {
- GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
- GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
- GLfloat dist2 = dx*dx + dy*dy;
- if (dist2<rmax2) {
+ /* translate by a half pixel to simplify math below */
+ vx -= 0.5F;
+ vx -= 0.5F;
+
+ for (y = ymin; y <= ymax; y++) {
+ for (x = xmin; x <= xmax; x++) {
+ const GLfloat dx = x - vx;
+ const GLfloat dy = y - vy;
+ const GLfloat dist2 = dx*dx + dy*dy;
+ if (dist2 < rmax2) {
alpha = VB->ColorPtr->data[i][3];
- if (dist2>=rmin2) {
- GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
+ if (dist2 >= rmin2) {
+ GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale);
/* coverage is in [0,256] */
alpha = (alpha * coverage) >> 8;
}
@@ -651,25 +672,29 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
GLint x, y, z;
GLint red, green, blue, alpha;
- xmin = (GLint) (VB->Win.data[i][0] - radius);
- xmax = (GLint) (VB->Win.data[i][0] + radius);
- ymin = (GLint) (VB->Win.data[i][1] - radius);
- ymax = (GLint) (VB->Win.data[i][1] + radius);
+ xmin = (GLint) (VB->Win.data[i][0] - 0.0 - radius);
+ xmax = (GLint) (VB->Win.data[i][0] - 0.0 + radius);
+ ymin = (GLint) (VB->Win.data[i][1] - 0.0 - radius);
+ ymax = (GLint) (VB->Win.data[i][1] - 0.0 + radius);
z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
red = VB->ColorPtr->data[i][0];
green = VB->ColorPtr->data[i][1];
blue = VB->ColorPtr->data[i][2];
- for (y=ymin;y<=ymax;y++) {
- for (x=xmin;x<=xmax;x++) {
- GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
- GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
- GLfloat dist2 = dx*dx + dy*dy;
- if (dist2<rmax2) {
+ /*
+ printf("point %g, %g\n", VB->Win.data[i][0], VB->Win.data[i][1]);
+ printf("%d..%d X %d..%d\n", xmin, xmax, ymin, ymax);
+ */
+ for (y = ymin; y <= ymax; y++) {
+ for (x = xmin; x <= xmax; x++) {
+ const GLfloat dx = x + 0.5F - VB->Win.data[i][0];
+ const GLfloat dy = y + 0.5F - VB->Win.data[i][1];
+ const GLfloat dist2 = dx*dx + dy*dy;
+ if (dist2 < rmax2) {
alpha = VB->ColorPtr->data[i][3];
- if (dist2>=rmin2) {
- GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
+ if (dist2 >= rmin2) {
+ GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale);
/* coverage is in [0,256] */
alpha = (alpha * coverage) >> 8;
}
@@ -936,8 +961,8 @@ dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
GLint ix, iy;
GLint isize, radius;
GLint red, green, blue, alpha;
- GLfloat s, t, u;
- GLfloat s1, t1, u1;
+ GLfloat s = 0.0F, t = 0.0F, u = 0.0F;
+ GLfloat s1 = 0.0F, t1 = 0.0F, u1 = 0.0F;
GLint x = (GLint) VB->Win.data[i][0];
GLint y = (GLint) VB->Win.data[i][1];
@@ -1084,8 +1109,8 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
GLint xmin, ymin, xmax, ymax;
GLint x, y, z;
GLint red, green, blue, alpha;
- GLfloat s, t, u;
- GLfloat s1, t1, u1;
+ GLfloat s = 0.0F, t = 0.0F, u = 0.0F;
+ GLfloat s1 = 0.0F, t1 = 0.0F, u1 = 0.0F;
GLfloat dsize = psize * dist[i];
if (dsize >= ctx->Point.Threshold) {
@@ -1099,9 +1124,9 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
}
rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
rmax = radius + 0.7071F;
- rmin2 = rmin*rmin;
- rmax2 = rmax*rmax;
- cscale = 256.0F / (rmax2-rmin2);
+ rmin2 = MAX2(0.0, rmin * rmin);
+ rmax2 = rmax * rmax;
+ cscale = 256.0F / (rmax2 - rmin2);
xmin = (GLint) (VB->Win.data[i][0] - radius);
xmax = (GLint) (VB->Win.data[i][0] + radius);
@@ -1179,9 +1204,9 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
for (y = ymin; y <= ymax; y++) {
for (x = xmin; x <= xmax; x++) {
- GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
- GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
- GLfloat dist2 = dx*dx + dy*dy;
+ const GLfloat dx = x + 0.5F - VB->Win.data[i][0];
+ const GLfloat dy = y + 0.5F - VB->Win.data[i][1];
+ const GLfloat dist2 = dx*dx + dy*dy;
if (dist2 < rmax2) {
alpha = VB->ColorPtr->data[i][3];
if (dist2 >= rmin2) {
@@ -1225,7 +1250,7 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
}
rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
rmax = radius + 0.7071F;
- rmin2 = rmin * rmin;
+ rmin2 = MAX2(0.0, rmin * rmin);
rmax2 = rmax * rmax;
cscale = 256.0F / (rmax2 - rmin2);
@@ -1241,9 +1266,9 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
for (y = ymin; y <= ymax; y++) {
for (x = xmin; x <= xmax; x++) {
- GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
- GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
- GLfloat dist2 = dx * dx + dy * dy;
+ const GLfloat dx = x + 0.5F - VB->Win.data[i][0];
+ const GLfloat dy = y + 0.5F - VB->Win.data[i][1];
+ const GLfloat dist2 = dx * dx + dy * dy;
if (dist2 < rmax2) {
alpha = VB->ColorPtr->data[i][3];
if (dist2 >= rmin2) {
@@ -1324,7 +1349,8 @@ void gl_set_point_function( GLcontext *ctx )
ctx->Driver.PointsFunc = antialiased_rgba_points;
}
else if (ctx->Texture.ReallyEnabled) {
- if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
+ if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D ||
+ ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
ctx->Driver.PointsFunc = multitextured_rgba_points;
}
else {
diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c
index 4f4ad90a3..4e5e11985 100644
--- a/xc/extras/Mesa/src/readpix.c
+++ b/xc/extras/Mesa/src/readpix.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/readpix.c,v 1.6 2000/09/26 15:56:33 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -638,7 +638,8 @@ static void read_rgba_pixels( GLcontext *ctx,
return;
}
- if (!_mesa_is_legal_format_and_type(format, type)) {
+ if (!_mesa_is_legal_format_and_type(format, type) ||
+ format == GL_INTENSITY) {
gl_error(ctx, GL_INVALID_OPERATION, "glReadPixels(format or type)");
return;
}
diff --git a/xc/extras/Mesa/src/rect.c b/xc/extras/Mesa/src/rect.c
index 4acaf6770..5a54a072b 100644
--- a/xc/extras/Mesa/src/rect.c
+++ b/xc/extras/Mesa/src/rect.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/rect.c,v 1.5 2000/09/26 15:56:33 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -43,13 +43,6 @@
void
_mesa_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
- /*
- * TODO: we could examine a bunch of state variables and ultimately
- * call the Driver->RectFunc() function to draw a screen-aligned
- * filled rectangle. Someday...
- *
- * KW: What happens to cull mode here?
- */
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx, "glRect");
RESET_IMMEDIATE(ctx);
@@ -59,6 +52,16 @@ _mesa_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
gl_Vertex2f( ctx, x2, y2 );
gl_Vertex2f( ctx, x1, y2 );
gl_End( ctx );
+
+ /* If compiling, flush these vertices so that they aren't saved
+ * by the normal vertex compilation methods.
+ */
+ if (ctx->CompileFlag)
+ {
+ ctx->CompileFlag = 0;
+ ctx->input->maybe_transform_vb( ctx->input );
+ ctx->CompileFlag = GL_TRUE;
+ }
}
diff --git a/xc/extras/Mesa/src/render_tmp.h b/xc/extras/Mesa/src/render_tmp.h
index 572a06c8c..b7a23b056 100644
--- a/xc/extras/Mesa/src/render_tmp.h
+++ b/xc/extras/Mesa/src/render_tmp.h
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/render_tmp.h,v 1.6 2000/09/26 15:56:33 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -210,13 +211,15 @@ static void TAG(render_vb_poly)( struct vertex_buffer *VB,
RENDER_TRI( start, j-1, j, start, 0 );
EDGEFLAG_POLY_TRI_POST( start, j-1, j, start );
}
+ if (VB->Flag[count] & VERT_END) {
+ RESET_STIPPLE;
+ }
}
else {
for (j=start+2;j<count;j++) {
RENDER_TRI( start, j-1, j, start, 0 );
}
}
- RESET_STIPPLE;
POSTFIX;
}
diff --git a/xc/extras/Mesa/src/shade.c b/xc/extras/Mesa/src/shade.c
index 97ddf37ac..0d794dcdf 100644
--- a/xc/extras/Mesa/src/shade.c
+++ b/xc/extras/Mesa/src/shade.c
@@ -22,8 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
-
+/* $XFree86: xc/extras/Mesa/src/shade.c,v 1.5 2000/09/26 15:56:33 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -39,29 +38,39 @@
#endif
+/* Lerp between adjacent values in the f(x) lookup table, giving a
+ * continuous function, with adequeate overall accuracy. (Though
+ * still pretty good compared to a straight lookup).
+ */
+#define GET_SHINE_TAB_ENTRY( table, dp, result ) \
+do { \
+ struct gl_shine_tab *_tab = table; \
+ if (dp>1.0) \
+ result = pow( dp, _tab->shininess ); \
+ else { \
+ float f = (dp * (SHINE_TABLE_SIZE-1)); \
+ int k = (int) f; \
+ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \
+ } \
+} while (0)
-#define GET_SHINE_TAB_ENTRY( tab, dp, result ) \
-do { \
- int k = (int) (dp * SHINE_TABLE_SIZE); \
- result = tab->tab[k]; \
-} while(0)
-
-
/* Combinatorics:
- * rgba_spec/rgba/rgba_fast/ci
+ * rgba_spec/rgba/rgba_fast/rgba_fast_single/ci
* one_side/two_side
* compacted_normals/ordinary_normals
* cull_mask/no_cull_mask
- *
- * We end up with an award-winning 32 seperate lighting functions.
*/
/* Table of all the shading functions.
*/
-gl_shade_func gl_shade_func_tab[0x20];
+gl_shade_func gl_shade_tab[0x10];
+gl_shade_func gl_shade_fast_tab[0x10];
+gl_shade_func gl_shade_fast_single_tab[0x10];
+gl_shade_func gl_shade_spec_tab[0x10];
+gl_shade_func gl_shade_ci_tab[0x10];
/* The original case where the normal for vertex[j] is normal[j],
@@ -190,28 +199,32 @@ void gl_init_shade( void )
void gl_update_lighting_function( GLcontext *ctx )
{
- GLuint idx;
+ gl_shade_func *tab;
if (ctx->Visual->RGBAflag) {
if (ctx->Light.NeedVertices) {
if (ctx->Texture.Enabled &&
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
- idx = SHADE_RGBA_SPEC;
+ tab = gl_shade_spec_tab;
else
- idx = SHADE_RGBA_VERTICES;
+ tab = gl_shade_tab;
}
- else
- idx = SHADE_RGBA_NORMALS;
+ else {
+ if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev &&
+ !ctx->Light.ColorMaterialEnabled)
+ tab = gl_shade_fast_single_tab;
+ else
+ tab = gl_shade_fast_tab;
+ }
}
else
- idx = 0;
+ tab = gl_shade_ci_tab;
if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- idx |= SHADE_TWOSIDE;
+ tab += SHADE_TWOSIDE;
}
-
- ctx->shade_func_flags = idx;
+ ctx->shade_func_tab = tab;
}
@@ -326,13 +339,7 @@ void gl_shade_rastpos( GLcontext *ctx,
shininess *= .5;
}
- if (n_dot_h>1.0) {
- spec_coef = (GLfloat) pow( n_dot_h, shininess );
- }
- else {
- struct gl_shine_tab *tab = ctx->ShineTable[0];
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
- }
+ GET_SHINE_TAB_ENTRY( ctx->ShineTable[0], n_dot_h, spec_coef );
if (spec_coef > 1.0e-10) {
ACC_SCALE_SCALAR_3V( contrib, spec_coef,
diff --git a/xc/extras/Mesa/src/shade_tmp.h b/xc/extras/Mesa/src/shade_tmp.h
index 189a91d4f..72a7f2d82 100644
--- a/xc/extras/Mesa/src/shade_tmp.h
+++ b/xc/extras/Mesa/src/shade_tmp.h
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.3
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 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"),
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/shade_tmp.h,v 1.6 2000/09/26 15:56:33 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -38,8 +39,6 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
GLuint vstride = VB->Unprojected->stride;
const GLfloat *vertex = VB->Unprojected->start;
- GLuint vertex_size = VB->Unprojected->size;
-
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = VB->NormalPtr->start;
CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3]) VB->NormalPtr->start;
@@ -82,8 +81,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
VB->Specular = VB->Spec[0];
- for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL)
- {
+ for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL) {
GLfloat sum[2][3], spec[2][3];
struct gl_light *light;
@@ -127,12 +125,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
else {
GLfloat d; /* distance from vertex to light */
- if (vertex_size == 2) {
- SUB_2V(VP, light->Position, vertex);
- VP[2] = light->Position[2];
- } else {
- SUB_3V(VP, light->Position, vertex);
- }
+ SUB_3V(VP, light->Position, vertex);
d = (GLfloat) LEN_3FV( VP );
@@ -146,8 +139,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
light->QuadraticAttenuation));
/* spotlight attenuation */
- if (light->Flags & LIGHT_SPOT)
- {
+ if (light->Flags & LIGHT_SPOT) {
GLfloat PV_dot_dir = - DOT3(VP, light->NormDirection);
if (PV_dot_dir<light->CosCutoff) {
@@ -181,7 +173,8 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
side = 1;
correction = -1;
n_dot_VP = -n_dot_VP;
- } else {
+ }
+ else {
if (LIGHT_REAR(*mask)) {
ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->MatAmbient[1]);
}
@@ -204,7 +197,6 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
if (ctx->Light.Model.LocalViewer) {
GLfloat v[3];
COPY_3V(v, vertex);
- if (vertex_size == 2) v[2] = 0;
NORMALIZE_3FV(v);
SUB_3V(VP, VP, v); /* h = VP + VPe */
h = VP;
@@ -214,15 +206,15 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
h = VP;
ACC_3V(h, ctx->EyeZDir);
normalized = 0;
- } else {
+ }
+ else {
h = light->h_inf_norm;
normalized = 1;
}
n_dot_h = correction * DOT3(normal, h);
- if (n_dot_h > 0.0F)
- {
+ if (n_dot_h > 0.0F) {
GLfloat spec_coef;
struct gl_shine_tab *tab = ctx->ShineTable[side];
@@ -232,11 +224,8 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
tab = ctx->ShineTable[side+2];
}
- if (n_dot_h>1.0) {
- spec_coef = (GLfloat) pow( n_dot_h, tab->shininess );
- } else
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
-
+ GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
+
if (spec_coef > 1.0e-10) {
spec_coef *= attenuation;
ACC_SCALE_SCALAR_3V( spec[side], spec_coef,
@@ -276,8 +265,6 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
GLuint vstride = VB->Unprojected->stride;
const GLfloat *vertex = (GLfloat *)VB->Unprojected->start;
- GLuint vertex_size = VB->Unprojected->size;
-
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = VB->NormalPtr->start;
CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3])VB->NormalPtr->start;
@@ -312,8 +299,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
VB->Color[0] = VB->LitColor[0];
VB->Color[1] = VB->LitColor[1];
- for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL)
- {
+ for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL) {
GLfloat sum[2][3];
struct gl_light *light;
@@ -354,13 +340,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
GLfloat d; /* distance from vertex to light */
- /* KW: fix me */
- if (vertex_size == 2) {
- SUB_2V(VP, light->Position, vertex);
- VP[2] = light->Position[2];
- } else {
- SUB_3V(VP, light->Position, vertex);
- }
+ SUB_3V(VP, light->Position, vertex);
d = LEN_3FV( VP );
@@ -368,14 +348,13 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
GLfloat invd = 1.0F / d;
SELF_SCALE_SCALAR_3V(VP, invd);
}
-/* if (light->Flags & LIGHT_ATTENUATED) */
- attenuation = 1.0F / (light->ConstantAttenuation + d *
- (light->LinearAttenuation + d *
- light->QuadraticAttenuation));
+
+ attenuation = 1.0F / (light->ConstantAttenuation + d *
+ (light->LinearAttenuation + d *
+ light->QuadraticAttenuation));
/* spotlight attenuation */
- if (light->Flags & LIGHT_SPOT)
- {
+ if (light->Flags & LIGHT_SPOT) {
GLfloat PV_dot_dir = - DOT3(VP, light->NormDirection);
if (PV_dot_dir<light->CosCutoff) {
@@ -410,7 +389,8 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
side = 1;
correction = -1;
n_dot_VP = -n_dot_VP;
- } else {
+ }
+ else {
if (LIGHT_REAR(*mask)) {
ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->MatAmbient[1]);
}
@@ -426,12 +406,10 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->MatDiffuse[side]);
/* specular term - cannibalize VP... */
- if (light->IsMatSpecular[side])
- {
+ if (light->IsMatSpecular[side]) {
if (ctx->Light.Model.LocalViewer) {
GLfloat v[3];
COPY_3V(v, vertex);
- if (vertex_size == 2) v[2] = 0;
NORMALIZE_3FV(v);
SUB_3V(VP, VP, v); /* h = VP + VPe */
h = VP;
@@ -441,7 +419,8 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
h = VP;
ACC_3V(h, ctx->EyeZDir);
normalized = 0;
- } else {
+ }
+ else {
h = light->h_inf_norm;
normalized = 1;
}
@@ -459,11 +438,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
tab = ctx->ShineTable[side+2];
}
- if (n_dot_h>1.0) {
- spec_coef = pow( n_dot_h, tab->shininess );
- } else {
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
- }
+ GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
ACC_SCALE_SCALAR_3V( contrib, spec_coef,
light->MatSpecular[side]);
@@ -494,12 +469,129 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB )
+/* As below, but with just a single light and no colormaterial.
+ */
+static void TAG(shade_fast_rgba_single)( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+ GLuint nstride = VB->NormalPtr->stride;
+ const GLfloat *normal = VB->NormalPtr->start;
+ CONST GLfloat (*first_normal)[3] =
+ (CONST GLfloat (*)[3])VB->NormalPtr->start;
+ GLubyte (*Fcolor)[4] = (GLubyte (*)[4])VB->LitColor[0]->start;
+ GLubyte (*Bcolor)[4] = (GLubyte (*)[4])VB->LitColor[1]->start;
+ GLubyte *mask = VB->NormCullStart;
+ struct gl_light *light = ctx->Light.EnabledList.next;
+ GLubyte *cullmask = mask;
+ GLuint *flags = VB->Flag + VB->Start;
+ GLubyte baseubyte[2][4];
+ GLuint j = 0;
+ struct gl_material (*new_material)[2] = VB->Material + VB->Start;
+ GLuint *new_material_mask = VB->MaterialMask + VB->Start;
+ GLfloat base[2][3];
+
+ (void) cullmask;
+ (void) first_normal;
+ (void) nstride;
+
+ if ( flags[j] & VERT_MATERIAL )
+ gl_update_material( ctx, new_material[j], new_material_mask[j] );
+
+ /* No attenuation, so incoporate MatAmbient into base color.
+ */
+ {
+ COPY_3V(base[0], light->MatAmbient[0]);
+ ACC_3V(base[0], ctx->Light.BaseColor[0] );
+ FLOAT_RGB_TO_UBYTE_RGB( baseubyte[0], base[0] );
+ baseubyte[0][3] = ctx->Light.BaseAlpha[0];
+
+ if (NR_SIDES == 2) {
+ COPY_3V(base[1], light->MatAmbient[1]);
+ ACC_3V(base[1], ctx->Light.BaseColor[1]);
+ FLOAT_RGB_TO_UBYTE_RGB( baseubyte[1], base[1]);
+ baseubyte[1][3] = ctx->Light.BaseAlpha[1];
+ }
+ }
+
+ VB->ColorPtr = VB->LitColor[0];
+ VB->Color[0] = VB->LitColor[0];
+ VB->Color[1] = VB->LitColor[1];
+
+ do {
+ do {
+ if ( !CULL(*mask) ) {
+ GLfloat n_dot_VP = DOT3(normal, light->VP_inf_norm);
+
+ COPY_4UBV(Fcolor[j], baseubyte[0]);
+ if (NR_SIDES == 2) COPY_4UBV(Bcolor[j], baseubyte[1]);
+
+ if (n_dot_VP < 0.0F) {
+ if (LIGHT_REAR(*mask)) {
+ GLfloat n_dot_h = -DOT3(normal, light->h_inf_norm);
+ if (n_dot_h > 0.0F) {
+ GLfloat spec, sum[3];
+ GET_SHINE_TAB_ENTRY( ctx->ShineTable[1], n_dot_h, spec );
+ COPY_3V(sum, base[1]);
+ ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->MatDiffuse[1]);
+ ACC_SCALE_SCALAR_3V(sum, spec, light->MatSpecular[1]);
+ FLOAT_RGB_TO_UBYTE_RGB(Bcolor[j], sum );
+ }
+ }
+ } else {
+ if (LIGHT_FRONT(*mask)) {
+ GLfloat n_dot_h = DOT3(normal, light->h_inf_norm);
+ if (n_dot_h > 0.0F) {
+ GLfloat spec, sum[3];
+ GET_SHINE_TAB_ENTRY( ctx->ShineTable[0], n_dot_h, spec );
+ COPY_3V(sum, base[0]);
+ ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->MatDiffuse[0]);
+ ACC_SCALE_SCALAR_3V(sum, spec, light->MatSpecular[0]);
+ FLOAT_RGB_TO_UBYTE_RGB(Fcolor[j], sum );
+ }
+ }
+ }
+ }
+ j++;
+ NEXT_NORMAL;
+ } while ((flags[j] & (VERT_MATERIAL|VERT_END_VB|VERT_NORM)) == VERT_NORM);
+
+
+ if (COMPACTED) {
+ GLuint last = j-1;
+ for ( ; !(flags[j] & (VERT_MATERIAL|VERT_END_VB|VERT_NORM)) ; j++ ) {
+ COPY_4UBV(Fcolor[j], Fcolor[last]);
+ if (NR_SIDES==2)
+ COPY_4UBV(Bcolor[j], Bcolor[last]);
+ }
+ NEXT_NORMAL;
+ }
+
+ /* Have to recompute our base colors on material change.
+ */
+ if ( flags[j] & VERT_MATERIAL ) {
+ gl_update_material( ctx, new_material[j], new_material_mask[j] );
+
+ COPY_3V(base[0], light->MatAmbient[0]);
+ ACC_3V(base[0], ctx->Light.BaseColor[0] );
+ FLOAT_RGB_TO_UBYTE_RGB( baseubyte[0], base[0] );
+
+ if (NR_SIDES == 2) {
+ COPY_3V(base[1], light->MatAmbient[1]);
+ ACC_3V(base[1], ctx->Light.BaseColor[1]);
+ FLOAT_RGB_TO_UBYTE_RGB( baseubyte[1], base[1]);
+ }
+ }
+
+ } while (!(flags[j] & VERT_END_VB));
+}
+
+
/* Vertex size doesn't matter - yay!
*/
static void TAG(shade_fast_rgba)( struct vertex_buffer *VB )
{
GLcontext *ctx = VB->ctx;
- GLfloat (*base)[3] = ctx->Light.BaseColor;
+ GLfloat base[2][3];
GLubyte *sumA = ctx->Light.BaseAlpha;
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = VB->NormalPtr->start;
@@ -515,6 +607,7 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB )
GLuint j = 0;
struct gl_material (*new_material)[2] = VB->Material + VB->Start;
GLuint *new_material_mask = VB->MaterialMask + VB->Start;
+ struct gl_light *light;
(void) cullmask;
(void) first_normal;
@@ -534,19 +627,20 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB )
}
+ if ( flags[j] & VERT_MATERIAL )
+ gl_update_material( ctx, new_material[j], new_material_mask[j] );
+
+ COPY_3V(base[0], ctx->Light.BaseColor[0]);
+ if (NR_SIDES == 2) COPY_3V(base[1], ctx->Light.BaseColor[1]);
+
interesting = cm_flags | VERT_MATERIAL | VERT_END_VB | VERT_NORM;
VB->ColorPtr = VB->LitColor[0];
VB->Color[0] = VB->LitColor[0];
VB->Color[1] = VB->LitColor[1];
- if ( flags[j] & VERT_MATERIAL )
- gl_update_material( ctx, new_material[j], new_material_mask[j] );
-
do {
do {
- if ( !CULL(*mask) )
- {
- struct gl_light *light;
+ if ( !CULL(*mask) ) {
GLfloat sum[2][3];
GLfloat spec;
@@ -563,14 +657,18 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB )
GLfloat n_dot_h;
GLint side = 0;
GLfloat n_dot_VP = DOT3(normal, light->VP_inf_norm);
-
+
+ ACC_3V(sum[0], light->MatAmbient[0]);
+ if (NR_SIDES == 2) ACC_3V(sum[1], light->MatAmbient[1]);
+
if (n_dot_VP < 0.0F) {
if ( !LIGHT_REAR(*mask) ) continue;
ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->MatDiffuse[1]);
if (!light->IsMatSpecular[1]) continue;
n_dot_h = -DOT3(normal, light->h_inf_norm);
side = 1;
- } else {
+ }
+ else {
if ( !LIGHT_FRONT(*mask) ) continue;
ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->MatDiffuse[0]);
if (!light->IsMatSpecular[0]) continue;
@@ -579,11 +677,7 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB )
if (n_dot_h > 0.0F) {
struct gl_shine_tab *tab = ctx->ShineTable[side];
- if (n_dot_h > 1.0)
- spec = pow( n_dot_h, tab->shininess );
- else
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
-
+ GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
ACC_SCALE_SCALAR_3V( sum[side], spec,
light->MatSpecular[side]);
}
@@ -646,8 +740,6 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
GLcontext *ctx = VB->ctx;
GLuint vstride = VB->Unprojected->stride;
const GLfloat *vertex = (GLfloat *)VB->Unprojected->start;
- GLuint vertex_size = VB->Unprojected->size;
-
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = VB->NormalPtr->start;
CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3])VB->NormalPtr->start;
@@ -686,8 +778,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
CMcolor = (GLubyte (*)[4])VB->ColorPtr->start;
}
- for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL)
- {
+ for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL) {
GLfloat diffuse[2], specular[2];
GLuint side = 0;
struct gl_light *light;
@@ -724,12 +815,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
else {
GLfloat d; /* distance from vertex to light */
- if (vertex_size == 2) {
- SUB_2V(VP, light->Position, vertex);
- VP[2] = light->Position[2];
- } else {
- SUB_3V(VP, light->Position, vertex);
- }
+ SUB_3V(VP, light->Position, vertex);
d = LEN_3FV( VP );
if ( d > 1e-6) {
@@ -742,8 +828,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
light->QuadraticAttenuation));
/* spotlight attenuation */
- if (light->Flags & LIGHT_SPOT)
- {
+ if (light->Flags & LIGHT_SPOT) {
GLfloat PV_dot_dir = - DOT3(VP, light->NormDirection);
if (PV_dot_dir<light->CosCutoff) {
continue; /* this light makes no contribution */
@@ -770,7 +855,8 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
side = 1;
correction = -1;
n_dot_VP = -n_dot_VP;
- } else {
+ }
+ else {
if (!LIGHT_FRONT(*mask))
continue;
}
@@ -785,7 +871,6 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
if (ctx->Light.Model.LocalViewer) {
GLfloat v[3];
COPY_3V(v, vertex);
- if (vertex_size == 2) v[2] = 0;
NORMALIZE_3FV(v);
SUB_3V(VP, VP, v); /* h = VP + VPe */
h = VP;
@@ -795,7 +880,8 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
h = VP;
ACC_3V(h, ctx->EyeZDir);
normalized = 0;
- } else {
+ }
+ else {
h = light->h_inf_norm;
normalized = 1;
}
@@ -813,18 +899,14 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
tab = ctx->ShineTable[side+2];
}
- if (n_dot_h>1.0) {
- spec_coef = pow( n_dot_h, tab->shininess );
- } else {
- GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef);
- }
+ GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef);
+
specular[side] += spec_coef * light->sli * attenuation;
}
} /*loop over lights*/
/* Now compute final color index */
- for (side = 0 ; side < NR_SIDES ; side++)
- {
+ for (side = 0 ; side < NR_SIDES ; side++) {
GLfloat index;
struct gl_material *mat;
@@ -850,22 +932,22 @@ static void TAG(shade_ci)( struct vertex_buffer *VB )
}
} /*for vertex*/
- if ( flags[j] & cm_flags )
- gl_update_color_material( ctx, CMcolor[j] );
+ if ( flags[j] & cm_flags )
+ gl_update_color_material( ctx, CMcolor[j] );
- if ( flags[j] & VERT_MATERIAL )
- gl_update_material( ctx, new_material[j], new_material_mask[j] );
-
+ if ( flags[j] & VERT_MATERIAL )
+ gl_update_material( ctx, new_material[j], new_material_mask[j] );
}
static void TAG(init_shade_tab)( void )
{
- gl_shade_func_tab[IDX|SHADE_RGBA_VERTICES] = TAG(shade_rgba);
- gl_shade_func_tab[IDX|SHADE_RGBA_NORMALS] = TAG(shade_fast_rgba);
- gl_shade_func_tab[IDX|SHADE_RGBA_SPEC] = TAG(shade_rgba_spec);
- gl_shade_func_tab[IDX] = TAG(shade_ci);
+ gl_shade_tab[IDX] = TAG(shade_rgba);
+ gl_shade_fast_tab[IDX] = TAG(shade_fast_rgba);
+ gl_shade_fast_single_tab[IDX] = TAG(shade_fast_rgba_single);
+ gl_shade_spec_tab[IDX] = TAG(shade_rgba_spec);
+ gl_shade_ci_tab[IDX] = TAG(shade_ci);
}
diff --git a/xc/extras/Mesa/src/span.c b/xc/extras/Mesa/src/span.c
index 598834047..3a3ba0633 100644
--- a/xc/extras/Mesa/src/span.c
+++ b/xc/extras/Mesa/src/span.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/span.c,v 1.7 2000/09/26 15:56:33 tsi Exp $ */
/*
* pixel span rasterization:
@@ -151,6 +151,8 @@ static void multi_write_index_span( GLcontext *ctx, GLuint n,
_mesa_logicop_ci_span( ctx, n, x, y, indexTmp, mask );
}
if (ctx->Color.SWmasking) {
+ if (ctx->Color.IndexMask == 0)
+ break;
_mesa_mask_index_span( ctx, n, x, y, indexTmp );
}
(*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask );
@@ -241,6 +243,8 @@ void gl_write_index_span( GLcontext *ctx,
_mesa_logicop_ci_span( ctx, n, x, y, index, mask );
}
if (ctx->Color.SWmasking) {
+ if (ctx->Color.IndexMask == 0)
+ return;
_mesa_mask_index_span( ctx, n, x, y, index );
}
@@ -315,10 +319,6 @@ void gl_write_monoindex_span( GLcontext *ctx,
_mesa_logicop_ci_span( ctx, n, x, y, indexes, mask );
}
- if (ctx->Color.SWmasking) {
- _mesa_mask_index_span( ctx, n, x, y, indexes );
- }
-
if (ctx->RasterMask & MULTI_DRAW_BIT) {
/* draw to zero or two or more buffers */
multi_write_index_span( ctx, n, x, y, indexes, mask );
@@ -329,6 +329,8 @@ void gl_write_monoindex_span( GLcontext *ctx,
_mesa_logicop_ci_span( ctx, n, x, y, indexes, mask );
}
if (ctx->Color.SWmasking) {
+ if (ctx->Color.IndexMask == 0)
+ return;
_mesa_mask_index_span( ctx, n, x, y, indexes );
}
(*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask );
@@ -399,6 +401,8 @@ static void multi_write_rgba_span( GLcontext *ctx, GLuint n,
_mesa_blend_span( ctx, n, x, y, rgbaTmp, mask );
}
if (ctx->Color.SWmasking) {
+ if (*((GLuint *) ctx->Color.ColorMask) == 0)
+ break;
_mesa_mask_rgba_span( ctx, n, x, y, rgbaTmp );
}
@@ -499,9 +503,7 @@ void gl_write_rgba_span( GLcontext *ctx,
ctx->OcclusionResult = GL_TRUE;
if (ctx->RasterMask & MULTI_DRAW_BIT) {
- multi_write_rgba_span( ctx, n, x, y,
- (const GLubyte (*)[4]) rgba,
- write_all ? Null : mask );
+ multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, mask );
}
else {
/* normal: write to exactly one buffer */
@@ -515,6 +517,8 @@ void gl_write_rgba_span( GLcontext *ctx,
/* Color component masking */
if (ctx->Color.SWmasking) {
+ if (*((GLuint *) ctx->Color.ColorMask) == 0)
+ return;
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
@@ -616,8 +620,8 @@ void gl_write_monocolor_span( GLcontext *ctx,
return;
}
- if (ctx->Color.BlendEnabled || ctx->Color.SWLogicOpEnabled
- || ctx->Color.SWmasking) {
+ if (ctx->Color.SWLogicOpEnabled || ctx->Color.SWmasking ||
+ (ctx->RasterMask & (BLEND_BIT | FOG_BIT))) {
/* assign same color to each pixel */
for (i=0;i<n;i++) {
if (mask[i]) {
@@ -625,9 +629,15 @@ void gl_write_monocolor_span( GLcontext *ctx,
}
}
+ /* Per-pixel fog */
+ if (ctx->Fog.Enabled &&
+ (primitive==GL_BITMAP || ctx->FogMode==FOG_FRAGMENT)) {
+ _mesa_fog_rgba_pixels( ctx, n, z, rgba );
+ }
+
if (ctx->RasterMask & MULTI_DRAW_BIT) {
- multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba,
- mask );
+ multi_write_rgba_span( ctx, n, x, y,
+ (const GLubyte (*)[4]) rgba, mask );
}
else {
/* normal: write to exactly one buffer */
@@ -640,6 +650,8 @@ void gl_write_monocolor_span( GLcontext *ctx,
/* Color component masking */
if (ctx->Color.SWmasking) {
+ if (*((GLuint *) ctx->Color.ColorMask) == 0)
+ return;
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
@@ -667,8 +679,7 @@ void gl_write_monocolor_span( GLcontext *ctx,
}
}
multi_write_rgba_span( ctx, n, x, y,
- (const GLubyte (*)[4]) rgba,
- mask );
+ (const GLubyte (*)[4]) rgba, mask );
}
else {
(*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, mask );
@@ -748,7 +759,7 @@ void gl_write_texture_span( GLcontext *ctx,
/* Texture */
ASSERT(ctx->Texture.ReallyEnabled);
- gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba );
+ gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba, rgba );
/* Add base and specular colors */
if (spec && ctx->Light.Enabled
@@ -804,8 +815,7 @@ void gl_write_texture_span( GLcontext *ctx,
ctx->OcclusionResult = GL_TRUE;
if (ctx->RasterMask & MULTI_DRAW_BIT) {
- multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4])rgba,
- write_all ? Null : mask );
+ multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, mask );
}
else {
/* normal: write to exactly one buffer */
@@ -816,6 +826,8 @@ void gl_write_texture_span( GLcontext *ctx,
_mesa_blend_span( ctx, n, x, y, rgba, mask );
}
if (ctx->Color.SWmasking) {
+ if (*((GLuint *) ctx->Color.ColorMask) == 0)
+ return;
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
@@ -864,7 +876,8 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
}
- if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)) {
+ if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)
+ || texUnits > 1) {
/* must make a copy of the colors since they may be modified */
MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte));
rgba = rgbaBackup;
@@ -876,9 +889,8 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
/* Texture */
ASSERT(ctx->Texture.ReallyEnabled);
ASSERT(texUnits <= MAX_TEXTURE_UNITS);
- for (i=0;i<texUnits;i++) {
- gl_texture_pixels( ctx, i, n, s[i], t[i], u[i], lambda[i], rgba );
- }
+ for (i=0;i<texUnits;i++)
+ gl_texture_pixels( ctx, i, n, s[i], t[i], u[i], lambda[i], rgbaIn, rgba );
/* Add base and specular colors */
if (spec && ctx->Light.Enabled
@@ -934,8 +946,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
ctx->OcclusionResult = GL_TRUE;
if (ctx->RasterMask & MULTI_DRAW_BIT) {
- multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba,
- write_all ? Null : mask );
+ multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, mask );
}
else {
/* normal: write to exactly one buffer */
@@ -947,6 +958,8 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
_mesa_blend_span( ctx, n, x, y, rgba, mask );
}
if (ctx->Color.SWmasking) {
+ if (*((GLuint *) ctx->Color.ColorMask) == 0)
+ return;
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
diff --git a/xc/extras/Mesa/src/stages.c b/xc/extras/Mesa/src/stages.c
index 43aff42c2..859aadac5 100644
--- a/xc/extras/Mesa/src/stages.c
+++ b/xc/extras/Mesa/src/stages.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/stages.c,v 1.6 2000/09/26 15:56:33 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -185,11 +185,18 @@ static void clean_texcoord( struct vertex_buffer *VB, GLuint i )
tc->stride = 4 * sizeof(GLfloat);
}
+static void clean_unprojected( struct vertex_buffer *VB )
+{
+ (void) Transform( &VB->Eye,
+ &gl_identity_mat,
+ VB->Unprojected,
+ 0,
+ 0);
+ VB->Unprojected = &VB->Eye;
+}
static void clean_clip( struct vertex_buffer *VB )
{
-/* printf("clean clip, stride %d, not writable\n", VB->ClipPtr->stride); */
-
(void) Transform( &VB->Clip,
&gl_identity_mat,
VB->ClipPtr,
@@ -329,7 +336,11 @@ static void do_vertex_pipeline( struct vertex_buffer *VB )
}
if (VB->ClipAndMask) {
+ if (MESA_VERBOSE&VERBOSE_CULL)
+ fprintf(stderr, "Culled in clip\n");
+
VB->Culled = 1;
+ gl_dont_cull_vb( VB );
gl_update_materials(VB);
return;
}
@@ -344,6 +355,7 @@ static void do_vertex_pipeline( struct vertex_buffer *VB )
if (MESA_VERBOSE&VERBOSE_CULL)
fprintf(stderr, "Culled in userclip\n");
+ gl_dont_cull_vb( VB );
gl_update_materials(VB);
return;
}
@@ -436,12 +448,23 @@ static void do_normal_transform( struct vertex_buffer *VB )
static void do_lighting( struct vertex_buffer *VB )
{
- GLubyte flags = (GLubyte) (VB->CullMode & (CULL_MASK_ACTIVE|COMPACTED_NORMALS));
+ GLubyte flags = (GLubyte) (VB->CullMode &
+ (CULL_MASK_ACTIVE|COMPACTED_NORMALS));
if ((flags&CULL_MASK_ACTIVE) && !VB->NormCullStart)
gl_make_normal_cullmask( VB );
- gl_shade_func_tab[VB->ctx->shade_func_flags | flags]( VB );
+ /* Make sure we can talk about elements 0..2 in the vector we are
+ * lighting.
+ */
+ if (VB->Unprojected->size == 2) {
+ if (VB->Unprojected->flags & VEC_WRITABLE)
+ gl_vector4f_clean_elem(VB->Unprojected, VB->Count, 2);
+ else
+ clean_unprojected( VB );
+ }
+
+ VB->ctx->shade_func_tab[flags]( VB );
}
diff --git a/xc/extras/Mesa/src/state.c b/xc/extras/Mesa/src/state.c
index ccf0d9091..e111b18db 100644
--- a/xc/extras/Mesa/src/state.c
+++ b/xc/extras/Mesa/src/state.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/state.c,v 1.5 2000/09/26 15:56:33 tsi Exp $ */
/*
* This file initializes the immediate-mode dispatch table (which may
@@ -845,17 +845,15 @@ static void update_rasterflags( GLcontext *ctx )
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
}
- else if (ctx->Visual->RGBAflag && ctx->Color.ColorMask==0) {
+ else if (ctx->Visual->RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) {
/* all RGBA channels disabled */
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
- ctx->Color.DrawDestMask = 0;
}
else if (!ctx->Visual->RGBAflag && ctx->Color.IndexMask==0) {
/* all color index bits disabled */
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
- ctx->Color.DrawDestMask = 0;
}
}
@@ -1062,11 +1060,6 @@ void gl_update_state( GLcontext *ctx )
ctx->Polygon.OffsetLine ||
ctx->Polygon.OffsetFill)
ctx->TriangleCaps |= DD_TRI_OFFSET;
-
- /* reset Z offsets now */
- ctx->PointZoffset = 0.0;
- ctx->LineZoffset = 0.0;
- ctx->PolygonZoffset = 0.0;
}
}
@@ -1183,14 +1176,13 @@ void gl_update_state( GLcontext *ctx )
ctx->NeedEyeNormals = GL_FALSE;
if (ctx->Light.Enabled) {
- if (ctx->Light.Flags & LIGHT_POSITIONAL) {
- /* Need length for attenuation */
- if (!TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING))
- ctx->NeedEyeCoords = GL_TRUE;
- } else if (ctx->Light.NeedVertices) {
- /* Need angle for spot calculations */
- if (!TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_ANGLE_PRESERVING))
- ctx->NeedEyeCoords = GL_TRUE;
+ if ((ctx->Light.Flags & LIGHT_POSITIONAL) ||
+ ctx->Light.NeedVertices ||
+ !TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING)) {
+ /* Need length for attenuation or need angle for spotlights
+ * or non-uniform scale matrix
+ */
+ ctx->NeedEyeCoords = GL_TRUE;
}
ctx->NeedEyeNormals = ctx->NeedEyeCoords;
}
diff --git a/xc/extras/Mesa/src/texgen_tmp.h b/xc/extras/Mesa/src/texgen_tmp.h
index 0324493cf..8fe16187f 100644
--- a/xc/extras/Mesa/src/texgen_tmp.h
+++ b/xc/extras/Mesa/src/texgen_tmp.h
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/texgen_tmp.h,v 1.5 2000/09/26 15:56:33 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -290,10 +291,10 @@ static void TAG(texgen_sphere_map)( struct vertex_buffer *VB,
GLfloat (*f)[3], *m;
if (!VB->tmp_f)
- VB->tmp_f = (GLfloat (*)[3])malloc(VB->Size * sizeof(GLfloat) * 3);
+ VB->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3);
if (!VB->tmp_m)
- VB->tmp_m = (GLfloat *)malloc(VB->Size * sizeof(GLfloat));
+ VB->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat));
f = VB->tmp_f;
m = VB->tmp_m;
@@ -349,10 +350,10 @@ static void TAG(texgen)( struct vertex_buffer *VB, GLuint textureUnit )
LOCAL_VARS;
if (!VB->tmp_f)
- VB->tmp_f = (GLfloat (*)[3])malloc(VB->Size * sizeof(GLfloat) * 3);
+ VB->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3);
if (!VB->tmp_m)
- VB->tmp_m = (GLfloat *)malloc(VB->Size * sizeof(GLfloat));
+ VB->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat));
f = VB->tmp_f;
m = VB->tmp_m;
diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c
index c79156370..c92ff7937 100644
--- a/xc/extras/Mesa/src/teximage.c
+++ b/xc/extras/Mesa/src/teximage.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/teximage.c,v 1.9 2000/08/28 02:43:09 tsi Exp $ */
+/* $XFree86: xc/extras/Mesa/src/teximage.c,v 1.10 2000/09/24 13:50:18 alanh Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -139,21 +139,23 @@ logbase2( int n )
GLint
_mesa_base_tex_format( GLcontext *ctx, GLint format )
{
+ /*
+ * Ask the driver for the base format, if it doesn't
+ * know, it will return -1;
+ */
+ if (ctx->Driver.BaseCompressedTexFormat) {
+ GLint ifmt = (*ctx->Driver.BaseCompressedTexFormat)(ctx, format);
+ if (ifmt >= 0) {
+ return ifmt;
+ }
+ }
switch (format) {
- case GL_COMPRESSED_ALPHA_ARB:
- if (ctx && !ctx->Extensions.HaveTextureCompression)
- return -1;
- /* fall-through */
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
return GL_ALPHA;
- case GL_COMPRESSED_LUMINANCE_ARB:
- if (ctx && !ctx->Extensions.HaveTextureCompression)
- return -1;
- /* fall-through */
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE4:
@@ -161,10 +163,6 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format )
case GL_LUMINANCE12:
case GL_LUMINANCE16:
return GL_LUMINANCE;
- case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- if (ctx && !ctx->Extensions.HaveTextureCompression)
- return -1;
- /* fall-through */
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
@@ -174,31 +172,12 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format )
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
return GL_LUMINANCE_ALPHA;
- case GL_COMPRESSED_INTENSITY_ARB:
- if (ctx && !ctx->Extensions.HaveTextureCompression)
- return -1;
- /* fall-through */
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
return GL_INTENSITY;
- case GL_COMPRESSED_RGB_ARB:
- if (ctx && ctx->Extensions.HaveTextureCompression)
- return GL_RGB;
- else
- return -1;
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- if (ctx && ctx->Extensions.HaveTextureCompressionFXT1)
- return GL_RGB;
- else
- return -1;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- if (ctx && ctx->Extensions.HaveTextureCompressionS3TC)
- return GL_RGB;
- else
- return -1;
case 3:
case GL_RGB:
case GL_R3_G3_B2:
@@ -209,23 +188,6 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format )
case GL_RGB12:
case GL_RGB16:
return GL_RGB;
- case GL_COMPRESSED_RGBA_ARB:
- if (ctx && ctx->Extensions.HaveTextureCompression)
- return GL_RGBA;
- else
- return -1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- if (ctx && ctx->Extensions.HaveTextureCompressionFXT1)
- return GL_RGBA;
- else
- return -1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- if (ctx && ctx->Extensions.HaveTextureCompressionS3TC)
- return GL_RGBA;
- else
- return -1;
case 4:
case GL_RGBA:
case GL_RGBA2:
@@ -328,25 +290,12 @@ components_in_intformat( GLint format )
* otherwise.
*/
static GLboolean
-is_compressed_format(GLenum internalFormat)
+is_compressed_format(GLcontext *ctx, GLenum internalFormat)
{
- switch (internalFormat) {
- case GL_COMPRESSED_ALPHA_ARB:
- case GL_COMPRESSED_LUMINANCE_ARB:
- case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- case GL_COMPRESSED_INTENSITY_ARB:
- case GL_COMPRESSED_RGB_ARB:
- case GL_COMPRESSED_RGBA_ARB:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
+ if (ctx->Driver.IsCompressedFormat) {
+ return (*ctx->Driver.IsCompressedFormat)(ctx, internalFormat);
+ }
+ return GL_FALSE;
}
@@ -511,13 +460,14 @@ _mesa_alloc_texture_image( void )
* Initialize most fields of a gl_texture_image struct.
*/
static void
-init_texture_image( struct gl_texture_image *img,
+init_texture_image( GLcontext *ctx,
+ struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat )
{
ASSERT(img);
ASSERT(!img->Data);
- img->Format = (GLenum) _mesa_base_tex_format(NULL, internalFormat);
+ img->Format = (GLenum) _mesa_base_tex_format(ctx, internalFormat);
set_teximage_component_sizes( img );
img->IntFormat = (GLenum) internalFormat;
img->Border = border;
@@ -537,7 +487,7 @@ init_texture_image( struct gl_texture_image *img,
img->Height2 = 1 << img->HeightLog2;
img->Depth2 = 1 << img->DepthLog2;
img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
- img->IsCompressed = is_compressed_format(internalFormat);
+ img->IsCompressed = is_compressed_format(ctx, internalFormat);
}
@@ -556,13 +506,26 @@ _mesa_free_texture_image( struct gl_texture_image *teximage )
/*
* Return number of bytes of storage needed to store a compressed texture
- * image.
+ * image. Only the driver knows for sure. If the driver can't help us,
+ * we must return 0.
*/
GLuint
-_mesa_compressed_image_size(GLenum internalFormat,
- GLint width, GLint height, GLint depth)
+_mesa_compressed_image_size(GLcontext *ctx,
+ GLenum internalFormat,
+ GLint numDimensions,
+ GLint width,
+ GLint height,
+ GLint depth)
{
- return 0;
+ if (ctx->Driver.CompressedImageSize) {
+ return (*ctx->Driver.CompressedImageSize)(ctx, internalFormat,
+ numDimensions,
+ width, height, depth);
+ }
+ else {
+ /* Shouldn't this be an internal error of some sort? */
+ return 0;
+ }
}
@@ -878,6 +841,40 @@ make_null_texture( struct gl_texture_image *texImage )
/*
+ * This is called when a proxy texture test fails, we set all the
+ * image members (except DriverData) to zero.
+ */
+static void
+clear_proxy_teximage(struct gl_texture_image *img)
+{
+ ASSERT(img);
+ img->Format = 0;
+ img->IntFormat = 0;
+ img->RedBits = 0;
+ img->GreenBits = 0;
+ img->BlueBits = 0;
+ img->AlphaBits = 0;
+ img->IntensityBits = 0;
+ img->LuminanceBits = 0;
+ img->IndexBits = 0;
+ img->Border = 0;
+ img->Width = 0;
+ img->Height = 0;
+ img->Depth = 0;
+ img->Width2 = 0;
+ img->Height2 = 0;
+ img->Depth2 = 0;
+ img->WidthLog2 = 0;
+ img->HeightLog2 = 0;
+ img->DepthLog2 = 0;
+ img->Data = NULL;
+ img->IsCompressed = 0;
+ img->CompressedSize = 0;
+}
+
+
+
+/*
* Test glTexImage[123]D() parameters for errors.
* Input:
* dimensions - must be 1 or 2 or 3
@@ -999,7 +996,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
return GL_TRUE;
}
- if (!is_compressed_format(internalFormat)) {
+ if (!is_compressed_format(ctx, internalFormat)) {
if (!_mesa_is_legal_format_and_type( format, type )) {
/* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there
* is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4.
@@ -1125,7 +1122,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
}
}
- if (!is_compressed_format(destTex->IntFormat)) {
+ if (!is_compressed_format(ctx, destTex->IntFormat)) {
if (!_mesa_is_legal_format_and_type(format, type)) {
char message[100];
sprintf(message, "glTexSubImage%dD(format or type)", dimensions);
@@ -1344,6 +1341,105 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
/*
+ * Turn generic compressed formats into specific compressed format.
+ * Some of the compressed formats we don't support, so we
+ * fall back to the uncompressed format. (See issue 15 of
+ * the GL_ARB_texture_compression specification.)
+ */
+static GLint
+get_specific_compressed_tex_format(GLcontext *ctx,
+ GLint ifmt, GLint numDimensions)
+{
+ char message[100];
+ GLint internalFormat = ifmt;
+
+ if (ctx->Extensions.HaveTextureCompression
+ && ctx->Driver.SpecificCompressedTexFormat) {
+ /*
+ * First, ask the driver for the specific format.
+ */
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ case GL_COMPRESSED_INTENSITY_ARB:
+ case GL_COMPRESSED_RGB_ARB:
+ case GL_COMPRESSED_RGBA_ARB:
+ internalFormat = (*ctx->Driver.SpecificCompressedTexFormat)
+ (ctx, internalFormat, numDimensions);
+ /* XXX shouldn't we return now? */
+ break;
+ default:
+ /* silence compiler warnings */
+ ;
+ }
+ }
+
+ /*
+ * Now, convert any generic format left to an uncompressed
+ * specific format. If the driver does not support compression
+ * of the format, we must drop back to the uncompressed format.
+ * See issue 15 of the GL_ARB_texture_compression specification.
+ */
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ if (ctx && !ctx->Extensions.HaveTextureCompression) {
+ sprintf(message, "glTexImage%dD(internalFormat)", numDimensions);
+ gl_error(ctx, GL_INVALID_VALUE, message);
+ return -1;
+ }
+ internalFormat = GL_ALPHA;
+ break;
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ if (ctx && !ctx->Extensions.HaveTextureCompression) {
+ sprintf(message, "glTexImage%dD(internalFormat)", numDimensions);
+ gl_error(ctx, GL_INVALID_VALUE, message);
+ return -1;
+ }
+ internalFormat = GL_LUMINANCE;
+ break;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ if (ctx && !ctx->Extensions.HaveTextureCompression) {
+ sprintf(message, "glTexImage%dD(internalFormat)", numDimensions);
+ gl_error(ctx, GL_INVALID_VALUE, message);
+ return -1;
+ }
+ internalFormat = GL_LUMINANCE_ALPHA;
+ break;
+ case GL_COMPRESSED_INTENSITY_ARB:
+ if (ctx && !ctx->Extensions.HaveTextureCompression) {
+ sprintf(message, "glTexImage%dD(internalFormat)", numDimensions);
+ gl_error(ctx, GL_INVALID_VALUE, message);
+ return -1;
+ }
+ internalFormat = GL_INTENSITY;
+ break;
+ case GL_COMPRESSED_RGB_ARB:
+ if (ctx && !ctx->Extensions.HaveTextureCompression) {
+ sprintf(message, "glTexImage%dD(internalFormat)", numDimensions);
+ gl_error(ctx, GL_INVALID_VALUE, message);
+ return -1;
+ }
+ internalFormat = GL_RGB;
+ break;
+ case GL_COMPRESSED_RGBA_ARB:
+ if (ctx && !ctx->Extensions.HaveTextureCompression) {
+ sprintf(message, "glTexImage%dD(internalFormat)", numDimensions);
+ gl_error(ctx, GL_INVALID_VALUE, message);
+ return -1;
+ }
+ internalFormat = GL_RGBA;
+ break;
+ default:
+ /* silence compiler warning */
+ ;
+ }
+ return internalFormat;
+}
+
+
+
+/*
* Called from the API. Note that width includes the border.
*/
void
@@ -1358,6 +1454,19 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+ GLint ifmt;
+
+ ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 1);
+ if (ifmt < 0) {
+ /*
+ * The error here is that we were sent a generic compressed
+ * format, but the extension is not supported.
+ */
+ return;
+ }
+ else {
+ internalFormat = ifmt;
+ }
if (texture_error_check(ctx, target, level, internalFormat,
format, type, 1, width, 1, 1, border)) {
@@ -1382,7 +1491,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
}
/* setup the teximage struct's fields */
- init_texture_image(texImage, width, 1, 1, border, internalFormat);
+ init_texture_image(ctx, texImage, width, 1, 1, border, internalFormat);
/* process the texture image */
if (pixels) {
@@ -1433,13 +1542,12 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
format, type, 1, width, 1, 1, border)) {
/* if error, clear all proxy texture image parameters */
if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- MEMSET( ctx->Texture.Proxy1D->Image[level], 0,
- sizeof(struct gl_texture_image) );
+ clear_proxy_teximage(ctx->Texture.Proxy1D->Image[level]);
}
}
else {
/* if no error, update proxy texture image parameters */
- init_texture_image(ctx->Texture.Proxy1D->Image[level],
+ init_texture_image(ctx, ctx->Texture.Proxy1D->Image[level],
width, 1, 1, border, internalFormat);
}
}
@@ -1466,6 +1574,19 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+ GLint ifmt;
+
+ ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 2);
+ if (ifmt < 0) {
+ /*
+ * The error here is that we were sent a generic compressed
+ * format, but the extension is not supported.
+ */
+ return;
+ }
+ else {
+ internalFormat = ifmt;
+ }
if (texture_error_check(ctx, target, level, internalFormat,
format, type, 2, width, height, 1, border)) {
@@ -1491,7 +1612,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
}
/* setup the teximage struct's fields */
- init_texture_image(texImage, width, height, 1, border, internalFormat);
+ init_texture_image(ctx, texImage, width, height,
+ 1, border, internalFormat);
/* process the texture image */
if (pixels) {
@@ -1551,13 +1673,13 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
format, type, 2, width, height, 1, border)) {
/* if error, clear all proxy texture image parameters */
if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- MEMSET( ctx->Texture.Proxy2D->Image[level], 0,
- sizeof(struct gl_texture_image) );
+ clear_proxy_teximage(ctx->Texture.Proxy2D->Image[level]);
}
}
else {
/* if no error, update proxy texture image parameters */
- init_texture_image(ctx->Texture.Proxy2D->Image[level],
+ init_texture_image(ctx,
+ ctx->Texture.Proxy2D->Image[level],
width, height, 1, border, internalFormat);
}
}
@@ -1586,6 +1708,20 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+ GLint ifmt;
+
+ ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 3);
+ if (ifmt < 0) {
+ /*
+ * The error here is that we were sent a generic compressed
+ * format, but the extension is not supported.
+ */
+ return;
+ }
+ else {
+ internalFormat = ifmt;
+ }
+
if (texture_error_check(ctx, target, level, internalFormat,
format, type, 3, width, height, depth, border)) {
return; /* error in texture image was detected */
@@ -1609,7 +1745,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
}
/* setup the teximage struct's fields */
- init_texture_image(texImage, width, height, depth,
+ init_texture_image(ctx, texImage, width, height, depth,
border, internalFormat);
/* process the texture image */
@@ -1661,13 +1797,12 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
format, type, 3, width, height, depth, border)) {
/* if error, clear all proxy texture image parameters */
if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- MEMSET( ctx->Texture.Proxy3D->Image[level], 0,
- sizeof(struct gl_texture_image) );
+ clear_proxy_teximage(ctx->Texture.Proxy3D->Image[level]);
}
}
else {
/* if no error, update proxy texture image parameters */
- init_texture_image(ctx->Texture.Proxy3D->Image[level],
+ init_texture_image(ctx, ctx->Texture.Proxy3D->Image[level],
width, height, depth, border, internalFormat);
}
}
@@ -2511,10 +2646,25 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage1DARB");
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ case GL_COMPRESSED_INTENSITY_ARB:
+ case GL_COMPRESSED_RGB_ARB:
+ case GL_COMPRESSED_RGBA_ARB:
+ gl_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1DARB");
+ return;
+ default:
+ /* silence compiler warning */
+ ;
+ }
+
if (target == GL_TEXTURE_1D) {
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+ GLsizei computedImageSize;
if (texture_error_check(ctx, target, level, internalFormat,
GL_NONE, GL_NONE, 1, width, 1, 1, border)) {
@@ -2539,23 +2689,32 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
}
/* setup the teximage struct's fields */
- init_texture_image(texImage, width, 1, 1, border, internalFormat);
+ init_texture_image(ctx, texImage, width, 1, 1,
+ border, internalFormat);
/* process the texture image */
if (data) {
GLboolean retain = GL_TRUE;
GLboolean success = GL_FALSE;
if (ctx->Driver.CompressedTexImage1D) {
- success = (*ctx->Driver.CompressedTexImage1D)( ctx, target, level,
- data, texObj, texImage, &retain);
+ success = (*ctx->Driver.CompressedTexImage1D)(ctx, target, level,
+ imageSize, data, texObj, texImage, &retain);
}
if (retain || !success) {
/* make internal copy of the texture image */
- GLuint imageSize = _mesa_compressed_image_size(internalFormat,
- width, 1, 1);
- texImage->Data = MALLOC(imageSize);
+ computedImageSize = _mesa_compressed_image_size(ctx,
+ internalFormat,
+ 1, /* num dims */
+ width,
+ 1, /* height */
+ 1); /* depth */
+ if (computedImageSize != imageSize) {
+ gl_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage1DARB(imageSize)");
+ return;
+ }
+ texImage->Data = MALLOC(computedImageSize);
if (texImage->Data) {
- MEMCPY(texImage->Data, data, imageSize);
+ MEMCPY(texImage->Data, data, computedImageSize);
}
}
if (!retain && texImage->Data) {
@@ -2567,8 +2726,9 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
make_null_texture(texImage);
if (ctx->Driver.CompressedTexImage1D) {
GLboolean retain;
- (*ctx->Driver.CompressedTexImage1D)( ctx, target, level,
- texImage->Data, texObj, texImage, &retain);
+ (*ctx->Driver.CompressedTexImage1D)(ctx, target, level, 0,
+ texImage->Data, texObj,
+ texImage, &retain);
}
}
@@ -2582,13 +2742,12 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
GL_NONE, GL_NONE, 1, width, 1, 1, border)) {
/* if error, clear all proxy texture image parameters */
if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- MEMSET( ctx->Texture.Proxy1D->Image[level], 0,
- sizeof(struct gl_texture_image) );
+ clear_proxy_teximage(ctx->Texture.Proxy1D->Image[level]);
}
}
else {
/* if no error, update proxy texture image parameters */
- init_texture_image(ctx->Texture.Proxy1D->Image[level],
+ init_texture_image(ctx, ctx->Texture.Proxy1D->Image[level],
width, 1, 1, border, internalFormat);
}
}
@@ -2608,6 +2767,20 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage2DARB");
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ case GL_COMPRESSED_INTENSITY_ARB:
+ case GL_COMPRESSED_RGB_ARB:
+ case GL_COMPRESSED_RGBA_ARB:
+ gl_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2DARB");
+ return;
+ default:
+ /* silence compiler warning */
+ ;
+ }
+
if (target==GL_TEXTURE_2D ||
(ctx->Extensions.HaveTextureCubeMap &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
@@ -2615,6 +2788,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+ GLsizei computedImageSize;
if (texture_error_check(ctx, target, level, internalFormat,
GL_NONE, GL_NONE, 1, width, height, 1, border)) {
@@ -2639,23 +2813,37 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
}
/* setup the teximage struct's fields */
- init_texture_image(texImage, width, height, 1, border, internalFormat);
+ init_texture_image(ctx, texImage, width, height, 1, border, internalFormat);
/* process the texture image */
if (data) {
GLboolean retain = GL_TRUE;
GLboolean success = GL_FALSE;
if (ctx->Driver.CompressedTexImage2D) {
- success = (*ctx->Driver.CompressedTexImage2D)( ctx, target, level,
- data, texObj, texImage, &retain);
+ success = (*ctx->Driver.CompressedTexImage2D)( ctx,
+ target,
+ level,
+ imageSize,
+ data,
+ texObj,
+ texImage,
+ &retain);
}
if (retain || !success) {
/* make internal copy of the texture image */
- GLuint imageSize = _mesa_compressed_image_size(internalFormat,
- width, height, 1);
- texImage->Data = MALLOC(imageSize);
+ computedImageSize = _mesa_compressed_image_size(ctx,
+ internalFormat,
+ 2, /* num dims */
+ width,
+ height,
+ 1); /* depth */
+ if (computedImageSize != imageSize) {
+ gl_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage2DARB(imageSize)");
+ return;
+ }
+ texImage->Data = MALLOC(computedImageSize);
if (texImage->Data) {
- MEMCPY(texImage->Data, data, imageSize);
+ MEMCPY(texImage->Data, data, computedImageSize);
}
}
if (!retain && texImage->Data) {
@@ -2667,8 +2855,9 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
make_null_texture(texImage);
if (ctx->Driver.CompressedTexImage2D) {
GLboolean retain;
- (*ctx->Driver.CompressedTexImage2D)( ctx, target, level,
- texImage->Data, texObj, texImage, &retain);
+ (*ctx->Driver.CompressedTexImage2D)( ctx, target, level, 0,
+ texImage->Data, texObj,
+ texImage, &retain);
}
}
@@ -2682,13 +2871,12 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
GL_NONE, GL_NONE, 1, width, 1, 1, border)) {
/* if error, clear all proxy texture image parameters */
if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- MEMSET( ctx->Texture.Proxy2D->Image[level], 0,
- sizeof(struct gl_texture_image) );
+ clear_proxy_teximage(ctx->Texture.Proxy2D->Image[level]);
}
}
else {
/* if no error, update proxy texture image parameters */
- init_texture_image(ctx->Texture.Proxy2D->Image[level],
+ init_texture_image(ctx, ctx->Texture.Proxy2D->Image[level],
width, 1, 1, border, internalFormat);
}
}
@@ -2708,10 +2896,25 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage3DARB");
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ case GL_COMPRESSED_INTENSITY_ARB:
+ case GL_COMPRESSED_RGB_ARB:
+ case GL_COMPRESSED_RGBA_ARB:
+ gl_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3DARB");
+ return;
+ default:
+ /* silence compiler warning */
+ ;
+ }
+
if (target == GL_TEXTURE_3D) {
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+ GLsizei computedImageSize;
if (texture_error_check(ctx, target, level, internalFormat,
GL_NONE, GL_NONE, 1, width, height, depth, border)) {
@@ -2736,23 +2939,34 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
}
/* setup the teximage struct's fields */
- init_texture_image(texImage, width, height, depth, border, internalFormat);
+ init_texture_image(ctx, texImage, width, height, depth,
+ border, internalFormat);
/* process the texture image */
if (data) {
GLboolean retain = GL_TRUE;
GLboolean success = GL_FALSE;
if (ctx->Driver.CompressedTexImage3D) {
- success = (*ctx->Driver.CompressedTexImage3D)( ctx, target, level,
- data, texObj, texImage, &retain);
+ success = (*ctx->Driver.CompressedTexImage3D)(ctx, target, level,
+ imageSize, data,
+ texObj, texImage,
+ &retain);
}
if (retain || !success) {
/* make internal copy of the texture image */
- GLuint imageSize = _mesa_compressed_image_size(internalFormat,
- width, height, depth);
- texImage->Data = MALLOC(imageSize);
+ computedImageSize = _mesa_compressed_image_size(ctx,
+ internalFormat,
+ 3, /* num dims */
+ width,
+ height,
+ depth);
+ if (computedImageSize != imageSize) {
+ gl_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage3DARB(imageSize)");
+ return;
+ }
+ texImage->Data = MALLOC(computedImageSize);
if (texImage->Data) {
- MEMCPY(texImage->Data, data, imageSize);
+ MEMCPY(texImage->Data, data, computedImageSize);
}
}
if (!retain && texImage->Data) {
@@ -2764,8 +2978,9 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
make_null_texture(texImage);
if (ctx->Driver.CompressedTexImage3D) {
GLboolean retain;
- (*ctx->Driver.CompressedTexImage3D)( ctx, target, level,
- texImage->Data, texObj, texImage, &retain);
+ (*ctx->Driver.CompressedTexImage3D)( ctx, target, level, 0,
+ texImage->Data, texObj,
+ texImage, &retain);
}
}
@@ -2779,13 +2994,12 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
GL_NONE, GL_NONE, 1, width, height, depth, border)) {
/* if error, clear all proxy texture image parameters */
if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- MEMSET( ctx->Texture.Proxy3D->Image[level], 0,
- sizeof(struct gl_texture_image) );
+ clear_proxy_teximage(ctx->Texture.Proxy3D->Image[level]);
}
}
else {
/* if no error, update proxy texture image parameters */
- init_texture_image(ctx->Texture.Proxy3D->Image[level],
+ init_texture_image(ctx, ctx->Texture.Proxy3D->Image[level],
width, 1, 1, border, internalFormat);
}
}
@@ -2829,7 +3043,6 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
gl_problem(ctx, "glCompressedTexSubImage1DARB failed!");
return;
}
-
}
diff --git a/xc/extras/Mesa/src/teximage.h b/xc/extras/Mesa/src/teximage.h
index b63649eac..1ff5e9038 100644
--- a/xc/extras/Mesa/src/teximage.h
+++ b/xc/extras/Mesa/src/teximage.h
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/teximage.h,v 1.6 2000/09/26 15:56:33 tsi Exp $ */
#ifndef TEXIMAGE_H
#define TEXIMAGE_H
@@ -47,7 +47,9 @@ _mesa_free_texture_image( struct gl_texture_image *teximage );
extern GLuint
-_mesa_compressed_image_size(GLenum internalFormat,
+_mesa_compressed_image_size(GLcontext *ctx,
+ GLenum internalFormat,
+ GLint numDimensions,
GLint width, GLint height, GLint depth);
diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c
index e55428408..75d63fff1 100644
--- a/xc/extras/Mesa/src/texobj.c
+++ b/xc/extras/Mesa/src/texobj.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/texobj.c,v 1.6 2000/09/26 15:56:33 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -65,6 +65,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
obj->RefCount = 1;
obj->Name = name;
obj->Dimensions = dimensions;
+ obj->Priority = 1.0F;
obj->WrapS = GL_REPEAT;
obj->WrapT = GL_REPEAT;
obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
@@ -391,11 +392,13 @@ _mesa_GenTextures( GLsizei n, GLuint *texName )
GLint i;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGenTextures");
- if (n<0) {
+ if (n < 0) {
gl_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
return;
}
+ if (!texName)
+ return;
/*
* This must be atomic (generation and allocation of texture IDs)
@@ -432,6 +435,9 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName)
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures");
+ if (!texName)
+ return;
+
for (i=0;i<n;i++) {
struct gl_texture_object *t;
if (texName[i]>0) {
@@ -610,19 +616,20 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
GLint i;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures");
- if (n<0) {
+ if (n < 0) {
gl_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
return;
}
- for (i=0;i<n;i++) {
- struct gl_texture_object *t;
- if (texName[i]>0) {
- t = (struct gl_texture_object *)
+ if (!priorities)
+ return;
+
+ for (i = 0; i < n; i++) {
+ if (texName[i] > 0) {
+ struct gl_texture_object *t = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
if (t) {
t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
-
if (ctx->Driver.PrioritizeTexture)
ctx->Driver.PrioritizeTexture( ctx, t, t->Priority );
}
@@ -636,41 +643,47 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
* Execute glAreTexturesResident
*/
GLboolean
-_mesa_AreTexturesResident( GLsizei n, const GLuint *texName,
- GLboolean *residences )
+_mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
+ GLboolean *residences)
{
GET_CURRENT_CONTEXT(ctx);
- GLboolean resident = GL_TRUE;
+ GLboolean allResident = GL_TRUE;
GLint i;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx,
- "glAreTexturesResident",
- GL_FALSE);
- if (n<0) {
- gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)" );
+ "glAreTexturesResident", GL_FALSE);
+ if (n < 0) {
+ gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
return GL_FALSE;
}
- for (i=0;i<n;i++) {
+ if (!texName || !residences)
+ return GL_FALSE;
+
+ for (i = 0; i < n; i++) {
struct gl_texture_object *t;
- if (texName[i]==0) {
- gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)" );
+ if (texName[i] == 0) {
+ gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
return GL_FALSE;
}
t = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
if (t) {
- if (ctx->Driver.IsTextureResident)
- residences[i] = ctx->Driver.IsTextureResident( ctx, t );
- else
+ if (ctx->Driver.IsTextureResident) {
+ residences[i] = ctx->Driver.IsTextureResident(ctx, t);
+ if (!residences[i])
+ allResident = GL_FALSE;
+ }
+ else {
residences[i] = GL_TRUE;
+ }
}
else {
- gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)" );
+ gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
return GL_FALSE;
}
}
- return resident;
+ return allResident;
}
@@ -684,7 +697,7 @@ _mesa_IsTexture( GLuint texture )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
GL_FALSE);
- if (texture>0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) {
+ if (texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) {
return GL_TRUE;
}
else {
diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c
index a51a7f873..7324ca657 100644
--- a/xc/extras/Mesa/src/texstate.c
+++ b/xc/extras/Mesa/src/texstate.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/texstate.c,v 1.6 2000/09/26 15:56:33 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -70,64 +70,284 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv");
if (target==GL_TEXTURE_ENV) {
-
- if (pname==GL_TEXTURE_ENV_MODE) {
- GLenum mode = (GLenum) (GLint) *param;
- switch (mode) {
- case GL_ADD:
- if (!ctx->Extensions.HaveTextureEnvAdd) {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
- return;
- }
- /* FALL-THROUGH */
- case GL_MODULATE:
- case GL_BLEND:
- case GL_DECAL:
- case GL_REPLACE:
- /* A small optimization for drivers */
- if (texUnit->EnvMode == mode)
- return;
-
- if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_TEXTURE))
- fprintf(stderr, "glTexEnv: old mode %s, new mode %s\n",
- gl_lookup_enum_by_nr(texUnit->EnvMode),
- gl_lookup_enum_by_nr(mode));
-
- texUnit->EnvMode = mode;
- ctx->NewState |= NEW_TEXTURE_ENV;
- break;
- default:
- gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
- return;
- }
- }
- else if (pname==GL_TEXTURE_ENV_COLOR) {
- texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
- texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
- texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
- texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
- return;
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ {
+ GLenum mode = (GLenum) (GLint) *param;
+ switch (mode) {
+ case GL_MODULATE:
+ case GL_BLEND:
+ case GL_DECAL:
+ case GL_REPLACE:
+ case GL_ADD:
+ case GL_COMBINE_EXT:
+ if (mode == GL_ADD &&
+ !ctx->Extensions.HaveTextureEnvAdd) {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ return;
+ }
+ if (mode == GL_COMBINE_EXT &&
+ !ctx->Extensions.HaveTextureEnvCombine) {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ return;
+ }
+ if (texUnit->EnvMode == mode)
+ return; /* no change */
+ texUnit->EnvMode = mode;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+ }
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
+ texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
+ texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
+ texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
+ break;
+ case GL_COMBINE_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ GLenum mode = (GLenum) (GLint) *param;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED_EXT:
+ case GL_INTERPOLATE_EXT:
+ if (texUnit->CombineModeRGB == mode)
+ return; /* no change */
+ texUnit->CombineModeRGB = mode;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_COMBINE_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ GLenum mode = (GLenum) (GLint) *param;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED_EXT:
+ case GL_INTERPOLATE_EXT:
+ if (texUnit->CombineModeA == mode)
+ return; /* no change */
+ texUnit->CombineModeA = mode;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_SOURCE0_RGB_EXT:
+ case GL_SOURCE1_RGB_EXT:
+ case GL_SOURCE2_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ GLenum source = (GLenum) (GLint) *param;
+ GLuint s = pname - GL_SOURCE0_RGB_EXT;
+ switch (source) {
+ case GL_TEXTURE:
+ case GL_CONSTANT_EXT:
+ case GL_PRIMARY_COLOR_EXT:
+ case GL_PREVIOUS_EXT:
+ if (texUnit->CombineSourceRGB[s] == source)
+ return; /* no change */
+ texUnit->CombineSourceRGB[s] = source;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_SOURCE0_ALPHA_EXT:
+ case GL_SOURCE1_ALPHA_EXT:
+ case GL_SOURCE2_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ GLenum source = (GLenum) (GLint) *param;
+ GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
+ switch (source) {
+ case GL_TEXTURE:
+ case GL_CONSTANT_EXT:
+ case GL_PRIMARY_COLOR_EXT:
+ case GL_PREVIOUS_EXT:
+ if (texUnit->CombineSourceA[s] == source) return;
+ texUnit->CombineSourceA[s] = source;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND0_RGB_EXT:
+ case GL_OPERAND1_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ GLenum operand = (GLenum) (GLint) *param;
+ GLuint s = pname - GL_OPERAND0_RGB_EXT;
+ switch (operand) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ texUnit->CombineOperandRGB[s] = operand;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND0_ALPHA_EXT:
+ case GL_OPERAND1_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ GLenum operand = (GLenum) (GLint) *param;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT]
+ = operand;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND2_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ if ((GLenum) (GLint) *param == GL_SRC_ALPHA) {
+ texUnit->CombineOperandRGB[2] = (GLenum) (GLint) *param;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND2_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ if ((GLenum) (GLint) *param == GL_SRC_ALPHA) {
+ texUnit->CombineOperandA[2] = (GLenum) (GLint) *param;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_RGB_SCALE_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ if (*param == 1.0) {
+ texUnit->CombineScaleShiftRGB = 0;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else if (*param == 2.0) {
+ texUnit->CombineScaleShiftRGB = 1;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else if (*param == 4.0) {
+ texUnit->CombineScaleShiftRGB = 2;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ if (*param == 1.0) {
+ texUnit->CombineScaleShiftA = 0;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else if (*param == 2.0) {
+ texUnit->CombineScaleShiftA = 1;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else if (*param == 4.0) {
+ texUnit->CombineScaleShiftA = 2;
+ ctx->NewState |= NEW_TEXTURE_ENV;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
}
-
}
else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) {
-
if (!ctx->Extensions.HaveTextureLodBias) {
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
return;
}
-
- if (pname==GL_TEXTURE_LOD_BIAS_EXT) {
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
texUnit->LodBias = param[0];
}
else {
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
return;
}
-
}
else {
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
@@ -183,7 +403,7 @@ void
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexEnvfv");
@@ -191,6 +411,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
return;
}
+
switch (pname) {
case GL_TEXTURE_ENV_MODE:
*params = ENUM_TO_FLOAT(texUnit->EnvMode);
@@ -198,6 +419,34 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
case GL_TEXTURE_ENV_COLOR:
COPY_4FV( params, texUnit->EnvColor );
break;
+ case GL_RGB_SCALE_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ if (texUnit->CombineScaleShiftRGB == 0)
+ *params = 1.0;
+ else if (texUnit->CombineScaleShiftRGB == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ if (texUnit->CombineScaleShiftA == 0)
+ *params = 1.0;
+ else if (texUnit->CombineScaleShiftA == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
}
@@ -208,14 +457,15 @@ void
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexEnviv");
- if (target!=GL_TEXTURE_ENV) {
+ if (target != GL_TEXTURE_ENV) {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
return;
}
+
switch (pname) {
case GL_TEXTURE_ENV_MODE:
*params = (GLint) texUnit->EnvMode;
@@ -225,6 +475,118 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
+ break;
+ case GL_COMBINE_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineModeRGB;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineModeA;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineSourceRGB[0];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineSourceRGB[1];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineSourceRGB[2];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineSourceA[0];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineSourceA[1];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineSourceA[2];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineOperandRGB[0];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineOperandRGB[1];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_RGB_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineOperandRGB[2];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineOperandA[0];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineOperandA[1];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_ALPHA_EXT:
+ if (ctx->Extensions.HaveTextureEnvCombine) {
+ *params = (GLint) texUnit->CombineOperandA[2];
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
@@ -608,7 +970,14 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
params[3] = obj->BorderColor[3] / 255.0F;
break;
case GL_TEXTURE_RESIDENT:
- *params = ENUM_TO_FLOAT(GL_TRUE);
+ {
+ GLboolean resident;
+ if (ctx->Driver.IsTextureResident)
+ resident = ctx->Driver.IsTextureResident(ctx, obj);
+ else
+ resident = GL_TRUE;
+ *params = ENUM_TO_FLOAT(resident);
+ }
break;
case GL_TEXTURE_PRIORITY:
*params = obj->Priority;
@@ -676,7 +1045,14 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
}
break;
case GL_TEXTURE_RESIDENT:
- *params = (GLint) GL_TRUE;
+ {
+ GLboolean resident;
+ if (ctx->Driver.IsTextureResident)
+ resident = ctx->Driver.IsTextureResident(ctx, obj);
+ else
+ resident = GL_TRUE;
+ *params = (GLint) resident;
+ }
break;
case GL_TEXTURE_PRIORITY:
*params = (GLint) obj->Priority;
diff --git a/xc/extras/Mesa/src/texture.c b/xc/extras/Mesa/src/texture.c
index 0106ab86b..fe4863ff4 100644
--- a/xc/extras/Mesa/src/texture.c
+++ b/xc/extras/Mesa/src/texture.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/texture.c,v 1.7 2000/09/26 15:56:34 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -31,6 +31,7 @@
#include "context.h"
#include "macros.h"
#include "mmath.h"
+#include "mem.h"
#include "pb.h"
#include "teximage.h"
#include "texture.h"
@@ -370,6 +371,36 @@ static void palette_sample(const struct gl_texture_object *tObj,
/*
+ * Compute linear mipmap levels for given lambda.
+ */
+#define COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level) \
+{ \
+ if (lambda < 0.0F) \
+ lambda = 0.0F; \
+ else if (lambda > tObj->M) \
+ lambda = tObj->M; \
+ level = (GLint) (tObj->BaseLevel + lambda); \
+}
+
+
+/*
+ * Compute nearest mipmap level for given lambda.
+ */
+#define COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level) \
+{ \
+ if (lambda <= 0.5F) \
+ lambda = 0.0F; \
+ else if (lambda > tObj->M + 0.4999F) \
+ lambda = tObj->M + 0.4999F; \
+ level = (GLint) (tObj->BaseLevel + lambda + 0.5F); \
+ if (level > tObj->P) \
+ level = tObj->P; \
+}
+
+
+
+
+/*
* Bitflags for texture border color sampling.
*/
#define I0BIT 1
@@ -578,14 +609,7 @@ sample_1d_nearest_mipmap_nearest( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda <= 0.5F)
- lambda = 0.0F;
- else if (lambda > tObj->M + 0.4999F)
- lambda = tObj->M + 0.4999F;
- level = (GLint) (tObj->BaseLevel + lambda + 0.5F);
- if (level > tObj->P)
- level = tObj->P;
-
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
sample_1d_nearest( tObj, tObj->Image[level], s, rgba );
}
@@ -596,14 +620,7 @@ sample_1d_linear_mipmap_nearest( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda <= 0.5F)
- lambda = 0.0F;
- else if (lambda > tObj->M + 0.4999F)
- lambda = tObj->M + 0.4999F;
- level = (GLint) (tObj->BaseLevel + lambda + 0.5F);
- if (level > tObj->P)
- level = tObj->P;
-
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
sample_1d_linear( tObj, tObj->Image[level], s, rgba );
}
@@ -615,11 +632,8 @@ sample_1d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda < 0.0F)
- lambda = 0.0F;
- else if (lambda > tObj->M)
- lambda = tObj->M;
- level = (GLint) (tObj->BaseLevel + lambda);
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->P) {
sample_1d_nearest( tObj, tObj->Image[tObj->P], s, rgba );
@@ -644,11 +658,8 @@ sample_1d_linear_mipmap_linear( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda < 0.0F)
- lambda = 0.0F;
- else if (lambda > tObj->M)
- lambda = tObj->M;
- level = (GLint) (tObj->BaseLevel + lambda);
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->P) {
sample_1d_linear( tObj, tObj->Image[tObj->P], s, rgba );
@@ -971,14 +982,7 @@ sample_2d_nearest_mipmap_nearest( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda <= 0.5F)
- lambda = 0.0F;
- else if (lambda > tObj->M + 0.4999F)
- lambda = tObj->M + 0.4999F;
- level = (GLint) (tObj->BaseLevel + lambda + 0.5F);
- if (level > tObj->P)
- level = tObj->P;
-
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
sample_2d_nearest( tObj, tObj->Image[level], s, t, rgba );
}
@@ -990,14 +994,7 @@ sample_2d_linear_mipmap_nearest( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda <= 0.5F)
- lambda = 0.0F;
- else if (lambda > tObj->M + 0.4999F)
- lambda = tObj->M + 0.4999F;
- level = (GLint) (tObj->BaseLevel + lambda + 0.5F);
- if (level > tObj->P)
- level = tObj->P;
-
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
sample_2d_linear( tObj, tObj->Image[level], s, t, rgba );
}
@@ -1009,11 +1006,8 @@ sample_2d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda < 0.0F)
- lambda = 0.0F;
- else if (lambda > tObj->M)
- lambda = tObj->M;
- level = (GLint) (tObj->BaseLevel + lambda);
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->P) {
sample_2d_nearest( tObj, tObj->Image[tObj->P], s, t, rgba );
@@ -1038,11 +1032,8 @@ sample_2d_linear_mipmap_linear( const struct gl_texture_object *tObj,
GLubyte rgba[4] )
{
GLint level;
- if (lambda < 0.0F)
- lambda = 0.0F;
- else if (lambda > tObj->M)
- lambda = tObj->M;
- level = (GLint) (tObj->BaseLevel + lambda);
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->P) {
sample_2d_linear( tObj, tObj->Image[tObj->P], s, t, rgba );
@@ -1490,14 +1481,7 @@ sample_3d_nearest_mipmap_nearest( const struct gl_texture_object *tObj,
GLfloat lambda, GLubyte rgba[4] )
{
GLint level;
- if (lambda <= 0.5F)
- lambda = 0.0F;
- else if (lambda > tObj->M + 0.4999F)
- lambda = tObj->M + 0.4999F;
- level = (GLint) (tObj->BaseLevel + lambda + 0.5F);
- if (level > tObj->P)
- level = tObj->P;
-
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
sample_3d_nearest( tObj, tObj->Image[level], s, t, r, rgba );
}
@@ -1508,14 +1492,7 @@ sample_3d_linear_mipmap_nearest( const struct gl_texture_object *tObj,
GLfloat lambda, GLubyte rgba[4] )
{
GLint level;
- if (lambda <= 0.5F)
- lambda = 0.0F;
- else if (lambda > tObj->M + 0.4999F)
- lambda = tObj->M + 0.4999F;
- level = (GLint) (tObj->BaseLevel + lambda + 0.5F);
- if (level > tObj->P)
- level = tObj->P;
-
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
sample_3d_linear( tObj, tObj->Image[level], s, t, r, rgba );
}
@@ -1526,11 +1503,8 @@ sample_3d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
GLfloat lambda, GLubyte rgba[4] )
{
GLint level;
- if (lambda < 0.0F)
- lambda = 0.0F;
- else if (lambda > tObj->M)
- lambda = tObj->M;
- level = (GLint) (tObj->BaseLevel + lambda);
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->P) {
sample_3d_nearest( tObj, tObj->Image[tObj->P], s, t, r, rgba );
@@ -1554,11 +1528,8 @@ sample_3d_linear_mipmap_linear( const struct gl_texture_object *tObj,
GLfloat lambda, GLubyte rgba[4] )
{
GLint level;
- if (lambda < 0.0F)
- lambda = 0.0F;
- else if (lambda > tObj->M)
- lambda = tObj->M;
- level = (GLint) (tObj->BaseLevel + lambda);
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->P) {
sample_3d_linear( tObj, tObj->Image[tObj->P], s, t, r, rgba );
@@ -1664,10 +1635,14 @@ static void sample_lambda_3d( const struct gl_texture_object *tObj, GLuint n,
/* Texture Cube Map Sampling Functions */
/**********************************************************************/
-static struct gl_texture_image *
+/*
+ * Choose one of six sides of a texture cube map given the texture
+ * coord (rx,ry,rz). Return pointer to corresponding array of texture
+ * images.
+ */
+static const struct gl_texture_image **
choose_cube_face(const struct gl_texture_object *texObj,
- const GLfloat texcoord[4],
- GLint level,
+ GLfloat rx, GLfloat ry, GLfloat rz,
GLfloat *newS, GLfloat *newT)
{
/*
@@ -1681,20 +1656,19 @@ choose_cube_face(const struct gl_texture_object *texObj,
+rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz
-rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz
*/
- struct gl_texture_image *texImg;
- const GLfloat rx = texcoord[0], ry = texcoord[1], rz = texcoord[2];
+ const struct gl_texture_image **imgArray;
const GLfloat arx = ABSF(rx), ary = ABSF(ry), arz = ABSF(rz);
GLfloat sc, tc, ma;
if (arx > ary && arx > arz) {
if (rx >= 0.0F) {
- texImg = texObj->Image[level];
+ imgArray = (const struct gl_texture_image **) texObj->Image;
sc = -rz;
tc = -ry;
ma = arx;
}
else {
- texImg = texObj->NegX[level];
+ imgArray = (const struct gl_texture_image **) texObj->NegX;
sc = rz;
tc = -ry;
ma = arx;
@@ -1702,13 +1676,13 @@ choose_cube_face(const struct gl_texture_object *texObj,
}
else if (ary > arx && ary > arz) {
if (ry >= 0.0F) {
- texImg = texObj->PosY[level];
+ imgArray = (const struct gl_texture_image **) texObj->PosY;
sc = rx;
tc = rz;
ma = ary;
}
else {
- texImg = texObj->NegY[level];
+ imgArray = (const struct gl_texture_image **) texObj->NegY;
sc = rx;
tc = -rz;
ma = ary;
@@ -1716,13 +1690,13 @@ choose_cube_face(const struct gl_texture_object *texObj,
}
else {
if (rz > 0.0F) {
- texImg = texObj->PosZ[level];
+ imgArray = (const struct gl_texture_image **) texObj->PosZ;
sc = rx;
tc = -ry;
ma = arz;
}
else {
- texImg = texObj->NegZ[level];
+ imgArray = (const struct gl_texture_image **) texObj->NegZ;
sc = -rx;
tc = -ry;
ma = arz;
@@ -1731,7 +1705,7 @@ choose_cube_face(const struct gl_texture_object *texObj,
*newS = ( sc / ma + 1.0F ) * 0.5F;
*newT = ( tc / ma + 1.0F ) * 0.5F;
- return texImg;
+ return imgArray;
}
@@ -1744,17 +1718,14 @@ sample_nearest_cube(const struct gl_texture_object *tObj, GLuint n,
GLuint i;
(void) lambda;
for (i = 0; i < n; i++) {
- struct gl_texture_image *image;
+ const struct gl_texture_image **images;
GLfloat newS, newT;
- GLfloat coord[4];
- coord[0] = s[i];
- coord[1] = t[i];
- coord[2] = u[i];
- image = choose_cube_face(tObj, coord, 0, &newS, &newT);
- sample_2d_nearest( tObj, image, newS, newT, rgba[i] );
+ images = choose_cube_face(tObj, s[i], t[i], u[i], &newS, &newT);
+ sample_2d_nearest( tObj, images[tObj->BaseLevel], newS, newT, rgba[i] );
}
}
+
static void
sample_linear_cube(const struct gl_texture_object *tObj, GLuint n,
const GLfloat s[], const GLfloat t[],
@@ -1764,17 +1735,104 @@ sample_linear_cube(const struct gl_texture_object *tObj, GLuint n,
GLuint i;
(void) lambda;
for (i = 0; i < n; i++) {
- struct gl_texture_image *image;
+ const struct gl_texture_image **images;
GLfloat newS, newT;
- GLfloat coord[4];
- coord[0] = s[i];
- coord[1] = t[i];
- coord[2] = u[i];
- image = choose_cube_face(tObj, coord, 0, &newS, &newT);
- sample_2d_linear( tObj, image, newS, newT, rgba[i] );
+ images = choose_cube_face(tObj, s[i], t[i], u[i], &newS, &newT);
+ sample_2d_linear( tObj, images[tObj->BaseLevel], newS, newT, rgba[i] );
}
}
+
+static void
+sample_cube_nearest_mipmap_nearest( const struct gl_texture_object *tObj,
+ GLfloat s, GLfloat t, GLfloat u,
+ GLfloat lambda, GLubyte rgba[4] )
+{
+ const struct gl_texture_image **images;
+ GLfloat newS, newT;
+ GLint level;
+
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
+
+ images = choose_cube_face(tObj, s, t, u, &newS, &newT);
+ sample_2d_nearest( tObj, images[level], newS, newT, rgba );
+}
+
+
+static void
+sample_cube_linear_mipmap_nearest( const struct gl_texture_object *tObj,
+ GLfloat s, GLfloat t, GLfloat u,
+ GLfloat lambda, GLubyte rgba[4] )
+{
+ const struct gl_texture_image **images;
+ GLfloat newS, newT;
+ GLint level;
+
+ COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
+
+ images = choose_cube_face(tObj, s, t, u, &newS, &newT);
+ sample_2d_linear( tObj, images[level], newS, newT, rgba );
+}
+
+
+static void
+sample_cube_nearest_mipmap_linear( const struct gl_texture_object *tObj,
+ GLfloat s, GLfloat t, GLfloat u,
+ GLfloat lambda, GLubyte rgba[4] )
+{
+ const struct gl_texture_image **images;
+ GLfloat newS, newT;
+ GLint level;
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
+
+ images = choose_cube_face(tObj, s, t, u, &newS, &newT);
+
+ if (level >= tObj->P) {
+ sample_2d_nearest( tObj, images[tObj->P], newS, newT, rgba );
+ }
+ else {
+ GLubyte t0[4], t1[4]; /* texels */
+ const GLfloat f = myFrac(lambda);
+ sample_2d_nearest( tObj, images[level ], newS, newT, t0 );
+ sample_2d_nearest( tObj, images[level+1], newS, newT, t1 );
+ rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ }
+}
+
+
+static void
+sample_cube_linear_mipmap_linear( const struct gl_texture_object *tObj,
+ GLfloat s, GLfloat t, GLfloat u,
+ GLfloat lambda, GLubyte rgba[4] )
+{
+ const struct gl_texture_image **images;
+ GLfloat newS, newT;
+ GLint level;
+
+ COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
+
+ images = choose_cube_face(tObj, s, t, u, &newS, &newT);
+
+ if (level >= tObj->P) {
+ sample_2d_linear( tObj, images[tObj->P], newS, newT, rgba );
+ }
+ else {
+ GLubyte t0[4], t1[4];
+ const GLfloat f = myFrac(lambda);
+ sample_2d_linear( tObj, images[level ], newS, newT, t0 );
+ sample_2d_linear( tObj, images[level+1], newS, newT, t1 );
+ rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ }
+}
+
+
static void
sample_lambda_cube(const struct gl_texture_object *tObj, GLuint n,
const GLfloat s[], const GLfloat t[],
@@ -1784,42 +1842,44 @@ sample_lambda_cube(const struct gl_texture_object *tObj, GLuint n,
GLuint i;
for (i = 0; i < n; i++) {
- struct gl_texture_image *image;
- GLfloat newS, newT;
- GLfloat coord[4];
- coord[0] = s[i];
- coord[1] = t[i];
- coord[2] = u[i];
- image = choose_cube_face(tObj, coord, 0, &newS, &newT);
-
if (lambda[i] > tObj->MinMagThresh) {
/* minification */
switch (tObj->MinFilter) {
case GL_NEAREST:
- sample_2d_nearest( tObj, image, newS, newT, rgba[i] );
+ {
+ const struct gl_texture_image **images;
+ GLfloat newS, newT;
+ images = choose_cube_face(tObj, s[i], t[i], u[i],
+ &newS, &newT);
+ sample_2d_nearest( tObj, images[tObj->BaseLevel],
+ newS, newT, rgba[i] );
+ }
break;
case GL_LINEAR:
- sample_2d_linear( tObj, image, newS, newT, rgba[i] );
+ {
+ const struct gl_texture_image **images;
+ GLfloat newS, newT;
+ images = choose_cube_face(tObj, s[i], t[i], u[i],
+ &newS, &newT);
+ sample_2d_linear( tObj, images[tObj->BaseLevel],
+ newS, newT, rgba[i] );
+ }
break;
case GL_NEAREST_MIPMAP_NEAREST:
- /*
- sample_3d_nearest_mipmap_nearest( tObj, s[i], t[i], u[i], lambda[i], rgba[i] );
- */
+ sample_cube_nearest_mipmap_nearest( tObj, s[i], t[i], u[i],
+ lambda[i], rgba[i] );
break;
case GL_LINEAR_MIPMAP_NEAREST:
- /*
- sample_3d_linear_mipmap_nearest( tObj, s[i], t[i], u[i], lambda[i], rgba[i] );
- */
+ sample_cube_linear_mipmap_nearest( tObj, s[i], t[i], u[i],
+ lambda[i], rgba[i] );
break;
case GL_NEAREST_MIPMAP_LINEAR:
- /*
- sample_3d_nearest_mipmap_linear( tObj, s[i], t[i], u[i], lambda[i], rgba[i] );
- */
+ sample_cube_nearest_mipmap_linear( tObj, s[i], t[i], u[i],
+ lambda[i], rgba[i] );
break;
case GL_LINEAR_MIPMAP_LINEAR:
- /*
- sample_3d_linear_mipmap_linear( tObj, s[i], t[i], u[i], lambda[i], rgba[i] );
- */
+ sample_cube_linear_mipmap_linear( tObj, s[i], t[i], u[i],
+ lambda[i], rgba[i] );
break;
default:
gl_problem(NULL, "Bad min filter in sample_lambda_cube");
@@ -1827,12 +1887,18 @@ sample_lambda_cube(const struct gl_texture_object *tObj, GLuint n,
}
else {
/* magnification */
+ const struct gl_texture_image **images;
+ GLfloat newS, newT;
+ images = choose_cube_face(tObj, s[i], t[i], u[i],
+ &newS, &newT);
switch (tObj->MagFilter) {
case GL_NEAREST:
- sample_2d_nearest( tObj, image, newS, newT, rgba[i] );
+ sample_2d_nearest( tObj, images[tObj->BaseLevel],
+ newS, newT, rgba[i] );
break;
case GL_LINEAR:
- sample_2d_linear( tObj, image, newS, newT, rgba[i] );
+ sample_2d_linear( tObj, images[tObj->BaseLevel],
+ newS, newT, rgba[i] );
break;
default:
gl_problem(NULL, "Bad mag filter in sample_lambda_cube");
@@ -1936,6 +2002,256 @@ _mesa_set_texture_sampler( struct gl_texture_object *t )
}
+#define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) )
+
+static INLINE void
+_mesa_texture_combine(CONST GLcontext *ctx,
+ CONST struct gl_texture_unit *textureUnit,
+ GLuint n,
+ GLubyte (*primary_rgba)[4],
+ GLubyte (*texel)[4],
+ GLubyte (*rgba)[4])
+{
+ GLubyte ccolor [3][3*MAX_WIDTH][4];
+ GLubyte (*argRGB [3])[4];
+ GLubyte (*argA [3])[4];
+ GLuint i, j;
+ GLuint RGBshift = textureUnit->CombineScaleShiftRGB;
+ GLuint Ashift = textureUnit->CombineScaleShiftA;
+
+ ASSERT(ctx->Extensions.HaveTextureEnvCombine);
+
+ for (j = 0; j < 3; j++) {
+ switch (textureUnit->CombineSourceA[j]) {
+ case GL_TEXTURE:
+ argA[j] = texel;
+ break;
+ case GL_PRIMARY_COLOR_EXT:
+ argA[j] = primary_rgba;
+ break;
+ case GL_PREVIOUS_EXT:
+ argA[j] = rgba;
+ break;
+ case GL_CONSTANT_EXT:
+ {
+ GLubyte (*c)[4] = ccolor[j];
+ GLubyte col = FLOAT_TO_UBYTE(textureUnit->EnvColor[3]);
+ for (i = 0; i < n; i++)
+ c[i][ACOMP] = col;
+ argA[j] = ccolor[j];
+ }
+ break;
+ default:
+ gl_problem(NULL, "invalid combine source");
+ }
+
+ if (textureUnit->CombineOperandA[j] == GL_ONE_MINUS_SRC_ALPHA) {
+ GLubyte (*src)[4] = argA[j];
+ GLubyte (*dst)[4] = ccolor[j];
+ argA[j] = ccolor[j];
+ for (i = 0; i < n; i++)
+ dst[i][ACOMP] = 255 - src[i][ACOMP];
+ }
+
+ if (j == 2) /* arg2 has no color component in specification. */
+ break;
+
+ switch (textureUnit->CombineSourceRGB[j]) {
+ case GL_TEXTURE:
+ argRGB[j] = texel;
+ break;
+ case GL_PRIMARY_COLOR_EXT:
+ argRGB[j] = primary_rgba;
+ break;
+ case GL_PREVIOUS_EXT:
+ argRGB[j] = rgba;
+ break;
+ case GL_CONSTANT_EXT:
+ {
+ GLubyte (*c)[4] = ccolor[j];
+ GLubyte col[4];
+
+ col[RCOMP] = FLOAT_TO_UBYTE(textureUnit->EnvColor[0]);
+ col[GCOMP] = FLOAT_TO_UBYTE(textureUnit->EnvColor[1]);
+ col[BCOMP] = FLOAT_TO_UBYTE(textureUnit->EnvColor[2]);
+
+ for (i = 0; i < n; i++) {
+ c[i][RCOMP] = col[RCOMP];
+ c[i][GCOMP] = col[GCOMP];
+ c[i][BCOMP] = col[BCOMP];
+ }
+ argRGB[j] = ccolor[j];
+ }
+ break;
+ default:
+ gl_problem(NULL, "invalid combine source");
+ }
+
+ if (textureUnit->CombineOperandRGB[j] != GL_SRC_COLOR) {
+ GLubyte (*src)[4] = argRGB[j];
+ GLubyte (*dst)[4] = ccolor[j];
+
+ argRGB[j] = ccolor[j];
+
+ if (textureUnit->CombineOperandRGB[j] == GL_ONE_MINUS_SRC_COLOR) {
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = 255 - src[i][RCOMP];
+ dst[i][GCOMP] = 255 - src[i][GCOMP];
+ dst[i][BCOMP] = 255 - src[i][BCOMP];
+ }
+ } else if (textureUnit->CombineOperandRGB[j] == GL_SRC_ALPHA) {
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = src[i][ACOMP];
+ dst[i][GCOMP] = src[i][ACOMP];
+ dst[i][BCOMP] = src[i][ACOMP];
+ }
+ } else { /* GL_ONE_MINUS_SRC_ALPHA */
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = 255 - src[i][ACOMP];
+ dst[i][GCOMP] = 255 - src[i][ACOMP];
+ dst[i][BCOMP] = 255 - src[i][ACOMP];
+ }
+ }
+ }
+
+ if (textureUnit->CombineModeRGB == GL_REPLACE &&
+ textureUnit->CombineModeA == GL_REPLACE) {
+ break; /* done, we need only arg0 */
+ }
+
+ if (j == 1 &&
+ textureUnit->CombineModeRGB != GL_INTERPOLATE_EXT &&
+ textureUnit->CombineModeA != GL_INTERPOLATE_EXT) {
+ break; /* arg0 and arg1 are done. we don't need arg2. */
+ }
+ }
+
+ switch (textureUnit->CombineModeRGB) {
+ case GL_REPLACE:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0];
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = arg0[i][RCOMP] << RGBshift;
+ rgba[i][GCOMP] = arg0[i][GCOMP] << RGBshift;
+ rgba[i][BCOMP] = arg0[i][BCOMP] << RGBshift;
+ }
+ }
+ break;
+ case GL_MODULATE:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argRGB[1];
+ RGBshift = 8 - RGBshift;
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = (GLubyte) (PROD(arg0[i][0], arg1[i][RCOMP]) >> RGBshift);
+ rgba[i][GCOMP] = (GLubyte) (PROD(arg0[i][1], arg1[i][GCOMP]) >> RGBshift);
+ rgba[i][BCOMP] = (GLubyte) (PROD(arg0[i][2], arg1[i][BCOMP]) >> RGBshift);
+ }
+ }
+ break;
+ case GL_ADD:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argRGB[1];
+ for (i = 0; i < n; i++) {
+ GLint r = ((GLuint) arg0[i][RCOMP] + arg1[i][RCOMP]) << RGBshift;
+ GLint g = ((GLuint) arg0[i][GCOMP] + arg1[i][GCOMP]) << RGBshift;
+ GLint b = ((GLuint) arg0[i][BCOMP] + arg1[i][BCOMP]) << RGBshift;
+ rgba[i][RCOMP] = (r > 255) ? 255 : (GLubyte) r;
+ rgba[i][GCOMP] = (g > 255) ? 255 : (GLubyte) g;
+ rgba[i][BCOMP] = (b > 255) ? 255 : (GLubyte) b;
+ }
+ }
+ break;
+ case GL_ADD_SIGNED_EXT:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argRGB[1];
+ for (i = 0; i < n; i++) {
+ GLint r = (GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP] - 128;
+ GLint g = (GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP] - 128;
+ GLint b = (GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP] - 128;
+ r = (r < 0) ? 0 : r << RGBshift;
+ b = (b < 0) ? 0 : b << RGBshift;
+ g = (g < 0) ? 0 : g << RGBshift;
+ rgba[i][RCOMP] = (r > 255) ? 255 : (GLubyte) r;
+ rgba[i][GCOMP] = (g > 255) ? 255 : (GLubyte) g;
+ rgba[i][BCOMP] = (b > 255) ? 255 : (GLubyte) b;
+ }
+ }
+ break;
+ case GL_INTERPOLATE_EXT:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argRGB[1];
+ const GLubyte (*arg2)[4] = (const GLubyte (*)[4]) argRGB[2];
+ RGBshift = 8 - RGBshift;
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = (GLubyte) ((PROD(arg0[i][RCOMP], arg2[i][ACOMP]) + PROD(arg1[i][RCOMP], 255 - arg2[i][ACOMP])) >> RGBshift);
+ rgba[i][GCOMP] = (GLubyte) ((PROD(arg0[i][GCOMP], arg2[i][ACOMP]) + PROD(arg1[i][GCOMP], 255 - arg2[i][ACOMP])) >> RGBshift);
+ rgba[i][BCOMP] = (GLubyte) ((PROD(arg0[i][BCOMP], arg2[i][ACOMP]) + PROD(arg1[i][BCOMP], 255 - arg2[i][ACOMP])) >> RGBshift);
+ }
+ }
+ break;
+ default:
+ gl_problem(NULL, "invalid combine mode");
+ }
+
+ switch (textureUnit->CombineModeA) {
+ case GL_REPLACE:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argA[0];
+ for (i = 0; i < n; i++)
+ rgba[i][ACOMP] = arg0[i][ACOMP] << Ashift;
+ }
+ break;
+ case GL_MODULATE:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argA[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argA[1];
+ Ashift = 8 - Ashift;
+ for (i = 0; i < n; i++)
+ rgba[i][ACOMP] = (GLubyte) (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> Ashift);
+ }
+ break;
+ case GL_ADD:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argA[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argA[1];
+ for (i = 0; i < n; i++) {
+ GLint a = ((GLint) arg0[i][ACOMP] + arg1[i][ACOMP]) << Ashift;
+ rgba[i][ACOMP] = (a > 255) ? 255 : (GLubyte) a;
+ }
+ }
+ break;
+ case GL_ADD_SIGNED_EXT:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argA[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argA[1];
+ for (i = 0; i < n; i++) {
+ GLint a = (GLint) arg0[i][ACOMP] + (GLint) arg1[i][ACOMP] - 128;
+ a = (a < 0) ? 0 : a << Ashift;
+ rgba[i][ACOMP] = (a > 255) ? 255 : (GLubyte) a;
+ }
+ }
+ break;
+ case GL_INTERPOLATE_EXT:
+ {
+ const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argA[0];
+ const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argA[1];
+ const GLubyte (*arg2)[4] = (const GLubyte (*)[4]) argA[2];
+ Ashift = 8 - Ashift;
+ for (i=0; i<n; i++)
+ rgba[i][ACOMP] = (GLubyte) ((PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + PROD(arg1[i][ACOMP], 255 - arg2[i][ACOMP])) >> Ashift);
+ }
+ break;
+ default:
+ gl_problem(NULL, "invalid combine mode");
+ }
+}
+#undef PROD
+
+
/**********************************************************************/
/* Texture Application */
@@ -1947,14 +2263,16 @@ _mesa_set_texture_sampler( struct gl_texture_object *t )
* Input: textureUnit - pointer to texture unit to apply
* format - base internal texture format
* n - number of fragments
+ * primary_rgba - primary colors (may be rgba for single texture)
* texels - array of texel colors
* InOut: rgba - incoming fragment colors modified by texel colors
* according to the texture environment mode.
*/
-static void apply_texture( const GLcontext *ctx,
- const struct gl_texture_unit *texUnit,
+static void apply_texture( CONST GLcontext *ctx,
+ CONST struct gl_texture_unit *texUnit,
GLuint n,
- GLubyte rgba[][4], CONST GLubyte texel[][4] )
+ GLubyte primary_rgba[][4], GLubyte texel[][4],
+ GLubyte rgba[][4] )
{
GLint baseLevel;
GLuint i;
@@ -2284,6 +2602,52 @@ static void apply_texture( const GLcontext *ctx,
}
break;
+ case GL_COMBINE_EXT: /* GL_EXT_combine_ext; we modify texel array */
+ switch (format) {
+ case GL_ALPHA:
+ for (i=0;i<n;i++)
+ texel[i][RCOMP] = texel[i][GCOMP] = texel[i][BCOMP] = 0;
+ break;
+ case GL_LUMINANCE:
+ for (i=0;i<n;i++) {
+ /* Cv = Lt */
+ GLubyte Lt = texel[i][RCOMP];
+ texel[i][GCOMP] = texel[i][BCOMP] = Lt;
+ /* Av = 1 */
+ texel[i][ACOMP] = 255;
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ for (i=0;i<n;i++) {
+ GLubyte Lt = texel[i][RCOMP];
+ /* Cv = Lt */
+ texel[i][GCOMP] = texel[i][BCOMP] = Lt;
+ }
+ break;
+ case GL_INTENSITY:
+ for (i=0;i<n;i++) {
+ /* Cv = It */
+ GLubyte It = texel[i][RCOMP];
+ texel[i][GCOMP] = texel[i][BCOMP] = It;
+ /* Av = It */
+ texel[i][ACOMP] = It;
+ }
+ break;
+ case GL_RGB:
+ for (i=0;i<n;i++) {
+ /* Av = 1 */
+ texel[i][ACOMP] = 255;
+ }
+ break;
+ case GL_RGBA: /* do nothing. */
+ break;
+ default:
+ gl_problem(ctx, "Bad format in apply_texture (GL_COMBINE_EXT)");
+ return;
+ }
+ _mesa_texture_combine (ctx, texUnit, n, primary_rgba, texel, rgba);
+ break;
+
default:
gl_problem(ctx, "Bad env mode in apply_texture");
return;
@@ -2299,7 +2663,7 @@ static void apply_texture( const GLcontext *ctx,
void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n,
const GLfloat s[], const GLfloat t[],
const GLfloat r[], GLfloat lambda[],
- GLubyte rgba[][4] )
+ GLubyte primary_rgba[][4], GLubyte rgba[][4] )
{
GLuint mask = (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE) << (texUnit * 4);
if (ctx->Texture.Enabled & mask) {
@@ -2369,8 +2733,7 @@ void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n,
(*textureUnit->Current->SampleFunc)( textureUnit->Current, n,
s, t, r, lambda, texel );
- apply_texture( ctx, textureUnit, n,
- rgba, (const GLubyte (*)[4])texel );
+ apply_texture( ctx, textureUnit, n, primary_rgba, texel, rgba );
}
}
}
diff --git a/xc/extras/Mesa/src/texture.h b/xc/extras/Mesa/src/texture.h
index 58bc13136..379e7a1d4 100644
--- a/xc/extras/Mesa/src/texture.h
+++ b/xc/extras/Mesa/src/texture.h
@@ -22,10 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
-
-
-
+/* $XFree86: xc/extras/Mesa/src/texture.h,v 1.6 2000/09/26 15:56:34 tsi Exp $ */
#ifndef TEXTURE_H
#define TEXTURE_H
@@ -46,7 +43,7 @@ extern void gl_update_texture_unit( GLcontext *ctx,
extern void gl_texture_pixels( GLcontext *ctx, GLuint texSet, GLuint n,
const GLfloat s[], const GLfloat t[],
const GLfloat r[], GLfloat lambda[],
- GLubyte rgba[][4] );
+ GLubyte primary_rgba[][4], GLubyte rgba[][4] );
#endif
diff --git a/xc/extras/Mesa/src/texutil.c b/xc/extras/Mesa/src/texutil.c
index 67805c8d7..a12ddd745 100644
--- a/xc/extras/Mesa/src/texutil.c
+++ b/xc/extras/Mesa/src/texutil.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/texutil.c,v 1.3 2000/09/26 15:56:34 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -586,6 +586,7 @@ _mesa_convert_teximage(MesaIntTexFormat dstFormat,
break;
case MESA_A8_R8_G8_B8:
+ case MESA_FF_R8_G8_B8:
/* 32-bit texels */
if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV){
/* special, optimized case */
@@ -661,13 +662,63 @@ _mesa_convert_teximage(MesaIntTexFormat dstFormat,
}
}
}
+ else if (srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE) {
+ /* general case */
+ if (wScale == 1 && hScale == 1) {
+ const GLubyte *src = _mesa_image_address(packing, srcImage,
+ srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0);
+ const GLint srcStride = _mesa_image_row_stride(packing,
+ srcWidth, srcFormat, srcType);
+ GLuint *dst = dstImage;
+ GLint row;
+ for (row = 0; row < dstHeight; row++) {
+ GLint col, col3;
+ for (col = col3 = 0; col < dstWidth; col++, col3 += 3) {
+ GLubyte r = src[col3 + 0];
+ GLubyte g = src[col3 + 1];
+ GLubyte b = src[col3 + 2];
+ GLubyte a = 255;
+ dst[col] = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+ src += srcStride;
+ dst = (GLuint *) ((GLubyte *) dst + dstRowStride);
+ }
+ }
+ else {
+ /* must rescale image */
+ GLuint *dst = dstImage;
+ GLint row;
+ for (row = 0; row < dstHeight; row++) {
+ GLint srcRow = row / hScale;
+ const GLubyte *src = _mesa_image_address(packing, srcImage,
+ srcWidth, srcHeight, srcFormat, srcType, 0, srcRow, 0);
+ GLint col;
+ for (col = 0; col < dstWidth; col++) {
+ GLint col3 = (col / wScale) * 3;
+ GLubyte r = src[col3 + 0];
+ GLubyte g = src[col3 + 1];
+ GLubyte b = src[col3 + 2];
+ GLubyte a = 255;
+ dst[col] = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+ dst = (GLuint *) ((GLubyte *) dst + dstRowStride);
+ }
+ }
+ }
else {
/* can't handle this source format/type combination */
return GL_FALSE;
}
+ if (dstFormat == MESA_FF_R8_G8_B8) {
+ /* set alpha bytes to 0xff */
+ GLuint i;
+ GLubyte *dst = (GLubyte *) dstImage;
+ for (i = 0; i < dstWidth * dstHeight; i++) {
+ dst[i * 4 + 3] = 0xff;
+ }
+ }
break;
-
default:
/* unexpected internal format! */
return GL_FALSE;
@@ -1140,6 +1191,7 @@ _mesa_convert_texsubimage(MesaIntTexFormat dstFormat,
break;
case MESA_A8_R8_G8_B8:
+ case MESA_FF_R8_G8_B8:
/* 32-bit texels */
if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV){
/* special, optimized case */
@@ -1223,6 +1275,18 @@ _mesa_convert_texsubimage(MesaIntTexFormat dstFormat,
/* can't handle this source format/type combination */
return GL_FALSE;
}
+ if (dstFormat == MESA_FF_R8_G8_B8) {
+ /* set alpha bytes to 0xff */
+ GLint row, col;
+ GLubyte *dst = (GLubyte *) dstImage
+ + dstYoffset * dstRowStride + dstXoffset;
+ for (row = 0; row < height; row++) {
+ for (col = 0; col < width; col++) {
+ dst[col * 4 + 3] = 0xff;
+ }
+ dst = dst + dstRowStride;
+ }
+ }
break;
@@ -1491,6 +1555,7 @@ _mesa_unconvert_teximage(MesaIntTexFormat srcFormat,
}
break;
case MESA_A8_R8_G8_B8:
+ case MESA_FF_R8_G8_B8:
ASSERT(dstFormat == GL_RGBA);
if (wScale == 1 && hScale == 1) {
GLint i, n = dstWidth * dstHeight;
@@ -1546,6 +1611,7 @@ _mesa_set_teximage_component_sizes(MesaIntTexFormat mesaFormat,
{ MESA_A4_R4_G4_B4, 4, 4, 4, 4, 0, 0, 0 },
{ MESA_A1_R5_G5_B5, 5, 5, 5, 1, 0, 0, 0 },
{ MESA_A8_R8_G8_B8, 8, 8, 8, 8, 0, 0, 0 },
+ { MESA_FF_R8_G8_B8, 8, 8, 8, 8, 0, 0, 0 },
{ -1, 0, 0, 0, 0, 0, 0, 0 }
};
GLint i;
diff --git a/xc/extras/Mesa/src/texutil.h b/xc/extras/Mesa/src/texutil.h
index 5f000be60..f1fbcfab2 100644
--- a/xc/extras/Mesa/src/texutil.h
+++ b/xc/extras/Mesa/src/texutil.h
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/texutil.h,v 1.3 2000/09/26 15:56:34 tsi Exp $ */
#ifndef TEXUTIL_H
#define TEXUTIL_H
@@ -32,6 +32,9 @@
+/*
+ * NOTE: "FF" means fill with byte value 0xff
+ */
/* msb <------ TEXEL BITS -----------> lsb */
typedef enum { /* ---- ---- ---- ---- ---- ---- ---- ---- */
MESA_I8, /* IIII IIII */
@@ -42,7 +45,8 @@ typedef enum { /* ---- ---- ---- ---- ---- ---- ---- ---- */
MESA_R5_G6_B5, /* RRRR RGGG GGGB BBBB */
MESA_A4_R4_G4_B4, /* AAAA RRRR GGGG BBBB */
MESA_A1_R5_G5_B5, /* ARRR RRGG GGGB BBBB */
- MESA_A8_R8_G8_B8 /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_A8_R8_G8_B8, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_FF_R8_G8_B8 /* FFFF FFFF RRRR RRRR GGGG GGGG BBBB BBBB */
} MesaIntTexFormat;
diff --git a/xc/extras/Mesa/src/triangle.c b/xc/extras/Mesa/src/triangle.c
index 29f85a4ef..d8f402d67 100644
--- a/xc/extras/Mesa/src/triangle.c
+++ b/xc/extras/Mesa/src/triangle.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/triangle.c,v 1.7 2000/09/26 15:56:34 tsi Exp $ */
/*
* Triangle rasterizers
@@ -1534,7 +1534,8 @@ void gl_set_triangle_function( GLcontext *ctx )
&& image->Border==0
&& ((format = image->Format)==GL_RGB || format==GL_RGBA)
&& (filter = current2Dtex->MinFilter)==current2Dtex->MagFilter
- && ctx->Light.Model.ColorControl==GL_SINGLE_COLOR) {
+ && ctx->Light.Model.ColorControl==GL_SINGLE_COLOR
+ && ctx->Texture.Unit[0].EnvMode!=GL_COMBINE_EXT) {
if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) {
diff --git a/xc/extras/Mesa/src/tritemp.h b/xc/extras/Mesa/src/tritemp.h
index 61e040365..54f8cea2e 100644
--- a/xc/extras/Mesa/src/tritemp.h
+++ b/xc/extras/Mesa/src/tritemp.h
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/tritemp.h,v 1.8 2000/06/17 00:02:18 martin Exp $ */
+/* $XFree86: xc/extras/Mesa/src/tritemp.h,v 1.9 2000/09/24 13:50:20 alanh Exp $ */
/*
* Triangle Rasterizer Template
@@ -146,10 +146,17 @@
const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
/* Do backface culling */
- if (area * bf < 0 || area * area < .0025)
+ if (area * bf < 0.0)
return;
- oneOverArea = 1.0F / area;
+ if (area == 0.0F)
+ return;
+
+ /* check for very tiny triangle */
+ if (area * area < 0.0025F) /* square it to ensure positive value */
+ oneOverArea = 1.0F / 0.0025F; /* a close-enough value */
+ else
+ oneOverArea = 1.0F / area;
}
#ifndef DO_OCCLUSION_TEST
diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h
index c44d602b9..550f4f1e6 100644
--- a/xc/extras/Mesa/src/types.h
+++ b/xc/extras/Mesa/src/types.h
@@ -2,7 +2,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -23,7 +23,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/types.h,v 1.7 2000/09/26 15:56:34 tsi Exp $ */
#ifndef TYPES_H
#define TYPES_H
@@ -831,9 +831,18 @@ struct gl_texture_unit {
GLuint Enabled;
GLuint ReallyEnabled;
- GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND */
+ GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, GL_COMBINE_EXT */
GLenum LastEnvMode;
+ GLenum CombineSourceRGB[3]; /* arg[i] for rgb EXT_texture_combine */
+ GLenum CombineSourceA[3]; /* dito for alpha combiner */
+ GLenum CombineModeRGB; /* GL_REPLACE, GL_DECAL, GL_ADD ... */
+ GLenum CombineModeA;
+ GLenum CombineOperandRGB[3]; /* SRC_COLOR or ONE_MINUS_SRC_COLOR */
+ GLenum CombineOperandA[3]; /* SRC_ALPHA or ONE_MINUS_SRC_ALPHA */
+ GLuint CombineScaleShiftRGB; /* 0, 1 or 2 */
+ GLuint CombineScaleShiftA;
+
GLfloat EnvColor[4];
GLuint TexGenEnabled; /* Bitwise-OR of [STRQ]_BIT values */
GLenum GenModeS; /* Tex coord generation mode, either */
@@ -868,6 +877,7 @@ struct gl_texture_unit {
struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */
struct gl_texture_object Saved2D;
struct gl_texture_object Saved3D;
+ struct gl_texture_object SavedCubeMap;
};
@@ -1259,6 +1269,8 @@ struct gl_shared_state {
/* Default texture objects (shared by all multi-texture units) */
struct gl_texture_object *DefaultD[4];
struct gl_texture_object *DefaultCubeMap;
+
+ void *DriverData; /* Device driver shared state */
};
@@ -1365,6 +1377,7 @@ struct gl_extensions {
struct extension *ext_list;
/* flags to quickly test if certain extensions are available */
GLboolean HaveTextureEnvAdd;
+ GLboolean HaveTextureEnvCombine;
GLboolean HaveTextureLodBias;
GLboolean HaveHpOcclusionTest;
GLboolean HaveTextureCubeMap;
@@ -1520,10 +1533,7 @@ struct gl_extensions {
* shared with the cull mode (ie. cull_mask_active and
* compacted_normals.)
*/
-#define SHADE_RGBA_VERTICES 0x4
-#define SHADE_RGBA_NORMALS 0x8
-#define SHADE_RGBA_SPEC 0xc /* note - not a seperate bit */
-#define SHADE_TWOSIDE 0x10
+#define SHADE_TWOSIDE 0x4
/* Flags for selecting a normal transformation function.
*/
@@ -1778,7 +1788,7 @@ struct gl_context {
GLmatrix ProjectionMatrix; /* current matrix, not stored on stack */
GLuint ProjectionStackDepth;
GLmatrix ProjectionStack[MAX_PROJECTION_STACK_DEPTH - 1];
- GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH - 1][2];
+ GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH][2];
/* Combined modelview and projection matrix */
GLmatrix ModelProjectMatrix;
@@ -1825,18 +1835,18 @@ struct gl_context {
struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
/* Renderer attribute groups */
- struct gl_accum_attrib Accum;
+ struct gl_accum_attrib Accum;
struct gl_colorbuffer_attrib Color;
struct gl_current_attrib Current;
struct gl_depthbuffer_attrib Depth;
- struct gl_eval_attrib Eval;
+ struct gl_eval_attrib Eval;
struct gl_fog_attrib Fog;
- struct gl_hint_attrib Hint;
- struct gl_light_attrib Light;
- struct gl_line_attrib Line;
- struct gl_list_attrib List;
- struct gl_pixel_attrib Pixel;
- struct gl_point_attrib Point;
+ struct gl_hint_attrib Hint;
+ struct gl_light_attrib Light;
+ struct gl_line_attrib Line;
+ struct gl_list_attrib List;
+ struct gl_pixel_attrib Pixel;
+ struct gl_point_attrib Point;
struct gl_polygon_attrib Polygon;
GLuint PolygonStipple[32];
struct gl_scissor_attrib Scissor;
@@ -1847,23 +1857,23 @@ struct gl_context {
/* Other attribute groups */
struct gl_histogram_attrib Histogram;
- struct gl_minmax_attrib MinMax;
- struct gl_convolution_attrib Convolution1D;
- struct gl_convolution_attrib Convolution2D;
- struct gl_convolution_attrib Separable2D;
+ struct gl_minmax_attrib MinMax;
+ struct gl_convolution_attrib Convolution1D;
+ struct gl_convolution_attrib Convolution2D;
+ struct gl_convolution_attrib Separable2D;
/* Client attribute stack */
GLuint ClientAttribStackDepth;
struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
/* Client attribute groups */
- struct gl_array_attrib Array; /* Vertex arrays */
+ struct gl_array_attrib Array; /* Vertex arrays */
struct gl_pixelstore_attrib Pack; /* Pixel packing */
struct gl_pixelstore_attrib Unpack; /* Pixel unpacking */
- struct gl_evaluators EvalMap; /* All evaluators */
- struct gl_feedback Feedback; /* Feedback */
- struct gl_selection Select; /* Selection */
+ struct gl_evaluators EvalMap; /* All evaluators */
+ struct gl_feedback Feedback; /* Feedback */
+ struct gl_selection Select; /* Selection */
struct gl_color_table ColorTable; /* Pre-convolution */
struct gl_color_table ProxyColorTable; /* Pre-convolution */
@@ -1878,21 +1888,21 @@ struct gl_context {
struct gl_fallback_arrays Fallback;
- GLenum ErrorValue; /* Last error code */
+ GLenum ErrorValue; /* Last error code */
/* Miscellaneous */
- GLuint NewState; /* bitwise OR of NEW_* flags */
- GLuint Enabled; /* bitwise or of ENABLE_* flags */
- GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
- GLuint StippleCounter; /* Line stipple counter */
- GLuint RasterMask; /* OR of rasterization flags */
+ GLuint NewState; /* bitwise OR of NEW_* flags */
+ GLuint Enabled; /* bitwise or of ENABLE_* flags */
+ GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
+ GLuint StippleCounter; /* Line stipple counter */
+ GLuint RasterMask; /* OR of rasterization flags */
GLuint TriangleCaps; /* OR of DD_* flags */
GLuint IndirectTriangles; /* TriangleCaps not handled by the driver */
- GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */
- GLfloat LineZoffset; /* Z offset for GL_LINE polygons */
- GLfloat PointZoffset; /* Z offset for GL_POINT polygons */
- GLboolean NeedNormals; /* Are vertex normal vectors needed? */
- GLuint FogMode; /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */
+ GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */
+ GLfloat LineZoffset; /* Z offset for GL_LINE polygons */
+ GLfloat PointZoffset; /* Z offset for GL_POINT polygons */
+ GLboolean NeedNormals; /* Are vertex normal vectors needed? */
+ GLuint FogMode; /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */
GLboolean DoViewportMapping;
@@ -1906,8 +1916,8 @@ struct gl_context {
normal_func *NormalTransform;
- /* Current shading function */
- GLuint shade_func_flags;
+ /* Current shading function table */
+ gl_shade_func *shade_func_tab;
GLfloat EyeZDir[3];
GLfloat rescale_factor;
diff --git a/xc/extras/Mesa/src/varray.c b/xc/extras/Mesa/src/varray.c
index 7df2603b1..ce8a4a186 100644
--- a/xc/extras/Mesa/src/varray.c
+++ b/xc/extras/Mesa/src/varray.c
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/varray.c,v 1.6 2000/09/26 15:56:34 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -375,7 +376,6 @@ _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
GLsizei count, const GLvoid *ptr)
{
(void) count;
- printf("glVertexPointerEXT %p\n", ptr);
_mesa_VertexPointer(size, type, stride, ptr);
}
diff --git a/xc/extras/Mesa/src/vb.c b/xc/extras/Mesa/src/vb.c
index 7dcb64b10..33139e8f3 100644
--- a/xc/extras/Mesa/src/vb.c
+++ b/xc/extras/Mesa/src/vb.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/vb.c,v 1.6 2000/09/26 15:56:35 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -43,9 +43,9 @@ struct vertex_buffer *gl_vb_create_for_immediate( GLcontext *ctx )
{
struct vertex_buffer *VB;
struct immediate *IM;
- GLuint alignment = 32;
+ const GLuint alignment = 32;
- VB = CALLOC_STRUCT(vertex_buffer);
+ VB = ALIGN_CALLOC_STRUCT( vertex_buffer, alignment );
if (!VB)
return 0;
@@ -63,14 +63,14 @@ struct vertex_buffer *gl_vb_create_for_immediate( GLcontext *ctx )
gl_vector4ub_alloc( &VB->BColor, VEC_WRITABLE, VB_SIZE, alignment );
gl_vector1ui_alloc( &VB->BIndex, VEC_WRITABLE, VB_SIZE, alignment );
- VB->ClipMask = (GLubyte *)MALLOC(sizeof(GLubyte) * VB_SIZE);
- VB->UserClipMask = (GLubyte *)CALLOC(sizeof(GLubyte) * VB_SIZE);
- VB->CullMask = (GLubyte *)MALLOC(sizeof(GLubyte) * VB_SIZE);
- VB->NormCullMask = (GLubyte *)MALLOC(sizeof(GLubyte) * VB_SIZE);
- VB->Spec[0] = (GLubyte (*)[4])MALLOC(sizeof(GLubyte) * 4 * VB_SIZE);
- VB->Spec[1] = (GLubyte (*)[4])MALLOC(sizeof(GLubyte) * 4 * VB_SIZE);
+ VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * VB_SIZE, alignment);
+ VB->UserClipMask = (GLubyte *) ALIGN_CALLOC(sizeof(GLubyte) * VB_SIZE, alignment);
+ VB->CullMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * VB_SIZE, alignment);
+ VB->NormCullMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * VB_SIZE, alignment);
+ VB->Spec[0] = (GLubyte (*)[4]) ALIGN_MALLOC(sizeof(GLubyte) * 4 * VB_SIZE, alignment);
+ VB->Spec[1] = (GLubyte (*)[4]) ALIGN_MALLOC(sizeof(GLubyte) * 4 * VB_SIZE, alignment);
- IM = VB->IM = gl_immediate_alloc( ctx );
+ IM = VB->IM = gl_immediate_alloc(ctx);
VB->store.Obj = &IM->v.Obj;
VB->store.Normal = &IM->v.Normal;
@@ -105,7 +105,7 @@ struct vertex_buffer *gl_vb_create_for_cva( GLcontext *ctx, GLuint size )
struct vertex_buffer *VB;
GLuint alignment = 32;
- VB = CALLOC_STRUCT(vertex_buffer);
+ VB = ALIGN_CALLOC_STRUCT( vertex_buffer, alignment );
if (!VB)
return 0;
@@ -121,11 +121,14 @@ struct vertex_buffer *gl_vb_create_for_cva( GLcontext *ctx, GLuint size )
VB->ClipAndMask = CLIP_ALL_BITS;
VB->pipeline = &ctx->CVA.pre;
- VB->ClipMask = (GLubyte *)MALLOC(sizeof(GLubyte) * size);
- VB->UserClipMask = (GLubyte *)CALLOC(sizeof(GLubyte) * size);
- VB->Spec[0] = (GLubyte (*)[4])MALLOC(sizeof(GLubyte) * 4 * size);
- VB->Spec[1] = (GLubyte (*)[4])MALLOC(sizeof(GLubyte) * 4 * size);
- VB->Flag = (GLuint *)MALLOC(sizeof(GLuint) * size);
+ VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * size, alignment );
+ VB->UserClipMask = (GLubyte *)ALIGN_CALLOC( sizeof(GLubyte) * size,
+ alignment );
+ VB->Spec[0] = (GLubyte (*)[4])ALIGN_MALLOC( sizeof(GLubyte) * 4 * size,
+ alignment );
+ VB->Spec[1] = (GLubyte (*)[4])ALIGN_MALLOC( sizeof(GLubyte) * 4 * size,
+ alignment );
+ VB->Flag = (GLuint *)ALIGN_MALLOC( sizeof(GLuint) * size, alignment );
gl_vector4f_alloc( &VB->Eye, 2, VEC_WRITABLE, size, alignment );
gl_vector4f_alloc( &VB->Clip, 2, VEC_WRITABLE, size, alignment );
@@ -201,8 +204,8 @@ void gl_vb_free( struct vertex_buffer *VB )
if ( ! --VB->IM->ref_count )
gl_immediate_free( VB->IM );
- FREE( VB->CullMask );
- FREE( VB->NormCullMask );
+ ALIGN_FREE( VB->CullMask );
+ ALIGN_FREE( VB->NormCullMask );
} else {
if (VB->store.Elt)
gl_vector4f_free( VB->store.Obj ); FREE( VB->store.Obj );
@@ -221,22 +224,22 @@ void gl_vb_free( struct vertex_buffer *VB )
gl_vector1ui_free( VB->FoggedIndex[0] ); FREE( VB->FoggedIndex[0] );
gl_vector1ui_free( VB->FoggedIndex[1] ); FREE( VB->FoggedIndex[1] );
- FREE( VB->Flag );
+ ALIGN_FREE( VB->Flag );
}
- if (VB->tmp_f) FREE(VB->tmp_f);
- if (VB->tmp_m) FREE(VB->tmp_m);
- if (VB->EvaluatedFlags) FREE(VB->EvaluatedFlags);
+ if (VB->tmp_f) FREE( VB->tmp_f );
+ if (VB->tmp_m) FREE( VB->tmp_m );
+ if (VB->EvaluatedFlags) FREE( VB->EvaluatedFlags );
- FREE( VB->Spec[0] );
- FREE( VB->Spec[1] );
- FREE( VB->ClipMask );
- FREE( VB->UserClipMask );
+ ALIGN_FREE( VB->Spec[0] );
+ ALIGN_FREE( VB->Spec[1] );
+ ALIGN_FREE( VB->ClipMask );
+ ALIGN_FREE( VB->UserClipMask );
if (VB->ctx->Driver.UnregisterVB)
VB->ctx->Driver.UnregisterVB( VB );
- FREE( VB );
+ ALIGN_FREE( VB );
}
@@ -254,7 +257,7 @@ struct immediate *gl_immediate_alloc( GLcontext *ctx )
return IM;
}
- IM = MALLOC_STRUCT(immediate);
+ IM = ALIGN_MALLOC_STRUCT( immediate, 32 );
if (!IM)
return 0;
@@ -272,7 +275,7 @@ struct immediate *gl_immediate_alloc( GLcontext *ctx )
IM->Material = 0;
IM->MaterialMask = 0;
#ifdef VMS
- for (j=0; j<VB_SIZE ; j++ )
+ for (j = 0; j < VB_SIZE; j++)
IM->Normal[j][0] = IM->Normal[j][1] = IM->Normal[j][2] = 0.0;
#endif
@@ -323,7 +326,7 @@ void gl_immediate_free( struct immediate *IM )
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
fprintf(stderr, "really free immediate %d\n", IM->id);
- FREE( IM );
+ ALIGN_FREE( IM );
}
else {
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
diff --git a/xc/extras/Mesa/src/vbcull.c b/xc/extras/Mesa/src/vbcull.c
index 927e485c6..4af76165b 100644
--- a/xc/extras/Mesa/src/vbcull.c
+++ b/xc/extras/Mesa/src/vbcull.c
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/vbcull.c,v 1.6 2000/09/26 15:56:35 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -92,7 +93,7 @@ static GLuint gl_cull_points( struct vertex_buffer *VB,
/* This is pretty pointless. (arf arf)
*/
- for (i=start+1;i<count;i++) {
+ for (i = start; i < count; i++) {
if (clipmask[i] == 0)
cullmask[i] = VERT_FACE_FRONT | PRIM_FACE_FRONT;
else {
@@ -783,6 +784,7 @@ void gl_purge_vertices( struct vertex_buffer *VB )
#define VERT_NOT_CLIPPED 0x80
+
static void build_clip_vert_bits( GLubyte *clipmask, const GLubyte *cullmask,
GLuint count )
{
@@ -842,7 +844,6 @@ GLuint gl_cull_vb( struct vertex_buffer *VB )
cullcount += n;
}
-
if (VB->LastPrimitive < VB->Count) {
if (copy_tab_cull[lastprim])
cullcount -= copy_tab_cull[prim]( VB,
@@ -862,8 +863,8 @@ GLuint gl_cull_vb( struct vertex_buffer *VB )
if (cullcount < VB->Count)
build_clip_vert_bits( VB->ClipMask, VB->CullMask, VB->Count );
-
}
+
if (VB->ClipOrMask) {
VB->CullMode |= CLIP_MASK_ACTIVE;
VB->CullFlag[1] |= (CLIP_ALL_BITS|CLIP_USER_BIT) & ctx->AllowVertexCull;
diff --git a/xc/extras/Mesa/src/vbfill.c b/xc/extras/Mesa/src/vbfill.c
index 4ee9d52a3..1bcea531a 100644
--- a/xc/extras/Mesa/src/vbfill.c
+++ b/xc/extras/Mesa/src/vbfill.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+/* $XFree86: xc/extras/Mesa/src/vbfill.c,v 1.6 2000/09/26 15:56:35 tsi Exp $ */
#ifdef PC_HEADER
#include "all.h"
@@ -693,6 +693,20 @@ _mesa_Indexubv( const GLubyte *c )
ASSIGN_3V(normal, x,y,z); \
}
+#if defined(USE_IEEE)
+#define NORMALF( x, y, z ) \
+{ \
+ GLuint count; \
+ GLint *normal; \
+ GET_IMMEDIATE; \
+ count = IM->Count; \
+ IM->Flag[count] |= VERT_NORM; \
+ normal = (GLint *)IM->Normal[count]; \
+ ASSIGN_3V(normal, *(int*)&(x), *(int*)&(y), *(int*)&(z)); \
+}
+#else
+#define NORMALF NORMAL
+#endif
void
_mesa_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz )
@@ -711,7 +725,7 @@ _mesa_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz )
void
_mesa_Normal3f( GLfloat nx, GLfloat ny, GLfloat nz )
{
- NORMAL(nx, ny, nz);
+ NORMALF(nx, ny, nz);
}
@@ -746,7 +760,7 @@ _mesa_Normal3dv( const GLdouble *v )
void
_mesa_Normal3fv( const GLfloat *v )
{
- NORMAL( v[0], v[1], v[2] );
+ NORMALF( v[0], v[1], v[2] );
}
@@ -811,6 +825,23 @@ _mesa_Normal3sv( const GLshort *v )
ASSIGN_4V(tc, s,t,u,v); \
}
+#if defined(USE_IEEE)
+#define TEXCOORD2F(s,t) \
+{ \
+ GLuint count; \
+ GLint *tc; \
+ GET_IMMEDIATE; \
+ count = IM->Count; \
+ IM->Flag[count] |= VERT_TEX0_12; \
+ tc = (GLint *)IM->TexCoord[0][count]; \
+ *tc = *(int *)&(s); \
+ *(tc+1) = *(int *)&(t); \
+ *(tc+2) = 0; \
+ *(tc+3) = IEEE_ONE; \
+}
+#else
+#define TEXCOORD2F TEXCOORD2
+#endif
void
_mesa_TexCoord1d( GLdouble s )
@@ -850,7 +881,7 @@ _mesa_TexCoord2d( GLdouble s, GLdouble t )
void
_mesa_TexCoord2f( GLfloat s, GLfloat t )
{
- TEXCOORD2(*(&s),*&t);
+ TEXCOORD2F(s,t);
}
@@ -962,7 +993,7 @@ _mesa_TexCoord2dv( const GLdouble *v )
void
_mesa_TexCoord2fv( const GLfloat *v )
{
- TEXCOORD2(v[0],v[1]);
+ TEXCOORD2F(v[0],v[1]);
}
@@ -1072,6 +1103,22 @@ _mesa_TexCoord4sv( const GLshort *v )
IM->maybe_transform_vb( IM ); \
}
+#if defined(USE_IEEE)
+#define VERTEX3F(IM,x,y,z) \
+{ \
+ GLuint count = IM->Count++; \
+ GLint *dest = (GLint *)IM->Obj[count]; \
+ IM->Flag[count] |= VERT_OBJ_23; \
+ dest[0] = *(int *)&(x); \
+ dest[1] = *(int *)&(y); \
+ dest[2] = *(int *)&(z); \
+ dest[3] = IEEE_ONE; \
+ if (dest == (GLint *)IM->Obj[VB_MAX-1]) \
+ IM->maybe_transform_vb( IM ); \
+}
+#else
+#define VERTEX3F VERTEX3
+#endif
void
_mesa_Vertex2d( GLdouble x, GLdouble y )
@@ -1127,7 +1174,7 @@ void
_mesa_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
{
GET_IMMEDIATE;
- VERTEX3( IM, *(&x), *(&y), *(&z) );
+ VERTEX3F( IM, x, y, z );
}
@@ -1159,7 +1206,7 @@ void
_mesa_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
GET_IMMEDIATE;
- VERTEX4( IM, *(&x), *(&y), *(&z), *(&w) );
+ VERTEX4( IM, x, y, z, w );
}
@@ -1223,7 +1270,7 @@ void
_mesa_Vertex3fv( const GLfloat *v )
{
GET_IMMEDIATE;
- VERTEX3( IM, v[0], v[1], v[2] );
+ VERTEX3F( IM, v[0], v[1], v[2] );
}
@@ -1347,6 +1394,22 @@ _mesa_Vertex4sv( const GLshort *v )
ASSIGN_4V(tc, s,t,u,v); \
}
+#if defined(USE_IEEE)
+#define MULTI_TEXCOORD2F(s,t) \
+{ \
+ GLuint count; \
+ GLint *tc; \
+ count = IM->Count; \
+ IM->Flag[count] |= IM->TF2[texSet]; \
+ tc = (GLint *)IM->TexCoord[texSet][count]; \
+ tc[0] = *(int *)&(s); \
+ tc[1] = *(int *)&(t); \
+ tc[2] = 0; \
+ tc[3] = IEEE_ONE; \
+}
+#else
+#define MULTI_TEXCOORD2F MULTI_TEXCOORD2
+#endif
void
_mesa_MultiTexCoord1dARB(GLenum target, GLdouble s)
@@ -1444,7 +1507,7 @@ _mesa_MultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
GLint texSet;
GET_IMMEDIATE;
CHECK_ARB
- MULTI_TEXCOORD2( s, t );
+ MULTI_TEXCOORD2F( s, t );
}
void
@@ -1453,7 +1516,7 @@ _mesa_MultiTexCoord2fvARB(GLenum target, const GLfloat *v)
GLint texSet;
GET_IMMEDIATE;
CHECK_ARB
- MULTI_TEXCOORD2( v[0], v[1] );
+ MULTI_TEXCOORD2F( v[0], v[1] );
}
void
diff --git a/xc/extras/Mesa/src/vbrender.c b/xc/extras/Mesa/src/vbrender.c
index cc4adb981..c71902330 100644
--- a/xc/extras/Mesa/src/vbrender.c
+++ b/xc/extras/Mesa/src/vbrender.c
@@ -22,7 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/extras/Mesa/src/vbrender.c,v 1.6 2000/08/28 02:43:10 tsi Exp $ */
+/* $XFree86: xc/extras/Mesa/src/vbrender.c,v 1.7 2000/09/24 13:50:22 alanh Exp $ */
/*
* Render points, lines, and polygons. The only entry point to this
@@ -100,20 +100,14 @@ static INLINE void gl_render_clipped_line2( GLcontext *ctx,
static void offset_polygon( GLcontext *ctx, GLfloat a, GLfloat b, GLfloat c )
{
GLfloat ac, bc, m;
- GLfloat offset;
+ GLfloat offset = 0.0F;
- if (c<0.001F && c>-0.001F) {
- /* to prevent underflow problems */
- offset = 0.0F;
- }
- else {
+ if (c*c > 1e-16) {
ac = a / c;
bc = b / c;
if (ac<0.0F) ac = -ac;
if (bc<0.0F) bc = -bc;
m = MAX2( ac, bc );
- /* m = sqrt( ac*ac + bc*bc ); */
-
offset = m * ctx->Polygon.OffsetFactor + ctx->Polygon.OffsetUnits;
}
@@ -125,10 +119,17 @@ static void offset_polygon( GLcontext *ctx, GLfloat a, GLfloat b, GLfloat c )
#define FLUSH_PRIM(prim) \
do { \
if (ctx->PB->primitive != prim) { \
- gl_reduced_prim_change( ctx, prim ); \
+ gl_reduced_prim_change( ctx, prim ); \
} \
} while(0)
+#define FLUSH_POLY(prim) \
+do { \
+ if ((ctx->IndirectTriangles & DD_TRI_UNFILLED) == 0) { \
+ FLUSH_PRIM(prim); \
+ } \
+} while(0)
+
/*
* When glPolygonMode() is used to specify that the front/back rendering
@@ -156,7 +157,6 @@ static void unfilled_polygon( GLcontext *ctx,
}
else if (mode==GL_LINE) {
GLuint i, j0, j1;
- ctx->StippleCounter = 0;
/* draw the edges */
for (i=0;i<n-1;i++) {
@@ -319,6 +319,13 @@ static void render_triangle( GLcontext *ctx,
else {
(*ctx->Driver.TriangleFunc)( ctx, v0, v1, v2, pv );
}
+
+ if (tricaps & DD_TRI_OFFSET) {
+ /* reset Z offsets now */
+ ctx->PointZoffset = 0.0;
+ ctx->LineZoffset = 0.0;
+ ctx->PolygonZoffset = 0.0;
+ }
}
@@ -377,6 +384,13 @@ static void render_quad( GLcontext *ctx, GLuint v0, GLuint v1,
else {
(*ctx->Driver.QuadFunc)( ctx, v0, v1, v2, v3, pv );
}
+
+ if (tricaps & DD_TRI_OFFSET) {
+ /* reset Z offsets now */
+ ctx->PointZoffset = 0.0;
+ ctx->LineZoffset = 0.0;
+ ctx->PolygonZoffset = 0.0;
+ }
}
@@ -415,15 +429,16 @@ do { \
#define EDGEFLAG_POLY_TRI_PRE( i2, i1, i, pv) \
do { \
+ eflag[i2] |= (eflag[i2] >> 2) & 1; \
eflag[i1] |= (eflag[i1] >> 2) & 1; \
eflag[i] |= (eflag[i] >> 2) & 2; \
} while (0)
#define EDGEFLAG_POLY_TRI_POST( i2, i1, i, pv) \
do { \
- eflag[i2] = 0; \
+ eflag[i2] &= ~(4|1); \
eflag[i1] &= ~(4|1); \
- eflag[i] &= ~(8|2); \
+ eflag[i] &= ~(8|2); \
} while (0)
@@ -503,7 +518,7 @@ do { \
(void) vlist; (void) eflag; (void) stipplecounter;
#define TAG(x) x##_cull
-#define INIT(x) FLUSH_PRIM(x)
+#define INIT(x) if (x == GL_POLYGON) FLUSH_POLY(x); else FLUSH_PRIM(x)
#define RESET_STIPPLE *stipplecounter = 0
#include "render_tmp.h"
@@ -541,7 +556,7 @@ do { \
GLuint *stipplecounter = &VB->ctx->StippleCounter; \
(void) eflag; (void) stipplecounter;
-#define INIT(x) FLUSH_PRIM(x);
+#define INIT(x) if (x == GL_POLYGON) FLUSH_POLY(x); else FLUSH_PRIM(x)
#define RESET_STIPPLE *stipplecounter = 0
#include "render_tmp.h"
@@ -575,7 +590,7 @@ do { \
GLuint *stipplecounter = &VB->ctx->StippleCounter; \
(void) eflag; (void) stipplecounter;
-#define INIT(x) FLUSH_PRIM(x);
+#define INIT(x) if (x == GL_POLYGON) FLUSH_POLY(x); else FLUSH_PRIM(x)
#define TAG(x) x##_clipped
#define RESET_STIPPLE *stipplecounter = 0
@@ -633,9 +648,9 @@ setup_edgeflag( struct vertex_buffer *VB,
case GL_POLYGON:
if (flag[0]) flag[0] = 0x1;
for (i = 1 ; i < n-1 ; i++) {
- if (flag[i]) flag[i] = 0x1<<2;
+ if (flag[i]) flag[i] = 0x4;
}
- if (flag[i]) flag[i] = 0x3<<2;
+ if (flag[i]) flag[i] = 0x8;
break;
default:
break;
diff --git a/xc/extras/Mesa/src/vector.c b/xc/extras/Mesa/src/vector.c
index b63b8df69..a7daed715 100644
--- a/xc/extras/Mesa/src/vector.c
+++ b/xc/extras/Mesa/src/vector.c
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/vector.c,v 1.5 2000/09/26 15:56:35 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -68,6 +69,8 @@ static const GLubyte size_bits[5] = {
VEC_SIZE_4,
};
+
+
void gl_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] )
{
v->stride = 4*sizeof(GLfloat);
@@ -78,7 +81,6 @@ void gl_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] )
v->flags = size_bits[4] | flags | VEC_GOOD_STRIDE;
}
-
void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] )
{
v->stride = 3*sizeof(GLfloat);
@@ -116,13 +118,6 @@ void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage )
}
-#define ALIGN_MALLOC(vec, type, bytes, alignment) \
-do { \
- vec->storage = MALLOC( bytes + alignment - 1 ); \
- vec->start = type (((unsigned long)vec->storage + alignment - 1) \
- & ~(unsigned long)(alignment - 1)); \
-} while (0)
-
void gl_vector4f_alloc( GLvector4f *v, GLuint sz, GLuint flags, GLuint count,
GLuint alignment )
@@ -130,18 +125,19 @@ void gl_vector4f_alloc( GLvector4f *v, GLuint sz, GLuint flags, GLuint count,
(void) sz;
v->stride = 4*sizeof(GLfloat);
v->size = 2;
- ALIGN_MALLOC(v, (GLfloat *), count * 4 * sizeof(GLfloat), alignment);
+ v->storage = v->start = (GLfloat *)
+ ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment );
v->data = (GLfloat (*)[4])v->start;
v->count = 0;
v->flags = size_bits[4] | flags | VEC_MALLOC | VEC_GOOD_STRIDE;
}
-
void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 3*sizeof(GLfloat);
- ALIGN_MALLOC(v, (GLfloat *), count * 3 * sizeof(GLfloat), alignment);
+ v->storage = v->start = (GLfloat *)
+ ALIGN_MALLOC( count * 3 * sizeof(GLfloat), alignment );
v->data = (GLfloat (*)[3])v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -151,7 +147,8 @@ void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 4*sizeof(GLubyte);
- ALIGN_MALLOC(v, (GLubyte *), count * 4 * sizeof(GLubyte), alignment);
+ v->storage = v->start = (GLubyte *)
+ ALIGN_MALLOC( count * 4 * sizeof(GLubyte), alignment );
v->data = (GLubyte (*)[4])v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -161,7 +158,8 @@ void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 1*sizeof(GLubyte);
- ALIGN_MALLOC(v, (GLubyte *), count * sizeof(GLubyte), alignment);
+ v->storage = v->start = (GLubyte *)
+ ALIGN_MALLOC( count * sizeof(GLubyte), alignment );
v->data = v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -171,7 +169,8 @@ void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 1*sizeof(GLuint);
- ALIGN_MALLOC(v, (GLuint *), count * sizeof(GLuint), alignment);
+ v->storage = v->start = (GLuint *)
+ ALIGN_MALLOC( count * sizeof(GLuint), alignment );
v->data = v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -182,7 +181,7 @@ void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count,
void gl_vector4f_free( GLvector4f *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -193,7 +192,7 @@ void gl_vector4f_free( GLvector4f *v )
void gl_vector3f_free( GLvector3f *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -204,7 +203,7 @@ void gl_vector3f_free( GLvector3f *v )
void gl_vector4ub_free( GLvector4ub *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -215,7 +214,7 @@ void gl_vector4ub_free( GLvector4ub *v )
void gl_vector1ub_free( GLvector1ub *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -226,7 +225,7 @@ void gl_vector1ub_free( GLvector1ub *v )
void gl_vector1ui_free( GLvector1ui *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -234,6 +233,8 @@ void gl_vector1ui_free( GLvector1ui *v )
}
}
+
+
void gl_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling )
{
GLfloat c[4] = { 0, 0, 0, 1 };
@@ -282,7 +283,6 @@ void gl_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling )
}
}
-
void gl_vector3f_print( GLvector3f *v, GLubyte *cullmask, GLboolean culling )
{
GLfloat *d = (GLfloat *)v->data;
diff --git a/xc/extras/Mesa/src/xform.h b/xc/extras/Mesa/src/xform.h
index d8757b803..ce2166901 100644
--- a/xc/extras/Mesa/src/xform.h
+++ b/xc/extras/Mesa/src/xform.h
@@ -22,10 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
-
-
-
+/* $XFree86: xc/extras/Mesa/src/xform.h,v 1.5 2000/09/26 15:56:35 tsi Exp $ */
#ifndef XFORM_H
#define XFORM_H
@@ -134,7 +131,7 @@ typedef void (*vec_copy_func)( GLvector4f *to,
* parameter, to allow a unified interface.
*/
typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec,
- const GLmatrix *mat,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *clipmask,
const GLubyte flag );
@@ -144,11 +141,11 @@ extern GLvector4f *gl_project_points( GLvector4f *to,
const GLvector4f *from );
extern void gl_transform_bounds3( GLubyte *orMask, GLubyte *andMask,
- const GLmatrix *mat,
+ const GLfloat m[16],
CONST GLfloat src[][3] );
extern void gl_transform_bounds2( GLubyte *orMask, GLubyte *andMask,
- const GLmatrix *mat,
+ const GLfloat m[16],
CONST GLfloat src[][3] );
@@ -168,11 +165,11 @@ extern void gl_transform_point_sz( GLfloat Q[4], const GLfloat M[16],
#define TransformRaw( to, mat, from ) \
- ( (*gl_transform_tab[0][(from)->size][(mat)->type])( to, mat, from, 0, 0 ), \
+ ( (*gl_transform_tab[0][(from)->size][(mat)->type])( to, (mat)->m, from, 0, 0 ), \
(to) )
#define Transform( to, mat, from, mask, cull ) \
- ( (*gl_transform_tab[cull!=0][(from)->size][(mat)->type])( to, mat, from, mask, cull ), \
+ ( (*gl_transform_tab[cull!=0][(from)->size][(mat)->type])( to, (mat)->m, from, mask, cull ), \
(to) )
diff --git a/xc/extras/Mesa/src/xform_tmp.h b/xc/extras/Mesa/src/xform_tmp.h
index 2e796aac1..8f521fa11 100644
--- a/xc/extras/Mesa/src/xform_tmp.h
+++ b/xc/extras/Mesa/src/xform_tmp.h
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/xform_tmp.h,v 1.5 2000/09/26 15:56:35 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -64,8 +65,9 @@
* cliped and/or culled vertices.
*/
-static void _XFORMAPI TAG(transform_points1_general)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points1_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -74,7 +76,6 @@ static void _XFORMAPI TAG(transform_points1_general)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m12 = m[12];
const GLfloat m1 = m[1], m13 = m[13];
const GLfloat m2 = m[2], m14 = m[14];
@@ -97,8 +98,9 @@ static void _XFORMAPI TAG(transform_points1_general)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points1_identity)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points1_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -108,10 +110,8 @@ static void _XFORMAPI TAG(transform_points1_identity)( GLvector4f *to_vec,
GLuint count = from_vec->count;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint i;
- (void) mat;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_IDENTITY);
if (to_vec == from_vec) return;
STRIDE_LOOP {
CLIP_CHECK {
@@ -124,8 +124,9 @@ static void _XFORMAPI TAG(transform_points1_identity)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points1_2d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points1_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -134,13 +135,11 @@ static void _XFORMAPI TAG(transform_points1_2d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1];
const GLfloat m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0];
@@ -153,8 +152,9 @@ static void _XFORMAPI TAG(transform_points1_2d)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -163,12 +163,10 @@ static void _XFORMAPI TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0];
@@ -182,8 +180,9 @@ static void _XFORMAPI TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points1_3d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points1_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -192,13 +191,11 @@ static void _XFORMAPI TAG(transform_points1_3d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2];
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0];
@@ -213,8 +210,9 @@ static void _XFORMAPI TAG(transform_points1_3d)( GLvector4f *to_vec,
}
-static void _XFORMAPI TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -223,13 +221,11 @@ static void _XFORMAPI TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0];
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0];
@@ -243,8 +239,9 @@ static void _XFORMAPI TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points1_perspective)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points1_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -253,12 +250,10 @@ static void _XFORMAPI TAG(transform_points1_perspective)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_PERSPECTIVE);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0];
@@ -280,8 +275,9 @@ static void _XFORMAPI TAG(transform_points1_perspective)( GLvector4f *to_vec,
* present early in the geometry pipeline and throughout the
* texture pipeline.
*/
-static void _XFORMAPI TAG(transform_points2_general)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points2_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -290,7 +286,6 @@ static void _XFORMAPI TAG(transform_points2_general)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m4 = m[4], m12 = m[12];
const GLfloat m1 = m[1], m5 = m[5], m13 = m[13];
const GLfloat m2 = m[2], m6 = m[6], m14 = m[14];
@@ -312,8 +307,9 @@ static void _XFORMAPI TAG(transform_points2_general)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points2_identity)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points2_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -323,10 +319,8 @@ static void _XFORMAPI TAG(transform_points2_identity)( GLvector4f *to_vec,
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
GLuint i;
- (void) mat;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_IDENTITY);
if (to_vec == from_vec) return;
STRIDE_LOOP {
CLIP_CHECK {
@@ -339,8 +333,9 @@ static void _XFORMAPI TAG(transform_points2_identity)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points2_2d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points2_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -349,13 +344,11 @@ static void _XFORMAPI TAG(transform_points2_2d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
const GLfloat m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1];
@@ -369,8 +362,9 @@ static void _XFORMAPI TAG(transform_points2_2d)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -379,12 +373,10 @@ static void _XFORMAPI TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1];
@@ -398,8 +390,9 @@ static void _XFORMAPI TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points2_3d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points2_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -408,13 +401,11 @@ static void _XFORMAPI TAG(transform_points2_3d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1];
@@ -432,8 +423,9 @@ static void _XFORMAPI TAG(transform_points2_3d)( GLvector4f *to_vec,
/* I would actually say this was a fairly important function, from
* a texture transformation point of view.
*/
-static void _XFORMAPI TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -442,13 +434,11 @@ static void _XFORMAPI TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5];
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1];
@@ -471,8 +461,9 @@ static void _XFORMAPI TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
* code. It's also hard to remove any of these functions if you are
* attached to the assertions that have appeared in them.
*/
-static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points2_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -481,12 +472,10 @@ static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_PERSPECTIVE);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1];
@@ -503,8 +492,9 @@ static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec,
-static void _XFORMAPI TAG(transform_points3_general)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points3_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -513,7 +503,6 @@ static void _XFORMAPI TAG(transform_points3_general)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12];
const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13];
const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14];
@@ -521,7 +510,6 @@ static void _XFORMAPI TAG(transform_points3_general)( GLvector4f *to_vec,
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_GENERAL);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2];
@@ -536,8 +524,9 @@ static void _XFORMAPI TAG(transform_points3_general)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points3_identity)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points3_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -547,10 +536,8 @@ static void _XFORMAPI TAG(transform_points3_identity)( GLvector4f *to_vec,
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
GLuint i;
- (void) mat;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_IDENTITY);
if (to_vec == from_vec) return;
STRIDE_LOOP {
CLIP_CHECK {
@@ -564,8 +551,9 @@ static void _XFORMAPI TAG(transform_points3_identity)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points3_2d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points3_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -574,13 +562,11 @@ static void _XFORMAPI TAG(transform_points3_2d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
const GLfloat m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2];
@@ -594,8 +580,9 @@ static void _XFORMAPI TAG(transform_points3_2d)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -604,12 +591,10 @@ static void _XFORMAPI TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2];
@@ -623,8 +608,9 @@ static void _XFORMAPI TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points3_3d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points3_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -633,14 +619,12 @@ static void _XFORMAPI TAG(transform_points3_3d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2];
@@ -656,8 +640,9 @@ static void _XFORMAPI TAG(transform_points3_3d)( GLvector4f *to_vec,
/* previously known as ortho...
*/
-static void _XFORMAPI TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -666,13 +651,11 @@ static void _XFORMAPI TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5];
const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2];
@@ -686,8 +669,9 @@ static void _XFORMAPI TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points3_perspective)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points3_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -696,13 +680,11 @@ static void _XFORMAPI TAG(transform_points3_perspective)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
const GLfloat m10 = m[10], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_PERSPECTIVE);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2];
@@ -719,8 +701,9 @@ static void _XFORMAPI TAG(transform_points3_perspective)( GLvector4f *to_vec,
-static void _XFORMAPI TAG(transform_points4_general)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points4_general)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -729,7 +712,6 @@ static void _XFORMAPI TAG(transform_points4_general)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12];
const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13];
const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14];
@@ -737,7 +719,6 @@ static void _XFORMAPI TAG(transform_points4_general)( GLvector4f *to_vec,
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_GENERAL);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
@@ -752,8 +733,9 @@ static void _XFORMAPI TAG(transform_points4_general)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points4_identity)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points4_identity)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -763,10 +745,8 @@ static void _XFORMAPI TAG(transform_points4_identity)( GLvector4f *to_vec,
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
GLuint i;
- (void) mat;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_IDENTITY);
if (to_vec == from_vec) return;
STRIDE_LOOP {
CLIP_CHECK {
@@ -781,8 +761,9 @@ static void _XFORMAPI TAG(transform_points4_identity)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points4_2d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points4_2d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -791,13 +772,11 @@ static void _XFORMAPI TAG(transform_points4_2d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
const GLfloat m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
@@ -812,8 +791,9 @@ static void _XFORMAPI TAG(transform_points4_2d)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -822,12 +802,10 @@ static void _XFORMAPI TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_2D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
@@ -842,8 +820,9 @@ static void _XFORMAPI TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points4_3d)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points4_3d)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -852,14 +831,12 @@ static void _XFORMAPI TAG(transform_points4_3d)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
@@ -874,8 +851,9 @@ static void _XFORMAPI TAG(transform_points4_3d)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -884,13 +862,11 @@ static void _XFORMAPI TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5];
const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_3D_NO_ROT);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
@@ -905,8 +881,9 @@ static void _XFORMAPI TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
to_vec->count = from_vec->count;
}
-static void _XFORMAPI TAG(transform_points4_perspective)( GLvector4f *to_vec,
- const GLmatrix *mat,
+static void _XFORMAPI
+TAG(transform_points4_perspective)( GLvector4f *to_vec,
+ const GLfloat m[16],
const GLvector4f *from_vec,
const GLubyte *mask,
const GLubyte flag )
@@ -915,13 +892,11 @@ static void _XFORMAPI TAG(transform_points4_perspective)( GLvector4f *to_vec,
GLfloat *from = from_vec->start;
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
GLuint count = from_vec->count;
- const GLfloat *m = mat->m;
const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
const GLfloat m10 = m[10], m14 = m[14];
GLuint i;
(void) mask;
(void) flag;
- ASSERT(mat->type == MATRIX_PERSPECTIVE);
STRIDE_LOOP {
CLIP_CHECK {
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];