summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa/src
diff options
context:
space:
mode:
Diffstat (limited to 'xc/extras/Mesa/src')
-rw-r--r--xc/extras/Mesa/src/OSmesa/osmesa.c7
-rw-r--r--xc/extras/Mesa/src/SPARC/sparc.c10
-rw-r--r--xc/extras/Mesa/src/X/fakeglx.c8
-rw-r--r--xc/extras/Mesa/src/X/xm_api.c4
-rw-r--r--xc/extras/Mesa/src/X86/mmx_blend.S740
-rw-r--r--xc/extras/Mesa/src/api_arrayelt.c8
-rw-r--r--xc/extras/Mesa/src/api_noop.c50
-rw-r--r--xc/extras/Mesa/src/api_noop.h28
-rw-r--r--xc/extras/Mesa/src/buffers.c8
-rw-r--r--xc/extras/Mesa/src/context.c60
-rw-r--r--xc/extras/Mesa/src/dlist.c13
-rw-r--r--xc/extras/Mesa/src/get.c4
-rw-r--r--xc/extras/Mesa/src/mmath.h2
-rw-r--r--xc/extras/Mesa/src/mtypes.h37
-rw-r--r--xc/extras/Mesa/src/state.c2
-rw-r--r--xc/extras/Mesa/src/swrast/s_blend.c10
-rw-r--r--xc/extras/Mesa/src/swrast/s_context.c8
-rw-r--r--xc/extras/Mesa/src/swrast/s_copypix.c10
-rw-r--r--xc/extras/Mesa/src/swrast/s_depth.c20
-rw-r--r--xc/extras/Mesa/src/swrast/s_drawpix.c6
-rw-r--r--xc/extras/Mesa/src/swrast/s_imaging.c8
-rw-r--r--xc/extras/Mesa/src/swrast/s_readpix.c12
-rw-r--r--xc/extras/Mesa/src/swrast/s_span.c36
-rw-r--r--xc/extras/Mesa/src/swrast/s_stencil.c18
-rw-r--r--xc/extras/Mesa/src/swrast/s_texture.c61
-rw-r--r--xc/extras/Mesa/src/swrast/s_zoom.c16
-rw-r--r--xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h8
-rw-r--r--xc/extras/Mesa/src/texstate.c14
-rw-r--r--xc/extras/Mesa/src/texstore.c15
-rw-r--r--xc/extras/Mesa/src/tnl/t_array_api.c58
-rw-r--r--xc/extras/Mesa/src/tnl/t_context.c28
-rw-r--r--xc/extras/Mesa/src/tnl/t_context.h11
-rw-r--r--xc/extras/Mesa/src/tnl/t_eval_api.c30
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_alloc.c8
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_alloc.h6
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_api.c150
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_api.h1
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_debug.c133
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_dlist.c14
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_eval.c13
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_exec.c17
-rw-r--r--xc/extras/Mesa/src/tnl/t_imm_fixup.c10
-rw-r--r--xc/extras/Mesa/src/tnl/t_vb_lighttmp.h21
-rw-r--r--xc/extras/Mesa/src/tnl/t_vb_normals.c16
-rw-r--r--xc/extras/Mesa/src/tnl/t_vb_render.c7
-rw-r--r--xc/extras/Mesa/src/tnl/t_vb_vertex.c7
-rw-r--r--xc/extras/Mesa/src/vtxfmt.c10
47 files changed, 1020 insertions, 743 deletions
diff --git a/xc/extras/Mesa/src/OSmesa/osmesa.c b/xc/extras/Mesa/src/OSmesa/osmesa.c
index ccce23967..e15b67ab2 100644
--- a/xc/extras/Mesa/src/OSmesa/osmesa.c
+++ b/xc/extras/Mesa/src/OSmesa/osmesa.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -36,6 +36,7 @@
#include "glheader.h"
#include "GL/osmesa.h"
+#include "buffers.h"
#include "context.h"
#include "colormac.h"
#include "depth.h"
@@ -479,6 +480,10 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
ctx->gl_ctx.Scissor.Width = width;
ctx->gl_ctx.Scissor.Height = height;
}
+ else {
+ /* this will make ensure we recognize the new buffer size */
+ _mesa_ResizeBuffersMESA();
+ }
return GL_TRUE;
}
diff --git a/xc/extras/Mesa/src/SPARC/sparc.c b/xc/extras/Mesa/src/SPARC/sparc.c
index 4e0688cfa..0ed54fe60 100644
--- a/xc/extras/Mesa/src/SPARC/sparc.c
+++ b/xc/extras/Mesa/src/SPARC/sparc.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -111,9 +111,13 @@ void _mesa_init_all_sparc_transform_asm(void)
ASSIGN_XFORM_GROUP(sparc, 3)
ASSIGN_XFORM_GROUP(sparc, 4)
+#if 0
+ /* Disabled for now. See Mesa bug report # 544665. Evidently these
+ * functions are using SPARC registers that shouldn't be touched.
+ */
_mesa_clip_tab[4] = _mesa_sparc_cliptest_points4;
_mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np;
-
+#endif
_mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =
_mesa_sparc_transform_normalize_normals;
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =
diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c
index 03f8cd396..0fdb6bbf2 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: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -65,7 +65,7 @@
#define SERVER_MINOR_VERSION 4
/* This is appended onto the glXGetClient/ServerString version strings. */
-#define MESA_GLX_VERSION "Mesa 4.0.2"
+#define MESA_GLX_VERSION "Mesa 4.0.3"
/* Who implemented this GLX? */
#define VENDOR "Brian Paul"
@@ -1790,7 +1790,11 @@ Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
*value = False; /* XXX ??? */
break;
case GLX_X_VISUAL_TYPE:
+#if defined(__cplusplus) || defined(c_plusplus)
+ switch (v->vishandle->c_class) {
+#else
switch (v->vishandle->class) {
+#endif
case GrayScale:
*value = GLX_GRAY_SCALE;
break;
diff --git a/xc/extras/Mesa/src/X/xm_api.c b/xc/extras/Mesa/src/X/xm_api.c
index 0dfad6a8a..44df501f4 100644
--- a/xc/extras/Mesa/src/X/xm_api.c
+++ b/xc/extras/Mesa/src/X/xm_api.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -2514,7 +2514,7 @@ const char *XMesaGetString( XMesaContext c, int name )
{
(void) c;
if (name==XMESA_VERSION) {
- return "3.5";
+ return "4.0.3";
}
else if (name==XMESA_EXTENSIONS) {
return "";
diff --git a/xc/extras/Mesa/src/X86/mmx_blend.S b/xc/extras/Mesa/src/X86/mmx_blend.S
index 154b8ef2c..8efae08f5 100644
--- a/xc/extras/Mesa/src/X86/mmx_blend.S
+++ b/xc/extras/Mesa/src/X86/mmx_blend.S
@@ -1,352 +1,418 @@
+/*
+ * Written by José Fonseca <j_r_fonseca@yahoo.co.uk>
+ */
+
#include "matypes.h"
+/*
+ * make the following approximation to the division (Sree)
+ *
+ * rgb*a/255 ~= (rgb*(a+1)) >> 256
+ *
+ * which is the fastest method that satisfies the following OpenGL criteria
+ *
+ * 0*0 = 0 and 255*255 = 255
+ *
+ * note this one should be used alone
+ */
+#define GMBT_ALPHA_PLUS_ONE 0
+
+/*
+ * take the geometric series approximation to the division
+ *
+ * t/255 = (t >> 8) + (t >> 16) + (t >> 24) ..
+ *
+ * in this case just the first two terms to fit in 16bit arithmetic
+ *
+ * t/255 ~= (t + (t >> 8)) >> 8
+ *
+ * note that just by itself it doesn't satisfies the OpenGL criteria, as 255*255 = 254,
+ * so the special case a = 255 must be accounted or roundoff must be used
+ */
+#define GMBT_GEOMETRIC_SERIES 1
+
+/*
+ * when using a geometric series division instead of truncating the result
+ * use roundoff in the approximation (Jim Blinn)
+ *
+ * t = rgb*a + 0x80
+ *
+ * achieving the exact results
+ */
+#define GMBT_ROUNDOFF 0
+
+/* instead of the roundoff this adds a small correction to satisfy the OpenGL criteria
+ *
+ * t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8
+ *
+ * note that although is faster than rounding off it doesn't give always the exact results
+ */
+#define GMBT_GEOMETRIC_CORRECTION 1
-SEG_TEXT
+/*
+ * do
+ *
+ * s = (q - p)*a + q
+ *
+ * instead of
+ *
+ * s = p*a + q*(1-a)
+ *
+ * this eliminates a multiply at the expense of
+ * complicating the roundoff but is generally worth it
+ */
+#define GMBT_SIGNED_ARITHMETIC 1
+#if GMBT_ROUNDOFF
+ SEG_DATA
+
+ALIGNDATA8
+const_80:
+ D_LONG 0x00800080, 0x00800080
+#endif
+
+ SEG_TEXT
ALIGNTEXT16
GLOBL GLNAME(_mesa_mmx_blend_transparency)
+/*
+ * void blend_transparency( GLcontext *ctx,
+ * GLuint n,
+ * const GLubyte mask[],
+ * GLchan rgba[][4],
+ * CONST GLchan dest[][4] )
+ *
+ * Common transparency blending mode.
+ */
GLNAME( _mesa_mmx_blend_transparency ):
- PUSH_L ( EBP )
- MOV_L ( ESP, EBP )
- SUB_L ( CONST(52), ESP )
- PUSH_L ( EBX )
- MOV_L ( CONST(16711680), REGOFF(-8, EBP) )
- MOV_L ( CONST(16711680), REGOFF(-4, EBP) )
- MOV_L ( CONST(0), REGOFF(-16, EBP) )
- MOV_L ( CONST(-1), REGOFF(-12, EBP) )
- MOV_L ( CONST(-1), REGOFF(-24, EBP) )
- MOV_L ( CONST(0), REGOFF(-20, EBP) )
- MOV_L ( REGOFF(24, EBP), EAX )
- ADD_L ( CONST(4), EAX )
- MOV_L ( EAX, EDX )
- AND_L ( REGOFF(20, EBP), EDX )
- MOV_L ( EDX, EAX )
- AND_L ( CONST(4), EAX )
- CMP_L ( CONST(8), EAX )
- JNE ( LLBL(GMBT_2) )
- MOV_L ( REGOFF(20, EBP), EAX )
- ADD_L ( CONST(3), EAX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(EAX), DL )
- MOV_L ( EDX, REGOFF(-32, EBP) )
- MOV_L ( CONST(255), EAX )
- MOV_L ( EAX, EBX )
- SUB_L ( REGOFF(-32, EBP), EBX )
- MOV_L ( EBX, REGOFF(-36, EBP) )
- MOV_L ( REGOFF(20, EBP), EAX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(EAX), DL )
- MOV_L ( EDX, EAX )
- IMUL_L ( REGOFF(-32, EBP), EAX )
- MOV_L ( REGOFF(24, EBP), EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EDX )
- IMUL_L ( REGOFF(-36, EBP), EDX )
- ADD_L ( EDX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-40, EBP) )
- MOV_L ( REGOFF(20, EBP), EAX )
- INC_L ( EAX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(EAX), DL )
- MOV_L ( EDX, EAX )
- IMUL_L ( REGOFF(-32, EBP), EAX )
- MOV_L ( REGOFF(24, EBP), EDX )
- INC_L ( EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EDX )
- IMUL_L ( REGOFF(-36, EBP), EDX )
- ADD_L ( EDX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-44, EBP) )
- MOV_L ( REGOFF(20, EBP), EAX )
- ADD_L ( CONST(2), EAX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(EAX), DL )
- MOV_L ( EDX, EAX )
- IMUL_L ( REGOFF(-32, EBP), EAX )
- MOV_L ( REGOFF(24, EBP), EDX )
- ADD_L ( CONST(2), EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EDX )
- IMUL_L ( REGOFF(-36, EBP), EDX )
- ADD_L ( EDX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-48, EBP) )
- MOV_L ( REGOFF(20, EBP), EAX )
- ADD_L ( CONST(3), EAX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(EAX), DL )
- MOV_L ( EDX, EAX )
- IMUL_L ( REGOFF(-32, EBP), EAX )
- MOV_L ( REGOFF(24, EBP), EDX )
- ADD_L ( CONST(3), EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EDX )
- IMUL_L ( REGOFF(-36, EBP), EDX )
- ADD_L ( EDX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-52, EBP) )
- MOV_L ( REGOFF(20, EBP), EAX )
- MOV_B ( REGOFF(-40, EBP), DL )
- MOV_B ( DL, REGIND(EAX) )
- MOV_L ( REGOFF(20, EBP), EAX )
- INC_L ( EAX )
- MOV_B ( REGOFF(-44, EBP), DL )
- MOV_B ( DL, REGIND(EAX) )
- MOV_L ( REGOFF(20, EBP), EAX )
- ADD_L ( CONST(2), EAX )
- MOV_B ( REGOFF(-48, EBP), DL )
- MOV_B ( DL, REGIND(EAX) )
- MOV_L ( REGOFF(20, EBP), EAX )
- ADD_L ( CONST(3), EAX )
- MOV_B ( REGOFF(-52, EBP), DL )
- MOV_B ( DL, REGIND(EAX) )
- INC_L ( REGOFF(16, EBP) )
- ADD_L ( CONST(4), REGOFF(20, EBP) )
- ADD_L ( CONST(4), REGOFF(24, EBP) )
- DEC_L ( REGOFF(12, EBP) )
-LLBL(GMBT_2):
-
- CMP_L ( CONST(0), REGOFF(12, EBP) )
- JE ( LLBL(GMBT_3) )
- MOV_L ( CONST(0), REGOFF(-28, EBP) )
-ALIGNTEXT4
-LLBL(GMBT_4):
-
- MOV_L ( REGOFF(12, EBP), EDX )
- MOV_L ( EDX, EAX )
- SHR_L ( CONST(1), EAX )
- CMP_L ( EAX, REGOFF(-28, EBP) )
- JB ( LLBL(GMBT_7) )
- JMP ( LLBL(GMBT_5) )
-ALIGNTEXT16
-LLBL(GMBT_7):
-
- MOV_L ( REGOFF(-28, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,2), EDX )
- MOV_L ( REGOFF(16, EBP), EAX )
- CMP_B ( CONST(0), REGBI(EAX,EDX) )
- JE ( LLBL(GMBT_6) )
- MOV_L ( REGOFF(-28, EBP), EAX )
- MOV_L ( EAX, EDX )
- LEA_L ( REGDIS(0,EDX,8), ECX )
- MOV_L ( ECX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- MOV_L ( REGOFF(-28, EBP), EDX )
- MOV_L ( EDX, ECX )
- LEA_L ( REGDIS(0,ECX,8), EDX )
- MOV_L ( EDX, ECX )
- ADD_L ( REGOFF(24, EBP), ECX )
-
- MOVQ ( REGIND(EAX), MM4 )
- PXOR ( MM5, MM5 )
- MOVQ ( MM4, MM1 )
- MOVQ ( REGIND(ECX), MM7 )
- PUNPCKLBW ( MM5, MM1 )
- MOVQ ( MM7, MM6 )
- MOVQ ( MM1, MM0 )
- PUNPCKLBW ( MM5, MM6 )
- MOVQ ( MM1, MM2 )
- PSRLQ ( CONST(48), MM0 )
- PUNPCKHBW ( MM5, MM4 )
- PACKSSDW ( MM0, MM0 )
- MOVQ ( MM0, MM3 )
- PUNPCKHBW ( MM5, MM7 )
- PSLLQ ( CONST(16), MM3 )
- POR ( REGOFF(-8, EBP), MM0 )
- PUNPCKLWD ( MM6, MM1 )
- PSUBW ( MM3, MM0 )
- PUNPCKHWD ( MM6, MM2 )
- MOVQ ( MM4, MM3 )
- PSRLQ ( CONST(48), MM3 )
- PACKSSDW ( MM3, MM3 )
- MOVQ ( MM3, MM6 )
- POR ( REGOFF(-8, EBP), MM3 )
- PSLLQ ( CONST(16), MM6 )
- PSUBW ( MM6, MM3 )
- MOVQ ( MM4, MM5 )
- PUNPCKLWD ( MM7, MM4 )
- PUNPCKHWD ( MM7, MM5 )
- PMADDWD ( MM0, MM1 )
- PMADDWD ( MM3, MM4 )
- PMADDWD ( MM0, MM2 )
- PMADDWD ( MM3, MM5 )
- PSRLD ( CONST(8), MM1 )
- PSRLD ( CONST(8), MM2 )
- PSRLD ( CONST(8), MM4 )
- PACKSSDW ( MM2, MM1 )
- PSRLD ( CONST(8), MM5 )
- PACKUSWB ( MM1, MM1 )
- PACKSSDW ( MM5, MM4 )
- PAND ( REGOFF(-24, EBP), MM1 )
- PACKUSWB ( MM4, MM4 )
- PAND ( REGOFF(-16, EBP), MM4 )
- POR ( MM1, MM4 )
- MOVQ ( MM4, REGIND(EAX) )
-
-
-LLBL(GMBT_8):
-
-LLBL(GMBT_6):
-
- INC_L ( REGOFF(-28, EBP) )
- JMP ( LLBL(GMBT_4) )
+
+ PUSH_L ( EBP )
+ MOV_L ( ESP, EBP )
+ PUSH_L ( ESI )
+ PUSH_L ( EDI )
+ PUSH_L ( EBX )
+
+ MOV_L ( REGOFF(12, EBP), ECX ) /* n */
+ CMP_L ( CONST(0), ECX)
+ JE ( LLBL (GMBT_return) )
+
+ MOV_L ( REGOFF(16, EBP), EBX ) /* mask */
+ MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */
+ MOV_L ( REGOFF(24, EBP), ESI ) /* dest */
+
+ TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */
+ JZ ( LLBL (GMBT_align_end) )
+
+ CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */
+ JE ( LLBL (GMBT_align_continue) )
+
+ PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */
+
+ MOVD ( REGIND(ESI), MM1 ) /* | | | | qa1 | qb1 | qg1 | qr1 */
+ MOVD ( REGIND(EDI), MM2 ) /* | | | | pa1 | pb1 | pg1 | pr1 */
+
+ PUNPCKLBW ( MM0, MM1 ) /* qa1 | qb1 | qg1 | qr1 */
+ PUNPCKLBW ( MM0, MM2 ) /* pa1 | pb1 | pg1 | pr1 */
+
+ MOVQ ( MM2, MM3 )
+
+ PUNPCKHWD ( MM3, MM3 ) /* pa1 | pa1 | | */
+ PUNPCKHDQ ( MM3, MM3 ) /* pa1 | pa1 | pa1 | pa1 */
+
+#if GMBT_ALPHA_PLUS_ONE
+ PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */
+
+ PSUBW ( MM4, MM3 ) /* pa1 + 1 | pa1 + 1 | pa1 + 1 | pa1 + 1 */
+#endif
+
+#if GMBT_SIGNED_ARITHMETIC
+ PSUBW ( MM1, MM2 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */
+
+ PSLLW ( CONST(8), MM1 ) /* q1 << 8 */
+
+#if GMBT_ROUNDOFF
+ MOVQ ( MM2, MM4 )
+#endif
+
+ PMULLW ( MM3, MM2 ) /* t1 = (q1 - p1)*pa1 */
+
+#if GMBT_ROUNDOFF
+ PSRLW ( CONST(15), MM4 ) /* q1 > p1 ? 1 : 0 */
+
+ PSLLW ( CONST(8), MM4 ) /* q1 > p1 ? 0x100 : 0 */
+
+ PSUBW ( MM4, MM2 ) /* t1 -=? 0x100 */
+#endif
+
+#else
+ PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */
+ PUNPCKLBW ( MM0, MM4 ) /* 0x00ff | 0x00ff | 0x00ff | 0x00ff */
+ MOVQ ( MM4, MM0 )
+
+ PMULLW ( MM3, MM2 ) /* p1*pa1 */
+
+ PSUBW ( MM3, MM0 ) /* 255 - pa1 | 255 - pa1 | 255 - pa1 | 255 - pa1 */
+
+ PMULLW ( MM0, MM1 ) /* q1*(255 - pa1) */
+
+ PADDW ( MM1, MM2 ) /* t1 = p1*pa1 + q1*(255 - pa1) */
+#endif
+
+#if GMBT_ROUNDOFF
+ MOVQ ( CONTENT(const_80), MM4 )
+
+ PADDW ( MM4, MM2 ) /* t1 += 0x80 */
+#endif
+
+#if GMBT_GEOMETRIC_SERIES
+ MOVQ ( MM2, MM3 )
+
+ PSRLW ( CONST(8), MM3 ) /* t1 >> 8 */
+
+ PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */
+#endif
+
+#if GMBT_SIGNED_ARITHMETIC
+ PADDW ( MM1, MM2 ) /* (t1/255 + q1) << 8 */
+#endif
+
+ PSRLW ( CONST(8), MM2 ) /* sa1 | sb1 | sg1 | sr1 */
+
+ PACKUSWB ( MM0, MM2 ) /* | | | | sa1 | sb1 | sg1 | sr1 */
+ MOVD ( MM2, REGIND(EDI) )
+
+LLBL (GMBT_align_continue):
+
+ DEC_L ( ECX ) /* n -= 1 */
+ INC_L ( EBX ) /* mask += 1 */
+ ADD_L ( CONST(4), EDI ) /* rgba += 1 */
+ ADD_L ( CONST(4), ESI ) /* dest += 1 */
+
+LLBL (GMBT_align_end):
+
+ CMP_L ( CONST(2), ECX)
+ JB ( LLBL (GMBT_loop_end) )
+
ALIGNTEXT16
-LLBL(GMBT_5):
+LLBL (GMBT_loop_begin):
+
+ CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */
+ JE ( LLBL (GMBT_loop_continue) )
+
+ /* NOTE: the instruction pairing when multiple pipelines are available must be checked */
+
+ PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */
+
+ MOVQ ( REGIND(ESI), MM7 ) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */
+ MOVQ ( REGIND(EDI), MM6 ) /* pa2 | pb2 | pg2 | pr2 | pa1 | pb1 | pg1 | pr1 */
+
+ MOVQ ( MM7, MM1 )
+ MOVQ ( MM6, MM2 )
+
+ PUNPCKLBW ( MM0, MM1 ) /* qa1 | qb1 | qg1 | qr1 */
+ PUNPCKHBW ( MM0, MM7 ) /* qa2 | qb2 | qg2 | qr2 */
+ PUNPCKLBW ( MM0, MM2 ) /* pa1 | pb1 | pg1 | pr1 */
+ PUNPCKHBW ( MM0, MM6 ) /* pa2 | pb2 | pg2 | pr2 */
+
+ MOVQ ( MM2, MM3 )
+ MOVQ ( MM6, MM5 )
+
+ PUNPCKHWD ( MM3, MM3 ) /* pa1 | pa1 | | */
+ PUNPCKHWD ( MM5, MM5 ) /* pa2 | pa2 | | */
+ PUNPCKHDQ ( MM3, MM3 ) /* pa1 | pa1 | pa1 | pa1 */
+ PUNPCKHDQ ( MM5, MM5 ) /* pa2 | pa2 | pa2 | pa2 */
+
+#if GMBT_ALPHA_PLUS_ONE
+ PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */
+
+ PSUBW ( MM4, MM3 ) /* pa1 + 1 | pa1 + 1 | pa1 + 1 | pa1 + 1 */
+ PSUBW ( MM4, MM5 ) /* pa2 + 1 | pa2 + 1 | pa2 + 1 | pa2 + 1 */
+#endif
+#if GMBT_SIGNED_ARITHMETIC
+ PSUBW ( MM1, MM2 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */
+ PSUBW ( MM7, MM6 ) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */
+
+ PSLLW ( CONST(8), MM1 ) /* q1 << 8 */
+ PSLLW ( CONST(8), MM7 ) /* q2 << 8 */
+
+#if GMBT_ROUNDOFF
+ MOVQ ( MM2, MM0 )
+ MOVQ ( MM6, MM4 )
+#endif
+
+ PMULLW ( MM3, MM2 ) /* t1 = (q1 - p1)*pa1 */
+ PMULLW ( MM5, MM6 ) /* t2 = (q2 - p2)*pa2 */
+
+#if GMBT_ROUNDOFF
+ PSRLW ( CONST(15), MM0 ) /* q1 > p1 ? 1 : 0 */
+ PSRLW ( CONST(15), MM4 ) /* q2 > q2 ? 1 : 0 */
+
+ PSLLW ( CONST(8), MM0 ) /* q1 > p1 ? 0x100 : 0 */
+ PSLLW ( CONST(8), MM4 ) /* q2 > q2 ? 0x100 : 0 */
+
+ PSUBW ( MM0, MM2 ) /* t1 -=? 0x100 */
+ PSUBW ( MM4, MM7 ) /* t2 -=? 0x100 */
+#endif
+
+#else
+ PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */
+ PUNPCKLBW ( MM0, MM4 ) /* 0x00ff | 0x00ff | 0x00ff | 0x00ff */
+ MOVQ ( MM4, MM0 )
+
+ PMULLW ( MM3, MM2 ) /* p1*pa1 */
+ PMULLW ( MM5, MM6 ) /* p2*pa2 */
+
+ PSUBW ( MM3, MM0 ) /* 255 - pa1 | 255 - pa1 | 255 - pa1 | 255 - pa1 */
+ PSUBW ( MM5, MM4 ) /* 255 - pa2 | 255 - pa2 | 255 - pa2 | 255 - pa2 */
+
+ PMULLW ( MM0, MM1 ) /* q1*(255 - pa1) */
+ PMULLW ( MM4, MM7 ) /* q2*(255 - pa2) */
+
+ PADDW ( MM1, MM2 ) /* t1 = p1*pa1 + q1*(255 - pa1) */
+ PADDW ( MM7, MM6 ) /* t2 = p2*pa2 + q2*(255 - pa2) */
+#endif
+
+#if GMBT_ROUNDOFF
+ MOVQ ( CONTENT(const_80), MM4 )
+
+ PADDW ( MM4, MM2 ) /* t1 += 0x80 */
+ PADDW ( MM4, MM6 ) /* t2 += 0x80 */
+#endif
+
+#if GMBT_GEOMETRIC_SERIES
+ MOVQ ( MM2, MM3 )
+ MOVQ ( MM6, MM5 )
+
+ PSRLW ( CONST(8), MM3 ) /* t1 >> 8 */
+ PSRLW ( CONST(8), MM5 ) /* t2 >> 8 */
+
+ PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */
+ PADDW ( MM5, MM6 ) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */
+
+#if GMBT_GEOMETRIC_CORRECTION
+ PSRLW ( CONST(7), MM3 ) /* t1 >> 15 */
+ PSRLW ( CONST(7), MM5 ) /* t2 >> 15 */
+
+ PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */
+ PADDW ( MM5, MM6 ) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */
+#endif
+#endif
+
+#if GMBT_SIGNED_ARITHMETIC
+ PADDW ( MM1, MM2 ) /* (t1/255 + q1) << 8 */
+ PADDW ( MM7, MM6 ) /* (t2/255 + q2) << 8 */
+#endif
+
+ PSRLW ( CONST(8), MM2 ) /* sa1 | sb1 | sg1 | sr1 */
+ PSRLW ( CONST(8), MM6 ) /* sa2 | sb2 | sg2 | sr2 */
+
+ PACKUSWB ( MM6, MM2 ) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */
+ MOVQ ( MM2, REGIND(EDI) )
+
+LLBL (GMBT_loop_continue):
+
+ DEC_L ( ECX )
+ DEC_L ( ECX ) /* n -= 2 */
+ ADD_L ( CONST(2), EBX ) /* mask += 2 */
+ ADD_L ( CONST(8), EDI ) /* rgba += 2 */
+ ADD_L ( CONST(8), ESI ) /* dest += 2 */
+ CMP_L ( CONST(2), ECX )
+ JAE ( LLBL (GMBT_loop_begin) )
+
+LLBL (GMBT_loop_end):
+
+ CMP_L ( CONST(1), ECX )
+ JB ( LLBL (GMBT_done) )
+
+ CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */
+ JE ( LLBL (GMBT_done) )
+
+ PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */
+
+ MOVD ( REGIND(ESI), MM1 ) /* | | | | qa1 | qb1 | qg1 | qr1 */
+ MOVD ( REGIND(EDI), MM2 ) /* | | | | pa1 | pb1 | pg1 | pr1 */
+
+ PUNPCKLBW ( MM0, MM1 ) /* qa1 | qb1 | qg1 | qr1 */
+ PUNPCKLBW ( MM0, MM2 ) /* pa1 | pb1 | pg1 | pr1 */
+
+ MOVQ ( MM2, MM3 )
+
+ PUNPCKHWD ( MM3, MM3 ) /* pa1 | pa1 | | */
+ PUNPCKHDQ ( MM3, MM3 ) /* pa1 | pa1 | pa1 | pa1 */
+
+#if GMBT_ALPHA_PLUS_ONE
+ PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */
+
+ PSUBW ( MM4, MM3 ) /* pa1 + 1 | pa1 + 1 | pa1 + 1 | pa1 + 1 */
+#endif
+
+#if GMBT_SIGNED_ARITHMETIC
+ PSUBW ( MM1, MM2 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */
+
+ PSLLW ( CONST(8), MM1 ) /* q1 << 8 */
+
+#if GMBT_ROUNDOFF
+ MOVQ ( MM2, MM4 )
+#endif
+
+ PMULLW ( MM3, MM2 ) /* t1 = (q1 - p1)*pa1 */
+
+#if GMBT_ROUNDOFF
+ PSRLW ( CONST(15), MM4 ) /* q1 > p1 ? 1 : 0 */
+
+ PSLLW ( CONST(8), MM4 ) /* q1 > p1 ? 0x100 : 0 */
+
+ PSUBW ( MM4, MM2 ) /* t1 -=? 0x100 */
+#endif
+
+#else
+ PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */
+ PUNPCKLBW ( MM0, MM4 ) /* 0x00ff | 0x00ff | 0x00ff | 0x00ff */
+ MOVQ ( MM4, MM0 )
+
+ PMULLW ( MM3, MM2 ) /* p1*pa1 */
+
+ PSUBW ( MM3, MM0 ) /* 255 - pa1 | 255 - pa1 | 255 - pa1 | 255 - pa1 */
+
+ PMULLW ( MM0, MM1 ) /* q1*(255 - pa1) */
+
+ PADDW ( MM1, MM2 ) /* t1 = p1*pa1 + q1*(255 - pa1) */
+#endif
+
+#if GMBT_ROUNDOFF
+ MOVQ ( CONTENT(const_80), MM4 )
+
+ PADDW ( MM4, MM2 ) /* t1 += 0x80 */
+#endif
+
+#if GMBT_GEOMETRIC_SERIES
+ MOVQ ( MM2, MM3 )
+
+ PSRLW ( CONST(8), MM3 ) /* t1 >> 8 */
+
+ PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */
+#endif
+
+#if GMBT_SIGNED_ARITHMETIC
+ PADDW ( MM1, MM2 ) /* (t1/255 + q1) << 8 */
+#endif
+
+ PSRLW ( CONST(8), MM2 ) /* sa1 | sb1 | sg1 | sr1 */
+
+ PACKUSWB ( MM0, MM2 ) /* | | | | sa1 | sb1 | sg1 | sr1 */
+ MOVD ( MM2, REGIND(EDI) )
+
+LLBL (GMBT_done):
EMMS
-LLBL(GMBT_3):
-
- MOV_L ( REGOFF(12, EBP), EAX )
- AND_L ( CONST(1), EAX )
- TEST_L ( EAX, EAX )
- JE ( LLBL(GMBT_9) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-1, EAX), EDX )
- XOR_L ( EAX, EAX )
- MOV_B ( REGIND(EDX), AL )
- MOV_L ( EAX, REGOFF(-52, EBP) )
- MOV_L ( CONST(255), EAX )
- MOV_L ( EAX, EBX )
- SUB_L ( REGOFF(-52, EBP), EBX )
- MOV_L ( EBX, REGOFF(-48, EBP) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-4, EAX), EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EAX )
- IMUL_L ( REGOFF(-52, EBP), EAX )
- MOV_L ( REGOFF(12, EBP), EDX )
- LEA_L ( REGDIS(0,EDX,4), ECX )
- MOV_L ( ECX, EDX )
- ADD_L ( REGOFF(24, EBP), EDX )
- LEA_L ( REGOFF(-4, EDX), ECX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(ECX), DL )
- MOV_L ( EDX, ECX )
- IMUL_L ( REGOFF(-48, EBP), ECX )
- ADD_L ( ECX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-44, EBP) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-3, EAX), EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EAX )
- IMUL_L ( REGOFF(-52, EBP), EAX )
- MOV_L ( REGOFF(12, EBP), EDX )
- LEA_L ( REGDIS(0,EDX,4), ECX )
- MOV_L ( ECX, EDX )
- ADD_L ( REGOFF(24, EBP), EDX )
- LEA_L ( REGOFF(-3, EDX), ECX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(ECX), DL )
- MOV_L ( EDX, ECX )
- IMUL_L ( REGOFF(-48, EBP), ECX )
- ADD_L ( ECX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-40, EBP) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-2, EAX), EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EAX )
- IMUL_L ( REGOFF(-52, EBP), EAX )
- MOV_L ( REGOFF(12, EBP), EDX )
- LEA_L ( REGDIS(0,EDX,4), ECX )
- MOV_L ( ECX, EDX )
- ADD_L ( REGOFF(24, EBP), EDX )
- LEA_L ( REGOFF(-2, EDX), ECX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(ECX), DL )
- MOV_L ( EDX, ECX )
- IMUL_L ( REGOFF(-48, EBP), ECX )
- ADD_L ( ECX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-36, EBP) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-1, EAX), EDX )
- XOR_L ( ECX, ECX )
- MOV_B ( REGIND(EDX), CL )
- MOV_L ( ECX, EAX )
- IMUL_L ( REGOFF(-52, EBP), EAX )
- MOV_L ( REGOFF(12, EBP), EDX )
- LEA_L ( REGDIS(0,EDX,4), ECX )
- MOV_L ( ECX, EDX )
- ADD_L ( REGOFF(24, EBP), EDX )
- LEA_L ( REGOFF(-1, EDX), ECX )
- XOR_L ( EDX, EDX )
- MOV_B ( REGIND(ECX), DL )
- MOV_L ( EDX, ECX )
- IMUL_L ( REGOFF(-48, EBP), ECX )
- ADD_L ( ECX, EAX )
- MOV_L ( EAX, EBX )
- SAR_L ( CONST(8), EBX )
- MOV_L ( EBX, REGOFF(-32, EBP) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-4, EAX), EDX )
- MOV_B ( REGOFF(-44, EBP), AL )
- MOV_B ( AL, REGIND(EDX) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-3, EAX), EDX )
- MOV_B ( REGOFF(-40, EBP), AL )
- MOV_B ( AL, REGIND(EDX) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-2, EAX), EDX )
- MOV_B ( REGOFF(-36, EBP), AL )
- MOV_B ( AL, REGIND(EDX) )
- MOV_L ( REGOFF(12, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,4), EDX )
- MOV_L ( EDX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
- LEA_L ( REGOFF(-1, EAX), EDX )
- MOV_B ( REGOFF(-32, EBP), AL )
- MOV_B ( AL, REGIND(EDX) )
-LLBL(GMBT_9):
-
-LLBL(GMBT_1):
-
- MOV_L ( REGOFF(-56, EBP), EBX )
- MOV_L ( EBP, ESP )
- POP_L ( EBP )
+LLBL (GMBT_return):
+
+ POP_L ( EBX )
+ POP_L ( EDI )
+ POP_L ( ESI )
+ MOV_L ( EBP, ESP )
+ POP_L ( EBP )
RET
diff --git a/xc/extras/Mesa/src/api_arrayelt.c b/xc/extras/Mesa/src/api_arrayelt.c
index 6704b7bf1..33c3f9dd9 100644
--- a/xc/extras/Mesa/src/api_arrayelt.c
+++ b/xc/extras/Mesa/src/api_arrayelt.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -62,7 +62,7 @@ typedef struct {
static void (*colorfuncs[2][8])( const void * ) = {
{ (array_func)glColor3bv,
- (array_func)glColor3ub,
+ (array_func)glColor3ubv,
(array_func)glColor3sv,
(array_func)glColor3usv,
(array_func)glColor3iv,
@@ -71,7 +71,7 @@ static void (*colorfuncs[2][8])( const void * ) = {
(array_func)glColor3dv },
{ (array_func)glColor4bv,
- (array_func)glColor4ub,
+ (array_func)glColor4ubv,
(array_func)glColor4sv,
(array_func)glColor4usv,
(array_func)glColor4iv,
@@ -274,7 +274,7 @@ static void _ae_update_state( GLcontext *ctx )
AEcontext *actx = AE_CONTEXT(ctx);
AEtexarray *ta = actx->texarrays;
AEarray *aa = actx->arrays;
- int i;
+ GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (ctx->Array.TexCoord[i].Enabled) {
diff --git a/xc/extras/Mesa/src/api_noop.c b/xc/extras/Mesa/src/api_noop.c
index 6eefdec1c..fb34dd3de 100644
--- a/xc/extras/Mesa/src/api_noop.c
+++ b/xc/extras/Mesa/src/api_noop.c
@@ -248,7 +248,7 @@ void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
}
}
-void _mesa_noop_MultiTexCoord1fvARB( GLenum target, GLfloat *v )
+void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -282,7 +282,7 @@ void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
}
}
-void _mesa_noop_MultiTexCoord2fvARB( GLenum target, GLfloat *v )
+void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -316,7 +316,7 @@ void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat
}
}
-void _mesa_noop_MultiTexCoord3fvARB( GLenum target, GLfloat *v )
+void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -351,7 +351,7 @@ void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
}
}
-void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v )
+void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -418,7 +418,7 @@ void _mesa_noop_TexCoord1f( GLfloat a )
dest[3] = 1;
}
-void _mesa_noop_TexCoord1fv( GLfloat *v )
+void _mesa_noop_TexCoord1fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Texcoord[0];
@@ -438,7 +438,7 @@ void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
dest[3] = 1;
}
-void _mesa_noop_TexCoord2fv( GLfloat *v )
+void _mesa_noop_TexCoord2fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Texcoord[0];
@@ -458,7 +458,7 @@ void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
dest[3] = 1;
}
-void _mesa_noop_TexCoord3fv( GLfloat *v )
+void _mesa_noop_TexCoord3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Texcoord[0];
@@ -478,7 +478,7 @@ void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
COPY_FLOAT(dest[3], d);
}
-void _mesa_noop_TexCoord4fv( GLfloat *v )
+void _mesa_noop_TexCoord4fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Texcoord[0];
@@ -488,6 +488,40 @@ void _mesa_noop_TexCoord4fv( GLfloat *v )
COPY_FLOAT(dest[3], v[3]);
}
+/* Useful outside begin/end?
+ */
+void _mesa_noop_Vertex2fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void _mesa_noop_Vertex3fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void _mesa_noop_Vertex4fv( const GLfloat *v )
+{
+ (void) v;
+}
+
+void _mesa_noop_Vertex2f( GLfloat a, GLfloat b )
+{
+ (void) a; (void) b;
+}
+
+void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c )
+{
+ (void) a; (void) b; (void) c;
+}
+
+void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+{
+ (void) a; (void) b; (void) c; (void) d;
+}
+
+
+
/* Execute a glRectf() function. This is not suitable for GL_COMPILE
* modes (as the test for outside begin/end is not compiled),
* but may be useful for drivers in circumstances which exclude
diff --git a/xc/extras/Mesa/src/api_noop.h b/xc/extras/Mesa/src/api_noop.h
index 7eafaedaf..fcfa16c29 100644
--- a/xc/extras/Mesa/src/api_noop.h
+++ b/xc/extras/Mesa/src/api_noop.h
@@ -74,22 +74,22 @@ extern void _mesa_noop_Color3fv( const GLfloat *v );
extern void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a );
-extern void _mesa_noop_MultiTexCoord1fvARB( GLenum target, GLfloat *v );
+extern void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v );
extern void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a,
GLfloat b );
-extern void _mesa_noop_MultiTexCoord2fvARB( GLenum target, GLfloat *v );
+extern void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v );
extern void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a,
GLfloat b, GLfloat c);
-extern void _mesa_noop_MultiTexCoord3fvARB( GLenum target, GLfloat *v );
+extern void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v );
extern void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a,
GLfloat b, GLfloat c, GLfloat d );
-extern void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v );
+extern void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v );
extern void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c );
@@ -101,19 +101,31 @@ extern void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v );
extern void _mesa_noop_TexCoord1f( GLfloat a );
-extern void _mesa_noop_TexCoord1fv( GLfloat *v );
+extern void _mesa_noop_TexCoord1fv( const GLfloat *v );
extern void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b );
-extern void _mesa_noop_TexCoord2fv( GLfloat *v );
+extern void _mesa_noop_TexCoord2fv( const GLfloat *v );
extern void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c );
-extern void _mesa_noop_TexCoord3fv( GLfloat *v );
+extern void _mesa_noop_TexCoord3fv( const GLfloat *v );
extern void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
-extern void _mesa_noop_TexCoord4fv( GLfloat *v );
+extern void _mesa_noop_TexCoord4fv( const GLfloat *v );
+
+extern void _mesa_noop_Vertex2fv( const GLfloat *v );
+
+extern void _mesa_noop_Vertex3fv( const GLfloat *v );
+
+extern void _mesa_noop_Vertex4fv( const GLfloat *v );
+
+extern void _mesa_noop_Vertex2f( GLfloat a, GLfloat b );
+
+extern void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c );
+
+extern void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
/* Not strictly a noop -- translate Rectf down to Begin/End and
diff --git a/xc/extras/Mesa/src/buffers.c b/xc/extras/Mesa/src/buffers.c
index 812096bcd..7481f5ad8 100644
--- a/xc/extras/Mesa/src/buffers.c
+++ b/xc/extras/Mesa/src/buffers.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -363,8 +363,7 @@ _mesa_ResizeBuffersMESA( void )
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
/* see if size of device driver's color buffer (window) has changed */
- if (buffer->Width == (GLint) buf_width &&
- buffer->Height == (GLint) buf_height)
+ if (buffer->Width == buf_width && buffer->Height == buf_height)
return; /* size is as expected */
buffer->Width = buf_width;
@@ -381,8 +380,7 @@ _mesa_ResizeBuffersMESA( void )
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
/* see if size of device driver's color buffer (window) has changed */
- if (buffer->Width == (GLint) buf_width &&
- buffer->Height == (GLint) buf_height)
+ if (buffer->Width == buf_width && buffer->Height == buf_height)
return; /* size is as expected */
buffer->Width = buf_width;
diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c
index 6bff2915e..689fd5b4e 100644
--- a/xc/extras/Mesa/src/context.c
+++ b/xc/extras/Mesa/src/context.c
@@ -70,22 +70,11 @@
#endif
#ifndef MESA_VERBOSE
-int MESA_VERBOSE = 0
-/* | VERBOSE_PIPELINE */
-/* | VERBOSE_IMMEDIATE */
-/* | VERBOSE_VARRAY */
-/* | VERBOSE_TEXTURE */
-/* | VERBOSE_API */
-/* | VERBOSE_DRIVER */
-/* | VERBOSE_STATE */
-/* | VERBOSE_DISPLAY_LIST */
-;
+int MESA_VERBOSE = 0;
#endif
#ifndef MESA_DEBUG_FLAGS
-int MESA_DEBUG_FLAGS = 0
-/* | DEBUG_ALWAYS_FLUSH */
-;
+int MESA_DEBUG_FLAGS = 0;
#endif
/**********************************************************************/
@@ -1387,6 +1376,44 @@ alloc_proxy_textures( GLcontext *ctx )
}
+static void add_debug_flags( const char *debug )
+{
+#ifdef MESA_DEBUG
+ if (strstr(debug, "varray"))
+ MESA_VERBOSE |= VERBOSE_VARRAY;
+
+ if (strstr(debug, "tex"))
+ MESA_VERBOSE |= VERBOSE_TEXTURE;
+
+ if (strstr(debug, "imm"))
+ MESA_VERBOSE |= VERBOSE_IMMEDIATE;
+
+ if (strstr(debug, "pipe"))
+ MESA_VERBOSE |= VERBOSE_PIPELINE;
+
+ if (strstr(debug, "driver"))
+ MESA_VERBOSE |= VERBOSE_DRIVER;
+
+ if (strstr(debug, "state"))
+ MESA_VERBOSE |= VERBOSE_STATE;
+
+ if (strstr(debug, "api"))
+ MESA_VERBOSE |= VERBOSE_API;
+
+ if (strstr(debug, "list"))
+ MESA_VERBOSE |= VERBOSE_DISPLAY_LIST;
+
+ if (strstr(debug, "lighting"))
+ MESA_VERBOSE |= VERBOSE_LIGHTING;
+
+ /* Debug flag:
+ */
+ if (strstr(debug, "flush"))
+ MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH;
+#endif
+}
+
+
/*
* Initialize a GLcontext struct. This includes allocating all the
* other structs and arrays which hang off of the context by pointers.
@@ -1550,6 +1577,13 @@ _mesa_initialize_context( GLcontext *ctx,
trInitDispatch(ctx->TraceDispatch);
#endif
+
+ if (getenv("MESA_DEBUG"))
+ add_debug_flags(getenv("MESA_DEBUG"));
+
+ if (getenv("MESA_VERBOSE"))
+ add_debug_flags(getenv("MESA_VERBOSE"));
+
return GL_TRUE;
}
diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c
index b88890981..5fe6124ec 100644
--- a/xc/extras/Mesa/src/dlist.c
+++ b/xc/extras/Mesa/src/dlist.c
@@ -4779,12 +4779,11 @@ _mesa_EndList( void )
{
GET_CURRENT_CONTEXT(ctx);
FLUSH_CURRENT(ctx, 0); /* must be called before assert */
- ASSERT_OUTSIDE_BEGIN_END(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glEndList\n");
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); /* ??? */
-
/* Check that a list is under construction */
if (!ctx->CurrentListPtr) {
_mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" );
@@ -4811,7 +4810,6 @@ _mesa_EndList( void )
ctx->CurrentDispatch = ctx->Exec;
_glapi_set_dispatch( ctx->CurrentDispatch );
-
}
@@ -4825,6 +4823,10 @@ _mesa_CallList( GLuint list )
/* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
/* execute the display list, and restore the CompileFlag. */
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ fprintf(stderr, "_mesa_CallList %d\n", list);
+
/* mesa_print_display_list( list ); */
save_compile_flag = ctx->CompileFlag;
@@ -4855,6 +4857,9 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
GLint i;
GLboolean save_compile_flag;
+ if (MESA_VERBOSE & VERBOSE_API)
+ fprintf(stderr, "_mesa_CallLists %d\n", n);
+
/* Save the CompileFlag status, turn it off, execute display list,
* and restore the CompileFlag.
*/
diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c
index 2627a1302..a59897d09 100644
--- a/xc/extras/Mesa/src/get.c
+++ b/xc/extras/Mesa/src/get.c
@@ -5368,8 +5368,8 @@ _mesa_GetString( GLenum name )
GET_CURRENT_CONTEXT(ctx);
static const char *vendor = "Brian Paul";
static const char *renderer = "Mesa";
- static const char *version_1_2 = "1.2 Mesa 4.0.2";
- static const char *version_1_3 = "1.3 Mesa 4.0.2";
+ static const char *version_1_2 = "1.2 Mesa 4.0.3";
+ static const char *version_1_3 = "1.3 Mesa 4.0.3";
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h
index 4f7d63c95..cfc8cb727 100644
--- a/xc/extras/Mesa/src/mmath.h
+++ b/xc/extras/Mesa/src/mmath.h
@@ -430,7 +430,7 @@ static INLINE int iceil(float f)
/* Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */
extern float _mesa_ubyte_to_float_color_tab[256];
-#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[u]
+#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)u]
/* Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */
#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) (((X)) * 255.0F))
diff --git a/xc/extras/Mesa/src/mtypes.h b/xc/extras/Mesa/src/mtypes.h
index bddaf49c4..5e9efe7b1 100644
--- a/xc/extras/Mesa/src/mtypes.h
+++ b/xc/extras/Mesa/src/mtypes.h
@@ -1608,6 +1608,9 @@ struct __GLcontextRec {
/* The string names for GL_POINT, GL_LINE_LOOP, etc */
extern const char *_mesa_prim_name[GL_POLYGON+4];
+#ifndef MESA_DEBUG
+#define MESA_DEBUG
+#endif
#ifdef MESA_DEBUG
extern int MESA_VERBOSE;
@@ -1629,8 +1632,10 @@ enum _verbose {
VERBOSE_DRIVER = 0x0010,
VERBOSE_STATE = 0x0020,
VERBOSE_API = 0x0040,
- VERBOSE_DISPLAY_LIST = 0x0200,
- VERBOSE_LIGHTING = 0x0400
+ VERBOSE_DISPLAY_LIST = 0x0100,
+ VERBOSE_LIGHTING = 0x0200,
+ VERBOSE_PRIMS = 0x0400,
+ VERBOSE_VERTS = 0x0800
};
@@ -1642,22 +1647,28 @@ enum _debug {
#define Elements(x) sizeof(x)/sizeof(*(x))
-
+#ifndef __GNUC__
+#define __FUNCTION__ "some function"
+#endif
/* Eventually let the driver specify what statechanges require a flush:
*/
-#define FLUSH_VERTICES(ctx, newstate) \
-do { \
- if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
- ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
- ctx->NewState |= newstate; \
+#define FLUSH_VERTICES(ctx, newstate) \
+do { \
+ if (MESA_VERBOSE & VERBOSE_STATE) \
+ fprintf(stderr, "FLUSH_VERTICES in %s\n", __FUNCTION__); \
+ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
+ ctx->NewState |= newstate; \
} while (0)
-#define FLUSH_CURRENT(ctx, newstate) \
-do { \
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
- ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
- ctx->NewState |= newstate; \
+#define FLUSH_CURRENT(ctx, newstate) \
+do { \
+ if (MESA_VERBOSE & VERBOSE_STATE) \
+ fprintf(stderr, "FLUSH_CURRENT in %s\n", __FUNCTION__); \
+ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
+ ctx->NewState |= newstate; \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
diff --git a/xc/extras/Mesa/src/state.c b/xc/extras/Mesa/src/state.c
index d60e158f5..e77dc152b 100644
--- a/xc/extras/Mesa/src/state.c
+++ b/xc/extras/Mesa/src/state.c
@@ -860,7 +860,7 @@ void _mesa_update_state( GLcontext *ctx )
const GLuint oldneedeyecoords = ctx->_NeedEyeCoords;
if (MESA_VERBOSE & VERBOSE_STATE)
- _mesa_print_state("", new_state);
+ _mesa_print_state("_mesa_update_state", new_state);
if (new_state & _NEW_MODELVIEW)
_math_matrix_analyse( &ctx->ModelView );
diff --git a/xc/extras/Mesa/src/swrast/s_blend.c b/xc/extras/Mesa/src/swrast/s_blend.c
index da3f6f351..8303867c5 100644
--- a/xc/extras/Mesa/src/swrast/s_blend.c
+++ b/xc/extras/Mesa/src/swrast/s_blend.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.1
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -624,10 +624,8 @@ void _swrast_choose_blend_func( GLcontext *ctx )
SWRAST_CONTEXT(ctx)->BlendFunc = blend_general;
}
else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_SRC_ALPHA
- && dstRGB==GL_ONE_MINUS_SRC_ALPHA)
- {
- /* XXX It looks like the MMX blend code is broken. Disable for now. */
-#if 0 && defined(USE_MMX_ASM)
+ && dstRGB==GL_ONE_MINUS_SRC_ALPHA) {
+#if defined(USE_MMX_ASM)
if ( cpu_has_mmx ) {
SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_transparency;
}
diff --git a/xc/extras/Mesa/src/swrast/s_context.c b/xc/extras/Mesa/src/swrast/s_context.c
index 6e0130c9c..b7272a35d 100644
--- a/xc/extras/Mesa/src/swrast/s_context.c
+++ b/xc/extras/Mesa/src/swrast/s_context.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -74,9 +74,9 @@ _swrast_update_rasterflags( GLcontext *ctx )
RasterMask |= ALPHABUF_BIT;
if ( ctx->Viewport.X < 0
- || ctx->Viewport.X + ctx->Viewport.Width > ctx->DrawBuffer->Width
+ || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
|| ctx->Viewport.Y < 0
- || ctx->Viewport.Y + ctx->Viewport.Height > ctx->DrawBuffer->Height) {
+ || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) {
RasterMask |= WINCLIP_BIT;
}
diff --git a/xc/extras/Mesa/src/swrast/s_copypix.c b/xc/extras/Mesa/src/swrast/s_copypix.c
index e6e88ded8..d9b575dfc 100644
--- a/xc/extras/Mesa/src/swrast/s_copypix.c
+++ b/xc/extras/Mesa/src/swrast/s_copypix.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -127,7 +127,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
&& !zoom
&& destx >= 0
- && destx + width <= ctx->DrawBuffer->Width) {
+ && destx + width <= (GLint) ctx->DrawBuffer->Width) {
quick_draw = GL_TRUE;
}
else {
@@ -285,7 +285,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* write row to framebuffer */
dy = desty + row;
- if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
+ if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
(const GLchan (*)[4])rgba, NULL );
}
@@ -365,7 +365,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
&& !zoom
&& destx >= 0
- && destx + width <= ctx->DrawBuffer->Width) {
+ && destx + width <= (GLint) ctx->DrawBuffer->Width) {
quick_draw = GL_TRUE;
}
else {
@@ -555,7 +555,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
UNDEFARRAY(q);
}
- if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
+ if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
(const GLchan (*)[4])rgba, NULL );
}
diff --git a/xc/extras/Mesa/src/swrast/s_depth.c b/xc/extras/Mesa/src/swrast/s_depth.c
index 1270102e8..a07e2f10b 100644
--- a/xc/extras/Mesa/src/swrast/s_depth.c
+++ b/xc/extras/Mesa/src/swrast/s_depth.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -1337,8 +1337,8 @@ _mesa_read_depth_span( GLcontext *ctx,
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- if (y < 0 || y >= ctx->DrawBuffer->Height ||
- x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) {
+ if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height ||
+ x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
GLint i;
for (i = 0; i < n; i++)
@@ -1355,8 +1355,8 @@ _mesa_read_depth_span( GLcontext *ctx,
n -= dx;
depth += dx;
}
- if (x + n > ctx->DrawBuffer->Width) {
- GLint dx = x + n - ctx->DrawBuffer->Width;
+ if (x + n > (GLint) ctx->DrawBuffer->Width) {
+ GLint dx = x + n - (GLint) ctx->DrawBuffer->Width;
GLint i;
for (i = 0; i < dx; i++)
depth[n - i - 1] = 0;
@@ -1411,8 +1411,8 @@ _mesa_read_depth_span_float( GLcontext *ctx,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat scale = 1.0F / ctx->DepthMaxF;
- if (y < 0 || y >= ctx->DrawBuffer->Height ||
- x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) {
+ if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height ||
+ x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
GLint i;
for (i = 0; i < n; i++)
@@ -1428,8 +1428,8 @@ _mesa_read_depth_span_float( GLcontext *ctx,
n -= dx;
x = 0;
}
- if (x + n > ctx->DrawBuffer->Width) {
- GLint dx = x + n - ctx->DrawBuffer->Width;
+ if (x + n > (GLint) ctx->DrawBuffer->Width) {
+ GLint dx = x + n - (GLint) ctx->DrawBuffer->Width;
GLint i;
for (i = 0; i < dx; i++)
depth[n - i - 1] = 0.0F;
diff --git a/xc/extras/Mesa/src/swrast/s_drawpix.c b/xc/extras/Mesa/src/swrast/s_drawpix.c
index ca3d1dee3..952e13fd3 100644
--- a/xc/extras/Mesa/src/swrast/s_drawpix.c
+++ b/xc/extras/Mesa/src/swrast/s_drawpix.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -762,8 +762,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
- && x + width <= ctx->DrawBuffer->Width
- && y + height <= ctx->DrawBuffer->Height) {
+ && x + width <= (GLint) ctx->DrawBuffer->Width
+ && y + height <= (GLint) ctx->DrawBuffer->Height) {
quickDraw = GL_TRUE;
}
else {
diff --git a/xc/extras/Mesa/src/swrast/s_imaging.c b/xc/extras/Mesa/src/swrast/s_imaging.c
index 174b99e05..d334b2e65 100644
--- a/xc/extras/Mesa/src/swrast/s_imaging.c
+++ b/xc/extras/Mesa/src/swrast/s_imaging.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -53,7 +53,7 @@ _swrast_CopyColorTable( GLcontext *ctx,
(*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
- glColorTable(target, internalformat, width, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glColorTable(target, internalformat, width, GL_RGBA, CHAN_TYPE, data);
}
void
@@ -77,7 +77,7 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start,
(*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
- glColorSubTable(target, start, width, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glColorSubTable(target, start, width, GL_RGBA, CHAN_TYPE, data);
}
diff --git a/xc/extras/Mesa/src/swrast/s_readpix.c b/xc/extras/Mesa/src/swrast/s_readpix.c
index 1e1693a66..1846552bf 100644
--- a/xc/extras/Mesa/src/swrast/s_readpix.c
+++ b/xc/extras/Mesa/src/swrast/s_readpix.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -250,8 +250,8 @@ read_fast_rgba_pixels( GLcontext *ctx,
readWidth += srcX;
srcX = 0;
}
- if (srcX + readWidth > ctx->ReadBuffer->Width)
- readWidth -= (srcX + readWidth - ctx->ReadBuffer->Width);
+ if (srcX + readWidth > (GLint) ctx->ReadBuffer->Width)
+ readWidth -= (srcX + readWidth - (GLint) ctx->ReadBuffer->Width);
if (readWidth <= 0)
return GL_TRUE;
@@ -261,8 +261,8 @@ read_fast_rgba_pixels( GLcontext *ctx,
readHeight += srcY;
srcY = 0;
}
- if (srcY + readHeight > ctx->ReadBuffer->Height)
- readHeight -= (srcY + readHeight - ctx->ReadBuffer->Height);
+ if (srcY + readHeight > (GLint) ctx->ReadBuffer->Height)
+ readHeight -= (srcY + readHeight - (GLint) ctx->ReadBuffer->Height);
if (readHeight <= 0)
return GL_TRUE;
diff --git a/xc/extras/Mesa/src/swrast/s_span.c b/xc/extras/Mesa/src/swrast/s_span.c
index ba24b86c7..3f90c40a6 100644
--- a/xc/extras/Mesa/src/swrast/s_span.c
+++ b/xc/extras/Mesa/src/swrast/s_span.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -86,7 +86,7 @@ static GLuint
clip_span( GLcontext *ctx, GLint n, GLint x, GLint y, GLubyte mask[] )
{
/* Clip to top and bottom */
- if (y < 0 || y >= ctx->DrawBuffer->Height) {
+ if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height) {
return 0;
}
@@ -103,8 +103,8 @@ clip_span( GLcontext *ctx, GLint n, GLint x, GLint y, GLubyte mask[] )
}
/* Clip to right */
- if (x + n > ctx->DrawBuffer->Width) {
- if (x >= ctx->DrawBuffer->Width) {
+ if (x + n > (GLint) ctx->DrawBuffer->Width) {
+ if (x >= (GLint) ctx->DrawBuffer->Width) {
/* completely off right side */
return 0;
}
@@ -1132,8 +1132,10 @@ _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
GLuint n, GLint x, GLint y, GLchan rgba[][4] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- if (y < 0 || y >= buffer->Height
- || x + (GLint) n < 0 || x >= buffer->Width) {
+ const GLint bufWidth = (GLint) buffer->Width;
+ const GLint bufHeight = (GLint) buffer->Height;
+
+ if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) {
/* completely above, below, or right */
/* XXX maybe leave undefined? */
BZERO(rgba, 4 * n * sizeof(GLchan));
@@ -1148,14 +1150,14 @@ _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
/* completely left of window */
return;
}
- if (length > buffer->Width) {
+ if (length > bufWidth) {
length = buffer->Width;
}
}
- else if ((GLint) (x + n) > buffer->Width) {
+ else if ((GLint) (x + n) > bufWidth) {
/* right edge clipping */
skip = 0;
- length = buffer->Width - x;
+ length = bufWidth - x;
if (length < 0) {
/* completely to right of window */
return;
@@ -1186,8 +1188,10 @@ _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
GLuint n, GLint x, GLint y, GLuint indx[] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- if (y < 0 || y >= buffer->Height
- || x + (GLint) n < 0 || x >= buffer->Width) {
+ const GLint bufWidth = (GLint) buffer->Width;
+ const GLint bufHeight = (GLint) buffer->Height;
+
+ if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) {
/* completely above, below, or right */
BZERO(indx, n * sizeof(GLuint));
}
@@ -1201,14 +1205,14 @@ _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
/* completely left of window */
return;
}
- if (length > buffer->Width) {
- length = buffer->Width;
+ if (length > bufWidth) {
+ length = bufWidth;
}
}
- else if ((GLint) (x + n) > buffer->Width) {
+ else if ((GLint) (x + n) > bufWidth) {
/* right edge clipping */
skip = 0;
- length = buffer->Width - x;
+ length = bufWidth - x;
if (length < 0) {
/* completely to right of window */
return;
diff --git a/xc/extras/Mesa/src/swrast/s_stencil.c b/xc/extras/Mesa/src/swrast/s_stencil.c
index 70ba70488..acb273803 100644
--- a/xc/extras/Mesa/src/swrast/s_stencil.c
+++ b/xc/extras/Mesa/src/swrast/s_stencil.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -1013,8 +1013,8 @@ _mesa_read_stencil_span( GLcontext *ctx,
GLint n, GLint x, GLint y, GLstencil stencil[] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- if (y < 0 || y >= ctx->DrawBuffer->Height ||
- x + n <= 0 || x >= ctx->DrawBuffer->Width) {
+ if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height ||
+ x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
return; /* undefined values OK */
}
@@ -1025,8 +1025,8 @@ _mesa_read_stencil_span( GLcontext *ctx,
n -= dx;
stencil += dx;
}
- if (x + n > ctx->DrawBuffer->Width) {
- GLint dx = x + n - ctx->DrawBuffer->Width;
+ if (x + n > (GLint) ctx->DrawBuffer->Width) {
+ GLint dx = x + n - (GLint) ctx->DrawBuffer->Width;
n -= dx;
}
if (n <= 0) {
@@ -1066,8 +1066,8 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLstencil *ssrc = stencil;
- if (y < 0 || y >= ctx->DrawBuffer->Height ||
- x + n <= 0 || x >= ctx->DrawBuffer->Width) {
+ if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height ||
+ x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
return; /* undefined values OK */
}
@@ -1078,8 +1078,8 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
n -= dx;
ssrc += dx;
}
- if (x + n > ctx->DrawBuffer->Width) {
- GLint dx = x + n - ctx->DrawBuffer->Width;
+ if (x + n > (GLint) ctx->DrawBuffer->Width) {
+ GLint dx = x + n - (GLint) ctx->DrawBuffer->Width;
n -= dx;
}
if (n <= 0) {
diff --git a/xc/extras/Mesa/src/swrast/s_texture.c b/xc/extras/Mesa/src/swrast/s_texture.c
index 73520cdd8..88083180e 100644
--- a/xc/extras/Mesa/src/swrast/s_texture.c
+++ b/xc/extras/Mesa/src/swrast/s_texture.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -1924,7 +1924,7 @@ texture_combine(const GLcontext *ctx,
}
break;
default:
- _mesa_problem(NULL, "invalid combine source");
+ _mesa_problem(ctx, "invalid combine source");
}
switch (textureUnit->CombineSourceRGB[j]) {
@@ -1955,7 +1955,7 @@ texture_combine(const GLcontext *ctx,
}
break;
default:
- _mesa_problem(NULL, "invalid combine source");
+ _mesa_problem(ctx, "invalid combine source");
}
if (textureUnit->CombineOperandRGB[j] != GL_SRC_COLOR) {
@@ -2047,7 +2047,7 @@ texture_combine(const GLcontext *ctx,
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
#if CHAN_TYPE != GL_FLOAT
- const GLint shift = 8 - RGBshift;
+ const GLint shift = CHAN_BITS - RGBshift;
#endif
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
@@ -2114,7 +2114,7 @@ texture_combine(const GLcontext *ctx,
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
#if CHAN_TYPE != GL_FLOAT
- const GLint shift = 8 - RGBshift;
+ const GLint shift = CHAN_BITS - RGBshift;
#endif
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
@@ -2161,15 +2161,37 @@ texture_combine(const GLcontext *ctx,
}
}
break;
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ {
+ /* Do not scale the result by 1 2 or 4 */
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
+ for (i = 0; i < n; i++) {
+#if CHAN_TYPE == GL_FLOAT
+ GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) +
+ (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) +
+ (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F))
+ * 4.0F;
+#else
+ GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half,
+ (GLint)arg1[i][RCOMP] - half) +
+ S_PROD((GLint)arg0[i][GCOMP] - half,
+ (GLint)arg1[i][GCOMP] - half) +
+ S_PROD((GLint)arg0[i][BCOMP] - half,
+ (GLint)arg1[i][BCOMP] - half)) >> 6;
+#endif
+ dot = CLAMP(dot, 0, CHAN_MAX);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot;
+ }
+ }
+ break;
case GL_DOT3_RGB_ARB:
case GL_DOT3_RGBA_ARB:
{
+ /* DO scale the result by 1 2 or 4 */
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
- /* ATI's EXT extension has a constant scale by 4. The ARB
- * one will likely remove this restriction, and we should
- * drop the EXT extension in favour of the ARB one.
- */
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) +
@@ -2184,13 +2206,13 @@ texture_combine(const GLcontext *ctx,
S_PROD((GLint)arg0[i][BCOMP] - half,
(GLint)arg1[i][BCOMP] - half)) >> 6;
#endif
- dot = CLAMP(dot, 0, CHAN_MAX);
+ dot = CLAMP(dot, 0, CHAN_MAX) << RGBshift;
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot;
}
}
break;
default:
- _mesa_problem(NULL, "invalid combine mode");
+ _mesa_problem(ctx, "invalid combine mode");
}
switch (textureUnit->CombineModeA) {
@@ -2219,7 +2241,7 @@ texture_combine(const GLcontext *ctx,
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
#if CHAN_TYPE != GL_FLOAT
- const GLint shift = 8 - Ashift;
+ const GLint shift = CHAN_BITS - Ashift;
#endif
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
@@ -2266,7 +2288,7 @@ texture_combine(const GLcontext *ctx,
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
#if CHAN_TYPE != GL_FLOAT
- const GLint shift = 8 - Ashift;
+ const GLint shift = CHAN_BITS - Ashift;
#endif
for (i=0; i<n; i++) {
#if CHAN_TYPE == GL_FLOAT
@@ -2284,13 +2306,13 @@ texture_combine(const GLcontext *ctx,
break;
case GL_SUBTRACT_ARB:
{
- const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
- const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult;
#else
- GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << RGBshift;
+ GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << Ashift;
rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
#endif
}
@@ -2298,10 +2320,13 @@ texture_combine(const GLcontext *ctx,
break;
default:
- _mesa_problem(NULL, "invalid combine mode");
+ _mesa_problem(ctx, "invalid combine mode");
}
- /* Fix the alpha component for GL_DOT3_RGBA_EXT combining.
+ /* Fix the alpha component for GL_DOT3_RGBA_EXT/ARB combining.
+ * This is kind of a kludge. It would have been better if the spec
+ * were written such that the GL_COMBINE_ALPHA value could be set to
+ * GL_DOT3.
*/
if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT ||
textureUnit->CombineModeRGB == GL_DOT3_RGBA_ARB) {
diff --git a/xc/extras/Mesa/src/swrast/s_zoom.c b/xc/extras/Mesa/src/swrast/s_zoom.c
index f125b6d98..531995a90 100644
--- a/xc/extras/Mesa/src/swrast/s_zoom.c
+++ b/xc/extras/Mesa/src/swrast/s_zoom.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -86,7 +86,8 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
/* below window */
return;
}
- if (r0>=ctx->DrawBuffer->Height && r1>=ctx->DrawBuffer->Height) {
+ if (r0 >= (GLint) ctx->DrawBuffer->Height &&
+ r1 >= (GLint) ctx->DrawBuffer->Height) {
/* above window */
return;
}
@@ -190,7 +191,8 @@ _mesa_write_zoomed_rgb_span( GLcontext *ctx,
/* below window */
return;
}
- if (r0>=ctx->DrawBuffer->Height && r1>=ctx->DrawBuffer->Height) {
+ if (r0 >= (GLint) ctx->DrawBuffer->Height &&
+ r1 >= (GLint) ctx->DrawBuffer->Height) {
/* above window */
return;
}
@@ -303,7 +305,8 @@ _mesa_write_zoomed_index_span( GLcontext *ctx,
/* below window */
return;
}
- if (r0>=ctx->DrawBuffer->Height && r1>=ctx->DrawBuffer->Height) {
+ if (r0 >= (GLint) ctx->DrawBuffer->Height &&
+ r1 >= (GLint) ctx->DrawBuffer->Height) {
/* above window */
return;
}
@@ -407,7 +410,8 @@ _mesa_write_zoomed_stencil_span( GLcontext *ctx,
/* below window */
return;
}
- if (r0>=ctx->DrawBuffer->Height && r1>=ctx->DrawBuffer->Height) {
+ if (r0 >= (GLint) ctx->DrawBuffer->Height &&
+ r1 >= (GLint) ctx->DrawBuffer->Height) {
/* above window */
return;
}
diff --git a/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h b/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h
index 8e95ad1f2..15277cfd2 100644
--- a/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h
+++ b/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -83,14 +83,14 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end,
if (VB->ColorPtr[0]->Type != CHAN_TYPE)
import_float_colors( ctx );
- color = VB->ColorPtr[0]->Ptr;
+ color = (GLchan *) VB->ColorPtr[0]->Ptr;
color_stride = VB->ColorPtr[0]->StrideB;
}
if (IND & SPEC) {
if (VB->SecondaryColorPtr[0]->Type != CHAN_TYPE)
import_float_spec_colors( ctx );
- spec = VB->SecondaryColorPtr[0]->Ptr;
+ spec = (GLchan *) VB->SecondaryColorPtr[0]->Ptr;
spec_stride = VB->SecondaryColorPtr[0]->StrideB;
}
if (IND & INDEX) {
diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c
index 0cbacc848..da998b797 100644
--- a/xc/extras/Mesa/src/texstate.c
+++ b/xc/extras/Mesa/src/texstate.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.1
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -139,10 +139,16 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
return;
}
break;
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ if (!ctx->Extensions.EXT_texture_env_dot3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
case GL_DOT3_RGB_ARB:
case GL_DOT3_RGBA_ARB:
- if (!ctx->Extensions.EXT_texture_env_dot3 &&
- !ctx->Extensions.ARB_texture_env_dot3) {
+ if (!ctx->Extensions.ARB_texture_env_dot3) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
diff --git a/xc/extras/Mesa/src/texstore.c b/xc/extras/Mesa/src/texstore.c
index c74a72ee4..04c20d447 100644
--- a/xc/extras/Mesa/src/texstore.c
+++ b/xc/extras/Mesa/src/texstore.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.2
+ * Version: 4.0.3
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -238,7 +238,8 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
/* color index texture */
const GLenum texType = CHAN_TYPE;
GLint img, row;
- GLchan *dest = (GLchan *) texDestAddr + dstZoffset * dstImageStride
+ GLchan *dest = (GLchan *) texDestAddr
+ + dstZoffset * (dstImageStride / sizeof(GLchan))
+ dstYoffset * (dstRowStride / sizeof(GLchan))
+ dstXoffset * texComponents;
for (img = 0; img < srcDepth; img++) {
@@ -331,7 +332,8 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
/* packing and transfer ops after convolution */
srcf = convImage;
- dest = (GLchan *) texDestAddr + (dstZoffset + img) * dstImageStride
+ dest = (GLchan *) texDestAddr
+ + (dstZoffset + img) * (dstImageStride / sizeof(GLchan))
+ dstYoffset * (dstRowStride / sizeof(GLchan));
for (row = 0; row < convHeight; row++) {
_mesa_pack_float_rgba_span(ctx, convWidth,
@@ -353,7 +355,8 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
* no convolution
*/
GLint img, row;
- GLchan *dest = (GLchan *) texDestAddr + dstZoffset * dstImageStride
+ GLchan *dest = (GLchan *) texDestAddr
+ + dstZoffset * (dstImageStride / sizeof(GLchan))
+ dstYoffset * (dstRowStride / sizeof(GLchan))
+ dstXoffset * texComponents;
for (img = 0; img < srcDepth; img++) {
@@ -367,7 +370,7 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
srcPacking, transferOps);
destRow += (dstRowStride / sizeof(GLchan));
}
- dest += dstImageStride;
+ dest += dstImageStride / sizeof(GLchan);
}
}
}
@@ -388,7 +391,7 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
* srcWidth, srcHeight, srcDepth - size of source iamge
* dstX/Y/Zoffset - as specified by glTexSubImage
* dstRowStride - stride between dest rows in bytes
- * dstImagetride - stride between dest images in bytes
+ * dstImageStride - stride between dest images in bytes
* srcFormat, srcType - incoming image format and datatype
* srcAddr - source image address
* srcPacking - packing params of source image
diff --git a/xc/extras/Mesa/src/tnl/t_array_api.c b/xc/extras/Mesa/src/tnl/t_array_api.c
index 5d6d6ca15..59c16b035 100644
--- a/xc/extras/Mesa/src/tnl/t_array_api.c
+++ b/xc/extras/Mesa/src/tnl/t_array_api.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -49,10 +49,9 @@ static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start,
{
if (_tnl_hard_begin( ctx, mode )) {
GLint i;
- for (i = start; i < count; i++) {
- _tnl_array_element( ctx, i );
- }
- _tnl_end( ctx );
+ for (i = start; i < count; i++)
+ glArrayElement( i );
+ glEnd();
}
}
@@ -60,13 +59,11 @@ static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start,
static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count,
const GLuint *indices)
{
- /* Simple version of the above code.
- */
if (_tnl_hard_begin(ctx, mode)) {
GLint i;
for (i = 0 ; i < count ; i++)
- _tnl_array_element( ctx, indices[i] );
- _tnl_end( ctx );
+ glArrayElement( indices[i] );
+ glEnd();
}
}
@@ -78,6 +75,10 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode,
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
FLUSH_CURRENT( ctx, 0 );
+
+ /* fprintf(stderr, "%s\n", __FUNCTION__); */
+ if (tnl->pipeline.build_state_changes)
+ _tnl_validate_pipeline( ctx );
_tnl_vb_bind_arrays( ctx, start, end );
@@ -106,8 +107,10 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
GET_CURRENT_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
-
-/* fprintf(stderr, "%s %d %d\n", __FUNCTION__, start, count); */
+ GLuint thresh = (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) ? 30 : 10;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ fprintf(stderr, "_tnl_DrawArrays %d %d\n", start, count);
/* Check arguments, etc.
*/
@@ -120,9 +123,14 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
if (ctx->CompileFlag) {
fallback_drawarrays( ctx, mode, start, start + count );
}
+ else if (!ctx->Array.LockCount && (GLuint) count < thresh) {
+ /* Small primitives: attempt to share a vb (at the expense of
+ * using the immediate interface).
+ */
+ fallback_drawarrays( ctx, mode, start, start + count );
+ }
else if (count < (GLint) ctx->Const.MaxArrayLockSize) {
-
- /* Small primitives which can fit in a single vertex buffer:
+ /* Moderate primitives which can fit in a single vertex buffer:
*/
FLUSH_CURRENT( ctx, 0 );
@@ -211,10 +219,6 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
FLUSH_CURRENT( ctx, 0 );
-/* fprintf(stderr, "start %d count %d min %d modulo %d skip %d\n", */
-/* start, count, minimum, modulo, skip); */
-
-
bufsz -= bufsz % modulo;
bufsz -= minimum;
count += start;
@@ -223,8 +227,6 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
nr = MIN2( bufsz, count - j );
-/* fprintf(stderr, "%d..%d\n", j - minimum, j+nr); */
-
_tnl_vb_bind_arrays( ctx, j - minimum, j + nr );
VB->FirstPrimitive = 0;
@@ -244,10 +246,10 @@ _tnl_DrawRangeElements(GLenum mode,
GLsizei count, GLenum type, const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint *ui_indices;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ fprintf(stderr, "_tnl_DrawRangeElements %d %d %d\n", start, end, count);
/* Check arguments, etc.
*/
@@ -255,9 +257,6 @@ _tnl_DrawRangeElements(GLenum mode,
type, indices ))
return;
- if (tnl->pipeline.build_state_changes)
- _tnl_validate_pipeline( ctx );
-
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT,
count, type, indices );
@@ -311,19 +310,16 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint *ui_indices;
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
+ if (MESA_VERBOSE & VERBOSE_API)
+ fprintf(stderr, "_tnl_DrawElements %d\n", count);
/* Check arguments, etc.
*/
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
return;
- if (tnl->pipeline.build_state_changes)
- _tnl_validate_pipeline( ctx );
-
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT,
count, type, indices );
diff --git a/xc/extras/Mesa/src/tnl/t_context.c b/xc/extras/Mesa/src/tnl/t_context.c
index 7f9c0614a..3e6a96e40 100644
--- a/xc/extras/Mesa/src/tnl/t_context.c
+++ b/xc/extras/Mesa/src/tnl/t_context.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -109,12 +109,15 @@ _tnl_CreateContext( GLcontext *ctx )
/* Hook our functions into exec and compile dispatch tables.
*/
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
- _mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
- ctx->Save->CallList = _mesa_save_CallList;
- ctx->Save->CallLists = _mesa_save_CallLists;
- ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1;
- ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
- ctx->Save->Begin = _tnl_save_Begin;
+
+ tnl->save_vtxfmt = tnl->vtxfmt;
+ tnl->save_vtxfmt.CallList = _mesa_save_CallList;
+ tnl->save_vtxfmt.EvalMesh1 = _mesa_save_EvalMesh1;
+ tnl->save_vtxfmt.EvalMesh2 = _mesa_save_EvalMesh2;
+ tnl->save_vtxfmt.Begin = _tnl_save_Begin;
+
+ _mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt );
+
/* Set a few default values in the driver struct.
*/
@@ -141,7 +144,7 @@ _tnl_DestroyContext( GLcontext *ctx )
_tnl_array_destroy( ctx );
_tnl_imm_destroy( ctx );
_tnl_destroy_pipeline( ctx );
- _tnl_free_immediate( tnl->freed_immediate );
+ _tnl_free_immediate( ctx, tnl->freed_immediate );
FREE(tnl);
ctx->swtnl_context = 0;
@@ -199,12 +202,7 @@ _tnl_wakeup_save_exec( GLcontext *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx);
_tnl_wakeup_exec( ctx );
- _mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
- ctx->Save->CallList = _mesa_save_CallList; /* fixme */
- ctx->Save->CallLists = _mesa_save_CallLists;
- ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */
- ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
- ctx->Save->Begin = _tnl_save_Begin;
+ _mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt );
}
diff --git a/xc/extras/Mesa/src/tnl/t_context.h b/xc/extras/Mesa/src/tnl/t_context.h
index fa1288d95..2243f7787 100644
--- a/xc/extras/Mesa/src/tnl/t_context.h
+++ b/xc/extras/Mesa/src/tnl/t_context.h
@@ -393,9 +393,13 @@ struct tnl_device_driver {
*/
void (*NotifyMaterialChange)(GLcontext *ctx);
- /* Alert tnl-aware drivers of changes to material, especially in
- * exec_empty_cassette, which doesn't otherwise reach the driver.
- * --> Need to be able to disable exec_empty_cassette???
+ /* Alert tnl-aware drivers of changes to material.
+ */
+
+ GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p);
+ /* Allow drivers to hook in optimized begin/end engines.
+ * Return value: GL_TRUE - driver handled the begin
+ * GL_FALSE - driver didn't handle the begin
*/
/***
@@ -545,6 +549,7 @@ typedef struct {
/* Functions to be plugged into dispatch when tnl is active.
*/
GLvertexformat vtxfmt;
+ GLvertexformat save_vtxfmt;
} TNLcontext;
diff --git a/xc/extras/Mesa/src/tnl/t_eval_api.c b/xc/extras/Mesa/src/tnl/t_eval_api.c
index ba97ba769..d3fa033d2 100644
--- a/xc/extras/Mesa/src/tnl/t_eval_api.c
+++ b/xc/extras/Mesa/src/tnl/t_eval_api.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -99,7 +99,12 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
*/
{
GLboolean compiling = ctx->CompileFlag;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
struct immediate *im = TNL_CURRENT_IM(ctx);
+ GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p);
+
+ NotifyBegin = tnl->Driver.NotifyBegin;
+ tnl->Driver.NotifyBegin = 0;
if (compiling) {
struct immediate *IM = _tnl_alloc_immediate( ctx );
@@ -109,7 +114,7 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
ctx->CompileFlag = GL_FALSE;
}
- _tnl_hard_begin( ctx, prim );
+ _tnl_Begin( prim );
for (i=i1;i<=i2;i++,u+=du) {
_tnl_eval_coord1f( ctx, u );
}
@@ -118,11 +123,12 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
/* Need this for replay *and* compile:
*/
FLUSH_VERTICES( ctx, 0 );
+ tnl->Driver.NotifyBegin = NotifyBegin;
if (compiling) {
TNL_CURRENT_IM(ctx)->ref_count--;
ASSERT( TNL_CURRENT_IM(ctx)->ref_count == 0 );
- _tnl_free_immediate( TNL_CURRENT_IM(ctx) );
+ _tnl_free_immediate( ctx, TNL_CURRENT_IM(ctx) );
SET_IMMEDIATE( ctx, im );
ctx->CompileFlag = GL_TRUE;
}
@@ -159,6 +165,11 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
{
GLboolean compiling = ctx->CompileFlag;
struct immediate *im = TNL_CURRENT_IM(ctx);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p);
+
+ NotifyBegin = tnl->Driver.NotifyBegin;
+ tnl->Driver.NotifyBegin = 0;
if (compiling) {
struct immediate *IM = _tnl_alloc_immediate( ctx );
@@ -170,7 +181,7 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
switch (mode) {
case GL_POINT:
- _tnl_hard_begin( ctx, GL_POINTS );
+ _tnl_Begin( GL_POINTS );
for (v=v1,j=j1;j<=j2;j++,v+=dv) {
for (u=u1,i=i1;i<=i2;i++,u+=du) {
_tnl_eval_coord2f( ctx, u, v );
@@ -180,14 +191,14 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
break;
case GL_LINE:
for (v=v1,j=j1;j<=j2;j++,v+=dv) {
- _tnl_hard_begin( ctx, GL_LINE_STRIP );
+ _tnl_Begin( GL_LINE_STRIP );
for (u=u1,i=i1;i<=i2;i++,u+=du) {
_tnl_eval_coord2f( ctx, u, v );
}
_tnl_end(ctx);
}
for (u=u1,i=i1;i<=i2;i++,u+=du) {
- _tnl_hard_begin( ctx, GL_LINE_STRIP );
+ _tnl_Begin( GL_LINE_STRIP );
for (v=v1,j=j1;j<=j2;j++,v+=dv) {
_tnl_eval_coord2f( ctx, u, v );
}
@@ -196,7 +207,7 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
break;
case GL_FILL:
for (v=v1,j=j1;j<j2;j++,v+=dv) {
- _tnl_hard_begin( ctx, GL_TRIANGLE_STRIP );
+ _tnl_Begin( GL_TRIANGLE_STRIP );
for (u=u1,i=i1;i<=i2;i++,u+=du) {
_tnl_eval_coord2f( ctx, u, v );
_tnl_eval_coord2f( ctx, u, v+dv );
@@ -212,10 +223,11 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
/* Need this for replay *and* compile:
*/
FLUSH_VERTICES( ctx, 0 );
+ tnl->Driver.NotifyBegin = NotifyBegin;
if (compiling) {
TNL_CURRENT_IM(ctx)->ref_count--;
- _tnl_free_immediate( TNL_CURRENT_IM( ctx ) );
+ _tnl_free_immediate( ctx, TNL_CURRENT_IM( ctx ) );
SET_IMMEDIATE( ctx, im );
ctx->CompileFlag = GL_TRUE;
}
diff --git a/xc/extras/Mesa/src/tnl/t_imm_alloc.c b/xc/extras/Mesa/src/tnl/t_imm_alloc.c
index 330275c6b..5c3a046b9 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_alloc.c
+++ b/xc/extras/Mesa/src/tnl/t_imm_alloc.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 4.0.1
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -123,9 +123,9 @@ struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
/* May be called after tnl is destroyed.
*/
-void _tnl_free_immediate( struct immediate *IM )
+void _tnl_free_immediate( GLcontext *ctx, struct immediate *IM )
{
- TNLcontext *tnl = TNL_CONTEXT(IM->backref);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
ASSERT(IM->ref_count == 0);
diff --git a/xc/extras/Mesa/src/tnl/t_imm_alloc.h b/xc/extras/Mesa/src/tnl/t_imm_alloc.h
index 02a3d729a..4ece015b1 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_alloc.h
+++ b/xc/extras/Mesa/src/tnl/t_imm_alloc.h
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -33,7 +33,7 @@
extern struct immediate *_tnl_alloc_immediate( GLcontext *ctx );
-extern void _tnl_free_immediate( struct immediate *im );
+extern void _tnl_free_immediate( GLcontext *ctx, struct immediate *im );
#endif
diff --git a/xc/extras/Mesa/src/tnl/t_imm_api.c b/xc/extras/Mesa/src/tnl/t_imm_api.c
index 02408c9de..0544496a7 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_api.c
+++ b/xc/extras/Mesa/src/tnl/t_imm_api.c
@@ -51,6 +51,10 @@ void _tnl_flush_immediate( struct immediate *IM )
{
GLcontext *ctx = IM->backref;
+ if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
+ fprintf(stderr, "_tnl_flush_immediate IM: %d compiling: %d\n",
+ IM->id, ctx->CompileFlag);
+
if (IM->FlushElt == FLUSH_ELT_EAGER) {
_tnl_translate_array_elts( ctx, IM, IM->LastPrimitive, IM->Count );
}
@@ -67,10 +71,18 @@ void _tnl_flush_immediate( struct immediate *IM )
}
+/* Hook for ctx->Driver.FlushVertices:
+ */
void _tnl_flush_vertices( GLcontext *ctx, GLuint flags )
{
struct immediate *IM = TNL_CURRENT_IM(ctx);
+ if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
+ fprintf( stderr,
+ "_tnl_flush_vertices flags %x IM(%d) %d..%d Flag[%d]: %x\n",
+ flags, IM->id, IM->Start, IM->Count, IM->Start,
+ IM->Flag[IM->Start]);
+
if (IM->Flag[IM->Start])
if ((flags & FLUSH_UPDATE_CURRENT) || IM->Count > IM->Start)
_tnl_flush_immediate( IM );
@@ -79,29 +91,23 @@ void _tnl_flush_vertices( GLcontext *ctx, GLuint flags )
-/* Note the ctx argument. This function called only by _tnl_Begin,
- * _tnl_save_Begin and _tnl_hard_begin() in this file.
- */
-static void
-_tnl_begin( GLcontext *ctx, GLenum p )
+void
+_tnl_save_Begin( GLenum mode )
{
+ GET_CURRENT_CONTEXT(ctx);
struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint inflags, state;
- if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glBegin(IM %d) %s\n", IM->id,
- _mesa_lookup_enum_by_nr(p));
+/* fprintf(stderr, "%s: before: %x\n", __FUNCTION__, IM->BeginState); */
+
+ if (mode > GL_POLYGON) {
+ _mesa_compile_error( ctx, GL_INVALID_ENUM, "_tnl_Begin" );
+ return;
+ }
if (ctx->NewState)
_mesa_update_state(ctx);
- /* if only a very few slots left, might as well flush now
- */
- if (IM->Count > IMM_MAXDATA-8) {
- _tnl_flush_immediate( IM );
- IM = TNL_CURRENT_IM(ctx);
- }
-
/* Check for and flush buffered vertices from internal operations.
*/
if (IM->SavedBeginState) {
@@ -122,7 +128,7 @@ _tnl_begin( GLcontext *ctx, GLenum p )
state |= (VERT_BEGIN_0|VERT_BEGIN_1);
IM->Flag[count] |= VERT_BEGIN;
- IM->Primitive[count] = p | PRIM_BEGIN;
+ IM->Primitive[count] = mode | PRIM_BEGIN;
IM->PrimitiveLength[IM->LastPrimitive] = count - IM->LastPrimitive;
IM->LastPrimitive = count;
@@ -137,20 +143,15 @@ _tnl_begin( GLcontext *ctx, GLenum p )
ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
IM->BeginState = state;
-}
-
-void
-_tnl_save_Begin( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (mode > GL_POLYGON) {
- _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" );
- return;
+ if (ctx->ExecuteFlag) {
+ if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_Begin" );
+ }
+ else
+ ctx->Driver.CurrentExecPrimitive = mode;
}
- _tnl_begin( ctx, mode );
/* Update save_primitive now.
*/
@@ -160,22 +161,57 @@ _tnl_save_Begin( GLenum mode )
ctx->Driver.CurrentSavePrimitive = mode;
}
-static void
+
+void
_tnl_Begin( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ ASSERT (!ctx->CompileFlag);
if (mode > GL_POLYGON) {
- _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "_tnl_Begin" );
return;
}
- _tnl_begin(ctx, mode);
+ if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
+ _mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_Begin" );
+ return;
+ }
- /* Update exec_primitive now.
- */
- ASSERT (!ctx->CompileFlag);
- if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) {
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ {
+ struct immediate *IM = TNL_CURRENT_IM(ctx);
+ GLuint count = IM->Count;
+ GLuint last = IM->LastPrimitive;
+
+ if (IM->Start == IM->Count &&
+ tnl->Driver.NotifyBegin &&
+ tnl->Driver.NotifyBegin( ctx, mode ))
+ return;
+
+ assert( IM->SavedBeginState == 0 );
+ assert( IM->BeginState == 0 );
+
+ /* Not quite right. Need to use the fallback '_aa_ArrayElement'
+ * when not known to be inside begin/end and arrays are
+ * unlocked.
+ */
+ if (IM->FlushElt == FLUSH_ELT_EAGER) {
+ _tnl_translate_array_elts( ctx, IM, last, count );
+ }
+
+ IM->Flag[count] |= VERT_BEGIN;
+ IM->Primitive[count] = mode | PRIM_BEGIN;
+ IM->PrimitiveLength[last] = count - last;
+ IM->LastPrimitive = count;
+ IM->BeginState = (VERT_BEGIN_0|VERT_BEGIN_1);
+
+/* fprintf(stderr, "%s: %x\n", __FUNCTION__, IM->BeginState); */
+
+ ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
ctx->Driver.CurrentExecPrimitive = mode;
}
}
@@ -188,12 +224,13 @@ _tnl_Begin( GLenum mode )
GLboolean
_tnl_hard_begin( GLcontext *ctx, GLenum p )
{
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
if (!ctx->CompileFlag) {
/* If not compiling, treat as a normal begin().
*/
- _tnl_begin( ctx, p );
- ASSERT(ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END);
- ctx->Driver.CurrentExecPrimitive = p;
+/* fprintf(stderr, "%s: treating as glBegin\n", __FUNCTION__); */
+ glBegin( p );
return GL_TRUE;
}
else {
@@ -259,7 +296,7 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p )
return GL_TRUE;
default:
- ASSERT (0);
+ assert (0);
return GL_TRUE;
}
}
@@ -282,6 +319,8 @@ _tnl_end( GLcontext *ctx )
GLuint state = IM->BeginState;
GLuint inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1);
+ assert( ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES );
+
state |= inflags << 2; /* errors */
if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1))
@@ -305,8 +344,11 @@ _tnl_end( GLcontext *ctx )
IM->BeginState = state;
- if (!ctx->CompileFlag) {
- ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
+ if (ctx->ExecuteFlag) {
+ if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END)
+ _mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_End" );
+ else
+ ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
}
/* You can set this flag to get the old 'flush_vb on glEnd()'
@@ -1085,19 +1127,6 @@ _tnl_eval_coord2f( GLcontext *CC, GLfloat u, GLfloat v )
EVALCOORD2( i, u, v );
}
-void
-_tnl_array_element( GLcontext *CC, GLint i )
-{
- struct immediate *im = TNL_CURRENT_IM(CC);
- ARRAY_ELT( im, i );
-}
-
-void
-_tnl_vertex2f( GLcontext *ctx, GLfloat x, GLfloat y )
-{
- struct immediate *im = TNL_CURRENT_IM(ctx);
- VERTEX2( im, x, y );
-}
@@ -1113,14 +1142,12 @@ _tnl_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
GET_CURRENT_CONTEXT(ctx);
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
if (_tnl_hard_begin( ctx, GL_QUADS )) {
- _tnl_vertex2f( ctx, x1, y1 );
- _tnl_vertex2f( ctx, x2, y1 );
- _tnl_vertex2f( ctx, x2, y2 );
- _tnl_vertex2f( ctx, x1, y2 );
- _tnl_end( ctx );
+ glVertex2f( x1, y1 );
+ glVertex2f( x2, y1 );
+ glVertex2f( x2, y2 );
+ glVertex2f( x1, y2 );
+ glEnd();
}
}
@@ -1136,6 +1163,9 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
if (bitmask == 0)
return;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ fprintf(stderr, "_tnl_Materialfv\n");
if (tnl->IsolateMaterials &&
!(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
diff --git a/xc/extras/Mesa/src/tnl/t_imm_api.h b/xc/extras/Mesa/src/tnl/t_imm_api.h
index c0c5f0b4d..1ed727466 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_api.h
+++ b/xc/extras/Mesa/src/tnl/t_imm_api.h
@@ -32,6 +32,7 @@
extern void _tnl_save_Begin( GLenum mode );
+extern void _tnl_Begin( GLenum mode );
/* TNL-private internal functions for building higher-level operations:
*/
diff --git a/xc/extras/Mesa/src/tnl/t_imm_debug.c b/xc/extras/Mesa/src/tnl/t_imm_debug.c
index 63b53b79b..c6c16c26c 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_debug.c
+++ b/xc/extras/Mesa/src/tnl/t_imm_debug.c
@@ -79,87 +79,90 @@ void _tnl_print_cassette( struct immediate *IM )
_tnl_print_vert_flags("Contains a full complement of", andflag);
fprintf(stderr, "Final begin/end state %s/%s, errors %s/%s\n",
- (state & VERT_BEGIN_0) ? "in" : "out",
- (state & VERT_BEGIN_1) ? "in" : "out",
- (state & VERT_ERROR_0) ? "y" : "n",
- (state & VERT_ERROR_1) ? "y" : "n");
+ (state & VERT_BEGIN_0) ? "in" : "out",
+ (state & VERT_BEGIN_1) ? "in" : "out",
+ (state & VERT_ERROR_0) ? "y" : "n",
+ (state & VERT_ERROR_1) ? "y" : "n");
}
- for (i = IM->CopyStart ; i <= IM->Count ; i++) {
- fprintf(stderr, "%u: ", i);
- if (req & VERT_OBJ_234) {
- if (flags[i] & VERT_EVAL_C1)
- fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]);
- else if (flags[i] & VERT_EVAL_P1)
- fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]);
- else if (flags[i] & VERT_EVAL_C2)
- fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]);
- else if (flags[i] & VERT_EVAL_P2)
- fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]);
- else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) {
- fprintf(stderr, "Obj %f %f %f %f",
- IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]);
+ if ((MESA_VERBOSE & VERBOSE_IMMEDIATE) &&
+ (MESA_VERBOSE & VERBOSE_VERTS)) {
+ for (i = IM->CopyStart ; i <= IM->Count ; i++) {
+ fprintf(stderr, "%u: ", i);
+ if (req & VERT_OBJ_234) {
+ if (flags[i] & VERT_EVAL_C1)
+ fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]);
+ else if (flags[i] & VERT_EVAL_P1)
+ fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]);
+ else if (flags[i] & VERT_EVAL_C2)
+ fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]);
+ else if (flags[i] & VERT_EVAL_P2)
+ fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]);
+ else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) {
+ fprintf(stderr, "Obj %f %f %f %f",
+ IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]);
+ }
}
- }
- if (req & flags[i] & VERT_ELT)
- fprintf(stderr, " Elt %u\t", IM->Elt[i]);
-
- if (req & flags[i] & VERT_NORM)
- fprintf(stderr, " Norm %f %f %f ",
- IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]);
-
- if (req & flags[i] & VERT_TEX_ANY) {
- GLuint j;
- for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) {
- if (req & flags[i] & VERT_TEX(j)) {
- fprintf(stderr,
- "TC%d %f %f %f %f",
- j,
- IM->TexCoord[j][i][0], IM->TexCoord[j][i][1],
- IM->TexCoord[j][i][2], IM->TexCoord[j][i][2]);
+ if (req & flags[i] & VERT_ELT)
+ fprintf(stderr, " Elt %u\t", IM->Elt[i]);
+
+ if (req & flags[i] & VERT_NORM)
+ fprintf(stderr, " Norm %f %f %f ",
+ IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]);
+
+ if (req & flags[i] & VERT_TEX_ANY) {
+ GLuint j;
+ for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) {
+ if (req & flags[i] & VERT_TEX(j)) {
+ fprintf(stderr,
+ "TC%d %f %f %f %f",
+ j,
+ IM->TexCoord[j][i][0], IM->TexCoord[j][i][1],
+ IM->TexCoord[j][i][2], IM->TexCoord[j][i][2]);
+ }
}
}
- }
- if (req & flags[i] & VERT_RGBA)
- fprintf(stderr, " Rgba %f %f %f %f ",
- IM->Color[i][0], IM->Color[i][1],
- IM->Color[i][2], IM->Color[i][3]);
+ if (req & flags[i] & VERT_RGBA)
+ fprintf(stderr, " Rgba %f %f %f %f ",
+ IM->Color[i][0], IM->Color[i][1],
+ IM->Color[i][2], IM->Color[i][3]);
- if (req & flags[i] & VERT_SPEC_RGB)
- fprintf(stderr, " Spec %f %f %f ",
- IM->SecondaryColor[i][0], IM->SecondaryColor[i][1],
- IM->SecondaryColor[i][2]);
+ if (req & flags[i] & VERT_SPEC_RGB)
+ fprintf(stderr, " Spec %f %f %f ",
+ IM->SecondaryColor[i][0], IM->SecondaryColor[i][1],
+ IM->SecondaryColor[i][2]);
- if (req & flags[i] & VERT_FOG_COORD)
- fprintf(stderr, " Fog %f ", IM->FogCoord[i]);
+ if (req & flags[i] & VERT_FOG_COORD)
+ fprintf(stderr, " Fog %f ", IM->FogCoord[i]);
- if (req & flags[i] & VERT_INDEX)
- fprintf(stderr, " Index %u ", IM->Index[i]);
+ if (req & flags[i] & VERT_INDEX)
+ fprintf(stderr, " Index %u ", IM->Index[i]);
- if (req & flags[i] & VERT_EDGE)
- fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]);
+ if (req & flags[i] & VERT_EDGE)
+ fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]);
- if (req & flags[i] & VERT_MATERIAL)
- fprintf(stderr, " Material ");
+ if (req & flags[i] & VERT_MATERIAL)
+ fprintf(stderr, " Material ");
- /* The order of these two is not easily knowable, but this is
- * the usually correct way to look at them.
- */
- if (req & flags[i] & VERT_END)
- fprintf(stderr, " END ");
+ /* The order of these two is not easily knowable, but this is
+ * the usually correct way to look at them.
+ */
+ if (req & flags[i] & VERT_END)
+ fprintf(stderr, " END ");
- if (req & flags[i] & VERT_BEGIN)
- fprintf(stderr, " BEGIN(%s) (%s%s%s%s)",
- _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK],
- (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "",
- (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "",
- (IM->Primitive[i] & PRIM_END) ? "END," : "",
- (IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : "");
+ if (req & flags[i] & VERT_BEGIN)
+ fprintf(stderr, " BEGIN(%s) (%s%s%s%s)",
+ _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK],
+ (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "",
+ (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "",
+ (IM->Primitive[i] & PRIM_END) ? "END," : "",
+ (IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : "");
- fprintf(stderr, "\n");
+ fprintf(stderr, "\n");
+ }
}
}
diff --git a/xc/extras/Mesa/src/tnl/t_imm_dlist.c b/xc/extras/Mesa/src/tnl/t_imm_dlist.c
index 3bafa911e..0b0f0f841 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_dlist.c
+++ b/xc/extras/Mesa/src/tnl/t_imm_dlist.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -75,7 +75,7 @@ static void build_normal_lengths( struct immediate *IM )
GLuint count = IM->Count - IM->Start;
if (!dest) {
- dest = IM->NormalLengthPtr = ALIGN_MALLOC( IMM_SIZE*sizeof(GLfloat), 32 );
+ dest = IM->NormalLengthPtr = (GLfloat *) ALIGN_MALLOC( IMM_SIZE*sizeof(GLfloat), 32 );
if (!dest) return;
}
dest += IM->Start;
@@ -127,6 +127,9 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
TNLvertexcassette *node;
GLuint new_beginstate;
+ if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
+ fprintf(stderr, "_tnl_compiled_cassette IM: %d\n", IM->id);
+
if (IM->FlushElt) {
ASSERT (IM->FlushElt == FLUSH_ELT_LAZY);
_tnl_translate_array_elts( ctx, IM, IM->Start, IM->Count );
@@ -292,7 +295,8 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
TNLvertexcassette *node = (TNLvertexcassette *)data;
struct immediate *IM = node->IM;
-/* fprintf(stderr, "%s IM: %d\n", __FUNCTION__, IM->id); */
+ if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
+ fprintf(stderr, "execute_compiled_cassette IM: %d\n", IM->id);
IM->Start = node->Start;
IM->CopyStart = node->Start;
@@ -388,7 +392,7 @@ destroy_compiled_cassette( GLcontext *ctx, void *data )
TNLvertexcassette *node = (TNLvertexcassette *)data;
if ( --node->IM->ref_count == 0 )
- _tnl_free_immediate( node->IM );
+ _tnl_free_immediate( ctx, node->IM );
}
diff --git a/xc/extras/Mesa/src/tnl/t_imm_eval.c b/xc/extras/Mesa/src/tnl/t_imm_eval.c
index 09f63a4fe..75ac8984e 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_eval.c
+++ b/xc/extras/Mesa/src/tnl/t_imm_eval.c
@@ -241,7 +241,6 @@ static void eval2_4f( GLvector4f *dest,
if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat v = (coord[i][1] - v1) * dv;
-/* fprintf(stderr, "coord %d: %f %f\n", i, coord[i][0], coord[i][1]); */
_math_horner_bezier_surf(map->Points, to[i], u, v, dimension,
map->Uorder, map->Vorder);
@@ -343,8 +342,6 @@ static void copy_4f_stride( GLfloat to[][4], GLfloat *from,
MEMCPY( to, from, count * sizeof(to[0]));
else {
GLuint i;
-/* fprintf(stderr, "%s stride %d count %d\n", __FUNCTION__, */
-/* stride, count); */
for (i = 0 ; i < count ; i++, STRIDE_F(from, stride))
COPY_4FV( to[i], from );
}
@@ -353,11 +350,7 @@ static void copy_4f_stride( GLfloat to[][4], GLfloat *from,
static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count )
{
GLuint i;
-/* MEMCPY( to, from, (count) * sizeof(to[0])); */
for (i = 0 ; i < count ; i++) {
-/* fprintf(stderr, "copy norm %d from %p: %f %f %f\n", i, */
-/* from[i], */
-/* from[i][0], from[i][1], from[i][2]); */
COPY_3FV(to[i], from[i]);
}
}
@@ -458,9 +451,6 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
else
copycount = IM->Count - IM->CopyStart; /* copy all vertices */
-/* fprintf(stderr, "%s copystart %d start %d count %d copycount %d\n", */
-/* __FUNCTION__, IM->CopyStart, IM->Start, IM->Count, copycount); */
-
if (!store)
store = tnl->eval.im = _tnl_alloc_immediate( ctx );
@@ -620,7 +610,6 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
GLuint generated = 0;
if (copycount) {
-/* fprintf(stderr, "%s: Copy normals\n", __FUNCTION__); */
copy_3f( store->Normal + IM->CopyStart, tmp->Normal.data,
copycount );
}
@@ -710,8 +699,6 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
struct vertex_buffer *VB = &tnl->vb;
GLuint i,j,count = VB->Count;
-/* fprintf(stderr, "PURGING\n"); */
-
for (i = 0, j = 0 ; i < count ; i++) {
if (flags[i] & vertex) {
store->Elt[j++] = i;
diff --git a/xc/extras/Mesa/src/tnl/t_imm_exec.c b/xc/extras/Mesa/src/tnl/t_imm_exec.c
index 62e940dcd..33dc781f1 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_exec.c
+++ b/xc/extras/Mesa/src/tnl/t_imm_exec.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -68,6 +68,10 @@ static void reset_input( GLcontext *ctx,
if (start < IM->Count+2)
MEMSET(IM->Flag + start, 0, sizeof(GLuint) * (IM->Count+2-start));
+ if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
+ fprintf(stderr, "reset_input: IM(%d) new %x\n",
+ IM->id, beginstate);
+
IM->Start = start;
IM->Count = start;
IM->LastMaterial = start;
@@ -358,7 +362,7 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
_tnl_vb_bind_immediate( ctx, IM );
@@ -406,7 +410,7 @@ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM )
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
_tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount );
@@ -487,6 +491,9 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1)
ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES;
+
+/* fprintf(stderr, "%s: NeedFlush: %x\n", __FUNCTION__, */
+/* ctx->Driver.NeedFlush); */
}
@@ -553,7 +560,7 @@ void _tnl_imm_destroy( GLcontext *ctx )
if (TNL_CURRENT_IM(ctx)) {
TNL_CURRENT_IM(ctx)->ref_count--;
if (TNL_CURRENT_IM(ctx)->ref_count == 0)
- _tnl_free_immediate( TNL_CURRENT_IM(ctx) );
+ _tnl_free_immediate( ctx, TNL_CURRENT_IM(ctx) );
/*
* Don't use SET_IMMEDIATE here, or else we'll whack the
* _tnl_CurrentInput pointer - not good when another
diff --git a/xc/extras/Mesa/src/tnl/t_imm_fixup.c b/xc/extras/Mesa/src/tnl/t_imm_fixup.c
index 99ce407fa..13ae8795d 100644
--- a/xc/extras/Mesa/src/tnl/t_imm_fixup.c
+++ b/xc/extras/Mesa/src/tnl/t_imm_fixup.c
@@ -1,9 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -356,6 +356,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
vulnerable );
+ ++i;
} while (vulnerable);
}
}
@@ -524,7 +525,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
}
if (--tnl->ExecCopySource->ref_count == 0)
- _tnl_free_immediate( tnl->ExecCopySource );
+ _tnl_free_immediate( ctx, tnl->ExecCopySource );
tnl->ExecCopySource = next; next->ref_count++;
}
@@ -635,6 +636,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
vulnerable );
+ ++i;
} while (vulnerable);
}
}
@@ -726,7 +728,7 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
if (tnl->ExecCopySource)
if (--tnl->ExecCopySource->ref_count == 0)
- _tnl_free_immediate( tnl->ExecCopySource );
+ _tnl_free_immediate( ctx, tnl->ExecCopySource );
if (prim == GL_POLYGON+1) {
tnl->ExecCopySource = 0;
diff --git a/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h b/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h
index a9cca9ac5..87562eb95 100644
--- a/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h
+++ b/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h
@@ -115,8 +115,8 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
(void) vstride;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
+ if (MESA_VERBOSE & VERBOSE_LIGHTING)
+ fprintf(stderr, "%s\n", __FUNCTION__ );
spec[0] = Fspec;
spec[1] = Bspec;
@@ -326,7 +326,9 @@ static void TAG(light_rgba)( GLcontext *ctx,
GLuint *new_material_mask = VB->MaterialMask;
GLuint nr = VB->Count;
-/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
+ if (MESA_VERBOSE & VERBOSE_LIGHTING)
+ fprintf(stderr, "%s\n", __FUNCTION__ );
+
(void) flags;
(void) nstride;
(void) vstride;
@@ -534,7 +536,9 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
GLfloat base[2][3];
GLuint nr = VB->Count;
-/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
+ if (MESA_VERBOSE & VERBOSE_LIGHTING)
+ fprintf(stderr, "%s\n", __FUNCTION__ );
+
(void) input; /* doesn't refer to Eye or Obj */
(void) flags;
(void) nr;
@@ -658,7 +662,10 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
GLuint nr = VB->Count;
struct gl_light *light;
-/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
+ if (MESA_VERBOSE & VERBOSE_LIGHTING)
+ fprintf(stderr, "%s\n", __FUNCTION__ );
+
+
(void) flags;
(void) input;
(void) nr;
@@ -795,7 +802,9 @@ static void TAG(light_ci)( GLcontext *ctx,
GLuint *new_material_mask = VB->MaterialMask;
GLuint nr = VB->Count;
-/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
+ if (MESA_VERBOSE & VERBOSE_LIGHTING)
+ fprintf(stderr, "%s\n", __FUNCTION__ );
+
(void) flags;
(void) nstride;
(void) vstride;
diff --git a/xc/extras/Mesa/src/tnl/t_vb_normals.c b/xc/extras/Mesa/src/tnl/t_vb_normals.c
index 617cbaa7d..94b8da896 100644
--- a/xc/extras/Mesa/src/tnl/t_vb_normals.c
+++ b/xc/extras/Mesa/src/tnl/t_vb_normals.c
@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.3
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
@@ -60,12 +60,22 @@ static GLboolean run_normal_stage( GLcontext *ctx,
ASSERT(store->NormalTransform);
- if (stage->changed_inputs)
+ if (stage->changed_inputs) {
+ /* We can only use the display list's saved normal lengths if we've
+ * got a transformation matrix with uniform scaling.
+ */
+ const GLfloat *lengths;
+ if (ctx->ModelView.flags & MAT_FLAG_GENERAL_SCALE)
+ lengths = NULL;
+ else
+ lengths = VB->NormalLengthPtr;
+
store->NormalTransform( &ctx->ModelView,
ctx->_ModelViewInvScale,
VB->NormalPtr,
- VB->NormalLengthPtr,
+ lengths,
&store->normal );
+ }
VB->NormalPtr = &store->normal;
VB->NormalLengthPtr = 0; /* no longer valid */
diff --git a/xc/extras/Mesa/src/tnl/t_vb_render.c b/xc/extras/Mesa/src/tnl/t_vb_render.c
index 6ec98c88d..8ef4653a5 100644
--- a/xc/extras/Mesa/src/tnl/t_vb_render.c
+++ b/xc/extras/Mesa/src/tnl/t_vb_render.c
@@ -41,6 +41,7 @@
#include "glheader.h"
#include "context.h"
+#include "enums.h"
#include "macros.h"
#include "mem.h"
#include "mtypes.h"
@@ -324,6 +325,12 @@ static GLboolean run_render( GLcontext *ctx,
length= VB->PrimitiveLength[i];
ASSERT(length || (flags & PRIM_LAST));
ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
+
+ if (MESA_VERBOSE & VERBOSE_PRIMS)
+ fprintf(stderr, "MESA prim %s %d..%d\n",
+ _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
+ i, i+length);
+
if (length)
tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
}
diff --git a/xc/extras/Mesa/src/tnl/t_vb_vertex.c b/xc/extras/Mesa/src/tnl/t_vb_vertex.c
index c0aabd844..6158c1c8b 100644
--- a/xc/extras/Mesa/src/tnl/t_vb_vertex.c
+++ b/xc/extras/Mesa/src/tnl/t_vb_vertex.c
@@ -139,7 +139,8 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
if (stage->changed_inputs) {
if (ctx->_NeedEyeCoords) {
- /* Separate modelview and project transformations:
+ /* Separate modelview transformation:
+ * Use combined ModelProject to avoid some depth artifacts
*/
if (ctx->ModelView.type == MATRIX_IDENTITY)
VB->EyePtr = VB->ObjPtr;
@@ -150,8 +151,8 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
if (ctx->ProjectionMatrix.type == MATRIX_IDENTITY)
VB->ClipPtr = VB->EyePtr;
else
- VB->ClipPtr = TransformRaw( &store->clip, &ctx->ProjectionMatrix,
- VB->EyePtr );
+ VB->ClipPtr = TransformRaw( &store->clip, &ctx->_ModelProjectMatrix,
+ VB->ObjPtr );
}
else {
/* Combined modelviewproject transform:
diff --git a/xc/extras/Mesa/src/vtxfmt.c b/xc/extras/Mesa/src/vtxfmt.c
index e67fd7c7e..861977673 100644
--- a/xc/extras/Mesa/src/vtxfmt.c
+++ b/xc/extras/Mesa/src/vtxfmt.c
@@ -49,15 +49,6 @@
{ \
GET_CURRENT_CONTEXT(ctx); \
struct gl_tnl_module *tnl = &(ctx->TnlModule); \
- const GLuint new_state = ctx->NewState; \
- \
- if ( new_state ) \
- _mesa_update_state( ctx ); \
- \
- /* Validate the current tnl module. \
- */ \
- if ( new_state & ctx->Driver.NeedValidate ) \
- ctx->Driver.ValidateTnlModule( ctx, new_state ); \
\
ASSERT( tnl->Current ); \
ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \
@@ -152,6 +143,7 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt )
void _mesa_init_exec_vtxfmt( GLcontext *ctx )
{
install_vtxfmt( ctx->Exec, &neutral_vtxfmt );
+ ctx->TnlModule.SwapCount = 0;
}