summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/trident
diff options
context:
space:
mode:
authorAdam Jackson <ajax@freedesktop.org>2004-12-24 03:04:14 +0000
committerAdam Jackson <ajax@freedesktop.org>2004-12-24 03:04:14 +0000
commit46a35b2284211e2c068c4c37f8bd3aced240e47a (patch)
tree45a723fcfb6a7557ff61a0adde675d8c82c79f16 /src/mesa/drivers/dri/trident
parent1c86c7ad9c38b5ef1baa19677b78076889b60e7f (diff)
Get trident building and -Werror clean.
- Added Makefile - Deleted references to old headers - Added prototypes all over the place - Lots of type updates (drmHandle -> drm_handle_t etc.) - Added __driCreateNewScreen(), deleted __driCreateScreen() - Fixed context creation to match other drivers - Fixed various bitfield names - Bumped driver date Still nowhere close to usable, the DDX isn't DRI-aware and there's no DRM.
Diffstat (limited to 'src/mesa/drivers/dri/trident')
-rw-r--r--src/mesa/drivers/dri/trident/Makefile36
-rw-r--r--src/mesa/drivers/dri/trident/trident_context.c99
-rw-r--r--src/mesa/drivers/dri/trident/trident_context.h37
-rw-r--r--src/mesa/drivers/dri/trident/trident_dd.c3
-rw-r--r--src/mesa/drivers/dri/trident/trident_dri.h28
-rw-r--r--src/mesa/drivers/dri/trident/trident_lock.h11
-rw-r--r--src/mesa/drivers/dri/trident/trident_state.c28
-rw-r--r--src/mesa/drivers/dri/trident/trident_tris.c25
-rw-r--r--src/mesa/drivers/dri/trident/trident_vb.c29
9 files changed, 211 insertions, 85 deletions
diff --git a/src/mesa/drivers/dri/trident/Makefile b/src/mesa/drivers/dri/trident/Makefile
new file mode 100644
index 0000000000..f895500940
--- /dev/null
+++ b/src/mesa/drivers/dri/trident/Makefile
@@ -0,0 +1,36 @@
+# src/mesa/drivers/dri/trident/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = trident_dri.so
+
+# Not yet
+# MINIGLX_SOURCES = server/trident_dri.c
+
+COMMON_SOURCES = \
+ ../../common/driverfuncs.c \
+ ../common/mm.c \
+ ../common/utils.c \
+ ../common/texmem.c \
+ ../common/vblank.c \
+ ../common/xmlconfig.c \
+ ../common/dri_util.c \
+ ../common/glcontextmodes.c
+
+DRIVER_SOURCES = \
+ trident_context.c \
+ trident_state.c \
+ trident_vb.c \
+ trident_dd.c \
+ trident_tris.c
+
+C_SOURCES = \
+ $(COMMON_SOURCES) \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../Makefile.template
+
+symlinks:
diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c
index 168e7d1fc4..76240668d7 100644
--- a/src/mesa/drivers/dri/trident/trident_context.c
+++ b/src/mesa/drivers/dri/trident/trident_context.c
@@ -37,17 +37,18 @@
#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
#include "simple_list.h"
-#include "mem.h"
#include "mm.h"
-static const struct gl_pipeline_stage *trident_pipeline[] = {
+#include "drivers/common/driverfuncs.h"
+#include "dri_util.h"
+
+static const struct tnl_pipeline_stage *trident_pipeline[] = {
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
@@ -58,7 +59,7 @@ static const struct gl_pipeline_stage *trident_pipeline[] = {
};
-GLboolean tridentCreateContext( Display *dpy, const __GLcontextModes *glVisual,
+GLboolean tridentCreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate)
{
@@ -66,6 +67,7 @@ GLboolean tridentCreateContext( Display *dpy, const __GLcontextModes *glVisual,
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
tridentContextPtr tmesa;
tridentScreenPtr tridentscrn;
+ struct dd_function_table functions;
#if 0
drm_trident_sarea_t *saPriv=(drm_trident_sarea_t *)(((char*)sPriv->pSAREA)+
sizeof(XF86DRISAREARec));
@@ -80,20 +82,22 @@ GLboolean tridentCreateContext( Display *dpy, const __GLcontextModes *glVisual,
else
shareCtx = NULL;
- tmesa->glCtx = _mesa_create_context(glVisual, shareCtx, tmesa, GL_TRUE);
+ _mesa_init_driver_functions(&functions);
+
+ tmesa->glCtx =
+ _mesa_create_context(glVisual, shareCtx, &functions, (void *)tmesa);
+
if (!tmesa->glCtx) {
FREE(tmesa);
return GL_FALSE;
}
- tmesa->display = dpy;
-
tmesa->driContext = driContextPriv;
tmesa->driScreen = sPriv;
tmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
tmesa->hHWContext = driContextPriv->hHWContext;
- tmesa->driHwLock = &sPriv->pSAREA->lock;
+ tmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock;
tmesa->driFd = sPriv->fd;
#if 0
tmesa->sarea = saPriv;
@@ -159,11 +163,11 @@ GLboolean tridentCreateContext( Display *dpy, const __GLcontextModes *glVisual,
tridentDDInitTriFuncs( ctx );
tridentDDInitState( tmesa );
- driContextPriv->driverPrivate = (void *)tmesa;
+ driContextPriv->driverPrivate = (void *)tmesa;
UNLOCK_HARDWARE(tmesa);
- return GL_TRUE;
+ return GL_TRUE;
}
static void
@@ -181,15 +185,14 @@ tridentDestroyContext(__DRIcontextPrivate *driContextPriv)
tmesa->glCtx->DriverCtx = NULL;
_mesa_destroy_context(tmesa->glCtx);
- Xfree(tmesa);
+ _mesa_free(tmesa);
driContextPriv->driverPrivate = NULL;
}
}
static GLboolean
-tridentCreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
@@ -217,10 +220,9 @@ tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
}
static void
-tridentSwapBuffers(Display *dpy, void *drawablePrivate)
+tridentSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- (void) dpy;
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
tridentContextPtr tmesa;
@@ -228,7 +230,7 @@ tridentSwapBuffers(Display *dpy, void *drawablePrivate)
tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = tmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
- _mesa_swapbuffers( ctx ); /* flush pending rendering comands */
+ _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
tridentCopyBuffer( dPriv );
}
}
@@ -284,24 +286,11 @@ tridentUnbindContext( __DRIcontextPrivate *driContextPriv )
return GL_TRUE;
}
-static GLboolean
-tridentOpenFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static GLboolean
-tridentCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
tridentScreenPtr tridentCreateScreen( __DRIscreenPrivate *sPriv )
{
TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv;
tridentScreenPtr tridentScreen;
- int i;
#if 0
/* Check the DRI version */
@@ -360,7 +349,7 @@ printf("offset 0x%x 0x%x\n",tridentScreen->backOffset,tridentScreen->depthOffset
FREE(tridentScreen);
return GL_FALSE;
}
-printf("MAPPED at 0x%x\n",tridentScreen->mmio.map);
+printf("MAPPED at %p\n", tridentScreen->mmio.map);
return tridentScreen;
}
@@ -396,23 +385,49 @@ static struct __DriverAPIRec tridentAPI = {
tridentSwapBuffers,
tridentMakeCurrent,
tridentUnbindContext,
- tridentOpenFullScreen,
- tridentCloseFullScreen
};
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
+#ifndef USE_NEW_INTERFACE
+#error trident_dri.so is new-interface only.
+#else
+
+static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
+
+PUBLIC void *__driCreateNewScreen( __DRInativeDisplay *dpy, int scrn,
+ __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ __GLcontextModes ** driver_modes )
{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &tridentAPI);
- return (void *) psp;
+ __DRIscreenPrivate *psp;
+ /* XXX version checks */
+
+ psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ ddx_version, dri_version, drm_version,
+ frame_buffer, pSAREA, fd,
+ internal_api_version, &tridentAPI);
+
+ if ( psp != NULL ) {
+ create_context_modes = (PFNGLXCREATECONTEXTMODES)
+ glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
+#if 0
+ if ( create_context_modes != NULL ) {
+ TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv;
+ *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8,
+ GL_TRUE );
+ }
+#endif
+ }
+ return (void *) psp;
}
+#endif
+
void __driRegisterExtensions(void)
{
/* No extensions */
diff --git a/src/mesa/drivers/dri/trident/trident_context.h b/src/mesa/drivers/dri/trident/trident_context.h
index ee098e5e7d..74a3acb2ce 100644
--- a/src/mesa/drivers/dri/trident/trident_context.h
+++ b/src/mesa/drivers/dri/trident/trident_context.h
@@ -27,7 +27,6 @@
#ifndef _TRIDENT_CONTEXT_H_
#define _TRIDENT_CONTEXT_H_
-#include "compiler.h"
#include "dri_util.h"
#include "macros.h"
#include "mtypes.h"
@@ -54,6 +53,23 @@
#include "tnl_dd/t_dd_vertex.h"
#undef TAG
+/* these require that base be dword-aligned */
+static inline void MMIO_OUT32(unsigned char *base, unsigned int offset,
+ unsigned int val)
+{
+ unsigned int *addr = (unsigned int *)(base + offset);
+ *addr = val;
+}
+
+static inline unsigned int MMIO_IN32(unsigned char *base, unsigned int offset)
+{
+ unsigned int *addr = (unsigned int *)(base + offset);
+ return *addr;
+}
+
+#define MMIO_OUT8(base, offset, val) *((base) + (offset)) = (val)
+#define MMIO_IN8(base, offset) *((base) + (offset))
+
struct trident_context;
typedef struct trident_context tridentContextRec;
typedef struct trident_context *tridentContextPtr;
@@ -74,7 +90,7 @@ typedef void (*trident_point_func)( tridentContextPtr,
const tridentVertex * );
typedef struct {
- drmHandle handle; /* Handle to the DRM region */
+ drm_handle_t handle; /* Handle to the DRM region */
drmSize size; /* Size of the DRM region */
unsigned char *map; /* Mapping of the DRM region */
} tridentRegionRec, *tridentRegionPtr;
@@ -123,11 +139,9 @@ struct trident_context {
/* Mirrors of some DRI state
*/
- Display *display; /* X server display */
-
int lastStamp; /* mirror driDrawable->lastStamp */
- drmContext hHWContext;
+ drm_context_t hHWContext;
drmLock *driHwLock;
int driFd;
@@ -141,10 +155,10 @@ struct trident_context {
GLint readOffset, readPitch;
GLuint numClipRects; /* Cliprects for the draw buffer */
- XF86DRIClipRectPtr pClipRects;
+ drm_clip_rect_t *pClipRects;
GLint scissor;
- XF86DRIClipRectRec ScissorRect; /* Current software scissor */
+ drm_clip_rect_t ScissorRect; /* Current software scissor */
GLuint Fallback;
GLuint RenderIndex;
@@ -199,10 +213,19 @@ void tridentInitHW( tridentContextPtr tmesa );
void tridentDDInitStateFuncs( GLcontext *ctx );
void tridentDDInitTextureFuncs( GLcontext *ctx );
void tridentDDInitTriFuncs( GLcontext *ctx );
+
extern void tridentBuildVertices( GLcontext *ctx,
GLuint start,
GLuint count,
GLuint newinputs );
+extern void tridentInitVB( GLcontext *ctx );
+extern void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv );
+extern void tridentFallback( tridentContextPtr tmesa, GLuint bit,
+ GLboolean mode );
+extern void tridentCheckTexSizes( GLcontext *ctx );
+extern void tridentChooseVertexState( GLcontext *ctx );
+extern void tridentDDUpdateHWState( GLcontext *ctx );
+extern void tridentUploadHwStateLocked( tridentContextPtr tmesa );
#define TRIDENT_CONTEXT(ctx) ((tridentContextPtr)(ctx->DriverCtx))
diff --git a/src/mesa/drivers/dri/trident/trident_dd.c b/src/mesa/drivers/dri/trident/trident_dd.c
index 2f79ffcf6a..35e1cf0035 100644
--- a/src/mesa/drivers/dri/trident/trident_dd.c
+++ b/src/mesa/drivers/dri/trident/trident_dd.c
@@ -33,8 +33,7 @@
#include "swrast/swrast.h"
#include "context.h"
-#define TRIDENT_DATE "20020318"
-
+#define TRIDENT_DATE "20041223"
/* Return the width and height of the current color buffer.
*/
diff --git a/src/mesa/drivers/dri/trident/trident_dri.h b/src/mesa/drivers/dri/trident/trident_dri.h
new file mode 100644
index 0000000000..c1ce3c4682
--- /dev/null
+++ b/src/mesa/drivers/dri/trident/trident_dri.h
@@ -0,0 +1,28 @@
+#ifndef _TRIDENT_DRI_
+#define _TRIDENT_DRI_
+
+#include "xf86drm.h"
+
+typedef struct {
+ drm_handle_t regs;
+ drmSize regsSize;
+ drmAddress regsMap;
+ int deviceID;
+ int width;
+ int height;
+ int mem;
+ int frontOffset;
+ int frontPitch;
+ int backOffset;
+ int backPitch;
+ int depthOffset;
+ int depthPitch;
+ int cpp;
+#if 0
+ int textureOffset;
+ int textureSize;
+#endif
+ unsigned int sarea_priv_offset;
+} TRIDENTDRIRec, *TRIDENTDRIPtr;
+
+#endif
diff --git a/src/mesa/drivers/dri/trident/trident_lock.h b/src/mesa/drivers/dri/trident/trident_lock.h
new file mode 100644
index 0000000000..ee0819f5ca
--- /dev/null
+++ b/src/mesa/drivers/dri/trident/trident_lock.h
@@ -0,0 +1,11 @@
+/* XXX tridentGetLock doesn't exist... */
+
+#define LOCK_HARDWARE(tmesa) \
+ do { \
+ char __ret = 0; \
+ DRM_CAS(tmesa->driHwLock, tmesa->hHWContext, \
+ DRM_LOCK_HELD | tmesa->hHWContext, __ret); \
+ } while (0)
+
+#define UNLOCK_HARDWARE(tmesa) \
+ DRM_UNLOCK(tmesa->driFd, tmesa->driHwLock, tmesa->hHWContext)
diff --git a/src/mesa/drivers/dri/trident/trident_state.c b/src/mesa/drivers/dri/trident/trident_state.c
index 49318824f5..2b9323f991 100644
--- a/src/mesa/drivers/dri/trident/trident_state.c
+++ b/src/mesa/drivers/dri/trident/trident_state.c
@@ -26,7 +26,10 @@
*/
#include "trident_context.h"
#include "trident_lock.h"
+#include "array_cache/acache.h"
#include "swrast/swrast.h"
+#include "swrast_setup/swrast_setup.h"
+#include "tnl/tnl.h"
#define TRIDENTPACKCOLOR332(r, g, b) \
(((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))
@@ -90,9 +93,9 @@ void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv )
{
unsigned char *MMIO;
tridentContextPtr tmesa;
- GLint nbox, i, ret;
+ GLint nbox, i;
int busy;
- XF86DRIClipRectPtr pbox;
+ drm_clip_rect_t *pbox;
assert(dPriv);
assert(dPriv->driContextPriv);
@@ -110,7 +113,7 @@ void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv )
for ( i = 0 ; i < nbox ; i++ ) {
#if 0
GLint nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS , nbox );
- XF86DRIClipRectPtr b = tmesa->sarea->boxes;
+ drm_clip_rect_t *b = tmesa->sarea->boxes;
GLint n = 0;
for ( ; i < nr ; i++ ) {
@@ -151,11 +154,9 @@ static void tridentDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
{
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- __DRIdrawablePrivate *dPriv = tmesa->driDrawable;
int busy;
GLuint flags = 0;
GLint i;
- GLint ret;
#define DRM_TRIDENT_FRONT 0x01
#define DRM_TRIDENT_BACK 0x02
@@ -195,8 +196,8 @@ static void tridentDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
for ( i = 0 ; i < tmesa->numClipRects ; i++ ) {
#if 0
int nr = MIN2( i + TRIDENT_NR_SAREA_CLIPRECTS, tmesa->numClipRects );
- XF86DRIClipRectPtr box = tmesa->pClipRects;
- XF86DRIClipRectPtr b = tmesa->sarea->boxes;
+ drm_clip_rect_t *box = tmesa->pClipRects;
+ drm_clip_rect_t *b = tmesa->sarea->boxes;
GLint n = 0;
if ( !all ) {
@@ -363,12 +364,12 @@ void tridentSetCliprects( tridentContextPtr tmesa, GLenum mode )
switch ( mode ) {
case GL_FRONT_LEFT:
if (dPriv->numClipRects == 0) {
- static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0};
+ static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
tmesa->numClipRects = 1;
tmesa->pClipRects = &zeroareacliprect;
} else {
tmesa->numClipRects = dPriv->numClipRects;
- tmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects;
+ tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects;
}
tmesa->drawX = dPriv->x;
tmesa->drawY = dPriv->y;
@@ -376,19 +377,19 @@ void tridentSetCliprects( tridentContextPtr tmesa, GLenum mode )
case GL_BACK_LEFT:
if ( dPriv->numBackClipRects == 0 ) {
if (dPriv->numClipRects == 0) {
- static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0};
+ static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
tmesa->numClipRects = 1;
tmesa->pClipRects = &zeroareacliprect;
} else {
tmesa->numClipRects = dPriv->numClipRects;
- tmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects;
+ tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects;
tmesa->drawX = dPriv->x;
tmesa->drawY = dPriv->y;
}
}
else {
tmesa->numClipRects = dPriv->numBackClipRects;
- tmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pBackClipRects;
+ tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pBackClipRects;
tmesa->drawX = dPriv->backX;
tmesa->drawY = dPriv->backY;
}
@@ -402,6 +403,7 @@ void tridentSetCliprects( tridentContextPtr tmesa, GLenum mode )
#endif
}
+#if 0
static GLboolean tridentDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
{
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
@@ -450,7 +452,7 @@ static void tridentDDClearColor( GLcontext *ctx,
color[0], color[1],
color[2], color[3] );
}
-
+#endif
void tridentDDUpdateState( GLcontext *ctx, GLuint new_state )
{
diff --git a/src/mesa/drivers/dri/trident/trident_tris.c b/src/mesa/drivers/dri/trident/trident_tris.c
index 890e34ed91..ee85ab482c 100644
--- a/src/mesa/drivers/dri/trident/trident_tris.c
+++ b/src/mesa/drivers/dri/trident/trident_tris.c
@@ -31,6 +31,7 @@
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
#include "swrast/swrast.h"
+#include "swrast_setup/swrast_setup.h"
static int first = 1;
@@ -277,7 +278,7 @@ void Init3D( tridentContextPtr tmesa )
int DrawTriangle( tridentContextPtr tmesa)
{
- volatile unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
+ unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
dmaBufRec clr;
printf("DRAW TRI\n");
@@ -416,6 +417,7 @@ static INLINE void trident_draw_point(tridentContextPtr tmesa,
const tridentVertex *v0 )
{
unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
+ (void) MMIO;
}
static INLINE void trident_draw_line( tridentContextPtr tmesa,
@@ -423,6 +425,7 @@ static INLINE void trident_draw_line( tridentContextPtr tmesa,
const tridentVertex *v1 )
{
unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
+ (void) MMIO;
}
static INLINE void trident_draw_triangle( tridentContextPtr tmesa,
@@ -547,6 +550,7 @@ if (vertsize == 4) {
* primitives are being drawn, and only for the unaccelerated
* primitives.
*/
+#if 0
static void
trident_fallback_quad( tridentContextPtr tmesa,
const tridentVertex *v0,
@@ -562,6 +566,11 @@ trident_fallback_quad( tridentContextPtr tmesa,
trident_translate_vertex( ctx, v3, &v[3] );
_swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] );
}
+#endif
+
+/* XXX hack to get the prototype defined in time... */
+void trident_translate_vertex(GLcontext *ctx, const tridentVertex *src,
+ SWvertex *dst);
static void
trident_fallback_tri( tridentContextPtr tmesa,
@@ -649,10 +658,10 @@ do { \
static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
+ tnl_points_func points;
+ tnl_line_func line;
+ tnl_triangle_func triangle;
+ tnl_quad_func quad;
} rast_tab[TRIDENT_MAX_TRIFUNC];
@@ -733,7 +742,9 @@ static const GLuint hw_prim[GL_POLYGON+1] = {
#endif
static void tridentResetLineStipple( GLcontext *ctx );
+#if 0
static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim );
+#endif
static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim );
#define RASTERIZE(x) /*if (tmesa->hw_primitive != hw_prim[x]) \
@@ -985,13 +996,14 @@ static void tridentChooseRenderState(GLcontext *ctx)
* which renders strips as strips, the equivalent calculations are
* performed in tridentrender.c.
*/
-
+#if 0
static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim )
{
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
if (tmesa->hw_primitive != hwprim)
tmesa->hw_primitive = hwprim;
}
+#endif
static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim )
{
@@ -1043,6 +1055,7 @@ static void tridentRenderFinish( GLcontext *ctx )
static void tridentResetLineStipple( GLcontext *ctx )
{
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
+ (void) tmesa;
/* Reset the hardware stipple counter.
*/
diff --git a/src/mesa/drivers/dri/trident/trident_vb.c b/src/mesa/drivers/dri/trident/trident_vb.c
index 4c6e088da4..77e4d9b76e 100644
--- a/src/mesa/drivers/dri/trident/trident_vb.c
+++ b/src/mesa/drivers/dri/trident/trident_vb.c
@@ -26,10 +26,8 @@
*/
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
#include "macros.h"
#include "colormac.h"
-#include "mmath.h"
#include "swrast_setup/swrast_setup.h"
#include "swrast/swrast.h"
@@ -49,8 +47,8 @@
static struct {
void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
+ tnl_interp_func interp;
+ tnl_copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
GLuint vertex_stride_shift;
@@ -77,10 +75,12 @@ static struct {
#define DO_PTEX (IND & TRIDENT_PTEX_BIT)
#define VERTEX tridentVertex
+#define VERTEX_COLOR trident_color_t
#define LOCALVARS tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
#define GET_VIEWPORT_MAT() tmesa->hw_viewport
#define GET_TEXSOURCE(n) tmesa->tmu_source[n]
#define GET_VERTEX_FORMAT() tmesa->vertex_format
+#define GET_VERTEX_SIZE() tmesa->vertex_size
#define GET_VERTEX_STORE() tmesa->verts
#define GET_VERTEX_STRIDE_SHIFT() tmesa->vertex_stride_shift
#define GET_UBYTE_COLOR_STORE() &tmesa->UbyteColor
@@ -310,24 +310,24 @@ void tridentBuildVertices( GLcontext *ctx,
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[tmesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= TRIDENT_RGBA_BIT;
- if (newinputs & VERT_SPEC_RGB)
+ if (newinputs & VERT_BIT_COLOR1)
ind |= TRIDENT_SPEC_BIT;
- if (newinputs & VERT_TEX0)
+ if (newinputs & VERT_BIT_TEX0)
ind |= TRIDENT_TEX0_BIT;
- if (newinputs & VERT_TEX1)
+ if (newinputs & VERT_BIT_TEX1)
ind |= TRIDENT_TEX1_BIT;
- if (newinputs & VERT_FOG_COORD)
+ if (newinputs & VERT_BIT_FOG)
ind |= TRIDENT_FOG_BIT;
if (tmesa->SetupIndex & TRIDENT_PTEX_BIT)
@@ -373,10 +373,9 @@ void tridentChooseVertexState( GLcontext *ctx )
if (ctx->Fog.Enabled)
ind |= TRIDENT_FOG_BIT;
- if (ctx->Texture._ReallyEnabled) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled) {
ind |= TRIDENT_TEX0_BIT;
- if (ctx->Texture.Unit[0]._ReallyEnabled &&
- ctx->Texture.Unit[1]._ReallyEnabled) {
+ if (ctx->Texture.Unit[1]._ReallyEnabled) {
ind |= TRIDENT_TEX1_BIT;
}
}
@@ -424,12 +423,12 @@ void tridentFreeVB( GLcontext *ctx )
}
if (tmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(tmesa->UbyteSecondaryColor.Ptr);
+ ALIGN_FREE((void *)tmesa->UbyteSecondaryColor.Ptr);
tmesa->UbyteSecondaryColor.Ptr = 0;
}
if (tmesa->UbyteColor.Ptr) {
- ALIGN_FREE(tmesa->UbyteColor.Ptr);
+ ALIGN_FREE((void *)tmesa->UbyteColor.Ptr);
tmesa->UbyteColor.Ptr = 0;
}
}