summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2004-01-19 10:41:35 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2004-01-19 10:41:35 +0000
commited43ecee90ad6fdde1e604f7f820ef7f8cd1251b (patch)
tree22fc85ebf63276f9ee8054a2efc59ad512de3dd1
parent41abe9e73f4d6cebd7bdfcc187c566e715894f0d (diff)
Migrate i830 driver to t_vertex.[ch] for building hw vertices.
-rw-r--r--src/mesa/drivers/dri/i830/Makefile.solo1
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.c6
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.h17
-rw-r--r--src/mesa/drivers/dri/i830/i830_debug.c1
-rw-r--r--src/mesa/drivers/dri/i830/i830_render.c7
-rw-r--r--src/mesa/drivers/dri/i830/i830_state.c14
-rw-r--r--src/mesa/drivers/dri/i830/i830_tex.h1
-rw-r--r--src/mesa/drivers/dri/i830/i830_texstate.c49
-rw-r--r--src/mesa/drivers/dri/i830/i830_tris.c157
-rw-r--r--src/mesa/drivers/dri/i830/i830_vb.c574
-rw-r--r--src/mesa/drivers/dri/i830/i830_vb.h64
11 files changed, 156 insertions, 735 deletions
diff --git a/src/mesa/drivers/dri/i830/Makefile.solo b/src/mesa/drivers/dri/i830/Makefile.solo
index 5bef9d0f1f..cc8e795c38 100644
--- a/src/mesa/drivers/dri/i830/Makefile.solo
+++ b/src/mesa/drivers/dri/i830/Makefile.solo
@@ -35,7 +35,6 @@ DRIVER_SOURCES = \
i830_texmem.c \
i830_texstate.c \
i830_tris.c \
- i830_vb.c \
../common/mm.c \
../common/utils.c \
../common/texmem.c \
diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c
index 49ccb9f1d6..eb4fb3f7a4 100644
--- a/src/mesa/drivers/dri/i830/i830_context.c
+++ b/src/mesa/drivers/dri/i830/i830_context.c
@@ -57,7 +57,6 @@
#include "i830_tex.h"
#include "i830_span.h"
#include "i830_tris.h"
-#include "i830_vb.h"
#include "i830_ioctl.h"
@@ -315,8 +314,6 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
imesa->hHWContext = driContextPriv->hHWContext;
imesa->driFd = sPriv->fd;
imesa->driHwLock = &sPriv->pSAREA->lock;
- imesa->vertex_format = 0;
-
imesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
switch(mesaVis->depthBits) {
@@ -360,7 +357,6 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
i830InitTriFuncs (ctx);
i830DDInitSpanFuncs( ctx );
i830DDInitIoctlFuncs( ctx );
- i830InitVB (ctx);
i830DDInitState (ctx);
#if DO_DEBUG
@@ -395,8 +391,6 @@ void i830DestroyContext(__DRIcontextPrivate *driContextPriv)
_ac_DestroyContext (imesa->glCtx);
_swrast_DestroyContext (imesa->glCtx);
- i830FreeVB (imesa->glCtx);
-
/* free the Mesa context */
imesa->glCtx->DriverCtx = NULL;
_mesa_destroy_context(imesa->glCtx);
diff --git a/src/mesa/drivers/dri/i830/i830_context.h b/src/mesa/drivers/dri/i830/i830_context.h
index 188d90c0c9..5f4bb565e1 100644
--- a/src/mesa/drivers/dri/i830/i830_context.h
+++ b/src/mesa/drivers/dri/i830/i830_context.h
@@ -38,6 +38,7 @@ typedef struct i830_texture_object_t *i830TextureObjectPtr;
#include "mtypes.h"
#include "drm.h"
#include "mm.h"
+#include "tnl/t_vertex.h"
#include "i830_screen.h"
#include "i830_tex.h"
@@ -130,17 +131,21 @@ struct i830_context_t
GLuint Fallback;
GLuint NewGLState;
- /* State for i830vb.c and i830tris.c.
+ /* Vertex state
+ */
+ GLuint vertex_size;
+ struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
+ GLuint vertex_attr_count;
+ char *verts; /* points to tnl->clipspace.vertex_buf */
+
+
+ /* State for i830tris.c.
*/
- GLuint SetupNewInputs;
- GLuint SetupIndex;
GLuint RenderIndex;
GLmatrix ViewportMatrix;
GLenum render_primitive;
GLenum reduced_primitive;
GLuint hw_primitive;
- GLuint vertex_format;
- char *verts;
drmBufPtr vertex_buffer;
char *vertex_addr;
@@ -163,8 +168,6 @@ struct i830_context_t
GLuint Setup[I830_CTX_SETUP_SIZE];
GLuint BufferSetup[I830_DEST_SETUP_SIZE];
GLuint StippleSetup[I830_STP_SETUP_SIZE];
- int vertex_size;
- int vertex_stride_shift;
unsigned int lastStamp;
GLboolean hw_stipple;
diff --git a/src/mesa/drivers/dri/i830/i830_debug.c b/src/mesa/drivers/dri/i830/i830_debug.c
index 66c698ba30..02c36bec7d 100644
--- a/src/mesa/drivers/dri/i830/i830_debug.c
+++ b/src/mesa/drivers/dri/i830/i830_debug.c
@@ -46,7 +46,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830_context.h"
#include "i830_state.h"
#include "i830_tex.h"
-#include "i830_vb.h"
#include "i830_tris.h"
#include "i830_ioctl.h"
#include "i830_debug.h"
diff --git a/src/mesa/drivers/dri/i830/i830_render.c b/src/mesa/drivers/dri/i830/i830_render.c
index ed4c94437b..c1564a54e5 100644
--- a/src/mesa/drivers/dri/i830/i830_render.c
+++ b/src/mesa/drivers/dri/i830/i830_render.c
@@ -48,7 +48,6 @@
#include "i830_context.h"
#include "i830_tris.h"
#include "i830_state.h"
-#include "i830_vb.h"
#include "i830_ioctl.h"
/*
@@ -127,7 +126,7 @@ static const int scale_prim[GL_POLYGON+1] = {
#define ALLOC_VERTS( nr ) \
i830AllocDmaLow( imesa, nr * imesa->vertex_size * 4)
#define EMIT_VERTS( ctx, j, nr, buf ) \
- i830_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
+ _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf)
#define TAG(x) i830_##x
#include "tnl_dd/t_dd_dmatmp.h"
@@ -191,12 +190,10 @@ static GLboolean i830_run_render( GLcontext *ctx,
*/
if (imesa->RenderIndex != 0 ||
!i830_validate_render( ctx, VB ) ||
- !choose_render( VB, GET_SUBSEQUENT_VB_MAX_VERTS() )) {
+ !choose_render( VB, 200 )) { /* 200 is estimate of nr verts/buf */
return GL_TRUE;
}
- imesa->SetupNewInputs = VERT_BIT_POS;
-
tnl->Driver.Render.Start( ctx );
for (i = 0 ; i < VB->PrimitiveCount ; i++)
diff --git a/src/mesa/drivers/dri/i830/i830_state.c b/src/mesa/drivers/dri/i830/i830_state.c
index 004b49acec..11f0fd7948 100644
--- a/src/mesa/drivers/dri/i830/i830_state.c
+++ b/src/mesa/drivers/dri/i830/i830_state.c
@@ -49,7 +49,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830_context.h"
#include "i830_state.h"
#include "i830_tex.h"
-#include "i830_vb.h"
#include "i830_tris.h"
#include "i830_ioctl.h"
@@ -1549,17 +1548,8 @@ void i830DDInitState( GLcontext *ctx )
memset(imesa->Setup, 0, sizeof(imesa->Setup));
- imesa->Setup[I830_CTXREG_VF] = (STATE3D_VERTEX_FORMAT_CMD |
- VRTX_TEX_COORD_COUNT(1) |
- VRTX_HAS_DIFFUSE |
- VRTX_HAS_SPEC |
- VRTX_HAS_XYZW);
- imesa->vertex_format = 0;
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D));
+ imesa->Setup[I830_CTXREG_VF] = 0;
+ imesa->Setup[I830_CTXREG_VF2] = 0;
imesa->Setup[I830_CTXREG_AA] = (STATE3D_AA_CMD |
AA_LINE_ECAAR_WIDTH_ENABLE |
diff --git a/src/mesa/drivers/dri/i830/i830_tex.h b/src/mesa/drivers/dri/i830/i830_tex.h
index dbfcbe3963..91203269e3 100644
--- a/src/mesa/drivers/dri/i830/i830_tex.h
+++ b/src/mesa/drivers/dri/i830/i830_tex.h
@@ -63,7 +63,6 @@ struct i830_texture_object_t
void i830UpdateTextureState( GLcontext *ctx );
void i830DDInitTextureFuncs( GLcontext *ctx );
-void i830UpdateTexUnitProj( GLcontext *ctx, GLuint unit, GLboolean state );
void i830DestroyTexObj( i830ContextPtr imesa, i830TextureObjectPtr t );
int i830UploadTexImagesLocked( i830ContextPtr imesa, i830TextureObjectPtr t );
diff --git a/src/mesa/drivers/dri/i830/i830_texstate.c b/src/mesa/drivers/dri/i830/i830_texstate.c
index 4d211176fd..34f13d8133 100644
--- a/src/mesa/drivers/dri/i830/i830_texstate.c
+++ b/src/mesa/drivers/dri/i830/i830_texstate.c
@@ -1326,14 +1326,6 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *tObj = texUnit->_Current;
i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint mcs = t->Setup[I830_TEXREG_MCS] & TEXCOORDTYPE_MASK;
-
- /* Handle projective texturing */
- if (imesa->vertex_format & (1<<31)) {
- mcs |= TEXCOORDTYPE_HOMOGENEOUS;
- } else {
- mcs |= TEXCOORDTYPE_CARTESIAN;
- }
/* Fallback if there's a texture border */
if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) {
@@ -1352,8 +1344,7 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
/* Update state if this is a different texture object to last
* time.
*/
- if (imesa->CurrentTexObj[unit] != t ||
- mcs != t->Setup[I830_TEXREG_MCS]) {
+ if (imesa->CurrentTexObj[unit] != t) {
if ( imesa->CurrentTexObj[unit] != NULL ) {
/* The old texture is no longer bound to this texture unit.
@@ -1364,7 +1355,6 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
}
I830_STATECHANGE(imesa, (I830_UPLOAD_TEX0<<unit));
- t->Setup[I830_TEXREG_MCS] = mcs;
imesa->CurrentTexObj[unit] = t;
i830TexSetUnit(t, unit);
}
@@ -1509,43 +1499,6 @@ static GLboolean i830UpdateTexUnit( GLcontext *ctx, GLuint unit )
}
-/* Called from vb code to update projective texturing properly */
-void i830UpdateTexUnitProj( GLcontext *ctx, GLuint unit, GLboolean state )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t;
- GLuint mcs;
-
- if (!tObj) return;
-
- t = (i830TextureObjectPtr)tObj->DriverData;
- mcs = (t->Setup[I830_TEXREG_MCS] &
- TEXCOORDTYPE_MASK &
- ~TEXCOORDS_ARE_NORMAL);
-
- /* Handle projective texturing */
- if (state) {
- mcs |= TEXCOORDTYPE_HOMOGENEOUS;
- } else {
- mcs |= TEXCOORDTYPE_CARTESIAN;
- }
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT) {
- mcs |= TEXCOORDS_ARE_NORMAL;
- }
- else if (texUnit->_ReallyEnabled == TEXTURE_RECT_BIT) {
- mcs |= TEXCOORDS_ARE_IN_TEXELUNITS;
- }
- else
- return;
-
- if (mcs != t->Setup[I830_TEXREG_MCS]) {
- I830_STATECHANGE(imesa, (I830_UPLOAD_TEX0<<unit));
- t->Setup[I830_TEXREG_MCS] = mcs;
- }
-}
/* Only deal with unit 0 and 1 for right now */
void i830UpdateTextureState( GLcontext *ctx )
diff --git a/src/mesa/drivers/dri/i830/i830_tris.c b/src/mesa/drivers/dri/i830/i830_tris.c
index e900661540..0adaee4d08 100644
--- a/src/mesa/drivers/dri/i830/i830_tris.c
+++ b/src/mesa/drivers/dri/i830/i830_tris.c
@@ -49,7 +49,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830_tris.h"
#include "i830_state.h"
-#include "i830_vb.h"
#include "i830_ioctl.h"
#include "i830_span.h"
@@ -403,9 +402,9 @@ i830_fallback_tri( i830ContextPtr imesa,
if (0)
fprintf(stderr, "\n%s\n", __FUNCTION__);
- i830_translate_vertex( ctx, v0, &v[0] );
- i830_translate_vertex( ctx, v1, &v[1] );
- i830_translate_vertex( ctx, v2, &v[2] );
+ _swsetup_Translate( ctx, v0, &v[0] );
+ _swsetup_Translate( ctx, v1, &v[1] );
+ _swsetup_Translate( ctx, v2, &v[2] );
i830SpanRenderStart( ctx );
_swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
i830SpanRenderFinish( ctx );
@@ -423,8 +422,8 @@ i830_fallback_line( i830ContextPtr imesa,
if (0)
fprintf(stderr, "\n%s\n", __FUNCTION__);
- i830_translate_vertex( ctx, v0, &v[0] );
- i830_translate_vertex( ctx, v1, &v[1] );
+ _swsetup_Translate( ctx, v0, &v[0] );
+ _swsetup_Translate( ctx, v1, &v[1] );
i830SpanRenderStart( ctx );
_swrast_Line( ctx, &v[0], &v[1] );
i830SpanRenderFinish( ctx );
@@ -441,7 +440,7 @@ i830_fallback_point( i830ContextPtr imesa,
if (0)
fprintf(stderr, "\n%s\n", __FUNCTION__);
- i830_translate_vertex( ctx, v0, &v[0] );
+ _swsetup_Translate( ctx, v0, &v[0] );
i830SpanRenderStart( ctx );
_swrast_Point( ctx, &v[0] );
i830SpanRenderFinish( ctx );
@@ -673,9 +672,6 @@ static void i830RunPipeline( GLcontext *ctx )
}
if (!imesa->Fallback) {
- if (imesa->NewGLState & _I830_NEW_VERTEX)
- i830ChooseVertexState( ctx );
-
if (imesa->NewGLState & _I830_NEW_RENDERSTATE)
i830ChooseRenderState( ctx );
}
@@ -686,15 +682,126 @@ static void i830RunPipeline( GLcontext *ctx )
_tnl_run_pipeline( ctx );
}
+
+#define TEXCOORDTYPE_MASK (3<<11)
+
+
+
+static void set_projective_texturing( i830ContextPtr imesa,
+ GLuint i,
+ GLuint sz)
+{
+ GLuint mcs = (imesa->CurrentTexObj[i]->Setup[I830_TEXREG_MCS] &
+ ~TEXCOORDTYPE_MASK);
+
+ if (sz == 4) {
+ mcs |= TEXCOORDTYPE_HOMOGENEOUS;
+ } else {
+ mcs |= TEXCOORDTYPE_CARTESIAN;
+ }
+
+ if (mcs != imesa->CurrentTexObj[i]->Setup[I830_TEXREG_MCS]) {
+ I830_STATECHANGE(imesa, I830_UPLOAD_TEX_N(i));
+ imesa->CurrentTexObj[i]->Setup[I830_TEXREG_MCS] = mcs;
+ }
+}
+
+
+#define SZ_TO_HW(sz) ((sz-2)&0x3)
+#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1)
+#define EMIT_ATTR( ATTR, STYLE, V0 ) \
+do { \
+ imesa->vertex_attrs[imesa->vertex_attr_count].attrib = (ATTR); \
+ imesa->vertex_attrs[imesa->vertex_attr_count].format = (STYLE); \
+ imesa->vertex_attr_count++; \
+ v0 |= V0; \
+} while (0)
+
+
+#define VRTX_TEX_SET_FMT(n, x) ((x)<<((n)*2))
+
+/* Make sure hardware vertex format is appropriate for VB state.
+ */
static void i830RenderStart( GLcontext *ctx )
{
- /* Check for projective textureing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
+ i830ContextPtr imesa = I830_CONTEXT(ctx);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ GLuint index = tnl->render_inputs;
+ GLuint v0 = STATE3D_VERTEX_FORMAT_CMD;
+ GLuint v2 = STATE3D_VERTEX_FORMAT_2_CMD;
+
+ /* Important:
*/
+ VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
+ imesa->vertex_attr_count = 0;
- i830CheckTexSizes( ctx );
+ /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
+ * build up a hardware vertex.
+ */
+ if (index & _TNL_BITS_TEX_ANY) {
+ EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VRTX_HAS_XYZW );
+ }
+ else {
+ EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, VRTX_HAS_XYZ );
+ }
+
+ EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA, VRTX_HAS_DIFFUSE );
+
+ if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
+ EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB, VRTX_HAS_SPEC );
+ EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VRTX_HAS_SPEC );
+ }
+
+ if (index & _TNL_BITS_TEX_ANY) {
+ int i, last_stage = 0;
+
+ /* Still using 2 as max tex units, but this code is fine for all
+ * 8 units supported by mesa:
+ */
+ for (i = 0; i < 2 ; i++)
+ if (index & _TNL_BIT_TEX(i))
+ last_stage = i+1;
+
+
+ for (i = 0; i < last_stage; i++) {
+ GLuint sz = VB->TexCoordPtr[i]->size;
+
+ v2 |= VRTX_TEX_SET_FMT(i, SZ_TO_HW(sz));
+ EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_SZ(sz), 0 );
+
+ if (imesa->CurrentTexObj[i])
+ set_projective_texturing( imesa, i, sz );
+ }
+
+ v0 |= VRTX_TEX_COORD_COUNT(last_stage);
+ }
+
+ /* Only need to change the vertex emit code if there has been a
+ * statechange to a new hardware vertex format:
+ */
+ if (v0 != imesa->Setup[I830_CTXREG_VF] ||
+ v2 != imesa->Setup[I830_CTXREG_VF2] ) {
+
+ I830_STATECHANGE( imesa, I830_UPLOAD_CTX );
+
+ /* Must do this *after* statechange, so as not to affect
+ * buffered vertices reliant on the old state:
+ */
+ imesa->vertex_size =
+ _tnl_install_attrs( ctx,
+ imesa->vertex_attrs,
+ imesa->vertex_attr_count,
+ imesa->ViewportMatrix.m, 0 );
+
+ imesa->vertex_size >>= 2;
+
+ imesa->Setup[I830_CTXREG_VF] = v0;
+ imesa->Setup[I830_CTXREG_VF2] = v2;
+ }
}
+
static void i830RenderFinish( GLcontext *ctx )
{
if (I830_CONTEXT(ctx)->RenderIndex & I830_FALLBACK_BIT)
@@ -850,8 +957,19 @@ void i830Fallback( i830ContextPtr imesa, GLuint bit, GLboolean mode )
tnl->Driver.Render.Start = i830RenderStart;
tnl->Driver.Render.PrimitiveNotify = i830RenderPrimitive;
tnl->Driver.Render.Finish = i830RenderFinish;
- tnl->Driver.Render.BuildVertices = i830BuildVertices;
- imesa->NewGLState |= (_I830_NEW_RENDERSTATE|_I830_NEW_VERTEX);
+
+ tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
+ tnl->Driver.Render.CopyPV = _tnl_copy_pv;
+ tnl->Driver.Render.Interp = _tnl_interp;
+
+ _tnl_invalidate_vertex_state( ctx, ~0 );
+ _tnl_invalidate_vertices( ctx, ~0 );
+ _tnl_install_attrs( ctx,
+ imesa->vertex_attrs,
+ imesa->vertex_attr_count,
+ imesa->ViewportMatrix.m, 0 );
+
+ imesa->NewGLState |= _I830_NEW_RENDERSTATE;
}
}
}
@@ -879,5 +997,12 @@ void i830InitTriFuncs( GLcontext *ctx )
tnl->Driver.Render.Finish = i830RenderFinish;
tnl->Driver.Render.PrimitiveNotify = i830RenderPrimitive;
tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = i830BuildVertices;
+ tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
+ tnl->Driver.Render.CopyPV = _tnl_copy_pv;
+ tnl->Driver.Render.Interp = _tnl_interp;
+
+ _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
+ 22 * sizeof(GLfloat) );
+
+ I830_CONTEXT(ctx)->verts = (char *)tnl->clipspace.vertex_buf;
}
diff --git a/src/mesa/drivers/dri/i830/i830_vb.c b/src/mesa/drivers/dri/i830/i830_vb.c
deleted file mode 100644
index c83cb47835..0000000000
--- a/src/mesa/drivers/dri/i830/i830_vb.c
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Adapted for use on the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_vb.c,v 1.5 2002/12/10 01:26:54 dawes Exp $ */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_vb.h"
-#include "i830_ioctl.h"
-#include "i830_tris.h"
-#include "i830_state.h"
-
-#define I830_TEX1_BIT 0x1
-#define I830_TEX0_BIT 0x2
-#define I830_RGBA_BIT 0x4
-#define I830_SPEC_BIT 0x8
-#define I830_FOG_BIT 0x10
-#define I830_XYZW_BIT 0x20
-#define I830_PTEX_BIT 0x40
-#define I830_MAX_SETUP 0x80
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_format;
-} setup_tab[I830_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_XYZ)
-
-#define NOTEX_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX0_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(1) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX1_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(2) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-
-/* I'm cheating here hardcore : if bit 31 is set I know to emit
- * a vf2 state == TEXCOORDFMT_3D. We never mix 2d/3d texcoords,
- * so this solution works for now.
- */
-
-#define PROJ_TEX1_VERTEX_FORMAT ((1<<31) | \
- STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(2) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-/* Might want to do these later */
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & I830_XYZW_BIT)
-#define DO_RGBA (IND & I830_RGBA_BIT)
-#define DO_SPEC (IND & I830_SPEC_BIT)
-#define DO_FOG (IND & I830_FOG_BIT)
-#define DO_TEX0 (IND & I830_TEX0_BIT)
-#define DO_TEX1 (IND & I830_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & I830_PTEX_BIT)
-
-#define VERTEX i830Vertex
-#define VERTEX_COLOR i830_color_t
-#define GET_VIEWPORT_MAT() I830_CONTEXT(ctx)->ViewportMatrix.m
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() I830_CONTEXT(ctx)->vertex_format
-#define GET_VERTEX_STORE() ((GLubyte *)I830_CONTEXT(ctx)->verts)
-#define GET_VERTEX_SIZE() I830_CONTEXT(ctx)->vertex_size * sizeof(int)
-#define INVALIDATE_STORED_VERTICES()
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-#define UNVIEWPORT_VARS GLfloat h = I830_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z * (float)I830_CONTEXT(ctx)->ClearDepth
-
-#define PTEX_FALLBACK() FALLBACK(I830_CONTEXT(ctx), I830_FALLBACK_TEXTURE, 1)
-
-#define INTERP_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) i830_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|\
- I830_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX0_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_FOG_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_FOG_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|I830_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|I830_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-/* Add functions for proj texturing for t0 and t1 */
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_TEX0_BIT|I830_TEX1_BIT|\
- I830_PTEX_BIT)
-#define TAG(x) x##_wgpt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_SPEC_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgspt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_TEX0_BIT|\
- I830_TEX1_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgfpt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I830_XYZW_BIT|I830_RGBA_BIT|I830_FOG_BIT|I830_SPEC_BIT|\
- I830_TEX1_BIT|I830_TEX0_BIT|I830_PTEX_BIT)
-#define TAG(x) x##_wgfspt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
- /* Add proj texturing on t1 */
- init_wgpt0t1();
- init_wgspt0t1();
- init_wgfpt0t1();
- init_wgfspt0t1();
-}
-
-
-
-void i830PrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & I830_XYZW_BIT) ? " xyzw," : "",
- (flags & I830_RGBA_BIT) ? " rgba," : "",
- (flags & I830_SPEC_BIT) ? " spec," : "",
- (flags & I830_FOG_BIT) ? " fog," : "",
- (flags & I830_TEX0_BIT) ? " tex-0," : "",
- (flags & I830_TEX1_BIT) ? " tex-1," : "",
- (flags & I830_PTEX_BIT) ? " ptex," : "");
-}
-
-void i830CheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT( ctx );
-
- if (!setup_tab[imesa->SetupIndex].check_tex_sizes(ctx)) {
- int ind = imesa->SetupIndex |= I830_PTEX_BIT;
-
- if(setup_tab[ind].vertex_format != imesa->vertex_format) {
- int vfmt = setup_tab[ind].vertex_format;
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_VF] = ~(1<<31) & vfmt;
-
- if (vfmt & (1<<31)) {
- /* Proj texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_3D));
- i830UpdateTexUnitProj( ctx, 0, GL_TRUE );
- i830UpdateTexUnitProj( ctx, 1, GL_TRUE );
-
- } else {
- /* Normal texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D));
- i830UpdateTexUnitProj( ctx, 0, GL_FALSE );
- i830UpdateTexUnitProj( ctx, 1, GL_FALSE );
- }
- imesa->vertex_format = vfmt;
- imesa->vertex_size = setup_tab[ind].vertex_size;
- }
-
- if (!imesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[imesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[imesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void i830BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint stride = imesa->vertex_size * sizeof(int);
- GLubyte *v = ((GLubyte *) imesa->verts + (start * stride));
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- newinputs |= imesa->SetupNewInputs;
- imesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= I830_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= I830_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= I830_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= I830_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= I830_FOG_BIT;
-
-#if 0
- if (imesa->SetupIndex & I830_PTEX_BIT)
- ind = ~0;
-#endif
-
- ind &= imesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void i830ChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint ind = I830_XYZW_BIT|I830_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= I830_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= I830_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2)
- /* unit 1 enabled */
- ind |= I830_TEX1_BIT|I830_TEX0_BIT;
- else if (ctx->Texture._EnabledUnits & 0x1)
- /* unit 0 enabled */
- ind |= I830_TEX0_BIT;
-
- imesa->SetupIndex = ind;
-
- if (I830_DEBUG & (DEBUG_VERTS|DEBUG_STATE))
- i830PrintSetupFlags( __FUNCTION__, ind );
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = i830_interp_extras;
- tnl->Driver.Render.CopyPV = i830_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != imesa->vertex_format) {
- int vfmt = setup_tab[ind].vertex_format;
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_VF] = ~(1<<31) & vfmt;
-
- if (vfmt & (1<<31)) {
- /* Proj texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_3D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_3D));
- i830UpdateTexUnitProj( ctx, 0, GL_TRUE );
- i830UpdateTexUnitProj( ctx, 1, GL_TRUE );
- } else {
- /* Normal texturing */
- imesa->Setup[I830_CTXREG_VF2] = (STATE3D_VERTEX_FORMAT_2_CMD |
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) |
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D));
- i830UpdateTexUnitProj( ctx, 0, GL_FALSE );
- i830UpdateTexUnitProj( ctx, 1, GL_FALSE );
- }
- imesa->vertex_format = vfmt;
- imesa->vertex_size = setup_tab[ind].vertex_size;
- }
-}
-
-
-
-void *i830_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- void *dest)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint stride = imesa->vertex_size * 4;
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, stride );
- return (void *)((char *)dest + stride * (count - start));
-}
-
-
-
-void i830InitVB( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- imesa->verts = (char *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void i830FreeVB( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- if (imesa->verts) {
- ALIGN_FREE(imesa->verts);
- imesa->verts = 0;
- }
-}
diff --git a/src/mesa/drivers/dri/i830/i830_vb.h b/src/mesa/drivers/dri/i830/i830_vb.h
deleted file mode 100644
index 570778ab6b..0000000000
--- a/src/mesa/drivers/dri/i830/i830_vb.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Adapted for use in the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_vb.h,v 1.1 2002/09/09 19:18:49 dawes Exp $ */
-
-#ifndef I830VB_INC
-#define I830VB_INC
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-
-#define _I830_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void i830ChooseVertexState( GLcontext *ctx );
-extern void i830CheckTexSizes( GLcontext *ctx );
-extern void i830BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void *i830_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- void *dest );
-
-extern void i830_translate_vertex( GLcontext *ctx,
- const i830Vertex *src,
- SWvertex *dst );
-
-extern void i830InitVB( GLcontext *ctx );
-extern void i830FreeVB( GLcontext *ctx );
-
-extern void i830_print_vertex( GLcontext *ctx, const i830Vertex *v );
-extern void i830PrintSetupFlags(char *msg, GLuint flags );
-
-#endif