summaryrefslogtreecommitdiff
path: root/xc/lib/GL/mesa/src/drv
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/GL/mesa/src/drv')
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_context.h2
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c4
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_points.c9
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_state.c78
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c21
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_context.c9
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_context.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h12
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_render.c18
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c17
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_span.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_state.c144
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c22
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c4
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c9
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c10
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810context.c32
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810context.h3
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810ioctl.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810render.c16
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810screen.c21
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810screen.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810span.c18
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810state.c61
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810tex.c9
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810texmem.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810texstate.c5
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810tris.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810vb.c20
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_context.c34
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_context.h9
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_debug.c4
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c11
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_render.c16
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_screen.c27
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_screen.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_span.c19
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_state.c68
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_tex.c10
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_texmem.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_texstate.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_tris.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/i830/i830_vb.c20
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c32
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgabuffers.c54
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgabuffers.h3
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgacontext.h3
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgadd.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaioctl.c9
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaioctl.h2
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgapixel.c4
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgarender.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgaspan.c22
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgastate.c45
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatex.c24
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatexmem.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatris.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgavb.c26
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.c31
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.h9
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_dd.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_lock.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_screen.c33
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_span.c45
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_state.c68
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tex.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_texmem.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_texstate.c25
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tris.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_vb.c16
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c13
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_context.c104
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_context.h64
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c15
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_lock.c9
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c24
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c29
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_pixel.c10
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_reg.h30
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_sanity.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_screen.c48
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_screen.h3
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_span.c35
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_state.c111
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_state_init.c77
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c24
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tcl.c36
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tex.c232
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tex.h2
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_texmem.c174
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_texstate.c433
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c102
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c18
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c5
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c7
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_compat.c5
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_context.c48
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_context.h3
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c10
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c10
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c25
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h51
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c29
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c21
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_span.c32
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_state.c110
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c34
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c22
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c39
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c20
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c10
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c16
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c114
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c11
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c5
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c5
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c22
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c42
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h7
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c2
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c11
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c8
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c41
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c18
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c63
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c68
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c16
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h8
143 files changed, 2212 insertions, 1691 deletions
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_context.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_context.h
index 4c7c38978..6e68b6dd2 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_context.h
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_context.h
@@ -3,7 +3,6 @@
#ifndef _FFB_CONTEXT_H
#define _FFB_CONTEXT_H
-#include <X11/Xlibint.h>
#include "dri_util.h"
#include "mtypes.h"
@@ -269,7 +268,6 @@ do { if ((STATE_MASK) & ~((FMESA)->state_dirty)) { \
drmContext hHWContext;
drmLock *driHwLock;
int driFd;
- Display *display;
unsigned int clear_pixel;
unsigned int clear_depth;
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c
index e14b6d443..d0137000f 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c
@@ -26,10 +26,6 @@
*/
#include "mtypes.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
#include "mm.h"
#include "ffb_dd.h"
#include "ffb_span.h"
@@ -41,7 +37,7 @@
#include "ffb_lock.h"
#include "extensions.h"
-#define FFB_DATE "20010624"
+#define FFB_DATE "20021125"
/* Mesa's Driver Functions */
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c
index e82c9ab51..da1de18f3 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c
@@ -26,10 +26,6 @@
*/
#include "mtypes.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
#include "mm.h"
#include "ffb_dd.h"
#include "ffb_span.h"
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_points.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_points.c
index a92c69d09..ee956d371 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_points.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_points.c
@@ -27,20 +27,13 @@
#include "mtypes.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "mm.h"
#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
#include "ffb_context.h"
#include "ffb_vb.h"
-#include "ffb_lines.h"
#include "ffb_points.h"
#include "ffb_tris.h"
#include "ffb_lock.h"
-#include "extensions.h"
+
#undef FFB_POINT_TRACE
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_state.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_state.c
index 13449f64b..6f33a35d2 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_state.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_state.c
@@ -27,9 +27,6 @@
#include "mtypes.h"
-#include <stdio.h>
-#include <stdlib.h>
-
#include "mm.h"
#include "ffb_dd.h"
#include "ffb_span.h"
@@ -37,8 +34,6 @@
#include "ffb_context.h"
#include "ffb_vb.h"
#include "ffb_tris.h"
-#include "ffb_lines.h"
-#include "ffb_points.h"
#include "ffb_state.h"
#include "ffb_lock.h"
#include "extensions.h"
@@ -56,6 +51,7 @@
static unsigned int ffbComputeAlphaFunc(GLcontext *ctx)
{
unsigned int xclip;
+ GLubyte alphaRef;
#ifdef STATE_TRACE
fprintf(stderr, "ffbDDAlphaFunc: func(%s) ref(%02x)\n",
@@ -77,12 +73,13 @@ static unsigned int ffbComputeAlphaFunc(GLcontext *ctx)
return FFB_XCLIP_TEST_ALWAYS | 0x00;
}
- xclip |= (ctx->Color.AlphaRef & 0xff);
+ CLAMPED_FLOAT_TO_UBYTE(alphaRef, ctx->Color.AlphaRef);
+ xclip |= (alphaRef & 0xff);
return xclip;
}
-static void ffbDDAlphaFunc(GLcontext *ctx, GLenum func, GLchan ref)
+static void ffbDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
@@ -448,7 +445,7 @@ void ffbCalcViewport(GLcontext *ctx)
ffbCalcViewportRegs(ctx);
- fmesa->setupnewinputs |= VERT_CLIP;
+ fmesa->setupnewinputs |= VERT_BIT_CLIP;
}
static void ffbDDViewport(GLcontext *ctx, GLint x, GLint y,
@@ -468,32 +465,32 @@ static void ffbDDScissor(GLcontext *ctx, GLint cx, GLint cy,
ffbCalcViewport(ctx);
}
-static void ffbDDSetDrawBuffer(GLcontext *ctx, GLenum buffer)
+static void ffbDDDrawBuffer(GLcontext *ctx, GLenum buffer)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
unsigned int fbc = fmesa->fbc;
#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDSetDrawBuffer: mode(%s)\n",
+ fprintf(stderr, "ffbDDDrawBuffer: mode(%s)\n",
_mesa_lookup_enum_by_nr(buffer));
#endif
fbc &= ~(FFB_FBC_WB_AB | FFB_FBC_RB_MASK);
switch (buffer) {
- case GL_FRONT_LEFT:
+ case FRONT_LEFT_BIT:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
else
fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
else
fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
break;
- case GL_FRONT_AND_BACK:
+ case BACK_LEFT_BIT | FRONT_LEFT_BIT:
fbc |= FFB_FBC_WB_AB;
break;
@@ -507,8 +504,18 @@ static void ffbDDSetDrawBuffer(GLcontext *ctx, GLenum buffer)
}
}
-static void ffbDDSetReadBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum buffer)
+
+static void ffbDDReadBuffer(GLcontext *ctx, GLenum buffer)
+{
+ /* no-op, unless you implement h/w glRead/CopyPixels */
+}
+
+
+/*
+ * Specifies buffer for sw fallbacks (spans)
+ */
+static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
+ GLuint bufferBit)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
unsigned int fbc = fmesa->fbc;
@@ -518,15 +525,15 @@ static void ffbDDSetReadBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
_mesa_lookup_enum_by_nr(buffer));
#endif
fbc &= ~(FFB_FBC_RB_MASK);
- switch (buffer) {
- case GL_FRONT_LEFT:
+ switch (bufferBit) {
+ case FRONT_LEFT_BIT:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_RB_B;
else
fbc |= FFB_FBC_RB_A;
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_RB_A;
else
@@ -543,13 +550,17 @@ static void ffbDDSetReadBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
}
}
-static void ffbDDClearColor(GLcontext *ctx, const GLchan color[4])
+static void ffbDDClearColor(GLcontext *ctx, const GLfloat color[4])
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- fmesa->clear_pixel = ((color[0] << 0) |
- (color[1] << 8) |
- (color[2] << 16));
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+
+ fmesa->clear_pixel = ((c[0] << 0) |
+ (c[1] << 8) |
+ (c[2] << 16));
}
static void ffbDDClearDepth(GLcontext *ctx, GLclampd depth)
@@ -842,14 +853,14 @@ static void ffbDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
tmp = fmesa->fbc & ~FFB_FBC_YE_MASK;
if (state) {
ffbDDStencilFunc(ctx,
- ctx->Stencil.Function,
- ctx->Stencil.Ref,
- ctx->Stencil.ValueMask);
- ffbDDStencilMask(ctx, ctx->Stencil.WriteMask);
+ ctx->Stencil.Function[0],
+ ctx->Stencil.Ref[0],
+ ctx->Stencil.ValueMask[0]);
+ ffbDDStencilMask(ctx, ctx->Stencil.WriteMask[0]);
ffbDDStencilOp(ctx,
- ctx->Stencil.FailFunc,
- ctx->Stencil.ZFailFunc,
- ctx->Stencil.ZPassFunc);
+ ctx->Stencil.FailFunc[0],
+ ctx->Stencil.ZFailFunc[0],
+ ctx->Stencil.ZPassFunc[0]);
tmp |= FFB_FBC_YE_MASK;
} else {
fmesa->stencil = 0xf0000000;
@@ -1017,7 +1028,7 @@ static void ffbDDUpdateState(GLcontext *ctx, GLuint newstate)
if (newstate & _NEW_TEXTURE)
FALLBACK( ctx, FFB_BADATTR_TEXTURE,
- (ctx->Texture._ReallyEnabled != 0));
+ (ctx->Texture._EnabledUnits != 0));
#ifdef STATE_TRACE
fprintf(stderr, "ffbDDUpdateState: newstate(%08x)\n", newstate);
@@ -1078,7 +1089,8 @@ void ffbDDInitStateFuncs(GLcontext *ctx)
ctx->Driver.StencilOp = NULL;
}
- ctx->Driver.SetDrawBuffer = ffbDDSetDrawBuffer;
+ ctx->Driver.DrawBuffer = ffbDDDrawBuffer;
+ ctx->Driver.ReadBuffer = ffbDDReadBuffer;
ctx->Driver.ClearColor = ffbDDClearColor;
ctx->Driver.ClearDepth = ffbDDClearDepth;
ctx->Driver.ClearStencil = ffbDDClearStencil;
@@ -1107,7 +1119,7 @@ void ffbDDInitStateFuncs(GLcontext *ctx)
{
struct swrast_device_driver *swdd =
_swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = ffbDDSetReadBuffer;
+ swdd->SetBuffer = ffbDDSetBuffer;
}
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c
index 2d90fd1e3..d0d3c3b9d 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c
@@ -25,9 +25,6 @@
* David S. Miller <davem@redhat.com>
*/
-#include <stdio.h>
-#include <stdlib.h>
-
#include "glheader.h"
#include "mtypes.h"
#include "macros.h"
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c
index 2e8c6687f..09c9d041e 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c
@@ -28,7 +28,7 @@
#include "ffb_xmesa.h"
#include "ffb_context.h"
#include "ffb_vb.h"
-#include "mem.h"
+#include "imports.h"
#include "tnl/t_context.h"
#include "swrast_setup/swrast_setup.h"
#include "math/m_translate.h"
@@ -175,12 +175,12 @@ static void ffbDDBuildVertices(GLcontext *ctx, GLuint start, GLuint count,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[fmesa->setupindex].emit(ctx, start, count);
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= (FFB_VB_RGBA_BIT | FFB_VB_TWOSIDE_BIT);
ind &= fmesa->setupindex;
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h
index dc0fd2a3f..58b0391c7 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h
@@ -13,8 +13,8 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end)
#endif
#endif
#if (IND & FFB_VB_XYZ_BIT)
- GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
- GLuint proj_stride = VB->ProjectedClipPtr->stride;
+ GLfloat (*proj)[4] = VB->NdcPtr->data;
+ GLuint proj_stride = VB->NdcPtr->stride;
const GLubyte *mask = VB->ClipMask;
#endif
ffb_vertex *v = &fmesa->verts[start];
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c
index ab5bd933b..329911bdc 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c
@@ -30,7 +30,7 @@
#include "context.h"
#include "light.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "mmath.h"
#include "mtypes.h"
#include "simple_list.h"
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
index b851a3240..eff0d5d9f 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
@@ -27,15 +27,12 @@
#ifdef GLX_DIRECT_RENDERING
-#include <X11/Xlibint.h>
-#include <stdio.h>
-
#include "ffb_xmesa.h"
#include "context.h"
#include "matrix.h"
#include "simple_list.h"
#include "mmath.h"
-#include "mem.h"
+#include "imports.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -43,9 +40,6 @@
#include "tnl/t_pipeline.h"
#include "array_cache/acache.h"
-
-#include "xf86dri.h"
-
#include "ffb_context.h"
#include "ffb_dd.h"
#include "ffb_span.h"
@@ -176,7 +170,7 @@ static const struct gl_pipeline_stage *ffb_pipeline[] = {
/* Create and initialize the Mesa and driver specific context data */
static GLboolean
-ffbCreateContext(Display *dpy, const __GLcontextModes *mesaVis,
+ffbCreateContext(const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate)
{
@@ -208,7 +202,6 @@ ffbCreateContext(Display *dpy, const __GLcontextModes *mesaVis,
ffbScreen = (ffbScreenPrivate *) sPriv->private;
/* Dri stuff. */
- fmesa->display = dpy;
fmesa->hHWContext = driContextPriv->hHWContext;
fmesa->driFd = sPriv->fd;
fmesa->driHwLock = &sPriv->pSAREA->lock;
@@ -315,8 +308,7 @@ ffbDestroyContext(__DRIcontextPrivate *driContextPriv)
/* Create and initialize the Mesa and driver specific pixmap buffer data */
static GLboolean
-ffbCreateBuffer(Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
@@ -346,9 +338,8 @@ ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
#define USE_FAST_SWAP
static void
-ffbSwapBuffers(Display *dpy, void *drawablePrivate)
+ffbSwapBuffers( __DRIdrawablePrivate *dPriv )
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
ffbContextPtr fmesa = (ffbContextPtr) dPriv->driContextPriv->driverPrivate;
unsigned int fbc, wid, wid_reg_val, dac_db_bit;
unsigned int shadow_dac_addr, active_dac_addr;
@@ -360,7 +351,7 @@ ffbSwapBuffers(Display *dpy, void *drawablePrivate)
return;
/* Flush pending rendering commands */
- _mesa_swapbuffers(fmesa->glCtx);
+ _mesa_notifySwapBuffers(fmesa->glCtx);
ffb = fmesa->regs;
dac = fmesa->ffbScreen->dac;
@@ -557,7 +548,7 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa)
__DRIscreenPrivate *sPriv = fmesa->driScreen;
int stamp = dPriv->lastStamp;
- DRI_VALIDATE_DRAWABLE_INFO(fmesa->display, sPriv, dPriv);
+ DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
if (dPriv->lastStamp != stamp) {
GLcontext *ctx = fmesa->glCtx;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_context.c
index 4f666f6d8..f7db2adea 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_context.c
@@ -35,14 +35,13 @@
#include "context.h"
#include "simple_list.h"
-#include "mem.h"
+#include "imports.h"
#include "matrix.h"
#include "extensions.h"
#if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h"
#endif
#include "simple_list.h"
-#include "mem.h"
#include "mm.h"
@@ -66,7 +65,7 @@ static const struct gl_pipeline_stage *gamma_pipeline[] = {
0,
};
-GLboolean gammaCreateContext( Display *dpy, const __GLcontextModes *glVisual,
+GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate)
{
@@ -86,14 +85,12 @@ GLboolean gammaCreateContext( Display *dpy, const __GLcontextModes *glVisual,
else
shareCtx = NULL;
- gmesa->glCtx = _mesa_create_context(glVisual, shareCtx, gmesa, GL_TRUE);
+ gmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) gmesa, GL_TRUE);
if (!gmesa->glCtx) {
FREE(gmesa);
return GL_FALSE;
}
- gmesa->display = dpy;
-
gmesa->driContext = driContextPriv;
gmesa->driScreen = sPriv;
gmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_context.h
index a2bbc9466..ce1994471 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_context.h
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_context.h
@@ -58,8 +58,7 @@ typedef union {
extern void gammaDDUpdateHWState(GLcontext *ctx);
extern gammaScreenPtr gammaCreateScreen(__DRIscreenPrivate *sPriv);
extern void gammaDestroyScreen(__DRIscreenPrivate *sPriv);
-extern GLboolean gammaCreateContext( Display *dpy,
- const __GLcontextModes *glVisual,
+extern GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate);
@@ -204,6 +203,9 @@ void gammaPrintGlobalLRU( gammaContextPtr gmesa );
extern void gammaFallback( gammaContextPtr gmesa, GLuint bit, GLboolean mode );
#define FALLBACK( imesa, bit, mode ) gammaFallback( imesa, bit, mode )
+void gammaSwapOutTexObj( gammaContextPtr gmesa, gammaTextureObjectPtr t );
+void gammaUpdateTexLRU( gammaContextPtr gmesa, gammaTextureObjectPtr t );
+
/* Use the templated vertex formats. Only one of these is used in gamma.
*/
#define TAG(x) gamma##x
@@ -246,8 +248,6 @@ struct gamma_context {
/* Mirrors of some DRI state
*/
- Display *display; /* X server display */
-
drmContext hHWContext;
drmLock *driHwLock;
int driFd;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c
index 98ef6cc52..5bd84026e 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_dd.c
@@ -33,7 +33,7 @@
#include "context.h"
#include "swrast/swrast.h"
-#define GAMMA_DATE "20010624"
+#define GAMMA_DATE "20021125"
/* Return the width and height of the current color buffer.
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c
index 4a7499579..12a48ee1f 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c
@@ -30,7 +30,7 @@ void gammaGetLock( gammaContextPtr gmesa, GLuint flags )
* Since the hardware state depends on having the latest drawable
* clip rects, all state checking must be done _after_ this call.
*/
- DRI_VALIDATE_DRAWABLE_INFO( gmesa->display, sPriv, dPriv );
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
if ( gmesa->lastStamp != dPriv->lastStamp ) {
gmesa->lastStamp = dPriv->lastStamp;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h b/xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h
index 2ef58c63b..bf9cf5f11 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h
@@ -246,15 +246,15 @@ do { \
} while (0)
#ifdef DO_VALIDATE
-#define VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp) \
+#define VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp) \
do { \
- __DRIscreenPrivate *psp = gcp->driScreen; \
- __DRIdrawablePrivate *pdp = gcp->driDrawable; \
+ /*__DRIscreenPrivate *psp = gcp->driScreen;*/ \
+ __DRIdrawablePrivate *pdp = gcp->driDrawable; \
\
if (*(pdp->pStamp) != pdp->lastStamp) { \
int old_index = pdp->index; \
while (*(pdp->pStamp) != pdp->lastStamp) { \
- DRI_VALIDATE_DRAWABLE_INFO_ONCE(gcp->display, psp->myNum, pdp);\
+ DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \
} \
if (pdp->index != old_index) { \
gcp->Window &= ~W_GIDMask; \
@@ -262,8 +262,8 @@ do { \
CHECK_WC_DMA_BUFFER(gcp, 1); \
WRITE(gcp->WCbuf, GLINTWindow, gcp->Window|(gcp->FrameCount<<9));\
} \
- \
- gammaUpdateViewportOffset( gcp->glCtx); \
+ \
+ gammaUpdateViewportOffset( gcp->glCtx); \
\
if (pdp->numClipRects == 1 && \
pdp->pClipRects->x1 == pdp->x && \
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_render.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_render.c
index d283b641b..145e29c54 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_render.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_render.c
@@ -28,7 +28,7 @@
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "mtypes.h"
#include "mmath.h"
@@ -67,8 +67,8 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
coord = VB->ClipPtr->data;
coord_stride = VB->ClipPtr->stride;
} else {
- coord = VB->ProjectedClipPtr->data;
- coord_stride = VB->ProjectedClipPtr->stride;
+ coord = VB->NdcPtr->data;
+ coord_stride = VB->NdcPtr->stride;
}
if (VB->importable_data) {
@@ -179,7 +179,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_CLIP;
+ GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
}
static const GLuint hw_prim[GL_POLYGON+1] = {
@@ -274,20 +274,20 @@ static GLboolean gamma_run_render( GLcontext *ctx,
static void gamma_check_render( GLcontext *ctx,
struct gl_pipeline_stage *stage )
{
- GLuint inputs = VERT_CLIP|VERT_RGBA;
+ GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
if (ctx->Fog.Enabled)
- inputs |= VERT_FOG_COORD;
+ inputs |= VERT_BIT_FOG;
}
stage->inputs = inputs;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c
index ddcd9d0a4..85cd1e516 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_screen.c
@@ -27,7 +27,7 @@
#include "gamma_vb.h"
#include "glint_dri.h"
-#include "mem.h"
+#include "imports.h"
gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv )
{
@@ -36,15 +36,12 @@ gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv )
int i;
#if 0
- /* Check the DRI version */
- {
- int major, minor, patch;
- if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) {
- if ( major != 3 || minor != 1 || patch < 0 ) {
- __driUtilMessage( "r128 DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch );
- return GL_FALSE;
- }
- }
+ /* Check the DRI externsion version */
+ if ( sPriv->driMajor != 3 || sPriv->driMinor != 1 ) {
+ __driUtilMessage( "Gamma DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return NULL;
}
/* Check that the DDX driver version is compatible */
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_span.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_span.c
index ce0b63471..180bf26a4 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_span.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_span.c
@@ -260,17 +260,17 @@ done:
}
#endif
-static void gammaSetReadBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLenum mode )
+static void gammaSetBuffer( GLcontext *ctx,
+ GLframebuffer *colorBuffer,
+ GLuint bufferBit )
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- switch ( mode ) {
- case GL_FRONT_LEFT:
+ switch ( bufferBit ) {
+ case FRONT_LEFT_BIT:
gmesa->readOffset = 0;
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
break;
}
@@ -282,7 +282,7 @@ void gammaDDInitSpanFuncs( GLcontext *ctx )
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = gammaSetReadBuffer;
+ swdd->SetBuffer = gammaSetBuffer;
switch ( gmesa->gammaScreen->cpp ) {
case 2:
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_state.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_state.c
index 5541006d4..867cd678b 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_state.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_state.c
@@ -24,7 +24,6 @@
* 3DLabs Gamma driver
*/
-#include <X11/Xlibint.h>
#include "gamma_context.h"
#include "gamma_macros.h"
#include "macros.h"
@@ -47,11 +46,12 @@ static void gammaUpdateAlphaMode( GLcontext *ctx )
CARD32 a = gmesa->AlphaTestMode;
CARD32 b = gmesa->AlphaBlendMode;
CARD32 f = gmesa->AB_FBReadMode_Save = 0;
+ GLubyte refByte = (GLint) (ctx->Color.AlphaRef * 255.0);
a &= ~(AT_CompareMask | AT_RefValueMask);
b &= ~(AB_SrcBlendMask | AB_DstBlendMask);
- a |= ctx->Color.AlphaRef << 4;
+ a |= refByte << 4;
switch ( ctx->Color.AlphaFunc ) {
case GL_NEVER:
@@ -166,9 +166,10 @@ static void gammaUpdateAlphaMode( GLcontext *ctx )
gmesa->AB_FBReadMode_Save = f;
}
-static void gammaDDAlphaFunc( GLcontext *ctx, GLenum func, GLchan ref )
+static void gammaDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
+ (void) ref;
FLUSH_BATCH( gmesa );
@@ -1015,12 +1016,17 @@ static void gammaDDShadeModel( GLcontext *ctx, GLenum mode )
* Miscellaneous
*/
-static void gammaDDClearColor( GLcontext *ctx, const GLchan color[4])
+static void gammaDDClearColor( GLcontext *ctx, const GLfloat color[4])
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
+ GLubyte c[4];
+ UNCLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
gmesa->ClearColor = gammaPackColor( gmesa->gammaScreen->cpp,
- color[0], color[1], color[2], color[3] );
+ c[0], c[1], c[2], c[3] );
if (gmesa->gammaScreen->cpp == 2) gmesa->ClearColor |= gmesa->ClearColor<<16;
}
@@ -1041,7 +1047,7 @@ static void gammaDDLogicalOpcode( GLcontext *ctx, GLenum opcode )
gmesa->dirty |= GAMMA_UPLOAD_LOGICOP;
}
-static void gammaDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
+static void gammaDDDrawBuffer( GLcontext *ctx, GLenum mode )
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
@@ -1057,6 +1063,11 @@ static void gammaDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
}
}
+static void gammaDDReadBuffer( GLcontext *ctx, GLenum mode )
+{
+ /* XXX anything? */
+}
+
/* =============================================================
* Window position and viewport transformation
*/
@@ -1131,84 +1142,72 @@ void gammaUpdateViewportOffset( GLcontext *ctx )
static void gammaLoadHWMatrix(GLcontext *ctx)
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
+ const GLfloat *m;
gmesa->TransformMode &= ~XM_XformTexture;
switch (ctx->Transform.MatrixMode) {
case GL_MODELVIEW:
gmesa->TransformMode |= XM_UseModelViewMatrix;
+ m = ctx->ModelviewMatrixStack.Top->m;
CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewMatrix0, ctx->ModelView.m[0]);
- WRITEF(gmesa->buf, ModelViewMatrix1, ctx->ModelView.m[1]);
- WRITEF(gmesa->buf, ModelViewMatrix2, ctx->ModelView.m[2]);
- WRITEF(gmesa->buf, ModelViewMatrix3, ctx->ModelView.m[3]);
- WRITEF(gmesa->buf, ModelViewMatrix4, ctx->ModelView.m[4]);
- WRITEF(gmesa->buf, ModelViewMatrix5, ctx->ModelView.m[5]);
- WRITEF(gmesa->buf, ModelViewMatrix6, ctx->ModelView.m[6]);
- WRITEF(gmesa->buf, ModelViewMatrix7, ctx->ModelView.m[7]);
- WRITEF(gmesa->buf, ModelViewMatrix8, ctx->ModelView.m[8]);
- WRITEF(gmesa->buf, ModelViewMatrix9, ctx->ModelView.m[9]);
- WRITEF(gmesa->buf, ModelViewMatrix10, ctx->ModelView.m[10]);
- WRITEF(gmesa->buf, ModelViewMatrix11, ctx->ModelView.m[11]);
- WRITEF(gmesa->buf, ModelViewMatrix12, ctx->ModelView.m[12]);
- WRITEF(gmesa->buf, ModelViewMatrix13, ctx->ModelView.m[13]);
- WRITEF(gmesa->buf, ModelViewMatrix14, ctx->ModelView.m[14]);
- WRITEF(gmesa->buf, ModelViewMatrix15, ctx->ModelView.m[15]);
+ WRITEF(gmesa->buf, ModelViewMatrix0, m[0]);
+ WRITEF(gmesa->buf, ModelViewMatrix1, m[1]);
+ WRITEF(gmesa->buf, ModelViewMatrix2, m[2]);
+ WRITEF(gmesa->buf, ModelViewMatrix3, m[3]);
+ WRITEF(gmesa->buf, ModelViewMatrix4, m[4]);
+ WRITEF(gmesa->buf, ModelViewMatrix5, m[5]);
+ WRITEF(gmesa->buf, ModelViewMatrix6, m[6]);
+ WRITEF(gmesa->buf, ModelViewMatrix7, m[7]);
+ WRITEF(gmesa->buf, ModelViewMatrix8, m[8]);
+ WRITEF(gmesa->buf, ModelViewMatrix9, m[9]);
+ WRITEF(gmesa->buf, ModelViewMatrix10, m[10]);
+ WRITEF(gmesa->buf, ModelViewMatrix11, m[11]);
+ WRITEF(gmesa->buf, ModelViewMatrix12, m[12]);
+ WRITEF(gmesa->buf, ModelViewMatrix13, m[13]);
+ WRITEF(gmesa->buf, ModelViewMatrix14, m[14]);
+ WRITEF(gmesa->buf, ModelViewMatrix15, m[15]);
break;
case GL_PROJECTION:
+ m = ctx->ProjectionMatrixStack.Top->m;
CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix0,
- ctx->ProjectionMatrix.m[0]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix1,
- ctx->ProjectionMatrix.m[1]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix2,
- ctx->ProjectionMatrix.m[2]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix3,
- ctx->ProjectionMatrix.m[3]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix4,
- ctx->ProjectionMatrix.m[4]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix5,
- ctx->ProjectionMatrix.m[5]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix6,
- ctx->ProjectionMatrix.m[6]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix7,
- ctx->ProjectionMatrix.m[7]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix8,
- ctx->ProjectionMatrix.m[8]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix9,
- ctx->ProjectionMatrix.m[9]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix10,
- ctx->ProjectionMatrix.m[10]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix11,
- ctx->ProjectionMatrix.m[11]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix12,
- ctx->ProjectionMatrix.m[12]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix13,
- ctx->ProjectionMatrix.m[13]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix14,
- ctx->ProjectionMatrix.m[14]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix15,
- ctx->ProjectionMatrix.m[15]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix0, m[0]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix1, m[1]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix2, m[2]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix3, m[3]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix4, m[4]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix5, m[5]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix6, m[6]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix7, m[7]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix8, m[8]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix9, m[9]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix10, m[10]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix11, m[11]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix12, m[12]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix13, m[13]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix14, m[14]);
+ WRITEF(gmesa->buf, ModelViewProjectionMatrix15, m[15]);
break;
case GL_TEXTURE:
+ m = ctx->TextureMatrixStack[0].Top->m;
CHECK_DMA_BUFFER(gmesa, 16);
gmesa->TransformMode |= XM_XformTexture;
- WRITEF(gmesa->buf, TextureMatrix0, ctx->TextureMatrix[0].m[0]);
- WRITEF(gmesa->buf, TextureMatrix1, ctx->TextureMatrix[0].m[1]);
- WRITEF(gmesa->buf, TextureMatrix2, ctx->TextureMatrix[0].m[2]);
- WRITEF(gmesa->buf, TextureMatrix3, ctx->TextureMatrix[0].m[3]);
- WRITEF(gmesa->buf, TextureMatrix4, ctx->TextureMatrix[0].m[4]);
- WRITEF(gmesa->buf, TextureMatrix5, ctx->TextureMatrix[0].m[5]);
- WRITEF(gmesa->buf, TextureMatrix6, ctx->TextureMatrix[0].m[6]);
- WRITEF(gmesa->buf, TextureMatrix7, ctx->TextureMatrix[0].m[7]);
- WRITEF(gmesa->buf, TextureMatrix8, ctx->TextureMatrix[0].m[8]);
- WRITEF(gmesa->buf, TextureMatrix9, ctx->TextureMatrix[0].m[9]);
- WRITEF(gmesa->buf, TextureMatrix10, ctx->TextureMatrix[0].m[10]);
- WRITEF(gmesa->buf, TextureMatrix11, ctx->TextureMatrix[0].m[11]);
- WRITEF(gmesa->buf, TextureMatrix12, ctx->TextureMatrix[0].m[12]);
- WRITEF(gmesa->buf, TextureMatrix13, ctx->TextureMatrix[0].m[13]);
- WRITEF(gmesa->buf, TextureMatrix14, ctx->TextureMatrix[0].m[14]);
- WRITEF(gmesa->buf, TextureMatrix15, ctx->TextureMatrix[0].m[15]);
+ WRITEF(gmesa->buf, TextureMatrix0, m[0]);
+ WRITEF(gmesa->buf, TextureMatrix1, m[1]);
+ WRITEF(gmesa->buf, TextureMatrix2, m[2]);
+ WRITEF(gmesa->buf, TextureMatrix3, m[3]);
+ WRITEF(gmesa->buf, TextureMatrix4, m[4]);
+ WRITEF(gmesa->buf, TextureMatrix5, m[5]);
+ WRITEF(gmesa->buf, TextureMatrix6, m[6]);
+ WRITEF(gmesa->buf, TextureMatrix7, m[7]);
+ WRITEF(gmesa->buf, TextureMatrix8, m[8]);
+ WRITEF(gmesa->buf, TextureMatrix9, m[9]);
+ WRITEF(gmesa->buf, TextureMatrix10, m[10]);
+ WRITEF(gmesa->buf, TextureMatrix11, m[11]);
+ WRITEF(gmesa->buf, TextureMatrix12, m[12]);
+ WRITEF(gmesa->buf, TextureMatrix13, m[13]);
+ WRITEF(gmesa->buf, TextureMatrix14, m[14]);
+ WRITEF(gmesa->buf, TextureMatrix15, m[15]);
break;
default:
@@ -1665,7 +1664,7 @@ void gammaDDUpdateHWState( GLcontext *ctx )
}
-void gammaDDUpdateState( GLcontext *ctx, GLuint new_state )
+static void gammaDDUpdateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
@@ -1691,7 +1690,8 @@ void gammaDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.Clear = gammaDDClear;
ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearColor = gammaDDClearColor;
- ctx->Driver.SetDrawBuffer = gammaDDSetDrawBuffer;
+ ctx->Driver.DrawBuffer = gammaDDDrawBuffer;
+ ctx->Driver.ReadBuffer = gammaDDReadBuffer;
ctx->Driver.IndexMask = NULL;
ctx->Driver.ColorMask = gammaDDColorMask;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c
index a0e30723a..6f33c38ee 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c
@@ -1,11 +1,7 @@
-/* $XFree86$ */
-
-#include <stdlib.h>
-#include <stdio.h>
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "simple_list.h"
#include "enums.h"
#include "texstore.h"
@@ -20,11 +16,12 @@
/*
* Compute the 'S2.4' lod bias factor from the floating point OpenGL bias.
*/
+#if 0
static GLuint gammaComputeLodBias(GLfloat bias)
{
return bias;
}
-
+#endif
static void gammaSetTexWrapping(gammaTextureObjectPtr t,
GLenum wraps, GLenum wrapt)
@@ -141,7 +138,7 @@ static void gammaTexParameter( GLcontext *ctx, GLenum target,
break;
case GL_TEXTURE_BORDER_COLOR:
- gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
+ gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
break;
case GL_TEXTURE_BASE_LEVEL:
@@ -206,7 +203,12 @@ static void gammaTexEnv( GLcontext *ctx, GLenum target,
{
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
+<<<<<<< gamma_tex.c
+ (void) t;
+ /* XXX Looks like there's something missing here */
+=======
/* XXX Looks like there's something missing here */
+>>>>>>> 1.4
}
#endif
break;
@@ -216,6 +218,7 @@ static void gammaTexEnv( GLcontext *ctx, GLenum target,
}
}
+#if 0
static void gammaTexImage1D( GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
@@ -233,7 +236,9 @@ static void gammaTexImage1D( GLcontext *ctx, GLenum target, GLint level,
width, border, format, type,
pixels, pack, texObj, texImage );
}
+#endif
+#if 0
static void gammaTexSubImage1D( GLcontext *ctx,
GLenum target,
GLint level,
@@ -253,6 +258,7 @@ static void gammaTexSubImage1D( GLcontext *ctx,
format, type, pixels, pack, texObj,
texImage);
}
+#endif
static void gammaTexImage2D( GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
@@ -341,7 +347,7 @@ static void gammaBindTexture( GLcontext *ctx, GLenum target,
gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
+ gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
}
}
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c
index 82d55ed07..851e1436d 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c
@@ -1,7 +1,3 @@
-/* $XFree86$ */
-
-#include <stdlib.h>
-#include <stdio.h>
#include "glheader.h"
#include "macros.h"
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c
index e6a9185b3..3591bd24a 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c
@@ -1,7 +1,3 @@
-/* $XFree86$ */
-
-#include <stdlib.h>
-#include <stdio.h>
#include "glheader.h"
#include "macros.h"
@@ -151,7 +147,7 @@ static void gammaUpdateTexUnit( GLcontext *ctx, GLuint unit )
/* fprintf(stderr, "%s\n", __FUNCTION__); */
- if (texUnit->_ReallyEnabled == TEXTURE0_2D)
+ if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
{
struct gl_texture_object *tObj = texUnit->_Current;
gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c
index bd7a8797b..f03910302 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_tris.c
@@ -25,9 +25,6 @@
* 3DLabs Gamma driver.
*/
-#include <stdio.h>
-#include <stdlib.h>
-
#include "gamma_context.h"
#include "gamma_vb.h"
#include "gamma_tris.h"
@@ -154,6 +151,7 @@ gamma_fallback_line( gammaContextPtr gmesa,
}
+#if 0
static void
gamma_fallback_point( gammaContextPtr gmesa,
const gammaVertex *v0 )
@@ -163,6 +161,7 @@ gamma_fallback_point( gammaContextPtr gmesa,
gamma_translate_vertex( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
}
+#endif
/***********************************************************************
@@ -180,7 +179,7 @@ gamma_fallback_point( gammaContextPtr gmesa,
#define LINE_FALLBACK (0)
#define TRI_FALLBACK (0)
-void gammaChooseRasterState(GLcontext *ctx)
+static void gammaChooseRasterState(GLcontext *ctx)
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
GLuint flags = ctx->_TriangleCaps;
@@ -193,7 +192,7 @@ void gammaChooseRasterState(GLcontext *ctx)
else
gmesa->Begin &= ~B_AntiAliasEnable;
- if ( ctx->Texture._ReallyEnabled ) {
+ if ( ctx->Texture.Unit[0]._ReallyEnabled ) {
ind |= GAMMA_RAST_TEX_BIT;
gmesa->Begin |= B_TextureEnable;
} else
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c
index e1e9801e3..10907a90c 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c
@@ -27,7 +27,7 @@
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "colormac.h"
#include "mmath.h"
@@ -278,21 +278,21 @@ void gammaBuildVertices( GLcontext *ctx,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[gmesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= GAMMA_RGBA_BIT;
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
ind |= GAMMA_SPEC_BIT;
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
ind |= GAMMA_TEX0_BIT;
- if (newinputs & VERT_FOG_COORD)
+ if (newinputs & VERT_BIT_FOG)
ind |= GAMMA_FOG_BIT;
if (gmesa->SetupIndex & GAMMA_PTEX_BIT)
@@ -318,7 +318,7 @@ void gammaChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled)
ind |= GAMMA_FOG_BIT;
- if (ctx->Texture._ReallyEnabled) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled) {
_tnl_need_projected_coords( ctx, GL_FALSE );
ind |= GAMMA_TEX0_BIT;
} else
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
index 881ca2282..ac63fd12a 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
@@ -74,8 +74,7 @@ gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
static GLboolean
-gammaCreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
@@ -103,11 +102,8 @@ gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
}
static void
-gammaSwapBuffers(Display *dpy, void *drawablePrivate)
+gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- (void) dpy;
-
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
gammaContextPtr gmesa;
__DRIscreenPrivate *driScrnPriv;
@@ -117,6 +113,8 @@ gammaSwapBuffers(Display *dpy, void *drawablePrivate)
ctx = gmesa->glCtx;
driScrnPriv = gmesa->driScreen;
+ _mesa_notifySwapBuffers(ctx);
+
VALIDATE_DRAWABLE_INFO(gmesa);
/* Flush any partially filled buffers */
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810context.c b/xc/lib/GL/mesa/src/drv/i810/i810context.c
index 916ce43b7..164396fb4 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810context.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810context.c
@@ -38,7 +38,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "matrix.h"
#include "simple_list.h"
#include "extensions.h"
-#include "mem.h"
+#include "imports.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -57,9 +57,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i810vb.h"
#include "i810ioctl.h"
-#include <X11/Xlibint.h>
-#include <stdio.h>
-
static const GLubyte *i810GetString( GLcontext *ctx, GLenum name )
{
@@ -67,7 +64,7 @@ static const GLubyte *i810GetString( GLcontext *ctx, GLenum name )
case GL_VENDOR:
return (GLubyte *)"Keith Whitwell";
case GL_RENDERER:
- return (GLubyte *)"Mesa DRI I810 20020221";
+ return (GLubyte *)"Mesa DRI I810 20021125";
default:
return 0;
}
@@ -117,7 +114,7 @@ static const struct gl_pipeline_stage *i810_pipeline[] = {
GLboolean
-i810CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
+i810CreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate )
{
@@ -139,7 +136,7 @@ i810CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
shareCtx = ((i810ContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
- imesa->glCtx = _mesa_create_context(mesaVis, shareCtx, imesa, GL_TRUE);
+ imesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void*) imesa, GL_TRUE);
if (!imesa->glCtx) {
FREE(imesa);
return GL_FALSE;
@@ -201,7 +198,6 @@ i810CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
/* Dri stuff
*/
- imesa->display = dpy;
imesa->hHWContext = driContextPriv->hHWContext;
imesa->driFd = sPriv->fd;
imesa->driHwLock = &sPriv->pSAREA->lock;
@@ -299,16 +295,17 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa )
static void i810XMesaWindowMoved( i810ContextPtr imesa )
{
- switch (imesa->glCtx->Color.DriverDrawBuffer) {
- case GL_BACK_LEFT:
+ switch (imesa->glCtx->Color._DrawDestMask) {
+ case FRONT_LEFT_BIT:
+ i810XMesaSetFrontClipRects( imesa );
+ break;
+ case BACK_LEFT_BIT:
i810XMesaSetBackClipRects( imesa );
break;
- case GL_FRONT_LEFT:
default:
+ /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
i810XMesaSetFrontClipRects( imesa );
- break;
}
-
}
@@ -371,7 +368,7 @@ void i810GetLock( i810ContextPtr imesa, GLuint flags )
* NOTE: This releases and regains the hw lock, so all state
* checking must be done *after* this call:
*/
- DRI_VALIDATE_DRAWABLE_INFO(imesa->display, sPriv, dPriv);
+ DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
/* If we lost context, need to dump all registers to hardware.
@@ -422,18 +419,15 @@ void i810GetLock( i810ContextPtr imesa, GLuint flags )
void
-i810SwapBuffers(Display *dpy, void *drawablePrivate)
+i810SwapBuffers( __DRIdrawablePrivate *dPriv )
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- (void) dpy;
-
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
i810ContextPtr imesa;
GLcontext *ctx;
imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = imesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
- _mesa_swapbuffers( ctx ); /* flush pending rendering comands */
+ _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
if ( imesa->doPageFlip ) {
i810PageFlip( dPriv );
}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810context.h b/xc/lib/GL/mesa/src/drv/i810/i810context.h
index f79bc8482..347a4ef20 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810context.h
+++ b/xc/lib/GL/mesa/src/drv/i810/i810context.h
@@ -30,8 +30,6 @@ typedef struct i810_context_t i810Context;
typedef struct i810_context_t *i810ContextPtr;
typedef struct i810_texture_object_t *i810TextureObjectPtr;
-#include <X11/Xlibint.h>
-
#include "mtypes.h"
#include "mm.h"
@@ -175,7 +173,6 @@ struct i810_context_t {
drmContext hHWContext;
drmLock *driHwLock;
int driFd;
- Display *display;
__DRIdrawablePrivate *driDrawable;
__DRIscreenPrivate *driScreen;
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c
index 1cd1790c0..49aa4ffec 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c
@@ -1,7 +1,6 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.c,v 1.6 2002/02/22 21:33:03 dawes Exp $ */
-#include <stdio.h>
-#include <unistd.h>
+#include <unistd.h> /* for usleep() */
#include "glheader.h"
#include "mtypes.h"
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810render.c b/xc/lib/GL/mesa/src/drv/i810/i810render.c
index b13adeffd..37d05069e 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810render.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810render.c
@@ -34,7 +34,7 @@
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "mtypes.h"
#include "mmath.h"
@@ -106,7 +106,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start,
count, flags );
- I810_CONTEXT(ctx)->SetupNewInputs = VERT_CLIP;
+ I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
}
@@ -151,7 +151,7 @@ static GLboolean i810_run_render( GLcontext *ctx,
return GL_TRUE;
}
- imesa->SetupNewInputs = VERT_CLIP;
+ imesa->SetupNewInputs = VERT_BIT_CLIP;
tnl->Driver.Render.Start( ctx );
@@ -172,20 +172,20 @@ static GLboolean i810_run_render( GLcontext *ctx,
static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
{
- GLuint inputs = VERT_CLIP|VERT_RGBA;
+ GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
if (ctx->Fog.Enabled)
- inputs |= VERT_FOG_COORD;
+ inputs |= VERT_BIT_FOG;
}
stage->inputs = inputs;
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810screen.c b/xc/lib/GL/mesa/src/drv/i810/i810screen.c
index bf34ef99d..d3f932522 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810screen.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810screen.c
@@ -33,9 +33,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <X11/Xlibint.h>
-#include <stdio.h>
-
#include "glheader.h"
#include "context.h"
#include "matrix.h"
@@ -90,15 +87,12 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
i810ScreenPrivate *i810Screen;
I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv;
- /* Check the DRI version */
- {
- int major, minor, patch;
- if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) {
- if (major != 4 || minor < 0) {
- __driUtilMessage("i810 DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch);
- return GL_FALSE;
- }
- }
+ /* Check the DRI externsion version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "i810 DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return GL_FALSE;
}
/* Check that the DDX driver version is compatible */
@@ -217,8 +211,7 @@ i810DestroyScreen(__DRIscreenPrivate *sPriv)
static GLboolean
-i810CreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810screen.h b/xc/lib/GL/mesa/src/drv/i810/i810screen.h
index 4aedbfd76..4625bc5e9 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810screen.h
+++ b/xc/lib/GL/mesa/src/drv/i810/i810screen.h
@@ -78,7 +78,7 @@ typedef struct {
extern GLboolean
-i810CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
+i810CreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate );
@@ -94,6 +94,6 @@ i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driReadPriv);
extern void
-i810SwapBuffers(Display *dpy, void *drawablePrivate);
+i810SwapBuffers(__DRIdrawablePrivate *driDrawPriv);
#endif
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810span.c b/xc/lib/GL/mesa/src/drv/i810/i810span.c
index f7ca9124c..15ba0a8ef 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810span.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810span.c
@@ -116,15 +116,23 @@ do { \
#include "depthtmp.h"
-static void i810SetReadBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum mode )
+/*
+ * This function is called to specify which buffer to read and write
+ * for software rasterization (swrast) fallbacks. This doesn't necessarily
+ * correspond to glDrawBuffer() or glReadBuffer() calls.
+ */
+static void i810SetBuffer(GLcontext *ctx, GLframebuffer *buffer,
+ GLuint bufferBit )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
+ (void) buffer;
- if (mode == GL_FRONT_LEFT) {
+ if (bufferBit == FRONT_LEFT_BIT) {
+ imesa->drawMap = (char *)imesa->driScreen->pFB;
imesa->readMap = (char *)imesa->driScreen->pFB;
}
- else if (mode == GL_BACK_LEFT) {
+ else if (bufferBit == BACK_LEFT_BIT) {
+ imesa->drawMap = imesa->i810Screen->back.map;
imesa->readMap = imesa->i810Screen->back.map;
}
else {
@@ -137,7 +145,7 @@ void i810InitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = i810SetReadBuffer;
+ swdd->SetBuffer = i810SetBuffer;
swdd->WriteRGBASpan = i810WriteRGBASpan_565;
swdd->WriteRGBSpan = i810WriteRGBSpan_565;
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810state.c b/xc/lib/GL/mesa/src/drv/i810/i810state.c
index 868fad43f..954a9e1b2 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810state.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810state.c
@@ -1,6 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810state.c,v 1.8 2002/09/10 00:39:37 dawes Exp $ */
-
-#include <stdio.h>
#include "glheader.h"
#include "context.h"
@@ -43,10 +40,13 @@ static __inline__ GLuint i810PackColor(GLuint format,
}
-static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLchan ref)
+static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint a = (ZA_UPDATE_ALPHAFUNC|ZA_UPDATE_ALPHAREF);
+ GLubyte refByte;
+
+ CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
switch (ctx->Color.AlphaFunc) {
case GL_NEVER: a |= ZA_ALPHA_NEVER; break;
@@ -60,7 +60,7 @@ static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLchan ref)
default: return;
}
- a |= ((ref & 0xfc) << ZA_ALPHAREF_SHIFT);
+ a |= ((refByte & 0xfc) << ZA_ALPHAREF_SHIFT);
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_ZA] &= ~(ZA_ALPHA_MASK|ZA_ALPHAREF_MASK);
@@ -276,45 +276,59 @@ static void i810RenderMode( GLcontext *ctx, GLenum mode )
}
-static void i810SetDrawBuffer(GLcontext *ctx, GLenum mode )
+static void i810DrawBuffer(GLcontext *ctx, GLenum mode )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
- if (mode == GL_FRONT_LEFT)
- {
+ /*
+ * _DrawDestMask is easier to cope with than <mode>.
+ */
+ switch ( ctx->Color._DrawDestMask ) {
+ case FRONT_LEFT_BIT:
I810_FIREVERTICES(imesa);
I810_STATECHANGE(imesa, I810_UPLOAD_BUFFERS);
imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->fbOffset |
imesa->i810Screen->backPitchBits);
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
i810XMesaSetFrontClipRects( imesa );
FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_FALSE );
- }
- else if (mode == GL_BACK_LEFT)
- {
+ break;
+ case BACK_LEFT_BIT:
I810_FIREVERTICES(imesa);
I810_STATECHANGE(imesa, I810_UPLOAD_BUFFERS);
imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->backOffset |
imesa->i810Screen->backPitchBits);
- imesa->drawMap = imesa->i810Screen->back.map;
- imesa->readMap = imesa->i810Screen->back.map;
i810XMesaSetBackClipRects( imesa );
FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_FALSE );
- }
- else {
+ break;
+ default:
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
}
+
+ /* We want to update the s/w rast state too so that r200SetBuffer()
+ * gets called.
+ */
+ _swrast_DrawBuffer(ctx, mode);
}
+static void i810ReadBuffer(GLcontext *ctx, GLenum mode )
+{
+ /* XXX anything? */
+}
+
-static void i810ClearColor(GLcontext *ctx, const GLchan color[4] )
+static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
imesa->ClearColor = i810PackColor( imesa->i810Screen->fbFormat,
- color[0], color[1],
- color[2], color[3] );
+ c[0], c[1], c[2], c[3] );
}
@@ -897,12 +911,14 @@ void i810InitState( GLcontext *ctx )
memset(imesa->BufferSetup, 0, sizeof(imesa->BufferSetup));
imesa->BufferSetup[I810_DESTREG_DI0] = CMD_OP_DESTBUFFER_INFO;
- if (imesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) {
+ if (imesa->glCtx->Visual.doubleBufferMode) {
+ /* use back buffer by default */
imesa->drawMap = i810Screen->back.map;
imesa->readMap = i810Screen->back.map;
imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->backOffset |
i810Screen->backPitchBits);
} else {
+ /* use front buffer by default */
imesa->drawMap = (char *)imesa->driScreen->pFB;
imesa->readMap = (char *)imesa->driScreen->pFB;
imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->fbOffset |
@@ -954,7 +970,8 @@ void i810InitStateFuncs(GLcontext *ctx)
ctx->Driver.PolygonStipple = i810PolygonStipple;
ctx->Driver.RenderMode = i810RenderMode;
ctx->Driver.Scissor = i810Scissor;
- ctx->Driver.SetDrawBuffer = i810SetDrawBuffer;
+ ctx->Driver.DrawBuffer = i810DrawBuffer;
+ ctx->Driver.ReadBuffer = i810ReadBuffer;
ctx->Driver.ShadeModel = i810ShadeModel;
ctx->Driver.DepthRange = i810DepthRange;
ctx->Driver.Viewport = i810Viewport;
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tex.c b/xc/lib/GL/mesa/src/drv/i810/i810tex.c
index 37dc13bc3..6f0de817d 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810tex.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810tex.c
@@ -23,12 +23,9 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tex.c,v 1.8 2002/02/22 21:33:04 dawes Exp $ */
-#include <stdlib.h>
-#include <stdio.h>
-
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "simple_list.h"
#include "enums.h"
#include "texstore.h"
@@ -179,7 +176,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,
break;
case GL_TEXTURE_BORDER_COLOR:
- i810SetTexBorderColor( t, tObj->BorderColor );
+ i810SetTexBorderColor( t, tObj->_BorderChan );
break;
case GL_TEXTURE_BASE_LEVEL:
@@ -371,7 +368,7 @@ static void i810BindTexture( GLcontext *ctx, GLenum target,
i810SetTexWrapping( t, tObj->WrapS, tObj->WrapT );
i810SetTexFilter( imesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- i810SetTexBorderColor( t, tObj->BorderColor );
+ i810SetTexBorderColor( t, tObj->_BorderChan );
}
}
}
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810texmem.c b/xc/lib/GL/mesa/src/drv/i810/i810texmem.c
index 05a4fe922..5f7b7fa1f 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810texmem.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810texmem.c
@@ -22,9 +22,6 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
-
#include "glheader.h"
#include "macros.h"
#include "mtypes.h"
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810texstate.c b/xc/lib/GL/mesa/src/drv/i810/i810texstate.c
index 0f0c58421..3ed355f4a 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810texstate.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810texstate.c
@@ -22,9 +22,6 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
-
#include "glheader.h"
#include "macros.h"
#include "mtypes.h"
@@ -691,7 +688,7 @@ static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit )
i810ContextPtr imesa = I810_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if (texUnit->_ReallyEnabled == TEXTURE0_2D)
+ if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
{
struct gl_texture_object *tObj = texUnit->_Current;
i810TextureObjectPtr t = (i810TextureObjectPtr)tObj->DriverData;
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tris.c b/xc/lib/GL/mesa/src/drv/i810/i810tris.c
index 5dc352e69..5c76e645c 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810tris.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810tris.c
@@ -31,9 +31,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
-#include <math.h>
-
#include "glheader.h"
#include "mtypes.h"
#include "macros.h"
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810vb.c b/xc/lib/GL/mesa/src/drv/i810/i810vb.c
index 0d2129613..43f040936 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810vb.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810vb.c
@@ -26,7 +26,7 @@
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "colormac.h"
#include "mmath.h"
@@ -380,24 +380,24 @@ void i810BuildVertices( GLcontext *ctx,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= I810_RGBA_BIT;
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
ind |= I810_SPEC_BIT;
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
ind |= I810_TEX0_BIT;
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
ind |= I810_TEX1_BIT;
- if (newinputs & VERT_FOG_COORD)
+ if (newinputs & VERT_BIT_FOG)
ind |= I810_FOG_BIT;
if (imesa->SetupIndex & I810_PTEX_BIT)
@@ -423,9 +423,11 @@ void i810ChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled)
ind |= I810_FOG_BIT;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
+ if (ctx->Texture._EnabledUnits & 0x2)
+ /* unit 1 enabled */
ind |= I810_TEX1_BIT|I810_TEX0_BIT;
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
+ else if (ctx->Texture._EnabledUnits & 0x1)
+ /* unit 0 enabled */
ind |= I810_TEX0_BIT;
imesa->SetupIndex = ind;
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_context.c b/xc/lib/GL/mesa/src/drv/i830/i830_context.c
index 6b1b3ef6d..2b87c6f3b 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_context.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_context.c
@@ -41,7 +41,7 @@
#include "matrix.h"
#include "simple_list.h"
#include "extensions.h"
-#include "mem.h"
+#include "imports.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -60,9 +60,6 @@
#include "i830_vb.h"
#include "i830_ioctl.h"
-#include <X11/Xlibint.h>
-#include <stdio.h>
-
#ifndef I830_DEBUG
int I830_DEBUG = (0);
@@ -74,7 +71,7 @@ int I830_DEBUG = (0);
#define PCI_CHIP_845_G 0x2562
#define PCI_CHIP_I830_M 0x3577
-#define DRIVER_DATE "20020803"
+#define DRIVER_DATE "20021125"
static const GLubyte *i830DDGetString( GLcontext *ctx, GLenum name )
{
@@ -201,9 +198,9 @@ static void add_debug_flags( const char *debug )
}
#endif
-GLboolean i830CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
+GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
+ __DRIcontextPrivate *driContextPriv,
+ void *sharedContextPrivate)
{
GLcontext *ctx , *shareCtx;
i830ContextPtr imesa;
@@ -221,8 +218,7 @@ GLboolean i830CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
shareCtx = ((i830ContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
-
- imesa->glCtx = _mesa_create_context(mesaVis, shareCtx, imesa, GL_TRUE);
+ imesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void*) imesa, GL_TRUE);
if (!imesa->glCtx) {
FREE(imesa);
return GL_FALSE;
@@ -278,7 +274,6 @@ GLboolean i830CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
_swrast_allow_vertex_fog( ctx, GL_TRUE );
/* Dri stuff */
- imesa->display = dpy;
imesa->hHWContext = driContextPriv->hHWContext;
imesa->driFd = sPriv->fd;
imesa->driHwLock = &sPriv->pSAREA->lock;
@@ -404,15 +399,16 @@ void i830XMesaSetBackClipRects( i830ContextPtr imesa )
static void i830XMesaWindowMoved( i830ContextPtr imesa )
{
- switch (imesa->glCtx->Color.DriverDrawBuffer) {
- case GL_FRONT_LEFT:
+ switch (imesa->glCtx->Color._DrawDestMask) {
+ case FRONT_LEFT_BIT:
i830XMesaSetFrontClipRects( imesa );
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
i830XMesaSetBackClipRects( imesa );
break;
default:
- break;
+ /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
+ i830XMesaSetFrontClipRects( imesa );
}
}
@@ -474,7 +470,7 @@ void i830GetLock( i830ContextPtr imesa, GLuint flags )
* NOTE: This releases and regains the hw lock, so all state
* checking must be done *after* this call:
*/
- DRI_VALIDATE_DRAWABLE_INFO(imesa->display, sPriv, dPriv);
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv);
/* If we lost context, need to dump all registers to hardware.
* Note that we don't care about 2d contexts, even if they perform
@@ -529,17 +525,15 @@ void i830GetLock( i830ContextPtr imesa, GLuint flags )
sarea->last_quiescent = -1; /* just kill it for now */
}
-void i830SwapBuffers(Display *dpy, void *drawablePrivate)
+void i830SwapBuffers( __DRIdrawablePrivate *dPriv )
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
-
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
i830ContextPtr imesa;
GLcontext *ctx;
imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = imesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
- _mesa_swapbuffers( ctx ); /* flush pending rendering comands */
+ _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
if ( imesa->doPageFlip ) {
i830PageFlip( dPriv );
} else {
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_context.h b/xc/lib/GL/mesa/src/drv/i830/i830_context.h
index 485ac52ba..52c0e54cf 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_context.h
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_context.h
@@ -100,10 +100,10 @@ struct i830_context_t
GLboolean mask_blue;
GLboolean mask_alpha;
- GLboolean clear_red;
- GLboolean clear_green;
- GLboolean clear_blue;
- GLboolean clear_alpha;
+ GLubyte clear_red;
+ GLubyte clear_green;
+ GLubyte clear_blue;
+ GLubyte clear_alpha;
GLfloat depth_scale;
int depth_clear_mask;
@@ -209,7 +209,6 @@ struct i830_context_t
drmContext hHWContext;
drmLock *driHwLock;
int driFd;
- Display *display;
__DRIdrawablePrivate *driDrawable;
__DRIscreenPrivate *driScreen;
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_debug.c b/xc/lib/GL/mesa/src/drv/i830/i830_debug.c
index fef802f8d..b452ee414 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_debug.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_debug.c
@@ -31,8 +31,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Author:
* Jeff Hartmann <jhartmann@2d3d.com>
*/
-#include <stdio.h>
-#include <unistd.h>
#include "glheader.h"
#include "context.h"
@@ -221,7 +219,6 @@ void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex )
"internal state\n");
fprintf(stderr, "Buffer size : %d\n", size);
fprintf(stderr, "Vertex size : %d\n", vfmt_size);
- sleep(10);
}
switch(sarea->vertex_prim) {
@@ -285,7 +282,6 @@ void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex )
fprintf(stderr, "temp_size : %d\n", temp_size);
fprintf(stderr, "remaining vertices : %d",
remaining / vfmt_size);
- sleep(10);
}
}
if (1) {
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c b/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c
index 050545769..b85622952 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c
@@ -38,8 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
-#include <unistd.h>
+#include <unistd.h> /* for usleep() */
#include "glheader.h"
#include "mtypes.h"
@@ -240,8 +239,8 @@ static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
imesa->clear_blue, imesa->clear_alpha);
i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
- imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
+ imesa->clear_red, imesa->clear_green,
+ imesa->clear_blue, imesa->clear_alpha);
i830FlushPrimsLocked( imesa );
}
@@ -309,7 +308,7 @@ static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
}
if(mask & DD_STENCIL_BIT) {
- GLuint s_mask = ctx->Stencil.WriteMask;
+ GLuint s_mask = ctx->Stencil.WriteMask[0];
sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
I830_UPLOAD_TEXBLEND0);
@@ -451,7 +450,7 @@ static void i830Clear(GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if((mask & DD_STENCIL_BIT) && imesa->hw_stencil) {
- if (ctx->Stencil.WriteMask != 0xff) {
+ if (ctx->Stencil.WriteMask[0] != 0xff) {
tri_mask |= DD_STENCIL_BIT;
} else {
clear.flags |= I830_DEPTH;
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_render.c b/xc/lib/GL/mesa/src/drv/i830/i830_render.c
index 65dd263ec..bfd4fb6b8 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_render.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_render.c
@@ -36,7 +36,7 @@
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "mtypes.h"
#include "mmath.h"
@@ -109,7 +109,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start,
count, flags );
- I830_CONTEXT(ctx)->SetupNewInputs = VERT_CLIP;
+ I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
}
@@ -151,7 +151,7 @@ static GLboolean i830_run_render( GLcontext *ctx,
return GL_TRUE;
}
- imesa->SetupNewInputs = VERT_CLIP;
+ imesa->SetupNewInputs = VERT_BIT_CLIP;
tnl->Driver.Render.Start( ctx );
@@ -172,19 +172,19 @@ static GLboolean i830_run_render( GLcontext *ctx,
static void i830_check_render( GLcontext *ctx,
struct gl_pipeline_stage *stage )
{
- GLuint inputs = VERT_CLIP|VERT_RGBA;
+ GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
if (ctx->Fog.Enabled)
- inputs |= VERT_FOG_COORD;
+ inputs |= VERT_BIT_FOG;
}
stage->inputs = inputs;
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_screen.c b/xc/lib/GL/mesa/src/drv/i830/i830_screen.c
index 71ae60640..5929a2288 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_screen.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_screen.c
@@ -34,13 +34,6 @@
*/
-#include <X11/Xlibint.h>
-#include <stdio.h>
-
-
-#include <X11/Xlibint.h>
-#include <stdio.h>
-
#include "glheader.h"
#include "context.h"
#include "matrix.h"
@@ -132,17 +125,14 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
i830ScreenPrivate *i830Screen;
I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv;
- /* Check the DRI version */
- {
- int major, minor, patch;
- if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) {
- if (major != 4 || minor < 0) {
- __driUtilMessage("i830 DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch);
- return GL_FALSE;
- }
- }
+ /* Check the DRI externsion version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "i830 DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return GL_FALSE;
}
-
+
/* Check that the DDX driver version is compatible */
if (sPriv->ddxMajor != 1 || sPriv->ddxMinor < 0) {
__driUtilMessage("i830 DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch);
@@ -268,8 +258,7 @@ static void i830DestroyScreen(__DRIscreenPrivate *sPriv)
sPriv->private = NULL;
}
-static GLboolean i830CreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+static GLboolean i830CreateBuffer(__DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_screen.h b/xc/lib/GL/mesa/src/drv/i830/i830_screen.h
index ca991c78a..270194c87 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_screen.h
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_screen.h
@@ -94,7 +94,7 @@ typedef struct
extern GLboolean
-i830CreateContext( Display *dpy, const __GLcontextModes *mesaVis,
+i830CreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate );
@@ -110,6 +110,6 @@ i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driReadPriv);
extern void
-i830SwapBuffers(Display *dpy, void *drawablePrivate);
+i830SwapBuffers(__DRIdrawablePrivate *driDrawPriv);
#endif
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_span.c b/xc/lib/GL/mesa/src/drv/i830/i830_span.c
index 232698911..2fe74ffc4 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_span.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_span.c
@@ -262,13 +262,20 @@ do { \
#define TAG(x) i830##x##_24_8
#include "stenciltmp.h"
-static void i830SetReadBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum mode)
+/*
+ * This function is called to specify which buffer to read and write
+ * for software rasterization (swrast) fallbacks. This doesn't necessarily
+ * correspond to glDrawBuffer() or glReadBuffer() calls.
+ */
+static void i830SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
+ GLuint bufferBit)
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
- if (mode == GL_FRONT_LEFT) {
- imesa->readMap = (char*)imesa->driScreen->pFB;
- } else if (mode == GL_BACK_LEFT) {
+ if (bufferBit == FRONT_LEFT_BIT) {
+ imesa->drawMap = (char *)imesa->driScreen->pFB;
+ imesa->readMap = (char *)imesa->driScreen->pFB;
+ } else if (bufferBit == BACK_LEFT_BIT) {
+ imesa->drawMap = imesa->i830Screen->back.map;
imesa->readMap = imesa->i830Screen->back.map;
} else {
ASSERT(0);
@@ -301,7 +308,7 @@ void i830DDInitSpanFuncs( GLcontext *ctx )
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = i830SetReadBuffer;
+ swdd->SetBuffer = i830SetBuffer;
switch (i830Screen->fbFormat) {
case DV_PF_555:
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_state.c b/xc/lib/GL/mesa/src/drv/i830/i830_state.c
index 86992d61e..15e0dd495 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_state.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_state.c
@@ -34,7 +34,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Heavily based on the I810 driver, which was written by:
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
#include "glheader.h"
#include "context.h"
@@ -244,10 +243,11 @@ static void i830StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
STENCIL_PASS_DEPTH_PASS_OP(dpop));
}
-static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLchan ref)
+static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
int test = 0;
+ GLuint refByte = (GLint) (ref * 255.0);
switch(func) {
case GL_NEVER:
@@ -274,7 +274,8 @@ static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLchan ref)
case GL_ALWAYS:
test = COMPAREFUNC_ALWAYS;
break;
- default: return;
+ default:
+ return;
}
I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
@@ -282,7 +283,7 @@ static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLchan ref)
imesa->Setup[I830_CTXREG_STATE2] |= (ENABLE_ALPHA_TEST_FUNC |
ENABLE_ALPHA_REF_VALUE |
ALPHA_TEST_FUNC(test) |
- ALPHA_REF_VALUE(ref));
+ ALPHA_REF_VALUE(refByte));
}
/* This function makes sure that the proper enables are
@@ -843,50 +844,60 @@ static void i830RenderMode( GLcontext *ctx, GLenum mode )
FALLBACK( imesa, I830_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
}
-static void i830SetDrawBuffer(GLcontext *ctx, GLenum mode )
+static void i830DrawBuffer(GLcontext *ctx, GLenum mode )
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
- if (mode == GL_FRONT_LEFT) {
+ /*
+ * _DrawDestMask is easier to cope with than <mode>.
+ */
+ switch ( ctx->Color._DrawDestMask ) {
+ case FRONT_LEFT_BIT:
I830_FIREVERTICES(imesa);
I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
-
imesa->BufferSetup[I830_DESTREG_CBUFADDR] = imesa->i830Screen->fbOffset;
-
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
i830XMesaSetFrontClipRects( imesa );
FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
- } else if (mode == GL_BACK_LEFT) {
+ break;
+ case BACK_LEFT_BIT:
I830_FIREVERTICES(imesa);
I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
-
imesa->BufferSetup[I830_DESTREG_CBUFADDR] =
imesa->i830Screen->backOffset;
-
- imesa->drawMap = imesa->i830Screen->back.map;
- imesa->readMap = imesa->i830Screen->back.map;
i830XMesaSetBackClipRects( imesa );
FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
- } else {
+ break;
+ default:
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
}
+
+ /* We want to update the s/w rast state too so that i830SetBuffer()
+ * gets called.
+ */
+ _swrast_DrawBuffer(ctx, mode);
+}
+
+static void i830ReadBuffer(GLcontext *ctx, GLenum mode )
+{
+ /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
}
-static void i830ClearColor(GLcontext *ctx, const GLchan color[4])
+static void i830ClearColor(GLcontext *ctx, const GLfloat color[4])
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
- imesa->clear_red = color[RCOMP];
- imesa->clear_green = color[GCOMP];
- imesa->clear_blue = color[BCOMP];
- imesa->clear_alpha = color[ACOMP];
+ CLAMPED_FLOAT_TO_UBYTE(imesa->clear_red, color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(imesa->clear_green, color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(imesa->clear_blue, color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(imesa->clear_alpha, color[3]);
imesa->ClearColor = i830PackColor(imesa->i830Screen->fbFormat,
- color[RCOMP],
- color[GCOMP],
- color[BCOMP],
- color[ACOMP] );
+ imesa->clear_red,
+ imesa->clear_green,
+ imesa->clear_blue,
+ imesa->clear_alpha);
}
static void i830CullFaceFrontFace(GLcontext *ctx, GLenum unused)
@@ -1566,12 +1577,14 @@ void i830DDInitState( GLcontext *ctx )
memset(imesa->BufferSetup, 0, sizeof(imesa->BufferSetup));
- if (imesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT) {
+ if (imesa->glCtx->Visual.doubleBufferMode) {
+ /* use back buffer by default */
imesa->drawMap = i830Screen->back.map;
imesa->readMap = i830Screen->back.map;
imesa->BufferSetup[I830_DESTREG_CBUFADDR] = i830Screen->backOffset;
imesa->BufferSetup[I830_DESTREG_DBUFADDR] = 0;
} else {
+ /* use front buffer by default */
imesa->drawMap = (char *)imesa->driScreen->pFB;
imesa->readMap = (char *)imesa->driScreen->pFB;
imesa->BufferSetup[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
@@ -1655,7 +1668,8 @@ void i830DDInitStateFuncs(GLcontext *ctx)
ctx->Driver.PolygonStipple = i830PolygonStipple;
ctx->Driver.RenderMode = i830RenderMode;
ctx->Driver.Scissor = i830Scissor;
- ctx->Driver.SetDrawBuffer = i830SetDrawBuffer;
+ ctx->Driver.DrawBuffer = i830DrawBuffer;
+ ctx->Driver.ReadBuffer = i830ReadBuffer;
ctx->Driver.ShadeModel = i830ShadeModel;
ctx->Driver.DepthRange = i830DepthRange;
ctx->Driver.Viewport = i830Viewport;
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_tex.c b/xc/lib/GL/mesa/src/drv/i830/i830_tex.c
index e90c8c12d..dc0baac86 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_tex.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_tex.c
@@ -35,13 +35,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keithw@tungstengraphics.com>
*/
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <GL/gl.h>
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "simple_list.h"
#include "enums.h"
#include "texstore.h"
@@ -223,7 +219,7 @@ static void i830TexParameter( GLcontext *ctx, GLenum target,
break;
case GL_TEXTURE_BORDER_COLOR:
- i830SetTexBorderColor( t, tObj->BorderColor );
+ i830SetTexBorderColor( t, tObj->_BorderChan );
break;
case GL_TEXTURE_BASE_LEVEL:
@@ -385,7 +381,7 @@ static void i830BindTexture( GLcontext *ctx, GLenum target,
i830SetTexWrapping( t, tObj->WrapS, tObj->WrapT );
i830SetTexFilter( imesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- i830SetTexBorderColor( t, tObj->BorderColor );
+ i830SetTexBorderColor( t, tObj->_BorderChan );
}
}
}
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c b/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c
index d54af4daf..c98327e87 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c
@@ -35,9 +35,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keithw@tungstengraphics.com>
*/
-#include <stdlib.h>
-#include <stdio.h>
-
#include "glheader.h"
#include "macros.h"
#include "mtypes.h"
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c b/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c
index 54f038ec7..d2cbaf3f1 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c
@@ -34,8 +34,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Heavily based on the I810 driver, which was written by:
* Keith Whitwell <keithw@tungstengraphics.com>
*/
-#include <stdlib.h>
-#include <stdio.h>
#include "glheader.h"
#include "macros.h"
@@ -1279,7 +1277,7 @@ static void i830UpdateTexUnit( GLcontext *ctx, GLuint unit )
imesa->TexEnabledMask &= ~(I830_TEX_UNIT_ENABLED(unit));
- if (texUnit->_ReallyEnabled == TEXTURE0_2D) {
+ if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT) {
struct gl_texture_object *tObj = texUnit->_Current;
i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
GLuint mcs = t->Setup[I830_TEXREG_MCS] & TEXCOORDTYPE_MASK;
@@ -1374,7 +1372,7 @@ void i830UpdateTexUnitProj( GLcontext *ctx, GLuint unit, GLboolean state )
i830ContextPtr imesa = I830_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if (texUnit->_ReallyEnabled == TEXTURE0_2D) {
+ if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT) {
struct gl_texture_object *tObj = texUnit->_Current;
i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
GLuint mcs = t->Setup[I830_TEXREG_MCS] & TEXCOORDTYPE_MASK;
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_tris.c b/xc/lib/GL/mesa/src/drv/i830/i830_tris.c
index 970fc0888..4ae95347b 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_tris.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_tris.c
@@ -33,9 +33,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Jeff Hartmann <jhartmann@2d3d.com>
*/
-#include <stdio.h>
-#include <math.h>
-
#include "glheader.h"
#include "context.h"
#include "macros.h"
diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_vb.c b/xc/lib/GL/mesa/src/drv/i830/i830_vb.c
index 532849abb..1bf20d813 100644
--- a/xc/lib/GL/mesa/src/drv/i830/i830_vb.c
+++ b/xc/lib/GL/mesa/src/drv/i830/i830_vb.c
@@ -27,7 +27,7 @@
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "colormac.h"
#include "mmath.h"
@@ -446,24 +446,24 @@ void i830BuildVertices( GLcontext *ctx,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= I830_RGBA_BIT;
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
ind |= I830_SPEC_BIT;
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
ind |= I830_TEX0_BIT;
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
ind |= I830_TEX1_BIT;
- if (newinputs & VERT_FOG_COORD)
+ if (newinputs & VERT_BIT_FOG)
ind |= I830_FOG_BIT;
#if 0
@@ -491,9 +491,11 @@ void i830ChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled)
ind |= I830_FOG_BIT;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
+ if (ctx->Texture._EnabledUnits & 0x2)
+ /* unit 1 enabled */
ind |= I830_TEX1_BIT|I830_TEX0_BIT;
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
+ else if (ctx->Texture._EnabledUnits & 0x1)
+ /* unit 0 enabled */
ind |= I830_TEX0_BIT;
imesa->SetupIndex = ind;
diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
index 264bc085e..e9d15bec5 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
@@ -28,17 +28,13 @@
#ifdef GLX_DIRECT_RENDERING
-#include <X11/Xlibint.h>
-#include <stdio.h>
-
-#include "xf86drm.h"
#include "mga_common.h"
#include "mga_xmesa.h"
#include "context.h"
#include "matrix.h"
#include "mmath.h"
#include "simple_list.h"
-#include "mem.h"
+#include "imports.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -57,7 +53,6 @@
#include "mgabuffers.h"
#include "mgapixel.h"
-#include "xf86dri.h"
#include "mga_xmesa.h"
#include "mga_dri.h"
@@ -85,15 +80,12 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
fprintf(stderr, "mgaInitDriver\n");
- /* Check the DRI version */
- {
- int major, minor, patch;
- if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) {
- if (major != 4 || minor < 0) {
- __driUtilMessage("MGA DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch);
- return GL_FALSE;
- }
- }
+ /* Check the DRI externsion version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "MGA DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return GL_FALSE;
}
/* Check that the DDX driver version is compatible */
@@ -276,7 +268,7 @@ static const struct gl_pipeline_stage *mga_pipeline[] = {
static GLboolean
-mgaCreateContext( Display *dpy, const __GLcontextModes *mesaVis,
+mgaCreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate )
{
@@ -302,7 +294,7 @@ mgaCreateContext( Display *dpy, const __GLcontextModes *mesaVis,
shareCtx = ((mgaContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
- mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, mmesa, GL_TRUE);
+ mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void *) mmesa, GL_TRUE);
if (!mmesa->glCtx) {
FREE(mmesa);
return GL_FALSE;
@@ -310,7 +302,6 @@ mgaCreateContext( Display *dpy, const __GLcontextModes *mesaVis,
driContextPriv->driverPrivate = mmesa;
/* Init mga state */
- mmesa->display = dpy;
mmesa->hHWContext = driContextPriv->hHWContext;
mmesa->driFd = sPriv->fd;
mmesa->driHwLock = &sPriv->pSAREA->lock;
@@ -462,8 +453,7 @@ mgaDestroyContext(__DRIcontextPrivate *driContextPriv)
static GLboolean
-mgaCreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
@@ -565,7 +555,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
if (*(dPriv->pStamp) != mmesa->lastStamp) {
mmesa->lastStamp = *(dPriv->pStamp);
- mmesa->SetupNewInputs |= VERT_CLIP;
+ mmesa->SetupNewInputs |= VERT_BIT_CLIP;
mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) );
}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c
index 41b42cf4b..5da3be6dd 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c
@@ -26,12 +26,13 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgabuffers.c,v 1.11 2002/09/11 19:49:07 tsi Exp $ */
-#include <stdio.h>
#include "mgacontext.h"
#include "mgabuffers.h"
#include "mgastate.h"
#include "mgaioctl.h"
#include "mgatris.h"
+#include "swrast/swrast.h"
+#include "imports.h"
static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa )
{
@@ -212,7 +213,7 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
/* fprintf(stderr, "%s\n", __FUNCTION__); */
- DRI_VALIDATE_DRAWABLE_INFO(mmesa->display, mmesa->driScreen, driDrawable);
+ DRI_VALIDATE_DRAWABLE_INFO(mmesa->driScreen, driDrawable);
mmesa->dirty_cliprects = 0;
if (mmesa->draw_buffer == MGA_FRONT)
@@ -235,36 +236,57 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
-void mgaDDSetDrawBuffer(GLcontext *ctx, GLenum mode )
+void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
FLUSH_BATCH( MGA_CONTEXT(ctx) );
-
- if (mode == GL_FRONT_LEFT)
- {
- mmesa->drawOffset = mmesa->mgaScreen->frontOffset;
- mmesa->readOffset = mmesa->mgaScreen->frontOffset;
+ /*
+ * _DrawDestMask is easier to cope with than <mode>.
+ */
+ switch ( ctx->Color._DrawDestMask ) {
+ case FRONT_LEFT_BIT:
mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
mmesa->dirty |= MGA_UPLOAD_CONTEXT;
mmesa->draw_buffer = MGA_FRONT;
mgaXMesaSetFrontClipRects( mmesa );
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
- }
- else if (mode == GL_BACK_LEFT)
- {
- mmesa->drawOffset = mmesa->mgaScreen->backOffset;
- mmesa->readOffset = mmesa->mgaScreen->backOffset;
+ break;
+ case BACK_LEFT_BIT:
mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
mmesa->draw_buffer = MGA_BACK;
mmesa->dirty |= MGA_UPLOAD_CONTEXT;
mgaXMesaSetBackClipRects( mmesa );
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
- }
- else
- {
+ break;
+ default:
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
}
+
+ /* We want to update the s/w rast state too so that r200SetBuffer()
+ * gets called.
+ */
+ _swrast_DrawBuffer(ctx, mode);
}
+
+void mgaDDReadBuffer(GLcontext *ctx, GLenum mode )
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+
+ FLUSH_BATCH( MGA_CONTEXT(ctx) );
+
+ switch (ctx->Pixel._ReadSrcMask) {
+ case FRONT_LEFT_BIT:
+ mmesa->read_buffer = MGA_FRONT;
+ break;
+ case BACK_LEFT_BIT:
+ mmesa->read_buffer = MGA_FRONT;
+ break;
+ default:
+ _mesa_problem(ctx, "bad mode in mgaDDReadBuffer");
+ }
+}
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h
index a98b19975..f5f23998a 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h
+++ b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h
@@ -29,7 +29,8 @@
#ifndef MGA_BUFFERS_H
#define MGA_BUFFERS_H
-void mgaDDSetDrawBuffer(GLcontext *ctx, GLenum mode );
+void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode );
+void mgaDDReadBuffer(GLcontext *ctx, GLenum mode );
void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers );
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h
index b8d64a0a0..6f67ed567 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h
+++ b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h
@@ -29,12 +29,10 @@
#ifndef MGALIB_INC
#define MGALIB_INC
-#include <X11/Xlibint.h>
#include "dri_util.h"
#include "mtypes.h"
#include "xf86drm.h"
#include "mm.h"
-#include "mem.h"
#include "mga_sarea.h"
@@ -237,7 +235,6 @@ struct mga_context_t {
drmContext hHWContext;
drmLock *driHwLock;
int driFd;
- Display *display;
__DRIdrawablePrivate *driDrawable;
__DRIscreenPrivate *driScreen;
struct mga_screen_private_s *mgaScreen;
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c
index 9d0a701cd..c2fb0be3b 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c
@@ -29,10 +29,6 @@
#include "mtypes.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
#include "mm.h"
#include "mgacontext.h"
#include "mgadd.h"
@@ -47,7 +43,7 @@
#include "X86/common_x86_asm.h"
#endif
-#define MGA_DATE "20020221"
+#define MGA_DATE "20021125"
/***************************************
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c
index 9bd3bd7a0..07b162ab8 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c
@@ -27,8 +27,6 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.14 2002/09/18 17:11:40 tsi Exp $ */
-#include <stdio.h>
-
#include "mtypes.h"
#include "macros.h"
#include "dd.h"
@@ -43,11 +41,9 @@
#include "mgaioctl.h"
#include "mgatris.h"
#include "mgabuffers.h"
-
-
-#include "xf86drm.h"
#include "mga_common.h"
+
static void mga_iload_dma_ioctl(mgaContextPtr mmesa,
unsigned long dest,
int length)
@@ -314,9 +310,8 @@ void mgaWaitForVBlank( mgaContextPtr mmesa )
/*
* Copy the back buffer to the front buffer.
*/
-void mgaSwapBuffers(Display *dpy, void *drawablePrivate)
+void mgaSwapBuffers( __DRIdrawablePrivate *dPriv )
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
mgaContextPtr mmesa;
XF86DRIClipRectPtr pbox;
GLint nbox;
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h
index 93183f50f..463999c23 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h
@@ -33,7 +33,7 @@
#include "mgacontext.h"
#include "mga_xmesa.h"
-void mgaSwapBuffers( Display *dpy, void *drawablePrivate );
+void mgaSwapBuffers( __DRIdrawablePrivate *dPriv );
void mgaWaitForVBlank( mgaContextPtr mmesa );
GLuint *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords );
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c
index 2de903d2d..d3cc4de8e 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c
@@ -37,10 +37,10 @@
#include "mgapixel.h"
#include "mgabuffers.h"
-#include "xf86drm.h"
#include "mga_common.h"
#include "swrast/swrast.h"
+#include "imports.h"
#define IS_AGP_MEM( mmesa, p ) \
((unsigned long)mmesa->mgaScreen->buffers.map <= ((unsigned long)p) && \
@@ -134,7 +134,7 @@ check_color_per_fragment_ops( const GLcontext *ctx )
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._ReallyEnabled ||
+ ctx->Texture._EnabledUnits ||
ctx->Depth.OcclusionTest
) &&
ctx->Current.RasterPosValid &&
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgarender.c b/xc/lib/GL/mesa/src/drv/mga/mgarender.c
index cee003071..e4d2a51fa 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgarender.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgarender.c
@@ -42,7 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "mtypes.h"
#include "mmath.h"
@@ -102,7 +102,7 @@ static void VERT_FALLBACK( GLcontext *ctx, GLuint start, GLuint count,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_CLIP;
+ MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_CLIP;
}
#define LOCAL_VARS mgaContextPtr mmesa = MGA_CONTEXT(ctx)
@@ -165,20 +165,20 @@ static GLboolean mga_run_render( GLcontext *ctx,
static void mga_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
{
- GLuint inputs = VERT_CLIP|VERT_RGBA;
+ GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
if (ctx->Fog.Enabled)
- inputs |= VERT_FOG_COORD;
+ inputs |= VERT_BIT_FOG;
}
stage->inputs = inputs;
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c
index ad7654a1b..06c3466b2 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c
@@ -233,20 +233,28 @@ do { \
-static void mgaDDSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLenum mode )
+/*
+ * This function is called to specify which buffer to read and write
+ * for software rasterization (swrast) fallbacks. This doesn't necessarily
+ * correspond to glDrawBuffer() or glReadBuffer() calls.
+ */
+static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
+ GLuint bufferBit)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- if (mode == GL_FRONT_LEFT)
+ if (bufferBit == FRONT_LEFT_BIT)
{
+ mmesa->drawOffset = mmesa->mgaScreen->frontOffset;
mmesa->readOffset = mmesa->mgaScreen->frontOffset;
- mmesa->read_buffer = MGA_FRONT;
}
- else
+ else if (bufferBit == BACK_LEFT_BIT)
{
+ mmesa->drawOffset = mmesa->mgaScreen->backOffset;
mmesa->readOffset = mmesa->mgaScreen->backOffset;
- mmesa->read_buffer = MGA_BACK;
+ }
+ else {
+ assert(0);
}
}
@@ -255,7 +263,7 @@ void mgaDDInitSpanFuncs( GLcontext *ctx )
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = mgaDDSetReadBuffer;
+ swdd->SetBuffer = mgaDDSetBuffer;
switch (mmesa->mgaScreen->cpp) {
case 2:
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.c b/xc/lib/GL/mesa/src/drv/mga/mgastate.c
index 82f1e3391..5bb2e25f6 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgastate.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.c
@@ -26,9 +26,9 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.12 2002/02/22 21:44:55 dawes Exp $ */
-#include <stdio.h>
#include "mtypes.h"
+#include "colormac.h"
#include "dd.h"
#include "mm.h"
@@ -48,7 +48,6 @@
#include "swrast_setup/swrast_setup.h"
-
/* Some outstanding problems with accelerating logic ops...
*/
#if defined(ACCEL_ROP)
@@ -72,11 +71,11 @@ static void mgaUpdateStencil(const GLcontext *ctx)
if (ctx->Stencil.Enabled)
{
- stencil = ctx->Stencil.Ref |
- ( ctx->Stencil.ValueMask << 8 ) |
- ( ctx->Stencil.WriteMask << 16 );
+ stencil = ctx->Stencil.Ref[0] |
+ ( ctx->Stencil.ValueMask[0] << 8 ) |
+ ( ctx->Stencil.WriteMask[0] << 16 );
- switch (ctx->Stencil.Function)
+ switch (ctx->Stencil.Function[0])
{
case GL_NEVER:
MGA_SET_FIELD(stencilctl, SC_smode_MASK, SC_smode_snever);
@@ -105,7 +104,7 @@ static void mgaUpdateStencil(const GLcontext *ctx)
break;
}
- switch (ctx->Stencil.FailFunc)
+ switch (ctx->Stencil.FailFunc[0])
{
case GL_KEEP:
MGA_SET_FIELD(stencilctl, SC_sfailop_MASK, SC_sfailop_keep);
@@ -129,7 +128,7 @@ static void mgaUpdateStencil(const GLcontext *ctx)
break;
}
- switch (ctx->Stencil.ZFailFunc)
+ switch (ctx->Stencil.ZFailFunc[0])
{
case GL_KEEP:
MGA_SET_FIELD(stencilctl, SC_szfailop_MASK, SC_szfailop_keep);
@@ -153,7 +152,7 @@ static void mgaUpdateStencil(const GLcontext *ctx)
break;
}
- switch (ctx->Stencil.ZPassFunc)
+ switch (ctx->Stencil.ZPassFunc[0])
{
case GL_KEEP:
MGA_SET_FIELD(stencilctl, SC_szpassop_MASK, SC_szpassop_keep);
@@ -269,7 +268,7 @@ static void mgaUpdateZMode(const GLcontext *ctx)
}
-static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLchan ref)
+static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
{
FLUSH_BATCH( MGA_CONTEXT(ctx) );
MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA;
@@ -380,7 +379,7 @@ static void mgaUpdateAlphaMode(GLcontext *ctx)
int a = 0;
/* determine source of alpha for blending and testing */
- if ( !ctx->Texture._ReallyEnabled ) {
+ if (ctx->Texture._EnabledUnits == 0) {
a |= AC_alphasel_diffused;
}
else {
@@ -415,7 +414,7 @@ static void mgaUpdateAlphaMode(GLcontext *ctx)
/* alpha test control.
*/
if (ctx->Color.AlphaEnabled) {
- GLubyte ref = ctx->Color.AlphaRef;
+ GLubyte ref = (GLint) (ctx->Color.AlphaRef * 255.0);
switch (ctx->Color.AlphaFunc) {
case GL_NEVER:
a |= AC_atmode_alt;
@@ -575,13 +574,17 @@ static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y,
static void mgaDDClearColor(GLcontext *ctx,
- const GLchan color[4] )
+ const GLfloat color[4] )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
mmesa->ClearColor = mgaPackColor( mmesa->mgaScreen->cpp,
- color[0], color[1],
- color[2], color[3]);
+ c[0], c[1], c[2], c[3]);
}
@@ -608,7 +611,8 @@ void mgaUpdateCull( GLcontext *ctx )
mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
if (ctx->Polygon.FrontFace != GL_CCW)
mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
- if (ctx->Texture._ReallyEnabled == (TEXTURE0_2D|TEXTURE1_2D))
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT)
mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE); /* warp bug? */
}
@@ -799,7 +803,7 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa )
/* This is a bit of a hack but seems to be the best place to ensure
* that separate specular is disabled when not needed.
*/
- if (mmesa->glCtx->Texture._ReallyEnabled == 0 ||
+ if (mmesa->glCtx->Texture._EnabledUnits == 0 ||
!mmesa->glCtx->Light.Enabled ||
mmesa->glCtx->Light.Model.ColorControl == GL_SINGLE_COLOR) {
sarea->TexState[0].texctl2 &= ~TMC_specen_enable;
@@ -1001,13 +1005,15 @@ void mgaInitState( mgaContextPtr mmesa )
mgaScreenPrivate *mgaScreen = mmesa->mgaScreen;
GLcontext *ctx = mmesa->glCtx;
- if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT) {
+ if (ctx->Visual.doubleBufferMode) {
+ /* use back buffer by default */
mmesa->draw_buffer = MGA_BACK;
mmesa->read_buffer = MGA_BACK;
mmesa->drawOffset = mmesa->mgaScreen->backOffset;
mmesa->readOffset = mmesa->mgaScreen->backOffset;
mmesa->setup.dstorg = mgaScreen->backOffset;
} else {
+ /* use front buffer by default */
mmesa->draw_buffer = MGA_FRONT;
mmesa->read_buffer = MGA_FRONT;
mmesa->drawOffset = mmesa->mgaScreen->frontOffset;
@@ -1102,7 +1108,8 @@ void mgaDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.FrontFace = mgaDDCullFaceFrontFace;
ctx->Driver.ColorMask = mgaDDColorMask;
- ctx->Driver.SetDrawBuffer = mgaDDSetDrawBuffer;
+ ctx->Driver.DrawBuffer = mgaDDDrawBuffer;
+ ctx->Driver.ReadBuffer = mgaDDReadBuffer;
ctx->Driver.ClearColor = mgaDDClearColor;
ctx->Driver.ClearDepth = mgaDDClearDepth;
ctx->Driver.LogicOpcode = mgaDDLogicOp;
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c
index 8cbd41622..40f5c13a9 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c
@@ -26,10 +26,7 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.13 2002/02/22 21:44:55 dawes Exp $ */
-#include <stdlib.h>
-#include <stdio.h>
-#include <GL/gl.h>
-
+#include "glheader.h"
#include "mm.h"
#include "mgacontext.h"
#include "mgatex.h"
@@ -39,7 +36,7 @@
#include "enums.h"
#include "simple_list.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "texformat.h"
#include "texstore.h"
@@ -423,7 +420,7 @@ static void mgaCreateTexObj(mgaContextPtr mmesa,
/* set all the register values for filtering, border, etc */
mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- mgaSetTexBorderColor( t, tObj->BorderColor );
+ mgaSetTexBorderColor( t, tObj->_BorderChan );
}
@@ -675,7 +672,7 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int hw_unit )
enabled = ctx->Texture.Unit[gl_unit]._ReallyEnabled;
tObj = ctx->Texture.Unit[gl_unit]._Current;
- if (enabled != TEXTURE0_2D) {
+ if (enabled != TEXTURE_2D_BIT) {
if (enabled)
FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE );
return;
@@ -708,7 +705,8 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int hw_unit )
/* mgaUpdateTexLRU( mmesa, t ); */
t->setup.texctl2 &= ~TMC_dualtex_enable;
- if (ctx->Texture._ReallyEnabled == (TEXTURE0_2D|TEXTURE1_2D))
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT)
t->setup.texctl2 |= TMC_dualtex_enable;
t->setup.texctl2 &= ~TMC_specen_enable;
@@ -738,7 +736,8 @@ void mgaUpdateTextureState( GLcontext *ctx )
mmesa->CurrentTexObj[1] = 0;
}
- if (ctx->Texture._ReallyEnabled == TEXTURE1_2D) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
mmesa->tmu_source[0] = 1;
} else {
mmesa->tmu_source[0] = 0;
@@ -750,7 +749,8 @@ void mgaUpdateTextureState( GLcontext *ctx )
mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0;
- if (ctx->Texture._ReallyEnabled == (TEXTURE0_2D|TEXTURE1_2D)) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
mgaUpdateTextureObject( ctx, 1 );
mgaUpdateTextureEnvG400( ctx, 1 );
mmesa->dirty |= MGA_UPLOAD_TEX1;
@@ -763,7 +763,7 @@ void mgaUpdateTextureState( GLcontext *ctx )
mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_TEX0;
mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= (ctx->Texture._ReallyEnabled
+ mmesa->setup.dwgctl |= (ctx->Texture._EnabledUnits
? DC_opcod_texture_trap
: DC_opcod_trap);
}
@@ -895,7 +895,7 @@ mgaDDTexParameter( GLcontext *ctx, GLenum target,
case GL_TEXTURE_BORDER_COLOR:
FLUSH_BATCH(mmesa);
- mgaSetTexBorderColor(t,tObj->BorderColor);
+ mgaSetTexBorderColor(t, tObj->_BorderChan);
break;
default:
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c b/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c
index 16eb7e3e4..35df6a830 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c
@@ -26,9 +26,6 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdlib.h>
-#include <stdio.h>
-
#include <GL/gl.h>
#include "mm.h"
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c
index ab88e0644..b7929a269 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c
@@ -26,9 +26,7 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v 1.6 2002/02/26 23:37:35 tsi Exp $ */
-#include <stdlib.h>
-#include <stdio.h>
-#include <GL/gl.h>
+#include "glheader.h"
#include "mm.h"
#include "mgacontext.h"
@@ -36,7 +34,7 @@
#include "mgaregs.h"
#include "mgaioctl.h"
-#include "mem.h"
+#include "imports.h"
#include "simple_list.h"
static void
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.c b/xc/lib/GL/mesa/src/drv/mga/mgatris.c
index 0bf5ebea1..2db3fed0f 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgatris.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.c
@@ -26,9 +26,6 @@
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.c,v 1.9 2002/02/22 21:44:56 dawes Exp $ */
-#include <stdio.h>
-#include <math.h>
-
#include "mtypes.h"
#include "macros.h"
#include "colormac.h"
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c
index 8a0138e70..57e24fa0e 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgavb.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.c
@@ -34,7 +34,7 @@
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "colormac.h"
#include "mmath.h"
@@ -43,9 +43,6 @@
#include "swrast_setup/swrast_setup.h"
#include "swrast/swrast.h"
-#include <stdio.h>
-#include <stdlib.h>
-
#define MGA_TEX1_BIT 0x1
#define MGA_TEX0_BIT 0x2
@@ -363,24 +360,24 @@ void mgaBuildVertices( GLcontext *ctx,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[mmesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= MGA_RGBA_BIT;
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
ind |= MGA_SPEC_BIT;
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
ind |= MGA_TEX0_BIT;
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
ind |= MGA_TEX0_BIT|MGA_TEX1_BIT;
- if (newinputs & VERT_FOG_COORD)
+ if (newinputs & VERT_BIT_FOG)
ind |= MGA_FOG_BIT;
if (mmesa->SetupIndex & MGA_PTEX_BIT)
@@ -407,15 +404,18 @@ void mgaChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled)
ind |= MGA_FOG_BIT;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY) {
- if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) {
+ if (ctx->Texture._EnabledUnits & 0x2) {
+ /* unit 1 enabled */
+ if (ctx->Texture._EnabledUnits & 0x1) {
+ /* unit 0 enabled */
ind |= MGA_TEX1_BIT|MGA_TEX0_BIT;
}
else {
ind |= MGA_TEX0_BIT;
}
}
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) {
+ else if (ctx->Texture._EnabledUnits & 0x1) {
+ /* unit 0 enabled */
ind |= MGA_TEX0_BIT;
}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.c b/xc/lib/GL/mesa/src/drv/r128/r128_context.c
index bf57fb79e..e06e4c168 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.c
@@ -33,7 +33,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-#include <stdlib.h>
+#include "glheader.h"
+#include "context.h"
+#include "simple_list.h"
+#include "imports.h"
+#include "matrix.h"
+
+#include "swrast/swrast.h"
+#include "swrast_setup/swrast_setup.h"
+#include "array_cache/acache.h"
+
+#include "tnl/tnl.h"
+#include "tnl/t_pipeline.h"
#include "r128_context.h"
#include "r128_ioctl.h"
@@ -44,19 +55,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_tris.h"
#include "r128_vb.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "context.h"
-#include "simple_list.h"
-#include "mem.h"
-#include "matrix.h"
-
#ifndef R128_DEBUG
int R128_DEBUG = (0
/* | DEBUG_ALWAYS_SYNC */
@@ -71,7 +69,7 @@ int R128_DEBUG = (0
/* Create the device specific context.
*/
-GLboolean r128CreateContext( Display *dpy, const __GLcontextModes *glVisual,
+GLboolean r128CreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate )
{
@@ -91,7 +89,7 @@ GLboolean r128CreateContext( Display *dpy, const __GLcontextModes *glVisual,
shareCtx = ((r128ContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, rmesa, GL_TRUE);
+ rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
if (!rmesa->glCtx) {
FREE(rmesa);
return GL_FALSE;
@@ -99,7 +97,6 @@ GLboolean r128CreateContext( Display *dpy, const __GLcontextModes *glVisual,
driContextPriv->driverPrivate = rmesa;
ctx = rmesa->glCtx;
- rmesa->display = dpy;
rmesa->driContext = driContextPriv;
rmesa->driScreen = sPriv;
rmesa->driDrawable = NULL;
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.h b/xc/lib/GL/mesa/src/drv/r128/r128_context.h
index 5a952f685..0b4dc0e92 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.h
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.h
@@ -38,8 +38,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef GLX_DIRECT_RENDERING
-#include <X11/Xlibint.h>
-
#include "dri_util.h"
#include "xf86drm.h"
@@ -47,7 +45,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mtypes.h"
-#include "r128_sarea.h"
#include "r128_reg.h"
struct r128_context;
@@ -184,7 +181,6 @@ struct r128_context {
/* Drawable, cliprect and scissor information
*/
- GLenum DrawBuffer; /* Optimize draw buffer update */
GLint drawOffset, drawPitch;
GLint readOffset, readPitch;
@@ -196,8 +192,6 @@ struct r128_context {
/* Mirrors of some DRI state
*/
- Display *display; /* X server display */
-
__DRIcontextPrivate *driContext; /* DRI context */
__DRIscreenPrivate *driScreen; /* DRI screen */
__DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
@@ -236,8 +230,7 @@ struct r128_context {
(rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_MOBILITY)
-extern GLboolean r128CreateContext( Display *dpy,
- const __GLcontextModes *glVisual,
+extern GLboolean r128CreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate );
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
index cd2979498..8bfdc165d 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
@@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "X86/common_x86_asm.h"
#endif
-#define R128_DATE "20020221"
+#define R128_DATE "20021125"
/* Return the width and height of the current color buffer.
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
index 2ecc474af..bdacef550 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
@@ -36,7 +36,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_state.h"
#include "r128_ioctl.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "swrast/swrast.h"
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_lock.c b/xc/lib/GL/mesa/src/drv/r128/r128_lock.c
index 4b6bcaffa..e94d30480 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_lock.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_lock.c
@@ -67,7 +67,7 @@ void r128GetLock( r128ContextPtr rmesa, GLuint flags )
* Since the hardware state depends on having the latest drawable
* clip rects, all state checking must be done _after_ this call.
*/
- DRI_VALIDATE_DRAWABLE_INFO( rmesa->display, sPriv, dPriv );
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
if ( rmesa->lastStamp != dPriv->lastStamp ) {
rmesa->lastStamp = dPriv->lastStamp;
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c
index aebcd0d93..1b1898c0b 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c
@@ -41,7 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_vb.h"
#include "context.h"
-#include "mem.h"
+#include "imports.h"
#if 1
/* Including xf86PciInfo.h introduces a bunch of errors...
@@ -256,8 +256,7 @@ r128CloseFullScreen( __DRIcontextPrivate *driContextPriv )
* data.
*/
static GLboolean
-r128CreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
@@ -286,19 +285,15 @@ r128DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
/* Copy the back color buffer to the front color buffer */
static void
-r128SwapBuffers(Display *dpy, void *drawablePrivate)
+r128SwapBuffers(__DRIdrawablePrivate *dPriv)
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- (void) dpy;
-
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
r128ContextPtr rmesa;
GLcontext *ctx;
rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = rmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
- _mesa_swapbuffers( ctx ); /* flush pending rendering comands */
-
+ _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
if ( rmesa->doPageFlip ) {
r128PageFlip( dPriv );
}
@@ -321,15 +316,12 @@ r128InitDriver( __DRIscreenPrivate *sPriv )
{
sPriv->private = (void *) r128CreateScreen( sPriv );
- /* Check the DRI version */
- {
- int major, minor, patch;
- if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) {
- if ( major != 4 || minor < 0 ) {
- __driUtilMessage( "R128 DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch );
- return GL_FALSE;
- }
- }
+ /* Check the DRI externsion version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "R128 DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return GL_FALSE;
}
/* Check that the DDX driver version is compatible */
@@ -356,12 +348,9 @@ r128InitDriver( __DRIscreenPrivate *sPriv )
-/* This function is called by libGL.so as soon as libGL.so is loaded.
- * This is where we'd register new extension functions with the
- * dispatcher.
- */
void __driRegisterExtensions( void )
{
+ /* See r200 driver for info */
}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.c b/xc/lib/GL/mesa/src/drv/r128/r128_span.c
index 2f606e4f2..653f893b3 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_span.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_span.c
@@ -40,7 +40,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_span.h"
#include "r128_tex.h"
-#include "swrast/s_pb.h" /* for PB_SIZE */
+#include "swrast/swrast.h"
#define DBG 0
@@ -219,8 +219,8 @@ do { \
#define WRITE_DEPTH_PIXELS() \
do { \
- GLint ox[PB_SIZE]; \
- GLint oy[PB_SIZE]; \
+ GLint ox[MAX_WIDTH]; \
+ GLint oy[MAX_WIDTH]; \
for ( i = 0 ; i < n ; i++ ) { \
ox[i] = x[i] + dPriv->x; \
} \
@@ -253,8 +253,8 @@ do { \
GLint i, remaining = n; \
\
while ( remaining > 0 ) { \
- GLint ox[PB_SIZE]; \
- GLint oy[PB_SIZE]; \
+ GLint ox[MAX_WIDTH]; \
+ GLint oy[MAX_WIDTH]; \
GLint count; \
\
if ( remaining <= 128 ) { \
@@ -296,8 +296,8 @@ do { \
#define WRITE_DEPTH_PIXELS() \
do { \
- GLint ox[PB_SIZE]; \
- GLint oy[PB_SIZE]; \
+ GLint ox[MAX_WIDTH]; \
+ GLint oy[MAX_WIDTH]; \
for ( i = 0 ; i < n ; i++ ) { \
ox[i] = x[i] + dPriv->x; \
} \
@@ -330,8 +330,8 @@ do { \
GLint i, remaining = n; \
\
while ( remaining > 0 ) { \
- GLint ox[PB_SIZE]; \
- GLint oy[PB_SIZE]; \
+ GLint ox[MAX_WIDTH]; \
+ GLint oy[MAX_WIDTH]; \
GLint count; \
\
if ( remaining <= 128 ) { \
@@ -378,20 +378,25 @@ do { \
-static void r128DDSetReadBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLenum mode )
+/*
+ * This function is called to specify which buffer to read and write
+ * for software rasterization (swrast) fallbacks. This doesn't necessarily
+ * correspond to glDrawBuffer() or glReadBuffer() calls.
+ */
+static void r128DDSetBuffer( GLcontext *ctx,
+ GLframebuffer *colorBuffer,
+ GLuint bufferBit )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
- switch ( mode ) {
- case GL_FRONT_LEFT:
- rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->readPitch = rmesa->r128Screen->frontPitch;
+ switch ( bufferBit ) {
+ case FRONT_LEFT_BIT:
+ rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
+ rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
break;
- case GL_BACK_LEFT:
- rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->readPitch = rmesa->r128Screen->backPitch;
+ case BACK_LEFT_BIT:
+ rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
+ rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
break;
default:
break;
@@ -404,7 +409,7 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
r128ContextPtr rmesa = R128_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = r128DDSetReadBuffer;
+ swdd->SetBuffer = r128DDSetBuffer;
switch ( rmesa->r128Screen->cpp ) {
case 2:
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_state.c b/xc/lib/GL/mesa/src/drv/r128/r128_state.c
index f5399aba9..ed68a7389 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_state.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_state.c
@@ -182,7 +182,7 @@ static void r128UpdateAlphaMode( GLcontext *ctx )
}
}
-static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLchan ref )
+static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
@@ -658,13 +658,18 @@ static void r128DepthRange( GLcontext *ctx,
*/
static void r128DDClearColor( GLcontext *ctx,
- const GLchan color[4] )
+ const GLfloat color[4] )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
+ GLubyte c[4];
+
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
rmesa->ClearColor = r128PackColor( rmesa->r128Screen->cpp,
- color[0], color[1],
- color[2], color[3] );
+ c[0], c[1], c[2], c[3] );
}
static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode )
@@ -678,35 +683,41 @@ static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode )
}
}
-static void r128DDSetDrawBuffer( GLcontext *ctx, GLenum mode )
+static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
FLUSH_BATCH( rmesa );
- if ( rmesa->DrawBuffer != mode ) {
- rmesa->DrawBuffer = mode;
+ /*
+ * _DrawDestMask is easier to cope with than <mode>.
+ */
+ switch ( ctx->Color._DrawDestMask ) {
+ case FRONT_LEFT_BIT:
+ FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
+ break;
+ case BACK_LEFT_BIT:
+ FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
+ break;
+ default:
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
+ FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ break;
+ }
- switch ( mode ) {
- case GL_FRONT_LEFT:
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case GL_BACK_LEFT:
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_TRUE );
- break;
- }
+ /* We want to update the s/w rast state too so that r200SetBuffer()
+ * gets called.
+ */
+ _swrast_DrawBuffer(ctx, mode);
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
- rmesa->new_state |= R128_NEW_WINDOW;
- }
+ rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
+ (rmesa->drawOffset >> 5));
+ rmesa->new_state |= R128_NEW_WINDOW;
+}
+
+static void r128DDReadBuffer( GLcontext *ctx, GLenum mode )
+{
+ /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
}
@@ -1073,11 +1084,9 @@ void r128DDInitState( r128ContextPtr rmesa )
rmesa->Fallback = 0;
if ( rmesa->glCtx->Visual.doubleBufferMode ) {
- rmesa->DrawBuffer = GL_BACK_LEFT;
rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
} else {
- rmesa->DrawBuffer = GL_FRONT_LEFT;
rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
}
@@ -1192,7 +1201,8 @@ void r128DDInitStateFuncs( GLcontext *ctx )
ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearColor = r128DDClearColor;
- ctx->Driver.SetDrawBuffer = r128DDSetDrawBuffer;
+ ctx->Driver.DrawBuffer = r128DDDrawBuffer;
+ ctx->Driver.ReadBuffer = r128DDReadBuffer;
ctx->Driver.IndexMask = NULL;
ctx->Driver.ColorMask = r128DDColorMask;
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
index 5b2b74f65..6423de7b3 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
@@ -48,7 +48,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "enums.h"
#include "texstore.h"
#include "texformat.h"
-#include "mem.h"
+#include "imports.h"
#define TEX_0 1
#define TEX_1 2
@@ -146,7 +146,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj )
r128SetTexWrap( t, texObj->WrapS, texObj->WrapT );
/*r128SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/
r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r128SetTexBorderColor( t, texObj->BorderColor );
+ r128SetTexBorderColor( t, texObj->_BorderChan );
return t;
}
@@ -509,7 +509,7 @@ static void r128DDTexParameter( GLcontext *ctx, GLenum target,
case GL_TEXTURE_BORDER_COLOR:
if ( t->bound ) FLUSH_BATCH( rmesa );
- r128SetTexBorderColor( t, tObj->BorderColor );
+ r128SetTexBorderColor( t, tObj->_BorderChan );
break;
case GL_TEXTURE_BASE_LEVEL:
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c b/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c
index e36bd3ac8..8b2e484ef 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c
@@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mmath.h"
#include "simple_list.h"
#include "texformat.h"
-#include "mem.h"
+#include "imports.h"
#define TEX_0 1
#define TEX_1 2
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c b/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c
index 0a8aae9c7..33e2d2120 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c
@@ -33,6 +33,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Brian Paul <brianp@valinux.com>
*/
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "macros.h"
+#include "texformat.h"
+
#include "r128_context.h"
#include "r128_state.h"
#include "r128_ioctl.h"
@@ -40,11 +46,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_tris.h"
#include "r128_tex.h"
-#include "context.h"
-#include "macros.h"
-#include "mem.h"
-#include "texformat.h"
-
static void r128SetTexImages( r128ContextPtr rmesa,
const struct gl_texture_object *tObj )
@@ -489,7 +490,7 @@ static void r128UpdateTextureUnit( GLcontext *ctx, int unit )
assert(unit == 0 || unit == 1); /* only two tex units */
- if (texUnit->_ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D)) {
+ if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
assert(t); /* should have driver tex data by now */
@@ -540,8 +541,9 @@ void r128UpdateTextureState( GLcontext *ctx )
r128ContextPtr rmesa = R128_CONTEXT(ctx);
if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p ) enabled=0x%x\n",
- __FUNCTION__, ctx, ctx->Texture._ReallyEnabled );
+ fprintf( stderr, "%s( %p ) enabled=0x%x 0x%x\n",
+ __FUNCTION__, ctx, ctx->Texture.Unit[0]._ReallyEnabled,
+ ctx->Texture.Unit[1]._ReallyEnabled );
}
/* Clear any texturing fallbacks */
@@ -565,8 +567,9 @@ void r128UpdateTextureState( GLcontext *ctx )
rmesa->tmu_source[1] = 1;
rmesa->blend_flags &= ~R128_BLEND_MULTITEX;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY) {
- if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) {
+ if (ctx->Texture._EnabledUnits & 0x2) {
+ /* unit 1 enabled */
+ if (ctx->Texture._EnabledUnits & 0x1) {
/* both texture 0 and 1 enabled */
if ( R128_IS_PLAIN( rmesa ) )
rmesa->blend_flags |= R128_BLEND_MULTITEX;
@@ -586,7 +589,7 @@ void r128UpdateTextureState( GLcontext *ctx )
rmesa->dirty |= (R128_UPLOAD_TEX0IMAGES | R128_UPLOAD_TEX0);
}
}
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) {
+ else if (ctx->Texture._EnabledUnits & 0x1) {
/* only texture 0 enabled */
r128UpdateTextureUnit( ctx, 0 );
r128UpdateTextureEnv( ctx, 0 );
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c b/xc/lib/GL/mesa/src/drv/r128/r128_tris.c
index 4a5cfd199..9a4e6a0ca 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_tris.c
@@ -33,9 +33,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-#include <stdio.h>
-#include <math.h>
-
#include "glheader.h"
#include "mtypes.h"
#include "colormac.h"
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
index 8b0d8b801..38cff8048 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
@@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "colormac.h"
#include "mmath.h"
@@ -380,24 +380,24 @@ void r128BuildVertices( GLcontext *ctx,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[rmesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= R128_RGBA_BIT;
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
ind |= R128_SPEC_BIT;
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
ind |= R128_TEX0_BIT;
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
ind |= R128_TEX1_BIT;
- if (newinputs & VERT_FOG_COORD)
+ if (newinputs & VERT_BIT_FOG)
ind |= R128_FOG_BIT;
if (rmesa->SetupIndex & R128_PTEX_BIT)
@@ -423,7 +423,7 @@ void r128ChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled)
ind |= R128_FOG_BIT;
- if (ctx->Texture._ReallyEnabled) {
+ if (ctx->Texture._EnabledUnits) {
ind |= R128_TEX0_BIT;
if (ctx->Texture.Unit[0]._ReallyEnabled &&
ctx->Texture.Unit[1]._ReallyEnabled)
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c b/xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c
index df710decf..d7c06b68e 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c
@@ -32,6 +32,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
+#include "imports.h"
+#include "macros.h"
+#include "context.h"
+#include "swrast/swrast.h"
+#include "simple_list.h"
+
#include "r200_context.h"
#include "r200_state.h"
#include "r200_ioctl.h"
@@ -39,12 +46,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_sanity.h"
#include "radeon_reg.h"
-#include "mem.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-#include "simple_list.h"
-
static void print_state_atom( struct r200_state_atom *state )
{
int i;
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_context.c b/xc/lib/GL/mesa/src/drv/r200/r200_context.c
index 421d61a18..6eb8d2350 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_context.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_context.c
@@ -32,6 +32,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
+#include "api_arrayelt.h"
+#include "context.h"
+#include "simple_list.h"
+#include "imports.h"
+#include "matrix.h"
+#include "state.h"
+#include "extensions.h"
+#include "state.h"
+
+#include "swrast/swrast.h"
+#include "swrast_setup/swrast_setup.h"
+#include "array_cache/acache.h"
+
+#include "tnl/tnl.h"
+#include "tnl/t_pipeline.h"
#include "r200_context.h"
#include "r200_ioctl.h"
@@ -44,27 +60,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_vtxfmt.h"
#include "r200_maos.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "attrib.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "simple_list.h"
-#include "mem.h"
-#include "matrix.h"
-#include "state.h"
-#include "extensions.h"
-#include "state.h"
#if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h"
#endif
-#define R200_DATE "20020827"
+#define R200_DATE "20021125"
#ifndef R200_DEBUG
int R200_DEBUG = (0);
@@ -158,17 +158,25 @@ static const GLubyte *r200GetString( GLcontext *ctx, GLenum name )
/* Initialize the extensions supported by this driver.
*/
-static void r200InitExtensions( GLcontext *ctx )
+static void r200InitExtensions( GLcontext *ctx, r200ScreenPtr r200Screen )
{
_mesa_enable_imaging_extensions( ctx );
_mesa_enable_extension( ctx, "GL_ARB_multitexture" );
+ if (r200Screen->drmSupportsCubeMaps)
+ _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
_mesa_enable_extension( ctx, "GL_ARB_texture_env_add" );
_mesa_enable_extension( ctx, "GL_ARB_texture_env_combine" );
_mesa_enable_extension( ctx, "GL_ARB_texture_env_dot3" );
+ _mesa_enable_extension( ctx, "GL_ARB_texture_mirrored_repeat" );
+ _mesa_enable_extension( ctx, "GL_ARB_texture_border_clamp" );
+
+ _mesa_enable_extension( ctx, "GL_ATI_texture_mirror_once" );
_mesa_enable_extension( ctx, "GL_EXT_blend_logic_op" );
+ /*_mesa_enable_extension( ctx, "GL_EXT_fog_coord" );*/
_mesa_enable_extension( ctx, "GL_EXT_stencil_wrap" );
+ _mesa_enable_extension( ctx, "GL_EXT_texture_edge_clamp" );
_mesa_enable_extension( ctx, "GL_EXT_texture_env_add" );
_mesa_enable_extension( ctx, "GL_EXT_texture_env_combine" );
_mesa_enable_extension( ctx, "GL_EXT_texture_env_dot3" );
@@ -183,7 +191,6 @@ static void r200InitExtensions( GLcontext *ctx )
_mesa_enable_extension( ctx, "GL_MESA_pack_invert" );
_mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" );
_mesa_enable_extension( ctx, "GL_NV_texture_rectangle" );
-
}
extern const struct gl_pipeline_stage _r200_render_stage;
@@ -283,7 +290,7 @@ static void add_debug_flags( const char *debug )
/* Create the device specific context.
*/
-GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual,
+GLboolean r200CreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate)
{
@@ -291,9 +298,8 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual,
r200ScreenPtr r200Screen = (r200ScreenPtr)(sPriv->private);
r200ContextPtr rmesa;
GLcontext *ctx, *shareCtx;
- int i;
+ int i, memPerUnit;
- assert(dpy);
assert(glVisual);
assert(driContextPriv);
assert(r200Screen);
@@ -308,7 +314,7 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual,
shareCtx = ((r200ContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, rmesa, GL_TRUE);
+ rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
if (!rmesa->glCtx) {
FREE(rmesa);
return GL_FALSE;
@@ -316,7 +322,6 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual,
driContextPriv->driverPrivate = rmesa;
/* Init r200 context data */
- rmesa->dri.display = dpy;
rmesa->dri.context = driContextPriv;
rmesa->dri.screen = sPriv;
rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
@@ -349,19 +354,53 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual,
* Test for 2 textures * 4 bytes/texel * size * size.
*/
ctx = rmesa->glCtx;
- if (r200Screen->texSize[RADEON_CARD_HEAP] >= 2 * 4 * 2048 * 2048) {
+ memPerUnit = r200Screen->texSize[RADEON_CARD_HEAP] / 2;
+
+ /* XXX the following code could go into a utility file */
+ if (memPerUnit >= 4 * 2048 * 2048) {
ctx->Const.MaxTextureLevels = 12; /* 2048x2048 */
}
- else if (r200Screen->texSize[RADEON_CARD_HEAP] >= 2 * 4 * 1024 * 1024) {
+ else if (memPerUnit >= 4 * 1024 * 1024) {
ctx->Const.MaxTextureLevels = 11; /* 1024x1024 */
}
- else if (r200Screen->texSize[RADEON_CARD_HEAP] >= 2 * 4 * 512 * 512) {
+ else if (memPerUnit >= 4 * 512 * 512) {
ctx->Const.MaxTextureLevels = 10; /* 512x512 */
}
else {
ctx->Const.MaxTextureLevels = 9; /* 256x256 */
}
+#if ENABLE_HW_3D_TEXTURE
+ if (memPerUnit >= 4 * 256 * 256 * 256) {
+ ctx->Const.Max3DTextureLevels = 9; /* 256x256x256 */
+ }
+ else if (memPerUnit >= 4 * 64 * 64 * 64) {
+ ctx->Const.Max3DTextureLevels = 8; /* 128x128x128 */
+ }
+ else if (memPerUnit >= 4 * 32 * 32 * 32) {
+ ctx->Const.Max3DTextureLevels = 7; /* 64x64x64 */
+ }
+ else { /* 256KBytes */
+ ctx->Const.Max3DTextureLevels = 6; /* 32x32x32 */
+ }
+#endif
+
+ if (memPerUnit >= 4 * 6 * 2048 * 2048) {
+ ctx->Const.MaxCubeTextureLevels = 12; /* 2048x2048 */
+ }
+ if (memPerUnit >= 4 * 6 * 1024 * 1024) {
+ ctx->Const.MaxCubeTextureLevels = 11; /* 1024x1024 */
+ }
+ else if (memPerUnit >= 4 * 6 * 512 * 512) {
+ ctx->Const.MaxCubeTextureLevels = 10; /* 512x512 */
+ }
+ else if (memPerUnit >= 4 * 6 * 256 * 256) {
+ ctx->Const.MaxCubeTextureLevels = 9; /* 256x256 */
+ }
+ else { /* 393216 bytes */
+ ctx->Const.MaxCubeTextureLevels = 8; /* 128x128 */
+ }
+
ctx->Const.MaxTextureUnits = 2;
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
@@ -378,7 +417,6 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual,
ctx->Const.MaxLineWidthAA = 10.0;
ctx->Const.LineWidthGranularity = 0.0625;
-
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
@@ -410,7 +448,7 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual,
_math_matrix_set_identity( &rmesa->TexGenMatrix[1] );
_math_matrix_set_identity( &rmesa->tmpmat );
- r200InitExtensions( ctx );
+ r200InitExtensions( ctx, r200Screen );
r200InitDriverFuncs( ctx );
r200InitIoctlFuncs( ctx );
r200InitStateFuncs( ctx );
@@ -536,19 +574,15 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
void
-r200SwapBuffers(Display *dpy, void *drawablePrivate)
+r200SwapBuffers( __DRIdrawablePrivate *dPriv )
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- (void) dpy;
-
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
r200ContextPtr rmesa;
GLcontext *ctx;
rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = rmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
- _mesa_swapbuffers( ctx ); /* flush pending rendering comands */
-
+ _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
if ( rmesa->doPageFlip ) {
r200PageFlip( dPriv );
}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_context.h b/xc/lib/GL/mesa/src/drv/r200/r200_context.h
index f2ca40b0a..1cf80a787 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_context.h
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_context.h
@@ -37,15 +37,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef GLX_DIRECT_RENDERING
-#include <X11/Xlibint.h>
#include "dri_util.h"
-#include "xf86drm.h"
#include "radeon_common.h"
#include "macros.h"
#include "mtypes.h"
#include "r200_reg.h"
+#define ENABLE_HW_3D_TEXTURE 0 /* XXX this is temporary! */
+
struct r200_context;
typedef struct r200_context r200ContextRec;
typedef struct r200_context *r200ContextPtr;
@@ -64,6 +64,10 @@ typedef struct r200_context *r200ContextPtr;
#define R200_FALLBACK_BLEND_FUNC 0x20
#define R200_FALLBACK_DISABLE 0x40
+/* The blit width for texture uploads
+ */
+#define BLIT_WIDTH_BYTES 1024
+
/* Use the templated vertex format:
*/
#define COLOR_IS_RGBA
@@ -135,9 +139,10 @@ struct r200_tex_obj {
GLuint bufAddr; /* Offset to start of locally
shared texture block */
- GLuint dirty_images; /* Flags for whether or not
+ GLuint dirty_images[6]; /* Flags for whether or not
images need to be uploaded to
- local or AGP texture space */
+ local or AGP texture space.
+ Six cube faces. */
GLuint dirty_state; /* Flags (1 per texunit) for
whether or not this texobj
@@ -148,17 +153,22 @@ struct r200_tex_obj {
GLint heap; /* Texture heap currently stored in */
- drmRadeonTexImage image[RADEON_MAX_TEXTURE_LEVELS];
+ drmRadeonTexImage image[6][RADEON_MAX_TEXTURE_LEVELS];
+ /* Six, for the cube faces */
GLint totalSize; /* Total size of the texture
- including all mipmap levels */
+ including all mipmap levels,
+ and all six cube faces */
GLuint pp_txfilter; /* hardware register values */
GLuint pp_txformat;
- GLuint pp_txoffset;
+ GLuint pp_txformat_x;
+ GLuint pp_txoffset; /* Image location in texmem.
+ All cube faces follow. */
GLuint pp_txsize; /* npot only */
GLuint pp_txpitch; /* npot only */
GLuint pp_border_color;
+ GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
/* texObj->Image[firstLevel] through texObj->Image[lastLevel] are the
* images to upload.
@@ -246,10 +256,10 @@ struct r200_state_atom {
#define VPT_SE_VPORT_ZOFFSET 6
#define VPT_STATE_SIZE 7
-#define ZBS_CMD_0 0
-#define ZBS_SE_ZBIAS_FACTOR 1
-#define ZBS_SE_ZBIAS_CONSTANT 2
-#define ZBS_STATE_SIZE 3
+#define ZBS_CMD_0 0
+#define ZBS_SE_ZBIAS_FACTOR 1
+#define ZBS_SE_ZBIAS_CONSTANT 2
+#define ZBS_STATE_SIZE 3
#define MSC_CMD_0 0
#define MSC_RE_MISC 1
@@ -260,16 +270,26 @@ struct r200_state_atom {
#define TAM_STATE_SIZE 2
#define TEX_CMD_0 0
-#define TEX_PP_TXFILTER 1
-#define TEX_PP_TXFORMAT 2
-#define TEX_PP_TXFORMAT_X 3
-#define TEX_PP_TXSIZE 4
-#define TEX_PP_TXPITCH 5
-#define TEX_PP_BORDER_COLOR 6
+#define TEX_PP_TXFILTER 1 /*2c00*/
+#define TEX_PP_TXFORMAT 2 /*2c04*/
+#define TEX_PP_TXFORMAT_X 3 /*2c08*/
+#define TEX_PP_TXSIZE 4 /*2c0c*/
+#define TEX_PP_TXPITCH 5 /*2c10*/
+#define TEX_PP_BORDER_COLOR 6 /*2c14*/
#define TEX_CMD_1 7
-#define TEX_PP_TXOFFSET 8
+#define TEX_PP_TXOFFSET 8 /*2d00 */
#define TEX_STATE_SIZE 9
+#define CUBE_CMD_0 0 /* 1 register follows */
+#define CUBE_PP_CUBIC_FACES 1 /* 0x2c18 */
+#define CUBE_CMD_1 2 /* 5 registers follow */
+#define CUBE_PP_CUBIC_OFFSET_F1 3 /* 0x2d04 */
+#define CUBE_PP_CUBIC_OFFSET_F2 4 /* 0x2d08 */
+#define CUBE_PP_CUBIC_OFFSET_F3 5 /* 0x2d0c */
+#define CUBE_PP_CUBIC_OFFSET_F4 6 /* 0x2d10 */
+#define CUBE_PP_CUBIC_OFFSET_F5 7 /* 0x2d14 */
+#define CUBE_STATE_SIZE 8
+
#define PIX_CMD_0 0
#define PIX_PP_TXCBLEND 1
#define PIX_PP_TXCBLEND2 2
@@ -492,6 +512,7 @@ struct r200_hw_state {
struct r200_state_atom tam;
struct r200_state_atom tf;
struct r200_state_atom tex[2];
+ struct r200_state_atom cube[2];
struct r200_state_atom zbs;
struct r200_state_atom mtl[2];
struct r200_state_atom mat[5];
@@ -563,8 +584,6 @@ struct r200_dma {
};
struct r200_dri_mirror {
- Display *display; /* X server display */
-
__DRIcontextPrivate *context; /* DRI context */
__DRIscreenPrivate *screen; /* DRI screen */
__DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
@@ -873,11 +892,10 @@ static __inline GLuint r200PackColor( GLuint cpp,
extern void r200DestroyContext( __DRIcontextPrivate *driContextPriv );
-extern GLboolean r200CreateContext( Display *dpy,
- const __GLcontextModes *glVisual,
+extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate);
-extern void r200SwapBuffers(Display *dpy, void *drawablePrivate);
+extern void r200SwapBuffers( __DRIdrawablePrivate *dPriv );
extern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv );
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c b/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c
index 8577bf55b..32a471447 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c
@@ -32,6 +32,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
+#include "imports.h"
+#include "macros.h"
+#include "context.h"
+#include "swrast/swrast.h"
+
#include "r200_context.h"
#include "r200_state.h"
#include "r200_ioctl.h"
@@ -39,15 +45,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_sanity.h"
#include "radeon_reg.h"
-#include "mem.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
+#include <unistd.h> /* for usleep() */
+
#define R200_TIMEOUT 512
#define R200_IDLE_RETRY 16
-#undef usleep
static void do_usleep( int nr, const char *caller )
{
@@ -142,7 +145,7 @@ void r200FlushCmdBuf( r200ContextPtr rmesa, const char *caller )
UNLOCK_HARDWARE( rmesa );
if (ret) {
- fprintf(stderr, "drmRadeonCmdBuffer: %d\n", ret);
+ fprintf(stderr, "drmRadeonCmdBuffer: %d (exiting)\n", ret);
exit(ret);
}
}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_lock.c b/xc/lib/GL/mesa/src/drv/r200/r200_lock.c
index 0d4db5647..b71919642 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_lock.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_lock.c
@@ -51,7 +51,7 @@ r200UpdatePageFlipping( r200ContextPtr rmesa )
int use_back;
rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
- use_back = (rmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT);
+ use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
if (use_back) {
@@ -93,11 +93,14 @@ void r200GetLock( r200ContextPtr rmesa, GLuint flags )
* Since the hardware state depends on having the latest drawable
* clip rects, all state checking must be done _after_ this call.
*/
- DRI_VALIDATE_DRAWABLE_INFO( rmesa->dri.display, sPriv, dPriv );
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
if ( rmesa->lastStamp != dPriv->lastStamp ) {
r200UpdatePageFlipping( rmesa );
- r200SetCliprects( rmesa, rmesa->glCtx->Color.DriverDrawBuffer );
+ if (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT)
+ r200SetCliprects( rmesa, GL_BACK_LEFT );
+ else
+ r200SetCliprects( rmesa, GL_FRONT_LEFT );
r200UpdateViewportOffset( rmesa->glCtx );
rmesa->lastStamp = dPriv->lastStamp;
}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c b/xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c
index 8bda9ea3c..19ed677cb 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c
@@ -35,7 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "glheader.h"
#include "mtypes.h"
#include "colormac.h"
-#include "mem.h"
+#include "imports.h"
#include "mmath.h"
#include "macros.h"
@@ -337,7 +337,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
}
- if (inputs & VERT_NORM) {
+ if (inputs & VERT_BIT_NORMAL) {
if (!rmesa->tcl.norm.buf)
emit_vector( ctx,
&(rmesa->tcl.norm),
@@ -350,7 +350,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
component[nr++] = &rmesa->tcl.norm;
}
- if (inputs & VERT_RGBA) {
+ if (inputs & VERT_BIT_COLOR0) {
if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) {
if (!rmesa->tcl.rgba.buf)
emit_ubyte_rgba( ctx,
@@ -389,7 +389,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
}
- if (inputs & VERT_SPEC_RGB) {
+ if (inputs & VERT_BIT_COLOR1) {
if (!rmesa->tcl.spec.buf) {
if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
r200_import_float_spec_colors( ctx );
@@ -411,7 +411,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
/* vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] & */
/* ~(R200_TCL_VTX_Q0|R200_TCL_VTX_Q1)); */
- if (inputs & VERT_TEX0) {
+ if (inputs & VERT_BIT_TEX0) {
if (!rmesa->tcl.tex[0].buf)
emit_vector( ctx,
&(rmesa->tcl.tex[0]),
@@ -424,7 +424,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
component[nr++] = &rmesa->tcl.tex[0];
}
- if (inputs & VERT_TEX1) {
+ if (inputs & VERT_BIT_TEX1) {
if (!rmesa->tcl.tex[1].buf)
emit_vector( ctx,
&(rmesa->tcl.tex[1]),
@@ -459,21 +459,21 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
if (R200_DEBUG & DEBUG_VERTS)
_tnl_print_vert_flags( __FUNCTION__, newinputs );
- if (newinputs & VERT_OBJ)
+ if (newinputs & VERT_BIT_POS)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
- if (newinputs & VERT_NORM)
+ if (newinputs & VERT_BIT_NORMAL)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ );
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c b/xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c
index 87ae7c48f..cc1d10f4d 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c
@@ -32,14 +32,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-#include "r200_swtcl.h"
-#include "r200_maos.h"
-
+#include "glheader.h"
+#include "imports.h"
#include "mmath.h"
#include "mtypes.h"
#include "enums.h"
@@ -51,6 +45,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/t_pipeline.h"
#include "tnl/t_imm_debug.h"
+#include "r200_context.h"
+#include "r200_state.h"
+#include "r200_ioctl.h"
+#include "r200_tex.h"
+#include "r200_tcl.h"
+#include "r200_swtcl.h"
+#include "r200_maos.h"
+
+
#define R200_TCL_MAX_SETUP 13
union emit_union { float f; GLuint ui; GLubyte ub[4]; };
@@ -256,19 +259,19 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
}
}
- if (inputs & VERT_NORM) {
+ if (inputs & VERT_BIT_NORMAL) {
req |= R200_CP_VC_FRMT_N0;
}
- if (inputs & VERT_RGBA) {
+ if (inputs & VERT_BIT_COLOR0) {
req |= R200_CP_VC_FRMT_PKCOLOR;
}
- if (inputs & VERT_SPEC_RGB) {
+ if (inputs & VERT_BIT_COLOR1) {
req |= R200_CP_VC_FRMT_PKSPEC;
}
- if (inputs & VERT_TEX0) {
+ if (inputs & VERT_BIT_TEX0) {
req |= R200_CP_VC_FRMT_ST0;
if (VB->TexCoordPtr[0]->size == 4) {
@@ -277,7 +280,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
}
}
- if (inputs & VERT_TEX1) {
+ if (inputs & VERT_BIT_TEX1) {
req |= R200_CP_VC_FRMT_ST1;
if (VB->TexCoordPtr[1]->size == 4) {
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_pixel.c b/xc/lib/GL/mesa/src/drv/r200/r200_pixel.c
index ff2ef8a49..94977efd1 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_pixel.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_pixel.c
@@ -32,20 +32,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
#include "enums.h"
#include "mtypes.h"
#include "macros.h"
#include "texutil.h"
+#include "swrast/swrast.h"
+
#include "r200_context.h"
#include "r200_ioctl.h"
#include "r200_pixel.h"
#include "r200_swtcl.h"
-#include "xf86drm.h"
-#include "swrast/swrast.h"
-
-
-
static GLboolean
@@ -96,7 +94,7 @@ check_color_per_fragment_ops( const GLcontext *ctx )
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._ReallyEnabled ||
+ ctx->Texture._EnabledUnits ||
ctx->Depth.OcclusionTest
) &&
ctx->Current.RasterPosValid);
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_reg.h b/xc/lib/GL/mesa/src/drv/r200/r200_reg.h
index 8f2f3f321..a014f1f3a 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_reg.h
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_reg.h
@@ -851,23 +851,28 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R200_TXFORMAT_WIDTH_SHIFT 8
#define R200_TXFORMAT_HEIGHT_MASK (15 << 12)
#define R200_TXFORMAT_HEIGHT_SHIFT 12
-#define R200_TXFORMAT_F5_WIDTH_MASK (15 << 15) /* cube face 5 */
-#define R200_TXFORMAT_F5_WIDTH_SHIFT 15
+#define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */
+#define R200_TXFORMAT_F5_WIDTH_SHIFT 16
#define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
#define R200_TXFORMAT_F5_HEIGHT_SHIFT 20
-#define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
#define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
#define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
#define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
#define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24)
#define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24)
#define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
+#define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
+#define R200_TXFORMAT_ST_ROUTE_SHIFT 24
#define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
#define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
#define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
#define R200_PP_TXFORMAT_X_0 0x2c08
-#define R200_DEPTH_LOG2_MASK (0xff << 0)
+#define R200_DEPTH_LOG2_MASK (0xf << 0)
#define R200_DEPTH_LOG2_SHIFT 0
+#define R200_VOLUME_FILTER_SHIFT 4
+#define R200_VOLUME_FILTER_MASK (1 << 4)
+#define R200_VOLUME_FILTER_NEAREST (0 << 4)
+#define R200_VOLUME_FILTER_LINEAR (1 << 4)
#define R200_WRAPEN_Q (1 << 8)
#define R200_CLAMP_Q_WRAP (0 << 9)
#define R200_CLAMP_Q_MIRROR (1 << 9)
@@ -886,12 +891,29 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R200_TEXCOORD_1D_PROJ (5 << 16)
#define R200_TEXCOORD_1D (6 << 16)
#define R200_TEXCOORD_ZERO (7 << 16)
+#define R200_TEXCOORD_MASK (7 << 16)
#define R200_LOD_BIAS_MASK (0xfff80000)
#define R200_LOD_BIAS_SHIFT 19
#define R200_PP_TXSIZE_0 0x2c0c /* NPOT only */
#define R200_PP_TXPITCH_0 0x2c10 /* NPOT only */
#define R200_PP_BORDER_COLOR_0 0x2c14
#define R200_PP_CUBIC_FACES_0 0x2c18
+#define R200_FACE_WIDTH_1_SHIFT 0
+#define R200_FACE_HEIGHT_1_SHIFT 4
+#define R200_FACE_WIDTH_1_MASK (0xf << 0)
+#define R200_FACE_HEIGHT_1_MASK (0xf << 4)
+#define R200_FACE_WIDTH_2_SHIFT 8
+#define R200_FACE_HEIGHT_2_SHIFT 12
+#define R200_FACE_WIDTH_2_MASK (0xf << 8)
+#define R200_FACE_HEIGHT_2_MASK (0xf << 12)
+#define R200_FACE_WIDTH_3_SHIFT 16
+#define R200_FACE_HEIGHT_3_SHIFT 20
+#define R200_FACE_WIDTH_3_MASK (0xf << 16)
+#define R200_FACE_HEIGHT_3_MASK (0xf << 20)
+#define R200_FACE_WIDTH_4_SHIFT 24
+#define R200_FACE_HEIGHT_4_SHIFT 28
+#define R200_FACE_WIDTH_4_MASK (0xf << 24)
+#define R200_FACE_HEIGHT_4_MASK (0xf << 28)
#define R200_PP_TXFILTER_1 0x2c20
#define R200_PP_TXFORMAT_1 0x2c24
#define R200_PP_TXFORMAT_X_1 0x2c28
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_sanity.c b/xc/lib/GL/mesa/src/drv/r200/r200_sanity.c
index 1e75d2017..3cd98c555 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_sanity.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_sanity.c
@@ -33,6 +33,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+
#include "r200_context.h"
#include "r200_ioctl.h"
#include "r200_sanity.h"
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_screen.c b/xc/lib/GL/mesa/src/drv/r200/r200_screen.c
index d7b1b0138..e660b826f 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_screen.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_screen.c
@@ -33,14 +33,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <dlfcn.h>
-#include <stdlib.h>
+
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
#include "r200_screen.h"
#include "r200_context.h"
#include "r200_ioctl.h"
-#include "mem.h"
-#include "context.h"
#if 1
/* Including xf86PciInfo.h introduces a bunch of errors...
@@ -67,19 +68,12 @@ r200CreateScreen( __DRIscreenPrivate *sPriv )
r200ScreenPtr r200Screen;
RADEONDRIPtr r200DRIPriv = (RADEONDRIPtr)sPriv->pDevPriv;
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Check the DRI version */
- {
- int major, minor, patch;
- if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) {
- if ( major != 4 || minor < 0 ) {
- __driUtilMessage( "R200 DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- major, minor, patch );
- return NULL;
- }
- }
+ /* Check the DRI extension version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "R200 DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return NULL;
}
/* Check that the DDX driver version is compatible */
@@ -102,8 +96,6 @@ r200CreateScreen( __DRIscreenPrivate *sPriv )
return NULL;
}
-
-
/* Allocate the private area */
r200Screen = (r200ScreenPtr) CALLOC( sizeof(*r200Screen) );
if ( !r200Screen ) {
@@ -112,6 +104,11 @@ r200CreateScreen( __DRIscreenPrivate *sPriv )
return NULL;
}
+ /* Check if kernel module is new enough to support cube maps */
+ if (sPriv->drmMajor * 100 + sPriv->drmMinor >= 107)
+ r200Screen->drmSupportsCubeMaps = GL_TRUE;
+ else
+ r200Screen->drmSupportsCubeMaps = GL_FALSE;
switch ( r200DRIPriv->deviceID ) {
case PCI_CHIP_R200_QD:
@@ -310,11 +307,10 @@ r200InitDriver( __DRIscreenPrivate *sPriv )
* data.
*/
static GLboolean
-r200CreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
+r200CreateBuffer( __DRIscreenPrivate *driScrnPriv,
+ __DRIdrawablePrivate *driDrawPriv,
+ const __GLcontextModes *mesaVis,
+ GLboolean isPixmap )
{
if (isPixmap) {
return GL_FALSE; /* not implemented */
@@ -389,8 +385,10 @@ void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
}
-/* This function is called by libGL.so as soon as libGL.so is loaded.
- * This is where we'd register new extension functions with the dispatcher.
+/* This function is called by libGL.so to allow the driver to dynamically
+ * extend libGL. We can add new GLX functions and/or new GL functions.
+ * Note that _mesa_create_context() will probably add most of the newer
+ * OpenGL extension functions into the dispatcher.
*/
void
__driRegisterExtensions( void )
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_screen.h b/xc/lib/GL/mesa/src/drv/r200/r200_screen.h
index b9c83f925..fd0ff7ab6 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_screen.h
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_screen.h
@@ -37,7 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef GLX_DIRECT_RENDERING
-#include <X11/Xlibint.h>
#include "dri_util.h"
#include "xf86drm.h"
#include "radeon_common.h"
@@ -90,6 +89,8 @@ typedef struct {
unsigned int agp_buffer_offset; /* offset in card memory space */
unsigned int agp_texture_offset; /* offset in card memory space */
unsigned int agp_base;
+
+ GLboolean drmSupportsCubeMaps; /* need radeon kernel module >=1.7 */
} r200ScreenRec, *r200ScreenPtr;
#endif
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_span.c b/xc/lib/GL/mesa/src/drv/r200/r200_span.c
index d67534794..efbef9894 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_span.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_span.c
@@ -32,14 +32,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
+#include "imports.h"
+#include "swrast/swrast.h"
+
#include "r200_context.h"
#include "r200_ioctl.h"
#include "r200_state.h"
#include "r200_span.h"
#include "r200_tex.h"
-#include "swrast/swrast.h"
-
#define DBG 0
#define LOCAL_VARS \
@@ -285,33 +287,46 @@ do { \
#include "stenciltmp.h"
-static void r200SetReadBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLenum mode )
+/*
+ * This function is called to specify which buffer to read and write
+ * for software rasterization (swrast) fallbacks. This doesn't necessarily
+ * correspond to glDrawBuffer() or glReadBuffer() calls.
+ */
+static void r200SetBuffer( GLcontext *ctx,
+ GLframebuffer *colorBuffer,
+ GLuint bufferBit )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- switch ( mode ) {
- case GL_FRONT_LEFT:
+ switch ( bufferBit ) {
+ case FRONT_LEFT_BIT:
if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
+ rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
+ rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
} else {
rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
+ rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
+ rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
}
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
+ rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
+ rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
} else {
rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
+ rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
+ rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
}
break;
default:
- assert(0);
+ _mesa_problem(ctx, "Bad bufferBit in r200SetBuffer()");
break;
}
}
@@ -359,7 +374,7 @@ void r200InitSpanFuncs( GLcontext *ctx )
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = r200SetReadBuffer;
+ swdd->SetBuffer = r200SetBuffer;
switch ( rmesa->r200Screen->cpp ) {
case 2:
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_state.c b/xc/lib/GL/mesa/src/drv/r200/r200_state.c
index 6efa0f6da..3ad2d2f13 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_state.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_state.c
@@ -32,20 +32,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_tcl.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
+#include "api_arrayelt.h"
#include "mmath.h"
#include "enums.h"
#include "colormac.h"
-#include "light.h"
-#include "api_arrayelt.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
@@ -54,19 +46,31 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast_setup/swrast_setup.h"
+#include "r200_context.h"
+#include "r200_ioctl.h"
+#include "r200_state.h"
+#include "r200_tcl.h"
+#include "r200_tex.h"
+#include "r200_swtcl.h"
+#include "r200_vtxfmt.h"
+
+
/* =============================================================
* Alpha blending
*/
-static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLchan ref )
+static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
+ GLubyte refByte;
+
+ CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
R200_STATECHANGE( rmesa, ctx );
pp_misc &= ~(R200_ALPHA_TEST_OP_MASK | R200_REF_ALPHA_MASK);
- pp_misc |= (ref & R200_REF_ALPHA_MASK);
+ pp_misc |= (refByte & R200_REF_ALPHA_MASK);
switch ( func ) {
case GL_NEVER:
@@ -1200,7 +1204,7 @@ static void r200UpdateClipPlanes( GLcontext *ctx )
GLuint p;
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipEnabled[p]) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
R200_STATECHANGE( rmesa, ucp[p] );
@@ -1221,8 +1225,8 @@ static void r200StencilFunc( GLcontext *ctx, GLenum func,
GLint ref, GLuint mask )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref << R200_STENCIL_REF_SHIFT) |
- (ctx->Stencil.ValueMask << R200_STENCIL_MASK_SHIFT));
+ GLuint refmask = ((ctx->Stencil.Ref[0] << R200_STENCIL_REF_SHIFT) |
+ (ctx->Stencil.ValueMask[0] << R200_STENCIL_MASK_SHIFT));
R200_STATECHANGE( rmesa, ctx );
R200_STATECHANGE( rmesa, msk );
@@ -1231,7 +1235,7 @@ static void r200StencilFunc( GLcontext *ctx, GLenum func,
rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~(R200_STENCIL_REF_MASK|
R200_STENCIL_VALUE_MASK);
- switch ( ctx->Stencil.Function ) {
+ switch ( ctx->Stencil.Function[0] ) {
case GL_NEVER:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_NEVER;
break;
@@ -1268,7 +1272,7 @@ static void r200StencilMask( GLcontext *ctx, GLuint mask )
R200_STATECHANGE( rmesa, msk );
rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~R200_STENCIL_WRITE_MASK;
rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |=
- (ctx->Stencil.WriteMask << R200_STENCIL_WRITEMASK_SHIFT);
+ (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT);
}
static void r200StencilOp( GLcontext *ctx, GLenum fail,
@@ -1281,7 +1285,7 @@ static void r200StencilOp( GLcontext *ctx, GLenum fail,
R200_STENCIL_ZFAIL_MASK |
R200_STENCIL_ZPASS_MASK);
- switch ( ctx->Stencil.FailFunc ) {
+ switch ( ctx->Stencil.FailFunc[0] ) {
case GL_KEEP:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_KEEP;
break;
@@ -1308,7 +1312,7 @@ static void r200StencilOp( GLcontext *ctx, GLenum fail,
break;
}
- switch ( ctx->Stencil.ZFailFunc ) {
+ switch ( ctx->Stencil.ZFailFunc[0] ) {
case GL_KEEP:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_KEEP;
break;
@@ -1335,7 +1339,7 @@ static void r200StencilOp( GLcontext *ctx, GLenum fail,
break;
}
- switch ( ctx->Stencil.ZPassFunc ) {
+ switch ( ctx->Stencil.ZPassFunc[0] ) {
case GL_KEEP:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_KEEP;
break;
@@ -1370,7 +1374,7 @@ static void r200ClearStencil( GLcontext *ctx, GLint s )
rmesa->state.stencil.clear =
((GLuint) ctx->Stencil.Clear |
(0xff << R200_STENCIL_MASK_SHIFT) |
- (ctx->Stencil.WriteMask << R200_STENCIL_WRITEMASK_SHIFT));
+ (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT));
}
@@ -1481,11 +1485,17 @@ void r200UpdateViewportOffset( GLcontext *ctx )
* Miscellaneous
*/
-static void r200ClearColor( GLcontext *ctx, const GLchan c[4] )
+static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ GLubyte color[4];
+ CLAMPED_FLOAT_TO_UBYTE(color[0], c[0]);
+ CLAMPED_FLOAT_TO_UBYTE(color[1], c[1]);
+ CLAMPED_FLOAT_TO_UBYTE(color[2], c[2]);
+ CLAMPED_FLOAT_TO_UBYTE(color[3], c[3]);
rmesa->state.color.clear = r200PackColor( rmesa->r200Screen->cpp,
- c[0], c[1], c[2], c[3] );
+ color[0], color[1],
+ color[2], color[3] );
}
@@ -1558,7 +1568,7 @@ void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
}
-static void r200SetDrawBuffer( GLcontext *ctx, GLenum mode )
+static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
@@ -1568,34 +1578,29 @@ static void r200SetDrawBuffer( GLcontext *ctx, GLenum mode )
R200_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */
- switch ( mode ) {
- case GL_FRONT_LEFT:
+ /*
+ * _DrawDestMask is easier to cope with than <mode>.
+ */
+ switch ( ctx->Color._DrawDestMask ) {
+ case FRONT_LEFT_BIT:
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- }
r200SetCliprects( rmesa, GL_FRONT_LEFT );
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- }
r200SetCliprects( rmesa, GL_BACK_LEFT );
break;
default:
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
+ /* We want to update the s/w rast state too so that r200SetBuffer()
+ * gets called.
+ */
+ _swrast_DrawBuffer(ctx, mode);
+
R200_STATECHANGE( rmesa, ctx );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset &
R200_COLOROFFSET_MASK);
@@ -1603,6 +1608,11 @@ static void r200SetDrawBuffer( GLcontext *ctx, GLenum mode )
}
+static void r200ReadBuffer( GLcontext *ctx, GLenum mode )
+{
+ /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
+}
+
/* =============================================================
* State enable/disable
*/
@@ -1932,7 +1942,7 @@ static void upload_matrix( r200ContextPtr rmesa, GLfloat *src, int idx )
R200_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
}
-static void upload_matrix_t( r200ContextPtr rmesa, GLfloat *src, int idx )
+static void upload_matrix_t( r200ContextPtr rmesa, const GLfloat *src, int idx )
{
float *dest = ((float *)R200_DB_STATE( mat[idx] ))+MAT_ELT_0;
memcpy(dest, src, 16*sizeof(float));
@@ -1958,7 +1968,7 @@ static void update_texturematrix( GLcontext *ctx )
if (!ctx->Texture.Unit[unit]._ReallyEnabled)
continue;
- if (ctx->TextureMatrix[unit].type != MATRIX_IDENTITY) {
+ if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) {
rmesa->TexMatEnabled |= (R200_TEXGEN_TEXMAT_0_ENABLE|
R200_TEXMAT_0_ENABLE) << unit;
@@ -1970,11 +1980,11 @@ static void update_texturematrix( GLcontext *ctx )
*/
_math_matrix_mul_matrix( &rmesa->tmpmat,
&rmesa->TexGenMatrix[unit],
- &ctx->TextureMatrix[unit] );
+ ctx->TextureMatrixStack[unit].Top );
upload_matrix( rmesa, rmesa->tmpmat.m, R200_MTX_TEX0+unit );
}
else {
- upload_matrix( rmesa, ctx->TextureMatrix[unit].m,
+ upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m,
R200_MTX_TEX0+unit );
}
}
@@ -2020,8 +2030,8 @@ void r200ValidateState( GLcontext *ctx )
/* Need these for lighting (shouldn't upload otherwise)
*/
if (new_state & (_NEW_MODELVIEW)) {
- upload_matrix( rmesa, ctx->ModelView.m, R200_MTX_MV );
- upload_matrix_t( rmesa, ctx->ModelView.inv, R200_MTX_IMV );
+ upload_matrix( rmesa, ctx->ModelviewMatrixStack.Top->m, R200_MTX_MV );
+ upload_matrix_t( rmesa, ctx->ModelviewMatrixStack.Top->inv, R200_MTX_IMV );
}
/* Does this need to be triggered on eg. modelview for
@@ -2038,7 +2048,7 @@ void r200ValidateState( GLcontext *ctx )
/* emit all active clip planes if projection matrix changes.
*/
if (new_state & (_NEW_PROJECTION)) {
- if (ctx->Transform._AnyClip)
+ if (ctx->Transform.ClipPlanesEnabled)
r200UpdateClipPlanes( ctx );
}
@@ -2093,7 +2103,8 @@ void r200InitStateFuncs( GLcontext *ctx )
ctx->Driver.UpdateState = r200InvalidateState;
ctx->Driver.LightingSpaceChange = r200LightingSpaceChange;
- ctx->Driver.SetDrawBuffer = r200SetDrawBuffer;
+ ctx->Driver.DrawBuffer = r200DrawBuffer;
+ ctx->Driver.ReadBuffer = r200ReadBuffer;
ctx->Driver.AlphaFunc = r200AlphaFunc;
ctx->Driver.BlendEquation = r200BlendEquation;
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_state_init.c b/xc/lib/GL/mesa/src/drv/r200/r200_state_init.c
index b26fc8876..34947e5bf 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_state_init.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_state_init.c
@@ -32,19 +32,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_tcl.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
#include "mmath.h"
#include "enums.h"
#include "colormac.h"
-#include "light.h"
#include "api_arrayelt.h"
#include "swrast/swrast.h"
@@ -53,6 +45,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
+#include "r200_context.h"
+#include "r200_ioctl.h"
+#include "r200_state.h"
+#include "r200_tcl.h"
+#include "r200_tex.h"
+#include "r200_swtcl.h"
+#include "r200_vtxfmt.h"
+
+
/* =============================================================
* State initialization
*/
@@ -138,16 +139,16 @@ static GLboolean check_firsttime( GLcontext *ctx, int idx )
}
CHECK( always, GL_TRUE )
-CHECK( tex_any, ctx->Texture._ReallyEnabled )
+CHECK( tex_any, ctx->Texture._EnabledUnits )
CHECK( tex, ctx->Texture.Unit[idx]._ReallyEnabled )
CHECK( fog, ctx->Fog.Enabled )
TCL_CHECK( tcl, GL_TRUE )
-TCL_CHECK( tcl_tex_any, ctx->Texture._ReallyEnabled )
+TCL_CHECK( tcl_tex_any, ctx->Texture._EnabledUnits )
TCL_CHECK( tcl_tex, ctx->Texture.Unit[idx]._ReallyEnabled )
TCL_CHECK( tcl_lighting, ctx->Light.Enabled )
TCL_CHECK( tcl_eyespace_or_lighting, ctx->_NeedEyeCoords || ctx->Light.Enabled )
TCL_CHECK( tcl_light, ctx->Light.Enabled && ctx->Light.Light[idx].Enabled )
-TCL_CHECK( tcl_ucp, ctx->Transform.ClipEnabled[idx] )
+TCL_CHECK( tcl_ucp, (ctx->Transform.ClipPlanesEnabled & (1 << idx)) )
/* TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords || ctx->Fog.Enabled ) */
@@ -252,6 +253,8 @@ void r200InitState( r200ContextPtr rmesa )
ALLOC_STATE( tf, tex_any, TF_STATE_SIZE, "TF/tfactor", 0 );
ALLOC_STATE( tex[0], tex_any, TEX_STATE_SIZE, "TEX/tex-0", 0 );
ALLOC_STATE( tex[1], tex_any, TEX_STATE_SIZE, "TEX/tex-1", 1 );
+ ALLOC_STATE( cube[0], tex_any, CUBE_STATE_SIZE, "CUBE/tex-0", 0 );
+ ALLOC_STATE( cube[1], tex_any, CUBE_STATE_SIZE, "CUBE/tex-1", 1 );
ALLOC_STATE( tcl, tcl, TCL_STATE_SIZE, "TCL/tcl", 0 );
ALLOC_STATE( msl, tcl, MSL_STATE_SIZE, "MSL/matrix-select", 0 );
@@ -308,6 +311,10 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.tex[0].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_0);
rmesa->hw.tex[1].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_1);
rmesa->hw.tex[1].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_1);
+ rmesa->hw.cube[0].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_0);
+ rmesa->hw.cube[0].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_0);
+ rmesa->hw.cube[1].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_1);
+ rmesa->hw.cube[1].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_1);
rmesa->hw.pix[0].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_0);
rmesa->hw.pix[1].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_1);
rmesa->hw.zbs.cmd[ZBS_CMD_0] = cmdpkt(RADEON_EMIT_SE_ZBIAS_FACTOR);
@@ -358,8 +365,8 @@ void r200InitState( r200ContextPtr rmesa )
/* Initial Harware state:
*/
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = (R200_ALPHA_TEST_PASS |
- R200_RIGHT_HAND_CUBE_OGL);
+ rmesa->hw.ctx.cmd[CTX_PP_MISC] = (R200_ALPHA_TEST_PASS
+ /* | R200_RIGHT_HAND_CUBE_OGL*/);
rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] = (R200_FOG_VERTEX |
R200_FOG_USE_SPEC_ALPHA);
@@ -470,16 +477,25 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = 0x00000000;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = 0x00000000;
- rmesa->hw.tex[0].cmd[TEX_PP_TXFILTER] = R200_BORDER_MODE_OGL;
- rmesa->hw.tex[0].cmd[TEX_PP_TXFORMAT] =
- (R200_TXFORMAT_ST_ROUTE_STQ0 |
- (2 << R200_TXFORMAT_WIDTH_SHIFT) |
- (2 << R200_TXFORMAT_HEIGHT_SHIFT));
- rmesa->hw.tex[0].cmd[TEX_PP_TXOFFSET] = 0;
- rmesa->hw.tex[0].cmd[TEX_PP_BORDER_COLOR] = 0;
- rmesa->hw.tex[0].cmd[TEX_PP_TXFORMAT_X] =
- (/* R200_TEXCOORD_PROJ | */
- 0x100000); /* Small default bias */
+ for (i = 0; i < 2; i++) { /* 2 texture units for now */
+ rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] = R200_BORDER_MODE_OGL;
+ rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT] =
+ ((i << R200_TXFORMAT_ST_ROUTE_SHIFT) | /* <-- note i */
+ (2 << R200_TXFORMAT_WIDTH_SHIFT) |
+ (2 << R200_TXFORMAT_HEIGHT_SHIFT));
+ rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET] = 0;
+ rmesa->hw.tex[i].cmd[TEX_PP_BORDER_COLOR] = 0;
+ rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT_X] =
+ (/* R200_TEXCOORD_PROJ | */
+ 0x100000); /* Small default bias */
+
+ rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_FACES] = 0;
+ rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F1] = 0;
+ rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F2] = 0;
+ rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F3] = 0;
+ rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F4] = 0;
+ rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F5] = 0;
+ }
rmesa->hw.pix[0].cmd[PIX_PP_TXCBLEND] =
(R200_TXC_ARG_A_ZERO |
@@ -505,17 +521,6 @@ void r200InitState( r200ContextPtr rmesa )
R200_TXA_CLAMP_0_1 |
R200_TXA_OUTPUT_REG_R0);
- rmesa->hw.tex[1].cmd[TEX_PP_TXFILTER] = R200_BORDER_MODE_OGL;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] =
- (R200_TXFORMAT_ST_ROUTE_STQ1 |
- (2 << R200_TXFORMAT_WIDTH_SHIFT) |
- (2 << R200_TXFORMAT_HEIGHT_SHIFT));
- rmesa->hw.tex[1].cmd[TEX_PP_TXOFFSET] = 0;
- rmesa->hw.tex[1].cmd[TEX_PP_BORDER_COLOR] = 0;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT_X] =
- (/* R200_TEXCOORD_PROJ | */
- 0x100000); /* Small default bias */
-
rmesa->hw.pix[1].cmd[PIX_PP_TXCBLEND] =
(R200_TXC_ARG_A_ZERO |
R200_TXC_ARG_B_ZERO |
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c b/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c
index b0d624f9e..491fa51a7 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c
@@ -36,10 +36,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mtypes.h"
#include "colormac.h"
#include "enums.h"
-#include "mem.h"
+#include "image.h"
+#include "imports.h"
#include "mmath.h"
#include "macros.h"
+#include "swrast/s_fog.h"
#include "swrast_setup/swrast_setup.h"
#include "math/m_translate.h"
#include "tnl/tnl.h"
@@ -372,9 +374,9 @@ void r200ChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR))
ind |= R200_SPEC_BIT;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
+ if (ctx->Texture._EnabledUnits & 0x2) /* unit 1 enabled */
ind |= R200_TEX0_BIT|R200_TEX1_BIT;
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
+ else if (ctx->Texture._EnabledUnits & 0x1) /* unit 1 enabled */
ind |= R200_TEX0_BIT;
r200SetVertexFormat( ctx, ind );
@@ -532,7 +534,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_CLIP;
+ R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
}
static void ELT_FALLBACK( GLcontext *ctx,
@@ -544,7 +546,7 @@ static void ELT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_CLIP;
+ R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
}
@@ -672,20 +674,20 @@ static GLboolean r200_run_render( GLcontext *ctx,
static void r200_check_render( GLcontext *ctx,
struct gl_pipeline_stage *stage )
{
- GLuint inputs = VERT_OBJ|VERT_CLIP|VERT_RGBA;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
if (ctx->Fog.Enabled)
- inputs |= VERT_FOG_COORD;
+ inputs |= VERT_BIT_FOG;
}
stage->inputs = inputs;
@@ -1119,7 +1121,7 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
GLfloat f;
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
- f = _mesa_z_to_fogfactor(ctx, ctx->Current.FogCoord);
+ f = _mesa_z_to_fogfactor(ctx, ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
else
f = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tcl.c b/xc/lib/GL/mesa/src/drv/r200/r200_tcl.c
index 772800d2d..46bd018f8 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tcl.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_tcl.c
@@ -32,14 +32,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-#include "r200_swtcl.h"
-#include "r200_maos.h"
-
+#include "glheader.h"
+#include "imports.h"
#include "mmath.h"
#include "mtypes.h"
#include "enums.h"
@@ -50,6 +44,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
+#include "r200_context.h"
+#include "r200_state.h"
+#include "r200_ioctl.h"
+#include "r200_tex.h"
+#include "r200_tcl.h"
+#include "r200_swtcl.h"
+#include "r200_maos.h"
+
#define HAVE_POINTS 1
@@ -320,7 +322,7 @@ static void r200_check_tcl_render( GLcontext *ctx,
struct gl_pipeline_stage *stage )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint inputs = VERT_OBJ;
+ GLuint inputs = VERT_BIT_POS;
/* Validate state:
*/
@@ -338,37 +340,37 @@ static void r200_check_tcl_render( GLcontext *ctx,
/* Make all this event-driven:
*/
if (ctx->Light.Enabled) {
- inputs |= VERT_NORM;
+ inputs |= VERT_BIT_NORMAL;
if (ctx->Light.ColorMaterialEnabled) {
- inputs |= VERT_RGBA;
+ inputs |= VERT_BIT_COLOR0;
}
}
else {
- inputs |= VERT_RGBA;
+ inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
}
}
if (ctx->Texture.Unit[0]._ReallyEnabled) {
if (ctx->Texture.Unit[0].TexGenEnabled) {
if (rmesa->TexGenNeedNormals[0]) {
- inputs |= VERT_NORM;
+ inputs |= VERT_BIT_NORMAL;
}
} else {
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
}
}
if (ctx->Texture.Unit[1]._ReallyEnabled) {
if (ctx->Texture.Unit[1].TexGenEnabled) {
if (rmesa->TexGenNeedNormals[1]) {
- inputs |= VERT_NORM;
+ inputs |= VERT_BIT_NORMAL;
}
} else {
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
}
}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tex.c b/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
index bc41dd863..d9efd101a 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
@@ -32,29 +32,30 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_swtcl.h"
-#include "r200_tex.h"
-
+#include "glheader.h"
+#include "imports.h"
#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "image.h"
-#include "mem.h"
#include "mmath.h"
#include "simple_list.h"
#include "texformat.h"
#include "texstore.h"
#include "texutil.h"
+#include "r200_context.h"
+#include "r200_state.h"
+#include "r200_ioctl.h"
+#include "r200_swtcl.h"
+#include "r200_tex.h"
+
/* =============================================================
* Utility functions:
*/
-static void r200SetTexWrap( r200TexObjPtr t, GLenum swrap, GLenum twrap )
+static void r200SetTexWrap( r200TexObjPtr t, GLenum swrap, GLenum twrap, GLenum rwrap )
{
t->pp_txfilter &= ~(R200_CLAMP_S_MASK | R200_CLAMP_T_MASK);
@@ -68,6 +69,20 @@ static void r200SetTexWrap( r200TexObjPtr t, GLenum swrap, GLenum twrap )
case GL_CLAMP_TO_EDGE:
t->pp_txfilter |= R200_CLAMP_S_CLAMP_LAST;
break;
+ case GL_CLAMP_TO_BORDER:
+ t->pp_txfilter |= R200_CLAMP_S_CLAMP_BORDER;
+ break;
+ case GL_MIRRORED_REPEAT_ARB:
+ t->pp_txfilter |= R200_CLAMP_S_MIRROR;
+ break;
+ case GL_MIRROR_CLAMP_ATI:
+ t->pp_txfilter |= R200_CLAMP_S_MIRROR_CLAMP_BORDER;
+ break;
+ case GL_MIRROR_CLAMP_TO_EDGE_ATI:
+ t->pp_txfilter |= R200_CLAMP_S_MIRROR_CLAMP_LAST;
+ break;
+ default:
+ _mesa_problem(NULL, "bad S wrap mode in r200SetTexWrap");
}
switch ( twrap ) {
@@ -80,6 +95,48 @@ static void r200SetTexWrap( r200TexObjPtr t, GLenum swrap, GLenum twrap )
case GL_CLAMP_TO_EDGE:
t->pp_txfilter |= R200_CLAMP_T_CLAMP_LAST;
break;
+ case GL_CLAMP_TO_BORDER:
+ t->pp_txfilter |= R200_CLAMP_T_CLAMP_BORDER;
+ break;
+ case GL_MIRRORED_REPEAT_ARB:
+ t->pp_txfilter |= R200_CLAMP_T_MIRROR;
+ break;
+ case GL_MIRROR_CLAMP_ATI:
+ t->pp_txfilter |= R200_CLAMP_T_MIRROR_CLAMP_BORDER;
+ break;
+ case GL_MIRROR_CLAMP_TO_EDGE_ATI:
+ t->pp_txfilter |= R200_CLAMP_T_MIRROR_CLAMP_LAST;
+ break;
+ default:
+ _mesa_problem(NULL, "bad S wrap mode in r200SetTexWrap");
+ }
+
+ t->pp_txformat_x &= ~R200_CLAMP_Q_MASK;
+
+ switch ( rwrap ) {
+ case GL_REPEAT:
+ t->pp_txformat_x |= R200_CLAMP_Q_WRAP;
+ break;
+ case GL_CLAMP:
+ t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_LAST;
+ break;
+ case GL_CLAMP_TO_EDGE:
+ t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_LAST;
+ break;
+ case GL_CLAMP_TO_BORDER:
+ t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_BORDER;
+ break;
+ case GL_MIRRORED_REPEAT_ARB:
+ t->pp_txformat_x |= R200_CLAMP_Q_MIRROR;
+ break;
+ case GL_MIRROR_CLAMP_ATI:
+ t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_BORDER;
+ break;
+ case GL_MIRROR_CLAMP_TO_EDGE_ATI:
+ t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_LAST;
+ break;
+ default:
+ _mesa_problem(NULL, "bad R wrap mode in r200SetTexWrap");
}
}
@@ -105,6 +162,7 @@ static void r200SetTexFilter( r200TexObjPtr t, GLenum minf, GLenum magf )
GLuint anisotropy = (t->pp_txfilter & R200_MAX_ANISO_MASK);
t->pp_txfilter &= ~(R200_MIN_FILTER_MASK | R200_MAG_FILTER_MASK);
+ t->pp_txformat_x &= ~R200_VOLUME_FILTER_MASK;
if ( anisotropy == R200_MAX_ANISO_1_TO_1 ) {
switch ( minf ) {
@@ -146,12 +204,17 @@ static void r200SetTexFilter( r200TexObjPtr t, GLenum minf, GLenum magf )
}
}
+ /* Note we don't have 3D mipmaps so only use the mag filter setting
+ * to set the 3D texture filter mode.
+ */
switch ( magf ) {
case GL_NEAREST:
t->pp_txfilter |= R200_MAG_FILTER_NEAREST;
+ t->pp_txformat_x |= R200_VOLUME_FILTER_NEAREST;
break;
case GL_LINEAR:
t->pp_txfilter |= R200_MAG_FILTER_LINEAR;
+ t->pp_txformat_x |= R200_VOLUME_FILTER_LINEAR;
break;
}
}
@@ -179,10 +242,10 @@ static r200TexObjPtr r200AllocTexObj( struct gl_texture_object *texObj )
/* Initialize non-image-dependent parts of the state:
*/
- r200SetTexWrap( t, texObj->WrapS, texObj->WrapT );
+ r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR );
r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r200SetTexBorderColor( t, texObj->BorderColor );
+ r200SetTexBorderColor( t, texObj->_BorderChan );
return t;
}
@@ -422,7 +485,7 @@ static void r200TexImage1D( GLcontext *ctx, GLenum target, GLint level,
width, border, format, type, pixels,
&ctx->Unpack, texObj, texImage);
- t->dirty_images |= (1 << level);
+ t->dirty_images[0] |= (1 << level);
}
@@ -441,7 +504,7 @@ static void r200TexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
assert( t ); /* this _should_ be true */
if ( t ) {
r200SwapOutTexObj( rmesa, t );
- t->dirty_images |= (1 << level);
+ t->dirty_images[0] |= (1 << level);
}
else {
t = r200AllocTexObj(texObj);
@@ -456,7 +519,7 @@ static void r200TexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
format, type, pixels, packing, texObj,
texImage);
- t->dirty_images |= (1 << level);
+ t->dirty_images[0] |= (1 << level);
}
@@ -470,6 +533,22 @@ static void r200TexImage2D( GLcontext *ctx, GLenum target, GLint level,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
r200TexObjPtr t = (r200TexObjPtr)texObj->DriverData;
+ GLuint face;
+
+ /* which cube face or ordinary 2D image */
+ switch (target) {
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ ASSERT(face < 6);
+ break;
+ default:
+ face = 0;
+ }
if ( t ) {
r200SwapOutTexObj( rmesa, t );
@@ -507,7 +586,7 @@ static void r200TexImage2D( GLcontext *ctx, GLenum target, GLint level,
width, height, border, format, type, pixels,
&ctx->Unpack, texObj, texImage);
- t->dirty_images |= (1 << level);
+ t->dirty_images[face] |= (1 << level);
}
}
@@ -523,9 +602,25 @@ static void r200TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
r200TexObjPtr t = (r200TexObjPtr) texObj->DriverData;
+ GLuint face;
/* fprintf(stderr, "%s\n", __FUNCTION__); */
+ /* which cube face or ordinary 2D image */
+ switch (target) {
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ ASSERT(face < 6);
+ break;
+ default:
+ face = 0;
+ }
+
assert( t ); /* this _should_ be true */
if ( t ) {
r200SwapOutTexObj( rmesa, t );
@@ -543,10 +638,104 @@ static void r200TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
height, format, type, pixels, packing, texObj,
texImage);
- t->dirty_images |= (1 << level);
+ t->dirty_images[face] |= (1 << level);
}
+static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint depth,
+ GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage )
+{
+ r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ r200TexObjPtr t = (r200TexObjPtr)texObj->DriverData;
+
+ if ( t ) {
+ r200SwapOutTexObj( rmesa, t );
+ }
+ else {
+ t = r200AllocTexObj( texObj );
+ if (!t) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
+ return;
+ }
+ texObj->DriverData = t;
+ }
+
+ texImage->IsClientData = GL_FALSE;
+
+#if 0
+ if (r200ValidateClientStorage( ctx, target,
+ internalFormat,
+ width, height,
+ format, type, pixels,
+ packing, texObj, texImage)) {
+ if (R200_DEBUG & DEBUG_TEXTURE)
+ fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
+ }
+ else
+#endif
+ {
+ if (R200_DEBUG & DEBUG_TEXTURE)
+ fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
+
+ /* Normal path: copy (to cached memory) and eventually upload
+ * via another copy to agp memory and then a blit... Could
+ * eliminate one copy by going straight to (permanent) agp.
+ *
+ * Note, this will call r200ChooseTextureFormat.
+ */
+ _mesa_store_teximage3d(ctx, target, level, internalFormat,
+ width, height, depth, border,
+ format, type, pixels,
+ &ctx->Unpack, texObj, texImage);
+
+ t->dirty_images[0] |= (1 << level);
+ }
+}
+
+
+static void
+r200TexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type,
+ const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage )
+{
+ r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ r200TexObjPtr t = (r200TexObjPtr) texObj->DriverData;
+
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
+ assert( t ); /* this _should_ be true */
+ if ( t ) {
+ r200SwapOutTexObj( rmesa, t );
+ }
+ else {
+ t = r200AllocTexObj(texObj);
+ if (!t) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
+ return;
+ }
+ texObj->DriverData = t;
+ }
+
+ _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, type, pixels, packing, texObj, texImage);
+
+ t->dirty_images[0] |= (1 << level);
+}
+
+
+
static void r200TexEnv( GLcontext *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
@@ -628,11 +817,12 @@ static void r200TexParameter( GLcontext *ctx, GLenum target,
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
- r200SetTexWrap( t, texObj->WrapS, texObj->WrapT );
+ case GL_TEXTURE_WRAP_R:
+ r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR );
break;
case GL_TEXTURE_BORDER_COLOR:
- r200SetTexBorderColor( t, texObj->BorderColor );
+ r200SetTexBorderColor( t, texObj->_BorderChan );
break;
case GL_TEXTURE_BASE_LEVEL:
@@ -763,10 +953,18 @@ void r200InitTextureFuncs( GLcontext *ctx )
ctx->Driver.ChooseTextureFormat = r200ChooseTextureFormat;
ctx->Driver.TexImage1D = r200TexImage1D;
ctx->Driver.TexImage2D = r200TexImage2D;
+#if ENABLE_HW_3D_TEXTURE
+ ctx->Driver.TexImage3D = r200TexImage3D;
+#else
ctx->Driver.TexImage3D = _mesa_store_teximage3d;
+#endif
ctx->Driver.TexSubImage1D = r200TexSubImage1D;
ctx->Driver.TexSubImage2D = r200TexSubImage2D;
+#if ENABLE_HW_3D_TEXTURE
+ ctx->Driver.TexSubImage3D = r200TexSubImage3D;
+#else
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
+#endif
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tex.h b/xc/lib/GL/mesa/src/drv/r200/r200_tex.h
index 1b3adb8ab..17230ae99 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tex.h
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_tex.h
@@ -39,7 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
extern void r200UpdateTextureState( GLcontext *ctx );
-extern int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t );
+extern int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face );
extern void r200AgeTextures( r200ContextPtr rmesa, int heap );
extern void r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t );
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c b/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c
index c1f8dba69..32624ab18 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c
@@ -36,6 +36,13 @@ SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "colormac.h"
+#include "mmath.h"
+#include "macros.h"
+#include "simple_list.h"
#include "radeon_reg.h" /* gets definition for usleep */
#include "r200_context.h"
#include "r200_state.h"
@@ -43,15 +50,8 @@ SOFTWARE.
#include "r200_swtcl.h"
#include "r200_tex.h"
-#include "context.h"
-#include "colormac.h"
-#include "mmath.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "mem.h"
+#include <unistd.h> /* for usleep() */
-#undef usleep
/* Destroy hardware state associated with texture `t'.
*/
@@ -77,12 +77,16 @@ void r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t )
rmesa->state.texture.unit[0].texobj = NULL;
remove_from_list( &rmesa->hw.tex[0] );
make_empty_list( &rmesa->hw.tex[0] );
+ remove_from_list( &rmesa->hw.cube[0] );
+ make_empty_list( &rmesa->hw.cube[0] );
}
if ( t == rmesa->state.texture.unit[1].texobj ) {
rmesa->state.texture.unit[1].texobj = NULL;
remove_from_list( &rmesa->hw.tex[1] );
make_empty_list( &rmesa->hw.tex[1] );
+ remove_from_list( &rmesa->hw.cube[1] );
+ make_empty_list( &rmesa->hw.cube[1] );
}
}
@@ -95,6 +99,8 @@ void r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t )
*/
void r200SwapOutTexObj( r200ContextPtr rmesa, r200TexObjPtr t )
{
+ GLuint face;
+
if ( R200_DEBUG & DEBUG_TEXTURE ) {
fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, t, t->tObj );
}
@@ -104,7 +110,8 @@ void r200SwapOutTexObj( r200ContextPtr rmesa, r200TexObjPtr t )
t->memBlock = NULL;
}
- t->dirty_images = ~0;
+ for (face = 0; face < 6; face++)
+ t->dirty_images[face] = ~0;
move_to_tail( &rmesa->texture.swapped, t );
}
@@ -326,26 +333,36 @@ static void r200UploadAGPClientSubImage( r200ContextPtr rmesa,
GLint width, GLint height )
{
const struct gl_texture_format *texFormat = texImage->TexFormat;
- GLuint pitch = t->image[0].width * texFormat->TexelBytes;
+ GLuint srcPitch, dstPitch;
int blit_format;
int srcOffset;
-
+ /*
+ * XXX it appears that we always upload the full image, not a subimage.
+ * I.e. x==0, y==0, width=texWidth, height=texWidth. If this is ever
+ * changed, the src pitch will have to change.
+ */
switch ( texFormat->TexelBytes ) {
case 1:
blit_format = R200_CP_COLOR_FORMAT_CI8;
+ srcPitch = t->image[0][0].width * texFormat->TexelBytes;
+ dstPitch = t->image[0][0].width * texFormat->TexelBytes;
break;
case 2:
blit_format = R200_CP_COLOR_FORMAT_RGB565;
+ srcPitch = t->image[0][0].width * texFormat->TexelBytes;
+ dstPitch = t->image[0][0].width * texFormat->TexelBytes;
break;
case 4:
blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
+ srcPitch = t->image[0][0].width * texFormat->TexelBytes;
+ dstPitch = t->image[0][0].width * texFormat->TexelBytes;
break;
default:
return;
}
- t->image[hwlevel].data = texImage->Data;
+ t->image[0][hwlevel].data = texImage->Data;
srcOffset = r200AgpOffsetFromVirtual( rmesa, texImage->Data );
assert( srcOffset != ~0 );
@@ -358,14 +375,14 @@ static void r200UploadAGPClientSubImage( r200ContextPtr rmesa,
r200EmitWait( rmesa, RADEON_WAIT_3D );
r200EmitBlit( rmesa, blit_format,
- pitch,
+ srcPitch,
srcOffset,
- t->image[0].width * texFormat->TexelBytes, /* dst pitch! */
+ dstPitch,
t->bufAddr,
x,
y,
- t->image[hwlevel].x + x,
- t->image[hwlevel].y + y,
+ t->image[0][hwlevel].x + x,
+ t->image[0][hwlevel].y + y,
width,
height );
@@ -379,7 +396,7 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa,
GLint width, GLint height )
{
const struct gl_texture_format *texFormat = texImage->TexFormat;
- int blit_format, blit_pitch, done;
+ int blit_format, dstPitch, done;
switch ( texFormat->TexelBytes ) {
case 1:
@@ -395,13 +412,13 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa,
return;
}
- t->image[0].data = texImage->Data;
+ t->image[0][0].data = texImage->Data;
/* Currently don't need to cope with small pitches.
*/
width = texImage->Width;
height = texImage->Height;
- blit_pitch = t->pp_txpitch + 32;
+ dstPitch = t->pp_txpitch + 32;
if (rmesa->prefer_agp_client_texturing && texImage->IsClientData) {
/* In this case, could also use agp texturing. This is
@@ -425,11 +442,13 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa,
else if (texImage->IsClientData) {
/* Data already in agp memory, with usable pitch.
*/
+ GLuint srcPitch;
+ srcPitch = texImage->RowStride * texFormat->TexelBytes;
r200EmitBlit( rmesa,
blit_format,
- texImage->RowStride * texFormat->TexelBytes,
+ srcPitch,
r200AgpOffsetFromVirtual( rmesa, texImage->Data ),
- blit_pitch, t->bufAddr,
+ dstPitch, t->bufAddr,
0, 0,
0, 0,
width, height );
@@ -439,20 +458,24 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa,
*/
for (done = 0; done < height ; ) {
struct r200_dma_region region;
- int lines = MIN2( height - done, RADEON_BUFFER_SIZE / blit_pitch );
- int src_pitch = texImage->RowStride * texFormat->TexelBytes;
- char *tex = (char *)texImage->Data + done * src_pitch;
+ int lines = MIN2( height - done, RADEON_BUFFER_SIZE / dstPitch );
+ int src_pitch;
+ char *tex;
+
+ src_pitch = texImage->RowStride * texFormat->TexelBytes;
+
+ tex = (char *)texImage->Data + done * src_pitch;
memset(&region, 0, sizeof(region));
- r200AllocDmaRegion( rmesa, &region, lines * blit_pitch, 64 );
+ r200AllocDmaRegion( rmesa, &region, lines * dstPitch, 64 );
/* Copy texdata to dma:
*/
if (0)
- fprintf(stderr, "%s: src_pitch %d blit_pitch %d\n",
- __FUNCTION__, src_pitch, blit_pitch);
+ fprintf(stderr, "%s: src_pitch %d dst_pitch %d\n",
+ __FUNCTION__, src_pitch, dstPitch);
- if (src_pitch == blit_pitch) {
+ if (src_pitch == dstPitch) {
memcpy( region.address, tex, lines * src_pitch );
}
else {
@@ -460,7 +483,7 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa,
int i;
for (i = 0 ; i < lines ; i++) {
memcpy( buf, tex, src_pitch );
- buf += blit_pitch;
+ buf += dstPitch;
tex += src_pitch;
}
}
@@ -471,8 +494,8 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa,
*/
r200EmitBlit( rmesa,
blit_format,
- blit_pitch, GET_START( &region ),
- blit_pitch, t->bufAddr,
+ dstPitch, GET_START( &region ),
+ dstPitch, t->bufAddr,
0, 0,
0, done,
width, lines );
@@ -492,9 +515,10 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa,
static void r200UploadSubImage( r200ContextPtr rmesa,
r200TexObjPtr t,
GLint hwlevel,
- GLint x, GLint y, GLint width, GLint height )
+ GLint x, GLint y, GLint width, GLint height,
+ GLuint face )
{
- struct gl_texture_image *texImage;
+ struct gl_texture_image *texImage = NULL;
const struct gl_texture_format *texFormat;
GLint texelsPerDword = 0;
GLuint format, pitch, offset;
@@ -509,13 +533,35 @@ static void r200UploadSubImage( r200ContextPtr rmesa,
level, width, height);
}
+ ASSERT(face < 6);
+
/* Ensure we have a valid texture to upload */
if ( ( hwlevel < 0 ) || ( hwlevel >= RADEON_MAX_TEXTURE_LEVELS ) ) {
_mesa_problem(NULL, "bad texture level in r200UploadSubimage");
return;
}
- texImage = t->tObj->Image[level];
+ switch (face) {
+ case 0:
+ texImage = t->tObj->Image[level];
+ break;
+ case 1:
+ texImage = t->tObj->NegX[level];
+ break;
+ case 2:
+ texImage = t->tObj->PosY[level];
+ break;
+ case 3:
+ texImage = t->tObj->NegY[level];
+ break;
+ case 4:
+ texImage = t->tObj->PosZ[level];
+ break;
+ case 5:
+ texImage = t->tObj->NegZ[level];
+ break;
+ }
+
if ( !texImage ) {
if ( R200_DEBUG & DEBUG_TEXTURE )
fprintf( stderr, "%s: texImage %d is NULL!\n", __FUNCTION__, level );
@@ -569,17 +615,21 @@ static void r200UploadSubImage( r200ContextPtr rmesa,
imageHeight = texImage->Height;
offset = t->bufAddr;
- pitch = (t->image[0].width * texFormat->TexelBytes) / 64;
+
+ if (texFormat->TexelBytes == 0)
+ pitch = (t->image[face][0].width * 1) / 64;
+ else
+ pitch = (t->image[face][0].width * texFormat->TexelBytes) / 64;
if ( R200_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) )
{
GLint imageX = 0;
GLint imageY = 0;
- GLint blitX = t->image[hwlevel].x;
- GLint blitY = t->image[hwlevel].y;
- GLint blitWidth = t->image[hwlevel].width;
- GLint blitHeight = t->image[hwlevel].height;
+ GLint blitX = t->image[face][hwlevel].x;
+ GLint blitY = t->image[face][hwlevel].y;
+ GLint blitWidth = t->image[face][hwlevel].width;
+ GLint blitHeight = t->image[face][hwlevel].height;
fprintf( stderr, " upload image: %d,%d at %d,%d\n",
imageWidth, imageHeight, imageX, imageY );
fprintf( stderr, " upload blit: %d,%d at %d,%d\n",
@@ -589,16 +639,31 @@ static void r200UploadSubImage( r200ContextPtr rmesa,
(GLuint)offset, (GLuint)pitch, hwlevel, level, format );
}
- t->image[hwlevel].data = texImage->Data;
+ t->image[face][hwlevel].data = texImage->Data;
+ /* Init the DRM_RADEON_TEXTURE command / drmRadeonTexture struct.
+ * NOTE: we're always use a 1KB-wide blit and I8 texture format.
+ * We used to use 1, 2 and 4-byte texels and used to use the texture
+ * width to dictate the blit width - but that won't work for compressed
+ * textures. (Brian)
+ */
tex.offset = offset;
- tex.pitch = pitch;
- tex.format = format;
- tex.width = imageWidth;
- tex.height = imageHeight;
+ tex.pitch = BLIT_WIDTH_BYTES / 64;
+ tex.format = R200_TXFORMAT_I8; /* any 1-byte texel format */
+ if (texImage->TexFormat->TexelBytes) {
+ tex.width = imageWidth * texImage->TexFormat->TexelBytes; /* in bytes */
+ tex.height = imageHeight;
+ }
+ else {
+ tex.width = imageWidth; /* compressed */
+ tex.height = imageHeight;
+ if (tex.height < 4)
+ tex.height = 4;
+ }
tex.image = &tmp;
- memcpy( &tmp, &t->image[hwlevel], sizeof(drmRadeonTexImage) );
+ /* copy (x,y,width,height,data) */
+ memcpy( &tmp, &t->image[face][hwlevel], sizeof(drmRadeonTexImage) );
LOCK_HARDWARE( rmesa );
do {
@@ -620,8 +685,8 @@ static void r200UploadSubImage( r200ContextPtr rmesa,
fprintf( stderr, " image width=%d height=%d\n",
imageWidth, imageHeight );
fprintf( stderr, " blit width=%d height=%d data=%p\n",
- t->image[hwlevel].width, t->image[hwlevel].height,
- t->image[hwlevel].data );
+ t->image[face][hwlevel].width, t->image[face][hwlevel].height,
+ t->image[face][hwlevel].data );
exit( 1 );
}
}
@@ -632,7 +697,7 @@ static void r200UploadSubImage( r200ContextPtr rmesa,
* require removing our own and/or other client's texture objects to
* make room for these images.
*/
-int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t )
+int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face )
{
const int numLevels = t->lastLevel - t->firstLevel + 1;
int heap;
@@ -713,21 +778,20 @@ int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t )
UNLOCK_HARDWARE( rmesa );
/* Upload any images that are new */
- if (t->dirty_images) {
+ if (t->dirty_images[face]) {
int hwlevel;
for ( hwlevel = 0 ; hwlevel < numLevels ; hwlevel++ ) {
- if ( t->dirty_images & (1 << (hwlevel+t->firstLevel)) ) {
+ if ( t->dirty_images[face] & (1 << (hwlevel+t->firstLevel)) ) {
r200UploadSubImage( rmesa, t, hwlevel,
- 0, 0,
- t->image[hwlevel].width,
- t->image[hwlevel].height );
+ 0, 0,
+ t->image[face][hwlevel].width,
+ t->image[face][hwlevel].height, face );
}
}
- t->dirty_images = 0;
+ t->dirty_images[face] = 0;
}
-
if (R200_DEBUG & DEBUG_SYNC) {
fprintf(stderr, "\nSyncing\n\n");
r200Finish( rmesa->glCtx );
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c b/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c
index cd1bdbd2f..daeb9d2f5 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c
@@ -32,6 +32,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "macros.h"
+#include "mmath.h"
+#include "texformat.h"
+
#include "r200_context.h"
#include "r200_state.h"
#include "r200_ioctl.h"
@@ -39,28 +46,23 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_tex.h"
#include "r200_tcl.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "macros.h"
-#include "mem.h"
-#include "mmath.h"
-#include "simple_list.h"
-#include "texformat.h"
-
+/*
+ * This function computes the number of bytes of storage needed for
+ * the given texture object (all mipmap levels, all cube faces).
+ * The t->image[face][level].x/y/width/height parameters for upload/blitting
+ * are computed here.
+ * t->pp_txfilter, t->pp_txformat, etc. will be set here too.
+ */
static void r200SetTexImages( r200ContextPtr rmesa,
- struct gl_texture_object *tObj,
- GLenum target )
+ struct gl_texture_object *tObj )
{
r200TexObjPtr t = (r200TexObjPtr)tObj->DriverData;
const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- GLint totalSize;
- GLint texelsPerDword = 0, blitWidth = 0, blitPitch = 0;
- GLint x, y, width, height;
+ GLint curOffset;
GLint i;
GLint firstLevel=0, lastLevel=0, numLevels;
- GLint log2Width, log2Height;
+ GLint log2Width, log2Height, log2Depth;
GLuint txformat = 0;
t->pp_txfilter &= ~R200_YUV_TO_RGB;
@@ -110,44 +112,10 @@ static void r200SetTexImages( r200ContextPtr rmesa,
txformat == R200_TXFORMAT_ARGB8888 ||
txformat == R200_TXFORMAT_ARGB4444 ||
txformat == R200_TXFORMAT_ARGB1555 ||
- txformat == R200_TXFORMAT_AI88 ) {
+ txformat == R200_TXFORMAT_AI88) {
t->pp_txformat |= R200_TXFORMAT_ALPHA_IN_MAP;
}
- /* The R200 has a 64-byte minimum pitch for all blits. We
- * calculate the equivalent number of texels to simplify the
- * calculation of the texture image area.
- */
- switch ( baseImage->TexFormat->TexelBytes ) {
- case 1:
- texelsPerDword = 4;
- blitPitch = 64;
- break;
- case 2:
- texelsPerDword = 2;
- blitPitch = 32;
- break;
- case 4:
- texelsPerDword = 1;
- blitPitch = 16;
- break;
- default:
- assert(0);
- }
-
- /* Select the larger of the two widths for our global texture image
- * coordinate space. As the R200 has very strict offset rules, we
- * can't upload mipmaps directly and have to reference their location
- * from the aligned start of the whole image.
- */
- blitWidth = MAX2( baseImage->Width, blitPitch );
-
- /* Calculate mipmap offsets and dimensions.
- */
- totalSize = 0;
- x = 0;
- y = 0;
-
/* Compute which mipmap levels we really want to send to the hardware.
* This depends on the base image size, GL_TEXTURE_MIN_LOD,
* GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
@@ -161,9 +129,10 @@ static void r200SetTexImages( r200ContextPtr rmesa,
tObj->MaxLevel);
- switch (target) {
+ switch (tObj->Target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP:
firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
firstLevel = MAX2(firstLevel, tObj->BaseLevel);
lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
@@ -173,10 +142,19 @@ static void r200SetTexImages( r200ContextPtr rmesa,
lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
log2Width = tObj->Image[firstLevel]->WidthLog2;
log2Height = tObj->Image[firstLevel]->HeightLog2;
+ log2Depth = 0;
+ break;
+ case GL_TEXTURE_3D:
+ firstLevel = tObj->BaseLevel;
+ lastLevel = tObj->BaseLevel;
+ log2Width = tObj->Image[firstLevel]->WidthLog2;
+ log2Height = tObj->Image[firstLevel]->HeightLog2;
+ log2Depth = tObj->Image[firstLevel]->DepthLog2;
break;
case GL_TEXTURE_RECTANGLE_NV:
firstLevel = lastLevel = 0;
log2Width = log2Height = 1; /* ? */
+ log2Depth = 0;
break;
default:
return;
@@ -200,7 +178,13 @@ static void r200SetTexImages( r200ContextPtr rmesa,
assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS);
- for ( i = 0 ; i < numLevels ; i++ ) {
+ /* Calculate mipmap offsets and dimensions for blitting (uploading)
+ * The idea is that we lay out the mipmap levels within a block of
+ * memory organized as a rectangle of width BLIT_WIDTH_BYTES.
+ */
+ curOffset = 0;
+
+ for (i = 0; i < numLevels; i++) {
const struct gl_texture_image *texImage;
GLuint size;
@@ -208,61 +192,71 @@ static void r200SetTexImages( r200ContextPtr rmesa,
if ( !texImage )
break;
- width = texImage->Width;
- height = texImage->Height;
-
- /* Texture images have a minimum pitch of 32 bytes (half of the
- * 64-byte minimum pitch for blits). For images that have a
- * width smaller than this, we must pad each texture image
- * scanline out to this amount.
- */
- if ( width < blitPitch / 2 ) {
- width = blitPitch / 2;
+ /* find image size in bytes */
+ if (texImage->IsCompressed) {
+ size = texImage->CompressedSize;
}
-
- if (target == GL_TEXTURE_RECTANGLE_NV)
- size = ((width*baseImage->TexFormat->TexelBytes+63)&~63) * height;
- else
- size = width * height * baseImage->TexFormat->TexelBytes;
-
- totalSize += size;
-
- if (target != GL_TEXTURE_RECTANGLE_NV) {
- while ( width < blitWidth && height > 1 ) {
- width *= 2;
- height /= 2;
- }
+ else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
+ size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63)
+ & ~63) * texImage->Height;
}
+ else {
+ int w = texImage->Width * texImage->TexFormat->TexelBytes;
+ if (w < 32)
+ w = 32;
+ size = w * texImage->Height * texImage->Depth;
+ }
+ assert(size > 0);
- t->image[i].x = x;
- t->image[i].y = y;
- t->image[i].width = width;
- t->image[i].height = height;
-
- /* While blits must have a pitch of at least 64 bytes, mipmaps
- * must be aligned on a 32-byte boundary (just like each texture
- * image scanline).
- */
- if ( width >= blitWidth ) {
- y += height;
- } else {
- x += width;
- if ( x >= blitWidth ) {
- x = 0;
- y++;
- }
+ if (curOffset & 0x1f) {
+ /* align to 32-byte offset */
+ curOffset = (curOffset + 0x1f) & ~0x1f;
}
- if ( 0 )
- fprintf( stderr, "level=%d p=%d %dx%d -> %dx%d at (%d,%d)\n",
- i, blitWidth, baseImage->Width, baseImage->Height,
- t->image[i].width, t->image[i].height,
- t->image[i].x, t->image[i].y );
+ t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES;
+ t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES;
+ t->image[0][i].width = MIN2(size, BLIT_WIDTH_BYTES);
+ t->image[0][i].height = size / t->image[0][i].width;
+
+#if 0
+ /* for debugging only and only applicable to non-rectangle targets */
+ assert(size % t->image[0][i].width == 0);
+ assert(t->image[0][i].x == 0
+ || (size < BLIT_WIDTH_BYTES && t->image[0][i].height == 1));
+#endif
+ curOffset += size;
+
+ if (0)
+ fprintf(stderr,
+ "level %d: %dx%d x=%d y=%d w=%d h=%d size=%d at %d\n",
+ i, texImage->Width, texImage->Height,
+ t->image[0][i].x, t->image[0][i].y,
+ t->image[0][i].width, t->image[0][i].height, size, curOffset);
}
/* Align the total size of texture memory block.
*/
- t->totalSize = (totalSize + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK;
+ t->totalSize = (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK;
+
+ /* Setup remaining cube face blits, if needed */
+ if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
+ /* Round totalSize up to multiple of BLIT_WIDTH_BYTES */
+ const GLuint faceSize = (t->totalSize + BLIT_WIDTH_BYTES - 1)
+ & ~(BLIT_WIDTH_BYTES-1);
+ const GLuint lines = faceSize / BLIT_WIDTH_BYTES;
+ GLuint face;
+ /* reuse face 0 x/y/width/height - just adjust y */
+ for (face = 1; face < 6; face++) {
+ for (i = 0; i < numLevels; i++) {
+ t->image[face][i].x = t->image[0][i].x;
+ t->image[face][i].y = t->image[0][i].y + face * lines;
+ t->image[face][i].width = t->image[0][i].width;
+ t->image[face][i].height = t->image[0][i].height;
+ }
+ }
+ t->totalSize = 6 * faceSize; /* total texmem needed */
+ }
+
/* Hardware state:
*/
@@ -270,23 +264,50 @@ static void r200SetTexImages( r200ContextPtr rmesa,
t->pp_txfilter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
t->pp_txformat &= ~(R200_TXFORMAT_WIDTH_MASK |
- R200_TXFORMAT_HEIGHT_MASK);
+ R200_TXFORMAT_HEIGHT_MASK |
+ R200_TXFORMAT_CUBIC_MAP_ENABLE |
+ R200_TXFORMAT_F5_WIDTH_MASK |
+ R200_TXFORMAT_F5_HEIGHT_MASK);
t->pp_txformat |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
(log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
+ t->pp_txformat_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
+ if (tObj->Target == GL_TEXTURE_3D) {
+ t->pp_txformat_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT);
+ t->pp_txformat_x |= R200_TEXCOORD_VOLUME;
+ }
+ else if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
+ ASSERT(log2Width == log2height);
+ t->pp_txformat |= ((log2Width << R200_TXFORMAT_F5_WIDTH_SHIFT) |
+ (log2Height << R200_TXFORMAT_F5_HEIGHT_SHIFT) |
+ (R200_TXFORMAT_CUBIC_MAP_ENABLE));
+ t->pp_txformat_x |= R200_TEXCOORD_CUBIC_ENV;
+ t->pp_cubic_faces = ((log2Width << R200_FACE_WIDTH_1_SHIFT) |
+ (log2Height << R200_FACE_HEIGHT_1_SHIFT) |
+ (log2Width << R200_FACE_WIDTH_2_SHIFT) |
+ (log2Height << R200_FACE_HEIGHT_2_SHIFT) |
+ (log2Width << R200_FACE_WIDTH_3_SHIFT) |
+ (log2Height << R200_FACE_HEIGHT_3_SHIFT) |
+ (log2Width << R200_FACE_WIDTH_4_SHIFT) |
+ (log2Height << R200_FACE_HEIGHT_4_SHIFT));
+ }
+
t->pp_txsize = (((tObj->Image[firstLevel]->Width - 1) << 0) |
- ((tObj->Image[firstLevel]->Height - 1) << 16));
+ ((tObj->Image[firstLevel]->Height - 1) << 16));
/* Only need to round to nearest 32 for textures, but the blitter
* requires 64-byte aligned pitches, and we may/may not need the
- * blitter.
+ * blitter. NPOT only!
*/
- t->pp_txpitch = ((tObj->Image[firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63);
+ if (baseImage->IsCompressed)
+ t->pp_txpitch = (tObj->Image[firstLevel]->Width + 63) & ~(63);
+ else
+ t->pp_txpitch = ((tObj->Image[firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63);
t->pp_txpitch -= 32;
t->dirty_state = TEX_ALL;
- r200UploadTexImages( rmesa, t );
+ /* FYI: r200UploadTexImages( rmesa, t ) used to be called here */
}
@@ -1104,9 +1125,15 @@ static void r200UpdateTextureEnv( GLcontext *ctx, int unit )
#define TEXOBJ_TXFORMAT_MASK (R200_TXFORMAT_WIDTH_MASK | \
R200_TXFORMAT_HEIGHT_MASK | \
R200_TXFORMAT_FORMAT_MASK | \
+ R200_TXFORMAT_F5_WIDTH_MASK | \
+ R200_TXFORMAT_F5_HEIGHT_MASK | \
R200_TXFORMAT_ALPHA_IN_MAP | \
+ R200_TXFORMAT_CUBIC_MAP_ENABLE | \
R200_TXFORMAT_NON_POWER2)
+#define TEXOBJ_TXFORMAT_X_MASK (R200_DEPTH_LOG2_MASK | \
+ R200_TEXCOORD_MASK | \
+ R200_VOLUME_FILTER_MASK)
static void import_tex_obj_state( r200ContextPtr rmesa,
@@ -1119,13 +1146,28 @@ static void import_tex_obj_state( r200ContextPtr rmesa,
cmd[TEX_PP_TXFILTER] |= texobj->pp_txfilter & TEXOBJ_TXFILTER_MASK;
cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
cmd[TEX_PP_TXFORMAT] |= texobj->pp_txformat & TEXOBJ_TXFORMAT_MASK;
+ cmd[TEX_PP_TXFORMAT_X] &= ~TEXOBJ_TXFORMAT_X_MASK;
+ cmd[TEX_PP_TXFORMAT_X] |= texobj->pp_txformat_x & TEXOBJ_TXFORMAT_X_MASK;
cmd[TEX_PP_TXSIZE] = texobj->pp_txsize; /* NPOT only! */
cmd[TEX_PP_TXPITCH] = texobj->pp_txpitch; /* NPOT only! */
cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset;
cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color;
- texobj->dirty_state &= ~(1<<unit);
-
R200_DB_STATECHANGE( rmesa, &rmesa->hw.tex[unit] );
+
+ if (texobj->tObj->Target == GL_TEXTURE_CUBE_MAP) {
+ GLuint *cube_cmd = R200_DB_STATE( cube[unit] );
+ GLuint bytesPerFace = texobj->totalSize / 6;
+ ASSERT(texobj->totalSize % 6 == 0);
+ cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces;
+ cube_cmd[CUBE_PP_CUBIC_OFFSET_F1] = texobj->pp_txoffset + 1 * bytesPerFace;
+ cube_cmd[CUBE_PP_CUBIC_OFFSET_F2] = texobj->pp_txoffset + 2 * bytesPerFace;
+ cube_cmd[CUBE_PP_CUBIC_OFFSET_F3] = texobj->pp_txoffset + 3 * bytesPerFace;
+ cube_cmd[CUBE_PP_CUBIC_OFFSET_F4] = texobj->pp_txoffset + 4 * bytesPerFace;
+ cube_cmd[CUBE_PP_CUBIC_OFFSET_F5] = texobj->pp_txoffset + 5 * bytesPerFace;
+ R200_DB_STATECHANGE( rmesa, &rmesa->hw.cube[unit] );
+ }
+
+ texobj->dirty_state &= ~(1<<unit);
}
@@ -1133,13 +1175,15 @@ static void import_tex_obj_state( r200ContextPtr rmesa,
static void set_texgen_matrix( r200ContextPtr rmesa,
GLuint unit,
- GLfloat *s_plane,
- GLfloat *t_plane )
+ const GLfloat *s_plane,
+ const GLfloat *t_plane,
+ const GLfloat *r_plane )
{
static const GLfloat scale_identity[4] = { 1,1,1,1 };
if (!TEST_EQ_4V( s_plane, scale_identity) ||
- !(TEST_EQ_4V( t_plane, scale_identity))) {
+ !TEST_EQ_4V( t_plane, scale_identity) ||
+ !TEST_EQ_4V( r_plane, scale_identity)) {
rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
rmesa->TexGenMatrix[unit].m[0] = s_plane[0];
rmesa->TexGenMatrix[unit].m[4] = s_plane[1];
@@ -1150,10 +1194,46 @@ static void set_texgen_matrix( r200ContextPtr rmesa,
rmesa->TexGenMatrix[unit].m[5] = t_plane[1];
rmesa->TexGenMatrix[unit].m[9] = t_plane[2];
rmesa->TexGenMatrix[unit].m[13] = t_plane[3];
+
+ /* NOTE: r_plane goes in the 4th row, not 3rd! */
+ rmesa->TexGenMatrix[unit].m[3] = r_plane[0];
+ rmesa->TexGenMatrix[unit].m[7] = r_plane[1];
+ rmesa->TexGenMatrix[unit].m[11] = r_plane[2];
+ rmesa->TexGenMatrix[unit].m[15] = r_plane[3];
+
rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
}
}
+/* Need this special matrix to get correct reflection map coords */
+static void
+set_texgen_reflection_matrix( r200ContextPtr rmesa, GLuint unit )
+{
+ static const GLfloat m[16] = {
+ -1, 0, 0, 0,
+ 0, -1, 0, 0,
+ 0, 0, 0, -1,
+ 0, 0, -1, 0 };
+ _math_matrix_loadf( &(rmesa->TexGenMatrix[unit]), m);
+ _math_matrix_analyse( &(rmesa->TexGenMatrix[unit]) );
+ rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
+}
+
+/* Need this special matrix to get correct normal map coords */
+static void
+set_texgen_normal_map_matrix( r200ContextPtr rmesa, GLuint unit )
+{
+ static const GLfloat m[16] = {
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 0, 1,
+ 0, 0, 1, 0 };
+ _math_matrix_loadf( &(rmesa->TexGenMatrix[unit]), m);
+ _math_matrix_analyse( &(rmesa->TexGenMatrix[unit]) );
+ rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
+}
+
+
/* Ignoring the Q texcoord for now.
*
* Returns GL_FALSE if fallback required.
@@ -1161,7 +1241,7 @@ static void set_texgen_matrix( r200ContextPtr rmesa,
static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit*4;
GLuint tmp = rmesa->TexGenEnabled;
@@ -1174,7 +1254,7 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
if (0)
fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
- if ((texUnit->TexGenEnabled & (S_BIT|T_BIT)) == 0) {
+ if ((texUnit->TexGenEnabled & (S_BIT|T_BIT|R_BIT)) == 0) {
/* Disabled, no fallback:
*/
rmesa->TexGenInputs |=
@@ -1185,42 +1265,58 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
/* Very easy to do this, in fact would remove a fallback case
* elsewhere, but I haven't done it yet... Fallback:
*/
- fprintf(stderr, "fallback Q_BIT\n");
+ /*fprintf(stderr, "fallback Q_BIT\n");*/
return GL_FALSE;
}
- else if ((texUnit->TexGenEnabled & (S_BIT|T_BIT)) != (S_BIT|T_BIT) ||
- texUnit->GenModeS != texUnit->GenModeT) {
+ else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) &&
+ texUnit->GenModeS == texUnit->GenModeT) {
+ /* OK */
+ rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
+ /* continue */
+ }
+ else if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT) &&
+ texUnit->GenModeS == texUnit->GenModeT &&
+ texUnit->GenModeT == texUnit->GenModeR) {
+ /* OK */
+ rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
+ /* continue */
+ }
+ else {
/* Mixed modes, fallback:
*/
-/* fprintf(stderr, "fallback mixed texgen\n"); */
+ /* fprintf(stderr, "fallback mixed texgen\n"); */
return GL_FALSE;
}
- else
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
+
+ rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
switch (texUnit->GenModeS) {
case GL_OBJECT_LINEAR:
rmesa->TexGenInputs |= R200_TEXGEN_INPUT_OBJ << inputshift;
set_texgen_matrix( rmesa, unit,
texUnit->ObjectPlaneS,
- texUnit->ObjectPlaneT);
+ texUnit->ObjectPlaneT,
+ texUnit->ObjectPlaneR);
break;
case GL_EYE_LINEAR:
rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE << inputshift;
set_texgen_matrix( rmesa, unit,
texUnit->EyePlaneS,
- texUnit->EyePlaneT);
+ texUnit->EyePlaneT,
+ texUnit->EyePlaneR);
break;
case GL_REFLECTION_MAP_NV:
rmesa->TexGenNeedNormals[unit] = GL_TRUE;
rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE_REFLECT<<inputshift;
+ set_texgen_reflection_matrix(rmesa, unit);
break;
case GL_NORMAL_MAP_NV:
rmesa->TexGenNeedNormals[unit] = GL_TRUE;
rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE_NORMAL<<inputshift;
+ set_texgen_normal_map_matrix(rmesa, unit);
break;
case GL_SPHERE_MAP:
@@ -1305,12 +1401,42 @@ static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
*/
if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
- t->dirty_images = ~0;
+ t->dirty_images[0] = ~0;
+ }
+
+ ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D);
+
+ if ( t->dirty_images[0] ) {
+ R200_FIREVERTICES( rmesa );
+ r200SetTexImages( rmesa, tObj );
+ r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
+ if ( !t->memBlock )
+ return GL_FALSE;
}
+
+ return GL_TRUE;
+}
+
+static GLboolean enable_tex_3d( GLcontext *ctx, int unit )
+{
+ r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_texture_object *tObj = texUnit->_Current;
+ r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
+
+ /* Need to load the 3d images associated with this unit.
+ */
+ if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
+ t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
+ t->dirty_images[0] = ~0;
+ }
+
+ ASSERT(tObj->Target == GL_TEXTURE_3D);
- if ( t->dirty_images ) {
+ if ( t->dirty_images[0] ) {
R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj, GL_TEXTURE_2D );
+ r200SetTexImages( rmesa, tObj );
+ r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
if ( !t->memBlock )
return GL_FALSE;
}
@@ -1318,6 +1444,48 @@ static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
return GL_TRUE;
}
+static GLboolean enable_tex_cube( GLcontext *ctx, int unit )
+{
+ r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_texture_object *tObj = texUnit->_Current;
+ r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
+ GLuint face;
+
+ /* Need to load the 2d images associated with this unit.
+ */
+ if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
+ t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
+ for (face = 0; face < 6; face++)
+ t->dirty_images[face] = ~0;
+ }
+
+ ASSERT(tObj->Target == GL_TEXTURE_CUBE_MAP);
+
+ if ( t->dirty_images[0] || t->dirty_images[1] ||
+ t->dirty_images[2] || t->dirty_images[3] ||
+ t->dirty_images[4] || t->dirty_images[5] ) {
+ /* flush */
+ R200_FIREVERTICES( rmesa );
+ /* layout memory space, once for all faces */
+ r200SetTexImages( rmesa, tObj );
+ }
+
+ /* upload (per face) */
+ for (face = 0; face < 6; face++) {
+ if (t->dirty_images[face]) {
+ r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, face );
+ }
+ }
+
+ if ( !t->memBlock ) {
+ /* texmem alloc failed, use s/w fallback */
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
static GLboolean enable_tex_rect( GLcontext *ctx, int unit )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
@@ -1327,12 +1495,15 @@ static GLboolean enable_tex_rect( GLcontext *ctx, int unit )
if (!(t->pp_txformat & R200_TXFORMAT_NON_POWER2)) {
t->pp_txformat |= R200_TXFORMAT_NON_POWER2;
- t->dirty_images = ~0;
+ t->dirty_images[0] = ~0;
}
- if ( t->dirty_images ) {
+ ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV);
+
+ if ( t->dirty_images[0] ) {
R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj, GL_TEXTURE_RECTANGLE_NV );
+ r200SetTexImages( rmesa, tObj );
+ r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
if ( !t->memBlock && !rmesa->prefer_agp_client_texturing )
return GL_FALSE;
}
@@ -1404,14 +1575,24 @@ static GLboolean r200UpdateTextureUnit( GLcontext *ctx, int unit )
{
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if ( texUnit->_ReallyEnabled & (TEXTURE0_RECT) ) {
+ if ( texUnit->_ReallyEnabled & (TEXTURE_RECT_BIT) ) {
return (enable_tex_rect( ctx, unit ) &&
update_tex_common( ctx, unit ));
}
- else if ( texUnit->_ReallyEnabled & (TEXTURE0_1D|TEXTURE0_2D) ) {
+ else if ( texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ) {
return (enable_tex_2d( ctx, unit ) &&
update_tex_common( ctx, unit ));
}
+#if ENABLE_HW_3D_TEXTURE
+ else if ( texUnit->_ReallyEnabled & (TEXTURE_3D_BIT) ) {
+ return (enable_tex_3d( ctx, unit ) &&
+ update_tex_common( ctx, unit ));
+ }
+#endif
+ else if ( texUnit->_ReallyEnabled & (TEXTURE_CUBE_BIT) ) {
+ return (enable_tex_cube( ctx, unit ) &&
+ update_tex_common( ctx, unit ));
+ }
else if ( texUnit->_ReallyEnabled ) {
return GL_FALSE;
}
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
index 029ab2071..b768dd47f 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
@@ -33,6 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "glheader.h"
+#include "imports.h"
#include "r200_context.h"
#include "r200_state.h"
#include "r200_ioctl.h"
@@ -43,7 +44,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "api_noop.h"
#include "api_arrayelt.h"
#include "context.h"
-#include "mem.h"
#include "mmath.h"
#include "mtypes.h"
#include "enums.h"
@@ -111,30 +111,30 @@ void r200_copy_to_current( GLcontext *ctx )
assert(vb.context == ctx);
if (rmesa->vb.vtxfmt_0 & R200_VTX_N0) {
- ctx->Current.Normal[0] = vb.normalptr[0];
- ctx->Current.Normal[1] = vb.normalptr[1];
- ctx->Current.Normal[2] = vb.normalptr[2];
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0] = vb.normalptr[0];
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1] = vb.normalptr[1];
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2] = vb.normalptr[2];
}
switch( VTX_COLOR(rmesa->vb.vtxfmt_0, 0) ) {
case R200_VTX_PK_RGBA:
- ctx->Current.Color[0] = UBYTE_TO_FLOAT( vb.ubytecolorptr[0] );
- ctx->Current.Color[1] = UBYTE_TO_FLOAT( vb.ubytecolorptr[1] );
- ctx->Current.Color[2] = UBYTE_TO_FLOAT( vb.ubytecolorptr[2] );
- ctx->Current.Color[3] = UBYTE_TO_FLOAT( vb.ubytecolorptr[3] );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = UBYTE_TO_FLOAT( vb.ubytecolorptr[0] );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = UBYTE_TO_FLOAT( vb.ubytecolorptr[1] );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = UBYTE_TO_FLOAT( vb.ubytecolorptr[2] );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT( vb.ubytecolorptr[3] );
break;
case R200_VTX_FP_RGB:
- ctx->Current.Color[0] = vb.floatcolorptr[0];
- ctx->Current.Color[1] = vb.floatcolorptr[1];
- ctx->Current.Color[2] = vb.floatcolorptr[2];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = vb.floatcolorptr[0];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = vb.floatcolorptr[1];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = vb.floatcolorptr[2];
break;
case R200_VTX_FP_RGBA:
- ctx->Current.Color[0] = vb.floatcolorptr[0];
- ctx->Current.Color[1] = vb.floatcolorptr[1];
- ctx->Current.Color[2] = vb.floatcolorptr[2];
- ctx->Current.Color[3] = vb.floatcolorptr[3];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = vb.floatcolorptr[0];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = vb.floatcolorptr[1];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = vb.floatcolorptr[2];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = vb.floatcolorptr[3];
break;
default:
@@ -142,23 +142,23 @@ void r200_copy_to_current( GLcontext *ctx )
}
if (VTX_COLOR(rmesa->vb.vtxfmt_0, 1) == R200_VTX_PK_RGBA) {
- ctx->Current.SecondaryColor[0] = UBYTE_TO_FLOAT( vb.ubytespecptr[0] );
- ctx->Current.SecondaryColor[1] = UBYTE_TO_FLOAT( vb.ubytespecptr[1] );
- ctx->Current.SecondaryColor[2] = UBYTE_TO_FLOAT( vb.ubytespecptr[2] );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] = UBYTE_TO_FLOAT( vb.ubytespecptr[0] );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] = UBYTE_TO_FLOAT( vb.ubytespecptr[1] );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] = UBYTE_TO_FLOAT( vb.ubytespecptr[2] );
}
if (rmesa->vb.vtxfmt_1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT)) {
- ctx->Current.Texcoord[0][0] = vb.texcoordptr[0][0];
- ctx->Current.Texcoord[0][1] = vb.texcoordptr[0][1];
- ctx->Current.Texcoord[0][2] = 0.0F;
- ctx->Current.Texcoord[0][3] = 1.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][0] = vb.texcoordptr[0][0];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][1] = vb.texcoordptr[0][1];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] = 0.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] = 1.0F;
}
if (rmesa->vb.vtxfmt_1 & (7 << R200_VTX_TEX1_COMP_CNT_SHIFT)) {
- ctx->Current.Texcoord[1][0] = vb.texcoordptr[1][0];
- ctx->Current.Texcoord[1][1] = vb.texcoordptr[1][1];
- ctx->Current.Texcoord[1][2] = 0.0F;
- ctx->Current.Texcoord[1][3] = 1.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][0] = vb.texcoordptr[1][0];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][1] = vb.texcoordptr[1][1];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] = 0.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] = 1.0F;
}
ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
@@ -412,7 +412,7 @@ static void VFMT_FALLBACK( const char *caller )
glBegin( prim );
if (rmesa->vb.installed_color_3f_sz == 4)
- alpha = ctx->Current.Color[3];
+ alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
/* Replay saved vertices
*/
@@ -598,8 +598,8 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
ind0 |= R200_VTX_N0;
}
} else {
- if (ctx->Current.Texcoord[0][2] != 0.0F ||
- ctx->Current.Texcoord[0][3] != 1.0) {
+ if (ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] != 0.0F ||
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] != 1.0) {
if (R200_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
fprintf(stderr, "%s: rq0\n", __FUNCTION__);
return GL_FALSE;
@@ -614,8 +614,8 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
ind0 |= R200_VTX_N0;
}
} else {
- if (ctx->Current.Texcoord[1][2] != 0.0F ||
- ctx->Current.Texcoord[1][3] != 1.0) {
+ if (ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] != 0.0F ||
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] != 1.0) {
if (R200_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
fprintf(stderr, "%s: rq1\n", __FUNCTION__);
return GL_FALSE;
@@ -633,11 +633,11 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
vb.vertex_size = 3;
- vb.normalptr = ctx->Current.Normal;
+ vb.normalptr = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
vb.ubytecolorptr = 0;
- vb.floatcolorptr = ctx->Current.Color;
- vb.texcoordptr[0] = ctx->Current.Texcoord[0];
- vb.texcoordptr[1] = ctx->Current.Texcoord[1];
+ vb.floatcolorptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
+ vb.texcoordptr[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ vb.texcoordptr[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1];
/* Run through and initialize the vertex components in the order
* the hardware understands:
@@ -645,52 +645,52 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
if (ind0 & R200_VTX_N0) {
vb.normalptr = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 3;
- vb.normalptr[0] = ctx->Current.Normal[0];
- vb.normalptr[1] = ctx->Current.Normal[1];
- vb.normalptr[2] = ctx->Current.Normal[2];
+ vb.normalptr[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
+ vb.normalptr[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
+ vb.normalptr[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
}
if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) {
vb.ubytecolorptr = &vb.vertex[vb.vertex_size].ub4[0];
vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( vb.ubytecolorptr, ctx->Current.Color );
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN( vb.ubytecolorptr, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
}
else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) {
vb.floatcolorptr = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 4;
- vb.floatcolorptr[0] = ctx->Current.Color[0];
- vb.floatcolorptr[1] = ctx->Current.Color[1];
- vb.floatcolorptr[2] = ctx->Current.Color[2];
- vb.floatcolorptr[3] = ctx->Current.Color[3];
+ vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
+ vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
+ vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
+ vb.floatcolorptr[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
}
else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
vb.floatcolorptr = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 3;
- vb.floatcolorptr[0] = ctx->Current.Color[0];
- vb.floatcolorptr[1] = ctx->Current.Color[1];
- vb.floatcolorptr[2] = ctx->Current.Color[2];
+ vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
+ vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
+ vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
}
if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) {
vb.ubytespecptr = &vb.vertex[vb.vertex_size].ub4[0];
vb.vertex_size += 1;
UNCLAMPED_FLOAT_TO_RGB_CHAN( vb.ubytespecptr,
- ctx->Current.SecondaryColor );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1] );
}
if (ind1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT)) {
vb.texcoordptr[0] = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 2;
- vb.texcoordptr[0][0] = ctx->Current.Texcoord[0][0];
- vb.texcoordptr[0][1] = ctx->Current.Texcoord[0][1];
+ vb.texcoordptr[0][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][0];
+ vb.texcoordptr[0][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][1];
}
if (ind1 & (7 << R200_VTX_TEX1_COMP_CNT_SHIFT)) {
vb.texcoordptr[1] = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 2;
- vb.texcoordptr[1][0] = ctx->Current.Texcoord[1][0];
- vb.texcoordptr[1][1] = ctx->Current.Texcoord[1][1];
+ vb.texcoordptr[1][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][0];
+ vb.texcoordptr[1][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][1];
}
if (rmesa->vb.installed_vertex_format != rmesa->vb.vtxfmt_0) {
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h
index 7a04d971f..abc34c9ca 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h
@@ -80,8 +80,8 @@ do { \
#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
- fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__, \
- __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL)); \
+ /*fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__,*/ \
+ /* __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL));*/ \
*(int *)(CODE+OFFSET) = (int)(NEWVAL); \
OFFSET += 4; \
} while (0)
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c
index bc6a49546..5c9f51572 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c
@@ -32,6 +32,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
+#include "imports.h"
#include "mtypes.h"
#include "colormac.h"
#include "simple_list.h"
@@ -282,7 +284,7 @@ static void r200_Color4ub_3f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
dest[0] = UBYTE_TO_FLOAT(r);
dest[1] = UBYTE_TO_FLOAT(g);
dest[2] = UBYTE_TO_FLOAT(b);
- vb.context->Current.Color[3] = UBYTE_TO_FLOAT(a);
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(a);
}
static void r200_Color4ubv_3f( const GLubyte *v )
@@ -291,7 +293,7 @@ static void r200_Color4ubv_3f( const GLubyte *v )
dest[0] = UBYTE_TO_FLOAT(v[0]);
dest[1] = UBYTE_TO_FLOAT(v[1]);
dest[2] = UBYTE_TO_FLOAT(v[2]);
- vb.context->Current.Color[3] = UBYTE_TO_FLOAT(v[3]);
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(v[3]);
}
@@ -317,7 +319,7 @@ static void r200_Color4f_3f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
dest[0] = r;
dest[1] = g;
dest[2] = b;
- vb.context->Current.Color[3] = a;
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = a;
}
static void r200_Color4fv_3f( const GLfloat *v )
@@ -326,7 +328,7 @@ static void r200_Color4fv_3f( const GLfloat *v )
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
- vb.context->Current.Color[3] = v[3];
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = v[3];
}
@@ -510,17 +512,17 @@ static void choose_##FN ARGS1 \
int key[2]; \
struct dynfn *dfn; \
\
- key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
- key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
+ key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
+ key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
\
- if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_PK_RGBA) { \
+ if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_PK_RGBA) { \
ctx->Exec->FN = r200_##FN##_ub; \
} \
else if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_FP_RGB) { \
\
if (rmesa->vb.installed_color_3f_sz != NR) { \
rmesa->vb.installed_color_3f_sz = NR; \
- if (NR == 3) ctx->Current.Color[3] = 1.0; \
+ if (NR == 3) ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = 1.0; \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \
r200_copy_to_current( ctx ); \
_mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c
index 6c0a696a4..ef77208c6 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c
@@ -32,9 +32,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
-#include <assert.h>
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
#include "simple_list.h"
#include "r200_vtxfmt.h"
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c
index 28978e35b..3e8d21fd2 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c
@@ -32,9 +32,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
-#include <assert.h>
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
#include "mmath.h"
#include "simple_list.h"
#include "r200_vtxfmt.h"
@@ -197,7 +196,7 @@ struct dynfn *r200_makeX86Normal3fv( GLcontext *ctx, const int *key )
FIXUP2(dfn->code, i, 0x0, (int)vb.normalptr);
FIXUP2(dfn->code, i, 0x4, 4+(int)vb.normalptr);
FIXUP2(dfn->code, i, 0x8, 8+(int)vb.normalptr);
- fprintf(stderr, "%s done\n", __FUNCTION__);
+ /*fprintf(stderr, "%s done\n", __FUNCTION__);*/
return dfn;
}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_compat.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_compat.c
index 405636465..0c3264153 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_compat.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_compat.c
@@ -33,10 +33,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+
#include "radeon_context.h"
#include "radeon_state.h"
#include "radeon_ioctl.h"
-#include "mem.h"
+
static struct {
int start;
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c
index 9296571ef..a6228635d 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c
@@ -35,6 +35,20 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+#include "api_arrayelt.h"
+#include "context.h"
+#include "simple_list.h"
+#include "matrix.h"
+#include "extensions.h"
+
+#include "swrast/swrast.h"
+#include "swrast_setup/swrast_setup.h"
+#include "array_cache/acache.h"
+
+#include "tnl/tnl.h"
+#include "tnl/t_pipeline.h"
#include "radeon_context.h"
#include "radeon_ioctl.h"
@@ -46,24 +60,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_vtxfmt.h"
#include "radeon_maos.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "api_arrayelt.h"
-#include "context.h"
-#include "simple_list.h"
-#include "mem.h"
-#include "matrix.h"
-#include "extensions.h"
#if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h"
#endif
-#define RADEON_DATE "20020611"
+#define RADEON_DATE "20021125"
#ifndef RADEON_DEBUG
int RADEON_DEBUG = (0);
@@ -254,7 +255,7 @@ static void radeonInitDriverFuncs( GLcontext *ctx )
/* Create the device specific context.
*/
static GLboolean
-radeonCreateContext( Display *dpy, const __GLcontextModes *glVisual,
+radeonCreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate)
{
@@ -264,7 +265,6 @@ radeonCreateContext( Display *dpy, const __GLcontextModes *glVisual,
GLcontext *ctx, *shareCtx;
int i;
- assert(dpy);
assert(glVisual);
assert(driContextPriv);
assert(radeonScreen);
@@ -279,7 +279,7 @@ radeonCreateContext( Display *dpy, const __GLcontextModes *glVisual,
shareCtx = ((radeonContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, rmesa, GL_TRUE);
+ rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
if (!rmesa->glCtx) {
FREE(rmesa);
return GL_FALSE;
@@ -287,7 +287,6 @@ radeonCreateContext( Display *dpy, const __GLcontextModes *glVisual,
driContextPriv->driverPrivate = rmesa;
/* Init radeon context data */
- rmesa->dri.display = dpy;
rmesa->dri.context = driContextPriv;
rmesa->dri.screen = sPriv;
rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
@@ -617,8 +616,7 @@ radeonInitDriver( __DRIscreenPrivate *sPriv )
* data.
*/
static GLboolean
-radeonCreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
@@ -652,10 +650,8 @@ radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
static void
-radeonSwapBuffers(Display *dpy, void *drawablePrivate)
+radeonSwapBuffers( __DRIdrawablePrivate *dPriv )
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- (void) dpy;
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
radeonContextPtr rmesa;
@@ -663,7 +659,7 @@ radeonSwapBuffers(Display *dpy, void *drawablePrivate)
rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = rmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
- _mesa_swapbuffers( ctx ); /* flush pending rendering comands */
+ _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
if ( rmesa->doPageFlip ) {
radeonPageFlip( dPriv );
@@ -753,12 +749,10 @@ radeonOpenCloseFullScreen( __DRIcontextPrivate *driContextPriv )
-/* This function is called by libGL.so as soon as libGL.so is loaded.
- * This is where we'd register new extension functions with the dispatcher.
- */
void
__driRegisterExtensions( void )
{
+ /* See r200 driver for info */
}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h
index ed86ad3ff..0b6046092 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h
@@ -44,6 +44,7 @@ typedef struct radeon_context radeonContextRec;
typedef struct radeon_context *radeonContextPtr;
#include "mtypes.h"
+#include "macros.h"
#include "radeon_lock.h"
#include "radeon_screen.h"
#include "mm.h"
@@ -474,8 +475,6 @@ struct radeon_dma {
};
struct radeon_dri_mirror {
- Display *display; /* X server display */
-
__DRIcontextPrivate *context; /* DRI context */
__DRIscreenPrivate *screen; /* DRI screen */
__DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
index c90be5b10..2b45a2749 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
@@ -35,17 +35,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+#include "simple_list.h"
+#include "swrast/swrast.h"
+
#include "radeon_context.h"
#include "radeon_state.h"
#include "radeon_ioctl.h"
#include "radeon_tcl.h"
#include "radeon_sanity.h"
-#include "mem.h"
-#include "macros.h"
-#include "swrast/swrast.h"
-#include "simple_list.h"
-
#define RADEON_TIMEOUT 512
#define RADEON_IDLE_RETRY 16
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c
index c9ef4f43a..b292c25d1 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c
@@ -34,6 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
#include "radeon_context.h"
#include "radeon_lock.h"
#include "radeon_tex.h"
@@ -57,7 +58,7 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
- use_back = (rmesa->glCtx->Color.DriverDrawBuffer == GL_BACK_LEFT);
+ use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
if ( RADEON_DEBUG & DEBUG_VERBOSE )
@@ -105,11 +106,14 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
* Since the hardware state depends on having the latest drawable
* clip rects, all state checking must be done _after_ this call.
*/
- DRI_VALIDATE_DRAWABLE_INFO( rmesa->dri.display, sPriv, dPriv );
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
if ( rmesa->lastStamp != dPriv->lastStamp ) {
radeonUpdatePageFlipping( rmesa );
- radeonSetCliprects( rmesa, rmesa->glCtx->Color.DriverDrawBuffer );
+ if (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT)
+ radeonSetCliprects( rmesa, GL_BACK_LEFT );
+ else
+ radeonSetCliprects( rmesa, GL_FRONT_LEFT );
radeonUpdateViewportOffset( rmesa->glCtx );
rmesa->lastStamp = dPriv->lastStamp;
}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c
index 7b2248115..d76ee087a 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c
@@ -34,9 +34,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "glheader.h"
+#include "imports.h"
#include "mtypes.h"
-#include "colormac.h"
-#include "mem.h"
#include "mmath.h"
#include "macros.h"
@@ -444,7 +443,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
}
- if (inputs & VERT_NORM) {
+ if (inputs & VERT_BIT_NORMAL) {
if (!rmesa->tcl.norm.buf)
emit_vector( ctx,
&(rmesa->tcl.norm),
@@ -457,7 +456,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
component[nr++] = &rmesa->tcl.norm;
}
- if (inputs & VERT_RGBA) {
+ if (inputs & VERT_BIT_COLOR0) {
if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) {
if (!rmesa->tcl.rgba.buf)
emit_ubyte_rgba( ctx,
@@ -497,7 +496,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
}
- if (inputs & VERT_SPEC_RGB) {
+ if (inputs & VERT_BIT_COLOR1) {
if (!rmesa->tcl.spec.buf) {
if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
radeon_import_float_spec_colors( ctx );
@@ -517,7 +516,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &
~(RADEON_TCL_VTX_Q0|RADEON_TCL_VTX_Q1));
- if (inputs & VERT_TEX0) {
+ if (inputs & VERT_BIT_TEX0) {
if (!rmesa->tcl.tex[0].buf)
emit_tex_vector( ctx,
&(rmesa->tcl.tex[0]),
@@ -536,7 +535,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
component[nr++] = &rmesa->tcl.tex[0];
}
- if (inputs & VERT_TEX1) {
+ if (inputs & VERT_BIT_TEX1) {
if (!rmesa->tcl.tex[1].buf)
emit_tex_vector( ctx,
&(rmesa->tcl.tex[1]),
@@ -572,21 +571,21 @@ void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs )
if (RADEON_DEBUG & DEBUG_VERTS)
_tnl_print_vert_flags( __FUNCTION__, newinputs );
- if (newinputs & VERT_OBJ)
+ if (newinputs & VERT_BIT_POS)
radeonReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
- if (newinputs & VERT_NORM)
+ if (newinputs & VERT_BIT_NORMAL)
radeonReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
radeonReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
radeonReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
radeonReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ );
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
radeonReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h
index 8ce767774..b379bad98 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -39,21 +39,20 @@ static void TAG(emit)( GLcontext *ctx,
void *dest )
{
LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint (*tc0)[4], (*tc1)[4];
- GLfloat *fog;
- GLuint (*tc2)[4], (*norm)[3];
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ GLuint (*tc0)[4], (*tc1)[4], (*tc2)[4];
+ GLfloat (*fog)[4];
+ GLuint (*norm)[4];
GLubyte (*col)[4], (*spec)[4];
GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
GLuint tc2_stride, norm_stride;
GLuint (*coord)[4];
- GLuint coord_stride;
+ GLuint coord_stride; /* object coordinates */
GLubyte dummy[4];
int i;
union emit_union *v = (union emit_union *)dest;
-
if (RADEON_DEBUG & DEBUG_VERTS)
fprintf(stderr, "%s\n", __FUNCTION__);
@@ -63,14 +62,14 @@ static void TAG(emit)( GLcontext *ctx,
*/
if (VB->ObjPtr->size < 3) {
if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE );
+ VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
}
_mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 2 );
}
if (DO_W && VB->ObjPtr->size < 4) {
if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE );
+ VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
}
_mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 3 );
}
@@ -84,7 +83,7 @@ static void TAG(emit)( GLcontext *ctx,
tc2_stride = VB->TexCoordPtr[t2]->stride;
if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
if (VB->TexCoordPtr[t2]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_TEX2, VEC_NOT_WRITEABLE );
+ VB->import_data( ctx, VERT_BIT_TEX2, VEC_NOT_WRITEABLE );
}
_mesa_vector4f_clean_elem( VB->TexCoordPtr[t2], VB->Count, 3 );
}
@@ -97,12 +96,12 @@ static void TAG(emit)( GLcontext *ctx,
tc1_stride = VB->TexCoordPtr[t1]->stride;
if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) {
if (VB->TexCoordPtr[t1]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_TEX1, VEC_NOT_WRITEABLE );
+ VB->import_data( ctx, VERT_BIT_TEX1, VEC_NOT_WRITEABLE );
}
_mesa_vector4f_clean_elem( VB->TexCoordPtr[t1], VB->Count, 3 );
}
} else {
- tc1 = (GLuint (*)[4])&ctx->Current.Texcoord[1]; /* could be anything, really */
+ tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1]; /* could be anything, really */
tc1_stride = 0;
}
}
@@ -114,12 +113,12 @@ static void TAG(emit)( GLcontext *ctx,
tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data;
if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) {
if (VB->TexCoordPtr[t0]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_TEX0, VEC_NOT_WRITEABLE );
+ VB->import_data( ctx, VERT_BIT_TEX0, VEC_NOT_WRITEABLE );
}
_mesa_vector4f_clean_elem( VB->TexCoordPtr[t0], VB->Count, 3 );
}
} else {
- tc0 = (GLuint (*)[4])&ctx->Current.Texcoord[0]; /* could be anything, really */
+ tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0]; /* could be anything, really */
tc0_stride = 0;
}
@@ -128,10 +127,10 @@ static void TAG(emit)( GLcontext *ctx,
if (DO_NORM) {
if (VB->NormalPtr) {
norm_stride = VB->NormalPtr->stride;
- norm = (GLuint (*)[3])VB->NormalPtr->data;
+ norm = (GLuint (*)[4])VB->NormalPtr->data;
} else {
norm_stride = 0;
- norm = (GLuint (*)[3])&ctx->Current.Normal;
+ norm = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
}
}
@@ -149,7 +148,6 @@ static void TAG(emit)( GLcontext *ctx,
col = &dummy; /* any old memory is fine */
col_stride = 0;
}
-
}
if (DO_SPEC) {
@@ -162,7 +160,6 @@ static void TAG(emit)( GLcontext *ctx,
spec = &dummy;
spec_stride = 0;
}
-
}
if (DO_FOG) {
@@ -170,10 +167,9 @@ static void TAG(emit)( GLcontext *ctx,
fog = VB->FogCoordPtr->data;
fog_stride = VB->FogCoordPtr->stride;
} else {
- fog = (GLfloat *)&dummy; *fog = 0;
+ fog = (GLfloat (*)[4])&dummy; fog[0][0] = 0.0F;
fog_stride = 0;
}
-
}
@@ -187,13 +183,13 @@ static void TAG(emit)( GLcontext *ctx,
if (DO_TEX2)
tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride);
if (DO_NORM)
- norm = (GLuint (*)[3])((GLubyte *)norm + start * norm_stride);
+ norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride);
if (DO_RGBA)
STRIDE_4UB(col, start * col_stride);
if (DO_SPEC)
STRIDE_4UB(spec, start * spec_stride);
if (DO_FOG)
- STRIDE_F(fog, start * fog_stride);
+ fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride);
}
for (i=start; i < end; i++) {
@@ -216,7 +212,7 @@ static void TAG(emit)( GLcontext *ctx,
v[2].ui = norm[0][2];
if (TCL_DEBUG) fprintf(stderr, "norm: %.2f %.2f %.2f ", v[0].f, v[1].f, v[2].f);
v += 3;
- norm = (GLuint (*)[3])((GLubyte *)norm + norm_stride);
+ norm = (GLuint (*)[4])((GLubyte *)norm + norm_stride);
}
if (DO_RGBA) {
v[0].ui = LE32_TO_CPU(*(GLuint *)&col[0]);
@@ -232,8 +228,8 @@ static void TAG(emit)( GLcontext *ctx,
STRIDE_4UB(spec, spec_stride);
}
if (DO_FOG) {
- v[0].specular.alpha = fog[0] * 255.0;
- STRIDE_F(fog, fog_stride);
+ v[0].specular.alpha = fog[0][0] * 255.0;
+ fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
}
if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
v++;
@@ -306,7 +302,8 @@ static void TAG(emit)( GLcontext *ctx,
v[0].specular.blue = spec[i][2];
}
if (DO_FOG) {
- v[0].specular.alpha = fog[i] * 255.0;
+ GLfloat *f = (GLfloat *) ((GLubyte *)fog + fog_stride);
+ v[0].specular.alpha = *f * 255.0;
}
v++;
}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c
index 6f421702c..671133a8b 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c
@@ -33,6 +33,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+#include "mtypes.h"
+
+#include "array_cache/acache.h"
+#include "tnl/tnl.h"
+#include "tnl/t_pipeline.h"
+#include "tnl/t_imm_debug.h"
+
#include "radeon_context.h"
#include "radeon_state.h"
#include "radeon_ioctl.h"
@@ -41,16 +50,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_swtcl.h"
#include "radeon_maos.h"
-#include "mmath.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "colormac.h"
-#include "light.h"
-
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_imm_debug.h"
#define RADEON_TCL_MAX_SETUP 13
@@ -257,19 +256,19 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
}
}
- if (inputs & VERT_NORM) {
+ if (inputs & VERT_BIT_NORMAL) {
req |= RADEON_CP_VC_FRMT_N0;
}
- if (inputs & VERT_RGBA) {
+ if (inputs & VERT_BIT_COLOR0) {
req |= RADEON_CP_VC_FRMT_PKCOLOR;
}
- if (inputs & VERT_SPEC_RGB) {
+ if (inputs & VERT_BIT_COLOR1) {
req |= RADEON_CP_VC_FRMT_PKSPEC;
}
- if (inputs & VERT_TEX0) {
+ if (inputs & VERT_BIT_TEX0) {
req |= RADEON_CP_VC_FRMT_ST0;
if (VB->TexCoordPtr[0]->size == 4) {
@@ -278,7 +277,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
}
}
- if (inputs & VERT_TEX1) {
+ if (inputs & VERT_BIT_TEX1) {
req |= RADEON_CP_VC_FRMT_ST1;
if (VB->TexCoordPtr[1]->size == 4) {
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c
index 80b3d9992..e5b97d2c9 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c
@@ -33,6 +33,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+
#include "radeon_context.h"
#include "radeon_ioctl.h"
#include "radeon_sanity.h"
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c
index 1ce156dcd..75443cb1f 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c
@@ -34,8 +34,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+
#include "radeon_screen.h"
-#include "mem.h"
#if 1
@@ -65,17 +67,12 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
radeonScreenPtr radeonScreen;
RADEONDRIPtr radeonDRIPriv = (RADEONDRIPtr)sPriv->pDevPriv;
- /* Check the DRI version */
- {
- int major, minor, patch;
- if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) {
- if ( major != 4 || minor < 0 ) {
- __driUtilMessage( "Radeon DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- major, minor, patch );
- return NULL;
- }
- }
+ /* Check the DRI extension version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "Radeon DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return NULL;
}
/* Check that the DDX driver version is compatible */
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c
index c97e92977..cce2fdf4c 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c
@@ -35,14 +35,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "swrast/swrast.h"
+
#include "radeon_context.h"
#include "radeon_ioctl.h"
#include "radeon_state.h"
#include "radeon_span.h"
#include "radeon_tex.h"
-#include "swrast/swrast.h"
-
#define DBG 0
#define LOCAL_VARS \
@@ -284,29 +285,42 @@ do { \
#include "stenciltmp.h"
-static void radeonSetReadBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLenum mode )
+/*
+ * This function is called to specify which buffer to read and write
+ * for software rasterization (swrast) fallbacks. This doesn't necessarily
+ * correspond to glDrawBuffer() or glReadBuffer() calls.
+ */
+static void radeonSetBuffer( GLcontext *ctx,
+ GLframebuffer *colorBuffer,
+ GLuint bufferBit )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- switch ( mode ) {
- case GL_FRONT_LEFT:
+ switch ( bufferBit ) {
+ case FRONT_LEFT_BIT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
+ rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
+ rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
} else {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
+ rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
+ rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
}
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
+ rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
+ rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
} else {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
+ rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
+ rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
}
break;
default:
@@ -340,7 +354,7 @@ void radeonInitSpanFuncs( GLcontext *ctx )
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = radeonSetReadBuffer;
+ swdd->SetBuffer = radeonSetBuffer;
switch ( rmesa->radeonScreen->cpp ) {
case 2:
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c
index ceb430ae6..d03f81c5f 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c
@@ -28,20 +28,12 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
+#include "api_arrayelt.h"
#include "mmath.h"
#include "enums.h"
#include "colormac.h"
-#include "light.h"
-#include "api_arrayelt.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
@@ -50,6 +42,15 @@
#include "swrast_setup/swrast_setup.h"
+#include "radeon_context.h"
+#include "radeon_ioctl.h"
+#include "radeon_state.h"
+#include "radeon_tcl.h"
+#include "radeon_tex.h"
+#include "radeon_swtcl.h"
+#include "radeon_vtxfmt.h"
+
+
#define MODEL_PROJ 0
#define MODEL 1
#define MODEL_IT 2
@@ -62,15 +63,18 @@
* Alpha blending
*/
-static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLchan ref )
+static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
+ GLubyte refByte;
+
+ CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
RADEON_STATECHANGE( rmesa, ctx );
pp_misc &= ~(RADEON_ALPHA_TEST_OP_MASK | RADEON_REF_ALPHA_MASK);
- pp_misc |= (ref & RADEON_REF_ALPHA_MASK);
+ pp_misc |= (refByte & RADEON_REF_ALPHA_MASK);
switch ( func ) {
case GL_NEVER:
@@ -1205,7 +1209,7 @@ static void radeonUpdateClipPlanes( GLcontext *ctx )
GLuint p;
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipEnabled[p]) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
RADEON_STATECHANGE( rmesa, ucp[p] );
@@ -1226,8 +1230,8 @@ static void radeonStencilFunc( GLcontext *ctx, GLenum func,
GLint ref, GLuint mask )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref << RADEON_STENCIL_REF_SHIFT) |
- (ctx->Stencil.ValueMask << RADEON_STENCIL_MASK_SHIFT));
+ GLuint refmask = ((ctx->Stencil.Ref[0] << RADEON_STENCIL_REF_SHIFT) |
+ (ctx->Stencil.ValueMask[0] << RADEON_STENCIL_MASK_SHIFT));
RADEON_STATECHANGE( rmesa, ctx );
RADEON_STATECHANGE( rmesa, msk );
@@ -1236,7 +1240,7 @@ static void radeonStencilFunc( GLcontext *ctx, GLenum func,
rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~(RADEON_STENCIL_REF_MASK|
RADEON_STENCIL_VALUE_MASK);
- switch ( ctx->Stencil.Function ) {
+ switch ( ctx->Stencil.Function[0] ) {
case GL_NEVER:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_NEVER;
break;
@@ -1273,7 +1277,7 @@ static void radeonStencilMask( GLcontext *ctx, GLuint mask )
RADEON_STATECHANGE( rmesa, msk );
rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~RADEON_STENCIL_WRITE_MASK;
rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |=
- (ctx->Stencil.WriteMask << RADEON_STENCIL_WRITEMASK_SHIFT);
+ (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT);
}
static void radeonStencilOp( GLcontext *ctx, GLenum fail,
@@ -1286,7 +1290,7 @@ static void radeonStencilOp( GLcontext *ctx, GLenum fail,
RADEON_STENCIL_ZFAIL_MASK |
RADEON_STENCIL_ZPASS_MASK);
- switch ( ctx->Stencil.FailFunc ) {
+ switch ( ctx->Stencil.FailFunc[0] ) {
case GL_KEEP:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_KEEP;
break;
@@ -1307,7 +1311,7 @@ static void radeonStencilOp( GLcontext *ctx, GLenum fail,
break;
}
- switch ( ctx->Stencil.ZFailFunc ) {
+ switch ( ctx->Stencil.ZFailFunc[0] ) {
case GL_KEEP:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_KEEP;
break;
@@ -1328,7 +1332,7 @@ static void radeonStencilOp( GLcontext *ctx, GLenum fail,
break;
}
- switch ( ctx->Stencil.ZPassFunc ) {
+ switch ( ctx->Stencil.ZPassFunc[0] ) {
case GL_KEEP:
rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_KEEP;
break;
@@ -1357,7 +1361,7 @@ static void radeonClearStencil( GLcontext *ctx, GLint s )
rmesa->state.stencil.clear =
((GLuint) ctx->Stencil.Clear |
(0xff << RADEON_STENCIL_MASK_SHIFT) |
- (ctx->Stencil.WriteMask << RADEON_STENCIL_WRITEMASK_SHIFT));
+ (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT));
}
@@ -1467,9 +1471,14 @@ void radeonUpdateViewportOffset( GLcontext *ctx )
* Miscellaneous
*/
-static void radeonClearColor( GLcontext *ctx, const GLchan c[4] )
+static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
rmesa->state.color.clear = radeonPackColor( rmesa->radeonScreen->cpp,
c[0], c[1], c[2], c[3] );
}
@@ -1544,7 +1553,7 @@ void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode )
}
-static void radeonSetDrawBuffer( GLcontext *ctx, GLenum mode )
+static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@@ -1554,44 +1563,40 @@ static void radeonSetDrawBuffer( GLcontext *ctx, GLenum mode )
RADEON_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */
- switch ( mode ) {
- case GL_FRONT_LEFT:
+ /*
+ * _DrawDestMask is easier to cope with than <mode>.
+ */
+ switch ( ctx->Color._DrawDestMask ) {
+ case FRONT_LEFT_BIT:
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- }
- rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
- rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
radeonSetCliprects( rmesa, GL_FRONT_LEFT );
break;
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- }
- rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
- rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
radeonSetCliprects( rmesa, GL_BACK_LEFT );
break;
default:
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
+ /* We want to update the s/w rast state too so that r200SetBuffer()
+ * gets called.
+ */
+ _swrast_DrawBuffer(ctx, mode);
+
RADEON_STATECHANGE( rmesa, ctx );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset &
RADEON_COLOROFFSET_MASK);
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
}
+static void radeonReadBuffer( GLcontext *ctx, GLenum mode )
+{
+ /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
+}
+
/* =============================================================
* State enable/disable
@@ -1950,7 +1955,7 @@ static void update_texturematrix( GLcontext *ctx )
for (unit = 0 ; unit < 2; unit++) {
if (!ctx->Texture.Unit[unit]._ReallyEnabled) {
}
- else if (ctx->TextureMatrix[unit].type != MATRIX_IDENTITY) {
+ else if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) {
GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
rmesa->TexMatEnabled |= (RADEON_TEXGEN_TEXMAT_0_ENABLE|
@@ -1962,13 +1967,13 @@ static void update_texturematrix( GLcontext *ctx )
*/
_math_matrix_mul_matrix( &rmesa->tmpmat,
&rmesa->TexGenMatrix[unit],
- &ctx->TextureMatrix[unit] );
+ ctx->TextureMatrixStack[unit].Top );
upload_matrix( rmesa, rmesa->tmpmat.m, TEXMAT_0+unit );
}
else {
rmesa->TexMatEnabled |=
(RADEON_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
- upload_matrix( rmesa, ctx->TextureMatrix[unit].m,
+ upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m,
TEXMAT_0+unit );
}
}
@@ -2023,8 +2028,8 @@ void radeonValidateState( GLcontext *ctx )
/* Need these for lighting (shouldn't upload otherwise)
*/
if (new_state & (_NEW_MODELVIEW)) {
- upload_matrix( rmesa, ctx->ModelView.m, MODEL );
- upload_matrix_t( rmesa, ctx->ModelView.inv, MODEL_IT );
+ upload_matrix( rmesa, ctx->ModelviewMatrixStack.Top->m, MODEL );
+ upload_matrix_t( rmesa, ctx->ModelviewMatrixStack.Top->inv, MODEL_IT );
}
/* Does this need to be triggered on eg. modelview for
@@ -2041,7 +2046,7 @@ void radeonValidateState( GLcontext *ctx )
/* emit all active clip planes if projection matrix changes.
*/
if (new_state & (_NEW_PROJECTION)) {
- if (ctx->Transform._AnyClip)
+ if (ctx->Transform.ClipPlanesEnabled)
radeonUpdateClipPlanes( ctx );
}
@@ -2098,7 +2103,8 @@ void radeonInitStateFuncs( GLcontext *ctx )
ctx->Driver.UpdateState = radeonInvalidateState;
ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange;
- ctx->Driver.SetDrawBuffer = radeonSetDrawBuffer;
+ ctx->Driver.DrawBuffer = radeonDrawBuffer;
+ ctx->Driver.ReadBuffer = radeonReadBuffer;
ctx->Driver.AlphaFunc = radeonAlphaFunc;
ctx->Driver.BlendEquation = radeonBlendEquation;
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c
index a76bf1bc2..b09651bcf 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c
@@ -28,19 +28,9 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
#include "mmath.h"
-#include "enums.h"
-#include "colormac.h"
-#include "light.h"
#include "api_arrayelt.h"
#include "swrast/swrast.h"
@@ -49,6 +39,14 @@
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
+#include "radeon_context.h"
+#include "radeon_ioctl.h"
+#include "radeon_state.h"
+#include "radeon_tcl.h"
+#include "radeon_tex.h"
+#include "radeon_swtcl.h"
+#include "radeon_vtxfmt.h"
+
/* =============================================================
* State initialization
*/
@@ -129,12 +127,12 @@ TCL_CHECK( tcl_lit4, ctx->Light.Enabled && ctx->Light.Light[4].Enabled )
TCL_CHECK( tcl_lit5, ctx->Light.Enabled && ctx->Light.Light[5].Enabled )
TCL_CHECK( tcl_lit6, ctx->Light.Enabled && ctx->Light.Light[6].Enabled )
TCL_CHECK( tcl_lit7, ctx->Light.Enabled && ctx->Light.Light[7].Enabled )
-TCL_CHECK( tcl_ucp0, ctx->Transform.ClipEnabled[0] )
-TCL_CHECK( tcl_ucp1, ctx->Transform.ClipEnabled[1] )
-TCL_CHECK( tcl_ucp2, ctx->Transform.ClipEnabled[2] )
-TCL_CHECK( tcl_ucp3, ctx->Transform.ClipEnabled[3] )
-TCL_CHECK( tcl_ucp4, ctx->Transform.ClipEnabled[4] )
-TCL_CHECK( tcl_ucp5, ctx->Transform.ClipEnabled[5] )
+TCL_CHECK( tcl_ucp0, (ctx->Transform.ClipPlanesEnabled & 0x1) )
+TCL_CHECK( tcl_ucp1, (ctx->Transform.ClipPlanesEnabled & 0x2) )
+TCL_CHECK( tcl_ucp2, (ctx->Transform.ClipPlanesEnabled & 0x4) )
+TCL_CHECK( tcl_ucp3, (ctx->Transform.ClipPlanesEnabled & 0x8) )
+TCL_CHECK( tcl_ucp4, (ctx->Transform.ClipPlanesEnabled & 0x10) )
+TCL_CHECK( tcl_ucp5, (ctx->Transform.ClipPlanesEnabled & 0x20) )
TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords || ctx->Fog.Enabled )
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c
index 620c0c71e..71b3f76f1 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c
@@ -37,7 +37,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mtypes.h"
#include "colormac.h"
#include "enums.h"
-#include "mem.h"
+#include "imports.h"
#include "mmath.h"
#include "macros.h"
@@ -317,9 +317,11 @@ void radeonChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR))
ind |= RADEON_SPEC_BIT;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
+ if (ctx->Texture._EnabledUnits & 0x2)
+ /* unit 1 enabled */
ind |= RADEON_TEX0_BIT|RADEON_TEX1_BIT;
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
+ else if (ctx->Texture._EnabledUnits & 0x1)
+ /* unit 0 enabled */
ind |= RADEON_TEX0_BIT;
rmesa->swtcl.SetupIndex = ind;
@@ -563,7 +565,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_CLIP;
+ RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
}
static void ELT_FALLBACK( GLcontext *ctx,
@@ -575,7 +577,7 @@ static void ELT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_CLIP;
+ RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
}
@@ -721,20 +723,20 @@ static GLboolean radeon_run_render( GLcontext *ctx,
static void radeon_check_render( GLcontext *ctx,
struct gl_pipeline_stage *stage )
{
- GLuint inputs = VERT_OBJ|VERT_CLIP|VERT_RGBA;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
if (ctx->Fog.Enabled)
- inputs |= VERT_FOG_COORD;
+ inputs |= VERT_BIT_FOG;
}
stage->inputs = inputs;
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c
index e66c150b0..429cef409 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.c
@@ -33,24 +33,25 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_swtcl.h"
-#include "radeon_maos.h"
-
+#include "glheader.h"
+#include "imports.h"
+#include "light.h"
#include "mmath.h"
#include "mtypes.h"
#include "enums.h"
-#include "colormac.h"
-#include "light.h"
#include "array_cache/acache.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
+#include "radeon_context.h"
+#include "radeon_state.h"
+#include "radeon_ioctl.h"
+#include "radeon_tex.h"
+#include "radeon_tcl.h"
+#include "radeon_swtcl.h"
+#include "radeon_maos.h"
+
/*
@@ -344,43 +345,43 @@ static void radeon_check_tcl_render( GLcontext *ctx,
struct gl_pipeline_stage *stage )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint inputs = VERT_OBJ;
+ GLuint inputs = VERT_BIT_POS;
if (ctx->RenderMode == GL_RENDER) {
/* Make all this event-driven:
*/
if (ctx->Light.Enabled) {
- inputs |= VERT_NORM;
+ inputs |= VERT_BIT_NORMAL;
if (ctx->Light.ColorMaterialEnabled) {
- inputs |= VERT_RGBA;
+ inputs |= VERT_BIT_COLOR0;
}
}
else {
- inputs |= VERT_RGBA;
+ inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
}
}
if (ctx->Texture.Unit[0]._ReallyEnabled) {
if (ctx->Texture.Unit[0].TexGenEnabled) {
if (rmesa->TexGenNeedNormals[0]) {
- inputs |= VERT_NORM;
+ inputs |= VERT_BIT_NORMAL;
}
} else {
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
}
}
if (ctx->Texture.Unit[1]._ReallyEnabled) {
if (ctx->Texture.Unit[1].TexGenEnabled) {
if (rmesa->TexGenNeedNormals[1]) {
- inputs |= VERT_NORM;
+ inputs |= VERT_BIT_NORMAL;
}
} else {
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
}
}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
index 24a5260ed..7aed7ca16 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
@@ -29,21 +29,23 @@
* Brian Paul <brianp@valinux.com>
*/
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_swtcl.h"
-#include "radeon_tex.h"
-
+#include "glheader.h"
+#include "imports.h"
#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "image.h"
-#include "mem.h"
#include "simple_list.h"
#include "texformat.h"
#include "texstore.h"
+#include "radeon_context.h"
+#include "radeon_state.h"
+#include "radeon_ioctl.h"
+#include "radeon_swtcl.h"
+#include "radeon_tex.h"
+
+
/* =============================================================
* Utility functions:
@@ -201,7 +203,7 @@ static radeonTexObjPtr radeonAllocTexObj( struct gl_texture_object *texObj )
radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT );
radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- radeonSetTexBorderColor( t, texObj->BorderColor );
+ radeonSetTexBorderColor( t, texObj->_BorderChan );
return t;
}
@@ -531,7 +533,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target,
break;
case GL_TEXTURE_BORDER_COLOR:
- radeonSetTexBorderColor( t, texObj->BorderColor );
+ radeonSetTexBorderColor( t, texObj->_BorderChan );
break;
case GL_TEXTURE_BASE_LEVEL:
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
index 976a7f6c2..0b7cfa2d0 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
@@ -34,13 +34,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-#include "radeon_context.h"
-#include "radeon_tex.h"
-
+#include "glheader.h"
+#include "imports.h"
#include "context.h"
+#include "mmath.h"
+#include "macros.h"
#include "simple_list.h"
-#include "mem.h"
+#include "radeon_context.h"
+#include "radeon_tex.h"
/* Destroy hardware state associated with texture `t'.
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
index 8f06c0dc6..bec6a8a24 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
@@ -34,6 +34,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "context.h"
+#include "enums.h"
+#include "macros.h"
+#include "mmath.h"
+#include "texformat.h"
+
#include "radeon_context.h"
#include "radeon_state.h"
#include "radeon_ioctl.h"
@@ -41,11 +50,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_tex.h"
#include "radeon_tcl.h"
-#include "context.h"
-#include "enums.h"
-#include "mem.h"
-#include "texformat.h"
-
static void radeonSetTexImages( radeonContextPtr rmesa,
struct gl_texture_object *tObj )
@@ -1265,7 +1269,7 @@ static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit )
/* fprintf(stderr, "%s\n", __FUNCTION__); */
- if ( texUnit->_ReallyEnabled & (TEXTURE0_1D|TEXTURE0_2D) ) {
+ if ( texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ) {
struct gl_texture_object *tObj = texUnit->_Current;
radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
GLenum format;
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
index 97c3f04e1..868989bad 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
@@ -33,17 +33,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include "glheader.h"
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_vtxfmt.h"
-
+#include "imports.h"
#include "api_noop.h"
#include "api_arrayelt.h"
#include "context.h"
-#include "mem.h"
#include "mmath.h"
#include "mtypes.h"
#include "enums.h"
@@ -57,6 +50,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/t_context.h"
#include "tnl/t_array_api.h"
+#include "radeon_context.h"
+#include "radeon_state.h"
+#include "radeon_ioctl.h"
+#include "radeon_tex.h"
+#include "radeon_tcl.h"
+#include "radeon_vtxfmt.h"
+
struct radeon_vb vb;
static void radeonFlushVertices( GLcontext *, GLuint );
@@ -108,45 +108,45 @@ void radeon_copy_to_current( GLcontext *ctx )
assert(vb.context == ctx);
if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_N0) {
- ctx->Current.Normal[0] = vb.normalptr[0];
- ctx->Current.Normal[1] = vb.normalptr[1];
- ctx->Current.Normal[2] = vb.normalptr[2];
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0] = vb.normalptr[0];
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1] = vb.normalptr[1];
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2] = vb.normalptr[2];
}
if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_PKCOLOR) {
- ctx->Current.Color[0] = UBYTE_TO_FLOAT( vb.colorptr->red );
- ctx->Current.Color[1] = UBYTE_TO_FLOAT( vb.colorptr->green );
- ctx->Current.Color[2] = UBYTE_TO_FLOAT( vb.colorptr->blue );
- ctx->Current.Color[3] = UBYTE_TO_FLOAT( vb.colorptr->alpha );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = UBYTE_TO_FLOAT( vb.colorptr->red );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = UBYTE_TO_FLOAT( vb.colorptr->green );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = UBYTE_TO_FLOAT( vb.colorptr->blue );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT( vb.colorptr->alpha );
}
if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_FPCOLOR) {
- ctx->Current.Color[0] = vb.floatcolorptr[0];
- ctx->Current.Color[1] = vb.floatcolorptr[1];
- ctx->Current.Color[2] = vb.floatcolorptr[2];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = vb.floatcolorptr[0];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = vb.floatcolorptr[1];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = vb.floatcolorptr[2];
}
if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_FPALPHA)
- ctx->Current.Color[3] = vb.floatcolorptr[3];
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = vb.floatcolorptr[3];
if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_PKSPEC) {
- ctx->Current.SecondaryColor[0] = UBYTE_TO_FLOAT( vb.specptr->red );
- ctx->Current.SecondaryColor[1] = UBYTE_TO_FLOAT( vb.specptr->green );
- ctx->Current.SecondaryColor[2] = UBYTE_TO_FLOAT( vb.specptr->blue );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] = UBYTE_TO_FLOAT( vb.specptr->red );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] = UBYTE_TO_FLOAT( vb.specptr->green );
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] = UBYTE_TO_FLOAT( vb.specptr->blue );
}
if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_ST0) {
- ctx->Current.Texcoord[0][0] = vb.texcoordptr[0][0];
- ctx->Current.Texcoord[0][1] = vb.texcoordptr[0][1];
- ctx->Current.Texcoord[0][2] = 0.0F;
- ctx->Current.Texcoord[0][3] = 1.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][0] = vb.texcoordptr[0][0];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][1] = vb.texcoordptr[0][1];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] = 0.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] = 1.0F;
}
if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_ST1) {
- ctx->Current.Texcoord[1][0] = vb.texcoordptr[1][0];
- ctx->Current.Texcoord[1][1] = vb.texcoordptr[1][1];
- ctx->Current.Texcoord[1][2] = 0.0F;
- ctx->Current.Texcoord[1][3] = 1.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][0] = vb.texcoordptr[1][0];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][1] = vb.texcoordptr[1][1];
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] = 0.0F;
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] = 1.0F;
}
ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
@@ -390,7 +390,7 @@ static void VFMT_FALLBACK( const char *caller )
glBegin( prim );
if (rmesa->vb.installed_color_3f_sz == 4)
- alpha = ctx->Current.Color[3];
+ alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
/* Replay saved vertices
*/
@@ -576,8 +576,8 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
ind |= RADEON_CP_VC_FRMT_N0;
}
} else {
- if (ctx->Current.Texcoord[0][2] != 0.0F ||
- ctx->Current.Texcoord[0][3] != 1.0) {
+ if (ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] != 0.0F ||
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] != 1.0) {
if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
fprintf(stderr, "%s: rq0\n", __FUNCTION__);
return GL_FALSE;
@@ -592,8 +592,8 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
ind |= RADEON_CP_VC_FRMT_N0;
}
} else {
- if (ctx->Current.Texcoord[1][2] != 0.0F ||
- ctx->Current.Texcoord[1][3] != 1.0) {
+ if (ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] != 0.0F ||
+ ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] != 1.0) {
if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
fprintf(stderr, "%s: rq1\n", __FUNCTION__);
return GL_FALSE;
@@ -610,11 +610,11 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
vb.vertex_size = 3;
rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
- vb.normalptr = ctx->Current.Normal;
+ vb.normalptr = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
vb.colorptr = NULL;
- vb.floatcolorptr = ctx->Current.Color;
- vb.texcoordptr[0] = ctx->Current.Texcoord[0];
- vb.texcoordptr[1] = ctx->Current.Texcoord[1];
+ vb.floatcolorptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
+ vb.texcoordptr[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
+ vb.texcoordptr[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1];
/* Run through and initialize the vertex components in the order
* the hardware understands:
@@ -622,55 +622,55 @@ static GLboolean check_vtx_fmt( GLcontext *ctx )
if (ind & RADEON_CP_VC_FRMT_N0) {
vb.normalptr = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 3;
- vb.normalptr[0] = ctx->Current.Normal[0];
- vb.normalptr[1] = ctx->Current.Normal[1];
- vb.normalptr[2] = ctx->Current.Normal[2];
+ vb.normalptr[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
+ vb.normalptr[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
+ vb.normalptr[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
}
if (ind & RADEON_CP_VC_FRMT_PKCOLOR) {
vb.colorptr = &vb.vertex[vb.vertex_size].color;
vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->red, ctx->Current.Color[0] );
- UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->green, ctx->Current.Color[1] );
- UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->blue, ctx->Current.Color[2] );
- UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->alpha, ctx->Current.Color[3] );
+ UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] );
+ UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] );
+ UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] );
+ UNCLAMPED_FLOAT_TO_CHAN( vb.colorptr->alpha, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] );
}
if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
assert(!(ind & RADEON_CP_VC_FRMT_PKCOLOR));
vb.floatcolorptr = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 3;
- vb.floatcolorptr[0] = ctx->Current.Color[0];
- vb.floatcolorptr[1] = ctx->Current.Color[1];
- vb.floatcolorptr[2] = ctx->Current.Color[2];
+ vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
+ vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
+ vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
if (ind & RADEON_CP_VC_FRMT_FPALPHA) {
vb.vertex_size += 1;
- vb.floatcolorptr[3] = ctx->Current.Color[3];
+ vb.floatcolorptr[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
}
}
if (ind & RADEON_CP_VC_FRMT_PKSPEC) {
vb.specptr = &vb.vertex[vb.vertex_size].color;
vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( vb.specptr->red, ctx->Current.SecondaryColor[0] );
- UNCLAMPED_FLOAT_TO_CHAN( vb.specptr->green, ctx->Current.SecondaryColor[1] );
- UNCLAMPED_FLOAT_TO_CHAN( vb.specptr->blue, ctx->Current.SecondaryColor[2] );
+ UNCLAMPED_FLOAT_TO_CHAN( vb.specptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] );
+ UNCLAMPED_FLOAT_TO_CHAN( vb.specptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] );
+ UNCLAMPED_FLOAT_TO_CHAN( vb.specptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] );
}
if (ind & RADEON_CP_VC_FRMT_ST0) {
vb.texcoordptr[0] = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 2;
- vb.texcoordptr[0][0] = ctx->Current.Texcoord[0][0];
- vb.texcoordptr[0][1] = ctx->Current.Texcoord[0][1];
+ vb.texcoordptr[0][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][0];
+ vb.texcoordptr[0][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][1];
}
if (ind & RADEON_CP_VC_FRMT_ST1) {
vb.texcoordptr[1] = &vb.vertex[vb.vertex_size].f;
vb.vertex_size += 2;
- vb.texcoordptr[1][0] = ctx->Current.Texcoord[1][0];
- vb.texcoordptr[1][1] = ctx->Current.Texcoord[1][1];
+ vb.texcoordptr[1][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][0];
+ vb.texcoordptr[1][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][1];
}
if (rmesa->vb.installed_vertex_format != rmesa->vb.vertex_format) {
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c
index 60032d955..48d24147c 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c
@@ -31,6 +31,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "glheader.h"
#include "mtypes.h"
#include "colormac.h"
#include "simple_list.h"
@@ -280,7 +281,7 @@ static void radeon_Color4ub_3f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
dest[0] = UBYTE_TO_FLOAT(r);
dest[1] = UBYTE_TO_FLOAT(g);
dest[2] = UBYTE_TO_FLOAT(b);
- vb.context->Current.Color[3] = UBYTE_TO_FLOAT(a);
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(a);
}
static void radeon_Color4ubv_3f( const GLubyte *v )
@@ -289,7 +290,7 @@ static void radeon_Color4ubv_3f( const GLubyte *v )
dest[0] = UBYTE_TO_FLOAT(v[0]);
dest[1] = UBYTE_TO_FLOAT(v[1]);
dest[2] = UBYTE_TO_FLOAT(v[2]);
- vb.context->Current.Color[3] = UBYTE_TO_FLOAT(v[3]);
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(v[3]);
}
@@ -315,7 +316,7 @@ static void radeon_Color4f_3f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
dest[0] = r;
dest[1] = g;
dest[2] = b;
- vb.context->Current.Color[3] = a;
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = a;
}
static void radeon_Color4fv_3f( const GLfloat *v )
@@ -324,7 +325,7 @@ static void radeon_Color4fv_3f( const GLfloat *v )
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
- vb.context->Current.Color[3] = v[3];
+ vb.context->Current.Attrib[VERT_ATTRIB_COLOR0][3] = v[3];
}
@@ -512,7 +513,7 @@ static void choose_##FN ARGS1 \
\
if (rmesa->vb.installed_color_3f_sz != NR) { \
rmesa->vb.installed_color_3f_sz = NR; \
- if (NR == 3) ctx->Current.Color[3] = 1.0; \
+ if (NR == 3) ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = 1.0; \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \
radeon_copy_to_current( ctx ); \
_mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c
index cd32b1424..868294fd5 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c
@@ -32,9 +32,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
-#include <assert.h>
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
#include "simple_list.h"
#include "radeon_vtxfmt.h"
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c
index 42685944a..40cee73de 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c
@@ -32,9 +32,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
-#include <assert.h>
-#include "mem.h"
+#include "glheader.h"
+#include "imports.h"
#include "mmath.h"
#include "simple_list.h"
#include "radeon_vtxfmt.h"
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c
index fe0780804..a3f05b947 100644
--- a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c
@@ -76,17 +76,13 @@ GLboolean XMesaInitDriver (__DRIscreenPrivate * driScrnPriv)
{
SISDRIPtr priv = (SISDRIPtr) driScrnPriv->pDevPriv;
- /* Check the DRI version */
- {
- int major, minor, patch;
- if (XF86DRIQueryVersion(driScrnPriv->display, &major, &minor, &patch)) {
- if (major != 4 || minor < 0) {
- char msg[1000];
- sprintf(msg, "sis DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch);
- __driMesaMessage(msg);
- return GL_FALSE;
- }
- }
+
+ /* Check the DRI externsion version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "sis DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return NULL;
}
/* Check that the DDX driver version is compatible */
@@ -211,7 +207,7 @@ GLvisual *XMesaCreateVisual(Display *dpy,
0 /* num samples */ );
}
-GLboolean XMesaCreateContext(Display *dpy, GLvisual *mesaVis,
+GLboolean XMesaCreateContext(GLvisual *mesaVis,
__DRIcontextPrivate *driContextPriv)
{
XMesaContext c;
@@ -228,12 +224,10 @@ GLboolean XMesaCreateContext(Display *dpy, GLvisual *mesaVis,
if (!c->xm_visual)
return GL_FALSE;
c->xm_visual->gl_visual = mesaVis;
- c->xm_visual->display = dpy;
c->gl_ctx = driContextPriv->mesaContext;
c->xm_buffer = NULL;
- c->display = dpy;
c->gl_ctx->Driver.UpdateState = sis_UpdateState;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
index 6eb1f2ceb..243710b97 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
@@ -55,16 +55,6 @@
#include "tnl/t_pipeline.h"
-#if 0
-/* Example extension function */
-static void
-fxFooBarEXT(GLint i)
-{
- printf("You called glFooBarEXT(%d)\n", i);
-}
-#endif
-
-
/*
* Enable/Disable the extensions for this context.
*/
@@ -89,28 +79,14 @@ static void tdfxDDInitExtensions( GLcontext *ctx )
_mesa_enable_extension( ctx, "GL_EXT_texture_env_combine" );
}
+#if 0
+ _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map");
+ _mesa_enable_extension( ctx, "GL_NV_texture_rectangle");
+#endif
+
if (fxMesa->haveHwStencil) {
_mesa_enable_extension( ctx, "GL_EXT_stencil_wrap" );
}
-
- /* Example of hooking in an extension function.
- * For DRI-based drivers, also see __driRegisterExtensions in the
- * tdfx_xmesa.c file.
- */
-#if 0
- {
- void **dispatchTable = (void **) ctx->Exec;
- const int _gloffset_FooBarEXT = 555; /* just an example number! */
- const int tabSize = _glapi_get_dispatch_table_size();
- assert(_gloffset_FooBarEXT < tabSize);
- dispatchTable[_gloffset_FooBarEXT] = (void *) tdfxFooBarEXT;
- /* XXX You would also need to hook into the display list dispatch
- * table. Really, the implementation of extensions might as well
- * be in the core of Mesa since core Mesa and the device driver
- * is one big shared lib.
- */
- }
-#endif
}
@@ -127,7 +103,7 @@ static const struct gl_pipeline_stage *tdfx_pipeline[] = {
};
-GLboolean tdfxCreateContext( Display *dpy, const __GLcontextModes *mesaVis,
+GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate )
{
@@ -138,7 +114,6 @@ GLboolean tdfxCreateContext( Display *dpy, const __GLcontextModes *mesaVis,
TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA +
sizeof(XF86DRISAREARec));
-
/* Allocate tdfx context */
fxMesa = (tdfxContextPtr) CALLOC( sizeof(tdfxContextRec) );
if (!fxMesa)
@@ -149,7 +124,8 @@ GLboolean tdfxCreateContext( Display *dpy, const __GLcontextModes *mesaVis,
shareCtx = ((tdfxContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
- fxMesa->glCtx = _mesa_create_context(mesaVis, shareCtx, fxMesa, GL_TRUE);
+
+ fxMesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void *) fxMesa, GL_TRUE);
if (!fxMesa->glCtx) {
FREE(fxMesa);
return GL_FALSE;
@@ -227,10 +203,8 @@ GLboolean tdfxCreateContext( Display *dpy, const __GLcontextModes *mesaVis,
ctx = fxMesa->glCtx;
if ( TDFX_IS_NAPALM( fxMesa ) ) {
ctx->Const.MaxTextureLevels = 12;
- ctx->Const.NumCompressedTextureFormats = 1;
} else {
ctx->Const.MaxTextureLevels = 9;
- ctx->Const.NumCompressedTextureFormats = 0;
}
ctx->Const.MaxTextureUnits = TDFX_IS_BANSHEE( fxMesa ) ? 1 : 2;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
index 7decaa97e..59e21b0d5 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
@@ -56,7 +56,7 @@
#include "context.h"
#include "macros.h"
#include "matrix.h"
-#include "mem.h"
+#include "imports.h"
#include "mtypes.h"
#include "tdfx_screen.h"
@@ -507,7 +507,7 @@ struct tdfx_texcombine_ext {
/* Used to track changes between Glide's state and Mesa's */
struct tdfx_texstate {
- GLuint Enabled; /* bitmask of all units */
+ GLuint Enabled[2]; /* values ala ctx->Texture.Unit[i]._ReallyEnabled */
GLenum EnvMode[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */
GLenum TexFormat[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */
};
@@ -947,8 +947,7 @@ struct tdfx_context {
extern GLboolean
-tdfxCreateContext( Display *dpy,
- const __GLcontextModes *mesaVis,
+tdfxCreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate );
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
index f45b8969d..1e5914db3 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
@@ -49,7 +49,7 @@
#endif
-#define TDFX_DATE "20020221"
+#define TDFX_DATE "20021125"
/* These are used in calls to FX_grColorMaskv() */
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
index e17a4c463..dc4c97619 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
@@ -54,7 +54,7 @@ void tdfxGetLock( tdfxContextPtr fxMesa )
drmGetLock( fxMesa->driFd, fxMesa->hHWContext, 0 );
/* This macro will update dPriv's cliprects if needed */
- DRI_VALIDATE_DRAWABLE_INFO( cPriv->display, sPriv, dPriv );
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
if ( saPriv->fifoOwner != fxMesa->hHWContext ) {
fxMesa->Glide.grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead );
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
index 940c49a12..803c8c5c1 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
@@ -64,6 +64,7 @@
} while (0);
+#if 0
static FxBool
FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
@@ -76,7 +77,7 @@ FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer,
UNLOCK_HARDWARE(fxMesa);
return result;
}
-
+#endif
#define FX_grLfbUnlock(fxMesa, t, b) \
@@ -511,7 +512,7 @@ tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2);
const GLushort *src = (const GLushort *) info.lfbPtr
+ scrY * srcStride + scrX;
- const GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
+ GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
dstImage, width, height, format, type, 0, 0, 0);
const GLint dstStride = _mesa_image_row_stride(packing,
width, format, type);
@@ -572,7 +573,7 @@ tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
+ scrY * srcStride + scrX;
const GLint dstStride =
_mesa_image_row_stride(packing, width, format, type);
- const GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
+ GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
dstImage, width, height, format, type, 0, 0, 0);
const GLint widthInBytes = width * 4;
@@ -616,7 +617,7 @@ tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._ReallyEnabled ||
+ ctx->Texture._EnabledUnits ||
ctx->Depth.OcclusionTest ||
fxMesa->Fallback)
{
@@ -662,7 +663,7 @@ tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
{
const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
? (fxMesa->screen_width * 4) : (info.strideInBytes);
- const GLubyte *dst = (const GLubyte *) info.lfbPtr
+ GLubyte *dst = (GLubyte *) info.lfbPtr
+ scrY * dstStride + scrX * 4;
const GLint srcStride =
_mesa_image_row_stride(unpack, width, format, type);
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
index 558766894..1cb3eeddb 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
@@ -67,7 +67,7 @@ static void tdfxDDClear( GLcontext *ctx,
mask &= ~(DD_ACCUM_BIT);
if (mask & DD_STENCIL_BIT) {
- if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask != 0xff) {
+ if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask[0] != 0xff) {
/* Napalm seems to have trouble with stencil write masks != 0xff */
/* do stencil clear in software */
mask &= ~(DD_STENCIL_BIT);
@@ -275,7 +275,7 @@ static void tdfxDDClear( GLcontext *ctx,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear);
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT)
+ if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (!ctx->Depth.Test || !ctx->Depth.Mask)
fxMesa->Glide.grDepthMask(FXFALSE);
@@ -295,7 +295,7 @@ static void tdfxDDClear( GLcontext *ctx,
fxMesa->Glide.grDepthMask(FXTRUE);
}
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT)
+ if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
}
@@ -532,7 +532,7 @@ static void uploadTextureImages( tdfxContextPtr fxMesa )
GLcontext *ctx = fxMesa->glCtx;
int unit;
for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- if (ctx->Texture.Unit[unit]._ReallyEnabled == TEXTURE0_2D) {
+ if (ctx->Texture.Unit[unit]._ReallyEnabled == TEXTURE_2D_BIT) {
struct gl_texture_object *tObj = ctx->Texture.Unit[unit].Current2D;
tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
if (ti && ti->reloadImages && ti->whichTMU != TDFX_TMU_NONE) {
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
index 6a9bf0801..611c13afc 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
@@ -34,8 +34,6 @@
*
*/
-#include <X11/Xlibint.h>
-
#include "tdfx_dri.h"
#include "tdfx_context.h"
#include "tdfx_lock.h"
@@ -125,16 +123,12 @@ tdfxInitDriver( __DRIscreenPrivate *sPriv )
fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv );
}
- /* Check the DRI version */
- if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) {
- if ( major != 4 ||
- minor < 0 ) {
- __driUtilMessage(
- "3dfx DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- major, minor, patch );
- return GL_FALSE;
- }
+ /* Check the DRI externsion version */
+ if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) {
+ __driUtilMessage( "tdfx DRI driver expected DRI version 4.0.x "
+ "but got version %d.%d.%d",
+ sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
+ return NULL;
}
/* Check that the DDX driver version is compatible */
@@ -167,8 +161,7 @@ tdfxInitDriver( __DRIscreenPrivate *sPriv )
static GLboolean
-tdfxCreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
@@ -196,9 +189,9 @@ tdfxDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
static void
-tdfxSwapBuffers(Display *dpy, void *drawablePrivate)
+tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
+
{
- __DRIdrawablePrivate *driDrawPriv = (__DRIdrawablePrivate*) drawablePrivate;
GET_CURRENT_CONTEXT(ctx);
tdfxContextPtr fxMesa = 0;
GLframebuffer *mesaBuffer;
@@ -221,7 +214,7 @@ tdfxSwapBuffers(Display *dpy, void *drawablePrivate)
if ( curDrawPriv == driDrawPriv ) {
/* swapping window bound to current context, flush first */
- _mesa_swapbuffers( ctx );
+ _mesa_notifySwapBuffers( ctx );
LOCK_HARDWARE( fxMesa );
}
else {
@@ -300,21 +293,9 @@ tdfxSwapBuffers(Display *dpy, void *drawablePrivate)
-/* This function is called by libGL.so as soon as libGL.so is loaded.
- * This is where we'd register new extension functions with the dispatcher.
- */
void __driRegisterExtensions( void )
{
-#if 0
- /* Example. Also look in tdfx_dd.c for more details. */
- {
- const int _gloffset_FooBarEXT = 555; /* just an example number! */
- if ( _glapi_add_entrypoint( "glFooBarEXT", _gloffset_FooBarEXT ) ) {
- void *f = glXGetProcAddressARB( "glFooBarEXT" );
- assert( f );
- }
- }
-#endif
+ /* See r200 driver for info */
}
static GLboolean
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
index 71dd984f2..2574a846a 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
@@ -1307,21 +1307,19 @@ static void tdfxSpanRenderFinish( GLcontext *ctx )
}
/* Set the buffer used for reading */
-static void tdfxDDSetReadBuffer( GLcontext *ctx,
- GLframebuffer *buffer, GLenum mode )
+static void tdfxDDSetBuffer( GLcontext *ctx,
+ GLframebuffer *buffer, GLuint bufferBit )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
(void) buffer;
- switch ( mode ) {
- case GL_FRONT_LEFT:
- fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
+ switch ( bufferBit ) {
+ case FRONT_LEFT_BIT:
+ fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
break;
-
- case GL_BACK_LEFT:
- fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
+ case BACK_LEFT_BIT:
+ fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
break;
-
default:
break;
}
@@ -1336,7 +1334,7 @@ void tdfxDDInitSpanFuncs( GLcontext *ctx )
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- swdd->SetReadBuffer = tdfxDDSetReadBuffer;
+ swdd->SetBuffer = tdfxDDSetBuffer;
if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) )
{
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
index a72656e34..ea9f229f7 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
@@ -37,6 +37,7 @@
*/
#include "mtypes.h"
+#include "colormac.h"
#include "texformat.h"
#include "texstore.h"
@@ -66,7 +67,7 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx )
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
GrCmpFnc_t func;
GrAlphaBlendFnc_t srcRGB, dstRGB, srcA, dstA;
- GrAlpha_t ref = ctx->Color.AlphaRef;
+ GrAlpha_t ref = (GLint) (ctx->Color.AlphaRef * 255.0);
if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
fprintf( stderr, "%s()\n", __FUNCTION__ );
@@ -257,7 +258,7 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx )
}
}
-static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLchan ref )
+static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
@@ -468,13 +469,13 @@ static void tdfxUpdateStencil( GLcontext *ctx )
if (fxMesa->haveHwStencil) {
if (ctx->Stencil.Enabled) {
- fxMesa->Stencil.Function = ctx->Stencil.Function - GL_NEVER;
- fxMesa->Stencil.RefValue = ctx->Stencil.Ref;
- fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask;
- fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask;
- fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc);
- fxMesa->Stencil.ZFailFunc =convertGLStencilOp(ctx->Stencil.ZFailFunc);
- fxMesa->Stencil.ZPassFunc =convertGLStencilOp(ctx->Stencil.ZPassFunc);
+ fxMesa->Stencil.Function = ctx->Stencil.Function[0] - GL_NEVER;
+ fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0];
+ fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0];
+ fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask[0];
+ fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc[0]);
+ fxMesa->Stencil.ZFailFunc = convertGLStencilOp(ctx->Stencil.ZFailFunc[0]);
+ fxMesa->Stencil.ZPassFunc = convertGLStencilOp(ctx->Stencil.ZPassFunc[0]);
fxMesa->Stencil.Clear = ctx->Stencil.Clear & 0xff;
}
fxMesa->dirty |= TDFX_UPLOAD_STENCIL;
@@ -796,12 +797,17 @@ static void tdfxDDColorMask( GLcontext *ctx,
static void tdfxDDClearColor( GLcontext *ctx,
- const GLchan color[4] )
+ const GLfloat color[4] )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
+ GLubyte c[4];
FLUSH_BATCH( fxMesa );
- fxMesa->Color.ClearColor = TDFXPACKCOLOR888( color[0], color[1], color[2] );
- fxMesa->Color.ClearAlpha = color[3];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+ fxMesa->Color.ClearColor = TDFXPACKCOLOR888( c[0], c[1], c[2] );
+ fxMesa->Color.ClearAlpha = c[3];
}
@@ -871,7 +877,7 @@ void tdfxUpdateViewport( GLcontext *ctx )
m[MAT_SZ] = v[MAT_SZ];
m[MAT_TZ] = v[MAT_TZ];
- fxMesa->SetupNewInputs |= VERT_CLIP;
+ fxMesa->SetupNewInputs |= VERT_BIT_CLIP;
}
@@ -996,7 +1002,7 @@ static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
/* Set the buffer used for drawing */
/* XXX support for separate read/draw buffers hasn't been tested */
-static void tdfxDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
+static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
@@ -1006,31 +1012,41 @@ static void tdfxDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
FLUSH_BATCH( fxMesa );
- switch( mode) {
- case GL_FRONT_LEFT:
+ /*
+ * _DrawDestMask is easier to cope with than <mode>.
+ */
+ switch ( ctx->Color._DrawDestMask ) {
+ case FRONT_LEFT_BIT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
-
- case GL_BACK_LEFT:
+ case BACK_LEFT_BIT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
-
- case GL_NONE:
+ case 0:
FX_grColorMaskv( ctx, false4 );
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
-
default:
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_TRUE );
break;
}
+
+ /* We want to update the s/w rast state too so that tdfxDDSetBuffer()
+ * gets called.
+ */
+ _swrast_DrawBuffer(ctx, mode);
}
+static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode )
+{
+ /* XXX ??? */
+}
+
/* =============================================================
* Polygon stipple
@@ -1282,7 +1298,7 @@ void tdfxInitState( tdfxContextPtr fxMesa )
fxMesa->TexState.EnvMode[i] = ~0;
fxMesa->TexState.TexFormat[i] = ~0;
- fxMesa->TexState.Enabled = 0;
+ fxMesa->TexState.Enabled[i] = 0;
}
if ( ctx->Visual.doubleBufferMode) {
@@ -1373,7 +1389,8 @@ void tdfxDDInitStateFuncs( GLcontext *ctx )
*/
ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearColor = tdfxDDClearColor;
- ctx->Driver.SetDrawBuffer = tdfxDDSetDrawBuffer;
+ ctx->Driver.DrawBuffer = tdfxDDDrawBuffer;
+ ctx->Driver.ReadBuffer = tdfxDDReadBuffer;
ctx->Driver.IndexMask = NULL;
ctx->Driver.ColorMask = tdfxDDColorMask;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c
index b90992c7a..a20215cb8 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c
@@ -1487,14 +1487,14 @@ static void print_state(tdfxContextPtr fxMesa)
GLenum base1 = tObj1->Image[tObj1->BaseLevel] ? tObj1->Image[tObj1->BaseLevel]->Format : 99;
printf("Unit 0: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[0]._ReallyEnabled,
- fxMesa->TexState.Enabled);
+ fxMesa->TexState.Enabled[0]);
printf(" EnvMode: GL=0x%x Gr=0x%x\n", ctx->Texture.Unit[0].EnvMode,
fxMesa->TexState.EnvMode[0]);
printf(" BaseFmt: GL=0x%x Gr=0x%x\n", base0, fxMesa->TexState.TexFormat[0]);
printf("Unit 1: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[1]._ReallyEnabled,
- fxMesa->TexState.Enabled);
+ fxMesa->TexState.Enabled[1]);
printf(" EnvMode: GL=0x%x Gr:0x%x\n", ctx->Texture.Unit[1].EnvMode,
fxMesa->TexState.EnvMode[1]);
printf(" BaseFmt: GL=0x%x Gr:0x%x\n", base1, fxMesa->TexState.TexFormat[1]);
@@ -1543,7 +1543,7 @@ static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit)
if (TDFX_IS_NAPALM(fxMesa)) {
/* see if we really need to update the unit */
- if (fxMesa->TexState.Enabled != ctx->Texture._ReallyEnabled ||
+ if (fxMesa->TexState.Enabled[unit] != ctx->Texture.Unit[unit]._ReallyEnabled ||
envMode != fxMesa->TexState.EnvMode[0] ||
envMode == GL_COMBINE_EXT ||
baseFormat != fxMesa->TexState.TexFormat[0]) {
@@ -1577,7 +1577,7 @@ static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit)
otherEnv->Alpha.Shift = 0;
otherEnv->Alpha.Invert = FXFALSE;
- fxMesa->TexState.Enabled = ctx->Texture._ReallyEnabled;
+ fxMesa->TexState.Enabled[unit] = ctx->Texture.Unit[unit]._ReallyEnabled;
fxMesa->TexState.EnvMode[0] = envMode;
fxMesa->TexState.TexFormat[0] = baseFormat;
fxMesa->TexState.EnvMode[1] = 0;
@@ -1588,7 +1588,7 @@ static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit)
/* Voodoo3 */
/* see if we really need to update the unit */
- if (fxMesa->TexState.Enabled != ctx->Texture._ReallyEnabled ||
+ if (fxMesa->TexState.Enabled[unit] != ctx->Texture.Unit[unit]._ReallyEnabled ||
envMode != fxMesa->TexState.EnvMode[0] ||
envMode == GL_COMBINE_EXT ||
baseFormat != fxMesa->TexState.TexFormat[0]) {
@@ -1596,7 +1596,7 @@ static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit)
/* software fallback */
FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
}
- fxMesa->TexState.Enabled = ctx->Texture._ReallyEnabled;
+ fxMesa->TexState.Enabled[unit] = ctx->Texture.Unit[unit]._ReallyEnabled;
fxMesa->TexState.EnvMode[0] = envMode;
fxMesa->TexState.TexFormat[0] = baseFormat;
fxMesa->TexState.EnvMode[1] = 0;
@@ -1850,7 +1850,7 @@ static void setupTextureDoubleTMU(GLcontext * ctx)
GLboolean hw1 = GL_TRUE, hw2 = GL_TRUE;
/* check if we really need to update glide unit 1 */
- if (fxMesa->TexState.Enabled != ctx->Texture._ReallyEnabled ||
+ if (fxMesa->TexState.Enabled[0] != ctx->Texture.Unit[0]._ReallyEnabled ||
envMode0 != fxMesa->TexState.EnvMode[1] ||
envMode0 == GL_COMBINE_EXT ||
baseImage0->Format != fxMesa->TexState.TexFormat[1] ||
@@ -1859,10 +1859,11 @@ static void setupTextureDoubleTMU(GLcontext * ctx)
baseImage0->Format, &fxMesa->TexCombineExt[1]);
fxMesa->TexState.EnvMode[1] = envMode0;
fxMesa->TexState.TexFormat[1] = baseImage0->Format;
+ fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled;
}
/* check if we really need to update glide unit 0 */
- if (fxMesa->TexState.Enabled != ctx->Texture._ReallyEnabled ||
+ if (fxMesa->TexState.Enabled[1] != ctx->Texture.Unit[1]._ReallyEnabled ||
envMode1 != fxMesa->TexState.EnvMode[0] ||
envMode1 == GL_COMBINE_EXT ||
baseImage1->Format != fxMesa->TexState.TexFormat[0] ||
@@ -1871,9 +1872,9 @@ static void setupTextureDoubleTMU(GLcontext * ctx)
baseImage1->Format, &fxMesa->TexCombineExt[0]);
fxMesa->TexState.EnvMode[0] = envMode1;
fxMesa->TexState.TexFormat[0] = baseImage1->Format;
+ fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled;
}
- fxMesa->TexState.Enabled = ctx->Texture._ReallyEnabled;
if (!hw1 || !hw2) {
FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
@@ -1887,7 +1888,8 @@ static void setupTextureDoubleTMU(GLcontext * ctx)
unit0 = 0;
unit1 = 1 - unit0;
- if (fxMesa->TexState.Enabled != ctx->Texture._ReallyEnabled ||
+ if (fxMesa->TexState.Enabled[0] != ctx->Texture.Unit[0]._ReallyEnabled ||
+ fxMesa->TexState.Enabled[1] != ctx->Texture.Unit[1]._ReallyEnabled ||
envMode0 != fxMesa->TexState.EnvMode[unit0] ||
envMode0 == GL_COMBINE_EXT ||
envMode1 != fxMesa->TexState.EnvMode[unit1] ||
@@ -1906,7 +1908,8 @@ static void setupTextureDoubleTMU(GLcontext * ctx)
fxMesa->TexState.TexFormat[unit0] = baseImage0->Format;
fxMesa->TexState.EnvMode[unit1] = envMode1;
fxMesa->TexState.TexFormat[unit1] = baseImage1->Format;
- fxMesa->TexState.Enabled = ctx->Texture._ReallyEnabled;
+ fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled;
+ fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled;
}
}
}
@@ -1916,31 +1919,29 @@ void
tdfxUpdateTextureState( GLcontext *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint tex2Denabled = ctx->Texture._ReallyEnabled;
-
- if (!fxMesa->haveTwoTMUs)
- tex2Denabled &= TEXTURE0_2D;
FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_FALSE);
FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_FALSE);
- switch (tex2Denabled) {
- case TEXTURE0_2D:
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == 0) {
LOCK_HARDWARE( fxMesa ); /* XXX remove locking eventually */
setupTextureSingleTMU(ctx, 0);
UNLOCK_HARDWARE( fxMesa );
- break;
- case TEXTURE1_2D:
+ }
+ else if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
LOCK_HARDWARE( fxMesa );
setupTextureSingleTMU(ctx, 1);
UNLOCK_HARDWARE( fxMesa );
- break;
- case (TEXTURE0_2D | TEXTURE1_2D):
+ }
+ else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
LOCK_HARDWARE( fxMesa );
setupTextureDoubleTMU(ctx);
UNLOCK_HARDWARE( fxMesa );
- break;
- default:
+ }
+ else {
/* disable hardware texturing */
if (TDFX_IS_NAPALM(fxMesa)) {
fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB;
@@ -1978,12 +1979,19 @@ tdfxUpdateTextureState( GLcontext *ctx )
fxMesa->AlphaCombine.Invert = FXFALSE;
}
- fxMesa->TexState.Enabled = 0;
+ fxMesa->TexState.Enabled[0] = 0;
+ fxMesa->TexState.Enabled[1] = 0;
fxMesa->TexState.EnvMode[0] = 0;
fxMesa->TexState.EnvMode[1] = 0;
fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
+
+ if (ctx->Texture.Unit[0]._ReallyEnabled != 0 ||
+ ctx->Texture.Unit[1]._ReallyEnabled != 0) {
+ /* software texture (cube map, rect tex, etc */
+ FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
+ }
}
}
@@ -2027,7 +2035,9 @@ tdfxUpdateTextureBinding( GLcontext *ctx )
fxMesa->tScale1 = ti1->tScale;
}
- if (ctx->Texture._ReallyEnabled == TEXTURE0_2D) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[0]._ReallyEnabled == 0) {
+ /* Only unit 0 2D enabled */
if (shared->umaTexMemory) {
fxMesa->TexSource[0].StartAddress = ti0->tm[0]->startAddr;
fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
@@ -2058,14 +2068,18 @@ tdfxUpdateTextureBinding( GLcontext *ctx )
}
}
}
- else if (ctx->Texture._ReallyEnabled == TEXTURE1_2D) {
+ else if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
+ ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) {
+ /* Only unit 1 2D enabled */
if (shared->umaTexMemory) {
fxMesa->TexSource[0].StartAddress = ti1->tm[0]->startAddr;
fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[0].Info = &(ti1->info);
}
}
- else if (ctx->Texture._ReallyEnabled == (TEXTURE0_2D | TEXTURE1_2D)) {
+ else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) {
+ /* Both 2D enabled */
if (shared->umaTexMemory) {
const FxU32 tmu0 = 0, tmu1 = 1;
fxMesa->TexSource[tmu0].StartAddress = ti0->tm[0]->startAddr;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
index b81ddd540..c67683ecb 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
@@ -29,9 +29,6 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include <stdio.h>
-#include <math.h>
-
#include "glheader.h"
#include "mtypes.h"
#include "macros.h"
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c
index 1375bb08a..31a47b1b2 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c
@@ -26,7 +26,7 @@
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "colormac.h"
#include "mmath.h"
@@ -271,18 +271,18 @@ void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[fxMesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= TDFX_RGBA_BIT;
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
ind |= TDFX_TEX0_BIT;
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
ind |= TDFX_TEX0_BIT|TDFX_TEX1_BIT;
if (fxMesa->SetupIndex & TDFX_PTEX_BIT)
@@ -303,9 +303,11 @@ void tdfxChooseVertexState( GLcontext *ctx )
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
GLuint ind = TDFX_XYZ_BIT|TDFX_RGBA_BIT;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
+ if (ctx->Texture._EnabledUnits & 0x2)
+ /* unit 1 enabled */
ind |= TDFX_W_BIT|TDFX_TEX1_BIT|TDFX_TEX0_BIT;
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
+ else if (ctx->Texture._EnabledUnits & 0x1)
+ /* unit 0 enabled */
ind |= TDFX_W_BIT|TDFX_TEX0_BIT;
else if (ctx->Fog.Enabled)
ind |= TDFX_W_BIT;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h
index 558f38666..9925a10ea 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vbtmp.h
@@ -12,8 +12,8 @@ static void TAG(emit)( GLcontext *ctx,
GLubyte (*col)[4];
GLuint tc0_stride, tc1_stride, col_stride;
GLuint tc0_size, tc1_size;
- GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
- GLuint proj_stride = VB->ProjectedClipPtr->stride;
+ GLfloat (*proj)[4] = VB->NdcPtr->data;
+ GLuint proj_stride = VB->NdcPtr->stride;
tdfxVertex *v = (tdfxVertex *)dest;
GLfloat u0scale,v0scale,u1scale,v1scale;
const GLubyte *mask = VB->ClipMask;
@@ -185,8 +185,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLubyte (*col)[4];
GLuint col_stride;
- GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
- GLuint proj_stride = VB->ProjectedClipPtr->stride;
+ GLfloat (*proj)[4] = VB->NdcPtr->data;
+ GLuint proj_stride = VB->NdcPtr->stride;
GLfloat *v = (GLfloat *)dest;
const GLubyte *mask = VB->ClipMask;
const GLfloat *s = fxMesa->hw_viewport;