summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i830
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i830')
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.h5
-rw-r--r--src/mesa/drivers/dri/i830/i830_render.c31
-rw-r--r--src/mesa/drivers/dri/i830/i830_tris.c7
-rw-r--r--src/mesa/drivers/dri/i830/i830_vb.c36
-rw-r--r--src/mesa/drivers/dri/i830/i830_vb.h7
5 files changed, 25 insertions, 61 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_context.h b/src/mesa/drivers/dri/i830/i830_context.h
index 2bb71cb719..188d90c0c9 100644
--- a/src/mesa/drivers/dri/i830/i830_context.h
+++ b/src/mesa/drivers/dri/i830/i830_context.h
@@ -130,11 +130,6 @@ struct i830_context_t
GLuint Fallback;
GLuint NewGLState;
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
/* State for i830vb.c and i830tris.c.
*/
GLuint SetupNewInputs;
diff --git a/src/mesa/drivers/dri/i830/i830_render.c b/src/mesa/drivers/dri/i830/i830_render.c
index f66acd3b56..caed73ed67 100644
--- a/src/mesa/drivers/dri/i830/i830_render.c
+++ b/src/mesa/drivers/dri/i830/i830_render.c
@@ -110,21 +110,6 @@ static const int scale_prim[GL_POLYGON+1] = {
3
};
-/* Fallback to normal rendering. Should now never be called.
- */
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(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 );
- I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
-}
-
#define LOCAL_VARS i830ContextPtr imesa = I830_CONTEXT(ctx)
#define INIT( prim ) do { \
@@ -132,15 +117,17 @@ static void VERT_FALLBACK( GLcontext *ctx,
i830RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] ); \
} while (0)
-#define NEW_PRIMITIVE() I830_STATECHANGE( imesa, 0 )
-#define NEW_BUFFER() I830_FIREVERTICES( imesa )
+#define FLUSH() I830_FIREVERTICES( imesa )
#define GET_CURRENT_VB_MAX_VERTS() \
(((int)imesa->vertex_high - (int)imesa->vertex_low) / (imesa->vertex_size*4))
#define GET_SUBSEQUENT_VB_MAX_VERTS() \
(I830_DMA_BUF_SZ-8) / (imesa->vertex_size * 4)
-#define EMIT_VERTS( ctx, j, nr ) \
- i830_emit_contiguous_verts(ctx, j, (j)+(nr))
+
+#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)
#define TAG(x) i830_##x
#include "tnl_dd/t_dd_dmatmp.h"
@@ -165,7 +152,6 @@ static GLboolean choose_render( struct vertex_buffer *VB, int bufsz )
for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
GLuint length = VB->Primitive[i].count;
if (!length)
@@ -200,10 +186,11 @@ static GLboolean i830_run_render( GLcontext *ctx,
i830ContextPtr imesa = I830_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
+ GLuint i;
/* Don't handle clipping or indexed vertices.
*/
- if (VB->ClipOrMask || imesa->RenderIndex != 0 || VB->Elts ||
+ if (imesa->RenderIndex != 0 ||
+ !i830_validate_render( ctx, VB ) ||
!choose_render( VB, GET_SUBSEQUENT_VB_MAX_VERTS() )) {
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/i830/i830_tris.c b/src/mesa/drivers/dri/i830/i830_tris.c
index 285287422b..e900661540 100644
--- a/src/mesa/drivers/dri/i830/i830_tris.c
+++ b/src/mesa/drivers/dri/i830/i830_tris.c
@@ -223,7 +223,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (imesa->verts + (e<<imesa->vertex_stride_shift))
+#define GET_VERTEX(e) (imesa->verts + (e * imesa->vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -454,7 +454,7 @@ i830_fallback_point( i830ContextPtr imesa,
/**********************************************************************/
#define IND 0
-#define V(x) (i830Vertex *)(vertptr + ((x)<<vertshift))
+#define V(x) (i830Vertex *)(vertptr + ((x) * vertsize * sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) POINT( V(ELT(start)) );
#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
@@ -465,7 +465,7 @@ i830_fallback_point( i830ContextPtr imesa,
#define LOCAL_VARS \
i830ContextPtr imesa = I830_CONTEXT(ctx); \
GLubyte *vertptr = (GLubyte *)imesa->verts; \
- const GLuint vertshift = imesa->vertex_stride_shift; \
+ const GLuint vertsize = imesa->vertex_size; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void) elt;
#define RESET_STIPPLE
@@ -524,7 +524,6 @@ static void i830FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint vertsize = imesa->vertex_size;
GLuint *vb = i830AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
GLubyte *vertptr = (GLubyte *)imesa->verts;
- const GLuint vertshift = imesa->vertex_stride_shift;
const GLuint *start = (const GLuint *)V(elts[0]);
int i,j;
diff --git a/src/mesa/drivers/dri/i830/i830_vb.c b/src/mesa/drivers/dri/i830/i830_vb.c
index c9c5408dc9..c83cb47835 100644
--- a/src/mesa/drivers/dri/i830/i830_vb.c
+++ b/src/mesa/drivers/dri/i830/i830_vb.c
@@ -58,7 +58,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[I830_MAX_SETUP];
@@ -119,9 +118,7 @@ static struct {
#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_STRIDE_SHIFT() I830_CONTEXT(ctx)->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &I830_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &I830_CONTEXT(ctx)->UbyteSecondaryColor
+#define GET_VERTEX_SIZE() I830_CONTEXT(ctx)->vertex_size * sizeof(int)
#define INVALIDATE_STORED_VERTICES()
#define HAVE_HW_VIEWPORT 0
@@ -142,9 +139,6 @@ static struct {
#define PTEX_FALLBACK() FALLBACK(I830_CONTEXT(ctx), I830_FALLBACK_TEXTURE, 1)
-#define IMPORT_FLOAT_COLORS i830_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS i830_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].copy_pv
@@ -416,7 +410,6 @@ void i830CheckTexSizes( GLcontext *ctx )
}
imesa->vertex_format = vfmt;
imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
if (!imesa->Fallback &&
@@ -433,9 +426,8 @@ void i830BuildVertices( GLcontext *ctx,
GLuint newinputs )
{
i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)
- imesa->verts + (start<<imesa->vertex_stride_shift));
- GLuint stride = 1<<imesa->vertex_stride_shift;
+ GLuint stride = imesa->vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *) imesa->verts + (start * stride));
if (0) fprintf(stderr, "%s\n", __FUNCTION__);
@@ -537,20 +529,20 @@ void i830ChooseVertexState( GLcontext *ctx )
}
imesa->vertex_format = vfmt;
imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
}
-void i830_emit_contiguous_verts( GLcontext *ctx,
+void *i830_emit_contiguous_verts( GLcontext *ctx,
GLuint start,
- GLuint count )
+ GLuint count,
+ void *dest)
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint vertex_size = imesa->vertex_size * 4;
- GLuint *dest = i830AllocDmaLow( imesa, (count-start) * vertex_size);
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
+ GLuint stride = imesa->vertex_size * 4;
+ setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, stride );
+ return (void *)((char *)dest + stride * (count - start));
}
@@ -579,14 +571,4 @@ void i830FreeVB( GLcontext *ctx )
ALIGN_FREE(imesa->verts);
imesa->verts = 0;
}
-
- if (imesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(imesa->UbyteSecondaryColor.Ptr);
- imesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (imesa->UbyteColor.Ptr) {
- ALIGN_FREE(imesa->UbyteColor.Ptr);
- imesa->UbyteColor.Ptr = 0;
- }
}
diff --git a/src/mesa/drivers/dri/i830/i830_vb.h b/src/mesa/drivers/dri/i830/i830_vb.h
index 523354465f..570778ab6b 100644
--- a/src/mesa/drivers/dri/i830/i830_vb.h
+++ b/src/mesa/drivers/dri/i830/i830_vb.h
@@ -46,9 +46,10 @@ extern void i830BuildVertices( GLcontext *ctx,
GLuint newinputs );
-extern void i830_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
+extern void *i830_emit_contiguous_verts( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ void *dest );
extern void i830_translate_vertex( GLcontext *ctx,
const i830Vertex *src,