summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xc/extras/Mesa/src/FX/X86/fx_3dnow_fastpath.S82
-rw-r--r--xc/extras/Mesa/src/FX/X86/fx_3dnow_fasttmp.h313
-rw-r--r--xc/extras/Mesa/src/FX/fxapi.c122
-rw-r--r--xc/extras/Mesa/src/FX/fxclip.c73
-rw-r--r--xc/extras/Mesa/src/FX/fxcliptmp.h54
-rw-r--r--xc/extras/Mesa/src/FX/fxcva.c78
-rw-r--r--xc/extras/Mesa/src/FX/fxcva.h45
-rw-r--r--xc/extras/Mesa/src/FX/fxcvatmp.h44
-rw-r--r--xc/extras/Mesa/src/FX/fxdd.c248
-rw-r--r--xc/extras/Mesa/src/FX/fxddspan.c261
-rw-r--r--xc/extras/Mesa/src/FX/fxddtex.c149
-rw-r--r--xc/extras/Mesa/src/FX/fxdrv.h158
-rw-r--r--xc/extras/Mesa/src/FX/fxfastpath.c72
-rw-r--r--xc/extras/Mesa/src/FX/fxfasttmp.h54
-rw-r--r--xc/extras/Mesa/src/FX/fxglidew.c294
-rw-r--r--xc/extras/Mesa/src/FX/fxglidew.h523
-rw-r--r--xc/extras/Mesa/src/FX/fxpipeline.c46
-rw-r--r--xc/extras/Mesa/src/FX/fxrender.c364
-rw-r--r--xc/extras/Mesa/src/FX/fxsanity.c45
-rw-r--r--xc/extras/Mesa/src/FX/fxsdettmp.h32
-rw-r--r--xc/extras/Mesa/src/FX/fxsetup.c871
-rw-r--r--xc/extras/Mesa/src/FX/fxspan.c56
-rw-r--r--xc/extras/Mesa/src/FX/fxstripdet.c45
-rw-r--r--xc/extras/Mesa/src/FX/fxtexman.c840
-rw-r--r--xc/extras/Mesa/src/FX/fxtrifuncs.c68
-rw-r--r--xc/extras/Mesa/src/FX/fxtritmp.h127
-rw-r--r--xc/extras/Mesa/src/FX/fxvs_tmp.h44
-rw-r--r--xc/extras/Mesa/src/FX/fxvsetup.c67
-rw-r--r--xc/extras/Mesa/src/FX/fxvsetup.h52
-rw-r--r--xc/extras/Mesa/src/FX/fxwgl.c77
-rw-r--r--xc/extras/Mesa/src/X86/3dnow.c2
-rw-r--r--xc/extras/Mesa/src/X86/3dnow.h2
-rw-r--r--xc/extras/Mesa/src/X86/x86.c2
-rw-r--r--xc/extras/Mesa/src/X86/x86.h2
-rw-r--r--xc/extras/Mesa/src/accum.c4
-rw-r--r--xc/extras/Mesa/src/accum.h2
-rw-r--r--xc/extras/Mesa/src/all.h2
-rw-r--r--xc/extras/Mesa/src/alpha.c2
-rw-r--r--xc/extras/Mesa/src/alpha.h2
-rw-r--r--xc/extras/Mesa/src/alphabuf.c2
-rw-r--r--xc/extras/Mesa/src/alphabuf.h2
-rw-r--r--xc/extras/Mesa/src/api.h2
-rw-r--r--xc/extras/Mesa/src/api1.c24
-rw-r--r--xc/extras/Mesa/src/api2.c2
-rw-r--r--xc/extras/Mesa/src/apiext.c2
-rw-r--r--xc/extras/Mesa/src/attrib.c12
-rw-r--r--xc/extras/Mesa/src/attrib.h2
-rw-r--r--xc/extras/Mesa/src/bbox.c2
-rw-r--r--xc/extras/Mesa/src/bbox.h2
-rw-r--r--xc/extras/Mesa/src/bitmap.c2
-rw-r--r--xc/extras/Mesa/src/bitmap.h2
-rw-r--r--xc/extras/Mesa/src/blend.c2
-rw-r--r--xc/extras/Mesa/src/blend.h2
-rw-r--r--xc/extras/Mesa/src/clip.c84
-rw-r--r--xc/extras/Mesa/src/clip.h2
-rw-r--r--xc/extras/Mesa/src/clip_funcs.h2
-rw-r--r--xc/extras/Mesa/src/clip_tmp.h2
-rw-r--r--xc/extras/Mesa/src/colortab.c2
-rw-r--r--xc/extras/Mesa/src/colortab.h2
-rw-r--r--xc/extras/Mesa/src/config.c2
-rw-r--r--xc/extras/Mesa/src/config.h2
-rw-r--r--xc/extras/Mesa/src/context.c60
-rw-r--r--xc/extras/Mesa/src/context.h2
-rw-r--r--xc/extras/Mesa/src/copy_tmp.h2
-rw-r--r--xc/extras/Mesa/src/copypix.c183
-rw-r--r--xc/extras/Mesa/src/copypix.h2
-rw-r--r--xc/extras/Mesa/src/cull_tmp.h2
-rw-r--r--xc/extras/Mesa/src/cva.c2
-rw-r--r--xc/extras/Mesa/src/cva.h2
-rw-r--r--xc/extras/Mesa/src/dd.h2
-rw-r--r--xc/extras/Mesa/src/ddsample.c2
-rw-r--r--xc/extras/Mesa/src/debug_xform.c2
-rw-r--r--xc/extras/Mesa/src/debug_xform.h2
-rw-r--r--xc/extras/Mesa/src/depth.c2
-rw-r--r--xc/extras/Mesa/src/depth.h2
-rw-r--r--xc/extras/Mesa/src/dlist.c2
-rw-r--r--xc/extras/Mesa/src/dlist.h2
-rw-r--r--xc/extras/Mesa/src/dotprod_tmp.h2
-rw-r--r--xc/extras/Mesa/src/drawpix.c6
-rw-r--r--xc/extras/Mesa/src/drawpix.h2
-rw-r--r--xc/extras/Mesa/src/enable.c2
-rw-r--r--xc/extras/Mesa/src/enable.h2
-rw-r--r--xc/extras/Mesa/src/enums.c2
-rw-r--r--xc/extras/Mesa/src/enums.h2
-rw-r--r--xc/extras/Mesa/src/eval.c2
-rw-r--r--xc/extras/Mesa/src/eval.h2
-rw-r--r--xc/extras/Mesa/src/extensions.c22
-rw-r--r--xc/extras/Mesa/src/extensions.h4
-rw-r--r--xc/extras/Mesa/src/feedback.c2
-rw-r--r--xc/extras/Mesa/src/feedback.h2
-rw-r--r--xc/extras/Mesa/src/fixed.h2
-rw-r--r--xc/extras/Mesa/src/fog.c85
-rw-r--r--xc/extras/Mesa/src/fog.h6
-rw-r--r--xc/extras/Mesa/src/fog_tmp.h175
-rw-r--r--xc/extras/Mesa/src/general_clip.h2
-rw-r--r--xc/extras/Mesa/src/get.c2
-rw-r--r--xc/extras/Mesa/src/get.h2
-rw-r--r--xc/extras/Mesa/src/glmisc.c2
-rw-r--r--xc/extras/Mesa/src/glmisc.h2
-rw-r--r--xc/extras/Mesa/src/hash.c2
-rw-r--r--xc/extras/Mesa/src/hash.h2
-rw-r--r--xc/extras/Mesa/src/highpc.c2
-rw-r--r--xc/extras/Mesa/src/image.c2
-rw-r--r--xc/extras/Mesa/src/image.h2
-rw-r--r--xc/extras/Mesa/src/indirect_tmp.h2
-rw-r--r--xc/extras/Mesa/src/interp_tmp.h16
-rw-r--r--xc/extras/Mesa/src/light.c25
-rw-r--r--xc/extras/Mesa/src/light.h2
-rw-r--r--xc/extras/Mesa/src/lines.c8
-rw-r--r--xc/extras/Mesa/src/lines.h2
-rw-r--r--xc/extras/Mesa/src/linetemp.h14
-rw-r--r--xc/extras/Mesa/src/lnaatemp.h2
-rw-r--r--xc/extras/Mesa/src/logic.c2
-rw-r--r--xc/extras/Mesa/src/logic.h2
-rw-r--r--xc/extras/Mesa/src/lowpc.c2
-rw-r--r--xc/extras/Mesa/src/macros.h2
-rw-r--r--xc/extras/Mesa/src/masking.c2
-rw-r--r--xc/extras/Mesa/src/masking.h2
-rw-r--r--xc/extras/Mesa/src/matrix.c2
-rw-r--r--xc/extras/Mesa/src/matrix.h2
-rw-r--r--xc/extras/Mesa/src/mmath.c2
-rw-r--r--xc/extras/Mesa/src/mmath.h2
-rw-r--r--xc/extras/Mesa/src/mthreads.c2
-rw-r--r--xc/extras/Mesa/src/mthreads.h2
-rw-r--r--xc/extras/Mesa/src/norm_tmp.h2
-rw-r--r--xc/extras/Mesa/src/pb.c7
-rw-r--r--xc/extras/Mesa/src/pb.h2
-rw-r--r--xc/extras/Mesa/src/pipeline.c4
-rw-r--r--xc/extras/Mesa/src/pipeline.h2
-rw-r--r--xc/extras/Mesa/src/pixel.c2
-rw-r--r--xc/extras/Mesa/src/pixel.h2
-rw-r--r--xc/extras/Mesa/src/pointers.c2
-rw-r--r--xc/extras/Mesa/src/pointers.h2
-rw-r--r--xc/extras/Mesa/src/points.c2
-rw-r--r--xc/extras/Mesa/src/points.h2
-rw-r--r--xc/extras/Mesa/src/polygon.c2
-rw-r--r--xc/extras/Mesa/src/polygon.h2
-rw-r--r--xc/extras/Mesa/src/quads.c2
-rw-r--r--xc/extras/Mesa/src/quads.h2
-rw-r--r--xc/extras/Mesa/src/rastpos.c2
-rw-r--r--xc/extras/Mesa/src/rastpos.h2
-rw-r--r--xc/extras/Mesa/src/readpix.c9
-rw-r--r--xc/extras/Mesa/src/readpix.h2
-rw-r--r--xc/extras/Mesa/src/rect.c2
-rw-r--r--xc/extras/Mesa/src/rect.h2
-rw-r--r--xc/extras/Mesa/src/render_tmp.h23
-rw-r--r--xc/extras/Mesa/src/scissor.c2
-rw-r--r--xc/extras/Mesa/src/scissor.h2
-rw-r--r--xc/extras/Mesa/src/shade.c30
-rw-r--r--xc/extras/Mesa/src/shade.h2
-rw-r--r--xc/extras/Mesa/src/shade_tmp.h2
-rw-r--r--xc/extras/Mesa/src/simple_list.h2
-rw-r--r--xc/extras/Mesa/src/span.c2
-rw-r--r--xc/extras/Mesa/src/span.h2
-rw-r--r--xc/extras/Mesa/src/stages.c4
-rw-r--r--xc/extras/Mesa/src/stages.h6
-rw-r--r--xc/extras/Mesa/src/stencil.c179
-rw-r--r--xc/extras/Mesa/src/stencil.h2
-rw-r--r--xc/extras/Mesa/src/texgen_tmp.h2
-rw-r--r--xc/extras/Mesa/src/teximage.c2
-rw-r--r--xc/extras/Mesa/src/teximage.h2
-rw-r--r--xc/extras/Mesa/src/texobj.c24
-rw-r--r--xc/extras/Mesa/src/texobj.h2
-rw-r--r--xc/extras/Mesa/src/texstate.c6
-rw-r--r--xc/extras/Mesa/src/texstate.h2
-rw-r--r--xc/extras/Mesa/src/texture.c714
-rw-r--r--xc/extras/Mesa/src/texture.h2
-rw-r--r--xc/extras/Mesa/src/trans_tmp.h2
-rw-r--r--xc/extras/Mesa/src/translate.c2
-rw-r--r--xc/extras/Mesa/src/translate.h2
-rw-r--r--xc/extras/Mesa/src/triangle.c55
-rw-r--r--xc/extras/Mesa/src/triangle.h2
-rw-r--r--xc/extras/Mesa/src/tritemp.h2
-rw-r--r--xc/extras/Mesa/src/types.h12
-rw-r--r--xc/extras/Mesa/src/varray.c25
-rw-r--r--xc/extras/Mesa/src/varray.h2
-rw-r--r--xc/extras/Mesa/src/vb.c2
-rw-r--r--xc/extras/Mesa/src/vb.h2
-rw-r--r--xc/extras/Mesa/src/vbcull.c2
-rw-r--r--xc/extras/Mesa/src/vbcull.h2
-rw-r--r--xc/extras/Mesa/src/vbfill.c10
-rw-r--r--xc/extras/Mesa/src/vbfill.h2
-rw-r--r--xc/extras/Mesa/src/vbindirect.c2
-rw-r--r--xc/extras/Mesa/src/vbindirect.h2
-rw-r--r--xc/extras/Mesa/src/vbrender.c20
-rw-r--r--xc/extras/Mesa/src/vbrender.h2
-rw-r--r--xc/extras/Mesa/src/vbxform.c18
-rw-r--r--xc/extras/Mesa/src/vbxform.h2
-rw-r--r--xc/extras/Mesa/src/vector.c2
-rw-r--r--xc/extras/Mesa/src/vector.h2
-rw-r--r--xc/extras/Mesa/src/vertices.c2
-rw-r--r--xc/extras/Mesa/src/vertices.h2
-rw-r--r--xc/extras/Mesa/src/winpos.c2
-rw-r--r--xc/extras/Mesa/src/winpos.h2
-rw-r--r--xc/extras/Mesa/src/xform.c2
-rw-r--r--xc/extras/Mesa/src/xform.h2
-rw-r--r--xc/extras/Mesa/src/xform_tmp.h2
-rw-r--r--xc/extras/Mesa/src/zoom.c2
-rw-r--r--xc/extras/Mesa/src/zoom.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c21
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c21
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h91
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c30
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c11
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c35
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c34
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c21
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c65
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c55
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c192
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h43
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h151
218 files changed, 5497 insertions, 2758 deletions
diff --git a/xc/extras/Mesa/src/FX/X86/fx_3dnow_fastpath.S b/xc/extras/Mesa/src/FX/X86/fx_3dnow_fastpath.S
new file mode 100644
index 000000000..eb426f705
--- /dev/null
+++ b/xc/extras/Mesa/src/FX/X86/fx_3dnow_fastpath.S
@@ -0,0 +1,82 @@
+#include "../../X86/assyntax.h"
+
+#define SETUP_RGBA 0x1
+#define SETUP_TMU0 0x2
+#define SETUP_TMU1 0x4
+
+
+/* Pack either rgba or texture into the remaining half of a 32 byte vertex.
+ */
+#define CLIP_R 24
+#define CLIP_G 16
+#define CLIP_B 20
+#define CLIP_A 28 /* defined inf fxdrv.h */
+
+#define CLIP_S0 16
+#define CLIP_T0 20
+#define CLIP_S1 24
+#define CLIP_T1 28
+
+#define SIZE 4
+#define TYPE (0)
+#define TAG(x) x
+#include "fx_3dnow_fasttmp.h"
+
+#define SIZE 8
+#define TYPE (SETUP_RGBA)
+#define TAG(x) x##_RGBA
+#include "fx_3dnow_fasttmp.h"
+
+#define SIZE 6
+#define TYPE (SETUP_TMU0)
+#define TAG(x) x##_TMU0
+#include "fx_3dnow_fasttmp.h"
+
+#define SIZE 8
+#define TYPE (SETUP_TMU0|SETUP_TMU1)
+#define TAG(x) x##_TMU0_TMU1
+#include "fx_3dnow_fasttmp.h"
+
+#undef CLIP_S1
+#undef CLIP_T1
+#define CLIP_S1 16
+#define CLIP_T1 20
+
+#define SIZE 6
+#define TYPE (SETUP_TMU1)
+#define TAG(x) x##_TMU1
+#include "fx_3dnow_fasttmp.h"
+
+/* These three need to use a full 64 byte clip-space vertex.
+ */
+#undef CLIP_S0
+#undef CLIP_T0
+#undef CLIP_S1
+#undef CLIP_T1
+
+#define CLIP_S0 32
+#define CLIP_T0 36
+#define CLIP_S1 40
+#define CLIP_T1 44
+
+#define SIZE 10
+#define TYPE (SETUP_RGBA|SETUP_TMU0)
+#define TAG(x) x##_RGBA_TMU0
+#include "fx_3dnow_fasttmp.h"
+
+#define SIZE 12
+#define TYPE (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1)
+#define TAG(x) x##_RGBA_TMU0_TMU1
+#include "fx_3dnow_fasttmp.h"
+
+#undef CLIP_S1
+#undef CLIP_T1
+#define CLIP_S1 32
+#define CLIP_T1 36
+
+#define SIZE 10
+#define TYPE (SETUP_RGBA|SETUP_TMU1)
+#define TAG(x) x##_RGBA_TMU1
+#include "fx_3dnow_fasttmp.h"
+
+
diff --git a/xc/extras/Mesa/src/FX/X86/fx_3dnow_fasttmp.h b/xc/extras/Mesa/src/FX/X86/fx_3dnow_fasttmp.h
new file mode 100644
index 000000000..78c5fef74
--- /dev/null
+++ b/xc/extras/Mesa/src/FX/X86/fx_3dnow_fasttmp.h
@@ -0,0 +1,313 @@
+
+#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER)
+#define TAGLLBL(a) TAG(.L##a)
+#else
+#define TAGLLBL(a) TAG(a)
+#endif
+
+#if !GLIDE3
+
+#define GR_VERTEX_X_OFFSET 0
+#define GR_VERTEX_Y_OFFSET 4
+#define GR_VERTEX_Z_OFFSET 8
+#define GR_VERTEX_R_OFFSET 12
+#define GR_VERTEX_G_OFFSET 16
+#define GR_VERTEX_B_OFFSET 20
+#define GR_VERTEX_OOZ_OFFSET 24
+#define GR_VERTEX_A_OFFSET 28
+#define GR_VERTEX_OOW_OFFSET 32
+
+#else /* GLIDE3 */
+
+#define GR_VERTEX_X_OFFSET 0
+#define GR_VERTEX_Y_OFFSET 4
+#define GR_VERTEX_OOZ_OFFSET 8
+#define GR_VERTEX_OOW_OFFSET 12
+#define GR_VERTEX_R_OFFSET 16
+#define GR_VERTEX_G_OFFSET 20
+#define GR_VERTEX_B_OFFSET 24
+#define GR_VERTEX_A_OFFSET 28
+#define GR_VERTEX_Z_OFFSET 32
+
+#endif /* GLIDE3 */
+
+#define GR_VERTEX_SOW_TMU0_OFFSET 36
+#define GR_VERTEX_TOW_TMU0_OFFSET 40
+#define GR_VERTEX_OOW_TMU0_OFFSET 44
+#define GR_VERTEX_SOW_TMU1_OFFSET 48
+#define GR_VERTEX_TOW_TMU1_OFFSET 52
+#define GR_VERTEX_OOW_TMU1_OFFSET 56
+
+
+
+
+/*#define MAT_SX 0 /* accessed by REGIND !! */
+#define MAT_SY 20
+#define MAT_SZ 40
+#define MAT_TX 48
+#define MAT_TY 52
+#define MAT_TZ 56
+
+
+
+
+/* Do viewport map, device scale and perspective projection.
+ *
+ * void project_verts( GLfloat *first,
+ * GLfloat *last,
+ * const GLfloat *m,
+ * GLuint stride )
+ *
+ *
+ * Rearrange fxVertices to look like grVertices.
+ */
+
+GLOBL GLNAME( TAG(fx_3dnow_project_vertices) )
+GLNAME( TAG(fx_3dnow_project_vertices) ):
+
+ PUSH_L ( EBP )
+
+ MOV_L ( REGOFF(8, ESP), ECX ) /* first_vert */
+ MOV_L ( REGOFF(12, ESP), EDX ) /* last_vert */
+
+ CMP_L ( ECX, EDX )
+ JE ( TAGLLBL(FXPV_end) )
+
+ FEMMS
+
+ PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
+
+ MOV_L ( REGOFF(16, ESP), EBP ) /* matrix */
+ MOV_L ( REGOFF(20, ESP), EAX ) /* stride */
+
+ MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
+ PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
+
+#if !defined(FX_V2)
+ MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
+ MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
+#endif
+
+ MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
+ PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
+
+ MOVD ( REGIND(EBP), MM5 )
+ PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
+
+ MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
+
+
+ALIGNTEXT32
+TAGLLBL(FXPV_loop_start):
+
+ PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
+
+
+ MOVD ( REGOFF(12, ECX), MM0 ) /* | f[3] */
+ PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
+
+ MOVD ( REGOFF(12, ECX), MM7 ) /* | f[3] */
+ PFRCPIT1 ( MM0, MM7 )
+ PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
+
+ PUNPCKLDQ ( MM7, MM7 )
+
+
+#if (TYPE & SETUP_RGBA)
+ MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
+ MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
+#endif
+
+#if (TYPE & SETUP_TMU1)
+ MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
+ PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
+ MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
+#endif
+
+
+#if (TYPE & SETUP_TMU0)
+ MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
+ PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
+ MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
+#endif
+
+
+
+
+
+/* DO_SETUP_XYZ */
+
+ MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
+ PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
+
+ MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
+ PFMUL ( MM7, MM3 ) /* | f[2] * oow */
+
+ MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
+ PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
+
+ PFADD ( MM0, MM3 ) /* | f[2] += vtz */
+ PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
+
+ PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
+
+#if !defined(FX_V2)
+ PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
+#endif
+
+ MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
+ MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
+
+
+/* end of DO_SETUP_XYZ */
+
+ MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
+ ADD_L ( EAX, ECX ) /* f += stride */
+
+ CMP_L ( ECX, EDX ) /* stall??? */
+ JA ( TAGLLBL(FXPV_loop_start) )
+
+TAGLLBL(FXPV_end):
+ FEMMS
+ POP_L ( EBP )
+ RET
+
+
+
+
+
+
+
+/* void project_verts( GLfloat *first,
+ * GLfloat *last,
+ * const GLfloat *m,
+ * GLuint stride,
+ * const GLubyte *mask )
+ *
+ */
+
+GLOBL GLNAME( TAG(fx_3dnow_project_clipped_vertices) )
+GLNAME( TAG(fx_3dnow_project_clipped_vertices) ):
+
+ PUSH_L ( EBP )
+
+ MOV_L ( REGOFF(8, ESP), ECX ) /* first FXDRIVER(VB)->verts*/
+ MOV_L ( REGOFF(12, ESP), EDX ) /* last FXDRIVER(VB)->last_vert */
+
+ FEMMS
+
+ PUSH_L ( EDI )
+ PUSH_L ( ESI )
+
+ PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
+
+ MOV_L ( REGOFF(24, ESP), EBP ) /* mat ctx->Viewport.WindowMap.M */
+ MOV_L ( REGOFF(28, ESP), EAX ) /* stride */
+ MOV_L ( REGOFF(32, ESP), ESI ) /* VB->ClipMask */
+
+ MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
+ PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
+
+#if !defined(FX_V2)
+ MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
+ MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
+#endif
+
+ MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
+ PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
+
+ MOVD ( REGIND(EBP), MM5 )
+ PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
+
+ MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
+
+
+
+ALIGNTEXT32
+TAGLLBL(FXPCV_loop_start):
+
+ PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
+
+ CMP_B ( CONST(0), REGIND(ESI) )
+ JNE ( TAGLLBL(FXPCV_skip) )
+
+ MOVD ( REGOFF(12, ECX), MM0) /* | f[3] */
+ PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
+
+ MOVD ( REGOFF(12, ECX), MM7) /* | f[3] */
+ PFRCPIT1 ( MM0, MM7 )
+ PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
+
+ PUNPCKLDQ ( MM7, MM7 )
+
+
+#if (TYPE & SETUP_RGBA)
+ MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
+ MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
+#endif
+
+#if (TYPE & SETUP_TMU1)
+ MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
+ PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
+ MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
+#endif
+
+
+#if (TYPE & SETUP_TMU0)
+ MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
+ PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
+ MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
+#endif
+
+
+
+
+/* DO_SETUP_XYZ */
+
+ MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
+ PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
+
+ MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
+ PFMUL ( MM7, MM3 ) /* | f[2] * oow */
+
+ MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
+ PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
+
+ PFADD ( MM0, MM3 ) /* | f[2] += vtz */
+ PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
+
+ PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
+
+#if !defined(FX_V2)
+ PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
+#endif
+
+ MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
+ MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
+
+
+/* end of DO_SETUP_XYZ */
+
+ MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
+
+TAGLLBL(FXPCV_skip):
+ ADD_L ( EAX, ECX ) /* f += stride */
+
+ INC_L ( ESI ) /* next ClipMask */
+ CMP_L ( ECX, EDX )
+ JA ( TAGLLBL(FXPCV_loop_start) )
+
+ POP_L ( ESI )
+ POP_L ( EDI )
+
+TAGLLBL(FXPCV_end):
+ FEMMS
+ POP_L ( EBP )
+ RET
+
+
+
+#undef TYPE
+#undef TAG
+#undef SIZE
+
diff --git a/xc/extras/Mesa/src/FX/fxapi.c b/xc/extras/Mesa/src/FX/fxapi.c
index baa9f3e15..8dec237e0 100644
--- a/xc/extras/Mesa/src/FX/fxapi.c
+++ b/xc/extras/Mesa/src/FX/fxapi.c
@@ -1,24 +1,52 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxapi.c - 3Dfx VooDoo/Mesa interface
-*/
+/* -*- mode: C; tab-width:8; -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Copyright (C) 1999 Brian Paul All Rights Reserved.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- ********************************************************************
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
+
+/* fxapi.c - 3Dfx VooDoo/Mesa interface */
+
+
+/********************************************************************
*
* Function names:
* fxMesa.... (The driver API)
@@ -820,9 +848,10 @@ void fxsignals()
/*
* Create a new FX/Mesa context and return a handle to it.
*/
-fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res,
- GrScreenRefresh_t ref,
- const GLint attribList[])
+fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,
+ GrScreenResolution_t res,
+ GrScreenRefresh_t ref,
+ const GLint attribList[])
{
fxMesaContext fxMesa = NULL;
int i,type;
@@ -835,7 +864,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res
GLint accumSize=0;
GLcontext *shareCtx = NULL;
GLcontext *ctx = 0;
- FX_GrContext_t glideContext = 0;
+ /*FX_GrContext_t glideContext = 0;*/
char *errorstr;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
@@ -928,24 +957,61 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res
fxMesa->verbose=verbose;
fxMesa->board=glbCurrentBoard;
-
- fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
#if FXMESA_USE_ARGB
- GR_COLORFORMAT_ARGB,
+ fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
+ GR_COLORFORMAT_ARGB,
+ GR_ORIGIN_LOWER_LEFT,
+ 2,aux);
#else
- GR_COLORFORMAT_ABGR,
+ fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref,
+ GR_COLORFORMAT_ABGR,
+ GR_ORIGIN_LOWER_LEFT,
+ 2,aux);
#endif
- GR_ORIGIN_LOWER_LEFT,
- 2,aux);
if (!fxMesa->glideContext){
errorstr = "grSstWinOpen";
goto errorhandler;
}
-
+
+ /* Pixel tables are use during pixel read-back */
+#if FXMESA_USE_ARGB
+ fxInitPixelTables(GL_FALSE); /* Force RGB pixel order */
+#else
+ if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) {
+ /* jk991130 - GROSS HACK!!! - Voodoo 3s don't use BGR!!
+ * the only way to tell if it's a Voodoo 3 at this stage of the
+ * ballgame (no Glide 3.x for linux *yet*) is to query the # of TMUs
+ * as Voodoo3s have 2 TMUs on board, Banshee has only 1
+ * Thanks to Joseph Kain for that one
+ */
+ if (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx == 2) {
+ fxInitPixelTables(GL_FALSE); /* use RGB pixel order (Voodoo3) */
+ }
+ else {
+ fxInitPixelTables(GL_TRUE); /* use BGR pixel order on Voodoo1/2 */
+ }
+ }
+ else {
+ fxInitPixelTables(GL_FALSE); /* use RGB pixel order otherwise */
+ }
+#endif
fxMesa->width=FX_grSstScreenWidth();
fxMesa->height=FX_grSstScreenHeight();
+ fxMesa->clipMinX = 0;
+ fxMesa->clipMaxX = fxMesa->width;
+ fxMesa->clipMinY = 0;
+ fxMesa->clipMaxY = fxMesa->height;
+
+ fxMesa->screen_width = fxMesa->width;
+ fxMesa->screen_height = fxMesa->height;
+ fxMesa->x_offset = 0;
+ fxMesa->y_offset = 0;
+ fxMesa->y_delta = 0;
+
+ fxMesa->needClip = 0;
+
if(verbose)
fprintf(stderr,"Glide screen size: %dx%d\n",
(int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight());
@@ -1204,7 +1270,7 @@ int GLAPIENTRY fxQueryHardware(void)
char buf[80];
FX_grGlideGetVersion(buf);
- fprintf(stderr,"Using Glide V%s\n",0);
+ fprintf(stderr,"Using Glide V%s\n","");
fprintf(stderr,"Number of boards: %d\n",glbHWConfig.num_sst);
if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) {
diff --git a/xc/extras/Mesa/src/FX/fxclip.c b/xc/extras/Mesa/src/FX/fxclip.c
index 0779a6309..bd4fb6885 100644
--- a/xc/extras/Mesa/src/FX/fxclip.c
+++ b/xc/extras/Mesa/src/FX/fxclip.c
@@ -1,3 +1,47 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
@@ -346,6 +390,26 @@ static GLuint fx_clip_line( GLcontext *ctx,
}
#else
+#if defined(DRIVERTS)
+
+#define VARS_XYZW \
+ GLfloat vsx = mat[MAT_SX]; \
+ GLfloat vsy = mat[MAT_SY]; \
+ GLfloat vsz = mat[MAT_SZ]; \
+ GLfloat vtx = mat[MAT_TX]+fxMesa->x_offset; \
+ GLfloat vty = mat[MAT_TY]+fxMesa->y_delta; \
+ GLfloat vtz = mat[MAT_TZ];
+
+#define DO_SETUP_XYZW \
+{ \
+ GLfloat oow = 1.0 / data[3]; \
+ v->x = data[0]*oow*vsx + vtx; \
+ v->y = data[1]*oow*vsy + vty; \
+ v->ooz = data[2]*oow*vsz + vtz; \
+ v->oow = oow; \
+}
+
+#else
#define VARS_XYZW \
GLfloat vsx = mat[MAT_SX]; \
GLfloat vsy = mat[MAT_SY]; \
@@ -367,6 +431,7 @@ static GLuint fx_clip_line( GLcontext *ctx,
}
#endif
+#endif
#define COPY_XYZW_STRIDE \
{ GLfloat *clip = VEC_ELT(VB->ClipPtr, GLfloat, e); \
@@ -394,8 +459,8 @@ static GLuint fx_clip_line( GLcontext *ctx,
#define VARS_TMU0 \
struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; \
- GLfloat sScale0 = ((tfxTexInfo *) (t0->Current->DriverData))->sScale; \
- GLfloat tScale0 = ((tfxTexInfo *) (t0->Current->DriverData))->tScale; \
+ GLfloat sScale0 = fxTMGetTexInfo(t0->Current)->sScale; \
+ GLfloat tScale0 = fxTMGetTexInfo(t0->Current)->tScale; \
#define COPY_TMU0_STRIDE(offset) \
@@ -409,8 +474,8 @@ static GLuint fx_clip_line( GLcontext *ctx,
#define VARS_TMU1 \
struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; \
- GLfloat sScale1 = ((tfxTexInfo *) (t1->Current->DriverData))->sScale; \
- GLfloat tScale1 = ((tfxTexInfo *) (t1->Current->DriverData))->tScale;
+ GLfloat sScale1 = fxTMGetTexInfo(t1->Current)->sScale; \
+ GLfloat tScale1 = fxTMGetTexInfo(t1->Current)->tScale;
#define COPY_TMU1_STRIDE(offset) \
{ GLfloat *tc1 = VEC_ELT(tc1_vec, GLfloat, e); \
diff --git a/xc/extras/Mesa/src/FX/fxcliptmp.h b/xc/extras/Mesa/src/FX/fxcliptmp.h
index 81da81550..384a25d25 100644
--- a/xc/extras/Mesa/src/FX/fxcliptmp.h
+++ b/xc/extras/Mesa/src/FX/fxcliptmp.h
@@ -1,3 +1,47 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
#define V1 VARS_XYZW
#define S1 DO_SETUP_XYZW
@@ -102,8 +146,8 @@ static void TAG(fx_tri_view_clip)( struct vertex_buffer *VB,
v2 = verts[1];
v3 = verts[2];
- for (i = 2 ; i < n ; v2 = v3, v3=verts[++i])
- grDrawTriangle(v, v2, v3);
+ for (i = 2 ; i < n ; v2 = v3, v3=verts[++i])
+ FX_grDrawTriangle(v, v2, v3);
}
}
@@ -167,8 +211,8 @@ static void TAG(fx_tri_clip_stride)( struct vertex_buffer *VB,
v2 = verts[1];
v3 = verts[2];
- for (i = 2 ; i < n ; v2 = v3, v3=verts[++i])
- grDrawTriangle(v, v2, v3);
+ for (i = 2 ; i < n ; v2 = v3, v3=verts[++i])
+ FX_grDrawTriangle(v, v2, v3);
}
}
@@ -227,7 +271,7 @@ static void TAG(fx_line_clip)( struct vertex_buffer *VB,
data = vlist[1];
SETUP;
- grDrawLine(gWin, v);
+ FX_grDrawLine(gWin, v);
}
}
diff --git a/xc/extras/Mesa/src/FX/fxcva.c b/xc/extras/Mesa/src/FX/fxcva.c
index 87692dd06..5a52509a9 100644
--- a/xc/extras/Mesa/src/FX/fxcva.c
+++ b/xc/extras/Mesa/src/FX/fxcva.c
@@ -1,29 +1,51 @@
-
-/* -*- mode: C; tab-width:8; -*-
-
- fxcva.c - the CVA related code
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * See the file fxapi.c for more informations about authors
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+/* fxcva.c - the CVA related code */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -79,12 +101,11 @@ static INLINE void fxRenderClippedTriangle2( struct vertex_buffer *VB,
GLubyte *clipmask = VB->ClipMask;
GLubyte mask = clipmask[v1] | clipmask[v2] | clipmask[v3];
- if (!mask)
- grDrawTriangle((GrVertex *)gWin[v1].f,
+ if (!mask) {
+ FX_grDrawTriangle((GrVertex *)gWin[v1].f,
(GrVertex *)gWin[v2].f,
(GrVertex *)gWin[v3].f);
- else if (!(clipmask[v1]&clipmask[v2]&clipmask[v3]&CLIP_ALL_BITS))
- {
+ } else if (!(clipmask[v1]&clipmask[v2]&clipmask[v3]&CLIP_ALL_BITS)) {
GLuint n;
GLuint vlist[VB_MAX_CLIPPED_VERTS];
ASSIGN_3V(vlist, v1, v2, v3);
@@ -92,10 +113,11 @@ static INLINE void fxRenderClippedTriangle2( struct vertex_buffer *VB,
n = (VB->ctx->poly_clip_tab[VB->ClipPtr->size])( VB, 3, vlist, mask );
if (n >= 3) {
GLuint i, j0 = vlist[0];
- for (i=2;i<n;i++)
- grDrawTriangle((GrVertex *)gWin[j0].f,
+ for (i=2;i<n;i++) {
+ FX_grDrawTriangle((GrVertex *)gWin[j0].f,
(GrVertex *)gWin[vlist[i-1]].f,
(GrVertex *)gWin[vlist[i]].f);
+ }
}
}
}
@@ -152,10 +174,10 @@ static mergefunc merge_and_render_tab[2][MAX_MERGABLE][PRIM_CULLED+1];
#define INIT_TMU1 (void) cva_tex1; (void) tmu1_stride; (void) tmu1_sz;
-#define DRAW_POINT grDrawPoint( (GrVertex *)v )
-#define DRAW_LINE grDrawLine( (GrVertex *)v, (GrVertex *)prev_v )
-#define DRAW_TRI grDrawTriangle( (GrVertex *)gWin[l[0]].f, (GrVertex *)gWin[l[1]].f, (GrVertex *)v )
-#define DRAW_TRI2 grDrawTriangle( vl[0], vl[1], vl[2] )
+#define DRAW_POINT FX_grDrawPoint( (GrVertex *)v )
+#define DRAW_LINE FX_grDrawLine( (GrVertex *)v, (GrVertex *)prev_v )
+#define DRAW_TRI FX_grDrawTriangle( (GrVertex *)gWin[l[0]].f, (GrVertex *)gWin[l[1]].f, (GrVertex *)v )
+#define DRAW_TRI2 FX_grDrawTriangle( vl[0], vl[1], vl[2] )
#define CLIP_LINE fxRenderClippedLine( cvaVB, e, prev )
#define CLIP_OR_DRAW_TRI fxRenderClippedTriangle2( cvaVB, l[0], l[1], e )
#define DIRECT 1
@@ -391,7 +413,7 @@ extern void fxTriangleSmooth(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3,
extern const char *gl_prim_name[];
-static GLboolean edge_flag[GL_POLYGON+2] = { 0,0,0,0,1,0,0,1,0,1,0 };
+/* static GLboolean edge_flag[GL_POLYGON+2] = { 0,0,0,0,1,0,0,1,0,1,0 }; */
void fxDDMergeAndRender( struct vertex_buffer *VB )
{
diff --git a/xc/extras/Mesa/src/FX/fxcva.h b/xc/extras/Mesa/src/FX/fxcva.h
index 8059015a4..fd50621df 100644
--- a/xc/extras/Mesa/src/FX/fxcva.h
+++ b/xc/extras/Mesa/src/FX/fxcva.h
@@ -1,3 +1,48 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
+
#ifndef _FXCVA_H_
#define _FXCVA_H_
diff --git a/xc/extras/Mesa/src/FX/fxcvatmp.h b/xc/extras/Mesa/src/FX/fxcvatmp.h
index 1f4ab14ab..75fc34bb4 100644
--- a/xc/extras/Mesa/src/FX/fxcvatmp.h
+++ b/xc/extras/Mesa/src/FX/fxcvatmp.h
@@ -1,3 +1,47 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
static void TAG(cva_render_points)( struct vertex_buffer *cvaVB,
struct vertex_buffer *VB,
diff --git a/xc/extras/Mesa/src/FX/fxdd.c b/xc/extras/Mesa/src/FX/fxdd.c
index 3580971ae..cbe63695f 100644
--- a/xc/extras/Mesa/src/FX/fxdd.c
+++ b/xc/extras/Mesa/src/FX/fxdd.c
@@ -1,28 +1,51 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxdd.c - 3Dfx VooDoo Mesa device driver functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Thank you for your contribution, David!
*
- * See the file fxapi.c for more informations about authors
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+/* fxdd.c - 3Dfx VooDoo Mesa device driver functions */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -34,6 +57,44 @@
#include "enums.h"
#include "extensions.h"
+
+/* These lookup table are used to extract RGB values in [0,255] from
+ * 16-bit pixel values.
+ */
+GLubyte FX_PixelToR[0x10000];
+GLubyte FX_PixelToG[0x10000];
+GLubyte FX_PixelToB[0x10000];
+
+
+/*
+ * Initialize the FX_PixelTo{RGB} arrays.
+ * Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order.
+ */
+void fxInitPixelTables(GLboolean bgrOrder)
+{
+ GLuint pixel;
+ for (pixel = 0; pixel <= 0xffff; pixel++) {
+ GLuint r, g, b;
+ if (bgrOrder) {
+ r = (pixel & 0x001F) << 3;
+ g = (pixel & 0x07E0) >> 3;
+ b = (pixel & 0xF800) >> 8;
+ }
+ else {
+ r = (pixel & 0xF800) >> 8;
+ g = (pixel & 0x07E0) >> 3;
+ b = (pixel & 0x001F) << 3;
+ }
+ r = r * 255 / 0xF8; /* fill in low-order bits */
+ g = g * 255 / 0xFC;
+ b = b * 255 / 0xF8;
+ FX_PixelToR[pixel] = r;
+ FX_PixelToG[pixel] = g;
+ FX_PixelToB[pixel] = b;
+ }
+}
+
+
/**********************************************************************/
/***** Miscellaneous functions *****/
/**********************************************************************/
@@ -45,10 +106,11 @@ void fxDDDither(GLcontext *ctx, GLboolean enable)
fprintf(stderr,"fxmesa: fxDDDither()\n");
}
- if(enable)
- grDitherMode(GR_DITHER_4x4);
- else
- grDitherMode(GR_DITHER_DISABLE);
+ if (enable) {
+ FX_grDitherMode(GR_DITHER_4x4);
+ } else {
+ FX_grDitherMode(GR_DITHER_DISABLE);
+ }
}
@@ -121,14 +183,14 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
/* clear color and depth buffer */
if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) {
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- grBufferClear(fxMesa->clearC, fxMesa->clearA,
- (FxU16)(ctx->Depth.Clear*0xffff));
+ FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
+ (FxU16)(ctx->Depth.Clear*0xffff));
}
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) {
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- grBufferClear(fxMesa->clearC, fxMesa->clearA,
- (FxU16)(ctx->Depth.Clear*0xffff));
+ FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
+ (FxU16)(ctx->Depth.Clear*0xffff));
}
newmask=mask & (~(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT));
@@ -137,19 +199,20 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
/* clear color buffer */
if(ctx->Color.ColorMask) {
- grDepthMask(FXFALSE);
+ FX_grDepthMask(FXFALSE);
if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) {
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
+ FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
}
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) {
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
+ FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
}
- if(ctx->Depth.Mask)
- grDepthMask(FXTRUE);
+ if(ctx->Depth.Mask) {
+ FX_grDepthMask(FXTRUE);
+ }
}
newmask=mask & (~(GL_COLOR_BUFFER_BIT));
@@ -158,14 +221,14 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
/* clear depth buffer */
if(ctx->Depth.Mask) {
- grColorMask(FXFALSE,FXFALSE);
- grBufferClear(fxMesa->clearC, fxMesa->clearA,
- (FxU16)(ctx->Depth.Clear*0xffff));
-
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
- ctx->Color.ColorMask[GCOMP] ||
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
+ FX_grColorMask(FXFALSE,FXFALSE);
+ FX_grBufferClear(fxMesa->clearC, fxMesa->clearA,
+ (FxU16)(ctx->Depth.Clear*0xffff));
+
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ ctx->Color.ColorMask[GCOMP] ||
+ ctx->Color.ColorMask[BCOMP],
+ ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
}
newmask=mask & (~(GL_DEPTH_BUFFER_BIT));
@@ -190,12 +253,12 @@ static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
if (mode == GL_FRONT_LEFT) {
fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
- grRenderBuffer(fxMesa->currentFB);
+ FX_grRenderBuffer(fxMesa->currentFB);
return GL_TRUE;
}
else if (mode == GL_BACK_LEFT) {
fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
- grRenderBuffer(fxMesa->currentFB);
+ FX_grRenderBuffer(fxMesa->currentFB);
return GL_TRUE;
}
else {
@@ -204,6 +267,22 @@ static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
}
+#ifdef XF86DRI
+static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py)
+{
+ int i;
+
+ py=fxMesa->height+fxMesa->y_offset-py;
+ for (i=0; i<fxMesa->numClipRects; i++) {
+ if ((px>=fxMesa->pClipRects[i].x1) &&
+ (px<fxMesa->pClipRects[i].x2) &&
+ (py>=fxMesa->pClipRects[i].y1) &&
+ (py<fxMesa->pClipRects[i].y2)) return GL_TRUE;
+ }
+ return GL_FALSE;
+}
+#endif
+
static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
@@ -241,10 +320,16 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
ymax=fxMesa->height;
}
+ xmin+=fxMesa->x_offset;
+ xmax+=fxMesa->x_offset;
-#define ISCLIPPED(rx) ( ((rx)<xmin) || ((rx)>=xmax) )
+#ifdef XF86DRI
+#define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) || !inClipRects(fxMesa, rx, ry))
+#else
+#define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) )
+#endif
#define DRAWBIT(i) { \
- if(!ISCLIPPED(x+px)) \
+ if(!ISCLIPPED(x+px, y)) \
if( (*pb) & (1<<(i)) ) \
(*p)=color; \
p++; \
@@ -258,7 +343,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
scrwidth=fxMesa->width;
scrheight=fxMesa->height;
- if((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0))
+ if ((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0))
return GL_TRUE;
pb=bitmap;
@@ -269,16 +354,16 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
py=0;
}
- if(py+height>=scrheight)
+ if (py+height>=scrheight)
height-=(py+height)-scrheight;
info.size=sizeof(info);
- if(!grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_565,
- GR_ORIGIN_UPPER_LEFT,
- FXFALSE,
- &info)) {
+ if(!FX_grLfbLock(GR_LFB_WRITE_ONLY,
+ fxMesa->currentFB,
+ GR_LFBWRITEMODE_565,
+ GR_ORIGIN_UPPER_LEFT,
+ FXFALSE,
+ &info)) {
#ifndef FX_SILENT
fprintf(stderr,"fx Driver: error locking the linear frame buffer\n");
#endif
@@ -298,13 +383,13 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
/* This code is a bit slow... */
- for(y=py;y<(py+height);y++) {
+ if (py>ymin) ymin=py;
+ if (py+height<ymax) ymax=py+height;
- if (y>=ymax)
- break;
+ px+=fxMesa->x_offset;
+ scrheight=fxMesa->height+fxMesa->y_offset;
- if (y<=ymin)
- continue;
+ for(y=ymin; y<ymax; y++) {
p=((FxU16 *)info.lfbPtr)+px+((scrheight-y)*stride);
@@ -315,7 +400,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
}
}
- grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
+ FX_grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
#undef ISCLIPPED
#undef DRAWBIT
@@ -347,8 +432,6 @@ void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
{
FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
ctx->Driver.RenderStart = fxSetupFXUnits;
-
- FX_CONTEXT(ctx)->wscale = fabs(f)/65535.0f;
}
/* KW: Put the word Mesa in the render string because quakeworld
@@ -459,13 +542,13 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
fxMesa->unitsState.depthMask =GL_TRUE;
fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;
- grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
+ FX_grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
if(fxMesa->haveDoubleBuffer) {
fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
} else {
fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
fxMesa->state = NULL;
@@ -481,10 +564,10 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
}
if(fxMesa->haveZBuffer)
- grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
+ FX_grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
#if (!FXMESA_USE_ARGB)
- grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */
+ FX_grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */
#endif
fxMesa->glCtx->Const.MaxTextureLevels=9;
@@ -505,7 +588,7 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
- grGlideGetState((GrState*)fxMesa->state);
+ FX_grGlideGetState((GrState*)fxMesa->state);
/* XXX Fix me: callback not registered when main VB is created.
*/
@@ -546,6 +629,12 @@ void fxDDInitExtensions( GLcontext *ctx )
gl_extensions_disable( ctx, "GL_ARB_multitexture" );
}
+/*
+ This driver may need to move the drawing operations to a different sub
+ window. This modifies the viewport command to add our X,Y offset to all
+ drawn objects that go through the viewport transformation.
+*/
+
/************************************************************************/
/************************************************************************/
/************************************************************************/
@@ -591,16 +680,19 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
/* Not very well written ... */
((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) &&
((ctx->Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D)))
- )
+ ) {
return GL_FALSE;
+ }
if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
- (ctx->Texture.Unit[0].EnvMode==GL_BLEND))
+ (ctx->Texture.Unit[0].EnvMode==GL_BLEND)) {
return GL_FALSE;
+ }
if((ctx->Texture.ReallyEnabled & TEXTURE1_2D) &&
- (ctx->Texture.Unit[1].EnvMode==GL_BLEND))
+ (ctx->Texture.Unit[1].EnvMode==GL_BLEND)) {
return GL_FALSE;
+ }
if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
@@ -617,8 +709,9 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
/* Can't use multipass to blend a multitextured triangle - fall
* back to software.
*/
- if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled)
+ if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) {
return GL_FALSE;
+ }
if ((ctx->Texture.Unit[0].EnvMode!=ctx->Texture.Unit[1].EnvMode) &&
(ctx->Texture.Unit[0].EnvMode!=GL_MODULATE) &&
@@ -626,7 +719,6 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
{
if (MESA_VERBOSE&VERBOSE_DRIVER)
fprintf(stderr, "fxMesa: unsupported multitex env mode\n");
-
return GL_FALSE;
}
}
@@ -635,13 +727,15 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
/* Not very well written ... */
((ctx->Enabled & TEXTURE0_1D) &&
(!(ctx->Enabled & TEXTURE0_2D)))
- )
+ ) {
return GL_FALSE;
+ }
if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
- (ctx->Texture.Unit[0].EnvMode==GL_BLEND))
+ (ctx->Texture.Unit[0].EnvMode==GL_BLEND)) {
return GL_FALSE;
+ }
}
return GL_TRUE;
@@ -680,11 +774,11 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
ctx->Driver.LineFunc=fxMesa->LineFunc;
ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
ctx->Driver.QuadFunc=fxMesa->QuadFunc;
- } else
+ } else {
fxMesa->render_index = FX_FALLBACK;
+ }
}
-
void fxSetupDDPointers(GLcontext *ctx)
{
if (MESA_VERBOSE&VERBOSE_DRIVER) {
@@ -748,7 +842,6 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.CullFace=fxDDCullFace;
ctx->Driver.ShadeModel=fxDDShadeModel;
ctx->Driver.Enable=fxDDEnable;
-
ctx->Driver.RegisterVB=fxDDRegisterVB;
ctx->Driver.UnregisterVB=fxDDUnregisterVB;
@@ -786,3 +879,4 @@ int gl_fx_dummy_function_dd(void)
}
#endif /* FX */
+
diff --git a/xc/extras/Mesa/src/FX/fxddspan.c b/xc/extras/Mesa/src/FX/fxddspan.c
index 21b48ae78..5540f3c6d 100644
--- a/xc/extras/Mesa/src/FX/fxddspan.c
+++ b/xc/extras/Mesa/src/FX/fxddspan.c
@@ -1,27 +1,51 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxdd.c - 3Dfx VooDoo Mesa span and pixel functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * See the file fxapi.c for more informations about authors
+ * Thank you for your contribution, David!
*
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+/* fxdd.c - 3Dfx VooDoo Mesa span and pixel functions */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -42,6 +66,66 @@
#if !defined(FXMESA_USE_ARGB)
+
+#if defined(FX_GLIDE3) && defined(XF86DRI)
+
+static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
+ FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
+ FxU32 src_width, FxU32 src_height, FxI32 src_stride,
+ void *src_data);
+
+FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
+ FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
+ FxU32 src_width, FxU32 src_height, FxI32 src_stride,
+ void *src_data)
+{
+ int i, x, w;
+ void *data;
+
+ if (src_width==1 && src_height==1) { /* Easy case writing a point */
+ for (i=0; i<fxMesa->numClipRects; i++) {
+ if ((dst_x>=fxMesa->pClipRects[i].x1) &&
+ (dst_x<fxMesa->pClipRects[i].x2) &&
+ (dst_y>=fxMesa->pClipRects[i].y1) &&
+ (dst_y<fxMesa->pClipRects[i].y2)) {
+ FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format,
+ src_width, src_height, src_stride, src_data);
+ return GL_TRUE;
+ }
+ }
+ } else if (src_height==1) { /* Writing a span */
+ for (i=0; i<fxMesa->numClipRects; i++) {
+ if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) {
+ if (dst_x<fxMesa->pClipRects[i].x1) {
+ x=fxMesa->pClipRects[i].x1;
+ data=((char*)src_data)+2*(dst_x-x);
+ w=src_width-(x-dst_x);
+ } else {
+ x=dst_x;
+ data=src_data;
+ w=src_width;
+ }
+ if (x+w>fxMesa->pClipRects[i].x2) {
+ w=fxMesa->pClipRects[i].x2-x;
+ }
+ FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, src_height,
+ src_stride, data);
+ }
+ }
+ } else { /* Punt on the case of arbitrary rectangles */
+ return GL_FALSE;
+ }
+ return GL_TRUE;
+}
+
+#else
+
+#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
+ FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
+
+#endif
+
+
/* KW: Rearranged the args in the call to grLfbWriteRegion().
*/
#define LFB_WRITE_SPAN_MESA(dst_buffer, \
@@ -50,7 +134,7 @@
src_width, \
src_stride, \
src_data) \
- grLfbWriteRegion(dst_buffer, \
+ writeRegionClipped(fxMesa, dst_buffer, \
dst_x, \
dst_y, \
GR_LFB_SRC_FMT_8888, \
@@ -60,7 +144,11 @@
src_data) \
-#else /* defined(FXMESA_USE_RGBA) */
+#else /* !defined(FXMESA_USE_RGBA) */
+
+#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
+ FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
+
#define MESACOLOR_TO_ARGB(c) ( \
( ((unsigned int)(c[ACOMP]))<<24 ) | \
@@ -68,7 +156,7 @@
( ((unsigned int)(c[GCOMP]))<<8 ) | \
( (unsigned int)(c[BCOMP])) )
-void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
+inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
FxU32 dst_x,
FxU32 dst_y,
FxU32 src_width,
@@ -84,7 +172,7 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
{
argb[i] = MESACOLOR_TO_ARGB(rgba[i]);
}
- FX_grLfbWriteRegion(dst_buffer,
+ writeRegionClipped( /*fxMesa,*/ NULL, dst_buffer,
dst_x,
dst_y,
GR_LFB_SRC_FMT_8888,
@@ -93,8 +181,9 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
src_stride,
(void*)argb);
}
+
+#endif /* !defined(FXMESA_USE_RGBA) */
-#endif
/************************************************************************/
/***** Span functions *****/
@@ -107,12 +196,13 @@ static void fxDDWriteRGBASpan(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBASpan(...)\n");
}
+ x+=fxMesa->x_offset;
if (mask) {
int span=0;
@@ -143,13 +233,14 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLubyte rgba[MAX_WIDTH][4];
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBSpan()\n");
}
+ x+=fxMesa->x_offset;
if (mask) {
int span=0;
@@ -192,13 +283,14 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLuint data[MAX_WIDTH];
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n");
}
+ x+=fxMesa->x_offset;
if (mask) {
int span=0;
@@ -208,7 +300,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
++span;
} else {
if (span > 0) {
- FX_grLfbWriteRegion( fxMesa->currentFB, x+i-span, bottom-y,
+ writeRegionClipped(fxMesa, fxMesa->currentFB, x+i-span, bottom-y,
GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data );
span = 0;
@@ -217,7 +309,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
}
if (span > 0)
- FX_grLfbWriteRegion( fxMesa->currentFB, x+n-span, bottom-y,
+ writeRegionClipped(fxMesa, fxMesa->currentFB, x+n-span, bottom-y,
GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data );
} else {
@@ -225,7 +317,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
data[i]=(GLuint) fxMesa->color;
}
- FX_grLfbWriteRegion( fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888,
+ writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888,
n, 1, 0, (void *) data );
}
}
@@ -237,7 +329,7 @@ static void fxDDReadRGBASpan(const GLcontext *ctx,
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLushort data[MAX_WIDTH];
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadRGBASpan(...)\n");
@@ -245,20 +337,16 @@ static void fxDDReadRGBASpan(const GLcontext *ctx,
assert(n < MAX_WIDTH);
- grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data);
+ x+=fxMesa->x_offset;
+ FX_grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data);
+
for (i=0;i<n;i++) {
-#if FXMESA_USE_ARGB
- rgba[i][RCOMP]=(data[i] & 0xF800) >> 8;
- rgba[i][GCOMP]=(data[i] & 0x07E0) >> 3;
- rgba[i][BCOMP]=(data[i] & 0x001F) << 3;
-#else
- rgba[i][RCOMP]=(data[i] & 0x001f) << 3;
- rgba[i][GCOMP]=(data[i] & 0x07e0) >> 3;
- rgba[i][BCOMP]=(data[i] & 0xf800) >> 8;
-#endif
- rgba[i][ACOMP]=255;
+ GLushort pixel = data[i];
+ rgba[i][RCOMP] = FX_PixelToR[pixel];
+ rgba[i][GCOMP] = FX_PixelToG[pixel];
+ rgba[i][BCOMP] = FX_PixelToB[pixel];
+ rgba[i][ACOMP] = 255;
}
-
}
/************************************************************************/
@@ -271,7 +359,7 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBAPixels(...)\n");
@@ -279,8 +367,8 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx,
for(i=0;i<n;i++)
if(mask[i])
- LFB_WRITE_SPAN_MESA(fxMesa->currentFB,x[i],bottom-y[i],
- /*GR_LFB_SRC_FMT_8888,*/1,/*1,*/0,(void *)rgba[i]);
+ LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i]+fxMesa->x_offset, bottom-y[i],
+ 1, 1, (void *)rgba[i]);
}
static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
@@ -289,7 +377,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
@@ -297,7 +385,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
for(i=0;i<n;i++)
if(mask[i])
- FX_grLfbWriteRegion(fxMesa->currentFB,x[i],bottom-y[i],
+ writeRegionClipped(fxMesa, fxMesa->currentFB,x[i]+fxMesa->x_offset,bottom-y[i],
GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color);
}
@@ -307,31 +395,25 @@ static void fxDDReadRGBAPixels(const GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
- GLint bottom=fxMesa->height-1;
- GLushort data;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n");
}
- for(i=0;i<n;i++)
+ for(i=0;i<n;i++) {
if(mask[i]) {
- grLfbReadRegion(fxMesa->currentFB,x[i],bottom-y[i],1,1,0,&data);
- #if FXMESA_USE_ARGB
- rgba[i][RCOMP]=(data & 0xF800) >> 8;
- rgba[i][GCOMP]=(data & 0x07E0) >> 3;
- rgba[i][BCOMP]=(data & 0x001F) >> 8;
- #else
- rgba[i][RCOMP]=(data & 0x001f) << 3;
- rgba[i][GCOMP]=(data & 0x07e0) >> 3;
- rgba[i][BCOMP]=(data & 0xf800) >> 8;
- #endif
- /* the alpha value should be read from the auxiliary buffer when required */
-
- rgba[i][ACOMP]=255;
+ GLushort pixel;
+ FX_grLfbReadRegion(fxMesa->currentFB,x[i],bottom-y[i],1,1,0,&pixel);
+ rgba[i][RCOMP] = FX_PixelToR[pixel];
+ rgba[i][GCOMP] = FX_PixelToG[pixel];
+ rgba[i][BCOMP] = FX_PixelToB[pixel];
+ rgba[i][ACOMP] = 255;
}
+ }
}
+
/************************************************************************/
/***** Depth functions *****/
/************************************************************************/
@@ -341,14 +423,15 @@ void fxDDReadDepthSpanFloat(GLcontext *ctx,
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
GLushort data[MAX_WIDTH];
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadDepthSpanFloat(...)\n");
}
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
+ x+=fxMesa->x_offset;
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
/*
convert the read values to float values [0.0 .. 1.0].
@@ -361,13 +444,14 @@ void fxDDReadDepthSpanInt(GLcontext *ctx,
GLuint n, GLint x, GLint y, GLdepth depth[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n");
}
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
+ x+=fxMesa->x_offset;
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
}
GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
@@ -380,13 +464,14 @@ GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
GLubyte *m=mask;
GLuint i;
GLuint passed=0;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDDepthTestSpanGeneric(...)\n");
}
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata);
+ x+=fxMesa->x_offset;
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata);
/* switch cases ordered from most frequent to less frequent */
switch (ctx->Depth.Func) {
@@ -578,7 +663,7 @@ GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
} /*switch*/
if(passed)
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata);
return passed;
}
@@ -590,7 +675,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLdepth zval;
GLuint i;
- GLint bottom=fxMesa->height-1;
+ GLint bottom=fxMesa->height+fxMesa->y_offset-1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDDepthTestPixelsGeneric(...)\n");
@@ -603,10 +688,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] < zval) {
/* pass */
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -617,7 +702,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] < zval) {
/* pass */
}
@@ -634,10 +719,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] <= zval) {
/* pass */
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -648,7 +733,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] <= zval) {
/* pass */
} else {
@@ -664,10 +749,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] >= zval) {
/* pass */
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -678,7 +763,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] >= zval) {
/* pass */
} else {
@@ -694,10 +779,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] > zval) {
/* pass */
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -708,7 +793,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] > zval) {
/* pass */
} else {
@@ -724,10 +809,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] != zval) {
/* pass */
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -738,7 +823,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] != zval) {
/* pass */
}
@@ -755,10 +840,10 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] == zval) {
/* pass */
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
} else {
/* fail */
mask[i] = 0;
@@ -769,7 +854,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Don't update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],1,1,0,&zval);
+ FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
if (z[i] == zval) {
/* pass */
} else {
@@ -785,7 +870,7 @@ void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
/* Update Z buffer */
for (i=0; i<n; i++) {
if (mask[i]) {
- FX_grLfbWriteRegion(GR_BUFFER_AUXBUFFER,x[i],bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
+ writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
}
}
} else {
diff --git a/xc/extras/Mesa/src/FX/fxddtex.c b/xc/extras/Mesa/src/FX/fxddtex.c
index 8890902a6..38dbf6f1a 100644
--- a/xc/extras/Mesa/src/FX/fxddtex.c
+++ b/xc/extras/Mesa/src/FX/fxddtex.c
@@ -1,27 +1,48 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxddtex.c - 3Dfx VooDoo Texture mapping functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Thank you for your contribution, David!
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
- * See the file fxapi.c for more informations about authors
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
*
+ * See fxapi.h for more revision/author details.
*/
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -30,6 +51,37 @@
#include "fxdrv.h"
+void fxPrintTextureData(tfxTexInfo *ti)
+{
+ fprintf(stderr, "Texture Data:\n");
+ if (ti->tObj) {
+ fprintf(stderr, "\tName: %d\n", ti->tObj->Name);
+ fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel);
+ fprintf(stderr, "\tSize: %d x %d\n",
+ ti->tObj->Image[ti->tObj->BaseLevel]->Width,
+ ti->tObj->Image[ti->tObj->BaseLevel]->Height);
+ } else
+ fprintf(stderr, "\tName: UNNAMED\n");
+ fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed);
+ fprintf(stderr, "\tTMU: %d\n", ti->whichTMU);
+ fprintf(stderr, "\t%s\n", (ti->isInTM)?"In TMU":"Not in TMU");
+ if (ti->tm[0])
+ fprintf(stderr, "\tMem0: %x-%x\n", ti->tm[0]->startAddr,
+ ti->tm[0]->endAddr);
+ if (ti->tm[1])
+ fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr,
+ ti->tm[1]->endAddr);
+ fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel);
+ fprintf(stderr, "\tFilters: min %d min %d\n", ti->minFilt, ti->maxFilt);
+ fprintf(stderr, "\tClamps: s %d t %d\n", ti->sClamp, ti->tClamp);
+ fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale);
+ fprintf(stderr, "\tInt Scales: s %d t %d\n",
+ ti->int_sScale/0x800000, ti->int_tScale/0x800000);
+ fprintf(stderr, "\t%s\n", (ti->fixedPalette)?"Fixed palette":"Non fixed palette");
+ fprintf(stderr, "\t%s\n", (ti->validated)?"Validated":"Not validated");
+}
+
+
/************************************************************************/
/*************************** Texture Mapping ****************************/
/************************************************************************/
@@ -41,7 +93,7 @@ void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj)
fxTMMoveOutTM(fxMesa,tObj); /* TO DO: SLOW but easy to write */
- ti=(tfxTexInfo *)tObj->DriverData;
+ ti=fxTMGetTexInfo(tObj);
ti->validated=GL_FALSE;
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
@@ -59,12 +111,12 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
}
ti->validated=GL_FALSE;
- ti->tmi.isInTM=GL_FALSE;
+ ti->isInTM=GL_FALSE;
- ti->tmi.whichTMU=FX_TMU_NONE;
+ ti->whichTMU=FX_TMU_NONE;
- ti->tmi.tm[FX_TMU0]=NULL;
- ti->tmi.tm[FX_TMU1]=NULL;
+ ti->tm[FX_TMU0]=NULL;
+ ti->tm[FX_TMU1]=NULL;
ti->minFilt=GR_TEXTUREFILTER_POINT_SAMPLED;
ti->maxFilt=GR_TEXTUREFILTER_BILINEAR;
@@ -81,8 +133,8 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
}
for(i=0;i<MAX_TEXTURE_LEVELS;i++) {
- ti->tmi.mipmapLevel[i].used=GL_FALSE;
- ti->tmi.mipmapLevel[i].data=NULL;
+ ti->mipmapLevel[i].used=GL_FALSE;
+ ti->mipmapLevel[i].data=NULL;
}
return ti;
@@ -100,13 +152,14 @@ void fxDDTexBind(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj)
if(target!=GL_TEXTURE_2D)
return;
- if(!tObj->DriverData)
+ if (!tObj->DriverData) {
tObj->DriverData=fxAllocTexObjData(fxMesa);
+ }
- ti=(tfxTexInfo *)tObj->DriverData;
+ ti=fxTMGetTexInfo(tObj);
fxMesa->texBindNumber++;
- ti->tmi.lastTimeUsed=fxMesa->texBindNumber;
+ ti->lastTimeUsed=fxMesa->texBindNumber;
fxMesa->new_state|=FX_NEW_TEXTURING;
ctx->Driver.RenderStart = fxSetupFXUnits;
@@ -141,10 +194,10 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
if(target!=GL_TEXTURE_2D)
return;
- if(!tObj->DriverData)
+ if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
- ti=(tfxTexInfo *)tObj->DriverData;
+ ti=fxTMGetTexInfo(tObj);
switch(pname) {
@@ -219,7 +272,6 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
ti->sClamp=GR_TEXTURECLAMP_WRAP;
break;
default:
- fprintf(stderr, "BAD CLAMP\n");
break;
}
fxMesa->new_state|=FX_NEW_TEXTURING;
@@ -266,7 +318,7 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti);
@@ -309,10 +361,10 @@ void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj)
return;
}
- if(!tObj->DriverData)
+ if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
- ti=(tfxTexInfo *)tObj->DriverData;
+ ti=fxTMGetTexInfo(tObj);
for(i=0;i<tObj->PaletteSize;i++) {
r=tObj->Palette[i*4];
@@ -374,13 +426,10 @@ void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state)
if((ctx->Texture.Unit[0].Current==ctx->Texture.Unit[0].CurrentD[2]) &&
(ctx->Texture.Unit[0].Current!=NULL)) {
struct gl_texture_object *tObj=ctx->Texture.Unit[0].Current;
- tfxTexInfo *ti;
- if(!tObj->DriverData)
+ if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
- ti=(tfxTexInfo *)tObj->DriverData;
-
fxTexInvalidate(ctx,tObj);
}
}
@@ -1014,21 +1063,23 @@ void fxDDTexImg(GLcontext *ctx, GLenum target,
tfxTexInfo *ti;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
- fprintf(stderr,"fxmesa: (%d) fxDDTexImg(...,%d,%x,%d,%d...)\n",tObj->Name,
- target,internalFormat,image->Width,image->Height);
+ fprintf(stderr,
+ "fxmesa: (%d) fxDDTexImg(...,level=%d,target=%d,format=%x,width=%d,height=%d...)\n",
+ tObj->Name, level, target, internalFormat, image->Width,
+ image->Height);
}
if(target!=GL_TEXTURE_2D)
return;
- if(!tObj->DriverData)
+ if (!tObj->DriverData)
tObj->DriverData=fxAllocTexObjData(fxMesa);
- ti=(tfxTexInfo *)tObj->DriverData;
+ ti=fxTMGetTexInfo(tObj);
if(fxIsTexSupported(target,internalFormat,image)) {
GrTextureFormat_t gldformat;
- tfxMipMapLevel *mml=&ti->tmi.mipmapLevel[level];
+ tfxMipMapLevel *mml=&ti->mipmapLevel[level];
fxTexGetFormat(internalFormat,&gldformat,NULL);
@@ -1039,7 +1090,7 @@ void fxDDTexImg(GLcontext *ctx, GLenum target,
fxTexBuildImageMap(image,internalFormat,&(mml->data),
&(mml->translated));
- if(ti->validated && ti->tmi.isInTM)
+ if(ti->validated && ti->isInTM)
fxTMReloadMipMapLevel(fxMesa,tObj,level);
else
fxTexInvalidate(ctx,tObj);
@@ -1239,18 +1290,20 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target,
tfxMipMapLevel *mml;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
- fprintf(stderr,"fxmesa: (%d) fxDDTexSubImg(...,%d,%x,%d,%d...)\n",tObj->Name,
- target,internalFormat,image->Width,image->Height);
+ fprintf(stderr,
+ "fxmesa: (%d) fxDDTexSubImg(level=%d,target=%d,format=%x,width=%d,height=%d)\n",
+ tObj->Name, level, target, internalFormat, image->Width,
+ image->Height);
}
if(target!=GL_TEXTURE_2D)
return;
- if(!tObj->DriverData)
+ if (!tObj->DriverData)
return;
- ti=(tfxTexInfo *)tObj->DriverData;
- mml=&ti->tmi.mipmapLevel[level];
+ ti=fxTMGetTexInfo(tObj);
+ mml=&ti->mipmapLevel[level];
fxTexGetFormat(internalFormat,&gldformat,NULL);
@@ -1278,7 +1331,7 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target,
fxTexBuildSubImageMap(image,internalFormat,xoffset,yoffset,
width,height,mml->data);
- if(ti->validated && ti->tmi.isInTM)
+ if(ti->validated && ti->isInTM)
fxTMReloadSubMipMapLevel(fxMesa,tObj,level,yoffset,height);
else
fxTexInvalidate(ctx,tObj);
diff --git a/xc/extras/Mesa/src/FX/fxdrv.h b/xc/extras/Mesa/src/FX/fxdrv.h
index aeb56e9a5..8cef3340b 100644
--- a/xc/extras/Mesa/src/FX/fxdrv.h
+++ b/xc/extras/Mesa/src/FX/fxdrv.h
@@ -1,27 +1,48 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxdrv.h - 3Dfx VooDoo driver types
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Thank you for your contribution, David!
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
- * See the file fxapi.c for more informations about authors
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
*
+ * See fxapi.h for more revision/author details.
*/
+
#ifndef FXDRV_H
#define FXDRV_H
@@ -54,14 +75,18 @@
#include "clip.h"
#include "vbrender.h"
+#ifdef XF86DRI
+typedef struct tfxMesaContext *fxMesaContext;
+#else
#include "GL/fxmesa.h"
+#endif
#include "fxglidew.h"
/* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of WINGDIAPI/APIENTRY/CALLBACK, */
/* these are defined in mesa gl/gl.h - tjump@spgs.com */
-#if 0
+#if defined(MESA_DEBUG) && 0
extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
#define grDrawTriangle fx_sanity_triangle
#endif
@@ -140,17 +165,17 @@ typedef struct {
#endif
#endif
-#define FX_VB_COLOR(fxm, color) \
-do { \
- if (sizeof(GLint) == 4*sizeof(GLubyte)) { \
- if (fxm->constColor != *(GLuint*)color) { \
- fxm->constColor = *(GLuint*)color; \
- grConstantColorValue(FXCOLOR4(color)); \
- } \
- } else { \
- grConstantColorValue(FXCOLOR4(color)); \
- } \
-} while (0)
+#define FX_VB_COLOR(fxm, color) \
+ do { \
+ if (sizeof(GLint) == 4*sizeof(GLubyte)) { \
+ if (fxm->constColor != *(GLuint*)color) { \
+ fxm->constColor = *(GLuint*)color; \
+ FX_grConstantColorValue(FXCOLOR4(color)); \
+ } \
+ } else { \
+ FX_grConstantColorValue(FXCOLOR4(color)); \
+ } \
+ } while (0)
#define GOURAUD(x) { \
GLubyte *col = VB->ColorPtr->data[(x)]; \
@@ -237,16 +262,13 @@ do { \
typedef void (*tfxRenderVBFunc)(GLcontext *);
-typedef struct tfxTMFreeListNode {
- struct tfxTMFreeListNode *next;
- FxU32 startAddress, endAddress;
-} tfxTMFreeNode;
-
-typedef struct tfxTMAllocListNode {
- struct tfxTMAllocListNode *next;
- FxU32 startAddress, endAddress;
- struct gl_texture_object *tObj;
-} tfxTMAllocNode;
+/*
+ Memory range from startAddr to endAddr-1
+*/
+typedef struct MemRange_t {
+ struct MemRange_t *next;
+ FxU32 startAddr, endAddr;
+} MemRange;
typedef struct {
GLsizei width, height;
@@ -256,19 +278,17 @@ typedef struct {
GLboolean translated, used;
} tfxMipMapLevel;
-typedef struct {
- GLuint lastTimeUsed;
+typedef struct tfxTexInfo_t {
+ struct tfxTexInfo *next;
+ struct gl_texture_object *tObj;
+ GLuint lastTimeUsed;
FxU32 whichTMU;
-
- tfxTMAllocNode *tm[FX_NUM_TMU];
+ GLboolean isInTM;
tfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS];
- GLboolean isInTM;
-} tfxTMInfo;
-typedef struct {
- tfxTMInfo tmi;
+ MemRange *tm[FX_NUM_TMU];
GLint minLevel, maxLevel;
GLint baseLevelInternalFormat;
@@ -384,14 +404,27 @@ struct tfxMesaVertexBuffer {
#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
-#define FX_TEXTURE_DATA(t) ((tfxTexInfo *) ((t)->Current->DriverData))
+#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current)
#if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING)
#include "tdfx_init.h"
#else
#define DRI_FX_CONTEXT
+#define BEGIN_BOARD_LOCK()
+#define END_BOARD_LOCK()
+#define BEGIN_CLIP_LOOP()
+#define END_CLIP_LOOP()
#endif
+
+/* These lookup table are used to extract RGB values in [0,255] from
+ * 16-bit pixel values.
+ */
+extern GLubyte FX_PixelToR[0x10000];
+extern GLubyte FX_PixelToG[0x10000];
+extern GLubyte FX_PixelToB[0x10000];
+
+
struct tfxMesaContext {
GuTexPalette glbPalette;
@@ -412,7 +445,6 @@ struct tfxMesaContext {
tfxUnitsState unitsState;
tfxUnitsState restoreUnitsState; /* saved during multipass */
-
GLuint tmu_source[FX_NUM_TMU];
GLuint tex_dest[MAX_TEXTURE_UNITS];
GLuint setupindex;
@@ -437,9 +469,10 @@ struct tfxMesaContext {
GLuint texBindNumber;
GLint tmuSrc;
GLuint lastUnitsMode;
+ GLuint texStart[FX_NUM_TMU];
GLuint freeTexMem[FX_NUM_TMU];
- tfxTMFreeNode *tmFree[FX_NUM_TMU];
- tfxTMAllocNode *tmAlloc[FX_NUM_TMU];
+ MemRange *tmPool;
+ MemRange *tmFree[FX_NUM_TMU];
GLenum fogTableMode;
GLfloat fogDensity;
@@ -477,10 +510,19 @@ struct tfxMesaContext {
FX_GrContext_t glideContext;
- GLfloat wscale;
+ int x_offset;
+ int y_offset;
+ int y_delta;
+ int screen_width;
+ int screen_height;
+ int initDone;
+ int clipMinX;
+ int clipMaxX;
+ int clipMinY;
+ int clipMaxY;
+ int needClip;
DRI_FX_CONTEXT
-
};
typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
@@ -522,6 +564,7 @@ extern void fxSetupDDSpanPointers(GLcontext *);
extern void fxDDBufferSize(GLcontext *, GLuint *, GLuint *);
+extern void fxPrintTextureData(tfxTexInfo *ti);
extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *);
extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *,
GLint, GLint, const struct gl_texture_image *);
@@ -571,6 +614,7 @@ extern void fxDDRenderVBIndirectDirect( struct vertex_buffer *VB );
extern void fxDDInitExtensions( GLcontext *ctx );
+#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
extern void fxTMInit(fxMesaContext ctx);
extern void fxTMClose(fxMesaContext ctx);
extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
@@ -622,4 +666,14 @@ extern void fxDDDoRenderVB( struct vertex_buffer *VB );
extern int fxDDInitFxMesaContext( fxMesaContext fxMesa );
+
+extern void fxSetScissorValues(GLcontext *ctx);
+extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
+ struct gl_texture_object *tObj,
+ GLint where);
+extern void fxSetupTexture_NoLock(GLcontext *ctx);
+extern void fxSetupTexture(GLcontext *ctx);
+
+extern void fxInitPixelTables(GLboolean bgrOrder);
+
#endif
diff --git a/xc/extras/Mesa/src/FX/fxfastpath.c b/xc/extras/Mesa/src/FX/fxfastpath.c
index ec4261508..08da27835 100644
--- a/xc/extras/Mesa/src/FX/fxfastpath.c
+++ b/xc/extras/Mesa/src/FX/fxfastpath.c
@@ -1,3 +1,47 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
@@ -31,13 +75,13 @@ if (mask & PLANE) { \
GLuint *outdata = inlist[in ^= 1]; \
GLuint nr = n; \
GLfloat *J = verts[indata[nr-1]].f; \
- GLfloat dpJ = (sgn J[v]) + J[3]; \
+ GLfloat dpJ = (sgn J[v]) + J[CLIP_WCOORD]; \
\
inlist[0] = vlist1; \
for (i = n = 0 ; i < nr ; i++) { \
GLuint elt_i = indata[i]; \
GLfloat *I = verts[elt_i].f; \
- GLfloat dpI = (sgn I[v]) + I[3]; \
+ GLfloat dpI = (sgn I[v]) + I[CLIP_WCOORD]; \
\
if (DIFFERENT_SIGNS(dpI, dpJ)) { \
GLfloat *O = verts[next_vert].f; \
@@ -131,9 +175,7 @@ do { \
} \
} while (0)
-
-
-#if defined(FX_V2)
+#if defined(FX_V2) || defined(DRIVERTS)
#define VARS_XYZ \
GLfloat vsx = mat[MAT_SX]; \
@@ -307,9 +349,12 @@ void fxDDFastPath( struct vertex_buffer *VB )
struct fx_fast_tab *tab = &fxFastTab[fxMesa->setupindex & 0x7];
GLuint do_clip = 1;
struct tfxMesaVertexBuffer *fxVB = FX_DRIVER_DATA(VB);
+#ifdef DRIVERTS
+ GLfloat tx, ty;
+#endif
- fxVertex *first, *last;
- const GLfloat *mat = ctx->Viewport.WindowMap.m;
+ fxVertex *first;
+ GLfloat *mat = ctx->Viewport.WindowMap.m;
gl_prepare_arrays_cva( VB ); /* still need this */
@@ -322,6 +367,13 @@ void fxDDFastPath( struct vertex_buffer *VB )
first = FX_DRIVER_DATA(VB)->verts;
+#ifdef DRIVERTS
+ tx=mat[MAT_TX];
+ ty=mat[MAT_TY];
+ mat[MAT_TX]=tx+fxMesa->x_offset;
+ mat[MAT_TY]=ty+fxMesa->y_delta;
+#endif
+
if (VB->ClipOrMask) {
if (!VB->ClipAndMask) {
GLubyte tmp = VB->ClipOrMask;
@@ -348,9 +400,15 @@ void fxDDFastPath( struct vertex_buffer *VB )
fxDDRenderElementsDirect( VB ); /* render using orig list */
}
+#ifdef DRIVERTS
+ mat[MAT_TX]=tx;
+ mat[MAT_TY]=ty;
+#endif
+
/* This indicates that there is no cached data to reuse.
*/
VB->pipeline->data_valid = 0;
+ VB->pipeline->pipeline_valid = 0;
}
diff --git a/xc/extras/Mesa/src/FX/fxfasttmp.h b/xc/extras/Mesa/src/FX/fxfasttmp.h
index cdc1602e1..c0fedd717 100644
--- a/xc/extras/Mesa/src/FX/fxfasttmp.h
+++ b/xc/extras/Mesa/src/FX/fxfasttmp.h
@@ -1,3 +1,47 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
/* Build clip space vertices from object space data.
*/
@@ -109,10 +153,7 @@ static void TAG(fx_project_vertices)( GLfloat *first,
}
#else
if (TYPE & SETUP_RGBA) {
- f[RCOORD] = f[CLIP_R];
- f[GCOORD] = f[CLIP_G];
- f[BCOORD] = f[CLIP_B];
- f[ACOORD] = f[CLIP_A];
+ f[RCOORD]=f[CLIP_R];
}
#endif
if (TYPE & SETUP_TMU1) {
@@ -155,10 +196,7 @@ static void TAG(fx_project_clipped_vertices)( GLfloat *first,
}
#else
if (TYPE & SETUP_RGBA) {
- f[RCOORD] = f[CLIP_R];
- f[GCOORD] = f[CLIP_G];
- f[BCOORD] = f[CLIP_B];
- f[ACOORD] = f[CLIP_A];
+ f[RCOORD]=f[CLIP_R];
}
#endif
diff --git a/xc/extras/Mesa/src/FX/fxglidew.c b/xc/extras/Mesa/src/FX/fxglidew.c
index 0613fd316..900e84076 100644
--- a/xc/extras/Mesa/src/FX/fxglidew.c
+++ b/xc/extras/Mesa/src/FX/fxglidew.c
@@ -1,28 +1,47 @@
-/* $Id: fxglidew.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* Mesa 3-D graphics library
* Version: 3.1
- *
+ *
* Copyright (C) 1999 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
@@ -36,8 +55,7 @@
#include <stdlib.h>
#include <string.h>
-
-FxI32 FX_grGetInteger(FxU32 pname)
+static FxI32 FX_grGetInteger_NoLock(FxU32 pname)
{
#if !defined(FX_GLIDE3)
switch (pname)
@@ -49,7 +67,7 @@ FxI32 FX_grGetInteger(FxU32 pname)
case FX_LFB_PIXEL_PIPE:
return FXFALSE;
case FX_PENDING_BUFFERSWAPS:
- return grBufferNumPending();
+ return grBufferNumPending();
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
@@ -74,12 +92,74 @@ FxI32 FX_grGetInteger(FxU32 pname)
}
return -1;
}
-
+
grGet(grname,4,&result);
return result;
#endif
}
+FxI32 FX_grGetInteger(FxU32 pname)
+{
+ int result;
+
+ BEGIN_BOARD_LOCK();
+ result=FX_grGetInteger_NoLock(pname);
+ END_BOARD_LOCK();
+ return result;
+}
+
+
+FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
+ GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
+ FxBool pixelPipeline, GrLfbInfo_t *info ) {
+ FxBool result;
+
+ BEGIN_BOARD_LOCK();
+ result=grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
+ END_BOARD_LOCK();
+ return result;
+}
+
+FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info) {
+ FxU32 result;
+
+ BEGIN_BOARD_LOCK();
+ result=grTexTextureMemRequired(evenOdd, info);
+ END_BOARD_LOCK();
+ return result;
+}
+
+FxU32 FX_grTexMinAddress(GrChipID_t tmu) {
+ FxU32 result;
+
+ BEGIN_BOARD_LOCK();
+ result=grTexMinAddress(tmu);
+ END_BOARD_LOCK();
+ return result;
+}
+
+extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) {
+ FxU32 result;
+
+ BEGIN_BOARD_LOCK();
+ result=grTexMaxAddress(tmu);
+ END_BOARD_LOCK();
+ return result;
+}
+
+FxBool FX_grSstControl(FxU32 code)
+{
+#if defined(FX_GLIDE3)
+ (void) code;
+ return 1; /* OK? */
+#else
+ FxU32 result;
+ BEGIN_BOARD_LOCK();
+ result = grSstControl(code);
+ END_BOARD_LOCK();
+ return result;
+#endif
+}
#if defined(FX_GLIDE3)
@@ -90,39 +170,33 @@ void FX_grGammaCorrectionValue(float val)
/* ToDo */
}
-void FX_grSstControl(int par)
-{
- (void)par;
- /* ToDo */
-}
int FX_getFogTableSize(void)
{
int result;
+ BEGIN_BOARD_LOCK();
grGet(GR_FOG_TABLE_ENTRIES,sizeof(int),(void*)&result);
+ END_BOARD_LOCK();
return result;
}
int FX_getGrStateSize(void)
{
int result;
+ BEGIN_BOARD_LOCK();
grGet(GR_GLIDE_STATE_SIZE,sizeof(int),(void*)&result);
-
+ END_BOARD_LOCK();
+
return result;
}
-int FX_grBufferNumPending()
-{
- int result;
- grGet(GR_PENDING_BUFFERSWAPS,sizeof(int),(void*)&result);
-
- return result;
-}
int FX_grSstScreenWidth()
{
FxI32 result[4];
-
+
+ BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
+ END_BOARD_LOCK();
return result[2];
}
@@ -130,15 +204,19 @@ int FX_grSstScreenWidth()
int FX_grSstScreenHeight()
{
FxI32 result[4];
-
+
+ BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
+ END_BOARD_LOCK();
return result[3];
}
void FX_grGlideGetVersion(char *buf)
{
- strcpy(buf,grGetString(GR_VERSION));
+ BEGIN_BOARD_LOCK();
+ strcpy(buf,grGetString(GR_VERSION));
+ END_BOARD_LOCK();
}
void FX_grSstPerfStats(GrSstPerfStats_t *st)
@@ -154,74 +232,91 @@ void FX_grSstPerfStats(GrSstPerfStats_t *st)
void FX_grAADrawLine(GrVertex *a,GrVertex *b)
{
/* ToDo */
+ BEGIN_CLIP_LOOP();
grDrawLine(a,b);
+ END_CLIP_LOOP();
}
+
void FX_grAADrawPoint(GrVertex *a)
{
+ BEGIN_CLIP_LOOP();
grDrawPoint(a);
+ END_CLIP_LOOP();
}
#if FX_USE_PARGB
void FX_setupGrVertexLayout(void)
{
- grReset(GR_VERTEX_PARAMETER);
+ BEGIN_BOARD_LOCK();
+ grReset(GR_VERTEX_PARAMETER);
- grCoordinateSpace(GR_WINDOW_COORDS);
- grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ grCoordinateSpace(GR_WINDOW_COORDS);
+ grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ END_BOARD_LOCK();
}
#else /* FX_USE_PARGB */
void FX_setupGrVertexLayout(void)
{
- grReset(GR_VERTEX_PARAMETER);
+ BEGIN_BOARD_LOCK();
+ grReset(GR_VERTEX_PARAMETER);
- grCoordinateSpace(GR_WINDOW_COORDS);
- grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
- /* grVertexLayout(GR_PARAM_Z, GR_VERTEX_Z_OFFSET << 2, GR_PARAM_ENABLE); */
- grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ grCoordinateSpace(GR_WINDOW_COORDS);
+ grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ END_BOARD_LOCK();
}
#endif
-void FX_grHints(GrHint_t hintType, FxU32 hintMask)
+void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
{
- switch(hintType) {
- case GR_HINT_STWHINT:
- {
- if (hintMask & GR_STWHINT_W_DIFF_TMU0)
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
-
- if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
- grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ switch(hintType) {
+ case GR_HINT_STWHINT:
+ {
+ if (hintMask & GR_STWHINT_W_DIFF_TMU0)
+ grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ else
+ grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+
+ if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
+ grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
+ else
+ grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- if (hintMask & GR_STWHINT_W_DIFF_TMU1)
- grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
-
- }
- }
+ if (hintMask & GR_STWHINT_W_DIFF_TMU1)
+ grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
+ else
+ grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+
+ }
+ }
+}
+
+void FX_grHints(GrHint_t hintType, FxU32 hintMask) {
+ BEGIN_BOARD_LOCK();
+ FX_grHints_NoLock(hintType, hintMask);
+ END_BOARD_LOCK();
}
+
int FX_grSstQueryHardware(GrHwConfiguration *config)
{
int i,j;
int numFB;
+
+ BEGIN_BOARD_LOCK();
grGet(GR_NUM_BOARDS,4,(void*)&(config->num_sst));
if (config->num_sst == 0)
return 0;
@@ -246,9 +341,74 @@ int FX_grSstQueryHardware(GrHwConfiguration *config)
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam /= 1024*1024;
}
}
+ END_BOARD_LOCK();
return 1;
}
+#else
+
+int FX_grSstScreenWidth()
+{
+ int i;
+ BEGIN_BOARD_LOCK();
+ i = grSstScreenWidth();
+ END_BOARD_LOCK();
+ return i;
+}
+
+int FX_grSstScreenHeight()
+{
+ int i;
+ BEGIN_BOARD_LOCK();
+ i = grSstScreenHeight();
+ END_BOARD_LOCK();
+ return i;
+}
+
+int FX_grSstQueryHardware(GrHwConfiguration *c)
+{
+ int i;
+ BEGIN_BOARD_LOCK();
+ i = grSstQueryHardware(c);
+ END_BOARD_LOCK();
+ return i;
+}
+
+FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
+ GrScreenResolution_t screen_resolution,
+ GrScreenRefresh_t refresh_rate,
+ GrColorFormat_t color_format,
+ GrOriginLocation_t origin_location,
+ int nColBuffers,
+ int nAuxBuffers)
+{
+ FX_GrContext_t i;
+ BEGIN_BOARD_LOCK();
+ i = grSstWinOpen( hWnd,
+ screen_resolution,
+ refresh_rate,
+ color_format,
+ origin_location,
+ nColBuffers,
+ nAuxBuffers );
+
+ fprintf(stderr,
+ "grSstWinOpen( win %d res %d ref %d fmt %d\n"
+ " org %d ncol %d naux %d )\n"
+ " ==> %d\n",
+ hWnd,
+ screen_resolution,
+ refresh_rate,
+ color_format,
+ origin_location,
+ nColBuffers,
+ nAuxBuffers,
+ i);
+ END_BOARD_LOCK();
+ return i;
+}
+
+
#endif
#else
diff --git a/xc/extras/Mesa/src/FX/fxglidew.h b/xc/extras/Mesa/src/FX/fxglidew.h
index c02045f45..c3e8057e4 100644
--- a/xc/extras/Mesa/src/FX/fxglidew.h
+++ b/xc/extras/Mesa/src/FX/fxglidew.h
@@ -1,26 +1,48 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
/*
* Mesa 3-D graphics library
* Version: 3.1
- *
+ *
* Copyright (C) 1999 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+
#ifndef __FX_GLIDE_WARPER__
#define __FX_GLIDE_WARPER__
@@ -201,23 +223,23 @@ typedef struct
typedef struct
{
- float x, y; /* X and Y in screen space */
- float ooz; /* 65535/Z (used for Z-buffering) */
- float oow; /* 1/W (used for W-buffering, texturing) */
- float r, g, b, a; /* R, G, B, A [0..255.0] */
- float z; /* Z is ignored */
+ float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
+ float r, g, b; /* R, G, B, ([0..255.0]) */
+ float ooz; /* 65535/Z (used for Z-buffering) */
+ float a; /* Alpha [0..255.0] */
+ float oow; /* 1/W (used for W-buffering, texturing) */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
} GrVertex;
#define GR_VERTEX_X_OFFSET 0
#define GR_VERTEX_Y_OFFSET 1
-#define GR_VERTEX_OOZ_OFFSET 2
-#define GR_VERTEX_OOW_OFFSET 3
-#define GR_VERTEX_R_OFFSET 4
-#define GR_VERTEX_G_OFFSET 5
-#define GR_VERTEX_B_OFFSET 6
+#define GR_VERTEX_Z_OFFSET 2
+#define GR_VERTEX_R_OFFSET 3
+#define GR_VERTEX_G_OFFSET 4
+#define GR_VERTEX_B_OFFSET 5
+#define GR_VERTEX_OOZ_OFFSET 6
#define GR_VERTEX_A_OFFSET 7
-#define GR_VERTEX_Z_OFFSET 8
+#define GR_VERTEX_OOW_OFFSET 8
#define GR_VERTEX_SOW_TMU0_OFFSET 9
#define GR_VERTEX_TOW_TMU0_OFFSET 10
#define GR_VERTEX_OOW_TMU0_OFFSET 11
@@ -233,29 +255,89 @@ typedef struct
* Glide2 functions for Glide3
*/
#if defined(FX_GLIDE3)
-#define FX_grTexDownloadTable(TMU,type,data) grTexDownloadTable(type,data)
+#define FX_grTexDownloadTable(TMU,type,data) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexDownloadTable(type,data); \
+ END_BOARD_LOCK(); \
+ } while (0);
+#define FX_grTexDownloadTable_NoLock(TMU,type,data) \
+ grTexDownloadTable(type, data)
#else
-#define FX_grTexDownloadTable(TMU,type,data) grTexDownloadTable(TMU,type,data)
+#define FX_grTexDownloadTable(TMU,type,data) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexDownloadTable(TMU,type,data); \
+ END_BOARD_LOCK(); \
+ } while (0);
+#define FX_grTexDownloadTable_NoLock grTexDownloadTable
#endif
/*
* Flush
*/
#if defined(FX_GLIDE3)
-#define FX_grFlush grFlush
+#define FX_grFlush() \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grFlush(); \
+ END_BOARD_LOCK(); \
+ } while (0)
#else
-#define FX_grFlush grSstIdle
+#define FX_grFlush() \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grSstIdle(); \
+ END_BOARD_LOCK(); \
+ } while (0)
#endif
+
+#define FX_grFinish() \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grFinish(); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
/*
* Write region: ToDo possible exploit the PixelPipe parameter.
*/
#if defined(FX_GLIDE3)
-#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
- grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data)
+#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
+ END_BOARD_LOCK(); \
+ } while(0)
#else
-#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
- grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data)
+#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data); \
+ END_BOARD_LOCK(); \
+ } while (0)
#endif
+
+/*
+ * Read region
+ */
+#define FX_grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
+ END_BOARD_LOCK(); \
+ } while (0);
+
+/*
+ * Draw triangle
+ */
+#define FX_grDrawTriangle(a,b,c) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grDrawTriangle(a,b,c); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
/*
* For Lod/LodLog2 conversion.
*/
@@ -288,12 +370,14 @@ typedef struct
#else
#define FX_largeLodValue(info) ((int)(info).largeLod)
#endif
+#define FX_largeLodValue_NoLock FX_largeLodValue
#if defined(FX_GLIDE3)
#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
#else
#define FX_smallLodValue(info) ((int)(info).smallLod)
#endif
+#define FX_smallLodValue_NoLock FX_smallLodValue
#if defined(FX_GLIDE3)
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
@@ -304,13 +388,9 @@ typedef struct
/*
* ScreenWidth/Height stuff.
*/
-#if defined(FX_GLIDE3)
- extern int FX_grSstScreenWidth();
- extern int FX_grSstScreenHeight();
-#else
- #define FX_grSstScreenWidth() grSstScreenWidth()
- #define FX_grSstScreenHeight() grSstScreenHeight()
-#endif
+ extern int FX_grSstScreenWidth(void);
+ extern int FX_grSstScreenHeight(void);
+
/*
@@ -319,7 +399,12 @@ typedef struct
#if defined(FX_GLIDE3)
extern void FX_grGlideGetVersion(char *buf);
#else
- #define FX_grGlideGetVersion grGlideGetVersion
+ #define FX_grGlideGetVersion(b) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grGlideGetVersion(b); \
+ END_BOARD_LOCK(); \
+ } while (0)
#endif
/*
* Performance statistics
@@ -327,25 +412,33 @@ typedef struct
#if defined(FX_GLIDE3)
extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
#else
- #define FX_grSstPerfStats grSstPerfStats
+ #define FX_grSstPerfStats(s) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grSstPerfStats(s); \
+ END_BOARD_LOCK(); \
+ } while (0)
#endif
/*
* Hardware Query
*/
-#if defined(FX_GLIDE3)
extern int FX_grSstQueryHardware(GrHwConfiguration *config);
-#else
- #define FX_grSstQueryHardware grSstQueryHardware
-#endif
/*
* GrHints
*/
#if defined(FX_GLIDE3)
+ extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
extern void FX_grHints(GrHint_t hintType, FxU32 hintMask);
#else
- #define FX_grHints grHints
+ #define FX_grHints(t,m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grHints(t, m); \
+ END_BOARD_LOCK(); \
+ } while(0)
+ #define FX_grHints_NoLock grHints
#endif
/*
* Antialiashed line+point drawing.
@@ -353,13 +446,23 @@ typedef struct
#if defined(FX_GLIDE3)
extern void FX_grAADrawLine(GrVertex *a,GrVertex *b);
#else
- #define FX_grAADrawLine grAADrawLine
+ #define FX_grAADrawLine(a,b) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grAADrawLine(a,b); \
+ END_CLIP_LOOP(); \
+ } while (0)
#endif
#if defined(FX_GLIDE3)
extern void FX_grAADrawPoint(GrVertex *a);
#else
- #define FX_grAADrawPoint grAADrawPoint
+ #define FX_grAADrawPoint(a) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grAADrawPoint(a); \
+ END_CLIP_LOOP(); \
+ } while (0)
#endif
/*
@@ -373,31 +476,345 @@ typedef struct
/*
* grSstControl stuff
*/
-#if defined(FX_GLIDE3)
- extern void FX_grSstControl(int par);
-#else
- #define FX_grSstControl grSstControl
-#endif
+extern FxBool FX_grSstControl(FxU32 code);
+
/*
* grGammaCorrectionValue
*/
#if defined(FX_GLIDE3)
extern void FX_grGammaCorrectionValue(float val);
#else
- #define FX_grGammaCorrectionValue grGammaCorrectionValue
+ #define FX_grGammaCorrectionValue(v) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grGammaCorrectionValue(v) \
+ END_BOARD_LOCK(); \
+ } while (0)
#endif
-/*
- * WinOpen/Close.
- */
#if defined(FX_GLIDE3)
- #define FX_grSstWinOpen(hWnd,screen_resolution,refresh_rate,color_format,origin_location,nColBuffers,nAuxBuffers) \
- grSstWinOpen(-1,screen_resolution,refresh_rate,color_format,origin_location,nColBuffers,nAuxBuffers)
- #define FX_grSstWinClose grSstWinClose
+#define FX_grSstWinClose(w) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grSstWinClose(w); \
+ END_BOARD_LOCK(); \
+ } while (0)
#else
- #define FX_grSstWinOpen grSstWinOpen
- #define FX_grSstWinClose(win) grSstWinClose()
+#define FX_grSstWinClose(w) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grSstWinClose(); \
+ END_BOARD_LOCK(); \
+ } while (0)
#endif
+extern FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
+ GrScreenResolution_t screen_resolution,
+ GrScreenRefresh_t refresh_rate,
+ GrColorFormat_t color_format,
+ GrOriginLocation_t origin_location,
+ int nColBuffers,
+ int nAuxBuffers);
+
+
+#define FX_grDrawLine(v1, v2) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grDrawLine(v1, v2); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
+#define FX_grDrawPoint(p) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grDrawPoint(p); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
+#define FX_grDitherMode(m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grDitherMode(m); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grRenderBuffer(b) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grRenderBuffer(b); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grBufferClear(c, a, d) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grBufferClear(c, a, d); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
+#define FX_grDepthMask(m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grDepthMask(m); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grColorMask(c, a) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grColorMask(c, a); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
+ GrLfbWriteMode_t writeMode,
+ GrOriginLocation_t origin, FxBool pixelPipeline,
+ GrLfbInfo_t *info );
+
+#define FX_grLfbUnlock(t, b) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grLfbUnlock(t, b); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grConstantColorValue(v) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grConstantColorValue(v); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grConstantColorValue_NoLock grConstantColorValue
+
+#define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grAADrawTriangle(a, b, c, ab, bc, ca); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
+#define FX_grAlphaBlendFunction(rs, rd, as, ad) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grAlphaBlendFunction(rs, rd, as, ad); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grAlphaCombine(func, fact, loc, oth, inv) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grAlphaCombine(func, fact, loc, oth, inv); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grAlphaCombine_NoLock grAlphaCombine
+
+#define FX_grAlphaTestFunction(f) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grAlphaTestFunction(f); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grAlphaTestReferenceValue(v) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grAlphaTestReferenceValue(v); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grClipWindow(minx, miny, maxx, maxy) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grClipWindow(minx, miny, maxx, maxy); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grClipWindow_NoLock grClipWindow
+
+#define FX_grColorCombine(func, fact, loc, oth, inv) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grColorCombine(func, fact, loc, oth, inv); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grColorCombine_NoLock grColorCombine
+
+#define FX_grCullMode(m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grCullMode(m); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grDepthBiasLevel(lev) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grDepthBiasLevel(lev); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grDepthBufferFunction(func) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grDepthBufferFunction(func); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grFogColorValue(c) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grFogColorValue(c); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grFogMode(m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grFogMode(m); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grFogTable(t) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grFogTable(t); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexClampMode(t, sc, tc) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexClampMode(t, sc, tc); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexClampMode_NoLock grTexClampMode
+
+#define FX_grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexCombine_NoLock grTexCombine
+
+#define FX_grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexDownloadMipMapLevel_NoLock grTexDownloadMipMapLevel
+
+#define FX_grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexFilterMode(t, minf, magf) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexFilterMode(t, minf, magf); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexFilterMode_NoLock grTexFilterMode
+
+extern FxU32 FX_grTexMinAddress(GrChipID_t tmu);
+extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu);
+
+#define FX_grTexMipMapMode(t, m, lod) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexMipMapMode(t, m, lod); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexMipMapMode_NoLock grTexMipMapMode
+
+#define FX_grTexSource(t, sa, eo, i) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grTexSource(t, sa, eo, i); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grTexSource_NoLock grTexSource
+
+extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info);
+#define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired
+
+#define FX_grGlideGetState(s) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grGlideGetState(s); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grDRIBufferSwap(i) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grDRIBufferSwap(i); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grSstSelect(b) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grSstSelect(b); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grSstSelect_NoLock grSstSelect
+
+#define FX_grGlideSetState(s) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grGlideSetState(s); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grDepthBufferMode(m) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grDepthBufferMode(m); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grLfbWriteColorFormat(f) \
+ do { \
+ BEGIN_BOARD_LOCK(); \
+ grLfbWriteColorFormat(f); \
+ END_BOARD_LOCK(); \
+ } while (0)
+
+#define FX_grDrawVertexArray(m, c, p) \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grDrawVertexArray(m, c, p); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
+#define FX_grGlideShutdown() \
+ do { \
+ BEGIN_CLIP_LOOP(); \
+ grGlideShutdown(); \
+ END_CLIP_LOOP(); \
+ } while (0)
+
+#define FX_grGlideInit_NoLock grGlideInit
+#define FX_grSstWinOpen_NoLock grSstWinOpen
+
+extern int FX_getFogTableSize(void);
+extern int FX_getGrStateSize(void);
+
#endif /* __FX_GLIDE_WARPER__ */
+
diff --git a/xc/extras/Mesa/src/FX/fxpipeline.c b/xc/extras/Mesa/src/FX/fxpipeline.c
index 1377d39ff..4d08d7ccd 100644
--- a/xc/extras/Mesa/src/FX/fxpipeline.c
+++ b/xc/extras/Mesa/src/FX/fxpipeline.c
@@ -1,3 +1,47 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
@@ -60,7 +104,7 @@ static void fxDDRenderVB( struct vertex_buffer *VB )
GLcontext *ctx = VB->ctx;
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
- if ((fxMesa->render_index & ~1) ||
+ if ((fxMesa->render_index & ~FX_FLAT) ||
((ctx->Texture.ReallyEnabled & 0xf) && VB->TexCoordPtr[0]->size>2) ||
((ctx->Texture.ReallyEnabled & 0xf0) && VB->TexCoordPtr[1]->size>2))
gl_render_vb( VB );
diff --git a/xc/extras/Mesa/src/FX/fxrender.c b/xc/extras/Mesa/src/FX/fxrender.c
index 3f15a0cdf..1e07cc8b0 100644
--- a/xc/extras/Mesa/src/FX/fxrender.c
+++ b/xc/extras/Mesa/src/FX/fxrender.c
@@ -1,27 +1,51 @@
-/* -*- mode: C; tab-width:8; c-basic-offset:2 -*-
-
- fxrender.c - 3Dfx VooDoo RenderVB driver function support
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Thank you for your contribution, David!
*
- * See the file fxapi.c for more informations about authors
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+/* fxrender.c - 3Dfx VooDoo RenderVB driver function support */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -45,7 +69,7 @@ void fxRenderClippedLine( struct vertex_buffer *VB,
GLubyte mask = VB->ClipMask[v1] | VB->ClipMask[v2];
if (!mask || (VB->ctx->line_clip_tab[VB->ClipPtr->size])(VB, &v1, &v2, mask))
- grDrawLine((GrVertex *)gWin[v1].f,(GrVertex *)gWin[v2].f);
+ FX_grDrawLine((GrVertex *)gWin[v1].f,(GrVertex *)gWin[v2].f);
}
@@ -76,8 +100,9 @@ INLINE void fxRenderClippedTriangle( struct vertex_buffer *VB,
GrVertex *i2 = (GrVertex *)gWin[vlist[2]].f;
GLuint i;
- for (i=2;i<n;i++, i1 = i2, i2 = (GrVertex *)gWin[vlist[i]].f)
- grDrawTriangle(i0,i1,i2);
+ for (i=2;i<n;i++, i1 = i2, i2 = (GrVertex *)gWin[vlist[i]].f) {
+ FX_grDrawTriangle(i0,i1,i2);
+ }
}
}
@@ -92,7 +117,7 @@ static INLINE void fxSafeClippedLine( struct vertex_buffer *VB,
if (!mask) {
fxVertex *gWin = FX_DRIVER_DATA(VB)->verts;
- grDrawLine((GrVertex *)gWin[v1].f,(GrVertex *)gWin[v2].f);
+ FX_grDrawLine((GrVertex *)gWin[v1].f,(GrVertex *)gWin[v2].f);
} else {
fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx;
fxLineClipTab[fxMesa->setupindex & 0x7]( VB, v1, v2, mask );
@@ -109,9 +134,9 @@ static INLINE void fxSafeClippedTriangle( struct vertex_buffer *VB,
GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v];
if (!mask) {
- grDrawTriangle((GrVertex *)gWin[v2].f,
- (GrVertex *)gWin[v1].f,
- (GrVertex *)gWin[v].f);
+ FX_grDrawTriangle((GrVertex *)gWin[v2].f,
+ (GrVertex *)gWin[v1].f,
+ (GrVertex *)gWin[v].f);
return;
}
@@ -141,11 +166,10 @@ static INLINE void fxSafeClippedTriangle2( struct vertex_buffer *VB,
GLubyte *clipmask = VB->ClipMask;
GLubyte mask = clipmask[v2] | clipmask[v1] | clipmask[v];
- if (!mask)
- grDrawTriangle((GrVertex *)gWin[v2].f,(GrVertex *)gWin[v1].f,
- (GrVertex *)gWin[v].f);
- else if (!(clipmask[v2] & clipmask[v1] & clipmask[v]))
- {
+ if (!mask) {
+ FX_grDrawTriangle((GrVertex *)gWin[v2].f,(GrVertex *)gWin[v1].f,
+ (GrVertex *)gWin[v].f);
+ } else if (!(clipmask[v2] & clipmask[v1] & clipmask[v])) {
GLuint vl[3];
ASSIGN_3V(vl, v2, v1, v );
cliptri( VB, vl, mask );
@@ -193,37 +217,37 @@ static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB,
(void) VB; \
(VB->ctx->Driver.PointsFunc)( VB->ctx, start, count-1 )
-
#define RENDER_LINE( i1, i ) \
-do { \
+ do { \
RVB_COLOR(i); \
- grDrawLine((GrVertex *)gWin[i1].f, \
+ FX_grDrawLine((GrVertex *)gWin[i1].f, \
(GrVertex *)gWin[i].f); \
-} while (0)
+ } while (0)
#define RENDER_TRI( i2, i1, i, pv, parity ) \
-do { \
- RVB_COLOR(pv); \
- if (parity) \
- grDrawTriangle((GrVertex *)gWin[i1].f, \
+ do { \
+ RVB_COLOR(pv); \
+ if (parity) { \
+ FX_grDrawTriangle((GrVertex *)gWin[i1].f, \
(GrVertex *)gWin[i2].f, \
(GrVertex *)gWin[i].f); \
- else \
- grDrawTriangle((GrVertex *)gWin[i2].f, \
+ } else { \
+ FX_grDrawTriangle((GrVertex *)gWin[i2].f, \
(GrVertex *)gWin[i1].f, \
(GrVertex *)gWin[i].f); \
-} while (0)
+ } \
+ } while (0)
#define RENDER_QUAD( i3, i2, i1, i, pv ) \
-do { \
- RVB_COLOR(i); \
- grDrawTriangle((GrVertex *)gWin[i3].f, \
+ do { \
+ RVB_COLOR(pv); \
+ FX_grDrawTriangle((GrVertex *)gWin[i3].f, \
(GrVertex *)gWin[i2].f, \
(GrVertex *)gWin[i].f); \
- grDrawTriangle((GrVertex *)gWin[i2].f, \
+ FX_grDrawTriangle((GrVertex *)gWin[i2].f, \
(GrVertex *)gWin[i1].f, \
(GrVertex *)gWin[i].f); \
-} while (0)
+ } while (0)
@@ -258,62 +282,62 @@ do { \
#define RENDER_LINE( i1, i ) \
-do { \
- const GLubyte flags = cullmask[i]; \
+ do { \
+ const GLubyte flags = cullmask[i]; \
\
- if (!(flags & PRIM_NOT_CULLED)) \
+ if (!(flags & PRIM_NOT_CULLED)) \
continue; \
\
- RVB_COLOR(i); \
- if (flags & PRIM_ANY_CLIP) \
+ RVB_COLOR(i); \
+ if (flags & PRIM_ANY_CLIP) \
fxRenderClippedLine( VB, i1, i ); \
- else \
- grDrawLine( (GrVertex *)gWin[i1].f, (GrVertex *)gWin[i].f ); \
-} while (0)
+ else \
+ FX_grDrawLine( (GrVertex *)gWin[i1].f, (GrVertex *)gWin[i].f ); \
+ } while (0)
#define RENDER_TRI( i2, i1, i, pv, parity) \
-do { \
- const GLubyte flags = cullmask[i]; \
- GLuint e2,e1; \
+ do { \
+ const GLubyte flags = cullmask[i]; \
+ GLuint e2,e1; \
\
- if (!(flags & PRIM_NOT_CULLED)) \
+ if (!(flags & PRIM_NOT_CULLED)) \
continue; \
\
- e2=i2, e1=i1; \
- if (parity) { e2=i1; e1=i2; } \
+ e2=i2, e1=i1; \
+ if (parity) { e2=i1; e1=i2; } \
\
- RVB_COLOR(pv); \
- if (flags & PRIM_ANY_CLIP) { \
- fxSafeClippedTriangle3(VB,gWin,cliptri,e2,e1,i); \
- } else \
- grDrawTriangle((GrVertex *)gWin[e2].f, \
+ RVB_COLOR(pv); \
+ if (flags & PRIM_ANY_CLIP) { \
+ fxSafeClippedTriangle3(VB,gWin,cliptri,e2,e1,i); \
+ } else { \
+ FX_grDrawTriangle((GrVertex *)gWin[e2].f, \
(GrVertex *)gWin[e1].f, \
(GrVertex *)gWin[i].f); \
- \
-} while (0)
+ } \
+ } while (0)
#define RENDER_QUAD(i3, i2, i1, i, pv) \
-do { \
- const GLubyte flags = cullmask[i]; \
+ do { \
+ const GLubyte flags = cullmask[i]; \
\
- if (!(flags & PRIM_NOT_CULLED)) \
+ if (!(flags & PRIM_NOT_CULLED)) \
continue; \
\
- RVB_COLOR(pv); \
- if (flags&PRIM_ANY_CLIP) { \
+ RVB_COLOR(pv); \
+ if (flags&PRIM_ANY_CLIP) { \
fxSafeClippedTriangle3(VB,gWin,cliptri,i3,i2,i); \
fxSafeClippedTriangle3(VB,gWin,cliptri,i2,i1,i); \
- } else { \
- grDrawTriangle((GrVertex *)gWin[i3].f, \
+ } else { \
+ FX_grDrawTriangle((GrVertex *)gWin[i3].f, \
(GrVertex *)gWin[i2].f, \
(GrVertex *)gWin[i].f); \
- grDrawTriangle((GrVertex *)gWin[i2].f, \
+ FX_grDrawTriangle((GrVertex *)gWin[i2].f, \
(GrVertex *)gWin[i1].f, \
(GrVertex *)gWin[i].f); \
- } \
-} while (0)
+ } \
+ } while (0)
@@ -348,37 +372,37 @@ do { \
/* Direct, with the possibility of clipping.
*/
#define RENDER_POINTS( start, count ) \
-do { \
- fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
- GLubyte *clipmask = VB->ClipMask; \
- GLuint i; \
- for (i = start ; i <= count ; i++) \
- if (clipmask[i] == 0) { \
+ do { \
+ fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
+ GLubyte *clipmask = VB->ClipMask; \
+ GLuint i; \
+ for (i = start ; i <= count ; i++) \
+ if (clipmask[i] == 0) { \
RVB_COLOR(i); \
- grDrawPoint( (GrVertex *)gWin[i].f ); \
- } \
-} while (0)
+ FX_grDrawPoint( (GrVertex *)gWin[i].f );\
+ } \
+ } while (0)
#define RENDER_LINE( i1, i ) \
-do { \
- RVB_COLOR(i); \
- fxSafeClippedLine( VB, i1, i ); \
-} while (0)
+ do { \
+ RVB_COLOR(i); \
+ fxSafeClippedLine( VB, i1, i ); \
+ } while (0)
#define RENDER_TRI( i2, i1, i, pv, parity) \
-do { \
- GLuint e2=i2, e1=i1; \
- if (parity) { GLuint t=e2; e2=e1; e1=t; } \
- RVB_COLOR(pv); \
- fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,i); \
-} while (0)
+ do { \
+ GLuint e2=i2, e1=i1; \
+ if (parity) { GLuint t=e2; e2=e1; e1=t; } \
+ RVB_COLOR(pv); \
+ fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,i); \
+ } while (0)
#define RENDER_QUAD( i3, i2, i1, i, pv) \
-do { \
- RVB_COLOR(pv); \
- fxSafeClippedTriangle(VB,gWin,cliptri,i3,i2,i); \
- fxSafeClippedTriangle(VB,gWin,cliptri,i2,i1,i); \
-} while (0)
+ do { \
+ RVB_COLOR(pv); \
+ fxSafeClippedTriangle(VB,gWin,cliptri,i3,i2,i); \
+ fxSafeClippedTriangle(VB,gWin,cliptri,i2,i1,i); \
+ } while (0)
#define LOCAL_VARS \
fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \
@@ -407,35 +431,36 @@ do { \
/* Indirect, with the possibility of clipping.
*/
#define RENDER_POINTS( start, count ) \
-do { \
- fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
- GLuint e; \
- GLubyte *clipmask = VB->ClipMask; \
- for(e=start;e<=count;e++) \
- if(clipmask[elt[e]]==0) \
- grDrawPoint((GrVertex *)gWin[elt[e]].f); \
-} while (0)
+ do { \
+ fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
+ GLuint e; \
+ GLubyte *clipmask = VB->ClipMask; \
+ for(e=start;e<=count;e++) \
+ if(clipmask[elt[e]]==0) { \
+ FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \
+ } \
+ } while (0)
#define RENDER_LINE( i1, i ) \
-do { \
- GLuint e1 = elt[i1], e = elt[i]; \
- RVB_COLOR(e); \
- fxSafeClippedLine( VB, e1, e ); \
-} while (0)
+ do { \
+ GLuint e1 = elt[i1], e = elt[i]; \
+ RVB_COLOR(e); \
+ fxSafeClippedLine( VB, e1, e ); \
+ } while (0)
#define RENDER_TRI( i2, i1, i, pv, parity) \
-do { \
- GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
- if (parity) { GLuint t=e2; e2=e1; e1=t; } \
- fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \
-} while (0)
+ do { \
+ GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ if (parity) { GLuint t=e2; e2=e1; e1=t; } \
+ fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \
+ } while (0)
#define RENDER_QUAD( i3, i2, i1, i, pv) \
-do { \
- GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
- fxSafeClippedTriangle(VB,gWin,cliptri,e3,e2,e); \
- fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \
-} while (0)
+ do { \
+ GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\
+ fxSafeClippedTriangle(VB,gWin,cliptri,e3,e2,e); \
+ fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \
+ } while (0)
#define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \
fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \
@@ -453,35 +478,36 @@ do { \
/* Indirect, clipped, but no user clip.
*/
#define RENDER_POINTS( start, count ) \
-do { \
- fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
- GLuint e; \
- GLubyte *clipmask = VB->ClipMask; \
- for(e=start;e<=count;e++) \
- if(clipmask[elt[e]]==0) \
- grDrawPoint((GrVertex *)gWin[elt[e]].f); \
-} while (0)
+ do { \
+ fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
+ GLuint e; \
+ GLubyte *clipmask = VB->ClipMask; \
+ for(e=start;e<=count;e++) \
+ if(clipmask[elt[e]]==0) { \
+ FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \
+ } \
+ } while (0)
#define RENDER_LINE( i1, i ) \
-do { \
- GLuint e1 = elt[i1], e = elt[i]; \
- RVB_COLOR(e); \
- fxSafeClippedLine( VB, e1, e ); \
-} while (0)
+ do { \
+ GLuint e1 = elt[i1], e = elt[i]; \
+ RVB_COLOR(e); \
+ fxSafeClippedLine( VB, e1, e ); \
+ } while (0)
#define RENDER_TRI( i2, i1, i, pv, parity) \
-do { \
- GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
- if (parity) { GLuint t=e2; e2=e1; e1=t; } \
- fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \
-} while (0)
+ do { \
+ GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ if (parity) { GLuint t=e2; e2=e1; e1=t; } \
+ fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \
+ } while (0)
#define RENDER_QUAD( i3, i2, i1, i, pv) \
-do { \
- GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
- fxSafeClippedTriangle2(VB,gWin,cliptri,e3,e2,e); \
- fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \
-} while (0)
+ do { \
+ GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\
+ fxSafeClippedTriangle2(VB,gWin,cliptri,e3,e2,e); \
+ fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \
+ } while (0)
#define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \
fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \
@@ -503,40 +529,41 @@ do { \
/* Indirect, and no clipping required.
*/
-#define RENDER_POINTS( start, count ) \
-do { \
- GLuint e; \
- for(e=start;e<=count;e++) \
- grDrawPoint((GrVertex *)gWin[elt[e]].f); \
-} while (0)
+#define RENDER_POINTS( start, count ) \
+ do { \
+ GLuint e; \
+ for(e=start;e<=count;e++) { \
+ FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \
+ } \
+ } while (0)
-#define RENDER_LINE( i1, i ) \
-do { \
- GLuint e1 = elt[i1], e = elt[i]; \
- grDrawLine( (GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f ); \
-} while (0)
+#define RENDER_LINE( i1, i ) \
+ do { \
+ GLuint e1 = elt[i1], e = elt[i]; \
+ FX_grDrawLine((GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f); \
+ } while (0)
#define RENDER_TRI( i2, i1, i, pv, parity) \
-do { \
- GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
- if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
- grDrawTriangle((GrVertex *)gWin[e2].f, \
+ do { \
+ GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
+ if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \
+ FX_grDrawTriangle((GrVertex *)gWin[e2].f, \
(GrVertex *)gWin[e1].f, \
(GrVertex *)gWin[e].f); \
-} while (0)
+ } while (0)
#define RENDER_QUAD( i3, i2, i1, i, pv) \
-do { \
- GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \
- grDrawTriangle((GrVertex *)gWin[e3].f, \
+ do { \
+ GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\
+ FX_grDrawTriangle((GrVertex *)gWin[e3].f, \
(GrVertex *)gWin[e2].f, \
(GrVertex *)gWin[e].f); \
- grDrawTriangle((GrVertex *)gWin[e2].f, \
+ FX_grDrawTriangle((GrVertex *)gWin[e2].f, \
(GrVertex *)gWin[e1].f, \
(GrVertex *)gWin[e].f); \
-} while (0)
+ } while (0)
#define LOCAL_VARS \
fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \
@@ -578,9 +605,14 @@ void fxDDRenderElementsDirect( struct vertex_buffer *VB )
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint p = 0;
+ if (!nr)
+ return;
+
if (fxMesa->new_state)
fxSetupFXUnits(ctx);
+ if (!nr) return;
+
if (VB->ClipOrMask) {
func = render_tab_fx_smooth_indirect_view_clipped[prim];
if (VB->ClipOrMask & CLIP_USER_BIT)
diff --git a/xc/extras/Mesa/src/FX/fxsanity.c b/xc/extras/Mesa/src/FX/fxsanity.c
index 4fb19e669..cd94b59fb 100644
--- a/xc/extras/Mesa/src/FX/fxsanity.c
+++ b/xc/extras/Mesa/src/FX/fxsanity.c
@@ -1,3 +1,46 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
#ifdef HAVE_CONFIG_H
@@ -67,7 +110,7 @@ void fx_sanity_triangle( GrVertex *v1, GrVertex *v2, GrVertex *v3 )
}
if (1)
- grDrawTriangle(v1,v2,v3);
+ FX_grDrawTriangle(v1,v2,v3);
else
fprintf(stderr, "\n\n\n");
}
diff --git a/xc/extras/Mesa/src/FX/fxsdettmp.h b/xc/extras/Mesa/src/FX/fxsdettmp.h
index d353bda20..258edf1bc 100644
--- a/xc/extras/Mesa/src/FX/fxsdettmp.h
+++ b/xc/extras/Mesa/src/FX/fxsdettmp.h
@@ -1,25 +1,45 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
/*
* Mesa 3-D graphics library
* Version: 3.1
- *
+ *
* Copyright (C) 1999 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
@@ -67,7 +87,7 @@ static void TAG(render_vb_triangles_smooth_indirect_sd)
}
else
{
- if (STRIP0(u,v))
+ if (STRIP0(u,v))
{
int is_strips = 1;
int parity = 0;
@@ -138,4 +158,4 @@ static void TAG(render_vb_triangles_smooth_indirect_sd)
#endif
#undef PRESERVE_VB_DEFS
-#undef PRESERVE_TAG \ No newline at end of file
+#undef PRESERVE_TAG
diff --git a/xc/extras/Mesa/src/FX/fxsetup.c b/xc/extras/Mesa/src/FX/fxsetup.c
index 8367a1f1f..b27d5c983 100644
--- a/xc/extras/Mesa/src/FX/fxsetup.c
+++ b/xc/extras/Mesa/src/FX/fxsetup.c
@@ -1,27 +1,51 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxsetup.c - 3Dfx VooDoo rendering mode setup functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * See the file fxapi.c for more informations about authors
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -31,14 +55,31 @@
#include "fxdrv.h"
#include "enums.h"
+static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
+ struct gl_texture_object *tObj0,
+ struct gl_texture_object *tObj1);
+static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset);
+static void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset);
+static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
+ struct gl_texture_object *tObj0,
+ struct gl_texture_object *tObj1);
+static void fxSetupBlend(GLcontext *ctx);
+static void fxSetupDepthTest(GLcontext *ctx);
+static void fxFogTableGenerate(GLcontext *ctx);
+static void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild);
+static void fxSetupScissor(GLcontext *ctx);
+static void fxSetupCull(GLcontext *ctx);
+static void gl_print_fx_state_flags( const char *msg, GLuint flags);
+static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint );
+
static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
{
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
- GLint minl,maxl;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
+ GLint minl, maxl;
- if (MESA_VERBOSE&VERBOSE_DRIVER)
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxTexValidate(...) Start\n");
-
+ }
if(ti->validated) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
@@ -47,15 +88,15 @@ static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
return;
}
+ ti->tObj=tObj;
minl=ti->minLevel=tObj->BaseLevel;
maxl=ti->maxLevel=MIN2(tObj->MaxLevel,tObj->Image[0]->MaxLog2);
-
- fxTexGetInfo(tObj->Image[minl]->Width,tObj->Image[minl]->Height,
- &(FX_largeLodLog2(ti->info)),&(FX_aspectRatioLog2(ti->info)),
- &(ti->sScale),&(ti->tScale),
- &(ti->int_sScale),&(ti->int_tScale),
- NULL,NULL);
+ fxTexGetInfo(tObj->Image[minl]->Width, tObj->Image[minl]->Height,
+ &(FX_largeLodLog2(ti->info)), &(FX_aspectRatioLog2(ti->info)),
+ &(ti->sScale), &(ti->tScale),
+ &(ti->int_sScale), &(ti->int_tScale),
+ NULL, NULL);
if((tObj->MinFilter!=GL_NEAREST) && (tObj->MinFilter!=GL_LINEAR))
fxTexGetInfo(tObj->Image[maxl]->Width,tObj->Image[maxl]->Height,
@@ -68,6 +109,27 @@ static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
fxTexGetFormat(tObj->Image[minl]->Format,&(ti->info.format),&(ti->baseLevelInternalFormat));
+ switch (tObj->WrapS) {
+ case GL_CLAMP_TO_EDGE:
+ /* What's this really mean compared to GL_CLAMP? */
+ case GL_CLAMP:
+ ti->sClamp=1;
+ break;
+ case GL_REPEAT:
+ ti->sClamp=0;
+ break;
+ }
+ switch (tObj->WrapT) {
+ case GL_CLAMP_TO_EDGE:
+ /* What's this really mean compared to GL_CLAMP? */
+ case GL_CLAMP:
+ ti->tClamp=1;
+ break;
+ case GL_REPEAT:
+ ti->tClamp=0;
+ break;
+ }
+
ti->validated=GL_TRUE;
ti->info.data=NULL;
@@ -109,9 +171,9 @@ static void fxPrintUnitsMode( const char *msg, GLuint mode )
(mode & FX_UM_ALPHA_CONSTANT) ? "ALPHA_CONSTANT, " : "");
}
-GLuint fxGetTexSetConfiguration(GLcontext *ctx,
- struct gl_texture_object *tObj0,
- struct gl_texture_object *tObj1)
+static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
+ struct gl_texture_object *tObj0,
+ struct gl_texture_object *tObj1)
{
GLuint unitsmode=0;
GLuint envmode=0;
@@ -131,7 +193,7 @@ GLuint fxGetTexSetConfiguration(GLcontext *ctx,
unitsmode|=FX_UM_COLOR_CONSTANT;
if(tObj0) {
- tfxTexInfo *ti0=(tfxTexInfo *)tObj0->DriverData;
+ tfxTexInfo *ti0=fxTMGetTexInfo(tObj0);
switch(ti0->baseLevelInternalFormat) {
case GL_ALPHA:
@@ -177,7 +239,7 @@ GLuint fxGetTexSetConfiguration(GLcontext *ctx,
}
if(tObj1) {
- tfxTexInfo *ti1=(tfxTexInfo *)tObj1->DriverData;
+ tfxTexInfo *ti1=fxTMGetTexInfo(tObj1);
switch(ti1->baseLevelInternalFormat) {
case GL_ALPHA:
@@ -239,50 +301,52 @@ GLuint fxGetTexSetConfiguration(GLcontext *ctx,
/************************* Single Texture Set ***************************/
-static void fxSetupSingleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj)
+static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
- if(!ti->tmi.isInTM) {
- if(ti->LODblend)
- fxTMMoveInTM(fxMesa,tObj,FX_TMU_SPLIT);
+ if (!ti->isInTM) {
+ if (ti->LODblend)
+ fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU_SPLIT);
else {
- if(fxMesa->haveTwoTMUs) {
- if(fxMesa->freeTexMem[FX_TMU0]>grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,&(ti->info)))
- fxTMMoveInTM(fxMesa,tObj,FX_TMU0);
+ if (fxMesa->haveTwoTMUs) {
+ if (fxMesa->freeTexMem[FX_TMU0] >
+ FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
+ &(ti->info)))
+ fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU0);
else
- fxTMMoveInTM(fxMesa,tObj,FX_TMU1);
+ fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU1);
} else
- fxTMMoveInTM(fxMesa,tObj,FX_TMU0);
+ fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU0);
}
}
- if(ti->LODblend && ti->tmi.whichTMU == FX_TMU_SPLIT) {
- if((ti->info.format==GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) {
+ if (ti->LODblend && ti->whichTMU == FX_TMU_SPLIT) {
+ if ((ti->info.format==GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: uploading texture palette\n");
}
- FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE,&(ti->palette));
- FX_grTexDownloadTable(GR_TMU1,GR_TEXTABLE_PALETTE,&(ti->palette));
+ FX_grTexDownloadTable_NoLock(GR_TMU0,GR_TEXTABLE_PALETTE,&(ti->palette));
+ FX_grTexDownloadTable_NoLock(GR_TMU1,GR_TEXTABLE_PALETTE,&(ti->palette));
}
- grTexClampMode(GR_TMU0,ti->sClamp,ti->tClamp);
- grTexClampMode(GR_TMU1,ti->sClamp,ti->tClamp);
- grTexFilterMode(GR_TMU0,ti->minFilt,ti->maxFilt);
- grTexFilterMode(GR_TMU1,ti->minFilt,ti->maxFilt);
- grTexMipMapMode(GR_TMU0,ti->mmMode,ti->LODblend);
- grTexMipMapMode(GR_TMU1,ti->mmMode,ti->LODblend);
-
- grTexSource(GR_TMU0,ti->tmi.tm[FX_TMU0]->startAddress,
- GR_MIPMAPLEVELMASK_ODD,&(ti->info));
- grTexSource(GR_TMU1,ti->tmi.tm[FX_TMU1]->startAddress,
- GR_MIPMAPLEVELMASK_EVEN,&(ti->info));
+ FX_grTexClampMode_NoLock(GR_TMU0,ti->sClamp,ti->tClamp);
+ FX_grTexClampMode_NoLock(GR_TMU1,ti->sClamp,ti->tClamp);
+ FX_grTexFilterMode_NoLock(GR_TMU0,ti->minFilt,ti->maxFilt);
+ FX_grTexFilterMode_NoLock(GR_TMU1,ti->minFilt,ti->maxFilt);
+ FX_grTexMipMapMode_NoLock(GR_TMU0,ti->mmMode,ti->LODblend);
+ FX_grTexMipMapMode_NoLock(GR_TMU1,ti->mmMode,ti->LODblend);
+
+ FX_grTexSource_NoLock(GR_TMU0,ti->tm[FX_TMU0]->startAddr,
+ GR_MIPMAPLEVELMASK_ODD,&(ti->info));
+ FX_grTexSource_NoLock(GR_TMU1,ti->tm[FX_TMU1]->startAddr,
+ GR_MIPMAPLEVELMASK_EVEN,&(ti->info));
} else {
if((ti->info.format==GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: uploading texture palette\n");
}
- FX_grTexDownloadTable(ti->tmi.whichTMU,GR_TEXTABLE_PALETTE,&(ti->palette));
+ FX_grTexDownloadTable_NoLock(ti->whichTMU,GR_TEXTABLE_PALETTE,&(ti->palette));
}
/* KW: The alternative is to do the download to the other tmu. If
@@ -292,63 +356,69 @@ static void fxSetupSingleTMU(fxMesaContext fxMesa, struct gl_texture_object *tOb
if (ti->LODblend && (MESA_VERBOSE&VERBOSE_DRIVER))
fprintf(stderr, "fxmesa: not blending texture - only on one tmu\n");
+ FX_grTexClampMode_NoLock(ti->whichTMU,ti->sClamp,ti->tClamp);
+ FX_grTexFilterMode_NoLock(ti->whichTMU,ti->minFilt,ti->maxFilt);
+ FX_grTexMipMapMode_NoLock(ti->whichTMU,ti->mmMode,FXFALSE);
- grTexClampMode(ti->tmi.whichTMU,ti->sClamp,ti->tClamp);
- grTexFilterMode(ti->tmi.whichTMU,ti->minFilt,ti->maxFilt);
- grTexMipMapMode(ti->tmi.whichTMU,ti->mmMode,FXFALSE);
-
- grTexSource(ti->tmi.whichTMU,ti->tmi.tm[ti->tmi.whichTMU]->startAddress,
- GR_MIPMAPLEVELMASK_BOTH,&(ti->info));
+ FX_grTexSource_NoLock(ti->whichTMU,
+ ti->tm[ti->whichTMU]->startAddr,
+ GR_MIPMAPLEVELMASK_BOTH,&(ti->info));
}
}
-static void fxSelectSingleTMUSrc(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
+static void fxSetupSingleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj) {
+ BEGIN_BOARD_LOCK();
+ fxSetupSingleTMU_NoLock(fxMesa, tObj);
+ END_BOARD_LOCK();
+}
+
+static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
{
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxSelectSingleTMUSrc(%d,%d)\n",tmu,LODblend);
}
if(LODblend) {
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND,
- GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
- GR_COMBINE_FUNCTION_BLEND,
- GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
- FXFALSE,FXFALSE);
-
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
+ GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
+ FXFALSE,FXFALSE);
+
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
fxMesa->tmuSrc=FX_TMU_SPLIT;
} else {
if(tmu==FX_TMU0) {
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
fxMesa->tmuSrc=FX_TMU0;
} else {
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
/* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND,GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_BLEND,GR_COMBINE_FACTOR_ONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND,GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_BLEND,GR_COMBINE_FACTOR_ONE,
+ FXFALSE,FXFALSE);
fxMesa->tmuSrc=FX_TMU1;
}
}
}
-void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset)
+static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GrCombineLocal_t localc,locala;
@@ -357,18 +427,18 @@ void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset)
tfxTexInfo *ti;
struct gl_texture_object *tObj=ctx->Texture.Unit[textureset].CurrentD[2];
- if (MESA_VERBOSE&VERBOSE_DRIVER)
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxSetupTextureSingleTMU(...) Start\n");
+ }
-
- ti=(tfxTexInfo *)tObj->DriverData;
+ ti=fxTMGetTexInfo(tObj);
fxTexValidate(ctx,tObj);
- fxSetupSingleTMU(fxMesa,tObj);
+ fxSetupSingleTMU_NoLock(fxMesa,tObj);
- if(fxMesa->tmuSrc!=ti->tmi.whichTMU)
- fxSelectSingleTMUSrc(fxMesa,ti->tmi.whichTMU,ti->LODblend);
+ if(fxMesa->tmuSrc!=ti->whichTMU)
+ fxSelectSingleTMUSrc_NoLock(fxMesa,ti->whichTMU,ti->LODblend);
if(textureset==0 || !fxMesa->haveTwoTMUs)
unitsmode=fxGetTexSetConfiguration(ctx,tObj,NULL);
@@ -381,7 +451,7 @@ void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset)
fxMesa->lastUnitsMode=unitsmode;
fxMesa->stw_hint_state = 0;
- FX_grHints(GR_HINT_STWHINT,0);
+ FX_grHints_NoLock(GR_HINT_STWHINT,0);
ifmt=ti->baseLevelInternalFormat;
@@ -401,37 +471,37 @@ void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset)
switch(ctx->Texture.Unit[textureset].EnvMode) {
case GL_DECAL:
- grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- locala,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
-
- grColorCombine(GR_COMBINE_FUNCTION_BLEND,
- GR_COMBINE_FACTOR_TEXTURE_ALPHA,
- localc,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ locala,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
break;
case GL_MODULATE:
- grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- locala,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ locala,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
if(ifmt==GL_ALPHA)
- grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- localc,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ localc,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
else
- grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- localc,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
break;
case GL_BLEND:
#ifndef FX_SILENT
@@ -441,30 +511,30 @@ void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset)
break;
case GL_REPLACE:
if((ifmt==GL_RGB) || (ifmt==GL_LUMINANCE))
- grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- locala,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ locala,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
else
- grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- locala,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ locala,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
if(ifmt==GL_ALPHA)
- grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- localc,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ localc,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
else
- grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- localc,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
break;
default:
#ifndef FX_SILENT
@@ -478,10 +548,17 @@ void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset)
}
}
+static void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset) {
+ BEGIN_BOARD_LOCK();
+ fxSetupTextureSingleTMU_NoLock(ctx, textureset);
+ END_BOARD_LOCK();
+}
+
/************************* Double Texture Set ***************************/
-void fxSetupDoubleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj0,
- struct gl_texture_object *tObj1)
+static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
+ struct gl_texture_object *tObj0,
+ struct gl_texture_object *tObj1)
{
#define T0_NOT_IN_TMU 0x01
#define T1_NOT_IN_TMU 0x02
@@ -490,18 +567,18 @@ void fxSetupDoubleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj0,
#define T0_IN_TMU1 0x10
#define T1_IN_TMU1 0x20
- tfxTexInfo *ti0=(tfxTexInfo *)tObj0->DriverData;
- tfxTexInfo *ti1=(tfxTexInfo *)tObj1->DriverData;
+ tfxTexInfo *ti0=fxTMGetTexInfo(tObj0);
+ tfxTexInfo *ti1=fxTMGetTexInfo(tObj1);
GLuint tstate=0;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxSetupDoubleTMU(...)\n");
}
- if(ti0->tmi.isInTM) {
- if(ti0->tmi.whichTMU==FX_TMU0)
+ if(ti0->isInTM) {
+ if(ti0->whichTMU==FX_TMU0)
tstate|=T0_IN_TMU0;
- else if(ti0->tmi.whichTMU==FX_TMU1)
+ else if(ti0->whichTMU==FX_TMU1)
tstate|=T0_IN_TMU1;
else {
fxTMMoveOutTM(fxMesa,tObj0);
@@ -510,10 +587,10 @@ void fxSetupDoubleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj0,
} else
tstate|=T0_NOT_IN_TMU;
- if(ti1->tmi.isInTM) {
- if(ti1->tmi.whichTMU==FX_TMU0)
+ if(ti1->isInTM) {
+ if(ti1->whichTMU==FX_TMU0)
tstate|=T1_IN_TMU0;
- else if(ti1->tmi.whichTMU==FX_TMU1)
+ else if(ti1->whichTMU==FX_TMU1)
tstate|=T1_IN_TMU1;
else {
fxTMMoveOutTM(fxMesa,tObj1);
@@ -522,8 +599,8 @@ void fxSetupDoubleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj0,
} else
tstate|=T1_NOT_IN_TMU;
- ti0->tmi.lastTimeUsed=fxMesa->texBindNumber;
- ti1->tmi.lastTimeUsed=fxMesa->texBindNumber;
+ ti0->lastTimeUsed=fxMesa->texBindNumber;
+ ti1->lastTimeUsed=fxMesa->texBindNumber;
/* Move texture maps in TMUs */
@@ -531,36 +608,36 @@ void fxSetupDoubleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj0,
case (T0_IN_TMU0 | T1_IN_TMU0):
fxTMMoveOutTM(fxMesa,tObj1);
- fxTMMoveInTM(fxMesa,tObj1,FX_TMU1);
+ fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1);
break;
case (T0_IN_TMU1 | T1_IN_TMU1):
fxTMMoveOutTM(fxMesa,tObj0);
- fxTMMoveInTM(fxMesa,tObj0,FX_TMU0);
+ fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0);
break;
case (T0_NOT_IN_TMU | T1_NOT_IN_TMU):
- fxTMMoveInTM(fxMesa,tObj0,FX_TMU0);
- fxTMMoveInTM(fxMesa,tObj1,FX_TMU1);
+ fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0);
+ fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1);
break;
/*** T0/T1 ***/
case (T0_NOT_IN_TMU | T1_IN_TMU0):
- fxTMMoveInTM(fxMesa,tObj0,FX_TMU1);
+ fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU1);
break;
case (T0_NOT_IN_TMU | T1_IN_TMU1):
- fxTMMoveInTM(fxMesa,tObj0,FX_TMU0);
+ fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0);
break;
case (T0_IN_TMU0 | T1_NOT_IN_TMU):
- fxTMMoveInTM(fxMesa,tObj1,FX_TMU1);
+ fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1);
break;
case (T0_IN_TMU1 | T1_NOT_IN_TMU):
- fxTMMoveInTM(fxMesa,tObj1,FX_TMU0);
+ fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU0);
break;
/*** Best Case ***/
@@ -576,33 +653,35 @@ void fxSetupDoubleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj0,
break;
}
- if(!fxMesa->haveGlobalPaletteTexture) {
- if(ti0->info.format==GR_TEXFMT_P_8) {
+ if (!fxMesa->haveGlobalPaletteTexture) {
+ if (ti0->info.format==GR_TEXFMT_P_8) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: uploading texture palette TMU0\n");
}
- FX_grTexDownloadTable(ti0->tmi.whichTMU,GR_TEXTABLE_PALETTE,&(ti0->palette));
+ FX_grTexDownloadTable_NoLock(ti0->whichTMU,GR_TEXTABLE_PALETTE,&(ti0->palette));
}
- if(ti1->info.format==GR_TEXFMT_P_8) {
+ if (ti1->info.format==GR_TEXFMT_P_8) {
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: uploading texture palette TMU1\n");
}
- FX_grTexDownloadTable(ti1->tmi.whichTMU,GR_TEXTABLE_PALETTE,&(ti1->palette));
+ FX_grTexDownloadTable_NoLock(ti1->whichTMU, GR_TEXTABLE_PALETTE,&(ti1->palette));
}
}
- grTexClampMode(ti0->tmi.whichTMU,ti0->sClamp,ti0->tClamp);
- grTexFilterMode(ti0->tmi.whichTMU,ti0->minFilt,ti0->maxFilt);
- grTexMipMapMode(ti0->tmi.whichTMU,ti0->mmMode,FXFALSE);
- grTexSource(ti0->tmi.whichTMU,ti0->tmi.tm[ti0->tmi.whichTMU]->startAddress,
- GR_MIPMAPLEVELMASK_BOTH,&(ti0->info));
+ FX_grTexSource_NoLock(ti0->whichTMU,
+ ti0->tm[ti0->whichTMU]->startAddr,
+ GR_MIPMAPLEVELMASK_BOTH,&(ti0->info));
+ FX_grTexClampMode_NoLock(ti0->whichTMU,ti0->sClamp,ti0->tClamp);
+ FX_grTexFilterMode_NoLock(ti0->whichTMU,ti0->minFilt,ti0->maxFilt);
+ FX_grTexMipMapMode_NoLock(ti0->whichTMU,ti0->mmMode,FXFALSE);
- grTexClampMode(ti1->tmi.whichTMU,ti1->sClamp,ti1->tClamp);
- grTexFilterMode(ti1->tmi.whichTMU,ti1->minFilt,ti1->maxFilt);
- grTexMipMapMode(ti1->tmi.whichTMU,ti1->mmMode,FXFALSE);
- grTexSource(ti1->tmi.whichTMU,ti1->tmi.tm[ti1->tmi.whichTMU]->startAddress,
- GR_MIPMAPLEVELMASK_BOTH,&(ti1->info));
+ FX_grTexSource_NoLock(ti1->whichTMU,
+ ti1->tm[ti1->whichTMU]->startAddr,
+ GR_MIPMAPLEVELMASK_BOTH,&(ti1->info));
+ FX_grTexClampMode_NoLock(ti1->whichTMU,ti1->sClamp,ti1->tClamp);
+ FX_grTexFilterMode_NoLock(ti1->whichTMU,ti1->minFilt,ti1->maxFilt);
+ FX_grTexMipMapMode_NoLock(ti1->whichTMU,ti1->mmMode,FXFALSE);
#undef T0_NOT_IN_TMU
#undef T1_NOT_IN_TMU
@@ -612,7 +691,7 @@ void fxSetupDoubleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj0,
#undef T1_IN_TMU1
}
-static void fxSetupTextureDoubleTMU(GLcontext *ctx)
+static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GrCombineLocal_t localc,locala;
@@ -625,13 +704,13 @@ static void fxSetupTextureDoubleTMU(GLcontext *ctx)
fprintf(stderr,"fxmesa: fxSetupTextureDoubleTMU(...) Start\n");
}
- ti0=(tfxTexInfo *)tObj0->DriverData;
+ ti0=fxTMGetTexInfo(tObj0);
fxTexValidate(ctx,tObj0);
- ti1=(tfxTexInfo *)tObj1->DriverData;
+ ti1=fxTMGetTexInfo(tObj1);
fxTexValidate(ctx,tObj1);
- fxSetupDoubleTMU(fxMesa,tObj0,tObj1);
+ fxSetupDoubleTMU_NoLock(fxMesa,tObj0,tObj1);
unitsmode=fxGetTexSetConfiguration(ctx,tObj0,tObj1);
@@ -641,7 +720,7 @@ static void fxSetupTextureDoubleTMU(GLcontext *ctx)
fxMesa->lastUnitsMode=unitsmode;
fxMesa->stw_hint_state |= GR_STWHINT_ST_DIFF_TMU1;
- FX_grHints(GR_HINT_STWHINT, fxMesa->stw_hint_state);
+ FX_grHints_NoLock(GR_HINT_STWHINT, fxMesa->stw_hint_state);
envmode=unitsmode & FX_UM_E_ENVMODE;
ifmt=unitsmode & FX_UM_E_IFMT;
@@ -670,128 +749,152 @@ static void fxSetupTextureDoubleTMU(GLcontext *ctx)
GLboolean isalpha[FX_NUM_TMU];
if(ti0->baseLevelInternalFormat==GL_ALPHA)
- isalpha[ti0->tmi.whichTMU]=GL_TRUE;
+ isalpha[ti0->whichTMU]=GL_TRUE;
else
- isalpha[ti0->tmi.whichTMU]=GL_FALSE;
+ isalpha[ti0->whichTMU]=GL_FALSE;
if(ti1->baseLevelInternalFormat==GL_ALPHA)
- isalpha[ti1->tmi.whichTMU]=GL_TRUE;
+ isalpha[ti1->whichTMU]=GL_TRUE;
else
- isalpha[ti1->tmi.whichTMU]=GL_FALSE;
+ isalpha[ti1->whichTMU]=GL_FALSE;
if(isalpha[FX_TMU1])
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_ZERO,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXTRUE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_ZERO,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXTRUE,FXFALSE);
else
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
if(isalpha[FX_TMU0])
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ FXFALSE,FXFALSE);
else
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- FXFALSE,FXFALSE);
-
- grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- localc,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
-
- grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- locala,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ FXFALSE,FXFALSE);
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ locala,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
break;
}
case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */
- if(ti1->tmi.whichTMU==FX_TMU1) {
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXTRUE,FXFALSE);
+ if(ti1->whichTMU==FX_TMU1) {
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXTRUE,FXFALSE);
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ FXFALSE,FXFALSE);
} else {
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ FXFALSE,FXFALSE);
}
- grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- locala,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
-
- grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- localc,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ locala,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
break;
case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */
- if(ti1->tmi.whichTMU==FX_TMU1) {
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_ZERO,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXTRUE);
+ if(ti1->whichTMU==FX_TMU1) {
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_ZERO,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXTRUE);
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ FXFALSE,FXFALSE);
} else {
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,GR_COMBINE_FACTOR_ONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ FXFALSE,FXFALSE);
}
if(ti0->baseLevelInternalFormat==GL_RGB)
- grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- locala,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ locala,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
else
- grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- locala,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
-
-
- grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- localc,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ locala,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
break;
@@ -800,47 +903,56 @@ static void fxSetupTextureDoubleTMU(GLcontext *ctx)
GLboolean isalpha[FX_NUM_TMU];
if(ti0->baseLevelInternalFormat==GL_ALPHA)
- isalpha[ti0->tmi.whichTMU]=GL_TRUE;
+ isalpha[ti0->whichTMU]=GL_TRUE;
else
- isalpha[ti0->tmi.whichTMU]=GL_FALSE;
+ isalpha[ti0->whichTMU]=GL_FALSE;
if(ti1->baseLevelInternalFormat==GL_ALPHA)
- isalpha[ti1->tmi.whichTMU]=GL_TRUE;
+ isalpha[ti1->whichTMU]=GL_TRUE;
else
- isalpha[ti1->tmi.whichTMU]=GL_FALSE;
+ isalpha[ti1->whichTMU]=GL_FALSE;
if(isalpha[FX_TMU1])
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_ZERO,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXTRUE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_ZERO,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXTRUE,FXFALSE);
else
- grTexCombine(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,FXFALSE);
if(isalpha[FX_TMU0])
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,GR_COMBINE_FACTOR_ONE,
- FXFALSE,FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ FXFALSE,FXFALSE);
else
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,GR_COMBINE_FACTOR_ONE,
- FXFALSE,FXFALSE);
-
- grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- localc,
- GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
-
- grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- locala, GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ FXFALSE,FXFALSE);
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ locala,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
break;
}
@@ -853,7 +965,7 @@ static void fxSetupTextureDoubleTMU(GLcontext *ctx)
/************************* No Texture ***************************/
-static void fxSetupTextureNone(GLcontext *ctx)
+static void fxSetupTextureNone_NoLock(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GrCombineLocal_t localc,locala;
@@ -875,32 +987,26 @@ static void fxSetupTextureNone(GLcontext *ctx)
else
localc=GR_COMBINE_LOCAL_CONSTANT;
- grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- locala,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
-
- grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- localc,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ locala,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ localc,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
fxMesa->lastUnitsMode=FX_UM_NONE;
}
-/* See below.
- */
-static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint );
-
-
-
/************************************************************************/
/************************** Texture Mode SetUp **************************/
/************************************************************************/
-void fxSetupTexture(GLcontext *ctx)
+void fxSetupTexture_NoLock(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint tex2Denabled;
@@ -922,28 +1028,34 @@ void fxSetupTexture(GLcontext *ctx)
switch(tex2Denabled) {
case TEXTURE0_2D:
- fxSetupTextureSingleTMU(ctx,0);
+ fxSetupTextureSingleTMU_NoLock(ctx,0);
break;
case TEXTURE1_2D:
- fxSetupTextureSingleTMU(ctx,1);
+ fxSetupTextureSingleTMU_NoLock(ctx,1);
break;
case (TEXTURE0_2D|TEXTURE1_2D):
if (fxMesa->haveTwoTMUs)
- fxSetupTextureDoubleTMU(ctx);
+ fxSetupTextureDoubleTMU_NoLock(ctx);
else {
if (MESA_VERBOSE&VERBOSE_DRIVER)
fprintf(stderr, "fxmesa: enabling fake multitexture\n");
- fxSetupTextureSingleTMU(ctx,0);
+ fxSetupTextureSingleTMU_NoLock(ctx,0);
ctx->Driver.MultipassFunc = fxMultipassTexture;
}
break;
default:
- fxSetupTextureNone(ctx);
+ fxSetupTextureNone_NoLock(ctx);
break;
}
}
+void fxSetupTexture(GLcontext *ctx) {
+ BEGIN_BOARD_LOCK();
+ fxSetupTexture_NoLock(ctx);
+ END_BOARD_LOCK();
+}
+
/************************************************************************/
/**************************** Blend SetUp *******************************/
/************************************************************************/
@@ -1065,16 +1177,16 @@ void fxDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
}
}
-void fxSetupBlend(GLcontext *ctx)
+static void fxSetupBlend(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
tfxUnitsState *us=&fxMesa->unitsState;
if(us->blendEnabled)
- grAlphaBlendFunction(us->blendSrcFuncRGB,us->blendDstFuncRGB,
+ FX_grAlphaBlendFunction(us->blendSrcFuncRGB,us->blendDstFuncRGB,
us->blendSrcFuncAlpha,us->blendDstFuncAlpha);
else
- grAlphaBlendFunction(GR_BLEND_ONE,GR_BLEND_ZERO,GR_BLEND_ONE,GR_BLEND_ZERO);
+ FX_grAlphaBlendFunction(GR_BLEND_ONE,GR_BLEND_ZERO,GR_BLEND_ONE,GR_BLEND_ZERO);
}
/************************************************************************/
@@ -1138,10 +1250,10 @@ static void fxSetupAlphaTest(GLcontext *ctx)
tfxUnitsState *us=&fxMesa->unitsState;
if(us->alphaTestEnabled) {
- grAlphaTestFunction(us->alphaTestFunc);
- grAlphaTestReferenceValue(us->alphaTestRefValue);
+ FX_grAlphaTestFunction(us->alphaTestFunc);
+ FX_grAlphaTestReferenceValue(us->alphaTestRefValue);
} else
- grAlphaTestFunction(GR_CMP_ALWAYS);
+ FX_grAlphaTestFunction(GR_CMP_ALWAYS);
}
/************************************************************************/
@@ -1206,17 +1318,17 @@ void fxDDDepthMask(GLcontext *ctx, GLboolean flag)
}
}
-void fxSetupDepthTest(GLcontext *ctx)
+static void fxSetupDepthTest(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
tfxUnitsState *us=&fxMesa->unitsState;
if(us->depthTestEnabled)
- grDepthBufferFunction(us->depthTestFunc);
+ FX_grDepthBufferFunction(us->depthTestFunc);
else
- grDepthBufferFunction(GR_CMP_ALWAYS);
+ FX_grDepthBufferFunction(GR_CMP_ALWAYS);
- grDepthMask(us->depthMask);
+ FX_grDepthMask(us->depthMask);
}
/************************************************************************/
@@ -1238,7 +1350,7 @@ static void fxSetupColorMask(GLcontext *ctx)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
@@ -1250,7 +1362,7 @@ static void fxSetupColorMask(GLcontext *ctx)
/**************************** Fog Mode SetUp ****************************/
/************************************************************************/
-void fxFogTableGenerate(GLcontext *ctx)
+static void fxFogTableGenerate(GLcontext *ctx)
{
int i;
float f,eyez;
@@ -1278,20 +1390,20 @@ void fxFogTableGenerate(GLcontext *ctx)
}
}
-void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild)
+static void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
if(ctx->Fog.Enabled && ctx->FogMode==FOG_FRAGMENT) {
GLubyte col[4];
- grFogMode(GR_FOG_WITH_TABLE);
+ FX_grFogMode(GR_FOG_WITH_TABLE);
col[0]=(unsigned int)(255*ctx->Fog.Color[0]);
col[1]=(unsigned int)(255*ctx->Fog.Color[1]);
col[2]=(unsigned int)(255*ctx->Fog.Color[2]);
col[3]=(unsigned int)(255*ctx->Fog.Color[3]);
- grFogColorValue(FXCOLOR4(col));
+ FX_grFogColorValue(FXCOLOR4(col));
if(forceTableRebuild ||
(fxMesa->fogTableMode!=ctx->Fog.Mode) ||
@@ -1302,9 +1414,9 @@ void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild)
fxMesa->fogDensity=ctx->Fog.Density;
}
- grFogTable(fxMesa->fogTable);
+ FX_grFogTable(fxMesa->fogTable);
} else
- grFogMode(GR_FOG_DISABLE);
+ FX_grFogMode(GR_FOG_DISABLE);
}
void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
@@ -1317,26 +1429,47 @@ void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
/************************** Scissor Test SetUp **************************/
/************************************************************************/
-static void fxSetupScissor(GLcontext *ctx)
+/* This routine is used in managing the lock state, and therefore can't lock */
+void fxSetScissorValues(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
+ int xmin, xmax;
+ int ymin, ymax, check;
if (ctx->Scissor.Enabled) {
- int ymin, ymax;
-
+ xmin=ctx->Scissor.X;
+ xmax=ctx->Scissor.X+ctx->Scissor.Width;
ymin=ctx->Scissor.Y;
ymax=ctx->Scissor.Y+ctx->Scissor.Height;
+ check=1;
+ } else {
+ xmin=0;
+ ymin=0;
+ xmax=fxMesa->width;
+ ymax=fxMesa->height;
+ check=0;
+ }
+ xmin+=fxMesa->x_offset;
+ xmax+=fxMesa->x_offset;
+ ymin+=fxMesa->y_delta;
+ ymax+=fxMesa->y_delta;
+ if (xmin<fxMesa->clipMinX) xmin=fxMesa->clipMinX;
+ if (xmax>fxMesa->clipMaxX) xmax=fxMesa->clipMaxX;
+ if (ymin<fxMesa->screen_height-fxMesa->clipMaxY)
+ ymin=fxMesa->screen_height-fxMesa->clipMaxY;
+ if (ymax>fxMesa->screen_height-fxMesa->clipMinY)
+ ymax=fxMesa->screen_height-fxMesa->clipMinY;
+ FX_grClipWindow_NoLock(xmin, ymin, xmax, ymax);
+}
- if (ymin<0) ymin=0;
-
- if (ymax>fxMesa->height) ymax=fxMesa->height;
-
- grClipWindow(ctx->Scissor.X,
- ymin,
- ctx->Scissor.X+ctx->Scissor.Width,
- ymax);
- } else
- grClipWindow(0,0,fxMesa->width,fxMesa->height);
+static void fxSetupScissor(GLcontext *ctx)
+{
+ fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
+ if (!fxMesa->needClip) {
+ BEGIN_BOARD_LOCK();
+ fxSetScissorValues(ctx);
+ END_BOARD_LOCK();
+ }
}
void fxDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
@@ -1365,30 +1498,30 @@ void fxDDFrontFace(GLcontext *ctx, GLenum mode)
}
-void fxSetupCull(GLcontext *ctx)
+static void fxSetupCull(GLcontext *ctx)
{
if(ctx->Polygon.CullFlag) {
switch(ctx->Polygon.CullFaceMode) {
case GL_BACK:
if(ctx->Polygon.FrontFace==GL_CCW)
- grCullMode(GR_CULL_NEGATIVE);
+ FX_grCullMode(GR_CULL_NEGATIVE);
else
- grCullMode(GR_CULL_POSITIVE);
+ FX_grCullMode(GR_CULL_POSITIVE);
break;
case GL_FRONT:
if(ctx->Polygon.FrontFace==GL_CCW)
- grCullMode(GR_CULL_POSITIVE);
+ FX_grCullMode(GR_CULL_POSITIVE);
else
- grCullMode(GR_CULL_NEGATIVE);
+ FX_grCullMode(GR_CULL_NEGATIVE);
break;
case GL_FRONT_AND_BACK:
- grCullMode(GR_CULL_DISABLE);
+ FX_grCullMode(GR_CULL_DISABLE);
break;
default:
break;
}
} else
- grCullMode(GR_CULL_DISABLE);
+ FX_grCullMode(GR_CULL_DISABLE);
}
@@ -1540,7 +1673,7 @@ void fxDDShadeModel(GLcontext *ctx, GLenum mode)
/************************************************************************/
/****************************** Units SetUp *****************************/
/************************************************************************/
-void gl_print_fx_state_flags( const char *msg, GLuint flags )
+static void gl_print_fx_state_flags( const char *msg, GLuint flags )
{
fprintf(stderr,
"%s: (0x%x) %s%s%s%s%s%s%s\n",
@@ -1560,11 +1693,9 @@ void fxSetupFXUnits( GLcontext *ctx )
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint newstate = fxMesa->new_state;
-
if (MESA_VERBOSE&VERBOSE_DRIVER)
gl_print_fx_state_flags("fxmesa: fxSetupFXUnits", newstate);
-
if (newstate) {
if (newstate & FX_NEW_TEXTURING)
fxSetupTexture(ctx);
diff --git a/xc/extras/Mesa/src/FX/fxspan.c b/xc/extras/Mesa/src/FX/fxspan.c
index 29a2ac480..86a178bb3 100644
--- a/xc/extras/Mesa/src/FX/fxspan.c
+++ b/xc/extras/Mesa/src/FX/fxspan.c
@@ -1,27 +1,51 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxdd.c - 3Dfx VooDoo Mesa span and pixel functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * See the file fxapi.c for more informations about authors
+ * Thank you for your contribution, David!
*
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+/* fxdd.c - 3Dfx VooDoo Mesa span and pixel functions */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
diff --git a/xc/extras/Mesa/src/FX/fxstripdet.c b/xc/extras/Mesa/src/FX/fxstripdet.c
index 65a1d25ba..791546fdf 100644
--- a/xc/extras/Mesa/src/FX/fxstripdet.c
+++ b/xc/extras/Mesa/src/FX/fxstripdet.c
@@ -1,27 +1,48 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
/*
* Mesa 3-D graphics library
* Version: 3.1
- *
+ *
* Copyright (C) 1999 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -41,11 +62,11 @@
#define INIT(a)
-#define SENDTRI(u0,u1,u2) grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
+#define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
#define FLUSHTRI() /* No-Op */
#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); }
#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); }
-#define FLUSHSTRIPS() grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
+#define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
#define CLIPPED(a,b,c) 0
#define CULLED(a,b,c) 0
@@ -70,11 +91,11 @@
#define INIT(a)
-#define SENDTRI(u0,u1,u2) grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
+#define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
#define FLUSHTRI() /* No-Op */
#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); }
#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); }
-#define FLUSHSTRIPS() grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
+#define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2])
#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2])
@@ -103,11 +124,11 @@
#define INIT(a)
-#define SENDTRI(u0,u1,u2) grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
+#define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
#define FLUSHTRI() /* No-Op */
#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); }
#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); }
-#define FLUSHSTRIPS() grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
+#define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2])
#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2] & CLIP_ALL_BITS)
@@ -132,10 +153,12 @@
void fxDDRenderInitGlide3(GLcontext *ctx)
{
+#if 0
render_tab_fx_smooth_indirect[GL_TRIANGLES] = render_vb_triangles_smooth_indirect_sd_fx;
render_tab_fx_smooth_indirect_view_clipped[GL_TRIANGLES] = render_vb_triangles_smooth_indirect_sd_fx_view_clipped;
render_tab_fx_smooth_indirect_clipped[GL_TRIANGLES] = render_vb_triangles_smooth_indirect_sd_fx_clipped;
+#endif
}
-#endif /* defined(FX) && FX_GLIDE3 */ \ No newline at end of file
+#endif /* defined(FX) && FX_GLIDE3 */
diff --git a/xc/extras/Mesa/src/FX/fxtexman.c b/xc/extras/Mesa/src/FX/fxtexman.c
index 3f899cbf5..770f095ab 100644
--- a/xc/extras/Mesa/src/FX/fxtexman.c
+++ b/xc/extras/Mesa/src/FX/fxtexman.c
@@ -1,27 +1,51 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxtexman.c - 3Dfx VooDoo texture memory functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Thank you for your contribution, David!
*
- * See the file fxapi.c for more informations about authors
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+/* fxtexman.c - 3Dfx VooDoo texture memory functions */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -30,30 +54,81 @@
#include "fxdrv.h"
-static tfxTMFreeNode *fxTMNewTMFreeNode(FxU32 start, FxU32 end)
+#define FX_2MB_SPLIT 0x200000
+
+static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa,
+ int tmu);
+
+
+#if 0
+static void fubar()
{
- tfxTMFreeNode *tmn;
+}
- if(!(tmn=MALLOC(sizeof(tfxTMFreeNode)))) {
- fprintf(stderr,"fx Driver: out of memory !\n");
- fxCloseHardware();
- exit(-1);
+ /* Sanity Check */
+static void sanity(fxMesaContext fxMesa, int tmu)
+{
+ MemRange *tmp, *prev;
+ int i;
+
+ prev=0;
+ tmp = fxMesa->tmFree[tmu];
+ i=0;
+ while (tmp) {
+ fprintf(stderr, "TMU %d Sanity %d %d-%d\n", tmu, i,
+ tmp->startAddr, tmp->endAddr);
+ i++;
+ if (!tmp->startAddr && !tmp->endAddr) {
+ fprintf(stderr, "Textures fubar\n");
+ fubar();
+ }
+ if (tmp->startAddr>=tmp->endAddr) {
+ fprintf(stderr, "Node fubar\n");
+ fubar();
+ }
+ if (prev && (prev->startAddr>=tmp->startAddr ||
+ prev->endAddr>=tmp->startAddr)) {
+ fprintf(stderr, "Sorting fubar\n");
+ fubar();
+ }
+ prev=tmp;
+ tmp=tmp->next;
}
+}
+#endif
- tmn->next=NULL;
- tmn->startAddress=start;
- tmn->endAddress=end;
+static MemRange *fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end) {
+ MemRange *result=0;
- return tmn;
+ if (fxMesa->tmPool) {
+ result=fxMesa->tmPool;
+ fxMesa->tmPool=fxMesa->tmPool->next;
+ } else {
+ if (!(result=MALLOC(sizeof(MemRange)))) {
+ fprintf(stderr, "fxDriver: out of memory!\n");
+ fxCloseHardware();
+ exit(-1);
+ }
+ }
+ result->startAddr=start;
+ result->endAddr=end;
+ return result;
+}
+
+static void fxTMDeleteRangeNode(fxMesaContext fxMesa, MemRange *range)
+{
+ range->next=fxMesa->tmPool;
+ fxMesa->tmPool=range;
}
static void fxTMUInit(fxMesaContext fxMesa, int tmu)
{
- tfxTMFreeNode *tmn,*tmntmp;
+ MemRange *tmn, *last;
FxU32 start,end,blockstart,blockend;
- start=grTexMinAddress(tmu);
- end=grTexMaxAddress(tmu);
+ start=FX_grTexMinAddress(tmu);
+ end=FX_grTexMaxAddress(tmu);
+ fxMesa->texStart[tmu]=start;
if(fxMesa->verbose) {
fprintf(stderr,"%s configuration:",(tmu==FX_TMU0) ? "TMU0" : "TMU1");
@@ -64,169 +139,158 @@ static void fxTMUInit(fxMesaContext fxMesa, int tmu)
fxMesa->freeTexMem[tmu]=end-start;
fxMesa->tmFree[tmu]=NULL;
- fxMesa->tmAlloc[tmu]=NULL;
+ last=0;
blockstart=start;
- while(blockstart<=end) {
- if(blockstart+0x1fffff>end)
- blockend=end;
- else
- blockend=blockstart+0x1fffff;
+ while (blockstart<end) {
+ if (blockstart+FX_2MB_SPLIT>end) blockend=end;
+ else blockend=blockstart+FX_2MB_SPLIT;
if(fxMesa->verbose)
- fprintf(stderr," %07u-%07u\n",(unsigned int)blockstart,(unsigned int)blockend);
+ fprintf(stderr," %07u-%07u\n",
+ (unsigned int)blockstart,(unsigned int)blockend);
- tmn=fxTMNewTMFreeNode(blockstart,blockend);
+ tmn=fxTMNewRangeNode(fxMesa, blockstart, blockend);
+ tmn->next=0;
- if(fxMesa->tmFree[tmu]) {
- for(tmntmp=fxMesa->tmFree[tmu];tmntmp->next!=NULL;tmntmp=tmntmp->next){};
- tmntmp->next=tmn;
- } else
- fxMesa->tmFree[tmu]=tmn;
+ if (last) last->next=tmn;
+ else fxMesa->tmFree[tmu]=tmn;
+ last=tmn;
- blockstart+=0x1fffff+1;
+ blockstart+=FX_2MB_SPLIT;
}
}
-void fxTMInit(fxMesaContext fxMesa)
-{
- fxTMUInit(fxMesa,FX_TMU0);
-
- if(fxMesa->haveTwoTMUs)
- fxTMUInit(fxMesa,FX_TMU1);
-
- fxMesa->texBindNumber=0;
-}
-
-static struct gl_texture_object *fxTMFindOldestTMBlock(fxMesaContext fxMesa,
- tfxTMAllocNode *tmalloc,
- GLuint texbindnumber)
+static int fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
{
- GLuint age,oldestage,lasttimeused;
- struct gl_texture_object *oldesttexobj;
-
- (void)fxMesa;
- oldesttexobj=tmalloc->tObj;
- oldestage=0;
-
- while(tmalloc) {
- lasttimeused=((tfxTexInfo *)(tmalloc->tObj->DriverData))->tmi.lastTimeUsed;
-
- if(lasttimeused>texbindnumber)
- age=texbindnumber+(UINT_MAX-lasttimeused+1); /* TO DO: check */
- else
- age=texbindnumber-lasttimeused;
-
- if(age>=oldestage) {
- oldestage=age;
- oldesttexobj=tmalloc->tObj;
+ MemRange *prev, *tmp;
+ int result;
+ struct gl_texture_object *obj;
+
+ while (1) {
+ prev=0;
+ tmp=fxMesa->tmFree[tmu];
+ while (tmp) {
+ if (tmp->endAddr-tmp->startAddr>=size) { /* Fits here */
+ result=tmp->startAddr;
+ tmp->startAddr+=size;
+ if (tmp->startAddr==tmp->endAddr) { /* Empty */
+ if (prev) {
+ prev->next=tmp->next;
+ } else {
+ fxMesa->tmFree[tmu]=tmp->next;
+ }
+ fxTMDeleteRangeNode(fxMesa, tmp);
+ }
+ return result;
+ }
+ prev=tmp;
+ tmp=tmp->next;
}
-
- tmalloc=tmalloc->next;
+ /* No free space. Discard oldest */
+ obj=fxTMFindOldestObject(fxMesa, tmu);
+ if (!obj) {
+ fprintf(stderr, "fx Driver: No space for texture\n");
+ return -1;
+ }
+ fxTMMoveOutTM(fxMesa, obj);
}
-
- return oldesttexobj;
-}
-
-static GLboolean fxTMFreeOldTMBlock(fxMesaContext fxMesa, GLint tmu)
-{
- struct gl_texture_object *oldesttexobj;
-
- if(!fxMesa->tmAlloc[tmu])
- return GL_FALSE;
-
- oldesttexobj=fxTMFindOldestTMBlock(fxMesa,fxMesa->tmAlloc[tmu],fxMesa->texBindNumber);
-
- fxTMMoveOutTM(fxMesa,oldesttexobj);
-
- return GL_TRUE;
}
-static tfxTMFreeNode *fxTMExtractTMFreeBlock(tfxTMFreeNode *tmfree, int texmemsize,
- GLboolean *success, FxU32 *startadr)
+static void fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange *range)
{
- int blocksize;
-
- /* TO DO: cut recursion */
+ MemRange *tmp, *prev, *next;
- if(!tmfree) {
- *success=GL_FALSE;
- return NULL;
+ if (range->startAddr==range->endAddr) {
+ fxTMDeleteRangeNode(fxMesa, range);
+ return;
}
-
- blocksize=(int)tmfree->endAddress-(int)tmfree->startAddress+1;
-
- if(blocksize==texmemsize) {
- tfxTMFreeNode *nexttmfree;
-
- *success=GL_TRUE;
- *startadr=tmfree->startAddress;
-
- nexttmfree=tmfree->next;
- FREE(tmfree);
-
- return nexttmfree;
+ prev=0;
+ tmp=fxMesa->tmFree[tmu];
+ while (tmp) {
+ if (range->startAddr>tmp->startAddr) {
+ prev=tmp;
+ tmp=tmp->next;
+ } else break;
}
-
- if(blocksize>texmemsize) {
- *success=GL_TRUE;
- *startadr=tmfree->startAddress;
-
- tmfree->startAddress+=texmemsize;
-
- return tmfree;
+ /* When we create the regions, we make a split at the 2MB boundary.
+ Now we have to make sure we don't join those 2MB boundary regions
+ back together again. */
+ range->next=tmp;
+ if (tmp) {
+ if (range->endAddr==tmp->startAddr && tmp->startAddr&(FX_2MB_SPLIT-1)) {
+ /* Combine */
+ tmp->startAddr=range->startAddr;
+ fxTMDeleteRangeNode(fxMesa, range);
+ range=tmp;
+ }
+ }
+ if (prev) {
+ if (prev->endAddr==range->startAddr && range->startAddr&(FX_2MB_SPLIT-1)) {
+ /* Combine */
+ prev->endAddr=range->endAddr;
+ prev->next=range->next;
+ fxTMDeleteRangeNode(fxMesa, range);
+ } else prev->next=range;
+ } else {
+ fxMesa->tmFree[tmu]=range;
}
-
- tmfree->next=fxTMExtractTMFreeBlock(tmfree->next,texmemsize,success,startadr);
-
- return tmfree;
}
-static tfxTMAllocNode *fxTMGetTMBlock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
- GLint tmu, int texmemsize)
+static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa,
+ int tmu)
{
- tfxTMFreeNode *newtmfree;
- tfxTMAllocNode *newtmalloc;
- GLboolean success;
- FxU32 startadr;
-
- for(;;) { /* TO DO: improve performaces */
- newtmfree=fxTMExtractTMFreeBlock(fxMesa->tmFree[tmu],texmemsize,&success,&startadr);
-
- if(success) {
- fxMesa->tmFree[tmu]=newtmfree;
-
- fxMesa->freeTexMem[tmu]-=texmemsize;
-
- if(!(newtmalloc=MALLOC(sizeof(tfxTMAllocNode)))) {
- fprintf(stderr,"fx Driver: out of memory !\n");
- fxCloseHardware();
- exit(-1);
+ GLuint age, old, lasttime, bindnumber;
+ tfxTexInfo *info;
+ struct gl_texture_object *obj, *tmp;
+
+ tmp=fxMesa->glCtx->Shared->TexObjectList;
+ if (!tmp) return 0;
+ obj=0;
+ old=0;
+
+ bindnumber=fxMesa->texBindNumber;
+ while (tmp) {
+ info=fxTMGetTexInfo(tmp);
+
+ if (info && info->isInTM &&
+ (info->whichTMU==tmu || info->whichTMU==FX_TMU_BOTH ||
+ info->whichTMU==FX_TMU_SPLIT)) {
+ lasttime=info->lastTimeUsed;
+
+ if (lasttime>bindnumber)
+ age=bindnumber+(UINT_MAX-lasttime+1); /* TO DO: check wrap around */
+ else
+ age=bindnumber-lasttime;
+
+ if (age>=old) {
+ old=age;
+ obj=tmp;
}
-
- newtmalloc->next=fxMesa->tmAlloc[tmu];
- newtmalloc->startAddress=startadr;
- newtmalloc->endAddress=startadr+texmemsize-1;
- newtmalloc->tObj=tObj;
-
- fxMesa->tmAlloc[tmu]=newtmalloc;
-
- return newtmalloc;
- }
-
- if(!fxTMFreeOldTMBlock(fxMesa,tmu)) {
- fprintf(stderr,"fx Driver: internal error in fxTMGetTMBlock()\n");
- fprintf(stderr," TMU: %d Size: %d\n",tmu,texmemsize);
-
- fxCloseHardware();
- exit(-1);
}
+ tmp=tmp->Next;
}
+ return obj;
}
-void fxTMMoveInTM(fxMesaContext fxMesa, struct gl_texture_object *tObj, GLint where)
+static MemRange *fxTMAddObj(fxMesaContext fxMesa,
+ struct gl_texture_object *tObj,
+ GLint tmu, int texmemsize)
{
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ FxU32 startAddr;
+ MemRange *range;
+
+ startAddr=fxTMFindStartAddr(fxMesa, tmu, texmemsize);
+ if (startAddr<0) return 0;
+ range=fxTMNewRangeNode(fxMesa, startAddr, startAddr+texmemsize);
+ return range;
+}
+
+/* External Functions */
+
+void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, GLint where)
+{
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
int i,l;
int texmemsize;
@@ -236,54 +300,71 @@ void fxTMMoveInTM(fxMesaContext fxMesa, struct gl_texture_object *tObj, GLint wh
fxMesa->stats.reqTexUpload++;
- if(!ti->validated) {
+ if (!ti->validated) {
fprintf(stderr,"fx Driver: internal error in fxTMMoveInTM() -> not validated\n");
fxCloseHardware();
exit(-1);
}
- if(ti->tmi.isInTM)
- return;
+ if (ti->isInTM) return;
if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_TEXTURE)) {
fprintf(stderr,"fxmesa: downloading %x (%d) in texture memory in %d\n",(GLuint)tObj,tObj->Name,where);
}
- ti->tmi.whichTMU=(FxU32)where;
+ ti->whichTMU=(FxU32)where;
- switch(where) {
+ switch (where) {
case FX_TMU0:
case FX_TMU1:
- texmemsize=(int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,&(ti->info));
- ti->tmi.tm[where]=fxTMGetTMBlock(fxMesa,tObj,where,texmemsize);
+ texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
+ &(ti->info));
+ ti->tm[where]=fxTMAddObj(fxMesa, tObj, where, texmemsize);
fxMesa->stats.memTexUpload+=texmemsize;
- for(i=FX_largeLodValue(ti->info),l=ti->minLevel;i<=FX_smallLodValue(ti->info);i++,l++)
- grTexDownloadMipMapLevel(where,
- ti->tmi.tm[where]->startAddress,FX_valueToLod(i),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_BOTH,
- ti->tmi.mipmapLevel[l].data);
+ for (i=FX_largeLodValue(ti->info), l=ti->minLevel;
+ i<=FX_smallLodValue(ti->info);
+ i++,l++)
+ FX_grTexDownloadMipMapLevel_NoLock(where,
+ ti->tm[where]->startAddr,
+ FX_valueToLod(i),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_BOTH,
+ ti->mipmapLevel[l].data);
break;
case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
- texmemsize=(int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_ODD,&(ti->info));
- ti->tmi.tm[FX_TMU0]=fxTMGetTMBlock(fxMesa,tObj,FX_TMU0,texmemsize);
+ texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD,
+ &(ti->info));
+ ti->tm[FX_TMU0]=fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize);
fxMesa->stats.memTexUpload+=texmemsize;
- texmemsize=(int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_EVEN,&(ti->info));
- ti->tmi.tm[FX_TMU1]=fxTMGetTMBlock(fxMesa,tObj,FX_TMU1,texmemsize);
+ texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_EVEN,
+ &(ti->info));
+ ti->tm[FX_TMU1]=fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize);
fxMesa->stats.memTexUpload+=texmemsize;
- for(i=FX_largeLodValue(ti->info),l=ti->minLevel;i<=FX_smallLodValue(ti->info);i++,l++) {
- grTexDownloadMipMapLevel(GR_TMU0,ti->tmi.tm[FX_TMU0]->startAddress,FX_valueToLod(i),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_ODD,
- ti->tmi.mipmapLevel[l].data);
-
- grTexDownloadMipMapLevel(GR_TMU1,ti->tmi.tm[FX_TMU1]->startAddress,FX_valueToLod(i),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_EVEN,
- ti->tmi.mipmapLevel[l].data);
+ for (i=FX_largeLodValue(ti->info),l=ti->minLevel;
+ i<=FX_smallLodValue(ti->info);
+ i++,l++) {
+ FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,
+ ti->tm[FX_TMU0]->startAddr,
+ FX_valueToLod(i),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_ODD,
+ ti->mipmapLevel[l].data);
+
+ FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1,
+ ti->tm[FX_TMU1]->startAddr,
+ FX_valueToLod(i),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_EVEN,
+ ti->mipmapLevel[l].data);
}
break;
default:
@@ -294,48 +375,63 @@ void fxTMMoveInTM(fxMesaContext fxMesa, struct gl_texture_object *tObj, GLint wh
fxMesa->stats.texUpload++;
- ti->tmi.isInTM=GL_TRUE;
+ ti->isInTM=GL_TRUE;
+}
+
+void fxTMMoveInTM(fxMesaContext fxMesa, struct gl_texture_object *tObj, GLint where) {
+ BEGIN_BOARD_LOCK();
+ fxTMMoveInTM_NoLock(fxMesa, tObj, where);
+ END_BOARD_LOCK();
}
void fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj, GLint level)
{
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
GrLOD_t lodlevel;
GLint tmu;
- if(!ti->validated) {
+ if (!ti->validated) {
fprintf(stderr,"fx Driver: internal error in fxTMReloadMipMapLevel() -> not validated\n");
fxCloseHardware();
exit(-1);
}
- tmu=(int)ti->tmi.whichTMU;
- fxTMMoveInTM(fxMesa,tObj,tmu);
+ tmu=(int)ti->whichTMU;
+ fxTMMoveInTM(fxMesa, tObj, tmu);
- fxTexGetInfo(ti->tmi.mipmapLevel[0].width,ti->tmi.mipmapLevel[0].height,
- &lodlevel,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+ fxTexGetInfo(ti->mipmapLevel[0].width,ti->mipmapLevel[0].height,
+ &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
switch(tmu) {
case FX_TMU0:
case FX_TMU1:
- grTexDownloadMipMapLevel(tmu,
- ti->tmi.tm[tmu]->startAddress,FX_valueToLod(FX_lodToValue(lodlevel)+level),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_BOTH,
- ti->tmi.mipmapLevel[level].data);
+ FX_grTexDownloadMipMapLevel(tmu,
+ ti->tm[tmu]->startAddr,
+ FX_valueToLod(FX_lodToValue(lodlevel)+level),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_BOTH,
+ ti->mipmapLevel[level].data);
break;
case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
- grTexDownloadMipMapLevel(GR_TMU0,
- ti->tmi.tm[GR_TMU0]->startAddress,FX_valueToLod(FX_lodToValue(lodlevel)+level),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_ODD,
- ti->tmi.mipmapLevel[level].data);
+ FX_grTexDownloadMipMapLevel(GR_TMU0,
+ ti->tm[GR_TMU0]->startAddr,
+ FX_valueToLod(FX_lodToValue(lodlevel)+level),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_ODD,
+ ti->mipmapLevel[level].data);
- grTexDownloadMipMapLevel(GR_TMU1,
- ti->tmi.tm[GR_TMU1]->startAddress,FX_valueToLod(FX_lodToValue(lodlevel)+level),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_EVEN,
- ti->tmi.mipmapLevel[level].data);
+ FX_grTexDownloadMipMapLevel(GR_TMU1,
+ ti->tm[GR_TMU1]->startAddr,
+ FX_valueToLod(FX_lodToValue(lodlevel)+level),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_EVEN,
+ ti->mipmapLevel[level].data);
break;
default:
fprintf(stderr,"fx Driver: internal error in fxTMReloadMipMapLevel() -> wrong tmu (%d)\n",tmu);
@@ -344,10 +440,11 @@ void fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
}
}
-void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
+void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
+ struct gl_texture_object *tObj,
GLint level, GLint yoffset, GLint height)
{
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
GrLOD_t lodlevel;
unsigned short *data;
GLint tmu;
@@ -358,43 +455,52 @@ void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tO
exit(-1);
}
- tmu=(int)ti->tmi.whichTMU;
- fxTMMoveInTM(fxMesa,tObj,tmu);
+ tmu=(int)ti->whichTMU;
+ fxTMMoveInTM(fxMesa, tObj, tmu);
- fxTexGetInfo(ti->tmi.mipmapLevel[0].width,ti->tmi.mipmapLevel[0].height,
- &lodlevel,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+ fxTexGetInfo(ti->mipmapLevel[0].width, ti->mipmapLevel[0].height,
+ &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if((ti->info.format==GR_TEXFMT_INTENSITY_8) ||
(ti->info.format==GR_TEXFMT_P_8) ||
(ti->info.format==GR_TEXFMT_ALPHA_8))
- data=ti->tmi.mipmapLevel[level].data+((yoffset*ti->tmi.mipmapLevel[level].width)>>1);
+ data=ti->mipmapLevel[level].data+((yoffset*ti->mipmapLevel[level].width)>>1);
else
- data=ti->tmi.mipmapLevel[level].data+yoffset*ti->tmi.mipmapLevel[level].width;
+ data=ti->mipmapLevel[level].data+yoffset*ti->mipmapLevel[level].width;
switch(tmu) {
case FX_TMU0:
case FX_TMU1:
- grTexDownloadMipMapLevelPartial(tmu,
- ti->tmi.tm[tmu]->startAddress,FX_valueToLod(FX_lodToValue(lodlevel)+level),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_BOTH,
- data,
- yoffset,yoffset+height-1);
+ FX_grTexDownloadMipMapLevelPartial(tmu,
+ ti->tm[tmu]->startAddr,
+ FX_valueToLod(FX_lodToValue(lodlevel)+level),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_BOTH,
+ data,
+ yoffset,yoffset+height-1);
break;
case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
- grTexDownloadMipMapLevelPartial(GR_TMU0,
- ti->tmi.tm[FX_TMU0]->startAddress,FX_valueToLod(FX_lodToValue(lodlevel)+level),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_ODD,
- data,
- yoffset,yoffset+height-1);
-
- grTexDownloadMipMapLevelPartial(GR_TMU1,
- ti->tmi.tm[FX_TMU1]->startAddress,FX_valueToLod(FX_lodToValue(lodlevel)+level),
- FX_largeLodLog2(ti->info),FX_aspectRatioLog2(ti->info),
- ti->info.format,GR_MIPMAPLEVELMASK_EVEN,
- data,
- yoffset,yoffset+height-1);
+ FX_grTexDownloadMipMapLevelPartial(GR_TMU0,
+ ti->tm[FX_TMU0]->startAddr,
+ FX_valueToLod(FX_lodToValue(lodlevel)+level),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_ODD,
+ data,
+ yoffset,yoffset+height-1);
+
+ FX_grTexDownloadMipMapLevelPartial(GR_TMU1,
+ ti->tm[FX_TMU1]->startAddr,
+ FX_valueToLod(FX_lodToValue(lodlevel)+level),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_EVEN,
+ data,
+ yoffset,yoffset+height-1);
break;
default:
fprintf(stderr,"fx Driver: internal error in fxTMReloadSubMipMapLevel() -> wrong tmu (%d)\n",tmu);
@@ -403,103 +509,24 @@ void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tO
}
}
-static tfxTMAllocNode *fxTMFreeTMAllocBlock(tfxTMAllocNode *tmalloc,
- tfxTMAllocNode *tmunalloc)
-{
- if(!tmalloc)
- return NULL;
-
- if(tmalloc==tmunalloc) {
- tfxTMAllocNode *newtmalloc;
-
- newtmalloc=tmalloc->next;
- FREE(tmalloc);
-
- return newtmalloc;
- }
-
- tmalloc->next=fxTMFreeTMAllocBlock(tmalloc->next,tmunalloc);
-
- return tmalloc;
-}
-
-static tfxTMFreeNode *fxTMAddTMFree(tfxTMFreeNode *tmfree, FxU32 startadr, FxU32 endadr)
-{
- if(!tmfree)
- return fxTMNewTMFreeNode(startadr,endadr);
-
- if((endadr+1==tmfree->startAddress) && (tmfree->startAddress & 0x1fffff)) {
- tmfree->startAddress=startadr;
-
- return tmfree;
- }
-
- if((startadr-1==tmfree->endAddress) && (startadr & 0x1fffff)) {
- tmfree->endAddress=endadr;
-
- if((tmfree->next && (endadr+1==tmfree->next->startAddress) &&
- (tmfree->next->startAddress & 0x1fffff))) {
- tfxTMFreeNode *nexttmfree;
-
- tmfree->endAddress=tmfree->next->endAddress;
-
- nexttmfree=tmfree->next->next;
- FREE(tmfree->next);
-
- tmfree->next=nexttmfree;
- }
-
-
- return tmfree;
- }
-
- if(startadr<tmfree->startAddress) {
- tfxTMFreeNode *newtmfree;
-
- newtmfree=fxTMNewTMFreeNode(startadr,endadr);
- newtmfree->next=tmfree;
-
- return newtmfree;
- }
-
- tmfree->next=fxTMAddTMFree(tmfree->next,startadr,endadr);
-
- return tmfree;
-}
-
-static void fxTMFreeTMBlock(fxMesaContext fxMesa, GLint tmu, tfxTMAllocNode *tmalloc)
-{
- FxU32 startadr,endadr;
-
- startadr=tmalloc->startAddress;
- endadr=tmalloc->endAddress;
-
- fxMesa->tmAlloc[tmu]=fxTMFreeTMAllocBlock(fxMesa->tmAlloc[tmu],tmalloc);
-
- fxMesa->tmFree[tmu]=fxTMAddTMFree(fxMesa->tmFree[tmu],startadr,endadr);
-
- fxMesa->freeTexMem[tmu]+=endadr-startadr+1;
-}
-
void fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxTMMoveOutTM(%x (%d))\n",(GLuint)tObj,tObj->Name);
}
- if(!ti->tmi.isInTM)
- return;
+ if (!ti->isInTM) return;
- switch(ti->tmi.whichTMU) {
+ switch(ti->whichTMU) {
case FX_TMU0:
case FX_TMU1:
- fxTMFreeTMBlock(fxMesa,(int)ti->tmi.whichTMU,ti->tmi.tm[ti->tmi.whichTMU]);
+ fxTMRemoveRange(fxMesa, (int)ti->whichTMU, ti->tm[ti->whichTMU]);
break;
case FX_TMU_SPLIT:
- fxTMFreeTMBlock(fxMesa,FX_TMU0,ti->tmi.tm[FX_TMU0]);
- fxTMFreeTMBlock(fxMesa,FX_TMU1,ti->tmi.tm[FX_TMU1]);
+ fxTMRemoveRange(fxMesa, FX_TMU0, ti->tm[FX_TMU0]);
+ fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
break;
default:
fprintf(stderr,"fx Driver: internal error in fxTMMoveOutTM()\n");
@@ -507,62 +534,163 @@ void fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
exit(-1);
}
- ti->tmi.whichTMU=FX_TMU_NONE;
- ti->tmi.isInTM=GL_FALSE;
+ ti->isInTM=GL_FALSE;
+ ti->whichTMU=FX_TMU_NONE;
}
void fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
int i;
- fxTMMoveOutTM(fxMesa,tObj);
+ fxTMMoveOutTM(fxMesa, tObj);
- for(i=0;i<MAX_TEXTURE_LEVELS;i++) {
- if(ti->tmi.mipmapLevel[i].used &&
- ti->tmi.mipmapLevel[i].translated)
- FREE(ti->tmi.mipmapLevel[i].data);
+ for(i=0; i<MAX_TEXTURE_LEVELS; i++) {
+ if (ti->mipmapLevel[i].used &&
+ ti->mipmapLevel[i].translated)
+ FREE(ti->mipmapLevel[i].data);
- (void)ti->tmi.mipmapLevel[i].data;
+ (void)ti->mipmapLevel[i].data;
+ }
+ switch (ti->whichTMU) {
+ case FX_TMU0:
+ fxTMDeleteRangeNode(fxMesa, ti->tm[ti->whichTMU]);
+ break;
+ case FX_TMU_SPLIT:
+ case FX_TMU_BOTH:
+ fxTMDeleteRangeNode(fxMesa, ti->tm[FX_TMU0]);
+ fxTMDeleteRangeNode(fxMesa, ti->tm[FX_TMU1]);
+ break;
}
}
-void fxTMFreeAllFreeNode(tfxTMFreeNode *fn)
+void fxTMInit(fxMesaContext fxMesa)
{
- if(!fn)
- return;
+ fxTMUInit(fxMesa,FX_TMU0);
- if(fn->next)
- fxTMFreeAllFreeNode(fn->next);
+ if(fxMesa->haveTwoTMUs)
+ fxTMUInit(fxMesa,FX_TMU1);
- FREE(fn);
+ fxMesa->texBindNumber=0;
}
-void fxTMFreeAllAllocNode(tfxTMAllocNode *an)
+void fxTMClose(fxMesaContext fxMesa)
{
- if(!an)
- return;
-
- if(an->next)
- fxTMFreeAllAllocNode(an->next);
+ MemRange *tmp, *next;
- FREE(an);
+ tmp=fxMesa->tmPool;
+ while (tmp) {
+ next=tmp->next;
+ FREE(tmp);
+ tmp=next;
+ }
+ tmp=fxMesa->tmFree[FX_TMU0];
+ while (tmp) {
+ next=tmp->next;
+ FREE(tmp);
+ tmp=next;
+ }
+ if (fxMesa->haveTwoTMUs) {
+ tmp=fxMesa->tmFree[FX_TMU1];
+ while (tmp) {
+ next=tmp->next;
+ FREE(tmp);
+ tmp=next;
+ }
+ }
}
-void fxTMClose(fxMesaContext fxMesa)
+void fxTMRestore_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
- fxTMFreeAllFreeNode(fxMesa->tmFree[FX_TMU0]);
- fxTMFreeAllAllocNode(fxMesa->tmAlloc[FX_TMU0]);
- fxMesa->tmFree[FX_TMU0] = NULL;
- fxMesa->tmAlloc[FX_TMU0] = NULL;
- if(fxMesa->haveTwoTMUs) {
- fxTMFreeAllFreeNode(fxMesa->tmFree[FX_TMU1]);
- fxTMFreeAllAllocNode(fxMesa->tmAlloc[FX_TMU1]);
- fxMesa->tmFree[FX_TMU1] = NULL;
- fxMesa->tmAlloc[FX_TMU1] = NULL;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
+ int i,l, where;
+
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
+ fprintf(stderr,"fxmesa: fxRestore(%d)\n",tObj->Name);
+ }
+
+ if (!ti->validated) {
+ fprintf(stderr,"fxDriver: internal error in fxRestore -> not validated\n");
+ fxCloseHardware();
+ exit(-1);
+ }
+
+ where=ti->whichTMU;
+ if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_TEXTURE)) {
+ fprintf(stderr,"fxmesa: reloading %x (%d) in texture memory in %d\n",
+ (GLuint)tObj, tObj->Name, where);
+ }
+
+ switch(where) {
+ case FX_TMU0:
+ case FX_TMU1:
+ for (i=FX_largeLodValue_NoLock(ti->info), l=ti->minLevel;
+ i<=FX_smallLodValue_NoLock(ti->info);
+ i++,l++)
+ if (ti->mipmapLevel[l].data)
+ FX_grTexDownloadMipMapLevel_NoLock(where,
+ ti->tm[where]->startAddr,
+ FX_valueToLod(i),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_BOTH,
+ ti->mipmapLevel[l].data);
+ break;
+ case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */
+ for (i=FX_largeLodValue_NoLock(ti->info),l=ti->minLevel;
+ i<=FX_smallLodValue_NoLock(ti->info);
+ i++,l++) {
+ if (ti->mipmapLevel[l].data)
+ FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,
+ ti->tm[FX_TMU0]->startAddr,
+ FX_valueToLod(i),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_ODD,
+ ti->mipmapLevel[l].data);
+ if (ti->mipmapLevel[l].data)
+ FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1,
+ ti->tm[FX_TMU1]->startAddr,
+ FX_valueToLod(i),
+ FX_largeLodLog2(ti->info),
+ FX_aspectRatioLog2(ti->info),
+ ti->info.format,
+ GR_MIPMAPLEVELMASK_EVEN,
+ ti->mipmapLevel[l].data);
+ }
+ break;
+ default:
+ fprintf(stderr,"fxDriver: internal error in fxRestore -> bad tmu (%d)\n",
+ where);
+ fxCloseHardware();
+ exit(-1);
}
}
+void
+fxTMRestoreTextures(fxMesaContext ctx) {
+ tfxTexInfo *ti;
+ struct gl_texture_object *tObj;
+ int i;
+
+ tObj=ctx->glCtx->Shared->TexObjectList;
+ while (tObj) {
+ ti=fxTMGetTexInfo(tObj);
+ if (ti && ti->isInTM) {
+ for (i=0; i<MAX_TEXTURE_UNITS; i++)
+ if (ctx->glCtx->Texture.Unit[i].Current==tObj) {
+ /* Force the texture onto the board, as it could be in use */
+ fxTMRestore_NoLock(ctx, tObj);
+ break;
+ }
+ if (i==MAX_TEXTURE_UNITS) /* Mark the texture as off the board */
+ fxTMMoveOutTM(ctx, tObj);
+ }
+ tObj=tObj->Next;
+ }
+}
#else
diff --git a/xc/extras/Mesa/src/FX/fxtrifuncs.c b/xc/extras/Mesa/src/FX/fxtrifuncs.c
index dd42e8d83..1d597608c 100644
--- a/xc/extras/Mesa/src/FX/fxtrifuncs.c
+++ b/xc/extras/Mesa/src/FX/fxtrifuncs.c
@@ -1,27 +1,51 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxtris.c - 3Dfx VooDoo triangle functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * See the file fxapi.c for more informations about authors
+ * Thank you for your contribution, David!
*
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+/* fxtris.c - 3Dfx VooDoo triangle functions */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -241,7 +265,7 @@ void fxDDChooseRenderState( GLcontext *ctx )
if (flags) {
if (fxMesa->render_index & FX_OFFSET)
- grDepthBiasLevel(0);
+ FX_grDepthBiasLevel(0);
if (flags & (DD_SELECT|DD_FEEDBACK)) {
fxMesa->PointsFunc = 0;
@@ -261,7 +285,7 @@ void fxDDChooseRenderState( GLcontext *ctx )
fxMesa->render_index = ind;
fxMesa->PointsFunc = points_tab[ind];
- if (ind & FX_FALLBACK)
+ if (ind&FX_FALLBACK)
ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE;
ind &= ~(FX_ANTIALIAS|FX_FALLBACK);
@@ -270,7 +294,7 @@ void fxDDChooseRenderState( GLcontext *ctx )
fxMesa->render_index |= ind;
fxMesa->LineFunc = line_tab[ind];
- if (ind & FX_FALLBACK)
+ if (ind&FX_FALLBACK)
ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE;
ind &= ~(FX_ANTIALIAS|FX_FALLBACK);
@@ -282,13 +306,13 @@ void fxDDChooseRenderState( GLcontext *ctx )
fxMesa->TriangleFunc = tri_tab[ind];
fxMesa->QuadFunc = quad_tab[ind];
- if (ind & FX_FALLBACK)
- ctx->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE);
+ if (ind&FX_FALLBACK)
+ ctx->IndirectTriangles |= DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE;
}
else if (fxMesa->render_index)
{
if (fxMesa->render_index & FX_OFFSET)
- grDepthBiasLevel(0);
+ FX_grDepthBiasLevel(0);
fxMesa->render_index = 0;
fxMesa->PointsFunc = points_tab[0];
diff --git a/xc/extras/Mesa/src/FX/fxtritmp.h b/xc/extras/Mesa/src/FX/fxtritmp.h
index 4e6bf78db..9ea386a80 100644
--- a/xc/extras/Mesa/src/FX/fxtritmp.h
+++ b/xc/extras/Mesa/src/FX/fxtritmp.h
@@ -1,3 +1,48 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
+
static void TAG(fx_tri)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint pv)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
@@ -53,7 +98,7 @@ static void TAG(fx_tri)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint
/* Probably a lot quicker just to nudge the z values and put
* them back afterwards.
*/
- grDepthBiasLevel((int)offset);
+ FX_grDepthBiasLevel((int)offset);
}
}
else if (IND & FX_FLAT) {
@@ -62,36 +107,36 @@ static void TAG(fx_tri)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint
}
if (IND & FX_FRONT_BACK) {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
FXFALSE);
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask(FXFALSE);
+ FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
}
if (IND & FX_ANTIALIAS)
- grAADrawTriangle(v1, v2, v3, FXTRUE, FXTRUE, FXTRUE);
+ FX_grAADrawTriangle(v1, v2, v3, FXTRUE, FXTRUE, FXTRUE);
else
- grDrawTriangle(v1, v2, v3);
+ FX_grDrawTriangle(v1, v2, v3);
/* Might be quicker to do two passes, one for each buffer?
*/
if (IND & FX_FRONT_BACK) {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
- if(ctx->Depth.Mask) grDepthMask(FXTRUE);
+ if(ctx->Depth.Mask) FX_grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (IND & FX_ANTIALIAS)
- grAADrawTriangle(v1,v2,v3, FXTRUE,FXTRUE,FXTRUE);
+ FX_grAADrawTriangle(v1,v2,v3, FXTRUE,FXTRUE,FXTRUE);
else
- grDrawTriangle(v1, v2, v3);
+ FX_grDrawTriangle(v1, v2, v3);
}
}
@@ -156,7 +201,7 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3,
/* Probably a lot quicker just to nudge the z values and put
* them back afterwards.
*/
- grDepthBiasLevel((int)offset);
+ FX_grDepthBiasLevel((int)offset);
}
}
else if (IND & FX_FLAT) {
@@ -165,41 +210,41 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3,
}
if (IND & FX_FRONT_BACK) {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
FXFALSE);
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask(FXFALSE);
+ FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
}
if (IND & FX_ANTIALIAS) {
- grAADrawTriangle(v1, v2, v4, FXTRUE, FXTRUE, FXTRUE);
- grAADrawTriangle(v2, v3, v4, FXTRUE, FXTRUE, FXTRUE);
+ FX_grAADrawTriangle(v1, v2, v4, FXTRUE, FXTRUE, FXTRUE);
+ FX_grAADrawTriangle(v2, v3, v4, FXTRUE, FXTRUE, FXTRUE);
} else {
- grDrawTriangle(v1, v2, v4);
- grDrawTriangle(v2, v3, v4);
+ FX_grDrawTriangle(v1, v2, v4);
+ FX_grDrawTriangle(v2, v3, v4);
}
/* Might be quicker to do two passes, one for each buffer?
*/
if (IND & FX_FRONT_BACK) {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
- if(ctx->Depth.Mask) grDepthMask(FXTRUE);
+ if(ctx->Depth.Mask) FX_grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (IND & FX_ANTIALIAS) {
- grAADrawTriangle(v1, v2, v4, FXTRUE, FXTRUE, FXTRUE);
- grAADrawTriangle(v2, v3, v4, FXTRUE, FXTRUE, FXTRUE);
+ FX_grAADrawTriangle(v1, v2, v4, FXTRUE, FXTRUE, FXTRUE);
+ FX_grAADrawTriangle(v2, v3, v4, FXTRUE, FXTRUE, FXTRUE);
} else {
- grDrawTriangle(v1, v2, v4);
- grDrawTriangle(v2, v3, v4);
+ FX_grDrawTriangle(v1, v2, v4);
+ FX_grDrawTriangle(v2, v3, v4);
}
}
}
@@ -239,35 +284,35 @@ static void TAG(fx_line)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint pv)
}
if (IND & FX_FRONT_BACK) {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
FXFALSE);
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask(FXFALSE);
+ FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
}
if (IND & FX_ANTIALIAS)
FX_grAADrawLine(v1,v2);
else
- grDrawLine(v1,v2);
+ FX_grDrawLine(v1,v2);
if (IND & FX_FRONT_BACK)
{
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
if(ctx->Depth.Mask)
- grDepthMask(FXTRUE);
+ FX_grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (IND & FX_ANTIALIAS)
FX_grAADrawLine(v1,v2);
else
- grDrawLine(v1,v2);
+ FX_grDrawLine(v1,v2);
}
}
#endif
@@ -293,7 +338,7 @@ static void TAG(fx_line)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint pv)
#if IND & FX_ANTIALIAS
#define DRAW_POINT(i) FX_grAADrawPoint((GrVertex *)gWin[i].f);
#else
-#define DRAW_POINT(i) grDrawPoint((GrVertex *)gWin[i].f);
+#define DRAW_POINT(i) FX_grDrawPoint((GrVertex *)gWin[i].f);
#endif
@@ -308,13 +353,13 @@ static void TAG(fx_points)(GLcontext *ctx, GLuint first, GLuint last)
(void) color; (void) fxMesa;
if (IND & FX_FRONT_BACK) {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
FXFALSE);
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask(FXFALSE);
+ FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
}
if(!VB->ClipOrMask) {
@@ -332,13 +377,13 @@ static void TAG(fx_points)(GLcontext *ctx, GLuint first, GLuint last)
}
if (IND & FX_FRONT_BACK) {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
+ FX_grColorMask(ctx->Color.ColorMask[RCOMP] ||
ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
if(ctx->Depth.Mask)
- grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ FX_grDepthMask(FXTRUE);
+ FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if(!VB->ClipOrMask) {
diff --git a/xc/extras/Mesa/src/FX/fxvs_tmp.h b/xc/extras/Mesa/src/FX/fxvs_tmp.h
index 0b7c2eb26..b2371b04f 100644
--- a/xc/extras/Mesa/src/FX/fxvs_tmp.h
+++ b/xc/extras/Mesa/src/FX/fxvs_tmp.h
@@ -1,3 +1,47 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
#if (IND & (SETUP_XY|SETUP_W|SETUP_Z))
#define V1 VARS_XY
diff --git a/xc/extras/Mesa/src/FX/fxvsetup.c b/xc/extras/Mesa/src/FX/fxvsetup.c
index c22ef2fa3..2489a4172 100644
--- a/xc/extras/Mesa/src/FX/fxvsetup.c
+++ b/xc/extras/Mesa/src/FX/fxvsetup.c
@@ -1,27 +1,51 @@
-/* -*- mode: C; tab-width:8; -*-
-
- fxvsetup.c - 3Dfx VooDoo vertices setup functions
-*/
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Thank you for your contribution, David!
*
- * See the file fxapi.c for more informations about authors
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
+/* fxvsetup.c - 3Dfx VooDoo vertices setup functions */
+
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@@ -258,7 +282,7 @@ void fxDDSetupInit( void )
tfxSetupFunc fxDDChooseSetupFunction(GLcontext *ctx)
{
- GLuint setupindex = SETUP_XY;
+ GLuint setupindex = SETUP_XY|SETUP_Z;
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
fxMesa->setupindex = 0;
@@ -290,11 +314,11 @@ tfxSetupFunc fxDDChooseSetupFunction(GLcontext *ctx)
{
if (setupindex & SETUP_TMU0) {
struct gl_texture_object *tObj=ctx->Texture.Unit[0].CurrentD[2];
- tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
+ tfxTexInfo *ti=fxTMGetTexInfo(tObj);
setupindex |= SETUP_TMU1|SETUP_W;
- if(ti->tmi.whichTMU!=FX_TMU0) {
+ if(ti->whichTMU!=FX_TMU0) {
fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0;
fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1;
}
@@ -309,10 +333,7 @@ tfxSetupFunc fxDDChooseSetupFunction(GLcontext *ctx)
if (ctx->Color.BlendEnabled)
setupindex |= SETUP_RGBA;
- if (ctx->Depth.Test)
- setupindex |= SETUP_Z;
-
- if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE))
+ if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_STATE))
fxPrintSetupFlags("fxmesa: vertex setup function", setupindex);
fxMesa->setupindex = setupindex;
diff --git a/xc/extras/Mesa/src/FX/fxvsetup.h b/xc/extras/Mesa/src/FX/fxvsetup.h
index cf2ba5a35..c99ca28e1 100644
--- a/xc/extras/Mesa/src/FX/fxvsetup.h
+++ b/xc/extras/Mesa/src/FX/fxvsetup.h
@@ -1,3 +1,48 @@
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
+
#ifndef _FXVSETUP_H_
#define _FXVSETUP_H_
@@ -40,6 +85,11 @@
v[XCOORD]=win[0]; \
v[YCOORD]=win[1];
#else
+#ifdef DRIVERTS
+# define DO_SETUP_XY \
+ v[XCOORD]=win[0]+fxMesa->x_offset; \
+ v[YCOORD]=win[1]+fxMesa->y_delta;
+#else
# if (defined(__linux__) && defined(__i386__)) || defined(macintosh)
# define DO_SETUP_XY { \
GLfloat t1 = win[0] + snapper; \
@@ -55,7 +105,7 @@
}
# endif
#endif
-
+#endif
#define DO_SETUP_W { \
diff --git a/xc/extras/Mesa/src/FX/fxwgl.c b/xc/extras/Mesa/src/FX/fxwgl.c
index c1db7b88b..e7d0be665 100644
--- a/xc/extras/Mesa/src/FX/fxwgl.c
+++ b/xc/extras/Mesa/src/FX/fxwgl.c
@@ -1,26 +1,54 @@
-/* fxwgl.c - Microsoft wgl functions emulation for
- * 3Dfx VooDoo/Mesa interface
- */
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ *
+ * Copyright (C) 1999 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Thank you for your contribution, David!
*
- * See the file fxapi.c for more informations about authors
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
*
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <daryll@precisioninsight.com>
+ * Keith Whitwell <keith@precisioninsight.com>
+ *
+ * See fxapi.h for more revision/author details.
+ */
+
+
+
+/* fxwgl.c - Microsoft wgl functions emulation for
+ * 3Dfx VooDoo/Mesa interface
*/
+
#ifdef __WIN32__
#ifdef __cplusplus
@@ -243,11 +271,11 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
static int moving = 0;
if (!moving) {
if(fxQueryHardware()!=GR_SSTTYPE_VOODOO) {
- if(!grSstControl(GR_CONTROL_RESIZE)) {
+ if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
moving = 1;
SetWindowPos(hwnd, 0, 0, 0, 300, 300, SWP_NOMOVE|SWP_NOZORDER);
moving = 0;
- if(!grSstControl(GR_CONTROL_RESIZE)) {
+ if(!FX_grSstControl(GR_CONTROL_RESIZE)) {
/*MessageBox(0,_T("Error changing windowsize"),_T("fxMESA"),MB_OK);*/
PostMessage(hWND,WM_CLOSE,0,0);
}
@@ -255,7 +283,7 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
}
/* Do the clipping in the glide library */
- grClipWindow(0,0,grSstScreenWidth(),grSstScreenHeight());
+ FX_grClipWindow(0,0,FX_grSstScreenWidth(),FX_grSstScreenHeight());
/* And let the new size set in the context */
fxMesaUpdateScreenSize(ctx);
}
@@ -269,21 +297,22 @@ LONG GLAPIENTRY __wglMonitor(HWND hwnd,UINT message,UINT wParam,LONG lParam)
BOOL fMinimized = (BOOL) HIWORD(wParam);
if((fActive == WA_INACTIVE) || fMinimized)
- grSstControl(GR_CONTROL_DEACTIVATE);
+ FX_grSstControl(GR_CONTROL_DEACTIVATE);
else
- grSstControl(GR_CONTROL_ACTIVATE);
+ FX_grSstControl(GR_CONTROL_ACTIVATE);
}
break;
case WM_SHOWWINDOW:
break;
+ case WM_SYSKEYDOWN:
case WM_SYSCHAR:
if(gdiWindowHackEna && (VK_RETURN == wParam)) {
if(gdiWindowHack) {
gdiWindowHack = GL_FALSE;
- grSstControl(GR_CONTROL_ACTIVATE);
+ FX_grSstControl(GR_CONTROL_ACTIVATE);
} else {
gdiWindowHack = GL_TRUE;
- grSstControl(GR_CONTROL_DEACTIVATE);
+ FX_grSstControl(GR_CONTROL_DEACTIVATE);
}
}
break;
@@ -382,7 +411,7 @@ HGLRC GLAPIENTRY wglCreateContext(HDC hdc)
gdiWindowHack = GL_FALSE;
else {
gdiWindowHack = GL_TRUE;
- grSstControl(GR_CONTROL_DEACTIVATE);
+ FX_grSstControl(GR_CONTROL_DEACTIVATE);
}
}
} else {
@@ -779,7 +808,7 @@ BOOL GLAPIENTRY wglSwapBuffers(HDC hdc)
HDC hdcDIBSection = CreateCompatibleDC(hdcScreen);
HBITMAP holdBitmap = (HBITMAP) SelectObject(hdcDIBSection, dibHBM);
- grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
+ FX_grLfbReadRegion(GR_BUFFER_FRONTBUFFER, 0, 0,
width, height,
width * 2,
dibSurfacePtr);
diff --git a/xc/extras/Mesa/src/X86/3dnow.c b/xc/extras/Mesa/src/X86/3dnow.c
index 48ca4a108..b4bd3dafe 100644
--- a/xc/extras/Mesa/src/X86/3dnow.c
+++ b/xc/extras/Mesa/src/X86/3dnow.c
@@ -1,4 +1,4 @@
-/* $Id: 3dnow.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: 3dnow.c,v 1.2 1999/12/07 03:37:16 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/X86/3dnow.h b/xc/extras/Mesa/src/X86/3dnow.h
index 7aefdac41..742a8b313 100644
--- a/xc/extras/Mesa/src/X86/3dnow.h
+++ b/xc/extras/Mesa/src/X86/3dnow.h
@@ -1,4 +1,4 @@
-/* $Id: 3dnow.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: 3dnow.h,v 1.2 1999/12/07 03:37:16 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/X86/x86.c b/xc/extras/Mesa/src/X86/x86.c
index 7a0c4f86f..99bebe373 100644
--- a/xc/extras/Mesa/src/X86/x86.c
+++ b/xc/extras/Mesa/src/X86/x86.c
@@ -1,4 +1,4 @@
-/* $Id: x86.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: x86.c,v 1.2 1999/12/07 03:37:16 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/X86/x86.h b/xc/extras/Mesa/src/X86/x86.h
index ba76ab123..1d835a543 100644
--- a/xc/extras/Mesa/src/X86/x86.h
+++ b/xc/extras/Mesa/src/X86/x86.h
@@ -1,4 +1,4 @@
-/* $Id: x86.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: x86.h,v 1.2 1999/12/07 03:37:16 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/accum.c b/xc/extras/Mesa/src/accum.c
index 82bc0a322..4393a12bc 100644
--- a/xc/extras/Mesa/src/accum.c
+++ b/xc/extras/Mesa/src/accum.c
@@ -1,4 +1,4 @@
-/* $Id: accum.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: accum.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -344,7 +344,7 @@ void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
static GLchan multTable[32768];
static GLfloat prevMult = 0.0;
GLuint j;
- const GLint max = 256 / mult;
+ const GLint max = (GLint) (256 / mult);
if (mult != prevMult) {
assert(max <= 32768);
for (j = 0; j < max; j++)
diff --git a/xc/extras/Mesa/src/accum.h b/xc/extras/Mesa/src/accum.h
index bcc8d9bf9..26b59be81 100644
--- a/xc/extras/Mesa/src/accum.h
+++ b/xc/extras/Mesa/src/accum.h
@@ -1,4 +1,4 @@
-/* $Id: accum.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: accum.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/all.h b/xc/extras/Mesa/src/all.h
index d09df36cb..1e9d6f3c3 100644
--- a/xc/extras/Mesa/src/all.h
+++ b/xc/extras/Mesa/src/all.h
@@ -1,4 +1,4 @@
-/* $Id: all.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: all.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/alpha.c b/xc/extras/Mesa/src/alpha.c
index acdaca235..123879b8f 100644
--- a/xc/extras/Mesa/src/alpha.c
+++ b/xc/extras/Mesa/src/alpha.c
@@ -1,4 +1,4 @@
-/* $Id: alpha.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: alpha.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/alpha.h b/xc/extras/Mesa/src/alpha.h
index efc164d25..8528c2f90 100644
--- a/xc/extras/Mesa/src/alpha.h
+++ b/xc/extras/Mesa/src/alpha.h
@@ -1,4 +1,4 @@
-/* $Id: alpha.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: alpha.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/alphabuf.c b/xc/extras/Mesa/src/alphabuf.c
index 070215d8e..2f3956029 100644
--- a/xc/extras/Mesa/src/alphabuf.c
+++ b/xc/extras/Mesa/src/alphabuf.c
@@ -1,4 +1,4 @@
-/* $Id: alphabuf.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: alphabuf.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/alphabuf.h b/xc/extras/Mesa/src/alphabuf.h
index 2b7d9b8a7..550519efd 100644
--- a/xc/extras/Mesa/src/alphabuf.h
+++ b/xc/extras/Mesa/src/alphabuf.h
@@ -1,4 +1,4 @@
-/* $Id: alphabuf.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: alphabuf.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/api.h b/xc/extras/Mesa/src/api.h
index 11da9e49c..9148baa82 100644
--- a/xc/extras/Mesa/src/api.h
+++ b/xc/extras/Mesa/src/api.h
@@ -1,4 +1,4 @@
-/* $Id: api.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: api.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/api1.c b/xc/extras/Mesa/src/api1.c
index 542809bc9..f3addc636 100644
--- a/xc/extras/Mesa/src/api1.c
+++ b/xc/extras/Mesa/src/api1.c
@@ -1,4 +1,4 @@
-/* $Id: api1.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: api1.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -834,10 +834,14 @@ void GLAPIENTRY glEnd(CTX_VOID )
inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1);
state |= inflags << 2; /* errors */
- if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glEnd(IM %d), BeginState is %x, errors %x\n",
- IM->id, state,
- inflags<<2);
+ if (MESA_VERBOSE&VERBOSE_API) {
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ fprintf(stderr, "glEnd(IM %d), BeginState is %x, errors %x\n",
+ IM->id, state,
+ inflags<<2);
+ else
+ fprintf(stderr, ">");
+ }
if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1))
@@ -873,6 +877,16 @@ void gl_End( GLcontext *ctx )
GLuint state = IM->BeginState;
GLuint inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1);
+
+ if (MESA_VERBOSE&VERBOSE_API) {
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ fprintf(stderr, "gl_End(IM %d), BeginState is %x, errors %x\n",
+ IM->id, state,
+ inflags<<2);
+ else
+ fprintf(stderr, ">");
+ }
+
state |= inflags << 2; /* errors */
if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1))
diff --git a/xc/extras/Mesa/src/api2.c b/xc/extras/Mesa/src/api2.c
index 3b2f2adff..673adf633 100644
--- a/xc/extras/Mesa/src/api2.c
+++ b/xc/extras/Mesa/src/api2.c
@@ -1,4 +1,4 @@
-/* $Id: api2.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: api2.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/apiext.c b/xc/extras/Mesa/src/apiext.c
index 07e608dbb..10e88a302 100644
--- a/xc/extras/Mesa/src/apiext.c
+++ b/xc/extras/Mesa/src/apiext.c
@@ -1,4 +1,4 @@
-/* $Id: apiext.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: apiext.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c
index 50656700c..ce9a813d7 100644
--- a/xc/extras/Mesa/src/attrib.c
+++ b/xc/extras/Mesa/src/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: attrib.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -596,7 +596,7 @@ void gl_PopAttrib( GLcontext* ctx )
(*ctx->Driver.Fogfv)( ctx, GL_FOG_INDEX, &index );
(*ctx->Driver.Fogfv)( ctx, GL_FOG_COLOR, ctx->Fog.Color );
}
- ctx->Enabled &= ENABLE_FOG;
+ ctx->Enabled &= ~ENABLE_FOG;
if (ctx->Fog.Enabled) ctx->Enabled |= ENABLE_FOG;
}
break;
@@ -624,7 +624,13 @@ void gl_PopAttrib( GLcontext* ctx )
}
(*ctx->Driver.Enable)( ctx, GL_LIGHTING, ctx->Light.Enabled );
}
- ctx->Enabled &= ENABLE_LIGHT;
+ if (ctx->Light.ShadeModel == GL_FLAT)
+ ctx->TriangleCaps |= DD_FLATSHADE;
+ else
+ ctx->TriangleCaps &= ~DD_FLATSHADE;
+ if (ctx->Driver.ShadeModel)
+ (*ctx->Driver.ShadeModel)(ctx, ctx->Light.ShadeModel);
+ ctx->Enabled &= ~ENABLE_LIGHT;
if (ctx->Light.Enabled && !is_empty_list(&ctx->Light.EnabledList))
ctx->Enabled |= ENABLE_LIGHT;
break;
diff --git a/xc/extras/Mesa/src/attrib.h b/xc/extras/Mesa/src/attrib.h
index 7a4a36dfc..7ba62e405 100644
--- a/xc/extras/Mesa/src/attrib.h
+++ b/xc/extras/Mesa/src/attrib.h
@@ -1,4 +1,4 @@
-/* $Id: attrib.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: attrib.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/bbox.c b/xc/extras/Mesa/src/bbox.c
index bd2938276..c1c01a98c 100644
--- a/xc/extras/Mesa/src/bbox.c
+++ b/xc/extras/Mesa/src/bbox.c
@@ -1,4 +1,4 @@
-/* $Id: bbox.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: bbox.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/bbox.h b/xc/extras/Mesa/src/bbox.h
index 11f4a7a7f..53fe32e04 100644
--- a/xc/extras/Mesa/src/bbox.h
+++ b/xc/extras/Mesa/src/bbox.h
@@ -1,4 +1,4 @@
-/* $Id: bbox.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: bbox.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/bitmap.c b/xc/extras/Mesa/src/bitmap.c
index e6b0ee301..df2b9d573 100644
--- a/xc/extras/Mesa/src/bitmap.c
+++ b/xc/extras/Mesa/src/bitmap.c
@@ -1,4 +1,4 @@
-/* $Id: bitmap.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: bitmap.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/bitmap.h b/xc/extras/Mesa/src/bitmap.h
index 97eb9e4c2..8d8c85088 100644
--- a/xc/extras/Mesa/src/bitmap.h
+++ b/xc/extras/Mesa/src/bitmap.h
@@ -1,4 +1,4 @@
-/* $Id: bitmap.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: bitmap.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/blend.c b/xc/extras/Mesa/src/blend.c
index eb2f5e7f5..0d0883591 100644
--- a/xc/extras/Mesa/src/blend.c
+++ b/xc/extras/Mesa/src/blend.c
@@ -1,4 +1,4 @@
-/* $Id: blend.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: blend.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/blend.h b/xc/extras/Mesa/src/blend.h
index 2dbbd54ef..3cd3bb918 100644
--- a/xc/extras/Mesa/src/blend.h
+++ b/xc/extras/Mesa/src/blend.h
@@ -1,4 +1,4 @@
-/* $Id: blend.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: blend.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/clip.c b/xc/extras/Mesa/src/clip.c
index 47349682e..00ea37227 100644
--- a/xc/extras/Mesa/src/clip.c
+++ b/xc/extras/Mesa/src/clip.c
@@ -1,4 +1,4 @@
-/* $Id: clip.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: clip.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -34,6 +34,7 @@
#ifndef XFree86Server
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#else
#include "GL/xf86glx.h"
#endif
@@ -50,6 +51,15 @@
+#define CLIP_RGBA0 0x1
+#define CLIP_RGBA1 0x2
+#define CLIP_TEX0 0x4
+#define CLIP_TEX1 0x8
+#define CLIP_INDEX0 0x10
+#define CLIP_INDEX1 0x20
+#define CLIP_FOG_COORD 0x40
+
+
/* Linear interpolation between A and B: */
#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) )
@@ -66,16 +76,7 @@ do { \
} while(0)
-
-
-#define CLIP_RGBA0 0x1
-#define CLIP_RGBA1 0x2
-#define CLIP_TEX0 0x4
-#define CLIP_TEX1 0x8
-#define CLIP_INDEX0 0x10
-#define CLIP_INDEX1 0x20
-
-static clip_interp_func clip_interp_tab[0x40];
+static clip_interp_func clip_interp_tab[0x80];
#define IND 0
#define NAME clip_nil
@@ -121,6 +122,50 @@ static clip_interp_func clip_interp_tab[0x40];
#define NAME clipINDEX0_INDEX1
#include "interp_tmp.h"
+#define IND (CLIP_FOG_COORD)
+#define NAME clip_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_RGBA0|CLIP_FOG_COORD)
+#define NAME clipRGBA0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
+#define NAME clipRGBA0_RGBA1_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
+#define NAME clipTEX0_RGBA0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
+#define NAME clipTEX0_RGBA0_RGBA1_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
+#define NAME clipTEX1_TEX0_RGBA0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX0|CLIP_FOG_COORD)
+#define NAME clipTEX0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD)
+#define NAME clipTEX1_TEX0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
+#define NAME clipTEX1_TEX0_RGBA0_RGBA1_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_INDEX0|CLIP_FOG_COORD)
+#define NAME clipINDEX0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD)
+#define NAME clipINDEX0_INDEX1_FOG
+#include "interp_tmp.h"
+
@@ -351,6 +396,8 @@ void gl_update_clipmask( GLcontext *ctx )
mask |= CLIP_INDEX1;
}
+ if (ctx->FogMode == FOG_FRAGMENT && (ctx->TriangleCaps & DD_CLIP_FOG_COORD))
+ mask |= CLIP_FOG_COORD;
ctx->ClipInterpFunc = clip_interp_tab[mask];
ctx->poly_clip_tab = gl_poly_clip_tab[0];
@@ -446,11 +493,22 @@ void gl_init_clip(void)
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0] = clipTEX1_TEX0_RGBA0;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1] =
clipTEX1_TEX0_RGBA0_RGBA1;
-
clip_interp_tab[CLIP_TEX0] = clipTEX0;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0] = clipTEX1_TEX0;
-
clip_interp_tab[CLIP_INDEX0] = clipINDEX0;
clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1] = clipINDEX0_INDEX1;
+
+ clip_interp_tab[CLIP_FOG_COORD] = clip_FOG;
+ clip_interp_tab[CLIP_RGBA0|CLIP_FOG_COORD] = clipRGBA0_FOG;
+ clip_interp_tab[CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipRGBA0_RGBA1_FOG;
+ clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX0_RGBA0_FOG;
+ clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipTEX0_RGBA0_RGBA1_FOG;
+ clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX1_TEX0_RGBA0_FOG;
+ clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] =
+ clipTEX1_TEX0_RGBA0_RGBA1_FOG;
+ clip_interp_tab[CLIP_TEX0|CLIP_FOG_COORD] = clipTEX0_FOG;
+ clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD] = clipTEX1_TEX0_FOG;
+ clip_interp_tab[CLIP_INDEX0|CLIP_FOG_COORD] = clipINDEX0_FOG;
+ clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD] = clipINDEX0_INDEX1_FOG;
}
diff --git a/xc/extras/Mesa/src/clip.h b/xc/extras/Mesa/src/clip.h
index 10eaa06c4..0f3bafaaf 100644
--- a/xc/extras/Mesa/src/clip.h
+++ b/xc/extras/Mesa/src/clip.h
@@ -1,4 +1,4 @@
-/* $Id: clip.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: clip.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/clip_funcs.h b/xc/extras/Mesa/src/clip_funcs.h
index 4ead29842..ccdc014c5 100644
--- a/xc/extras/Mesa/src/clip_funcs.h
+++ b/xc/extras/Mesa/src/clip_funcs.h
@@ -1,4 +1,4 @@
-/* $Id: clip_funcs.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: clip_funcs.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/clip_tmp.h b/xc/extras/Mesa/src/clip_tmp.h
index ebf270af9..1c39e3f29 100644
--- a/xc/extras/Mesa/src/clip_tmp.h
+++ b/xc/extras/Mesa/src/clip_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: clip_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: clip_tmp.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/colortab.c b/xc/extras/Mesa/src/colortab.c
index d93913949..d0e72d46b 100644
--- a/xc/extras/Mesa/src/colortab.c
+++ b/xc/extras/Mesa/src/colortab.c
@@ -1,4 +1,4 @@
-/* $Id: colortab.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: colortab.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/colortab.h b/xc/extras/Mesa/src/colortab.h
index f416dfa60..b792b5ae3 100644
--- a/xc/extras/Mesa/src/colortab.h
+++ b/xc/extras/Mesa/src/colortab.h
@@ -1,4 +1,4 @@
-/* $Id: colortab.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: colortab.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/config.c b/xc/extras/Mesa/src/config.c
index 0df85d2e9..cb1dab9cd 100644
--- a/xc/extras/Mesa/src/config.c
+++ b/xc/extras/Mesa/src/config.c
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: config.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/config.h b/xc/extras/Mesa/src/config.h
index 88f4b7f68..9cae80135 100644
--- a/xc/extras/Mesa/src/config.h
+++ b/xc/extras/Mesa/src/config.h
@@ -1,4 +1,4 @@
-/* $Id: config.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: config.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c
index 98224b11a..7a4cc0d0c 100644
--- a/xc/extras/Mesa/src/context.c
+++ b/xc/extras/Mesa/src/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: context.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -61,6 +61,7 @@
#include "enums.h"
#include "extensions.h"
#include "fog.h"
+#include "get.h"
#include "hash.h"
#include "light.h"
#include "lines.h"
@@ -917,9 +918,9 @@ static void initialize_context( GLcontext *ctx )
ctx->Stencil.ZPassFunc = GL_KEEP;
ctx->Stencil.ZFailFunc = GL_KEEP;
ctx->Stencil.Ref = 0;
- ctx->Stencil.ValueMask = 0xff;
+ ctx->Stencil.ValueMask = STENCIL_MAX;
ctx->Stencil.Clear = 0;
- ctx->Stencil.WriteMask = 0xff;
+ ctx->Stencil.WriteMask = STENCIL_MAX;
/* Texture group */
ctx->Texture.CurrentUnit = 0; /* multitexture */
@@ -1070,6 +1071,7 @@ static void initialize_context( GLcontext *ctx )
/* For debug/development only */
ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
+ ctx->FirstTimeCurrent = GL_TRUE;
/* Dither disable */
ctx->NoDither = getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
@@ -1332,7 +1334,6 @@ GLcontext *gl_create_context( GLvisual *visual,
ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int;
-
#ifdef PROFILE
init_timings( ctx );
#endif
@@ -1564,6 +1565,21 @@ void gl_make_current( GLcontext *ctx, GLframebuffer *buffer )
ctx->NewState = NEW_ALL; /* just to be safe */
gl_update_state( ctx );
}
+
+ /* We can use this to help debug user's problems. Tell the to set
+ * the MESA_INFO env variable before running their app. Then the
+ * first time each context is made current we'll print some useful
+ * information.
+ */
+ if (ctx && ctx->FirstTimeCurrent) {
+ if (getenv("MESA_INFO")) {
+ fprintf(stderr, "Mesa GL_VERSION = %s\n", (char *) gl_GetString(ctx, GL_VERSION));
+ fprintf(stderr, "Mesa GL_RENDERER = %s\n", (char *) gl_GetString(ctx, GL_RENDERER));
+ fprintf(stderr, "Mesa GL_VENDOR = %s\n", (char *) gl_GetString(ctx, GL_VENDOR));
+ fprintf(stderr, "Mesa GL_EXTENSIONS = %s\n", (char *) gl_GetString(ctx, GL_EXTENSIONS));
+ }
+ ctx->FirstTimeCurrent = GL_FALSE;
+ }
}
@@ -1977,21 +1993,17 @@ static void update_pixel_masking( GLcontext *ctx )
static void update_fog_mode( GLcontext *ctx )
{
int old_mode = ctx->FogMode;
+ ctx->FogMode = FOG_NONE;
if (ctx->Fog.Enabled) {
- if (ctx->Texture.Enabled)
- ctx->FogMode = FOG_FRAGMENT;
- else if (ctx->Hint.Fog == GL_NICEST)
- ctx->FogMode = FOG_FRAGMENT;
- else
- ctx->FogMode = FOG_VERTEX;
+ ctx->FogMode = FOG_VERTEX;
- if (ctx->Driver.GetParameteri)
- if ((ctx->Driver.GetParameteri)( ctx, DD_HAVE_HARDWARE_FOG ))
- ctx->FogMode = FOG_FRAGMENT;
- }
- else {
- ctx->FogMode = FOG_NONE;
+ if (ctx->Texture.Enabled || ctx->Hint.Fog == GL_NICEST)
+ ctx->FogMode = FOG_FRAGMENT;
+
+ if ( ctx->Driver.GetParameteri &&
+ ctx->Driver.GetParameteri( ctx, DD_HAVE_HARDWARE_FOG ) )
+ ctx->FogMode = FOG_FRAGMENT;
}
if (old_mode != ctx->FogMode)
@@ -2130,14 +2142,6 @@ void gl_update_state( GLcontext *ctx )
ctx->Texture.Unit[1].LastEnvMode = ctx->Texture.Unit[1].EnvMode;
}
- if ((ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE)) == 0) {
-
- if (MESA_VERBOSE&VERBOSE_STATE)
- fprintf(stderr, "update_state: goto finished\n");
-
- goto finished;
- }
-
if (ctx->NewState & NEW_TEXTURE_MATRIX) {
ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
@@ -2154,7 +2158,7 @@ void gl_update_state( GLcontext *ctx )
}
}
- if (ctx->NewState & NEW_TEXTURING) {
+ if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) {
ctx->Texture.NeedNormals = GL_FALSE;
gl_update_dirty_texobjs(ctx);
ctx->Enabled &= ~(ENABLE_TEXGEN0|ENABLE_TEXGEN1);
@@ -2316,7 +2320,7 @@ void gl_update_state( GLcontext *ctx )
}
}
- if (ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE|
+ if (ctx->NewState & ~(NEW_CLIENT_STATE|
NEW_DRIVER_STATE|NEW_USER_CLIP|
NEW_POLYGON))
gl_update_clipmask(ctx);
@@ -2324,6 +2328,7 @@ void gl_update_state( GLcontext *ctx )
if (ctx->NewState & (NEW_LIGHTING|
NEW_RASTER_OPS|
NEW_TEXTURING|
+ NEW_TEXTURE_ENABLE|
NEW_TEXTURE_ENV|
NEW_POLYGON|
NEW_DRVSTATE0|
@@ -2419,7 +2424,7 @@ void gl_update_state( GLcontext *ctx )
oldnorm = ctx->NeedEyeNormals;
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
- ctx->NeedEyeCoords = ((ctx->Fog.Enabled && ctx->Hint.Fog != GL_NICEST) ||
+ ctx->NeedEyeCoords = (ctx->FogMode == FOG_VERTEX ||
ctx->Point.Attenuated);
ctx->NeedEyeNormals = GL_FALSE;
@@ -2475,7 +2480,6 @@ void gl_update_state( GLcontext *ctx )
gl_update_normal_transform( ctx );
}
- finished:
gl_update_pipelines(ctx);
ctx->NewState = 0;
}
diff --git a/xc/extras/Mesa/src/context.h b/xc/extras/Mesa/src/context.h
index 3c2665339..1651acbfb 100644
--- a/xc/extras/Mesa/src/context.h
+++ b/xc/extras/Mesa/src/context.h
@@ -1,4 +1,4 @@
-/* $Id: context.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: context.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/copy_tmp.h b/xc/extras/Mesa/src/copy_tmp.h
index 9820cf86a..bd9dfb941 100644
--- a/xc/extras/Mesa/src/copy_tmp.h
+++ b/xc/extras/Mesa/src/copy_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: copy_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: copy_tmp.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/copypix.c b/xc/extras/Mesa/src/copypix.c
index d1090b129..d0768b768 100644
--- a/xc/extras/Mesa/src/copypix.c
+++ b/xc/extras/Mesa/src/copypix.c
@@ -1,4 +1,4 @@
-/* $Id: copypix.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: copypix.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -50,6 +50,29 @@
#endif
+/*
+ * Determine if there's overlap in an image copy
+ */
+static GLboolean
+regions_overlap(int srcx, int srcy, int dstx, int dsty, int width, int height,
+ float zoomX, float zoomY)
+{
+ if ((srcx > dstx + (width * zoomX) + 1) || (srcx + width + 1 < dstx)) {
+ return GL_FALSE;
+ }
+ else if ((srcy < dsty) && (srcy + height < dsty + (height * zoomY))) {
+ return GL_FALSE;
+ }
+ else if ((srcy > dsty) && (srcy + height > dsty + (height * zoomY))) {
+ return GL_FALSE;
+ }
+ else {
+ return GL_TRUE;
+ }
+}
+
+
+
static void copy_rgba_pixels( GLcontext* ctx,
GLint srcx, GLint srcy,
@@ -58,12 +81,14 @@ static void copy_rgba_pixels( GLcontext* ctx,
{
GLdepth zspan[MAX_WIDTH];
GLubyte rgba[MAX_WIDTH][4];
+ GLubyte *prgba,*p;
GLboolean quick_draw;
GLint sy, dy, stepy;
GLint i, j;
GLboolean changeBuffer;
GLubyte *saveAlpha;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F;
+ GLboolean needbuffer;
/* Determine if copy should be done bottom-to-top or top-to-bottom */
if (srcy<desty) {
@@ -79,7 +104,10 @@ static void copy_rgba_pixels( GLcontext* ctx,
stepy = 1;
}
- if (ctx->Depth.Test) {
+ needbuffer = regions_overlap(srcx, srcy, destx, desty, width, height,
+ ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
+
+ if (ctx->Depth.Test || ctx->Fog.Enabled) {
/* fill in array of z values */
GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
for (i=0;i<width;i++) {
@@ -98,7 +126,15 @@ static void copy_rgba_pixels( GLcontext* ctx,
/* If read and draw buffer are different we must do buffer switching */
saveAlpha = ctx->Buffer->Alpha;
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer;
- for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
+
+ if (needbuffer) {
+ GLint ssy = sy;
+ prgba = (GLubyte *) MALLOC(width*height*sizeof(GLubyte)*4);
+ if (!prgba) {
+ gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
+ return;
+ }
+ p = prgba;
if (changeBuffer) {
(*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT)
@@ -110,7 +146,32 @@ static void copy_rgba_pixels( GLcontext* ctx,
else
ctx->Buffer->Alpha = ctx->Buffer->BackRightAlpha;
}
- gl_read_rgba_span( ctx, width, srcx, sy, rgba );
+ for (j=0; j<height; j++, ssy+=stepy) {
+ gl_read_rgba_span( ctx, width, srcx, ssy,(GLubyte (*)[4]) p );
+ p += (width*sizeof(GLubyte)*4);
+ }
+ p = prgba;
+ }
+
+ for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
+ if (needbuffer) {
+ MEMCPY(rgba, p, width * sizeof(GLubyte) * 4);
+ p += (width * sizeof(GLubyte) * 4);
+ }
+ else {
+ if (changeBuffer) {
+ (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT)
+ ctx->Buffer->Alpha = ctx->Buffer->FrontLeftAlpha;
+ else if (ctx->Pixel.DriverReadBuffer == GL_BACK_LEFT)
+ ctx->Buffer->Alpha = ctx->Buffer->BackLeftAlpha;
+ else if (ctx->Pixel.DriverReadBuffer == GL_FRONT_RIGHT)
+ ctx->Buffer->Alpha = ctx->Buffer->FrontRightAlpha;
+ else
+ ctx->Buffer->Alpha = ctx->Buffer->BackRightAlpha;
+ }
+ gl_read_rgba_span( ctx, width, srcx, sy, rgba );
+ }
if (ctx->Pixel.ScaleOrBiasRGBA) {
gl_scale_and_bias_rgba( ctx, width, rgba );
}
@@ -131,6 +192,9 @@ static void copy_rgba_pixels( GLcontext* ctx,
}
}
+ if (needbuffer)
+ FREE(prgba);
+
/* Restore current alpha buffer pointer */
ctx->Buffer->Alpha = saveAlpha;
if (changeBuffer)
@@ -143,11 +207,13 @@ static void copy_ci_pixels( GLcontext* ctx,
GLint destx, GLint desty )
{
GLdepth zspan[MAX_WIDTH];
+ GLuint *pci,*p;
GLint sy, dy, stepy;
GLint i, j;
GLboolean changeBuffer;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F;
const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset;
+ GLboolean needbuffer;
/* Determine if copy should be bottom-to-top or top-to-bottom */
if (srcy<desty) {
@@ -163,7 +229,10 @@ static void copy_ci_pixels( GLcontext* ctx,
stepy = 1;
}
- if (ctx->Depth.Test) {
+ needbuffer = regions_overlap(srcx, srcy, destx, desty, width, height,
+ ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
+
+ if (ctx->Depth.Test || ctx->Fog.Enabled) {
/* fill in array of z values */
GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
for (i=0;i<width;i++) {
@@ -174,12 +243,36 @@ static void copy_ci_pixels( GLcontext* ctx,
/* If read and draw buffer are different we must do buffer switching */
changeBuffer = ctx->Pixel.ReadBuffer!=ctx->Color.DrawBuffer;
- for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
- GLuint indexes[MAX_WIDTH];
+ if (needbuffer) {
+ GLint ssy = sy;
+ pci = (GLuint *) MALLOC(width * height * sizeof(GLuint));
+ if (!pci) {
+ gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
+ return;
+ }
+ p = pci;
if (changeBuffer) {
(*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
}
- gl_read_index_span( ctx, width, srcx, sy, indexes );
+ for (j=0; j<height; j++, ssy+=stepy) {
+ gl_read_index_span( ctx, width, srcx, ssy, p );
+ p += width;
+ }
+ p = pci;
+ }
+
+ for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
+ GLuint indexes[MAX_WIDTH];
+ if (needbuffer) {
+ MEMCPY(indexes, p, width * sizeof(GLuint));
+ p += width;
+ }
+ else {
+ if (changeBuffer) {
+ (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ }
+ gl_read_index_span( ctx, width, srcx, sy, indexes );
+ }
if (shift_or_offset) {
gl_shift_and_offset_ci( ctx, width, indexes );
@@ -198,6 +291,10 @@ static void copy_ci_pixels( GLcontext* ctx,
gl_write_index_span( ctx, width, destx, dy, zspan, indexes, GL_BITMAP );
}
}
+
+ if (needbuffer)
+ FREE(pci);
+
if (changeBuffer)
(*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer );
}
@@ -213,11 +310,13 @@ static void copy_depth_pixels( GLcontext* ctx, GLint srcx, GLint srcy,
{
GLfloat depth[MAX_WIDTH];
GLdepth zspan[MAX_WIDTH];
+ GLfloat *p,*pdepth;
GLuint indexes[MAX_WIDTH];
GLubyte rgba[MAX_WIDTH][4];
GLint sy, dy, stepy;
GLint i, j;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F;
+ GLboolean needbuffer;
if (!ctx->Buffer->Depth) {
gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
@@ -238,6 +337,10 @@ static void copy_depth_pixels( GLcontext* ctx, GLint srcx, GLint srcy,
stepy = 1;
}
+
+ needbuffer = regions_overlap(srcx, srcy, destx, desty, width, height,
+ ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
+
/* setup colors or indexes */
if (ctx->Visual->RGBAflag) {
GLuint *rgba32 = (GLuint *) rgba;
@@ -252,8 +355,29 @@ static void copy_depth_pixels( GLcontext* ctx, GLint srcx, GLint srcy,
}
}
+ if (needbuffer) {
+ GLint ssy = sy;
+ pdepth = (GLfloat *) MALLOC(width * height * sizeof(GLfloat));
+ if (!pdepth) {
+ gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
+ return;
+ }
+ p = pdepth;
+ for (j=0; j<height; j++, ssy+=stepy) {
+ (*ctx->Driver.ReadDepthSpanFloat)( ctx, width, srcx, ssy, p );
+ p += width;
+ }
+ p = pdepth;
+ }
+
for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
- (*ctx->Driver.ReadDepthSpanFloat)( ctx, width, srcx, sy, depth );
+ if (needbuffer) {
+ MEMCPY(depth, p, width * sizeof(GLfloat));
+ p += width;
+ }
+ else {
+ (*ctx->Driver.ReadDepthSpanFloat)( ctx, width, srcx, sy, depth );
+ }
for (i=0;i<width;i++) {
GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
@@ -280,6 +404,9 @@ static void copy_depth_pixels( GLcontext* ctx, GLint srcx, GLint srcy,
}
}
}
+
+ if (needbuffer)
+ FREE(pdepth);
}
@@ -290,8 +417,10 @@ static void copy_stencil_pixels( GLcontext* ctx, GLint srcx, GLint srcy,
{
GLint sy, dy, stepy;
GLint j;
+ GLstencil *p,*psten;
const GLboolean zoom = (ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F);
const GLboolean shift_or_offset = ctx->Pixel.IndexShift!=0 || ctx->Pixel.IndexOffset!=0;
+ GLboolean needbuffer;
if (!ctx->Buffer->Stencil) {
gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
@@ -312,9 +441,34 @@ static void copy_stencil_pixels( GLcontext* ctx, GLint srcx, GLint srcy,
stepy = 1;
}
+ needbuffer = regions_overlap(srcx, srcy, destx, desty, width, height,
+ ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
+
+ if (needbuffer) {
+ GLint ssy = sy;
+ psten = (GLstencil *) MALLOC(width * height * sizeof(GLstencil));
+ if (!psten) {
+ gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
+ return;
+ }
+ p = psten;
+ for (j=0; j<height; j++, ssy+=stepy) {
+ gl_read_stencil_span( ctx, width, srcx, ssy, p );
+ p += width;
+ }
+ p = psten;
+ }
+
for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
GLstencil stencil[MAX_WIDTH];
- gl_read_stencil_span( ctx, width, srcx, sy, stencil );
+
+ if (needbuffer) {
+ MEMCPY(stencil, p, width * sizeof(GLstencil));
+ p += width;
+ }
+ else {
+ gl_read_stencil_span( ctx, width, srcx, sy, stencil );
+ }
if (shift_or_offset) {
gl_shift_and_offset_stencil( ctx, width, stencil );
@@ -330,13 +484,16 @@ static void copy_stencil_pixels( GLcontext* ctx, GLint srcx, GLint srcy,
gl_write_stencil_span( ctx, width, destx, dy, stencil );
}
}
+
+ if (needbuffer)
+ FREE(psten);
}
-void gl_CopyPixels( GLcontext* ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height,
- GLenum type )
+void gl_CopyPixels( GLcontext* ctx, GLint srcx, GLint srcy,
+ GLsizei width, GLsizei height, GLenum type )
{
GLint destx, desty;
@@ -388,5 +545,3 @@ void gl_CopyPixels( GLcontext* ctx, GLint srcx, GLint srcy, GLsizei width, GLsiz
}
}
-
-
diff --git a/xc/extras/Mesa/src/copypix.h b/xc/extras/Mesa/src/copypix.h
index 4e6e2ad15..bc106a0bf 100644
--- a/xc/extras/Mesa/src/copypix.h
+++ b/xc/extras/Mesa/src/copypix.h
@@ -1,4 +1,4 @@
-/* $Id: copypix.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: copypix.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/cull_tmp.h b/xc/extras/Mesa/src/cull_tmp.h
index a032bb231..f292253c5 100644
--- a/xc/extras/Mesa/src/cull_tmp.h
+++ b/xc/extras/Mesa/src/cull_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: cull_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: cull_tmp.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/cva.c b/xc/extras/Mesa/src/cva.c
index 02c205f26..ffd1e024b 100644
--- a/xc/extras/Mesa/src/cva.c
+++ b/xc/extras/Mesa/src/cva.c
@@ -1,4 +1,4 @@
-/* $Id: cva.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: cva.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/cva.h b/xc/extras/Mesa/src/cva.h
index e8b5530c7..fc4a00925 100644
--- a/xc/extras/Mesa/src/cva.h
+++ b/xc/extras/Mesa/src/cva.h
@@ -1,4 +1,4 @@
-/* $Id: cva.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: cva.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/dd.h b/xc/extras/Mesa/src/dd.h
index a4d544498..2f7b92f98 100644
--- a/xc/extras/Mesa/src/dd.h
+++ b/xc/extras/Mesa/src/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: dd.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/ddsample.c b/xc/extras/Mesa/src/ddsample.c
index 19aa656b5..06db5f1f4 100644
--- a/xc/extras/Mesa/src/ddsample.c
+++ b/xc/extras/Mesa/src/ddsample.c
@@ -1,4 +1,4 @@
-/* $Id: ddsample.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: ddsample.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/debug_xform.c b/xc/extras/Mesa/src/debug_xform.c
index 64b261172..53dcad634 100644
--- a/xc/extras/Mesa/src/debug_xform.c
+++ b/xc/extras/Mesa/src/debug_xform.c
@@ -1,4 +1,4 @@
-/* $Id: debug_xform.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: debug_xform.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/debug_xform.h b/xc/extras/Mesa/src/debug_xform.h
index 1af1f6476..42a79807b 100644
--- a/xc/extras/Mesa/src/debug_xform.h
+++ b/xc/extras/Mesa/src/debug_xform.h
@@ -1,4 +1,4 @@
-/* $Id: debug_xform.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: debug_xform.h,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/depth.c b/xc/extras/Mesa/src/depth.c
index 126bde548..4b467e074 100644
--- a/xc/extras/Mesa/src/depth.c
+++ b/xc/extras/Mesa/src/depth.c
@@ -1,4 +1,4 @@
-/* $Id: depth.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: depth.c,v 1.2 1999/12/07 03:37:14 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/depth.h b/xc/extras/Mesa/src/depth.h
index a14ce0ad3..bca5f3535 100644
--- a/xc/extras/Mesa/src/depth.h
+++ b/xc/extras/Mesa/src/depth.h
@@ -1,5 +1,5 @@
-/* $Id: depth.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: depth.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c
index d0c3a8064..33a3dc11e 100644
--- a/xc/extras/Mesa/src/dlist.c
+++ b/xc/extras/Mesa/src/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: dlist.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/dlist.h b/xc/extras/Mesa/src/dlist.h
index e2bfdb86d..a9856d6fb 100644
--- a/xc/extras/Mesa/src/dlist.h
+++ b/xc/extras/Mesa/src/dlist.h
@@ -1,4 +1,4 @@
-/* $Id: dlist.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: dlist.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/dotprod_tmp.h b/xc/extras/Mesa/src/dotprod_tmp.h
index dc15f045e..4c7c3f225 100644
--- a/xc/extras/Mesa/src/dotprod_tmp.h
+++ b/xc/extras/Mesa/src/dotprod_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: dotprod_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: dotprod_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/drawpix.c b/xc/extras/Mesa/src/drawpix.c
index 02364256a..5959d76a2 100644
--- a/xc/extras/Mesa/src/drawpix.c
+++ b/xc/extras/Mesa/src/drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: drawpix.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -395,7 +395,7 @@ static void draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
widthInBytes = width;
/* Fragment depth values */
- if (ctx->Depth.Test) {
+ if (ctx->Depth.Test || ctx->Fog.Enabled) {
GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
for (i=0;i<width;i++) {
zspan[i] = zval;
@@ -741,7 +741,7 @@ static void draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
height = image->Height;
/* Fragment depth values */
- if (ctx->Depth.Test) {
+ if (ctx->Depth.Test || ctx->Fog.Enabled) {
/* fill in array of z values */
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
for (i=0;i<width;i++) {
diff --git a/xc/extras/Mesa/src/drawpix.h b/xc/extras/Mesa/src/drawpix.h
index 02fd6382d..1d080ffbf 100644
--- a/xc/extras/Mesa/src/drawpix.h
+++ b/xc/extras/Mesa/src/drawpix.h
@@ -1,4 +1,4 @@
-/* $Id: drawpix.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: drawpix.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c
index 87d445063..8ae55aa3b 100644
--- a/xc/extras/Mesa/src/enable.c
+++ b/xc/extras/Mesa/src/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: enable.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/enable.h b/xc/extras/Mesa/src/enable.h
index 1acb3cc26..16330369c 100644
--- a/xc/extras/Mesa/src/enable.h
+++ b/xc/extras/Mesa/src/enable.h
@@ -1,4 +1,4 @@
-/* $Id: enable.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: enable.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/enums.c b/xc/extras/Mesa/src/enums.c
index d7dcd6b5f..7059d72da 100644
--- a/xc/extras/Mesa/src/enums.c
+++ b/xc/extras/Mesa/src/enums.c
@@ -1,4 +1,4 @@
-/* $Id: enums.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: enums.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/enums.h b/xc/extras/Mesa/src/enums.h
index 87aae96ad..2c07cdf83 100644
--- a/xc/extras/Mesa/src/enums.h
+++ b/xc/extras/Mesa/src/enums.h
@@ -1,4 +1,4 @@
-/* $Id: enums.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: enums.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/eval.c b/xc/extras/Mesa/src/eval.c
index 2dcbaf938..5e8220d6c 100644
--- a/xc/extras/Mesa/src/eval.c
+++ b/xc/extras/Mesa/src/eval.c
@@ -1,4 +1,4 @@
-/* $Id: eval.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: eval.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/eval.h b/xc/extras/Mesa/src/eval.h
index d9d7956df..893e3fd96 100644
--- a/xc/extras/Mesa/src/eval.h
+++ b/xc/extras/Mesa/src/eval.h
@@ -1,4 +1,4 @@
-/* $Id: eval.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: eval.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/extensions.c b/xc/extras/Mesa/src/extensions.c
index 9aa7a090c..4a0d5db40 100644
--- a/xc/extras/Mesa/src/extensions.c
+++ b/xc/extras/Mesa/src/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: extensions.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -132,6 +132,24 @@ int gl_extensions_disable( GLcontext *ctx, const char *name )
}
+/*
+ * Test if the named extension is enabled in this context.
+ */
+GLboolean gl_extension_is_enabled( GLcontext *ctx, const char *name)
+{
+ struct extension *i;
+ foreach( i, ctx->Extensions.ext_list )
+ if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) {
+ if (i->enabled)
+ return GL_TRUE;
+ else
+ return GL_FALSE;
+ }
+
+ return GL_FALSE;
+}
+
+
void gl_extensions_dtr( GLcontext *ctx )
{
struct extension *i, *nexti;
@@ -288,7 +306,7 @@ void (*gl_get_proc_address( const GLubyte *procName ))()
{ "glTexSubImage3DEXT", (gl_function) glTexSubImage3DEXT },
{ "glCopyTexSubImage3DEXT", (gl_function) glCopyTexSubImage3DEXT },
- /* GL_EXT_color_table */
+ /* GL_EXT_paletted_texture */
{ "glColorTableEXT", (gl_function) glColorTableEXT },
{ "glColorSubTableEXT", (gl_function) glColorSubTableEXT },
{ "glGetColorTableEXT", (gl_function) glGetColorTableEXT },
diff --git a/xc/extras/Mesa/src/extensions.h b/xc/extras/Mesa/src/extensions.h
index cc2743fbd..a25156c0a 100644
--- a/xc/extras/Mesa/src/extensions.h
+++ b/xc/extras/Mesa/src/extensions.h
@@ -1,4 +1,4 @@
-/* $Id: extensions.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: extensions.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -39,7 +39,7 @@
*/
extern int gl_extensions_add( struct gl_context *ctx, int state,
const char *name, void (*notify)( void ) );
-
+extern GLboolean gl_extension_is_enabled( GLcontext *ctx, const char *name);
extern int gl_extensions_enable( struct gl_context *ctx, const char *name );
extern int gl_extensions_disable( struct gl_context *ctx, const char *name );
extern void gl_extensions_dtr( struct gl_context *ctx );
diff --git a/xc/extras/Mesa/src/feedback.c b/xc/extras/Mesa/src/feedback.c
index 429808c3b..abf19b5b7 100644
--- a/xc/extras/Mesa/src/feedback.c
+++ b/xc/extras/Mesa/src/feedback.c
@@ -1,4 +1,4 @@
-/* $Id: feedback.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: feedback.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/feedback.h b/xc/extras/Mesa/src/feedback.h
index 094fb66f4..6369e5cf8 100644
--- a/xc/extras/Mesa/src/feedback.h
+++ b/xc/extras/Mesa/src/feedback.h
@@ -1,4 +1,4 @@
-/* $Id: feedback.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: feedback.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/fixed.h b/xc/extras/Mesa/src/fixed.h
index 3cd783838..385493b4c 100644
--- a/xc/extras/Mesa/src/fixed.h
+++ b/xc/extras/Mesa/src/fixed.h
@@ -1,4 +1,4 @@
-/* $Id: fixed.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: fixed.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/fog.c b/xc/extras/Mesa/src/fog.c
index 4ceff02cf..cce3fbeed 100644
--- a/xc/extras/Mesa/src/fog.c
+++ b/xc/extras/Mesa/src/fog.c
@@ -1,4 +1,4 @@
-/* $Id: fog.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: fog.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,6 +41,7 @@
#include "macros.h"
#include "mmath.h"
#include "types.h"
+#include "xform.h"
#endif
@@ -70,23 +71,9 @@ void gl_Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
}
break;
case GL_FOG_START:
-#if 0
- /* Prior to OpenGL 1.1, this was an error */
- if (*params<0.0F) {
- gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_START)" );
- return;
- }
-#endif
ctx->Fog.Start = *params;
break;
case GL_FOG_END:
-#if 0
- /* Prior to OpenGL 1.1, this was an error */
- if (*params<0.0F) {
- gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_END)" );
- return;
- }
-#endif
ctx->Fog.End = *params;
break;
case GL_FOG_INDEX:
@@ -114,9 +101,13 @@ void gl_Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
typedef void (*fog_func)( struct vertex_buffer *VB, GLuint side,
GLubyte flag );
+typedef void (*fog_coord_func)( struct vertex_buffer *VB,
+ const GLvector4f *from,
+ GLubyte flag );
static fog_func fog_ci_tab[2];
static fog_func fog_rgba_tab[2];
+static fog_coord_func make_fog_coord_tab[2];
/*
* Compute the fogged color for an array of vertices.
@@ -170,6 +161,70 @@ void gl_fog_vertices( struct vertex_buffer *VB )
}
}
+
+static void check_fog_coords( GLcontext *ctx, struct gl_pipeline_stage *d )
+{
+ d->type = 0;
+
+ if (ctx->FogMode==FOG_FRAGMENT)
+ {
+ d->type = PIPE_IMMEDIATE|PIPE_PRECALC;
+ d->inputs = VERT_OBJ_ANY;
+ d->outputs = VERT_FOG_COORD;
+ }
+}
+
+void gl_make_fog_coords( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+
+ /* If full eye coords weren't required, just calculate the eye Z
+ * values.
+ */
+ if (!ctx->NeedEyeCoords) {
+ GLfloat *m = ctx->ModelView.m;
+ GLfloat plane[4];
+
+ plane[0] = m[2];
+ plane[1] = m[6];
+ plane[2] = m[10];
+ plane[3] = m[14];
+
+ gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye,
+ 2, /* fill z coordinates */
+ VB->ObjPtr,
+ plane,
+ 0 );
+
+ make_fog_coord_tab[0]( VB, &VB->Eye, 0 );
+ }
+ else
+ {
+ make_fog_coord_tab[0]( VB, VB->EyePtr, 0 );
+ }
+}
+
+
+/* Drivers that want fog coordinates in VB->Spec[0] alpha, can substitute this
+ * stage for the default PIPE_OP_FOG pipeline stage.
+ */
+struct gl_pipeline_stage gl_fog_coord_stage = {
+ "build fog coordinates",
+ PIPE_OP_FOG,
+ PIPE_PRECALC|PIPE_IMMEDIATE,
+ 0,
+ NEW_FOG,
+ NEW_LIGHTING|NEW_RASTER_OPS|NEW_FOG|NEW_MODELVIEW,
+ 0, 0,
+ 0, 0, 0,
+ check_fog_coords,
+ gl_make_fog_coords
+};
+
+
+
+
+
/*
* Apply fog to an array of RGBA pixels.
* Input: n - number of pixels
diff --git a/xc/extras/Mesa/src/fog.h b/xc/extras/Mesa/src/fog.h
index 9612f868d..b7fd91777 100644
--- a/xc/extras/Mesa/src/fog.h
+++ b/xc/extras/Mesa/src/fog.h
@@ -1,4 +1,4 @@
-/* $Id: fog.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: fog.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,7 +45,11 @@ extern void gl_fog_rgba_pixels( const GLcontext *ctx,
extern void gl_fog_ci_pixels( const GLcontext *ctx,
GLuint n, const GLdepth z[], GLuint indx[] );
+extern void gl_make_fog_coords( struct vertex_buffer *VB );
+
+extern struct gl_pipeline_stage gl_fog_coord_stage;
extern void gl_init_fog( void );
+
#endif
diff --git a/xc/extras/Mesa/src/fog_tmp.h b/xc/extras/Mesa/src/fog_tmp.h
index aaa092406..0d5c5db62 100644
--- a/xc/extras/Mesa/src/fog_tmp.h
+++ b/xc/extras/Mesa/src/fog_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: fog_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: fog_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -24,6 +24,178 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* For 3.2: Add a helper function for drivers to do fog coordinate
+ * calculation. Not called from standard pipelines.
+ */
+static void TAG(make_fog_coord)( struct vertex_buffer *VB,
+ const GLvector4f *eye,
+ GLubyte flag)
+{
+ const GLcontext *ctx = VB->ctx;
+ GLfloat end = ctx->Fog.End;
+ GLubyte *cullmask = VB->CullMask + VB->Start;
+ GLfloat *v = eye->start;
+ GLuint stride = eye->stride;
+ GLuint n = VB->Count - VB->Start;
+ GLubyte (*out)[4];
+ GLfloat d;
+ GLuint i;
+
+ (void) cullmask;
+ (void) flag;
+
+ /* Use specular alpha (front side) as fog coordinate.
+ */
+ out = VB->Spec[0] + VB->Start;
+
+ if (VB->EyePtr->size > 2) {
+ switch (ctx->Fog.Mode) {
+ case GL_LINEAR:
+ d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
+ for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) {
+ CULLCHECK {
+ GLfloat f = (end - ABSF(v[2])) * d;
+ FLOAT_COLOR_TO_UBYTE_COLOR(out[i][3], f);
+ }
+ }
+ break;
+ case GL_EXP:
+ d = -ctx->Fog.Density;
+ for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) {
+ CULLCHECK {
+ GLfloat f = exp( d*ABSF(v[2]) ); /* already clamped */
+ FLOAT_COLOR_TO_UBYTE_COLOR(out[i][3], f);
+ }
+ }
+ break;
+ case GL_EXP2:
+ d = -(ctx->Fog.Density*ctx->Fog.Density);
+ for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) {
+ CULLCHECK {
+ GLfloat z = v[2];
+ GLfloat f = exp( d*z*z ); /* already clamped */
+ FLOAT_COLOR_TO_UBYTE_COLOR(out[i][3], f);
+ }
+ }
+ break;
+ default:
+ gl_problem(ctx, "Bad fog mode in make_fog_coord");
+ return;
+ }
+ }
+ else
+ {
+ GLubyte r = 0;
+
+ if (ctx->Fog.Mode == GL_LINEAR) {
+ GLfloat f = ctx->Fog.End * (ctx->Fog.End - ctx->Fog.Start);
+ CLAMP_FLOAT_COLOR( f );
+ f = 1.0 - f;
+ FLOAT_COLOR_TO_UBYTE_COLOR(r, f);
+ }
+
+ for (i = 0 ; i < n ; i++)
+ out[i][3] = r;
+ }
+}
+
+
+
+
+
+#if 0
+/* For 3.3: use fog coordinates as intermediate step in all fog
+ * calculations.
+ */
+
+static void TAG(fog_rgba_vertices)( struct vertex_buffer *VB,
+ GLuint side,
+ GLubyte flag)
+{
+ const GLcontext *ctx = VB->ctx;
+ const GLubyte rFog = ctx->Fog.ByteColor[0];
+ const GLubyte gFog = ctx->Fog.ByteColor[1];
+ const GLubyte bFog = ctx->Fog.ByteColor[2];
+ GLfloat end = ctx->Fog.End;
+ GLubyte *cullmask = VB->CullMask + VB->Start;
+ GLubyte (*fcoord)[4] = VB->SpecPtr[0]->start;
+ GLuint stride = VB->SpecPtr[0]->stride;
+ GLuint n = VB->Count - VB->Start;
+ GLubyte *in;
+ GLuint in_stride;
+ GLubyte (*out)[4];
+ GLfloat d,t;
+ GLuint i;
+
+ (void) cullmask;
+ (void) flag;
+
+ /* Get correct source and destination for fogged colors.
+ */
+ in_stride = VB->Color[side]->stride;
+ in = VB->Color[side]->start;
+ VB->Color[side] = VB->FoggedColor[side];
+ VB->ColorPtr = VB->Color[0];
+ out = (GLubyte (*)[4])VB->Color[side]->start;
+
+ FLOAT_COLOR_TO_UBYTE_COLOR( rFog, ctx->Fog.Color[0] );
+
+ for ( i = 0 ; i < n ; i++, STRIDE_F(spec, sp_stride), in += in_stride) {
+ CULLCHECK {
+ GLint fc = (GLint) spec[3], ifc = 255 - fc;
+
+ out[i][0] = (fc * in[0] + ifc * rFog) >> 8;
+ out[i][1] = (fc * in[1] + ifc * gFog) >> 8;
+ out[i][2] = (fc * in[2] + ifc * bFog) >> 8;
+ }
+ }
+}
+
+
+
+static void TAG(fog_ci_vertices)( struct vertex_buffer *VB,
+ GLuint side,
+ GLubyte flag )
+{
+ GLcontext *ctx = VB->ctx;
+
+ GLubyte *cullmask = VB->CullMask + VB->Start;
+
+ GLfloat *v = VB->EyePtr->start;
+ GLuint stride = VB->EyePtr->stride;
+ GLuint vertex_size = VB->EyePtr->size;
+ GLuint n = VB->EyePtr->count;
+
+ GLuint *in;
+ GLuint in_stride;
+ GLuint *out;
+ GLuint i;
+
+ (void) flag;
+ (void) cullmask;
+
+
+ in = VB->Index[side]->start;
+ in_stride = VB->Index[side]->stride;
+ VB->IndexPtr = VB->FoggedIndex[side];
+ out = VB->IndexPtr->start;
+
+
+ /* NOTE: the extensive use of casts generates better/faster code for MIPS */
+ for ( i = 0; i < n ; i++, STRIDE_F(v,stride), STRIDE_UI(in,in_stride))
+ CULLCHECK {
+ GLfloat f = (fogend - ABSF(v[2])) * d;
+ f = CLAMP( f, 0.0, 1.0 );
+ *out = (GLint) ((GLfloat)(GLint) *in + (1.0F-f) * fogindex);
+ }
+}
+
+#endif
+
+
+
+
+
static void TAG(fog_rgba_vertices)( struct vertex_buffer *VB,
@@ -255,6 +427,7 @@ static void TAG(init_fog_tab)(void)
{
fog_ci_tab[IDX] = TAG(fog_ci_vertices);
fog_rgba_tab[IDX] = TAG(fog_rgba_vertices);
+ make_fog_coord_tab[IDX] = TAG(make_fog_coord);
}
#undef TAG
diff --git a/xc/extras/Mesa/src/general_clip.h b/xc/extras/Mesa/src/general_clip.h
index 7a77f4239..349abf2de 100644
--- a/xc/extras/Mesa/src/general_clip.h
+++ b/xc/extras/Mesa/src/general_clip.h
@@ -1,4 +1,4 @@
-/* $Id: general_clip.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: general_clip.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c
index 3546c8604..153e32a87 100644
--- a/xc/extras/Mesa/src/get.c
+++ b/xc/extras/Mesa/src/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: get.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/get.h b/xc/extras/Mesa/src/get.h
index 6fd2821ed..e87955334 100644
--- a/xc/extras/Mesa/src/get.h
+++ b/xc/extras/Mesa/src/get.h
@@ -1,4 +1,4 @@
-/* $Id: get.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: get.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/glmisc.c b/xc/extras/Mesa/src/glmisc.c
index 5afb131dc..5c2517ef7 100644
--- a/xc/extras/Mesa/src/glmisc.c
+++ b/xc/extras/Mesa/src/glmisc.c
@@ -1,4 +1,4 @@
-/* $Id: glmisc.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: glmisc.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/glmisc.h b/xc/extras/Mesa/src/glmisc.h
index 6d6af4fc2..fa3f2d213 100644
--- a/xc/extras/Mesa/src/glmisc.h
+++ b/xc/extras/Mesa/src/glmisc.h
@@ -1,4 +1,4 @@
-/* $Id: glmisc.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: glmisc.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/hash.c b/xc/extras/Mesa/src/hash.c
index 16a31b488..90373b5c2 100644
--- a/xc/extras/Mesa/src/hash.c
+++ b/xc/extras/Mesa/src/hash.c
@@ -1,4 +1,4 @@
-/* $Id: hash.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: hash.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/hash.h b/xc/extras/Mesa/src/hash.h
index dfeafd719..164f3cadc 100644
--- a/xc/extras/Mesa/src/hash.h
+++ b/xc/extras/Mesa/src/hash.h
@@ -1,4 +1,4 @@
-/* $Id: hash.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: hash.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/highpc.c b/xc/extras/Mesa/src/highpc.c
index 3cf488c0a..b3fb4ca1d 100644
--- a/xc/extras/Mesa/src/highpc.c
+++ b/xc/extras/Mesa/src/highpc.c
@@ -1,4 +1,4 @@
-/* $Id: highpc.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: highpc.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c
index bc3329ce2..d95c881df 100644
--- a/xc/extras/Mesa/src/image.c
+++ b/xc/extras/Mesa/src/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: image.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/image.h b/xc/extras/Mesa/src/image.h
index 013131cec..e5efd04fa 100644
--- a/xc/extras/Mesa/src/image.h
+++ b/xc/extras/Mesa/src/image.h
@@ -1,4 +1,4 @@
-/* $Id: image.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: image.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/indirect_tmp.h b/xc/extras/Mesa/src/indirect_tmp.h
index a74c608e9..066986ced 100644
--- a/xc/extras/Mesa/src/indirect_tmp.h
+++ b/xc/extras/Mesa/src/indirect_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: indirect_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: indirect_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/interp_tmp.h b/xc/extras/Mesa/src/interp_tmp.h
index b8d62b34e..ee4137efa 100644
--- a/xc/extras/Mesa/src/interp_tmp.h
+++ b/xc/extras/Mesa/src/interp_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: interp_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: interp_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -28,7 +28,7 @@
static void NAME( struct vertex_buffer *VB,
GLuint dst, GLfloat t, GLuint in, GLuint out )
{
-#if (IND & CLIP_RGBA0)
+#if (IND & (CLIP_RGBA0|CLIP_FOG_COORD))
GLfloat col[3][4];
#endif
@@ -57,18 +57,26 @@ static void NAME( struct vertex_buffer *VB,
{
UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Spec[0][in]);
UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Spec[0][out]);
- INTERP_SZ( t, col, 0, 1, 2, 4 );
+ INTERP_SZ( t, col, 0, 1, 2, 3 );
FLOAT_RGBA_TO_UBYTE_RGBA(VB->Spec[0][dst], col[0]);
if (VB->ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Spec[1][in]);
UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Spec[1][out]);
- INTERP_SZ( t, col, 0, 1, 2, 4 );
+ INTERP_SZ( t, col, 0, 1, 2, 3 );
FLOAT_RGBA_TO_UBYTE_RGBA(VB->Spec[1][dst], col[0]);
}
}
#endif
+#if (IND & CLIP_FOG_COORD)
+ col[0][0] = UBYTE_COLOR_TO_FLOAT_COLOR( VB->Spec[0][in][3]);
+ col[0][1] = UBYTE_COLOR_TO_FLOAT_COLOR( VB->Spec[0][out][3]);
+ col[0][2] = LINTERP( t, col[0][0], col[0][1] );
+ FLOAT_COLOR_TO_UBYTE_COLOR(VB->Spec[0][dst][3], col[0][2]);
+#endif
+
+
#if (IND & CLIP_INDEX0)
VB->IndexPtr->data[dst] = (GLuint) (GLint)
LINTERP( t,
diff --git a/xc/extras/Mesa/src/light.c b/xc/extras/Mesa/src/light.c
index b57e81364..a23291df0 100644
--- a/xc/extras/Mesa/src/light.c
+++ b/xc/extras/Mesa/src/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: light.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -62,22 +62,21 @@ void gl_ShadeModel( GLcontext *ctx, GLenum mode )
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode));
-
- switch (mode) {
- case GL_FLAT:
- case GL_SMOOTH:
- if (ctx->Light.ShadeModel!=mode) {
+ if (mode == GL_FLAT || mode == GL_SMOOTH) {
+ if (ctx->Light.ShadeModel != mode) {
ctx->Light.ShadeModel = mode;
- ctx->TriangleCaps ^= DD_FLATSHADE;
+ if (ctx->Light.ShadeModel == GL_FLAT)
+ ctx->TriangleCaps |= DD_FLATSHADE;
+ else
+ ctx->TriangleCaps &= ~DD_FLATSHADE;
ctx->NewState |= NEW_RASTER_OPS;
+ if (ctx->Driver.ShadeModel)
+ (*ctx->Driver.ShadeModel)( ctx, mode );
}
- break;
- default:
+ }
+ else {
gl_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
}
-
- if (ctx->Driver.ShadeModel)
- (*ctx->Driver.ShadeModel)( ctx, mode );
}
@@ -1122,7 +1121,7 @@ void gl_update_lighting( GLcontext *ctx )
void gl_compute_light_positions( GLcontext *ctx )
{
struct gl_light *light;
-
+
if (ctx->Light.NeedVertices && !ctx->Light.Model.LocalViewer) {
GLfloat eye_z[3] = { 0, 0, 1 };
if (!ctx->NeedEyeCoords) {
diff --git a/xc/extras/Mesa/src/light.h b/xc/extras/Mesa/src/light.h
index d17cb8d41..9725da290 100644
--- a/xc/extras/Mesa/src/light.h
+++ b/xc/extras/Mesa/src/light.h
@@ -1,4 +1,4 @@
-/* $Id: light.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: light.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/lines.c b/xc/extras/Mesa/src/lines.c
index 9f40b048d..e34164d0e 100644
--- a/xc/extras/Mesa/src/lines.c
+++ b/xc/extras/Mesa/src/lines.c
@@ -1,4 +1,4 @@
-/* $Id: lines.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: lines.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -1027,8 +1027,7 @@ void gl_set_line_function( GLcontext *ctx )
else {
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* Width==1, non-stippled, smooth-shaded */
- if (ctx->Depth.Test
- || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+ if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
if (rgbmode)
ctx->Driver.LineFunc = smooth_rgba_z_line;
else
@@ -1043,8 +1042,7 @@ void gl_set_line_function( GLcontext *ctx )
}
else {
/* Width==1, non-stippled, flat-shaded */
- if (ctx->Depth.Test
- || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+ if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
if (rgbmode)
ctx->Driver.LineFunc = flat_rgba_z_line;
else
diff --git a/xc/extras/Mesa/src/lines.h b/xc/extras/Mesa/src/lines.h
index 491c6f311..42cb513ea 100644
--- a/xc/extras/Mesa/src/lines.h
+++ b/xc/extras/Mesa/src/lines.h
@@ -1,4 +1,4 @@
-/* $Id: lines.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: lines.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/linetemp.h b/xc/extras/Mesa/src/linetemp.h
index a11ec093c..c0a53f9a8 100644
--- a/xc/extras/Mesa/src/linetemp.h
+++ b/xc/extras/Mesa/src/linetemp.h
@@ -1,4 +1,4 @@
-/* $Id: linetemp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: linetemp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -97,12 +97,12 @@
GLfixed db = IntToFixed(VB->ColorPtr->data[vert1][2]) - b0;
#endif
#if INTERP_SPEC
- GLfixed sr0 = IntToFixed(VB->Specular[vert0][0]);
- GLfixed dsr = IntToFixed(VB->Specular[vert1][0]) - sr0;
- GLfixed sg0 = IntToFixed(VB->Specular[vert0][1]);
- GLfixed dsg = IntToFixed(VB->Specular[vert1][1]) - sg0;
- GLfixed sb0 = IntToFixed(VB->Specular[vert0][2]);
- GLfixed dsb = IntToFixed(VB->Specular[vert1][2]) - sb0;
+ GLfixed sr0 = VB->Specular ? IntToFixed(VB->Specular[vert0][0]) : 0;
+ GLfixed dsr = VB->Specular ? IntToFixed(VB->Specular[vert1][0]) - sr0 : 0;
+ GLfixed sg0 = VB->Specular ? IntToFixed(VB->Specular[vert0][1]) : 0;
+ GLfixed dsg = VB->Specular ? IntToFixed(VB->Specular[vert1][1]) - sg0 : 0;
+ GLfixed sb0 = VB->Specular ? IntToFixed(VB->Specular[vert0][2]) : 0;
+ GLfixed dsb = VB->Specular ? IntToFixed(VB->Specular[vert1][2]) - sb0 : 0;
#endif
#if INTERP_ALPHA
GLfixed a0 = IntToFixed(VB->ColorPtr->data[vert0][3]);
diff --git a/xc/extras/Mesa/src/lnaatemp.h b/xc/extras/Mesa/src/lnaatemp.h
index 879429637..251a240d2 100644
--- a/xc/extras/Mesa/src/lnaatemp.h
+++ b/xc/extras/Mesa/src/lnaatemp.h
@@ -1,4 +1,4 @@
-/* $Id: lnaatemp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: lnaatemp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/logic.c b/xc/extras/Mesa/src/logic.c
index 08c443e67..20f524fe9 100644
--- a/xc/extras/Mesa/src/logic.c
+++ b/xc/extras/Mesa/src/logic.c
@@ -1,4 +1,4 @@
-/* $Id: logic.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: logic.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/logic.h b/xc/extras/Mesa/src/logic.h
index c5749fad6..425804d8b 100644
--- a/xc/extras/Mesa/src/logic.h
+++ b/xc/extras/Mesa/src/logic.h
@@ -1,4 +1,4 @@
-/* $Id: logic.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: logic.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/lowpc.c b/xc/extras/Mesa/src/lowpc.c
index 6eb3ce0f1..c333b9aeb 100644
--- a/xc/extras/Mesa/src/lowpc.c
+++ b/xc/extras/Mesa/src/lowpc.c
@@ -1,4 +1,4 @@
-/* $Id: lowpc.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: lowpc.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/macros.h b/xc/extras/Mesa/src/macros.h
index 29ff51902..ddf1fca80 100644
--- a/xc/extras/Mesa/src/macros.h
+++ b/xc/extras/Mesa/src/macros.h
@@ -1,4 +1,4 @@
-/* $Id: macros.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: macros.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/masking.c b/xc/extras/Mesa/src/masking.c
index 44ff89b06..e707c82b6 100644
--- a/xc/extras/Mesa/src/masking.c
+++ b/xc/extras/Mesa/src/masking.c
@@ -1,4 +1,4 @@
-/* $Id: masking.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: masking.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/masking.h b/xc/extras/Mesa/src/masking.h
index 75c212140..a0c455b46 100644
--- a/xc/extras/Mesa/src/masking.h
+++ b/xc/extras/Mesa/src/masking.h
@@ -1,4 +1,4 @@
-/* $Id: masking.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: masking.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/matrix.c b/xc/extras/Mesa/src/matrix.c
index f597cf60d..837528764 100644
--- a/xc/extras/Mesa/src/matrix.c
+++ b/xc/extras/Mesa/src/matrix.c
@@ -1,4 +1,4 @@
-/* $Id: matrix.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: matrix.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/matrix.h b/xc/extras/Mesa/src/matrix.h
index 97f252e04..77dcd64e8 100644
--- a/xc/extras/Mesa/src/matrix.h
+++ b/xc/extras/Mesa/src/matrix.h
@@ -1,4 +1,4 @@
-/* $Id: matrix.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: matrix.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/mmath.c b/xc/extras/Mesa/src/mmath.c
index 36f3d7ccd..e47fc371d 100644
--- a/xc/extras/Mesa/src/mmath.c
+++ b/xc/extras/Mesa/src/mmath.c
@@ -1,4 +1,4 @@
-/* $Id: mmath.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: mmath.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h
index 2c6dc65c0..5b27b0f3c 100644
--- a/xc/extras/Mesa/src/mmath.h
+++ b/xc/extras/Mesa/src/mmath.h
@@ -1,4 +1,4 @@
-/* $Id: mmath.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: mmath.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/mthreads.c b/xc/extras/Mesa/src/mthreads.c
index 8f24c9984..8c101d707 100644
--- a/xc/extras/Mesa/src/mthreads.c
+++ b/xc/extras/Mesa/src/mthreads.c
@@ -1,4 +1,4 @@
-/* $Id: mthreads.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: mthreads.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/mthreads.h b/xc/extras/Mesa/src/mthreads.h
index 8f9ad933e..3a5d997dd 100644
--- a/xc/extras/Mesa/src/mthreads.h
+++ b/xc/extras/Mesa/src/mthreads.h
@@ -1,4 +1,4 @@
-/* $Id: mthreads.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: mthreads.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/norm_tmp.h b/xc/extras/Mesa/src/norm_tmp.h
index 611862291..3ac9926f0 100644
--- a/xc/extras/Mesa/src/norm_tmp.h
+++ b/xc/extras/Mesa/src/norm_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: norm_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: norm_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/pb.c b/xc/extras/Mesa/src/pb.c
index fc859c7d0..d956b8555 100644
--- a/xc/extras/Mesa/src/pb.c
+++ b/xc/extras/Mesa/src/pb.c
@@ -1,4 +1,4 @@
-/* $Id: pb.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pb.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -285,8 +285,7 @@ void gl_flush_pb( GLcontext *ctx )
}
if (ctx->Fog.Enabled
- && (ctx->Hint.Fog==GL_NICEST || PB->primitive==GL_BITMAP
- || ctx->Texture.ReallyEnabled)) {
+ && (ctx->FogMode == FOG_FRAGMENT || PB->primitive==GL_BITMAP)) {
gl_fog_rgba_pixels( ctx, PB->count, PB->z, PB->rgba );
}
@@ -420,7 +419,7 @@ void gl_flush_pb( GLcontext *ctx )
if (ctx->MutablePixels || !PB->mono) {
if (ctx->Fog.Enabled
- && (ctx->Hint.Fog==GL_NICEST || PB->primitive==GL_BITMAP)) {
+ && (ctx->FogMode==FOG_FRAGMENT || PB->primitive==GL_BITMAP)) {
gl_fog_ci_pixels( ctx, PB->count, PB->z, PB->i );
}
diff --git a/xc/extras/Mesa/src/pb.h b/xc/extras/Mesa/src/pb.h
index d2b2c5e35..84ad6a969 100644
--- a/xc/extras/Mesa/src/pb.h
+++ b/xc/extras/Mesa/src/pb.h
@@ -1,4 +1,4 @@
-/* $Id: pb.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pb.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/pipeline.c b/xc/extras/Mesa/src/pipeline.c
index dd086c14c..46d389056 100644
--- a/xc/extras/Mesa/src/pipeline.c
+++ b/xc/extras/Mesa/src/pipeline.c
@@ -1,4 +1,4 @@
-/* $Id: pipeline.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pipeline.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -54,7 +54,7 @@
#ifndef MESA_VERBOSE
int MESA_VERBOSE = 0
/* | VERBOSE_PIPELINE */
-/* | VERBOSE_IMMEDIATE */
+ | VERBOSE_IMMEDIATE
/* | VERBOSE_VARRAY */
/* | VERBOSE_TEXTURE */
/* | VERBOSE_API */
diff --git a/xc/extras/Mesa/src/pipeline.h b/xc/extras/Mesa/src/pipeline.h
index acf750d01..b385b8688 100644
--- a/xc/extras/Mesa/src/pipeline.h
+++ b/xc/extras/Mesa/src/pipeline.h
@@ -1,4 +1,4 @@
-/* $Id: pipeline.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pipeline.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/pixel.c b/xc/extras/Mesa/src/pixel.c
index 3f553d127..0e3771a24 100644
--- a/xc/extras/Mesa/src/pixel.c
+++ b/xc/extras/Mesa/src/pixel.c
@@ -1,4 +1,4 @@
-/* $Id: pixel.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pixel.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/pixel.h b/xc/extras/Mesa/src/pixel.h
index e75989c0a..b658bb37b 100644
--- a/xc/extras/Mesa/src/pixel.h
+++ b/xc/extras/Mesa/src/pixel.h
@@ -1,4 +1,4 @@
-/* $Id: pixel.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pixel.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/pointers.c b/xc/extras/Mesa/src/pointers.c
index 03d65911d..e71268dfe 100644
--- a/xc/extras/Mesa/src/pointers.c
+++ b/xc/extras/Mesa/src/pointers.c
@@ -1,4 +1,4 @@
-/* $Id: pointers.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pointers.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/pointers.h b/xc/extras/Mesa/src/pointers.h
index 885ab6858..b3ed6f533 100644
--- a/xc/extras/Mesa/src/pointers.h
+++ b/xc/extras/Mesa/src/pointers.h
@@ -1,4 +1,4 @@
-/* $Id: pointers.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: pointers.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/points.c b/xc/extras/Mesa/src/points.c
index 1f4afa9c5..ebe00f15e 100644
--- a/xc/extras/Mesa/src/points.c
+++ b/xc/extras/Mesa/src/points.c
@@ -1,4 +1,4 @@
-/* $Id: points.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: points.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/points.h b/xc/extras/Mesa/src/points.h
index 773b422cf..8ef94f4fb 100644
--- a/xc/extras/Mesa/src/points.h
+++ b/xc/extras/Mesa/src/points.h
@@ -1,4 +1,4 @@
-/* $Id: points.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: points.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/polygon.c b/xc/extras/Mesa/src/polygon.c
index 72d6dc8ad..205d8dd44 100644
--- a/xc/extras/Mesa/src/polygon.c
+++ b/xc/extras/Mesa/src/polygon.c
@@ -1,4 +1,4 @@
-/* $Id: polygon.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: polygon.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/polygon.h b/xc/extras/Mesa/src/polygon.h
index 3271c03dd..9b2fba6e4 100644
--- a/xc/extras/Mesa/src/polygon.h
+++ b/xc/extras/Mesa/src/polygon.h
@@ -1,4 +1,4 @@
-/* $Id: polygon.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: polygon.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/quads.c b/xc/extras/Mesa/src/quads.c
index d910b400a..e23bfd479 100644
--- a/xc/extras/Mesa/src/quads.c
+++ b/xc/extras/Mesa/src/quads.c
@@ -1,4 +1,4 @@
-/* $Id: quads.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: quads.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/quads.h b/xc/extras/Mesa/src/quads.h
index 535166bbc..71781ac95 100644
--- a/xc/extras/Mesa/src/quads.h
+++ b/xc/extras/Mesa/src/quads.h
@@ -1,4 +1,4 @@
-/* $Id: quads.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: quads.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/rastpos.c b/xc/extras/Mesa/src/rastpos.c
index 6e62d1c27..a68009feb 100644
--- a/xc/extras/Mesa/src/rastpos.c
+++ b/xc/extras/Mesa/src/rastpos.c
@@ -1,4 +1,4 @@
-/* $Id: rastpos.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: rastpos.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/rastpos.h b/xc/extras/Mesa/src/rastpos.h
index f21b8151a..98b4c4678 100644
--- a/xc/extras/Mesa/src/rastpos.h
+++ b/xc/extras/Mesa/src/rastpos.h
@@ -1,4 +1,4 @@
-/* $Id: rastpos.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: rastpos.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c
index 71801ea78..9809e81a2 100644
--- a/xc/extras/Mesa/src/readpix.c
+++ b/xc/extras/Mesa/src/readpix.c
@@ -1,4 +1,4 @@
-/* $Id: readpix.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: readpix.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,6 +38,7 @@
#else
#include "GL/xf86glx.h"
#endif
+#include "alphabuf.h"
#include "context.h"
#include "depth.h"
#include "feedback.h"
@@ -570,7 +571,11 @@ read_fast_rgba_pixels( GLcontext *ctx,
GLint row;
for (row=0; row<readHeight; row++) {
(*ctx->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
- (void *) dest);
+ (GLubyte (*)[4]) dest);
+ if (ctx->Visual->SoftwareAlpha) {
+ gl_read_alpha_span(ctx, readWidth, srcX, srcY,
+ (GLubyte (*)[4]) dest);
+ }
dest += rowLength * 4;
srcY++;
}
diff --git a/xc/extras/Mesa/src/readpix.h b/xc/extras/Mesa/src/readpix.h
index b1de1bc4b..6e5fed2a1 100644
--- a/xc/extras/Mesa/src/readpix.h
+++ b/xc/extras/Mesa/src/readpix.h
@@ -1,4 +1,4 @@
-/* $Id: readpix.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: readpix.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/rect.c b/xc/extras/Mesa/src/rect.c
index 298153f71..a79f22a10 100644
--- a/xc/extras/Mesa/src/rect.c
+++ b/xc/extras/Mesa/src/rect.c
@@ -1,4 +1,4 @@
-/* $Id: rect.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: rect.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/rect.h b/xc/extras/Mesa/src/rect.h
index c5ce6b538..63d2b20f3 100644
--- a/xc/extras/Mesa/src/rect.h
+++ b/xc/extras/Mesa/src/rect.h
@@ -1,4 +1,4 @@
-/* $Id: rect.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: rect.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/render_tmp.h b/xc/extras/Mesa/src/render_tmp.h
index 178ec0b02..f550e018f 100644
--- a/xc/extras/Mesa/src/render_tmp.h
+++ b/xc/extras/Mesa/src/render_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: render_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: render_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -42,6 +42,10 @@
#define EDGEFLAG_QUAD(a,b,c,d,e)
#endif
+#ifndef RESET_STIPPLE
+#define RESET_STIPPLE
+#endif
+
static void TAG(render_vb_points)( struct vertex_buffer *VB,
GLuint start,
@@ -61,14 +65,13 @@ static void TAG(render_vb_lines)( struct vertex_buffer *VB,
GLuint parity )
{
GLuint j;
- GLuint *stipplecounter = &VB->ctx->StippleCounter;
LOCAL_VARS;
(void) parity;
INIT(GL_LINES);
for (j=start+1; j<count; j+=2 ) {
RENDER_LINE( j-1, j );
- *stipplecounter = 0;
+ RESET_STIPPLE;
}
POSTFIX;
}
@@ -86,9 +89,8 @@ static void TAG(render_vb_line_strip)( struct vertex_buffer *VB,
INIT(GL_LINES);
for (j=start+1; j<count; j++ ) {
RENDER_LINE( j-1, j );
- }
-
- VB->ctx->StippleCounter = 0;
+ }
+ RESET_STIPPLE;
POSTFIX;
}
@@ -111,7 +113,7 @@ static void TAG(render_vb_line_loop)( struct vertex_buffer *VB,
RENDER_LINE( i-1, start );
}
- VB->ctx->StippleCounter = 0;
+ RESET_STIPPLE;
POSTFIX;
}
@@ -128,6 +130,7 @@ static void TAG(render_vb_triangles)( struct vertex_buffer *VB,
INIT(GL_POLYGON);
for (j=start+2; j<count; j+=3) {
RENDER_TRI( j-2, j-1, j, j, 0 );
+ RESET_STIPPLE;
}
POSTFIX;
}
@@ -147,6 +150,7 @@ static void TAG(render_vb_tri_strip)( struct vertex_buffer *VB,
for (j=start+2;j<count;j++,parity^=1) {
EDGEFLAG_TRI( j-2, j-1, j, j, parity );
RENDER_TRI( j-2, j-1, j, j, parity );
+ RESET_STIPPLE;
}
} else {
for (j=start+2;j<count;j++,parity^=1) {
@@ -170,6 +174,7 @@ static void TAG(render_vb_tri_fan)( struct vertex_buffer *VB,
for (j=start+2;j<count;j++) {
EDGEFLAG_TRI( start, j-1, j, j, 0 );
RENDER_TRI( start, j-1, j, j, 0 );
+ RESET_STIPPLE;
}
} else {
for (j=start+2;j<count;j++) {
@@ -193,6 +198,7 @@ static void TAG(render_vb_poly)( struct vertex_buffer *VB,
for (j=start+2;j<count;j++) {
RENDER_TRI( start, j-1, j, start, 0 );
}
+ RESET_STIPPLE;
POSTFIX;
}
@@ -208,6 +214,7 @@ static void TAG(render_vb_quads)( struct vertex_buffer *VB,
INIT(GL_POLYGON);
for (j=start+3; j<count; j+=4) {
RENDER_QUAD( j-3, j-2, j-1, j, j );
+ RESET_STIPPLE;
}
POSTFIX;
}
@@ -225,6 +232,7 @@ static void TAG(render_vb_quad_strip)( struct vertex_buffer *VB,
for (j=start+3;j<count;j+=2) {
EDGEFLAG_QUAD( j-3, j-2, j, j-1, j );
RENDER_QUAD( j-3, j-2, j, j-1, j );
+ RESET_STIPPLE;
}
} else {
for (j=start+3;j<count;j+=2) {
@@ -274,6 +282,7 @@ static void TAG(render_init)( void )
#undef LOCAL_VARS
#undef INIT
#undef POSTFIX
+#undef RESET_STIPPLE
#endif
#ifndef PRESERVE_TAG
diff --git a/xc/extras/Mesa/src/scissor.c b/xc/extras/Mesa/src/scissor.c
index 5b3a2b6ae..19865fd38 100644
--- a/xc/extras/Mesa/src/scissor.c
+++ b/xc/extras/Mesa/src/scissor.c
@@ -1,4 +1,4 @@
-/* $Id: scissor.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: scissor.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/scissor.h b/xc/extras/Mesa/src/scissor.h
index 599cd711e..95b50ad92 100644
--- a/xc/extras/Mesa/src/scissor.h
+++ b/xc/extras/Mesa/src/scissor.h
@@ -1,4 +1,4 @@
-/* $Id: scissor.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: scissor.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/shade.c b/xc/extras/Mesa/src/shade.c
index e0d05007b..fdcfbf943 100644
--- a/xc/extras/Mesa/src/shade.c
+++ b/xc/extras/Mesa/src/shade.c
@@ -1,4 +1,4 @@
-/* $Id: shade.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: shade.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -302,8 +302,7 @@ void gl_shade_rastpos( GLcontext *ctx,
ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->MatDiffuse[0]);
diffuse += n_dot_VP * light->dli * attenuation;
- if (light->IsMatSpecular[0])
- {
+ if (light->IsMatSpecular[0]) {
if (ctx->Light.Model.LocalViewer) {
GLfloat v[3];
COPY_3V(v, vertex);
@@ -316,15 +315,15 @@ void gl_shade_rastpos( GLcontext *ctx,
h = VP;
ACC_3V(h, ctx->EyeZDir);
normalized = 0;
- } else {
+ }
+ else {
h = light->h_inf_norm;
normalized = 1;
}
n_dot_h = DOT3(normal, h);
- if (n_dot_h > 0.0F)
- {
+ if (n_dot_h > 0.0F) {
struct gl_material *mat = &ctx->Light.Material[0];
GLfloat spec_coef;
GLfloat shininess = mat->Shininess;
@@ -337,7 +336,8 @@ void gl_shade_rastpos( GLcontext *ctx,
if (n_dot_h>1.0) {
spec_coef = (GLfloat) pow( n_dot_h, shininess );
- } else {
+ }
+ else {
struct gl_shine_tab *tab = ctx->ShineTable[0];
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
}
@@ -354,16 +354,18 @@ void gl_shade_rastpos( GLcontext *ctx,
}
if (ctx->Visual->RGBAflag) {
- COPY_4FV(Rcolor, color);
- } else {
- GLfloat ind;
+ Rcolor[0] = CLAMP(color[0], 0.0F, 1.0F);
+ Rcolor[1] = CLAMP(color[1], 0.0F, 1.0F);
+ Rcolor[2] = CLAMP(color[2], 0.0F, 1.0F);
+ Rcolor[3] = CLAMP(color[3], 0.0F, 1.0F);
+ }
+ else {
struct gl_material *mat = &ctx->Light.Material[0];
GLfloat d_a = mat->DiffuseIndex - mat->AmbientIndex;
GLfloat s_a = mat->SpecularIndex - mat->AmbientIndex;
-
- ind = mat->AmbientIndex
- + diffuse * (1.0F-specular) * d_a
- + specular * s_a;
+ GLfloat ind = mat->AmbientIndex
+ + diffuse * (1.0F-specular) * d_a
+ + specular * s_a;
if (ind > mat->SpecularIndex) {
ind = mat->SpecularIndex;
}
diff --git a/xc/extras/Mesa/src/shade.h b/xc/extras/Mesa/src/shade.h
index 880d1f58f..d68d72bda 100644
--- a/xc/extras/Mesa/src/shade.h
+++ b/xc/extras/Mesa/src/shade.h
@@ -1,4 +1,4 @@
-/* $Id: shade.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: shade.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/shade_tmp.h b/xc/extras/Mesa/src/shade_tmp.h
index b69c9fe66..26c6b3612 100644
--- a/xc/extras/Mesa/src/shade_tmp.h
+++ b/xc/extras/Mesa/src/shade_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: shade_tmp.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: shade_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/simple_list.h b/xc/extras/Mesa/src/simple_list.h
index ebe595d63..5bb00846a 100644
--- a/xc/extras/Mesa/src/simple_list.h
+++ b/xc/extras/Mesa/src/simple_list.h
@@ -1,4 +1,4 @@
-/* $Id: simple_list.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: simple_list.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/span.c b/xc/extras/Mesa/src/span.c
index d7b21460d..022b7c3c7 100644
--- a/xc/extras/Mesa/src/span.c
+++ b/xc/extras/Mesa/src/span.c
@@ -1,4 +1,4 @@
-/* $Id: span.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: span.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/span.h b/xc/extras/Mesa/src/span.h
index ba9af27f8..be731a435 100644
--- a/xc/extras/Mesa/src/span.h
+++ b/xc/extras/Mesa/src/span.h
@@ -1,4 +1,4 @@
-/* $Id: span.h,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: span.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/stages.c b/xc/extras/Mesa/src/stages.c
index 31efaee36..737b0e13a 100644
--- a/xc/extras/Mesa/src/stages.c
+++ b/xc/extras/Mesa/src/stages.c
@@ -1,4 +1,4 @@
-/* $Id: stages.c,v 1.1 1999/12/05 23:10:26 daryll Exp $ */
+/* $Id: stages.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -515,7 +515,7 @@ static void check_fog( GLcontext *ctx, struct gl_pipeline_stage *d )
{
d->type = 0;
- if (ctx->Fog.Enabled && ctx->FogMode==FOG_VERTEX)
+ if (ctx->FogMode==FOG_VERTEX)
{
GLuint flags;
diff --git a/xc/extras/Mesa/src/stages.h b/xc/extras/Mesa/src/stages.h
index c83a33d4f..6e3ec4744 100644
--- a/xc/extras/Mesa/src/stages.h
+++ b/xc/extras/Mesa/src/stages.h
@@ -1,4 +1,4 @@
-/* $Id: stages.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: stages.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -28,8 +28,8 @@
#ifndef STAGES_H
#define STAGES_H
-extern const GLuint gl_default_nr_stages;
-extern const struct gl_pipeline_stage gl_default_pipeline[];
+extern CONST GLuint gl_default_nr_stages;
+extern CONST struct gl_pipeline_stage gl_default_pipeline[];
extern void gl_init_vbxform( void );
diff --git a/xc/extras/Mesa/src/stencil.c b/xc/extras/Mesa/src/stencil.c
index 899325b2a..d7d942721 100644
--- a/xc/extras/Mesa/src/stencil.c
+++ b/xc/extras/Mesa/src/stencil.c
@@ -1,4 +1,4 @@
-/* $Id: stencil.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: stencil.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,15 +45,6 @@
#endif
-#if STENCIL_BITS==8
-# define STENCIL_MAX 0xff
-#elif STENCIL_BITS==16
-# define STENCIL_MAX 0xffff
-#else
- illegal number of stencil bits
-#endif
-
-
/*
* Return the address of a stencil buffer value given the window coords:
@@ -177,19 +168,14 @@ void gl_StencilOp( GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass )
/* Stencil Logic:
IF stencil test fails THEN
+ Apply fail-op to stencil value
Don't write the pixel (RGBA,Z)
- Execute FailOp
-ELSE
- Write the pixel
-ENDIF
-
-Perform Depth Test
-
-IF depth test passes OR no depth buffer THEN
- Execute ZPass
- Write the pixel
ELSE
- Execute ZFail
+ IF doing depth test && depth test fails THEN
+ Apply zfail-op to stencil value
+ Write RGBA and Z to appropriate buffers
+ ELSE
+ Apply zpass-op to stencil value
ENDIF
*/
@@ -198,21 +184,19 @@ ENDIF
/*
- * Apply the given stencil operator for each pixel in the span whose
- * mask flag is set.
+ * Apply the given stencil operator to the array of stencil values.
+ * Don't touch stencil[i] if mask[i] is zero.
* Input: n - number of pixels in the span
- * x, y - location of leftmost pixel in the span
* oper - the stencil buffer operator
+ * stencil - array of stencil values
* mask - array [n] of flag: 1=apply operator, 0=don't apply operator
*/
-static void apply_stencil_op_to_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLenum oper, GLubyte mask[] )
+static void apply_stencil_op( GLcontext *ctx, GLenum oper,
+ GLuint n, GLstencil stencil[], GLubyte mask[] )
{
const GLstencil ref = ctx->Stencil.Ref;
const GLstencil wrtmask = ctx->Stencil.WriteMask;
const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask);
- GLstencil *stencil = STENCIL_ADDRESS( x, y );
GLuint i;
switch (oper) {
@@ -351,7 +335,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx,
}
break;
default:
- gl_problem(ctx, "Bad stencilop in apply_stencil_op_to_span");
+ gl_problem(ctx, "Bad stencil op in apply_stencil_op");
}
}
@@ -526,7 +510,9 @@ GLint gl_stencil_span( GLcontext *ctx,
return 0;
}
- apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.FailFunc, fail );
+ if (ctx->Stencil.FailFunc != GL_KEEP) {
+ apply_stencil_op( ctx, ctx->Stencil.FailFunc, n, stencil, fail );
+ }
return (allfail) ? 0 : 1;
}
@@ -546,11 +532,13 @@ void gl_depth_stencil_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
GLubyte mask[] )
{
+ GLstencil *stencil = STENCIL_ADDRESS(x, y);
+
if (ctx->Depth.Test==GL_FALSE) {
/*
* No depth buffer, just apply zpass stencil function to active pixels.
*/
- apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.ZPassFunc, mask );
+ apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, mask );
}
else {
/*
@@ -559,31 +547,36 @@ void gl_depth_stencil_span( GLcontext *ctx,
GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH];
GLuint i;
- /* init pass and fail masks to zero, copy mask[] to oldmask[] */
- for (i=0;i<n;i++) {
- passmask[i] = failmask[i] = 0;
- oldmask[i] = mask[i];
- }
+ /* save the current mask bits */
+ MEMCPY(oldmask, mask, n * sizeof(GLubyte));
/* apply the depth test */
if (ctx->Driver.DepthTestSpan)
(*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask );
- /* set the stencil pass/fail flags according to result of depth test */
+ /* Set the stencil pass/fail flags according to result of depth testing.
+ * if oldmask[i] == 0 then
+ * Don't touch the stencil value
+ * else if oldmask[i] and newmask[i] then
+ * Depth test passed
+ * else
+ * assert(oldmask[i] && !newmask[i])
+ * Depth test failed
+ * endif
+ */
for (i=0;i<n;i++) {
- if (oldmask[i]) {
- if (mask[i]) {
- passmask[i] = 1;
- }
- else {
- failmask[i] = 1;
- }
- }
+ ASSERT(mask[i] == 0 || mask[i] == 1);
+ passmask[i] = oldmask[i] & mask[i];
+ failmask[i] = oldmask[i] & (mask[i] ^ 1);
}
/* apply the pass and fail operations */
- apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.ZFailFunc, failmask );
- apply_stencil_op_to_span( ctx, n, x, y, ctx->Stencil.ZPassFunc, passmask );
+ if (ctx->Stencil.ZFailFunc != GL_KEEP) {
+ apply_stencil_op( ctx, ctx->Stencil.ZFailFunc, n, stencil, failmask );
+ }
+ if (ctx->Stencil.ZPassFunc != GL_KEEP) {
+ apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, passmask );
+ }
}
}
@@ -963,26 +956,27 @@ void gl_depth_stencil_pixels( GLcontext *ctx,
GLubyte passmask[PB_SIZE], failmask[PB_SIZE], oldmask[PB_SIZE];
GLuint i;
- /* init pass and fail masks to zero */
- for (i=0;i<n;i++) {
- passmask[i] = failmask[i] = 0;
- oldmask[i] = mask[i];
- }
+ /* save the current mask bits */
+ MEMCPY(oldmask, mask, n * sizeof(GLubyte));
/* apply the depth test */
if (ctx->Driver.DepthTestPixels)
(*ctx->Driver.DepthTestPixels)( ctx, n, x, y, z, mask );
- /* set the stencil pass/fail flags according to result of depth test */
+ /* Set the stencil pass/fail flags according to result of depth testing.
+ * if oldmask[i] == 0 then
+ * Don't touch the stencil value
+ * else if oldmask[i] and newmask[i] then
+ * Depth test passed
+ * else
+ * assert(oldmask[i] && !newmask[i])
+ * Depth test failed
+ * endif
+ */
for (i=0;i<n;i++) {
- if (oldmask[i]) {
- if (mask[i]) {
- passmask[i] = 1;
- }
- else {
- failmask[i] = 1;
- }
- }
+ ASSERT(mask[i] == 0 || mask[i] == 1);
+ passmask[i] = oldmask[i] & mask[i];
+ failmask[i] = oldmask[i] & (mask[i] ^ 1);
}
/* apply the pass and fail operations */
@@ -1082,30 +1076,63 @@ void gl_clear_stencil_buffer( GLcontext *ctx )
if (ctx->Scissor.Enabled) {
/* clear scissor region only */
- GLint y;
- GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
- for (y=ctx->Buffer->Ymin; y<=ctx->Buffer->Ymax; y++) {
- GLstencil *ptr = STENCIL_ADDRESS( ctx->Buffer->Xmin, y );
+ const GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
+ if (ctx->Stencil.WriteMask != STENCIL_MAX) {
+ /* must apply mask to the clear */
+ GLint y;
+ for (y=ctx->Buffer->Ymin; y<=ctx->Buffer->Ymax; y++) {
+ GLstencil *ptr = STENCIL_ADDRESS( ctx->Buffer->Xmin, y );
+ GLint x;
+ const GLstencil mask = ctx->Stencil.WriteMask;
+ const GLstencil invMask = ~mask;
+ const GLstencil clearVal = (ctx->Stencil.Clear & mask);
+ for (x = 0; x < width; x++) {
+ ptr[x] = (ptr[x] & invMask) | clearVal;
+ }
+ }
+ }
+ else {
+ /* no masking */
+ GLint y;
+ for (y=ctx->Buffer->Ymin; y<=ctx->Buffer->Ymax; y++) {
+ GLstencil *ptr = STENCIL_ADDRESS( ctx->Buffer->Xmin, y );
#if STENCIL_BITS==8
- MEMSET( ptr, ctx->Stencil.Clear, width * sizeof(GLstencil) );
+ MEMSET( ptr, ctx->Stencil.Clear, width * sizeof(GLstencil) );
#else
- GLint x;
- for (x = 0; x < width; x++)
- ptr[x] = ctx->Stencil.Clear;
+ GLint x;
+ for (x = 0; x < width; x++)
+ ptr[x] = ctx->Stencil.Clear;
#endif
+ }
}
}
else {
/* clear whole stencil buffer */
+ if (ctx->Stencil.WriteMask != STENCIL_MAX) {
+ /* must apply mask to the clear */
+ const GLuint n = ctx->Buffer->Width * ctx->Buffer->Height;
+ GLstencil *buffer = ctx->Buffer->Stencil;
+ const GLstencil mask = ctx->Stencil.WriteMask;
+ const GLstencil invMask = ~mask;
+ const GLstencil clearVal = (ctx->Stencil.Clear & mask);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ buffer[i] = (buffer[i] & invMask) | clearVal;
+ }
+ }
+ else {
+ /* clear whole buffer without masking */
+ const GLuint n = ctx->Buffer->Width * ctx->Buffer->Height;
+ GLstencil *buffer = ctx->Buffer->Stencil;
+
#if STENCIL_BITS==8
- MEMSET( ctx->Buffer->Stencil, ctx->Stencil.Clear,
- ctx->Buffer->Width * ctx->Buffer->Height * sizeof(GLstencil) );
+ MEMSET(buffer, ctx->Stencil.Clear, n * sizeof(GLstencil) );
#else
- GLuint i;
- GLuint pixels = ctx->Buffer->Width * ctx->Buffer->Height;
- GLstencil *buffer = ctx->Buffer->Stencil;
- for (i = 0; i < pixels; i++)
- ptr[i] = ctx->Stencil.Clear;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ buffer[i] = ctx->Stencil.Clear;
+ }
#endif
+ }
}
}
diff --git a/xc/extras/Mesa/src/stencil.h b/xc/extras/Mesa/src/stencil.h
index 4e0d9af7b..ccb6b9810 100644
--- a/xc/extras/Mesa/src/stencil.h
+++ b/xc/extras/Mesa/src/stencil.h
@@ -1,4 +1,4 @@
-/* $Id: stencil.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: stencil.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/texgen_tmp.h b/xc/extras/Mesa/src/texgen_tmp.h
index 3de1b3f28..e96da6569 100644
--- a/xc/extras/Mesa/src/texgen_tmp.h
+++ b/xc/extras/Mesa/src/texgen_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: texgen_tmp.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: texgen_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c
index 4b9907466..4e965b790 100644
--- a/xc/extras/Mesa/src/teximage.c
+++ b/xc/extras/Mesa/src/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: teximage.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/teximage.h b/xc/extras/Mesa/src/teximage.h
index 49174e52b..bd9fb02e0 100644
--- a/xc/extras/Mesa/src/teximage.h
+++ b/xc/extras/Mesa/src/teximage.h
@@ -1,4 +1,4 @@
-/* $Id: teximage.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: teximage.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c
index a7b89326f..484ad8ded 100644
--- a/xc/extras/Mesa/src/texobj.c
+++ b/xc/extras/Mesa/src/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: texobj.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -65,7 +65,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
{
struct gl_texture_object *obj;
- assert(dimensions <= 3);
+ ASSERT(dimensions <= 3);
obj = (struct gl_texture_object *)
calloc(1,sizeof(struct gl_texture_object));
@@ -423,14 +423,21 @@ void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture");
- dim = (GLuint) (target - GL_TEXTURE_1D);
-
- if (dim < 0 || dim > 2) {
- gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" );
- return;
+ switch (target) {
+ case GL_TEXTURE_1D:
+ dim = 1;
+ break;
+ case GL_TEXTURE_2D:
+ dim = 2;
+ break;
+ case GL_TEXTURE_3D:
+ dim = 3;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ return;
}
- dim++;
oldTexObj = texUnit->CurrentD[dim];
if (oldTexObj->Name == texName)
@@ -447,6 +454,7 @@ void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName )
if (newTexObj->Dimensions != dim) {
if (newTexObj->Dimensions) {
+ /* the named texture object's dimensions don't match the target */
gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" );
return;
}
diff --git a/xc/extras/Mesa/src/texobj.h b/xc/extras/Mesa/src/texobj.h
index 0fa60ae20..f87fbc3c7 100644
--- a/xc/extras/Mesa/src/texobj.h
+++ b/xc/extras/Mesa/src/texobj.h
@@ -1,4 +1,4 @@
-/* $Id: texobj.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: texobj.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c
index c0a2a191a..ac85cb68f 100644
--- a/xc/extras/Mesa/src/texstate.c
+++ b/xc/extras/Mesa/src/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: texstate.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -37,6 +37,7 @@
#endif
#include "context.h"
#include "enums.h"
+#include "extensions.h"
#include "macros.h"
#include "matrix.h"
#include "texobj.h"
@@ -93,9 +94,8 @@ void gl_TexEnvfv( GLcontext *ctx,
case GL_BLEND:
case GL_DECAL:
case GL_REPLACE:
- /* A small optimization for drivers */
if (texUnit->EnvMode == mode)
- return;
+ return; /* no change */
if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_TEXTURE))
fprintf(stderr, "glTexEnv: old mode %s, new mode %s\n",
diff --git a/xc/extras/Mesa/src/texstate.h b/xc/extras/Mesa/src/texstate.h
index dc96ae287..dd65245da 100644
--- a/xc/extras/Mesa/src/texstate.h
+++ b/xc/extras/Mesa/src/texstate.h
@@ -1,4 +1,4 @@
-/* $Id: texstate.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: texstate.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/texture.c b/xc/extras/Mesa/src/texture.c
index 764c04578..0d686da89 100644
--- a/xc/extras/Mesa/src/texture.c
+++ b/xc/extras/Mesa/src/texture.c
@@ -1,4 +1,4 @@
-/* $Id: texture.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: texture.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -286,6 +286,91 @@ static void palette_sample(const struct gl_texture_object *tObj,
+/*
+ * These values are used in the fixed-point arithmetic used
+ * for linear filtering.
+ */
+#define WEIGHT_SCALE 65536.0F
+#define WEIGHT_SHIFT 16
+
+
+/*
+ * Used to compute texel locations for linear sampling.
+ */
+#define COMPUTE_LINEAR_TEXEL_LOCATIONS(wrapMode, S, U, SIZE, I0, I1) \
+{ \
+ if (wrapMode == GL_REPEAT) { \
+ U = S * SIZE - 0.5F; \
+ I0 = ((GLint) myFloor(U)) & (SIZE - 1); \
+ I1 = (I0 + 1) & (SIZE - 1); \
+ } \
+ else { \
+ U = S * SIZE; \
+ if (U < 0.0F) \
+ U = 0.0F; \
+ else if (U >= SIZE) \
+ U = SIZE; \
+ U -= 0.5F; \
+ I0 = (GLint) myFloor(U); \
+ I1 = I0 + 1; \
+ if (wrapMode == GL_CLAMP_TO_EDGE) { \
+ if (I0 < 0) \
+ I0 = 0; \
+ if (I1 >= SIZE) \
+ I1 = SIZE - 1; \
+ } \
+ } \
+}
+
+
+/*
+ * Used to compute texel location for nearest sampling.
+ */
+#define COMPUTE_NEAREST_TEXEL_LOCATION(wrapMode, S, SIZE, I) \
+{ \
+ if (wrapMode == GL_REPEAT) { \
+ /* s limited to [0,1) */ \
+ /* i limited to [0,width-1] */ \
+ I = (GLint) (S * SIZE); \
+ if (S < 0.0F) \
+ I -= 1; \
+ I &= (SIZE - 1); \
+ } \
+ else if (wrapMode == GL_CLAMP_TO_EDGE) { \
+ const GLfloat min = 1.0F / (2.0F * SIZE); \
+ const GLfloat max = 1.0F - min; \
+ if (S < min) \
+ I = 0; \
+ else if (S > max) \
+ I = SIZE - 1; \
+ else \
+ I = (GLint) (S * SIZE); \
+ } \
+ else { \
+ ASSERT(wrapMode == GL_CLAMP); \
+ /* s limited to [0,1] */ \
+ /* i limited to [0,width-1] */ \
+ if (S <= 0.0F) \
+ I = 0; \
+ else if (S >= 1.0F) \
+ I = SIZE - 1; \
+ else \
+ I = (GLint) (S * SIZE); \
+ } \
+}
+
+
+/*
+ * Bitflags for texture border color sampling.
+ */
+#define I0BIT 1
+#define I1BIT 2
+#define J0BIT 4
+#define J1BIT 8
+#define K0BIT 16
+#define K1BIT 32
+
+
/**********************************************************************/
/* 1-D Texture Sampling Functions */
@@ -293,9 +378,22 @@ static void palette_sample(const struct gl_texture_object *tObj,
/*
+ * Return floor of x, being careful of negative values.
+ */
+static GLfloat myFloor(GLfloat x)
+{
+ if (x < 0.0F)
+ return (GLfloat) ((GLint) x - 1);
+ else
+ return (GLfloat) (GLint) x;
+}
+
+
+/*
* Return the fractional part of x.
*/
-#define frac(x) ( (GLfloat)(x) - (GLfloat) floor((GLfloat) x) )
+#define myFrac(x) ( (x) - myFloor(x) )
+
@@ -307,11 +405,12 @@ static void get_1d_texel( const struct gl_texture_object *tObj,
const struct gl_texture_image *img, GLint i,
GLubyte rgba[4] )
{
- GLubyte *texel;
+ const GLubyte *texel;
#ifdef DEBUG
GLint width = img->Width;
- if (i<0 || i>=width) abort();
+ assert(i >= 0);
+ assert(i < width);
#endif
switch (img->Format) {
@@ -361,36 +460,11 @@ static void sample_1d_nearest( const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
GLfloat s, GLubyte rgba[4] )
{
- GLint width = img->Width2; /* without border, power of two */
+ const GLint width = img->Width2; /* without border, power of two */
+ const GLubyte *texel;
GLint i;
- GLubyte *texel;
-
- /* Clamp/Repeat S and convert to integer texel coordinate */
- if (tObj->WrapS==GL_REPEAT) {
- /* s limited to [0,1) */
- /* i limited to [0,width-1] */
- i = (GLint) (s * width);
- if (s<0.0F) i -= 1;
- i &= (width-1);
- }
- else if (tObj->WrapS==GL_CLAMP_TO_EDGE) {
- GLfloat min = 1.0F / (2.0F * width);
- GLfloat max = 1.0F - min;
- if (s < min)
- i = 0;
- else if (s > max)
- i = width-1;
- else
- i = (GLint) (s * width);
- }
- else {
- ASSERT(tObj->WrapS==GL_CLAMP);
- /* s limited to [0,1] */
- /* i limited to [0,width-1] */
- if (s<=0.0F) i = 0;
- else if (s>=1.0F) i = width-1;
- else i = (GLint) (s * width);
- }
+
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i);
/* skip over the border, if any */
i += img->Border;
@@ -443,63 +517,32 @@ static void sample_1d_linear( const struct gl_texture_object *tObj,
GLfloat s,
GLubyte rgba[4] )
{
- GLint width = img->Width2;
+ const GLint width = img->Width2;
GLint i0, i1;
GLfloat u;
- GLint i0border = 0, i1border = 0;
-
- if (tObj->WrapS==GL_REPEAT) {
- u = s * width - 0.5F;
- i0 = ((GLint) floor(u)) & (width - 1);
- i1 = i0 + 1;
- if (i1 >= width)
- i1 = 0;
- }
- else if (tObj->WrapS==GL_CLAMP_TO_EDGE) {
- u = s * width - 0.5F;
- i0 = (GLint) floor(u);
- i1 = i0 + 1;
- if (i0 < 0)
- i0 = 0;
- else if (i0 >= width)
- i0 = width - 1;
- if (i1 < 0)
- i1 = 0;
- else if (i1 >= width)
- i1 = width - 1;
- }
- else {
- ASSERT(tObj->WrapS==GL_CLAMP);
- if (s < 0.0)
- s = 0.0;
- else if (s > 1.0)
- s = 1.0;
- u = s * width - 0.5F;
- i0 = (GLint) floor(u);
- i1 = i0 + 1;
- i0border = (i0<0) | (i0>=width);
- i1border = (i1<0) | (i1>=width);
- }
+ GLuint useBorderColor;
+
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1);
+ useBorderColor = 0;
if (img->Border) {
i0 += img->Border;
i1 += img->Border;
- if (tObj->WrapS != GL_CLAMP)
- i0border = i1border = 0;
}
else {
- i0 &= (width-1);
+ if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT;
+ if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT;
}
{
- GLfloat a = frac(u);
-
- GLint w0 = (GLint) ((1.0F-a) * 256.0F);
- GLint w1 = (GLint) ( a * 256.0F);
+ GLfloat a = myFrac(u);
+ /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */
+ GLint w0 = (GLint) ((1.0F-a) * WEIGHT_SCALE + 0.5F);
+ GLint w1 = (GLint) ( a * WEIGHT_SCALE + 0.5F);
GLubyte t0[4], t1[4]; /* texels */
- if (i0border) {
+ if (useBorderColor & I0BIT) {
t0[RCOMP] = tObj->BorderColor[0];
t0[GCOMP] = tObj->BorderColor[1];
t0[BCOMP] = tObj->BorderColor[2];
@@ -508,7 +551,7 @@ static void sample_1d_linear( const struct gl_texture_object *tObj,
else {
get_1d_texel( tObj, img, i0, t0 );
}
- if (i1border) {
+ if (useBorderColor & I1BIT) {
t1[RCOMP] = tObj->BorderColor[0];
t1[GCOMP] = tObj->BorderColor[1];
t1[BCOMP] = tObj->BorderColor[2];
@@ -518,10 +561,10 @@ static void sample_1d_linear( const struct gl_texture_object *tObj,
get_1d_texel( tObj, img, i1, t1 );
}
- rgba[0] = (GLubyte) ((w0 * t0[0] + w1 * t1[0]) >> 8);
- rgba[1] = (GLubyte) ((w0 * t0[1] + w1 * t1[1]) >> 8);
- rgba[2] = (GLubyte) ((w0 * t0[2] + w1 * t1[2]) >> 8);
- rgba[3] = (GLubyte) ((w0 * t0[3] + w1 * t1[3]) >> 8);
+ rgba[0] = (GLubyte) ((w0 * t0[0] + w1 * t1[0]) >> WEIGHT_SHIFT);
+ rgba[1] = (GLubyte) ((w0 * t0[1] + w1 * t1[1]) >> WEIGHT_SHIFT);
+ rgba[2] = (GLubyte) ((w0 * t0[2] + w1 * t1[2]) >> WEIGHT_SHIFT);
+ rgba[3] = (GLubyte) ((w0 * t0[3] + w1 * t1[3]) >> WEIGHT_SHIFT);
}
}
@@ -580,7 +623,7 @@ sample_1d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
}
else {
GLubyte t0[4], t1[4];
- GLfloat f = frac(lambda);
+ GLfloat f = myFrac(lambda);
sample_1d_nearest( tObj, tObj->Image[level ], s, t0 );
sample_1d_nearest( tObj, tObj->Image[level+1], s, t1 );
rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
@@ -609,7 +652,7 @@ sample_1d_linear_mipmap_linear( const struct gl_texture_object *tObj,
}
else {
GLubyte t0[4], t1[4];
- GLfloat f = frac(lambda);
+ GLfloat f = myFrac(lambda);
sample_1d_linear( tObj, tObj->Image[level ], s, t0 );
sample_1d_linear( tObj, tObj->Image[level+1], s, t1 );
rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
@@ -729,13 +772,15 @@ static void get_2d_texel( const struct gl_texture_object *tObj,
const struct gl_texture_image *img, GLint i, GLint j,
GLubyte rgba[4] )
{
- GLint width = img->Width; /* includes border */
- GLubyte *texel;
+ const GLint width = img->Width; /* includes border */
+ const GLubyte *texel;
#ifdef DEBUG
- GLint height = img->Height; /* includes border */
- if (i<0 || i>=width) abort();
- if (j<0 || j>=height) abort();
+ const GLint height = img->Height; /* includes border */
+ assert(i >= 0);
+ assert(i < width);
+ assert(j >= 0);
+ assert(j < height);
#endif
switch (img->Format) {
@@ -785,65 +830,14 @@ static void sample_2d_nearest( const struct gl_texture_object *tObj,
GLfloat s, GLfloat t,
GLubyte rgba[] )
{
- GLint imgWidth = img->Width; /* includes border */
- GLint width = img->Width2; /* without border, power of two */
- GLint height = img->Height2; /* without border, power of two */
+ const GLint imgWidth = img->Width; /* includes border */
+ const GLint width = img->Width2; /* without border, power of two */
+ const GLint height = img->Height2; /* without border, power of two */
+ const GLubyte *texel;
GLint i, j;
- GLubyte *texel;
-
- /* Clamp/Repeat S and convert to integer texel coordinate */
- if (tObj->WrapS==GL_REPEAT) {
- /* s limited to [0,1) */
- /* i limited to [0,width-1] */
- i = (GLint) (s * width);
- if (s<0.0F) i -= 1;
- i &= (width-1);
- }
- else if (tObj->WrapS==GL_CLAMP_TO_EDGE) {
- GLfloat min = 1.0F / (2.0F * width);
- GLfloat max = 1.0F - min;
- if (s < min)
- i = 0;
- else if (s > max)
- i = width-1;
- else
- i = (GLint) (s * width);
- }
- else {
- ASSERT(tObj->WrapS==GL_CLAMP);
- /* s limited to [0,1] */
- /* i limited to [0,width-1] */
- if (s<=0.0F) i = 0;
- else if (s>=1.0F) i = width-1;
- else i = (GLint) (s * width);
- }
- /* Clamp/Repeat T and convert to integer texel coordinate */
- if (tObj->WrapT==GL_REPEAT) {
- /* t limited to [0,1) */
- /* j limited to [0,height-1] */
- j = (GLint) (t * height);
- if (t<0.0F) j -= 1;
- j &= (height-1);
- }
- else if (tObj->WrapT==GL_CLAMP_TO_EDGE) {
- GLfloat min = 1.0F / (2.0F * height);
- GLfloat max = 1.0F - min;
- if (t < min)
- j = 0;
- else if (t > max)
- j = height-1;
- else
- j = (GLint) (t * height);
- }
- else {
- ASSERT(tObj->WrapT==GL_CLAMP);
- /* t limited to [0,1] */
- /* j limited to [0,height-1] */
- if (t<=0.0F) j = 0;
- else if (t>=1.0F) j = height-1;
- else j = (GLint) (t * height);
- }
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j);
/* skip over the border, if any */
i += img->Border;
@@ -897,107 +891,43 @@ static void sample_2d_linear( const struct gl_texture_object *tObj,
GLfloat s, GLfloat t,
GLubyte rgba[] )
{
- GLint width = img->Width2;
- GLint height = img->Height2;
+ const GLint width = img->Width2;
+ const GLint height = img->Height2;
GLint i0, j0, i1, j1;
- GLint i0border = 0;
- GLint i1border = 0;
- GLint j0border = 0;
- GLint j1border = 0;
+ GLuint useBorderColor;
GLfloat u, v;
- if (tObj->WrapS==GL_REPEAT) {
- u = s * width - 0.5F;
- i0 = ((GLint) floor(u)) & (width - 1);
- i1 = i0 + 1;
- if (i1 >= width)
- i1 = 0;
- }
- else if (tObj->WrapS==GL_CLAMP_TO_EDGE) {
- u = s * width - 0.5F;
- i0 = (GLint) floor(u);
- i1 = i0 + 1;
- if (i0 < 0)
- i0 = 0;
- else if (i0 >= width)
- i0 = width - 1;
- if (i1 < 0)
- i1 = 0;
- else if (i1 >= width)
- i1 = width - 1;
- }
- else {
- ASSERT(tObj->WrapS==GL_CLAMP);
- if (s < 0.0)
- s = 0.0;
- else if (s > 1.0)
- s = 1.0;
- u = s * width - 0.5F;
- i0 = (GLint) floor(u);
- i1 = i0 + 1;
- i0border = (i0<0) | (i0>=width);
- i1border = (i1<0) | (i1>=width);
- }
-
- if (tObj->WrapT==GL_REPEAT) {
- v = t * height - 0.5F;
- j0 = ((GLint) floor(v)) & (height - 1);
- j1 = (j0 + 1);
- if (j1 >= height)
- j1 = 0;
- }
- else if (tObj->WrapT==GL_CLAMP_TO_EDGE) {
- v = t * height - 0.5F;
- j0 = (GLint) floor(v);
- j1 = j0 + 1;
- if (j0 < 0)
- j0 = 0;
- else if (j0 >= height)
- j0 = height-1;
- if (j1 < 0)
- j1 = 0;
- else if (j1 >= height)
- j1 = height-1;
- }
- else {
- ASSERT(tObj->WrapT==GL_CLAMP);
- if (t < 0.0)
- t = 0.0;
- else if (t > 1.0)
- t = 1.0;
- v = t * height - 0.5F;
- j0 = (GLint) floor(v);
- j1 = j0 + 1;
- j0border = (j0<0) | (j0>=height);
- j1border = (j1<0) | (j1>=height);
- }
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, t, v, height, j0, j1);
+ useBorderColor = 0;
if (img->Border) {
i0 += img->Border;
i1 += img->Border;
j0 += img->Border;
j1 += img->Border;
- if (tObj->WrapS != GL_CLAMP)
- i0border = i1border = 0;
- if (tObj->WrapT != GL_CLAMP)
- j0border = j1border = 0;
+ }
+ else {
+ if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT;
+ if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT;
+ if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT;
+ if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT;
}
{
- GLfloat a = frac(u);
- GLfloat b = frac(v);
-
- GLint w00 = (GLint) ((1.0F-a)*(1.0F-b) * 256.0F);
- GLint w10 = (GLint) ( a *(1.0F-b) * 256.0F);
- GLint w01 = (GLint) ((1.0F-a)* b * 256.0F);
- GLint w11 = (GLint) ( a * b * 256.0F);
-
+ GLfloat a = myFrac(u);
+ GLfloat b = myFrac(v);
+ /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */
+ GLint w00 = (GLint) ((1.0F-a)*(1.0F-b) * WEIGHT_SCALE + 0.5F);
+ GLint w10 = (GLint) ( a *(1.0F-b) * WEIGHT_SCALE + 0.5F);
+ GLint w01 = (GLint) ((1.0F-a)* b * WEIGHT_SCALE + 0.5F);
+ GLint w11 = (GLint) ( a * b * WEIGHT_SCALE + 0.5F);
GLubyte t00[4];
GLubyte t10[4];
GLubyte t01[4];
GLubyte t11[4];
- if (i0border | j0border) {
+ if (useBorderColor & (I0BIT | J0BIT)) {
t00[RCOMP] = tObj->BorderColor[0];
t00[GCOMP] = tObj->BorderColor[1];
t00[BCOMP] = tObj->BorderColor[2];
@@ -1006,7 +936,7 @@ static void sample_2d_linear( const struct gl_texture_object *tObj,
else {
get_2d_texel( tObj, img, i0, j0, t00 );
}
- if (i1border | j0border) {
+ if (useBorderColor & (I1BIT | J0BIT)) {
t10[RCOMP] = tObj->BorderColor[0];
t10[GCOMP] = tObj->BorderColor[1];
t10[BCOMP] = tObj->BorderColor[2];
@@ -1015,7 +945,7 @@ static void sample_2d_linear( const struct gl_texture_object *tObj,
else {
get_2d_texel( tObj, img, i1, j0, t10 );
}
- if (i0border | j1border) {
+ if (useBorderColor & (I0BIT | J1BIT)) {
t01[RCOMP] = tObj->BorderColor[0];
t01[GCOMP] = tObj->BorderColor[1];
t01[BCOMP] = tObj->BorderColor[2];
@@ -1024,7 +954,7 @@ static void sample_2d_linear( const struct gl_texture_object *tObj,
else {
get_2d_texel( tObj, img, i0, j1, t01 );
}
- if (i1border | j1border) {
+ if (useBorderColor & (I1BIT | J1BIT)) {
t11[RCOMP] = tObj->BorderColor[0];
t11[GCOMP] = tObj->BorderColor[1];
t11[BCOMP] = tObj->BorderColor[2];
@@ -1034,11 +964,12 @@ static void sample_2d_linear( const struct gl_texture_object *tObj,
get_2d_texel( tObj, img, i1, j1, t11 );
}
- rgba[0] = (GLubyte) ((w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]) >> 8);
- rgba[1] = (GLubyte) ((w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]) >> 8);
- rgba[2] = (GLubyte) ((w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]) >> 8);
- rgba[3] = (GLubyte) ((w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]) >> 8);
+ rgba[0] = (GLubyte) ((w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]) >> WEIGHT_SHIFT);
+ rgba[1] = (GLubyte) ((w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]) >> WEIGHT_SHIFT);
+ rgba[2] = (GLubyte) ((w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]) >> WEIGHT_SHIFT);
+ rgba[3] = (GLubyte) ((w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]) >> WEIGHT_SHIFT);
}
+
}
@@ -1098,7 +1029,7 @@ sample_2d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
}
else {
GLubyte t0[4], t1[4]; /* texels */
- GLfloat f = frac(lambda);
+ GLfloat f = myFrac(lambda);
sample_2d_nearest( tObj, tObj->Image[level ], s, t, t0 );
sample_2d_nearest( tObj, tObj->Image[level+1], s, t, t1 );
rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
@@ -1127,7 +1058,7 @@ sample_2d_linear_mipmap_linear( const struct gl_texture_object *tObj,
}
else {
GLubyte t0[4], t1[4]; /* texels */
- GLfloat f = frac(lambda);
+ GLfloat f = myFrac(lambda);
sample_2d_linear( tObj, tObj->Image[level ], s, t, t0 );
sample_2d_linear( tObj, tObj->Image[level+1], s, t, t1 );
rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
@@ -1323,20 +1254,19 @@ static void get_3d_texel( const struct gl_texture_object *tObj,
GLint i, GLint j, GLint k,
GLubyte rgba[4] )
{
- GLint width = img->Width; /* includes border */
- GLint height = img->Height; /* includes border */
- GLint depth = img->Depth; /* includes border */
- GLint rectarea; /* = width * heigth */
- GLubyte *texel;
-
- rectarea = width*height;
+ const GLint width = img->Width; /* includes border */
+ const GLint height = img->Height; /* includes border */
+ const GLint rectarea = width * height;
+ const GLubyte *texel;
#ifdef DEBUG
- if (i<0 || i>=width) abort();
- if (j<0 || j>=height) abort();
- if (k<0 || k>=depth) abort();
-#else
- (void) depth;
+ const GLint depth = img->Depth; /* includes border */
+ assert(i >= 0);
+ assert(i < width);
+ assert(j >= 0);
+ assert(j < height);
+ assert(k >= 0);
+ assert(k < depth);
#endif
switch (img->Format) {
@@ -1385,97 +1315,18 @@ static void sample_3d_nearest( const struct gl_texture_object *tObj,
GLfloat s, GLfloat t, GLfloat r,
GLubyte rgba[4] )
{
- GLint imgWidth = img->Width; /* includes border, if any */
- GLint imgHeight = img->Height; /* includes border, if any */
- GLint width = img->Width2; /* without border, power of two */
- GLint height = img->Height2; /* without border, power of two */
- GLint depth = img->Depth2; /* without border, power of two */
- GLint rectarea; /* = width * height */
+ const GLint imgWidth = img->Width; /* includes border, if any */
+ const GLint imgHeight = img->Height; /* includes border, if any */
+ const GLint width = img->Width2; /* without border, power of two */
+ const GLint height = img->Height2; /* without border, power of two */
+ const GLint depth = img->Depth2; /* without border, power of two */
+ const GLint rectarea = imgWidth * imgHeight;
+ const GLubyte *texel;
GLint i, j, k;
- GLubyte *texel;
-
- rectarea = imgWidth * imgHeight;
-
- /* Clamp/Repeat S and convert to integer texel coordinate */
- if (tObj->WrapS==GL_REPEAT) {
- /* s limited to [0,1) */
- /* i limited to [0,width-1] */
- i = (GLint) (s * width);
- if (s<0.0F) i -= 1;
- i &= (width-1);
- }
- else if (tObj->WrapS==GL_CLAMP_TO_EDGE) {
- GLfloat min = 1.0F / (2.0F * width);
- GLfloat max = 1.0F - min;
- if (s < min)
- i = 0;
- else if (s > max)
- i = width-1;
- else
- i = (GLint) (s * width);
- }
- else {
- ASSERT(tObj->WrapS==GL_CLAMP);
- /* s limited to [0,1] */
- /* i limited to [0,width-1] */
- if (s<=0.0F) i = 0;
- else if (s>=1.0F) i = width-1;
- else i = (GLint) (s * width);
- }
-
- /* Clamp/Repeat T and convert to integer texel coordinate */
- if (tObj->WrapT==GL_REPEAT) {
- /* t limited to [0,1) */
- /* j limited to [0,height-1] */
- j = (GLint) (t * height);
- if (t<0.0F) j -= 1;
- j &= (height-1);
- }
- else if (tObj->WrapT==GL_CLAMP_TO_EDGE) {
- GLfloat min = 1.0F / (2.0F * height);
- GLfloat max = 1.0F - min;
- if (t < min)
- j = 0;
- else if (t > max)
- j = height-1;
- else
- j = (GLint) (t * height);
- }
- else {
- ASSERT(tObj->WrapT==GL_CLAMP);
- /* t limited to [0,1] */
- /* j limited to [0,height-1] */
- if (t<=0.0F) j = 0;
- else if (t>=1.0F) j = height-1;
- else j = (GLint) (t * height);
- }
- /* Clamp/Repeat R and convert to integer texel coordinate */
- if (tObj->WrapR==GL_REPEAT) {
- /* r limited to [0,1) */
- /* k limited to [0,depth-1] */
- k = (GLint) (r * depth);
- if (r<0.0F) k -= 1;
- k &= (depth-1);
- }
- else if (tObj->WrapR==GL_CLAMP_TO_EDGE) {
- GLfloat min = 1.0F / (2.0F * depth);
- GLfloat max = 1.0F - min;
- if (r < min)
- k = 0;
- else if (r > max)
- k = depth-1;
- else
- k = (GLint) (t * depth);
- }
- else {
- ASSERT(tObj->WrapR==GL_CLAMP);
- /* r limited to [0,1] */
- /* k limited to [0,depth-1] */
- if (r<=0.0F) k = 0;
- else if (r>=1.0F) k = depth-1;
- else k = (GLint) (r * depth);
- }
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, r, depth, k);
switch (tObj->Image[0]->Format) {
case GL_COLOR_INDEX:
@@ -1515,6 +1366,7 @@ static void sample_3d_nearest( const struct gl_texture_object *tObj,
}
+
/*
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
@@ -1523,113 +1375,18 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
GLfloat s, GLfloat t, GLfloat r,
GLubyte rgba[4] )
{
- GLint width = img->Width2;
- GLint height = img->Height2;
- GLint depth = img->Depth2;
+ const GLint width = img->Width2;
+ const GLint height = img->Height2;
+ const GLint depth = img->Depth2;
GLint i0, j0, k0, i1, j1, k1;
- GLint i0border = 0, j0border = 0, k0border = 0;
- GLint i1border = 0, j1border = 0, k1border = 0;
+ GLuint useBorderColor;
GLfloat u, v, w;
- if (tObj->WrapS==GL_REPEAT) {
- u = s * width - 0.5F;
- i0 = ((GLint) floor(u)) & (width - 1);
- i1 = i0 + 1;
- if (i1 >= width)
- i1 = 0;
- }
- else if (tObj->WrapS==GL_CLAMP_TO_EDGE) {
- u = s * width - 0.5F;
- i0 = (GLint) floor(u);
- i1 = i0 + 1;
- if (i0 < 0)
- i0 = 0;
- else if (i0 >= width)
- i0 = width - 1;
- if (i1 < 0)
- i1 = 0;
- else if (i1 >= width)
- i1 = width - 1;
- }
- else {
- ASSERT(tObj->WrapS==GL_CLAMP);
- if (s < 0.0)
- s = 0.0;
- else if (s > 1.0)
- s = 1.0;
- u = s * width - 0.5F;
- i0 = (GLint) floor(u);
- i1 = i0 + 1;
- i0border = (i0<0) | (i0>=width);
- i1border = (i1<0) | (i1>=width);
- }
-
- if (tObj->WrapT==GL_REPEAT) {
- v = t * height - 0.5F;
- j0 = ((GLint) floor(v)) & (height - 1);
- j1 = (j0 + 1);
- if (j1 >= height)
- j1 = 0;
- }
- else if (tObj->WrapT==GL_CLAMP_TO_EDGE) {
- v = t * height - 0.5F;
- j0 = (GLint) floor(v);
- j1 = j0 + 1;
- if (j0 < 0)
- j0 = 0;
- else if (j0 >= height)
- j0 = height-1;
- if (j1 < 0)
- j1 = 0;
- else if (j1 >= height)
- j1 = height-1;
- }
- else {
- ASSERT(tObj->WrapT==GL_CLAMP);
- if (t < 0.0)
- t = 0.0;
- else if (t > 1.0)
- t = 1.0;
- v = t * height - 0.5F;
- j0 = (GLint) floor(v);
- j1 = j0 + 1;
- j0border = (j0<0) | (j0>=height);
- j1border = (j1<0) | (j1>=height);
- }
-
- if (tObj->WrapR==GL_REPEAT) {
- w = r * depth - 0.5F;
- k0 = ((GLint) floor(w)) & (depth - 1);
- k1 = (k0 + 1);
- if (k1 >= depth)
- k1 = 0;
- }
- else if (tObj->WrapR==GL_CLAMP_TO_EDGE) {
- w = r * depth - 0.5F;
- k0 = (GLint) floor(w);
- k1 = k0 + 1;
- if (k0 < 0)
- k0 = 0;
- else if (k0 >= depth)
- k0 = depth-1;
- if (k1 < 0)
- k1 = 0;
- else if (k1 >= depth)
- k1 = depth-1;
- }
- else {
- ASSERT(tObj->WrapR==GL_CLAMP);
- if (r < 0.0)
- r = 0.0;
- else if (r > 1.0)
- r = 1.0;
- w = r * depth - 0.5F;
- k0 = (GLint) floor(w);
- k1 = k0 + 1;
- k0border = (k0<0) | (k0>=depth);
- k1border = (k1<0) | (k1>=depth);
- }
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, t, v, height, j0, j1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, r, w, depth, k0, k1);
+ useBorderColor = 0;
if (img->Border) {
i0 += img->Border;
i1 += img->Border;
@@ -1637,38 +1394,35 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
j1 += img->Border;
k0 += img->Border;
k1 += img->Border;
- if (tObj->WrapS != GL_CLAMP)
- i0border = i1border = 0;
- if (tObj->WrapT != GL_CLAMP)
- j0border = j1border = 0;
- if (tObj->WrapR != GL_CLAMP)
- k0border = k1border = 0;
}
else {
- i0 &= (width-1);
- j0 &= (height-1);
- k0 &= (depth-1);
+ /* check if sampling texture border color */
+ if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT;
+ if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT;
+ if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT;
+ if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT;
+ if (k0 < 0 || k0 >= depth) useBorderColor |= K0BIT;
+ if (k1 < 0 || k1 >= depth) useBorderColor |= K1BIT;
}
{
- GLfloat a = frac(u);
- GLfloat b = frac(v);
- GLfloat c = frac(w);
-
- GLint w000 = (GLint) ((1.0F-a)*(1.0F-b) * (1.0F-c) * 256.0F);
- GLint w100 = (GLint) ( a *(1.0F-b) * (1.0F-c) * 256.0F);
- GLint w010 = (GLint) ((1.0F-a)* b * (1.0F-c) * 256.0F);
- GLint w110 = (GLint) ( a * b * (1.0F-c) * 256.0F);
- GLint w001 = (GLint) ((1.0F-a)*(1.0F-b) * c * 256.0F);
- GLint w101 = (GLint) ( a *(1.0F-b) * c * 256.0F);
- GLint w011 = (GLint) ((1.0F-a)* b * c * 256.0F);
- GLint w111 = (GLint) ( a * b * c * 256.0F);
-
-
- GLubyte t000[4], t010[4], t001[4], t011[4]; /* texels */
+ GLfloat a = myFrac(u);
+ GLfloat b = myFrac(v);
+ GLfloat c = myFrac(w);
+ /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */
+ GLint w000 = (GLint) ((1.0F-a)*(1.0F-b)*(1.0F-c) * WEIGHT_SCALE + 0.5F);
+ GLint w100 = (GLint) ( a *(1.0F-b)*(1.0F-c) * WEIGHT_SCALE + 0.5F);
+ GLint w010 = (GLint) ((1.0F-a)* b *(1.0F-c) * WEIGHT_SCALE + 0.5F);
+ GLint w110 = (GLint) ( a * b *(1.0F-c) * WEIGHT_SCALE + 0.5F);
+ GLint w001 = (GLint) ((1.0F-a)*(1.0F-b)* c * WEIGHT_SCALE + 0.5F);
+ GLint w101 = (GLint) ( a *(1.0F-b)* c * WEIGHT_SCALE + 0.5F);
+ GLint w011 = (GLint) ((1.0F-a)* b * c * WEIGHT_SCALE + 0.5F);
+ GLint w111 = (GLint) ( a * b * c * WEIGHT_SCALE + 0.5F);
+
+ GLubyte t000[4], t010[4], t001[4], t011[4];
GLubyte t100[4], t110[4], t101[4], t111[4];
- if (k0border | i0border | j0border ) {
+ if (useBorderColor & (I0BIT | J0BIT | K0BIT)) {
t000[RCOMP] = tObj->BorderColor[0];
t000[GCOMP] = tObj->BorderColor[1];
t000[BCOMP] = tObj->BorderColor[2];
@@ -1677,7 +1431,7 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
else {
get_3d_texel( tObj, img, i0, j0, k0, t000 );
}
- if (k0border | i1border | j0border) {
+ if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
t100[RCOMP] = tObj->BorderColor[0];
t100[GCOMP] = tObj->BorderColor[1];
t100[BCOMP] = tObj->BorderColor[2];
@@ -1686,7 +1440,7 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
else {
get_3d_texel( tObj, img, i1, j0, k0, t100 );
}
- if (k0border | i0border | j1border) {
+ if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
t010[RCOMP] = tObj->BorderColor[0];
t010[GCOMP] = tObj->BorderColor[1];
t010[BCOMP] = tObj->BorderColor[2];
@@ -1695,7 +1449,7 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
else {
get_3d_texel( tObj, img, i0, j1, k0, t010 );
}
- if (k0border | i1border | j1border) {
+ if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
t110[RCOMP] = tObj->BorderColor[0];
t110[GCOMP] = tObj->BorderColor[1];
t110[BCOMP] = tObj->BorderColor[2];
@@ -1705,7 +1459,7 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
get_3d_texel( tObj, img, i1, j1, k0, t110 );
}
- if (k1border | i0border | j0border ) {
+ if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
t001[RCOMP] = tObj->BorderColor[0];
t001[GCOMP] = tObj->BorderColor[1];
t001[BCOMP] = tObj->BorderColor[2];
@@ -1714,7 +1468,7 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
else {
get_3d_texel( tObj, img, i0, j0, k1, t001 );
}
- if (k1border | i1border | j0border) {
+ if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
t101[RCOMP] = tObj->BorderColor[0];
t101[GCOMP] = tObj->BorderColor[1];
t101[BCOMP] = tObj->BorderColor[2];
@@ -1723,7 +1477,7 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
else {
get_3d_texel( tObj, img, i1, j0, k1, t101 );
}
- if (k1border | i0border | j1border) {
+ if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
t011[RCOMP] = tObj->BorderColor[0];
t011[GCOMP] = tObj->BorderColor[1];
t011[BCOMP] = tObj->BorderColor[2];
@@ -1732,7 +1486,7 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
else {
get_3d_texel( tObj, img, i0, j1, k1, t011 );
}
- if (k1border | i1border | j1border) {
+ if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
t111[RCOMP] = tObj->BorderColor[0];
t111[GCOMP] = tObj->BorderColor[1];
t111[BCOMP] = tObj->BorderColor[2];
@@ -1745,19 +1499,19 @@ static void sample_3d_linear( const struct gl_texture_object *tObj,
rgba[0] = (GLubyte) (
(w000*t000[0] + w010*t010[0] + w001*t001[0] + w011*t011[0] +
w100*t100[0] + w110*t110[0] + w101*t101[0] + w111*t111[0] )
- >> 8);
+ >> WEIGHT_SHIFT);
rgba[1] = (GLubyte) (
(w000*t000[1] + w010*t010[1] + w001*t001[1] + w011*t011[1] +
w100*t100[1] + w110*t110[1] + w101*t101[1] + w111*t111[1] )
- >> 8);
+ >> WEIGHT_SHIFT);
rgba[2] = (GLubyte) (
(w000*t000[2] + w010*t010[2] + w001*t001[2] + w011*t011[2] +
w100*t100[2] + w110*t110[2] + w101*t101[2] + w111*t111[2] )
- >> 8);
+ >> WEIGHT_SHIFT);
rgba[3] = (GLubyte) (
(w000*t000[3] + w010*t010[3] + w001*t001[3] + w011*t011[3] +
w100*t100[3] + w110*t110[3] + w101*t101[3] + w111*t111[3] )
- >> 8);
+ >> WEIGHT_SHIFT);
}
}
@@ -1816,7 +1570,7 @@ sample_3d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
}
else {
GLubyte t0[4], t1[4]; /* texels */
- GLfloat f = frac(lambda);
+ GLfloat f = myFrac(lambda);
sample_3d_nearest( tObj, tObj->Image[level ], s, t, r, t0 );
sample_3d_nearest( tObj, tObj->Image[level+1], s, t, r, t1 );
rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
@@ -1844,7 +1598,7 @@ sample_3d_linear_mipmap_linear( const struct gl_texture_object *tObj,
}
else {
GLubyte t0[4], t1[4]; /* texels */
- GLfloat f = frac(lambda);
+ GLfloat f = myFrac(lambda);
sample_3d_linear( tObj, tObj->Image[level ], s, t, r, t0 );
sample_3d_linear( tObj, tObj->Image[level+1], s, t, r, t1 );
rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
diff --git a/xc/extras/Mesa/src/texture.h b/xc/extras/Mesa/src/texture.h
index e2d3d963e..481c73950 100644
--- a/xc/extras/Mesa/src/texture.h
+++ b/xc/extras/Mesa/src/texture.h
@@ -1,4 +1,4 @@
-/* $Id: texture.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: texture.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/trans_tmp.h b/xc/extras/Mesa/src/trans_tmp.h
index 45b3ce3cc..a75cf8234 100644
--- a/xc/extras/Mesa/src/trans_tmp.h
+++ b/xc/extras/Mesa/src/trans_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: trans_tmp.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: trans_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/translate.c b/xc/extras/Mesa/src/translate.c
index f025e6374..3cf841dc8 100644
--- a/xc/extras/Mesa/src/translate.c
+++ b/xc/extras/Mesa/src/translate.c
@@ -1,4 +1,4 @@
-/* $Id: translate.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: translate.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/translate.h b/xc/extras/Mesa/src/translate.h
index 51983e85a..d3f99df41 100644
--- a/xc/extras/Mesa/src/translate.h
+++ b/xc/extras/Mesa/src/translate.h
@@ -1,4 +1,4 @@
-/* $Id: translate.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: translate.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/triangle.c b/xc/extras/Mesa/src/triangle.c
index 6255abd35..d51d460ab 100644
--- a/xc/extras/Mesa/src/triangle.c
+++ b/xc/extras/Mesa/src/triangle.c
@@ -1,4 +1,4 @@
-/* $Id: triangle.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: triangle.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -249,18 +249,10 @@ static void simple_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
GLint tmask = obj->Image[b]->Height - 1;
(void) pv;
-#define RGB_TEX \
- rgba[i][RCOMP] = texture[pos]; \
- rgba[i][GCOMP] = texture[pos+1]; \
- rgba[i][BCOMP] = texture[pos+2]; \
- rgba[i][ACOMP] = 255
-
-
-
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, n = RIGHT-LEFT; \
- GLubyte rgba[MAX_WIDTH][4]; \
+ GLubyte rgb[MAX_WIDTH][3]; \
if (n>0) { \
ffs -= FIXED_HALF; /* off-by-one error? */ \
fft -= FIXED_HALF; \
@@ -268,13 +260,15 @@ static void simple_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
GLint s = FixedToInt(ffs) & smask; \
GLint t = FixedToInt(fft) & tmask; \
GLint pos = (t << twidth_log2) + s; \
- pos = pos + pos + pos; /* multiply by 3 */ \
- RGB_TEX; \
+ pos = pos + pos + pos; /* multiply by 3 */ \
+ rgb[i][RCOMP] = texture[pos]; \
+ rgb[i][GCOMP] = texture[pos+1]; \
+ rgb[i][BCOMP] = texture[pos+2]; \
ffs += fdsdx; \
fft += fdtdx; \
} \
- (*ctx->Driver.WriteRGBASpan)( ctx, n, LEFT, Y, \
- (const GLubyte (*)[4]) rgba, NULL ); \
+ (*ctx->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
+ (const GLubyte (*)[3]) rgb, NULL ); \
} \
}
@@ -308,7 +302,7 @@ static void simple_z_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, n = RIGHT-LEFT; \
- GLubyte rgba[MAX_WIDTH][4]; \
+ GLubyte rgb[MAX_WIDTH][3]; \
GLubyte mask[MAX_WIDTH]; \
if (n>0) { \
ffs -= FIXED_HALF; /* off-by-one error? */ \
@@ -319,8 +313,10 @@ static void simple_z_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
GLint s = FixedToInt(ffs) & smask; \
GLint t = FixedToInt(fft) & tmask; \
GLint pos = (t << twidth_log2) + s; \
- pos = pos + pos + pos; /* multiply by 3 */\
- RGB_TEX; \
+ pos = pos + pos + pos; /* multiply by 3 */ \
+ rgb[i][RCOMP] = texture[pos]; \
+ rgb[i][GCOMP] = texture[pos+1]; \
+ rgb[i][BCOMP] = texture[pos+2]; \
zRow[i] = z; \
mask[i] = 1; \
} \
@@ -331,8 +327,8 @@ static void simple_z_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
ffs += fdsdx; \
fft += fdtdx; \
} \
- (*ctx->Driver.WriteRGBASpan)( ctx, n, LEFT, Y, \
- (const GLubyte (*)[4]) rgba, mask ); \
+ (*ctx->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
+ (const GLubyte (*)[3]) rgb, mask ); \
} \
}
@@ -1563,25 +1559,26 @@ void gl_set_triangle_function( GLcontext *ctx )
ctx->Driver.TriangleFunc = lambda_multitextured_triangle;
dputs("lambda_multitextured_triangle");
}
- else if (ctx->Light.Model.ColorControl==GL_SINGLE_COLOR) {
+ else if (ctx->Light.Enabled &&
+ ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
+ /* separate specular color interpolation */
if (needLambda) {
- ctx->Driver.TriangleFunc = lambda_textured_triangle;
- dputs("lambda_textured_triangle");
+ ctx->Driver.TriangleFunc = lambda_textured_spec_triangle;
+ dputs("lambda_textured_spec_triangle");
}
else {
- ctx->Driver.TriangleFunc = general_textured_triangle;
- dputs("general_textured_triangle");
+ ctx->Driver.TriangleFunc = general_textured_spec_triangle;
+ dputs("general_textured_spec_triangle");
}
}
else {
- /* seprate specular color interpolation */
if (needLambda) {
- ctx->Driver.TriangleFunc = lambda_textured_spec_triangle;
- dputs("lambda_textured_spec_triangle");
+ ctx->Driver.TriangleFunc = lambda_textured_triangle;
+ dputs("lambda_textured_triangle");
}
else {
- ctx->Driver.TriangleFunc = general_textured_spec_triangle;
- dputs("general_textured_spec_triangle");
+ ctx->Driver.TriangleFunc = general_textured_triangle;
+ dputs("general_textured_triangle");
}
}
}
diff --git a/xc/extras/Mesa/src/triangle.h b/xc/extras/Mesa/src/triangle.h
index b898c4843..9c13529af 100644
--- a/xc/extras/Mesa/src/triangle.h
+++ b/xc/extras/Mesa/src/triangle.h
@@ -1,4 +1,4 @@
-/* $Id: triangle.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: triangle.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/tritemp.h b/xc/extras/Mesa/src/tritemp.h
index bc38bc9b9..84df60add 100644
--- a/xc/extras/Mesa/src/tritemp.h
+++ b/xc/extras/Mesa/src/tritemp.h
@@ -1,4 +1,4 @@
-/* $Id: tritemp.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: tritemp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h
index b9c313b4b..f0ffa2443 100644
--- a/xc/extras/Mesa/src/types.h
+++ b/xc/extras/Mesa/src/types.h
@@ -1,5 +1,5 @@
/* -*- mode: C; tab-width:8; c-basic-offset:8 -*- */
-/* $Id: types.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: types.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -98,11 +98,16 @@
*/
#if STENCIL_BITS==8
typedef GLubyte GLstencil;
+# define STENCIL_MAX 0xff
+#elif STENCIL_BITS==16
+ typedef GLushort GLstencil
+# define STENCIL_MAX 0xffff
#else
# error "illegal number of stencil bits"
#endif
+
/*
* Depth buffer data type:
*/
@@ -1559,6 +1564,7 @@ struct gl_extensions {
#define DD_TRI_CULL_FRONT_BACK 0x400000 /* not supported by most drivers */
#define DD_Z_NEVER 0x800000
#define DD_STENCIL 0x1000000
+#define DD_CLIP_FOG_COORD 0x2000000
#define DD_SW_SETUP (DD_TRI_CULL| \
DD_TRI_CULL_FRONT_BACK| \
@@ -1762,6 +1768,7 @@ typedef union node Node;
#define VERT_EVAL_P1 0x4000000 /* */
#define VERT_EVAL_P2 0x8000000 /* */
#define VERT_FLOAT_RGBA 0x10000000 /* allow partial support for this */
+#define VERT_FOG_COORD 0x20000000 /* internal use only, currently */
#define VERT_EYE VERT_BEGIN /* for pipeline management & cva */
#define VERT_WIN VERT_END /* some overlaps can be tolerated */
@@ -1812,7 +1819,7 @@ typedef union node Node;
#define VERT_DATA (VERT_TEX0_ANY|VERT_TEX1_ANY|VERT_RGBA| \
VERT_INDEX|VERT_EDGE|VERT_NORM| \
VERT_OBJ_ANY|VERT_MATERIAL|VERT_ELT| \
- VERT_EVAL_ANY)
+ VERT_EVAL_ANY|VERT_FOG_COORD)
#define VERT_TO_PIPE (~VERT_END_VB)
@@ -2054,6 +2061,7 @@ struct gl_context {
/* For debugging/development only */
GLboolean NoRaster;
+ GLboolean FirstTimeCurrent;
/* Dither disable via MESA_NO_DITHER env var */
GLboolean NoDither;
diff --git a/xc/extras/Mesa/src/varray.c b/xc/extras/Mesa/src/varray.c
index fc8d9ecba..5aaa07aad 100644
--- a/xc/extras/Mesa/src/varray.c
+++ b/xc/extras/Mesa/src/varray.c
@@ -1,4 +1,4 @@
-/* $Id: varray.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: varray.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -503,14 +503,23 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
* rendering to keep it turned on.
*/
relock = ctx->CompileCVAFlag;
- ctx->CompileCVAFlag = 0;
- if (!elt->pipeline_valid || relock)
+ if (relock) {
+ ctx->CompileCVAFlag = 0;
+ elt->pipeline_valid = 0;
+ }
+
+ if (!elt->pipeline_valid)
gl_build_immediate_pipeline( ctx );
required = elt->inputs;
fallback = (elt->inputs & ~ctx->Array.Summary);
+ /* The translate function doesn't do anything about size. It
+ * just ensures that type and stride come out right.
+ */
+ IM->v.Obj.size = ctx->Array.Vertex.Size;
+
if (required & VERT_RGBA)
{
Color = &ctx->Array.Color;
@@ -583,7 +592,7 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
VB->NextPrimitive = IM->NextPrimitive;
VB->MaterialMask = IM->MaterialMask;
VB->Material = IM->Material;
- VB->BoundsPtr = 0;
+ VB->BoundsPtr = 0;
while (remaining > 0) {
GLint vbspace = VB_MAX - VB_START;
@@ -667,6 +676,7 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
VB->NextPrimitive[VB->CopyStart] = VB->Count;
VB->Primitive[VB->CopyStart] = mode;
+ ctx->Array.Flag[count] |= VERT_END_VB;
/* Transform and render.
*/
@@ -680,7 +690,12 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
remaining -= n;
}
- ctx->CompileCVAFlag = relock;
+ gl_reset_input( ctx );
+
+ if (relock) {
+ ctx->CompileCVAFlag = relock;
+ elt->pipeline_valid = 0;
+ }
}
else if (ctx->Array.Vertex.Enabled)
{
diff --git a/xc/extras/Mesa/src/varray.h b/xc/extras/Mesa/src/varray.h
index a371d6bff..391b3e471 100644
--- a/xc/extras/Mesa/src/varray.h
+++ b/xc/extras/Mesa/src/varray.h
@@ -1,4 +1,4 @@
-/* $Id: varray.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: varray.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vb.c b/xc/extras/Mesa/src/vb.c
index ef83d5727..a370e7e23 100644
--- a/xc/extras/Mesa/src/vb.c
+++ b/xc/extras/Mesa/src/vb.c
@@ -1,4 +1,4 @@
-/* $Id: vb.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vb.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vb.h b/xc/extras/Mesa/src/vb.h
index 83d6ff324..cb05d6d7d 100644
--- a/xc/extras/Mesa/src/vb.h
+++ b/xc/extras/Mesa/src/vb.h
@@ -1,4 +1,4 @@
-/* $Id: vb.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vb.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vbcull.c b/xc/extras/Mesa/src/vbcull.c
index e923df6e8..97e2c970e 100644
--- a/xc/extras/Mesa/src/vbcull.c
+++ b/xc/extras/Mesa/src/vbcull.c
@@ -1,4 +1,4 @@
-/* $Id: vbcull.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbcull.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vbcull.h b/xc/extras/Mesa/src/vbcull.h
index 63387f84e..0b4a18fac 100644
--- a/xc/extras/Mesa/src/vbcull.h
+++ b/xc/extras/Mesa/src/vbcull.h
@@ -1,4 +1,4 @@
-/* $Id: vbcull.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbcull.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vbfill.c b/xc/extras/Mesa/src/vbfill.c
index 5da2f511b..8e8e72563 100644
--- a/xc/extras/Mesa/src/vbfill.c
+++ b/xc/extras/Mesa/src/vbfill.c
@@ -1,4 +1,4 @@
-/* $Id: vbfill.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbfill.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -68,8 +68,12 @@ void gl_Begin( GLcontext *ctx, GLenum p )
struct immediate *IM = ctx->input;
GLuint inflags, state;
- if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glBegin(IM %d) %s\n", IM->id, gl_lookup_enum_by_nr(p));
+ if (MESA_VERBOSE&VERBOSE_API) {
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ fprintf(stderr, "glBegin(IM %d) %s\n", IM->id, gl_lookup_enum_by_nr(p));
+ else
+ fprintf(stderr, "<");
+ }
if (ctx->NewState)
gl_update_state( ctx ); /* should already be flushed */
diff --git a/xc/extras/Mesa/src/vbfill.h b/xc/extras/Mesa/src/vbfill.h
index aea4904f1..9a71438f9 100644
--- a/xc/extras/Mesa/src/vbfill.h
+++ b/xc/extras/Mesa/src/vbfill.h
@@ -1,4 +1,4 @@
-/* $Id: vbfill.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbfill.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vbindirect.c b/xc/extras/Mesa/src/vbindirect.c
index ab16d0d14..169f9eee8 100644
--- a/xc/extras/Mesa/src/vbindirect.c
+++ b/xc/extras/Mesa/src/vbindirect.c
@@ -1,4 +1,4 @@
-/* $Id: vbindirect.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbindirect.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vbindirect.h b/xc/extras/Mesa/src/vbindirect.h
index e8e54ffa0..182040bc0 100644
--- a/xc/extras/Mesa/src/vbindirect.h
+++ b/xc/extras/Mesa/src/vbindirect.h
@@ -1,4 +1,4 @@
-/* $Id: vbindirect.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbindirect.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vbrender.c b/xc/extras/Mesa/src/vbrender.c
index 50ffda927..7f028af26 100644
--- a/xc/extras/Mesa/src/vbrender.c
+++ b/xc/extras/Mesa/src/vbrender.c
@@ -1,4 +1,4 @@
-/* $Id: vbrender.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbrender.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -161,7 +161,6 @@ static void unfilled_polygon( GLcontext *ctx,
}
else if (mode==GL_LINE) {
GLuint i, j0, j1;
- ctx->StippleCounter = 0;
/* draw the edges */
for (i=0;i<n-1;i++) {
@@ -450,10 +449,12 @@ do { \
const GLubyte *cullmask = VB->CullMask; \
GLuint vlist[VB_SIZE]; \
GLubyte *eflag = VB->EdgeFlagPtr->data; \
+ GLuint *stipplecounter = &VB->ctx->StippleCounter; \
(void) vlist; (void) eflag;
#define TAG(x) x##_cull
#define INIT(x) FLUSH_PRIM(x)
+#define RESET_STIPPLE *stipplecounter = 0
#include "render_tmp.h"
@@ -487,9 +488,11 @@ do { \
#define LOCAL_VARS \
GLcontext *ctx = VB->ctx; \
GLubyte *eflag = VB->EdgeFlagPtr->data; \
+ GLuint *stipplecounter = &VB->ctx->StippleCounter; \
(void) eflag;
#define INIT(x) FLUSH_PRIM(x);
+#define RESET_STIPPLE *stipplecounter = 0
#include "render_tmp.h"
@@ -523,9 +526,13 @@ do { \
#define LOCAL_VARS \
GLcontext *ctx = VB->ctx; \
GLubyte *eflag = VB->EdgeFlagPtr->data; \
+ GLuint *stipplecounter = &VB->ctx->StippleCounter; \
(void) eflag;
+
#define INIT(x) FLUSH_PRIM(x);
#define TAG(x) x##_clipped
+#define RESET_STIPPLE *stipplecounter = 0
+
#include "render_tmp.h"
/* Bits:
@@ -666,10 +673,13 @@ void gl_reduced_prim_change( GLcontext *ctx, GLenum prim )
ctx->PB->count = 0;
ctx->PB->mono = GL_FALSE;
- ctx->PB->primitive = prim;
+
+ if (ctx->PB->primitive != prim) {
+ ctx->PB->primitive = prim;
- if (ctx->Driver.ReducedPrimitiveChange)
- ctx->Driver.ReducedPrimitiveChange( ctx, prim );
+ if (ctx->Driver.ReducedPrimitiveChange)
+ ctx->Driver.ReducedPrimitiveChange( ctx, prim );
+ }
}
diff --git a/xc/extras/Mesa/src/vbrender.h b/xc/extras/Mesa/src/vbrender.h
index f76c254b7..e2d53b874 100644
--- a/xc/extras/Mesa/src/vbrender.h
+++ b/xc/extras/Mesa/src/vbrender.h
@@ -1,4 +1,4 @@
-/* $Id: vbrender.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbrender.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vbxform.c b/xc/extras/Mesa/src/vbxform.c
index 00bc1d1da..7e5eb332c 100644
--- a/xc/extras/Mesa/src/vbxform.c
+++ b/xc/extras/Mesa/src/vbxform.c
@@ -1,4 +1,4 @@
-/* $Id: vbxform.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbxform.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
@@ -466,9 +466,6 @@ void gl_compute_orflag( struct immediate *IM )
IM->LastData = count-1;
-/* fprintf(stderr, "In gl_compute_orflag, start %d count %d\n", IM->Start, IM->Count); */
-/* gl_print_vert_flags("initial andflag", andflag); */
-
/* Compute the flags for the whole buffer, even if
*/
for (i = IM->Start ; i < count ; i++) {
@@ -478,12 +475,10 @@ void gl_compute_orflag( struct immediate *IM )
if (IM->Flag[i] & VERT_DATA) {
IM->LastData++;
-/* andflag &= IM->Flag[i]; */
+/* andflag &= IM->Flag[i]; */ /* possibly incorrect (norm_bug.c) */
orflag |= IM->Flag[i];
}
-/* gl_print_vert_flags("final andflag", andflag); */
-
IM->Flag[IM->LastData+1] |= VERT_END_VB;
IM->AndFlag = andflag;
IM->OrFlag = orflag;
@@ -542,8 +537,13 @@ void gl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (ctx->ExecuteFlag && (fixup & ~IM->Flag[start])) {
GLuint copy = fixup & ~IM->Flag[start];
- if (copy & VERT_NORM)
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ gl_print_vert_flags("copy from current", copy);
+
+ if (copy & VERT_NORM) {
+ IM->Flag[start] |= VERT_NORM;
COPY_3V( IM->Normal[start], ctx->Current.Normal );
+ }
if (copy & VERT_RGBA)
COPY_4UBV( IM->Color[start], ctx->Current.ByteColor);
@@ -604,7 +604,7 @@ void gl_fixup_input( GLcontext *ctx, struct immediate *IM )
}
if (fixup & VERT_NORM) {
- if (IM->OrFlag & VERT_EVAL_ANY)
+ if (IM->OrFlag & VERT_NORM)
fixup_3f( IM->Normal, IM->Flag, start, VERT_NORM );
else if (!(IM->Flag[IM->LastData] & VERT_NORM))
find_last_3f( IM->Normal, IM->Flag, VERT_NORM, IM->LastData );
diff --git a/xc/extras/Mesa/src/vbxform.h b/xc/extras/Mesa/src/vbxform.h
index 71cd5bf23..4496ab4b7 100644
--- a/xc/extras/Mesa/src/vbxform.h
+++ b/xc/extras/Mesa/src/vbxform.h
@@ -1,4 +1,4 @@
-/* $Id: vbxform.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vbxform.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vector.c b/xc/extras/Mesa/src/vector.c
index c6094c711..26fcc7f90 100644
--- a/xc/extras/Mesa/src/vector.c
+++ b/xc/extras/Mesa/src/vector.c
@@ -1,4 +1,4 @@
-/* $Id: vector.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vector.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vector.h b/xc/extras/Mesa/src/vector.h
index 3fae438d5..a9315bf5f 100644
--- a/xc/extras/Mesa/src/vector.h
+++ b/xc/extras/Mesa/src/vector.h
@@ -1,4 +1,4 @@
-/* $Id: vector.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vector.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vertices.c b/xc/extras/Mesa/src/vertices.c
index 528dc41e7..26596dff8 100644
--- a/xc/extras/Mesa/src/vertices.c
+++ b/xc/extras/Mesa/src/vertices.c
@@ -1,4 +1,4 @@
-/* $Id: vertices.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vertices.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/vertices.h b/xc/extras/Mesa/src/vertices.h
index 895093bf9..4bc835d40 100644
--- a/xc/extras/Mesa/src/vertices.h
+++ b/xc/extras/Mesa/src/vertices.h
@@ -1,4 +1,4 @@
-/* $Id: vertices.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: vertices.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/winpos.c b/xc/extras/Mesa/src/winpos.c
index 965bf14c4..7ca152e8a 100644
--- a/xc/extras/Mesa/src/winpos.c
+++ b/xc/extras/Mesa/src/winpos.c
@@ -1,4 +1,4 @@
-/* $Id: winpos.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: winpos.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/winpos.h b/xc/extras/Mesa/src/winpos.h
index 82ae90e63..fd2b1fe79 100644
--- a/xc/extras/Mesa/src/winpos.h
+++ b/xc/extras/Mesa/src/winpos.h
@@ -1,4 +1,4 @@
-/* $Id: winpos.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: winpos.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/xform.c b/xc/extras/Mesa/src/xform.c
index 5aaba7c5a..99f413231 100644
--- a/xc/extras/Mesa/src/xform.c
+++ b/xc/extras/Mesa/src/xform.c
@@ -1,4 +1,4 @@
-/* $Id: xform.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: xform.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/xform.h b/xc/extras/Mesa/src/xform.h
index 36a318ac1..26110f5c6 100644
--- a/xc/extras/Mesa/src/xform.h
+++ b/xc/extras/Mesa/src/xform.h
@@ -1,4 +1,4 @@
-/* $Id: xform.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: xform.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/xform_tmp.h b/xc/extras/Mesa/src/xform_tmp.h
index 91acdc369..9fad0f286 100644
--- a/xc/extras/Mesa/src/xform_tmp.h
+++ b/xc/extras/Mesa/src/xform_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: xform_tmp.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: xform_tmp.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/zoom.c b/xc/extras/Mesa/src/zoom.c
index 15405e749..6ff309d3b 100644
--- a/xc/extras/Mesa/src/zoom.c
+++ b/xc/extras/Mesa/src/zoom.c
@@ -1,4 +1,4 @@
-/* $Id: zoom.c,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: zoom.c,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
* Mesa 3-D graphics library
diff --git a/xc/extras/Mesa/src/zoom.h b/xc/extras/Mesa/src/zoom.h
index 9877798e7..b4ae3a464 100644
--- a/xc/extras/Mesa/src/zoom.h
+++ b/xc/extras/Mesa/src/zoom.h
@@ -1,4 +1,4 @@
-/* $Id: zoom.h,v 1.1 1999/12/05 23:10:27 daryll Exp $ */
+/* $Id: zoom.h,v 1.2 1999/12/07 03:37:15 daryll Exp $ */
/*
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
index f2157b335..1d83dfd31 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.2 1999/09/27 06:29:57 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.3 1999/11/19 13:54:50 hohndel Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
@@ -203,7 +203,7 @@ TDFXAccelInit(ScreenPtr pScreen)
infoPtr->ColorExpandRange = 128;
infoPtr->CPUToScreenColorExpandFillFlags = commonFlags |
CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD |
- LEFT_EDGE_CLIPPING /* | LEFT_EDGE_CLIPPING_NEGATIVE_X */;
+ LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */
pTDFX->scanlineColorExpandBuffers[0]=0;
pTDFX->scanlineColorExpandBuffers[1]=0;
#else
@@ -220,7 +220,7 @@ TDFXAccelInit(ScreenPtr pScreen)
TDFXSubsequentColorExpandScanline;
infoPtr->ScanlineCPUToScreenColorExpandFillFlags = commonFlags |
CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD |
- LEFT_EDGE_CLIPPING /* | LEFT_EDGE_CLIPPING_NEGATIVE_X */;
+ LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */
#endif
infoPtr->SetupForMono8x8PatternFill = TDFXSetupForMono8x8PatternFill;
@@ -317,6 +317,7 @@ TDFXMatchState(TDFXPtr pTDFX)
TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, pTDFX->ModeReg.clip1max);
pTDFX->DrawState&=~DRAW_STATE_CLIP1CHANGED;
}
+
pTDFX->PrevDrawState=pTDFX->DrawState;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
index d02767a39..293d4f7c3 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
@@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.2 1999/09/27 06:29:57 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.6 1999/12/03 19:17:36 eich Exp $ */
/*
* Authors:
@@ -159,7 +159,10 @@ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn,
DriverRec TDFX = {
VERSION,
+ TDFX_DRIVER_NAME,
+#if 0
"Accelerated driver for 3dfx Voodoo Banshee and Voodoo3 cards",
+#endif
TDFXIdentify,
TDFXProbe,
NULL,
@@ -382,7 +385,7 @@ TDFXIdentify(int flags) {
static Bool
TDFXProbe(DriverPtr drv, int flags) {
int i, numUsed, numDevSections, *usedChips;
- GDevPtr *devSections;
+ GDevPtr *devSections = NULL;
Bool foundScreen = FALSE;
TDFXTRACE("TDFXProbe start\n");
@@ -404,8 +407,9 @@ TDFXProbe(DriverPtr drv, int flags) {
TDFXChipsets, TDFXPciChipsets,
devSections, numDevSections,
drv, &usedChips);
- xfree(devSections);
- devSections=0;
+ if (devSections)
+ xfree(devSections);
+ devSections=NULL;
if (numUsed<=0) return FALSE;
for (i=0; i<numUsed; i++) {
@@ -838,11 +842,7 @@ TDFXMapMem(ScrnInfoPtr pScrn)
TDFXTRACE("TDFXMapMem start\n");
pTDFX = TDFXPTR(pScrn);
-#if !defined(__alpha__)
mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
-#else
- mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE;
-#endif
pTDFX->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
pTDFX->PciTag,
@@ -1507,6 +1507,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
@@ -1763,11 +1764,11 @@ TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
break;
case DPMSModeStandby:
/* Screen: Off; HSync: Off, VSync: On */
- state=BIT(1);
+ state=BIT(3);
break;
case DPMSModeSuspend:
/* Screen: Off; HSync: On, VSync: Off */
- state=BIT(3);
+ state=BIT(1);
break;
case DPMSModeOff:
/* Screen: Off; HSync: Off, VSync: Off */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c
index a8501f5d4..fb0efcbf2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c
@@ -24,7 +24,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.2 1999/09/27 06:29:58 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.3 1999/12/03 19:17:36 eich Exp $ */
/*
* Authors:
@@ -40,21 +40,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tdfx.h"
-#ifndef __alpha__
-#define minb(p) *(volatile CARD8 *)(pTDFX->MMIOBase + (p))
-#define moutb(p,v) \
- *(volatile CARD8 *)(pTDFX->MMIOBase + (p)) = (v)
-#define minl(p) *(volatile CARD32 *)(pTDFX->MMIOBase + (p))
-#define moutl(p,v) \
- *(volatile CARD32 *)(pTDFX->MMIOBase + (p)) = (v)
-#else
-#define minb(p) xf86ReadSparse8(pTDFX->MMIOBase, (p))
-#define moutb(p,v) \
- xf86WriteSparse8((v), pTDFX->MMIOBase, (p))
-#define minl(p) xf86ReadSparse32(pTDFX->MMIOBase, (p))
-#define moutl(p,v) \
- xf86WriteSparse32((v), pTDFX->MMIOBase, (p))
-#endif
+#define minb(p) MMIO_IN8(pTDFX->MMIOBase, (p))
+#define moutb(p,v) MMIO_OUT8(pTDFX->MMIOBase, (p),(v))
+#define minl(p) MMIO_IN32(pTDFX->MMIOBase, (p))
+#define moutl(p,v) MMIO_OUT32(pTDFX->MMIOBase, (p),(v))
static void TDFXWriteControlPIO(TDFXPtr pTDFX, int addr, char index, char val) {
outb(pTDFX->PIOBase+addr, index);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
index 68cc4e290..f8425c5dd 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
@@ -140,7 +140,7 @@ Bool TDFXInitPrivate(ScreenPtr pScreen)
pTDFX->fifoOffset = (pTDFX->lowMemLoc+4095)&~0xFFF;
pTDFX->lowMemLoc = pTDFX->fifoOffset+CMDFIFO_PAGES*4096;
pTDFX->texOffset = pTDFX->lowMemLoc;
- pTDFX->texSize = 4*1024*1024;
+ pTDFX->texSize = 8*1024*1024;
pTDFX->lowMemLoc += pTDFX->texSize;
/* Find the location of the box given to us and round up to page boundary */
pTDFX->fifoSize = CMDFIFO_PAGES*4096;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c
index e9879099f..780c4fb69 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c
@@ -1,6 +1,6 @@
/* bufs.c -- IOCTLs to manage buffers -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 22:48:10 1999 by faith@precisioninsight.com
+ * Revised: Fri Dec 3 12:11:11 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -89,10 +89,11 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd,
case _DRM_SHM:
- DRM_DEBUG("%ld %d\n", map->size, drm_order(map->size));
map->handle = (void *)drm_alloc_pages(drm_order(map->size)
- PAGE_SHIFT,
DRM_MEM_SAREA);
+ DRM_DEBUG("%ld %d %p\n", map->size, drm_order(map->size),
+ map->handle);
if (!map->handle) {
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return -ENOMEM;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
index 324e20029..320db51eb 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
@@ -1,6 +1,6 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 13:08:18 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -26,7 +26,10 @@
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.1 1999/09/25 14:37:58 dawes Exp $
- *
+ *
+ * Acknowledgements:
+ * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
+ *
*/
#ifndef _DRM_H_
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
index 37b9d0531..966e6e05a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
@@ -1,6 +1,6 @@
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:51:07 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 16:06:49 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -83,33 +83,77 @@
#define DRM_MEM_BUFLISTS 14
/* Backward compatibility section */
+ /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */
#ifndef _PAGE_PWT
- /* The name of _PAGE_WT was changed to
- _PAGE_PWT in Linux 2.2.6 */
#define _PAGE_PWT _PAGE_WT
#endif
- /* Wait queue declarations changes in 2.3.1 */
+ /* Wait queue declarations changed in 2.3.1 */
#ifndef DECLARE_WAITQUEUE
#define DECLARE_WAITQUEUE(w,c) struct wait_queue w = { c, NULL }
typedef struct wait_queue *wait_queue_head_t;
#define init_waitqueue_head(q) *q = NULL;
#endif
-#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock)
-#define _DRM_CAS(lock,old,new,__ret) \
- do { \
- int __dummy; /* Can't mark eax as clobbered */ \
- __asm__ __volatile__( \
- "lock ; cmpxchg %4,%1\n\t" \
- "setnz %0" \
- : "=d" (__ret), \
- "=m" (__drm_dummy_lock(lock)), \
- "=a" (__dummy) \
- : "2" (old), \
- "r" (new)); \
- } while (0)
+ /* _PAGE_4M changed to _PAGE_PSE in 2.3.23 */
+#ifndef _PAGE_PSE
+#define _PAGE_PSE _PAGE_4M
+#endif
+
+ /* vm_offset changed to vm_pgoff in 2.3.25 */
+#if LINUX_VERSION_CODE < 0x020319
+#define VM_OFFSET(vma) ((vma)->vm_offset)
+#else
+#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
+#endif
+ /* *_nopage return values defined in 2.3.26 */
+#ifndef NOPAGE_SIGBUS
+#define NOPAGE_SIGBUS 0
+#endif
+#ifndef NOPAGE_OOM
+#define NOPAGE_OOM 0
+#endif
+ /* Generic cmpxchg added in 2.3.x */
+#if CPU != 386
+#ifndef __HAVE_ARCH_CMPXCHG
+ /* Include this here so that driver can be
+ used with older kernels. */
+static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
+ unsigned long new, int size)
+{
+ unsigned long prev;
+ switch (size) {
+ case 1:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ case 2:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ case 4:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ }
+ return old;
+}
+
+#define cmpxchg(ptr,o,n) \
+ ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \
+ (unsigned long)(n),sizeof(*(ptr))))
+#endif
+#else
+ /* Compiling for a 386 proper... */
+#error DRI not supported on Intel 80386
+#endif
/* Macros to make printk easier */
#define DRM_ERROR(fmt, arg...) \
@@ -436,6 +480,7 @@ extern ssize_t drm_read(struct file *filp, char *buf, size_t count,
extern int drm_write_string(drm_device_t *dev, const char *s);
/* Mapping support (vm.c) */
+#if LINUX_VERSION_CODE < 0x020317
extern unsigned long drm_vm_nopage(struct vm_area_struct *vma,
unsigned long address,
int write_access);
@@ -445,6 +490,18 @@ extern unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
extern unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
unsigned long address,
int write_access);
+#else
+ /* Return type changed in 2.3.23 */
+extern struct page *drm_vm_nopage(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access);
+extern struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access);
+extern struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access);
+#endif
extern void drm_vm_open(struct vm_area_struct *vma);
extern void drm_vm_close(struct vm_area_struct *vma);
extern int drm_mmap_dma(struct file *filp,
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c
index ed235d7fb..4ee43f04a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c
@@ -1,6 +1,6 @@
/* drmstat.c -- DRM device status and testing program
* Created: Tue Jan 5 08:19:24 1999 by faith@precisioninsight.com
- * Revised: Sun Aug 1 11:02:00 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 10:33:46 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -218,8 +218,8 @@ int main(int argc, char **argv)
info->list[i].low_mark,
info->list[i].high_mark);
}
- printf("===== /proc/drm/1/meminfo =====\n");
- sprintf(buf, "cat /proc/drm/1/meminfo");
+ printf("===== /proc/graphics/0/mem =====\n");
+ sprintf(buf, "cat /proc/graphics/0/mem");
system(buf);
#if 1
if (!(bufs = drmMapBufs(fd))) {
@@ -234,8 +234,8 @@ int main(int argc, char **argv)
bufs->list[i].total,
bufs->list[i].address);
}
- printf("===== /proc/drm/1/vmainfo =====\n");
- sprintf(buf, "cat /proc/drm/1/vmainfo");
+ printf("===== /proc/graphics/0/vma =====\n");
+ sprintf(buf, "cat /proc/graphics/0/vma");
system(buf);
#endif
break;
@@ -249,8 +249,8 @@ int main(int argc, char **argv)
return 1;
}
printf("0x%08lx:0x%04lx added\n", offset, size);
- printf("===== /proc/drm/1/meminfo =====\n");
- sprintf(buf, "cat /proc/drm/1/meminfo");
+ printf("===== /proc/graphics/0/mem =====\n");
+ sprintf(buf, "cat /proc/graphics/0/mem");
system(buf);
break;
case 'r':
@@ -266,8 +266,8 @@ int main(int argc, char **argv)
return 1;
}
printf("0x%08lx:0x%04lx added\n", offset, size);
- printf("===== /proc/drm/1/meminfo =====\n");
- sprintf(buf, "cat /proc/drm/1/meminfo");
+ printf("===== /proc/graphics/0/mem =====\n");
+ sprintf(buf, "cat /proc/graphics/0/mem");
system(buf);
break;
case 's':
@@ -315,11 +315,11 @@ int main(int argc, char **argv)
printf("===== /proc/%d/maps =====\n", getpid());
sprintf(buf, "cat /proc/%d/maps", getpid());
system(buf);
- printf("===== /proc/drm/1/meminfo =====\n");
- sprintf(buf, "cat /proc/drm/1/meminfo");
+ printf("===== /proc/grphics/0/mem =====\n");
+ sprintf(buf, "cat /proc/graphics/0/mem");
system(buf);
- printf("===== /proc/drm/1/vmainfo =====\n");
- sprintf(buf, "cat /proc/drm/1/vmainfo");
+ printf("===== /proc/graphics/0/vma =====\n");
+ sprintf(buf, "cat /proc/graphics/0/vma");
system(buf);
printf("===== READING =====\n");
for (i = 0; i < 0x10; i++)
@@ -336,8 +336,8 @@ int main(int argc, char **argv)
for (i = 0; i < 0x10; i++)
printf("%02x ", (unsigned int)((unsigned char *)address)[i]);
printf("\n");
- printf("===== /proc/drm/1/vmainfo =====\n");
- sprintf(buf, "cat /proc/drm/1/vmainfo");
+ printf("===== /proc/graphics/0/vma =====\n");
+ sprintf(buf, "cat /proc/graphics/0/vma");
system(buf);
break;
case 'L':
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c
index 403a19bb3..47eacb833 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c
@@ -1,6 +1,6 @@
/* fops.c -- File operations for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:48:59 1999 by faith@precisioninsight.com
+ * Revised: Fri Dec 3 10:26:26 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -75,8 +75,8 @@ int drm_flush(struct file *filp)
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d, f_count = %d\n",
- current->pid, dev->device, dev->open_count, filp->f_count);
+ DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
+ current->pid, dev->device, dev->open_count);
return 0;
}
@@ -211,7 +211,12 @@ int drm_write_string(drm_device_t *dev, const char *s)
send -= count;
}
+#if LINUX_VERSION_CODE < 0x020315
if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
+#else
+ /* Parameter added in 2.3.21 */
+ if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN);
+#endif
DRM_DEBUG("waking\n");
wake_up_interruptible(&dev->buf_readers);
return 0;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c
index 3d1263d07..b84561f2e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c
@@ -1,6 +1,6 @@
/* lists.c -- Buffer list handling routines -*- linux-c -*-
* Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:01 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -130,11 +130,9 @@ int drm_freelist_destroy(drm_freelist_t *bl)
int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
{
- unsigned int old;
- unsigned int new;
- char failed;
+ drm_buf_t *old, *prev;
int count = 0;
- drm_device_dma_t *dma = dev->dma;
+ drm_device_dma_t *dma = dev->dma;
if (!dma) {
DRM_ERROR("No DMA support\n");
@@ -155,15 +153,14 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
#endif
buf->list = DRM_LIST_FREE;
do {
- old = (unsigned long)bl->next;
- buf->next = (void *)old;
- new = (unsigned long)buf;
- _DRM_CAS(&bl->next, old, new, failed);
+ old = bl->next;
+ bl->next = old;
+ prev = cmpxchg(&bl->next, old, buf);
if (++count > DRM_LOOPING_LIMIT) {
DRM_ERROR("Looping\n");
return 1;
}
- } while (failed);
+ } while (prev != old);
atomic_inc(&bl->count);
if (atomic_read(&bl->count) > dma->buf_count) {
DRM_ERROR("%d of %d buffers free after addition of %d\n",
@@ -180,9 +177,7 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
static drm_buf_t *drm_freelist_try(drm_freelist_t *bl)
{
- unsigned int old;
- unsigned int new;
- char failed;
+ drm_buf_t *old, *new, *prev;
drm_buf_t *buf;
int count = 0;
@@ -190,20 +185,18 @@ static drm_buf_t *drm_freelist_try(drm_freelist_t *bl)
/* Get buffer */
do {
- old = (unsigned int)bl->next;
- if (!old) {
- return NULL;
- }
- new = (unsigned long)bl->next->next;
- _DRM_CAS(&bl->next, old, new, failed);
+ old = bl->next;
+ if (!old) return NULL;
+ new = bl->next->next;
+ prev = cmpxchg(&bl->next, old, new);
if (++count > DRM_LOOPING_LIMIT) {
DRM_ERROR("Looping\n");
return NULL;
}
- } while (failed);
+ } while (prev != old);
atomic_dec(&bl->count);
- buf = (drm_buf_t *)old;
+ buf = old;
buf->next = NULL;
buf->list = DRM_LIST_NONE;
DRM_DEBUG("%d, count = %d, wfh = %d, w%d, p%d\n",
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c
index ab1c0742c..e8c1eff10 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c
@@ -1,6 +1,6 @@
/* lock.c -- IOCTLs for locking -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Tue Oct 12 08:51:06 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -48,17 +48,15 @@ int drm_unblock(struct inode *inode, struct file *filp, unsigned int cmd,
int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
{
- unsigned int old;
- unsigned int new;
- char failed;
+ unsigned int old, new, prev;
DRM_DEBUG("%d attempts\n", context);
do {
old = *lock;
if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT;
else new = context | _DRM_LOCK_HELD;
- _DRM_CAS(lock, old, new, failed);
- } while (failed);
+ prev = cmpxchg(lock, old, new);
+ } while (prev != old);
if (_DRM_LOCKING_CONTEXT(old) == context) {
if (old & _DRM_LOCK_HELD) {
if (context != DRM_KERNEL_CONTEXT) {
@@ -83,16 +81,14 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
int drm_lock_transfer(drm_device_t *dev,
__volatile__ unsigned int *lock, unsigned int context)
{
- unsigned int old;
- unsigned int new;
- char failed;
+ unsigned int old, new, prev;
dev->lock.pid = 0;
do {
- old = *lock;
- new = context | _DRM_LOCK_HELD;
- _DRM_CAS(lock, old, new, failed);
- } while (failed);
+ old = *lock;
+ new = context | _DRM_LOCK_HELD;
+ prev = cmpxchg(lock, old, new);
+ } while (prev != old);
DRM_DEBUG("%d => %d\n", _DRM_LOCKING_CONTEXT(old), context);
return 1;
}
@@ -100,18 +96,16 @@ int drm_lock_transfer(drm_device_t *dev,
int drm_lock_free(drm_device_t *dev,
__volatile__ unsigned int *lock, unsigned int context)
{
- unsigned int old;
- unsigned int new;
- char failed;
+ unsigned int old, new, prev;
pid_t pid = dev->lock.pid;
DRM_DEBUG("%d\n", context);
dev->lock.pid = 0;
do {
- old = *lock;
- new = 0;
- _DRM_CAS(lock, old, new, failed);
- } while (failed);
+ old = *lock;
+ new = 0;
+ prev = cmpxchg(lock, old, new);
+ } while (prev != old);
if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
DRM_ERROR("%d freed heavyweight lock held by %d (pid %d)\n",
context,
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c
index b3fc4fcaf..af8d510b5 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c
@@ -1,6 +1,6 @@
/* memory.c -- Memory management wrappers for DRM -*- linux-c -*-
* Created: Thu Feb 4 14:00:34 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 13:04:33 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 10:28:18 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -42,7 +42,7 @@ typedef struct drm_mem_stats {
} drm_mem_stats_t;
static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED;
-static unsigned long drm_ram_available = 0;
+static unsigned long drm_ram_available = 0; /* In pages */
static unsigned long drm_ram_used = 0;
static drm_mem_stats_t drm_mem_stats[] = {
[DRM_MEM_DMA] = { "dmabufs" },
@@ -77,7 +77,12 @@ void drm_mem_init(void)
}
si_meminfo(&si);
+#if LINUX_VERSION_CODE < 0x020317
+ /* Changed to page count in 2.3.23 */
+ drm_ram_available = si.totalram >> PAGE_SHIFT;
+#else
drm_ram_available = si.totalram;
+#endif
drm_ram_used = 0;
}
@@ -95,10 +100,11 @@ static int _drm_mem_info(char *buf, char **start, off_t offset, int len,
" | outstanding \n");
DRM_PROC_PRINT("type alloc freed fail bytes freed"
" | allocs bytes\n\n");
- DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu |\n",
- "system", 0, 0, 0, drm_ram_available);
- DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu |\n",
- "locked", 0, 0, 0, drm_ram_used);
+ DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n",
+ "system", 0, 0, 0,
+ drm_ram_available << (PAGE_SHIFT - 10));
+ DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n",
+ "locked", 0, 0, 0, drm_ram_used >> 10);
DRM_PROC_PRINT("\n");
for (pt = drm_mem_stats; pt->name; pt++) {
DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n",
@@ -207,7 +213,8 @@ unsigned long drm_alloc_pages(int order, int area)
unsigned int sz;
spin_lock(&drm_mem_lock);
- if (drm_ram_used > +(DRM_RAM_PERCENT * drm_ram_available) / 100) {
+ if ((drm_ram_used >> PAGE_SHIFT)
+ > (DRM_RAM_PERCENT * drm_ram_available) / 100) {
spin_unlock(&drm_mem_lock);
return 0;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c
index 0883d7186..33a5b20e8 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c
@@ -1,6 +1,6 @@
/* proc.c -- /proc support for DRM -*- linux-c -*-
* Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:31:48 1999 by faith@precisioninsight.com
+ * Revised: Fri Dec 3 09:44:16 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -382,7 +382,8 @@ static int _drm_vma_info(char *buf, char **start, off_t offset, int len,
vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
vma->vm_flags & VM_LOCKED ? 'l' : '-',
vma->vm_flags & VM_IO ? 'i' : '-',
- vma->vm_offset );
+ VM_OFFSET(vma));
+
#if defined(__i386__)
pgprot = pgprot_val(vma->vm_page_prot);
DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c",
@@ -393,7 +394,7 @@ static int _drm_vma_info(char *buf, char **start, off_t offset, int len,
pgprot & _PAGE_PCD ? 'u' : 'c',
pgprot & _PAGE_ACCESSED ? 'a' : '-',
pgprot & _PAGE_DIRTY ? 'd' : '-',
- pgprot & _PAGE_4M ? 'm' : 'k',
+ pgprot & _PAGE_PSE ? 'm' : 'k',
pgprot & _PAGE_GLOBAL ? 'g' : 'l' );
#endif
DRM_PROC_PRINT("\n");
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c
index 898037846..d649a6e75 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c
@@ -1,6 +1,6 @@
/* vm.c -- Memory mapping for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 22:48:11 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 16:54:35 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -50,18 +50,32 @@ struct vm_operations_struct drm_vm_dma_ops = {
close: drm_vm_close,
};
+#if LINUX_VERSION_CODE < 0x020317
unsigned long drm_vm_nopage(struct vm_area_struct *vma,
unsigned long address,
int write_access)
+#else
+ /* Return type changed in 2.3.23 */
+struct page *drm_vm_nopage(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#endif
{
DRM_DEBUG("0x%08lx, %d\n", address, write_access);
- return 0; /* Disallow mremap */
+ return NOPAGE_SIGBUS; /* Disallow mremap */
}
+#if LINUX_VERSION_CODE < 0x020317
unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
unsigned long address,
int write_access)
+#else
+ /* Return type changed in 2.3.23 */
+struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#endif
{
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
@@ -69,8 +83,8 @@ unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
unsigned long offset;
unsigned long page;
- if (address > vma->vm_end) return 0; /* Disallow mremap */
- if (!dev->lock.hw_lock) return 0; /* Nothing allocated */
+ if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
+ if (!dev->lock.hw_lock) return NOPAGE_OOM; /* Nothing allocated */
offset = address - vma->vm_start;
page = offset >> PAGE_SHIFT;
@@ -78,12 +92,23 @@ unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
+#if LINUX_VERSION_CODE < 0x020317
return physical;
+#else
+ return mem_map + MAP_NR(physical);
+#endif
}
+#if LINUX_VERSION_CODE < 0x020317
unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
unsigned long address,
int write_access)
+#else
+ /* Return type changed in 2.3.23 */
+struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
+ unsigned long address,
+ int write_access)
+#endif
{
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
@@ -92,17 +117,21 @@ unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
unsigned long offset;
unsigned long page;
- if (!dma) return 0; /* Error */
- if (address > vma->vm_end) return 0; /* Disallow mremap */
- if (!dma->pagelist) return 0; /* Nothing allocated */
+ if (!dma) return NOPAGE_SIGBUS; /* Error */
+ if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
+ if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */
- offset = address - vma->vm_start; /* vm_offset should be 0 */
+ offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
page = offset >> PAGE_SHIFT;
physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
+#if LINUX_VERSION_CODE < 0x020317
return physical;
+#else
+ return mem_map + MAP_NR(physical);
+#endif
}
void drm_vm_open(struct vm_area_struct *vma)
@@ -169,7 +198,7 @@ int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
unsigned long length = vma->vm_end - vma->vm_start;
DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
- vma->vm_start, vma->vm_end, vma->vm_offset);
+ vma->vm_start, vma->vm_end, VM_OFFSET(vma));
/* Length must match exact page count */
if ((length >> PAGE_SHIFT) != dma->page_count) return -EINVAL;
@@ -195,9 +224,9 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
int i;
DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
- vma->vm_start, vma->vm_end, vma->vm_offset);
+ vma->vm_start, vma->vm_end, VM_OFFSET(vma));
- if (!vma->vm_offset) return drm_mmap_dma(filp, vma);
+ if (!VM_OFFSET(vma)) return drm_mmap_dma(filp, vma);
/* A sequential search of a linked list is
fine here because: 1) there will only be
@@ -208,7 +237,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
bit longer. */
for (i = 0; i < dev->map_count; i++) {
map = dev->maplist[i];
- if (map->offset == vma->vm_offset) break;
+ if (map->offset == VM_OFFSET(vma)) break;
}
if (i >= dev->map_count) return -EINVAL;
@@ -222,7 +251,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
switch (map->type) {
case _DRM_FRAME_BUFFER:
case _DRM_REGISTERS:
- if (vma->vm_offset >= __pa(high_memory)) {
+ if (VM_OFFSET(vma) >= __pa(high_memory)) {
#if defined(__i386__)
if (boot_cpu_data.x86 > 3) {
pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
@@ -232,7 +261,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
vma->vm_flags |= VM_IO; /* not in core dump */
}
if (remap_page_range(vma->vm_start,
- vma->vm_offset,
+ VM_OFFSET(vma),
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
return -EAGAIN;
@@ -249,7 +278,15 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
}
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
if (map->flags & _DRM_READ_ONLY) {
+#if defined(__i386__)
pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
+#else
+ /* Ye gads this is ugly. With more thought
+ we could move this up higher and use
+ `protection_map' instead. */
+ vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect(
+ __pte(pgprot_val(vma->vm_page_prot)))));
+#endif
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
index a5aef4c6b..0d3b90a86 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
@@ -1,6 +1,6 @@
/* xf86drm.c -- User-level interface to DRM device
* Created: Tue Jan 5 08:16:21 1999 by faith@precisioninsight.com
- * Revised: Wed Aug 4 07:54:23 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 11:34:13 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.43 1999/08/04 18:14:43 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.4 1999/09/25 14:37:49 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.5 1999/10/13 22:33:07 dawes Exp $
*
*/
@@ -57,7 +57,7 @@
# ifdef DRM_USE_MALLOC
# define _DRM_MALLOC malloc
# define _DRM_FREE free
-extern int xf86InstallSIGIOHandler(int fd, void (*f)(int));
+extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *);
extern int xf86RemoveSIGIOHandler(int fd);
# else
# include <Xlibint.h>
@@ -174,6 +174,28 @@ static int drmOpenDevice(const char *path, long dev,
return drm_open(path);
}
+static int drmOpenByBusid(const char *busid)
+{
+ int i;
+ char dev_name[64];
+ char *buf;
+ int fd;
+
+ for (i = 0; i < 8; i++) {
+ sprintf(dev_name, "/dev/graphics/card%d", i);
+ if ((fd = drm_open(dev_name)) >= 0) {
+ buf = drmGetBusid(fd);
+ if (buf && !strcmp(buf, busid)) {
+ drmFreeBusid(buf);
+ return fd;
+ }
+ if (buf) drmFreeBusid(buf);
+ close(fd);
+ }
+ }
+ return -1;
+}
+
static int drmOpenByName(const char *name)
{
int i;
@@ -237,29 +259,6 @@ static int drmOpenByName(const char *name)
return -1;
}
-static int drmOpenByBusid(const char *busid)
-{
- int i;
- char dev_name[64];
- char *buf;
- int fd;
-
- for (i = 0; i < 8; i++) {
- sprintf(dev_name, "/dev/graphics/card%d", i);
- if ((fd = drm_open(dev_name)) >= 0) {
- buf = drmGetBusid(fd);
- if (buf && !strcmp(buf, busid)) {
- drmFreeBusid(buf);
- return fd;
- }
- if (buf) drmFreeBusid(buf);
- close(fd);
- }
- }
- return -1;
-}
-
-
/* drmOpen looks up the specified name and busid, and opens the device
found. The entry in /dev/graphics is created if necessary (and if root).
A file descriptor is returned. On error, the return value is
@@ -838,7 +837,7 @@ void *drmGetContextTag(int fd, drmContext context)
}
#if defined(XFree86Server) || defined(DRM_USE_MALLOC)
-static void drmSIGIOHandler(int interrupt)
+static void drmSIGIOHandler(int interrupt, void *closure)
{
unsigned long key;
void *value;
@@ -890,7 +889,7 @@ int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *))
entry = drmGetEntry(fd);
entry->f = f;
- return xf86InstallSIGIOHandler(fd, drmSIGIOHandler);
+ return xf86InstallSIGIOHandler(fd, drmSIGIOHandler, 0);
}
int drmRemoveSIGIOHandler(int fd)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
index 324e20029..320db51eb 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
@@ -1,6 +1,6 @@
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 13:08:18 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All rights reserved.
@@ -26,7 +26,10 @@
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.1 1999/09/25 14:37:58 dawes Exp $
- *
+ *
+ * Acknowledgements:
+ * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
+ *
*/
#ifndef _DRM_H_
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
index 660bfa68c..d03e09eca 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* $PI: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.1 1999/06/07 13:01:43 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.2 1999/06/14 12:02:11 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.6 1999/12/03 19:17:45 eich Exp $
*
*/
@@ -34,12 +34,17 @@
# include "X.h"
# include "xf86.h"
# include "xf86drm.h"
+# include "xf86Priv.h"
# include "xf86_OSlib.h"
# include "xf86drm.h"
#else
# include <unistd.h>
# include <signal.h>
# include <fcntl.h>
+# include <sys/time.h>
+# include <errno.h>
+# include <stdio.h>
+# include <string.h>
#endif
/*
@@ -50,19 +55,93 @@
# define O_ASYNC FASYNC
#endif
+#define MAX_FUNCS 16
+
+typedef struct _xf86SigIOFunc {
+ void (*f) (int, void *);
+ int fd;
+ void *closure;
+} Xf86SigIOFunc;
+
+static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS];
+static int xf86SigIOMax;
+static int xf86SigIOMaxFd;
+static fd_set xf86SigIOMask;
+
+#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
+
+/*
+ * SIGIO gives no way of discovering which fd signalled, select
+ * to discover
+ */
+static void
+xf86SIGIO (int sig)
+{
+ int i;
+ fd_set ready;
+ struct timeval to;
+ int r;
+
+ ready = xf86SigIOMask;
+ to.tv_sec = 0;
+ to.tv_usec = 0;
+ SYSCALL (r = select (xf86SigIOMaxFd, &ready, 0, 0, &to));
+ for (i = 0; r > 0 && i < xf86SigIOMax; i++)
+ if (xf86SigIOFuncs[i].f && FD_ISSET (xf86SigIOFuncs[i].fd, &ready))
+ {
+ (*xf86SigIOFuncs[i].f)(xf86SigIOFuncs[i].fd,
+ xf86SigIOFuncs[i].closure);
+ r--;
+ }
+}
+
int
-xf86InstallSIGIOHandler(int fd, void (*f)(int))
+xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
{
struct sigaction sa;
struct sigaction osa;
+ int i;
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGIO);
- sa.sa_flags = 0;
- sa.sa_handler = f;
- sigaction(SIGIO, &sa, &osa);
- fcntl(fd, F_SETOWN, getpid());
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC);
+ for (i = 0; i < MAX_FUNCS; i++)
+ {
+ if (!xf86SigIOFuncs[i].f)
+ {
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = xf86SIGIO;
+ sigaction(SIGIO, &sa, &osa);
+ xf86SigIOFuncs[i].fd = fd;
+ xf86SigIOFuncs[i].closure = closure;
+ xf86SigIOFuncs[i].f = f;
+ if (i >= xf86SigIOMax)
+ xf86SigIOMax = i+1;
+ if (fd >= xf86SigIOMaxFd)
+ xf86SigIOMaxFd = fd + 1;
+ FD_SET (fd, &xf86SigIOMask);
+ if (fcntl(fd, F_SETOWN, getpid()) == -1) {
+#ifdef XFree86Server
+ xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
+ fd, strerror(errno));
+#else
+ fprintf(stderr,"fcntl(%d, F_SETOWN): %s\n",
+ fd, strerror(errno));
+#endif
+ return 0;
+ }
+ if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
+#ifdef XFree86Server
+ xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
+ fd, strerror(errno));
+#else
+ fprintf(stderr,"fcntl(%d, O_ASYNC): %s\n",
+ fd, strerror(errno));
+#endif
+ return 0;
+ }
+ return 1;
+ }
+ }
return 0;
}
@@ -71,12 +150,93 @@ xf86RemoveSIGIOHandler(int fd)
{
struct sigaction sa;
struct sigaction osa;
+ int i;
+ int max;
+ int maxfd;
+ int ret;
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGIO);
- sa.sa_flags = 0;
- sa.sa_handler = SIG_DFL;
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
- sigaction(SIGIO, &sa, &osa);
- return 0;
+ max = 0;
+ maxfd = -1;
+ ret = 0;
+ for (i = 0; i < MAX_FUNCS; i++)
+ {
+ if (xf86SigIOFuncs[i].f)
+ {
+ if (xf86SigIOFuncs[i].fd == fd)
+ {
+ xf86SigIOFuncs[i].f = 0;
+ xf86SigIOFuncs[i].fd = 0;
+ xf86SigIOFuncs[i].closure = 0;
+ FD_CLR (fd, &xf86SigIOMask);
+ ret = 1;
+ }
+ else
+ {
+ max = i + 1;
+ if (xf86SigIOFuncs[i].fd >= maxfd)
+ maxfd = xf86SigIOFuncs[i].fd + 1;
+ }
+ }
+ }
+ if (ret)
+ {
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
+ xf86SigIOMax = max;
+ xf86SigIOMaxFd = maxfd;
+ if (!max)
+ {
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGIO, &sa, &osa);
+ }
+ }
+ return ret;
+}
+
+int
+xf86BlockSIGIO (void)
+{
+ sigset_t set, old;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ return sigismember (&old, SIGIO);
+}
+
+void
+xf86UnblockSIGIO (int wasset)
+{
+ sigset_t set;
+
+ if (!wasset)
+ {
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &set, NULL);
+ }
}
+
+#ifdef XFree86Server
+void
+xf86AssertBlockedSIGIO (char *where)
+{
+ sigset_t set, old;
+
+ sigemptyset (&set);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ if (!sigismember (&old, SIGIO))
+ xf86Msg (X_ERROR, "SIGIO not blocked at %s\n", where);
+}
+#endif
+
+/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
+
+int
+xf86SIGIOSupported (void)
+{
+ return 1;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
index ee6b6d48e..13afe83d1 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
@@ -64,7 +64,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.28 1999/06/14 07:31:57 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.37 1999/12/03 19:17:38 eich Exp $ */
#ifndef _XF86_OSPROC_H
#define _XF86_OSPROC_H
@@ -83,8 +83,12 @@
#define VIDMEM_FRAMEBUFFER 0x01 /* memory for framebuffer use */
#define VIDMEM_MMIO 0x02 /* memory for I/O use */
-#define VIDMEM_SPARSE 0x04 /* sparse mapping required */
+#define VIDMEM_MMIO_32BIT 0x04 /* memory accesses >= 32bit */
#define VIDMEM_READSIDEEFFECT 0x08 /* reads can have side-effects */
+#define VIDMEM_SPARSE 0x10 /* sparse mapping required
+ * assumed when VIDMEM_MMIO is
+ * set. May be used with
+ * VIDMEM_FRAMEBUFFER) */
/*
* OS-independent modem state flags for xf86SetSerialModemState() and
@@ -108,12 +112,11 @@ extern void xf86WrapperInit(void);
/*
* This is to prevent re-entrancy to FatalError() when aborting.
* Anything that can be called as a result of AbortDDX() should use this
- * instead of FatalError(). (xf86Exiting gets set to TRUE the first time
- * AbortDDX() is called.)
+ * instead of FatalError().
*/
#define xf86FatalError(a, b) \
- if (xf86Exiting) { \
+ if (dispatchException & DE_TERMINATE) { \
ErrorF(a, b); \
return; \
} else FatalError(a, b)
@@ -123,11 +126,13 @@ extern void xf86WrapperInit(void);
/***************************************************************************/
#include <X11/Xfuncproto.h>
+#include "opaque.h"
_XFUNCPROTOBEGIN
/* public functions */
extern Bool xf86LinearVidMem(void);
+extern Bool xf86CheckMTRR(int);
extern pointer xf86MapVidMem(int, int, unsigned long, unsigned long);
extern void xf86UnMapVidMem(int, pointer, unsigned long);
extern void xf86MapReadSideEffects(int, int, pointer, unsigned long);
@@ -159,10 +164,6 @@ extern int xf86SerialModemClearBits(int fd, int bits);
#if defined(__alpha__)
/* entry points for SPARSE memory access routines */
-#if 0
-extern pointer xf86MapVidMemSparse(int, int, pointer, unsigned long);
-extern void xf86UnMapVidMemSparse(int, pointer, unsigned long);
-#endif
extern int xf86ReadSparse8(pointer, unsigned long);
extern int xf86ReadSparse16(pointer, unsigned long);
extern int xf86ReadSparse32(pointer, unsigned long);
@@ -179,8 +180,14 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
module. These routines are small, and the code if very POSIX-signal (or
OS-signal) specific, so it seemed better to provide more complex
wrappers than to wrap each individual function called. */
-extern int xf86InstallSIGIOHandler(int fd, void (*f)(int));
+extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *);
extern int xf86RemoveSIGIOHandler(int fd);
+extern int xf86BlockSIGIO (void);
+extern void xf86UnblockSIGIO (int);
+#ifdef XFree86Server
+extern void xf86AssertBlockedSIGIO (char *);
+#endif
+extern Bool xf86SIGIOSupported (void);
#ifdef XF86_OS_PRIVS
extern void xf86OpenConsole(void);
@@ -199,17 +206,6 @@ extern void xf86KbdInit(void);
extern int xf86KbdOn(void);
extern int xf86KbdOff(void);
extern void xf86KbdEvents(void);
-#ifndef NEW_INPUT
-extern void xf86SetMouseSpeed(MouseDevPtr, int, int, unsigned);
-extern void xf86MouseInit(MouseDevPtr);
-extern int xf86MouseOn(MouseDevPtr);
-extern int xf86MouseOff(MouseDevPtr, Bool);
-extern void xf86MouseEvents(MouseDevPtr);
-extern int xf86XqueMseProc(DeviceIntPtr, int);
-extern int xf86OsMouseProc(DeviceIntPtr, int);
-extern void xf86OsMouseEvents(void);
-extern void xf86OsMouseOption(int, pointer);
-#endif
extern int xf86XqueKbdProc(DeviceIntPtr, int);
extern void xf86XqueEvents(void);
@@ -218,15 +214,12 @@ extern void xf86XqueEvents(void);
/* internal to os-support layer */
resPtr xf86StdAccWindowsFromOS(void);
resPtr xf86StdAccResFromOS(resPtr ret);
-void xf86StdInitOSPciAllocator(const pciConfigPtr *pciInfo,
- resPtr *sysRes, const resPtr pciRes);
/* available to the common layer */
resPtr xf86AccWindowsFromOS(void);
resPtr xf86AccResFromOS(resPtr ret);
-PciBusPtr xf86InitOSPciAllocator(const pciConfigPtr *pciInfo,
- resPtr *sysRes, const resPtr pciRes);
#endif /* NEED_OS_RAC_PROTOS */
+Bool xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits);
#endif /* XF86_OS_PRIVS */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
index 4b53e7861..4440d9b7a 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
@@ -1,6 +1,6 @@
/* xf86drm.h -- OS-independent header for DRM user-level library interface
* Created: Tue Jan 5 08:17:23 1999 by faith@precisioninsight.com
- * Revised: Thu Jun 24 14:18:55 1999 by faith@precisioninsight.com
+ * Revised: Fri Jul 30 16:03:10 1999 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +24,8 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.41 1999/06/24 18:37:13 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.3 1999/07/04 06:39:13 dawes Exp $
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.44 1999/08/04 18:14:42 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.4 1999/09/25 14:37:43 dawes Exp $
*
*/
@@ -57,15 +57,6 @@ typedef struct _drmVersion {
char *desc; /* User-space buffer to hold desc */
} drmVersion, *drmVersionPtr;
-typedef struct _drmCapability {
- int dummy; /* Driver capabilities */
-} drmCapability, *drmCapabilityPtr;
-
-typedef struct _drmList {
- int count; /* Length of version */
- drmVersionPtr version; /* List of versions */
- drmCapabilityPtr capability; /* List of (possibly null) capabilities */
-} drmList, *drmListPtr;
/* All of these enums *MUST* match with the
kernel implementation -- so do *NOT*
@@ -122,23 +113,6 @@ typedef enum {
DRM_CONTEXT_2DONLY = 0x02 /* This context is for 2D rendering only. */
} drmContextFlags, *drmContextFlagsPtr;
-typedef enum {
- /* These are present in drm.h, but there
- is no performance-related reason why
- they need to match -- it's all done in
- a case statement in xf86drm.c */
- DRM_IH_PRE_INST, /* Before IH installation */
- DRM_IH_POST_INST, /* After IH installation */
- DRM_IH_SERVICE, /* IH */
- DRM_IH_PRE_UNINST, /* Before IH uninstallation */
- DRM_IH_POST_UNINST, /* After IH uninstallation */
- DRM_DMA_DISPATCH, /* DMA dispatch (including ready) */
- DRM_DMA_READY, /* Ready for DMA */
- DRM_DMA_IS_READY, /* Tests if hardware ready for another DMA*/
- DRM_DMA_QUIESCENT, /* HW Sync */
- DRM_DESC_MAX
-} drmCtlDesc;
-
typedef struct _drmBufDesc {
int count; /* Number of buffers of this size */
int size; /* Size in bytes */
@@ -296,122 +270,21 @@ typedef struct { unsigned int a[100]; } __drm_dummy_lock_t;
} \
} while(0)
- /* These constants MUST MATCH drm.h */
-#define DRM_INST_LENGTH 5
-
-#define DRM_M_WRITE 0x00
-#define DRM_M_WHILE 0x01
-#define DRM_M_IF 0x02
-#define DRM_M_GOTO 0x03
-#define DRM_M_NOOP 0x04
-#define DRM_M_RETURN 0x05
-#define DRM_M_DO 0x06
-#define DRM_M_READ 0x07
-#define DRM_M_TEST 0x08
-
-#define DRM_T_IMM 0x00 /* MUST BE 0 */
-#define DRM_T_LENGTH 0x01
-#define DRM_T_ADDRESS 0x02
-#define DRM_T_ACC 0x03
-
-#define DRM_V_NONE 0x00 /* MUST BE 0 */
-#define DRM_V_RSHIFT 0x01
-#define DRM_V_LSHIFT 0x02
-
-#define DRM_C_EQ 0x01
-#define DRM_C_LT 0x02
-#define DRM_C_GT 0x03
-#define DRM_C_LE 0x04
-#define DRM_C_GE 0x05
-#define DRM_C_NE 0x06
-#define DRM_C_BIT 0x07
-
-#define DRM_F_NOOP 0x00
-#define DRM_F_DMA 0x01
-#define DRM_F_SYNC 0x02
-#define DRM_F_EXTEN 0x03
-#define DRM_F_ERROR 0x04
-#define DRM_F_VERT 0x05
-#define DRM_F_CLEAR 0x06
-
-#define DRM_I_CMD(x) ((x) & 0xfff)
-#define DRM_I_TYPE(x) (((x) & 0x00f) <<12)
-#define DRM_I_MOD(x) (((x) & 0x00f) <<16)
-#define DRM_I_MODVAL(x) (((x) & 0x0ff) <<24)
-#define DRM_I_COND(x) (((x) & 0x00f) <<28)
-
-#define DRM_E_CMD(x) ((x) &0x00000fff)
-#define DRM_E_TYPE(x) (((x)&0x0000f000)>>12)
-#define DRM_E_MOD(x) (((x)&0x000f0000)>>16)
-#define DRM_E_MODVAL(x) (((x)&0x0ff00000)>>24)
-#define DRM_E_COND(x) (((x)&0xf0000000)>>28)
-
-
-#define DRM_I_WRITE(group,offset,type,value,mod,modval) \
- DRM_I_CMD(DRM_M_WRITE) | DRM_I_TYPE(type) \
- | DRM_I_MOD(mod) \
- | DRM_I_MODVAL(modval) \
- ,(group), (offset), (value), 0
-
-#define DRM_I_WRITE_IMM(group,offset,value) \
- DRM_I_CMD(DRM_M_WRITE),(group), (offset), (value), 0
-
-#define DRM_I_WHILE(group,offset,type,value,mod,modval,cond) \
- DRM_I_CMD(DRM_M_WHILE) | DRM_I_TYPE(type) \
- | DRM_I_MOD(mod) \
- | DRM_I_MODVAL(modval) \
- | DRM_I_COND(cond) \
- ,(group), (offset), (value), 0
-
-#define DRM_I_WHILE_IMM(group,offset,value,cond) \
- DRM_I_CMD(DRM_M_WHILE) | DRM_I_COND(cond) \
- ,(group), (offset), (value), 0
-
-#define DRM_I_IF(group,offset,type,value,mod,modval,cond,inst) \
- DRM_I_CMD(DRM_M_IF) | DRM_I_TYPE(type) \
- | DRM_I_MOD(mod) \
- | DRM_I_MODVAL(modval) \
- | DRM_I_COND(cond) \
- ,(group), (offset), (value), (inst)
-
-#define DRM_I_IF_IMM(group,offset,value,cond,inst) \
- DRM_I_CMD(DRM_M_IF) | DRM_I_COND(cond) \
- ,(group), (offset), (value), (inst)
-
-#define DRM_I_TEST(type,value,mod,modval,cond,inst) \
- DRM_I_CMD(DRM_M_TEST) | DRM_I_TYPE(type) \
- | DRM_I_MOD(mod) \
- | DRM_I_MODVAL(modval) \
- | DRM_I_COND(cond) \
- ,0, 0, (value), (inst)
-
-#define DRM_I_TEST_IMM(value,cond,inst) \
- DRM_I_CMD(DRM_M_TEST) | DRM_I_COND(cond) \
- ,0, 0, (value), (inst)
-
-#define DRM_I_GOTO(inst) DRM_I_CMD(DRM_M_GOTO),0, 0, 0, (inst)
-#define DRM_I_NOOP DRM_I_CMD(DRM_M_NOOP), 0, 0, 0, 0
-#define DRM_I_RETURN(value) DRM_I_CMD(DRM_M_RETURN), 0, 0, (value), 0
-#define DRM_I_DO(inst) DRM_I_CMD(DRM_M_DO), 0, 0, 0, (inst)
-#define DRM_I_READ(group,offset) DRM_I_CMD(DRM_M_READ), (group), (offset), 0, 0
-
-
-
/* General user-level programmer's API: unprivileged */
extern int drmAvailable(void);
-extern int drmOpenDRM(void);
-extern int drmCloseDRM(int fd);
+extern int drmOpen(const char *name, const char *busid);
+extern int drmClose(int fd);
extern drmVersionPtr drmGetVersion(int fd);
extern void drmFreeVersion(drmVersionPtr);
-extern drmListPtr drmGetVersionList(int fd);
-extern void drmFreeVersionList(drmListPtr);
+extern int drmGetMagic(int fd, drmMagicPtr magic);
+extern char *drmGetBusid(int fd);
extern int drmGetInterruptFromBusID(int fd, int busnum, int devnum,
int funcnum);
/* General user-level programmer's API: X server (root) only */
-extern int drmCreateSub(int fd, const char *name, const char *busid);
-extern int drmDestroySub(int fd, const char *busid);
+extern void drmFreeBusid(const char *busid);
+extern int drmSetBusid(int fd, const char *busid);
extern int drmAuthMagic(int fd, drmMagic magic);
extern int drmAddMap(int fd,
drmHandle offset,
@@ -435,9 +308,6 @@ extern int drmSwitchToContext(int fd, drmContext context);
extern int drmDestroyContext(int fd, drmContext handle);
extern int drmCreateDrawable(int fd, drmDrawablePtr handle);
extern int drmDestroyDrawable(int fd, drmDrawable handle);
-extern int drmCtlAddCommand(int fd, drmCtlDesc desc,
- int count, int *inst);
-extern int drmCtlRemoveCommands(int fd);
extern int drmCtlInstHandler(int fd, int irq);
extern int drmCtlUninstHandler(int fd);
extern int drmInstallSIGIOHandler(int fd,
@@ -447,9 +317,6 @@ extern int drmInstallSIGIOHandler(int fd,
extern int drmRemoveSIGIOHandler(int fd);
/* General user-level programmer's API: authenticated client and/or X */
-extern int drmOpenSub(const char *busid);
-extern int drmCloseSub(int fd);
-extern int drmGetMagic(int fd, drmMagicPtr magic);
extern int drmMap(int fd,
drmHandle handle,
drmSize size,