diff options
Diffstat (limited to 'src/mesa/drivers/dri/glamo/glamo_render.c')
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_render.c | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/glamo/glamo_render.c b/src/mesa/drivers/dri/glamo/glamo_render.c index 3e7aec2dc5..7908359705 100644 --- a/src/mesa/drivers/dri/glamo/glamo_render.c +++ b/src/mesa/drivers/dri/glamo/glamo_render.c @@ -73,41 +73,58 @@ * VRAM buffers. Use strip/fan hardware primitives where possible. * Try to simulate missing primitives with indexed vertices. */ -#define HAVE_POINTS 0 +#define HAVE_POINTS 1 #define HAVE_LINES 1 -#define HAVE_LINE_STRIPS 1 +#define HAVE_LINE_STRIPS 0 #define HAVE_TRIANGLES 1 -#define HAVE_TRI_STRIPS 1 -#define HAVE_TRI_STRIP_1 0 /* Has it, template can't use it yet */ -#define HAVE_TRI_FANS 1 -#define HAVE_POLYGONS 1 +#define HAVE_TRI_STRIPS 0 +#define HAVE_TRI_STRIP_1 0 +#define HAVE_TRI_FANS 0 +#define HAVE_POLYGONS 0 #define HAVE_QUADS 0 #define HAVE_QUAD_STRIPS 0 #define HAVE_ELTS 0 -static inline GLuint glamoGetVBMax(struct glamo_context *glamo) +static void glamoFlushPrim(struct glamo_context *gCtx) { - return GLAMO_VB_SIZE / (4 * 4); + printf("glamoFlushPrim: %i vertices, %i %i\n", gCtx->prim.count, + gCtx->prim.start_offset, gCtx->prim.current_offset); + + if ( gCtx->prim.vb_bo == NULL ) return; + + gCtx->prim.start_offset = gCtx->prim.current_offset; + + glamo_bo_subdata(gCtx->prim.vb_bo, 0, gCtx->prim.start_offset, + gCtx->prim.vb); + + /* Dispatch to the hardware */ + + /* Please use a new BO for the next buffer */ + gCtx->prim.vb_bo = NULL; } -static inline GLuint glamoGetCurrentMax(struct glamo_context *glamo) + +static inline GLuint glamoGetVBMax(struct glamo_context *gCtx) +{ + return GLAMO_VB_SIZE / gCtx->vertex_size; +} + + +static inline GLuint glamoGetCurrentMax(struct glamo_context *gCtx) { /* How many more vertices can be accommodated? * Each vertex takes up 4x 32-bit fixed point values */ - return (GLAMO_VB_SIZE - glamo->prim.current_offset) / (4 * 4); + return (GLAMO_VB_SIZE - gCtx->prim.current_offset) / gCtx->vertex_size; } + #define LOCAL_VARS \ struct glamo_context *gCtx = GLAMO_CONTEXT(ctx); #define INIT(prim) -#define FLUSH() \ - do { \ - if ((gCtx)->prim.flush) \ - (gCtx)->prim.flush(gCtx); \ - } while (0) +#define FLUSH() glamoFlushPrim(gCtx) #define GET_SUBSEQUENT_VB_MAX_VERTS() glamoGetVBMax(gCtx) #define GET_CURRENT_VB_MAX_VERTS() glamoGetCurrentMax(gCtx) @@ -134,6 +151,8 @@ static GLboolean glamoRunRender(GLcontext *ctx, struct vertex_buffer *VB = &tnl->vb; GLuint i; + printf("glamoRunRender\n"); + /* Don't handle clipping */ if ( !glamo_validate_render(ctx, VB) ) { return GL_TRUE; /* Failed */ @@ -144,6 +163,7 @@ static GLboolean glamoRunRender(GLcontext *ctx, tnl->Driver.Render.Start(ctx); for ( i=0; i<VB->PrimitiveCount; i++ ) { + GLuint prim = _tnl_translate_prim(&VB->Primitive[i]); GLuint start = VB->Primitive[i].start; GLuint length = VB->Primitive[i].count; @@ -152,13 +172,11 @@ static GLboolean glamoRunRender(GLcontext *ctx, glamo_render_tab_verts[prim & PRIM_MODE_MASK](ctx, start, start + length, prim); + } tnl->Driver.Render.Finish(ctx); - if ((gCtx)->prim.flush) - (gCtx)->prim.flush(gCtx); - return GL_FALSE; /* Ok */ } |