mesa: Branch 'index-swtnl-0.1' - 5 commits

Keith Whitwell keithw at kemper.freedesktop.org
Fri Feb 16 20:06:54 UTC 2007


 src/mesa/drivers/dri/i915tex/intel_context.h    |    4 ++--
 src/mesa/drivers/dri/i915tex/intel_idx_render.c |   15 +++++++++------
 src/mesa/tnl/t_context.c                        |    2 +-
 src/mesa/tnl/t_draw.c                           |    2 +-
 src/mesa/tnl/t_vb_index.c                       |   13 ++++++++++---
 5 files changed, 23 insertions(+), 13 deletions(-)

New commits:
diff-tree 682fdd9462485562e3534293a12ccebc41d3c3ed (from 8f128b2f34539051a2925cee7c023578946c015b)
Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Fri Feb 16 20:06:45 2007 +0000

    Fix thinko trying to remap buffer objects immediately after use.
    
    Would like a way to keep a buffer object mapped in the situation where
    it is being stuffed with vertices incrementally.

diff --git a/src/mesa/drivers/dri/i915tex/intel_idx_render.c b/src/mesa/drivers/dri/i915tex/intel_idx_render.c
index decd5d9..b5b57c3 100644
--- a/src/mesa/drivers/dri/i915tex/intel_idx_render.c
+++ b/src/mesa/drivers/dri/i915tex/intel_idx_render.c
@@ -54,7 +54,7 @@
 
 
 
-#define MAX_VBO 16		/* XXX: make dynamic */
+#define MAX_VBO 32		/* XXX: make dynamic */
 #define VBO_SIZE (128*1024)
 
 
@@ -236,9 +236,9 @@ static void *get_space( struct intel_vb 
    void *ptr;
    GLuint space = nr * vertex_size * 4;
 
-   DBG("%s %d %d\n", __FUNCTION__, nr, vertex_size);
+   DBG("%s %d*%d, vbo %d\n", __FUNCTION__, nr, vertex_size, vb->nr_vbo);
 
-   if (vb->current_vbo_used + space > vb->current_vbo_size)
+   if (vb->current_vbo_used + space > vb->current_vbo_size || !vb->current_vbo_ptr)
       get_next_vbo( vb, space );
 
    if (vb->vertex_size != vertex_size) {
@@ -248,6 +248,8 @@ static void *get_space( struct intel_vb 
    }
 
    if (!vb->current_vbo_ptr) {
+      DBG("%s map vbo %d\n", __FUNCTION__, vb->nr_vbo);
+
       /* Map the vbo now, will be unmapped in release_current_vbo, above.
        */
       vb->current_vbo_ptr = ctx->Driver.MapBuffer( ctx,
@@ -366,11 +368,12 @@ static void emit_prims( GLcontext *ctx,
 	 OUT_BATCH( (offset + indices[start+j]) );
 
       ADVANCE_BATCH();
+
+      /* This won't fail, but only because of the wierd emit above:
+       */
+      assert(!vb->dirty);
    }
 
-   /* This won't fail, but only because of the wierd emit above:
-    */
-   assert(!vb->dirty);
 
    DBG("%s - done\n", __FUNCTION__);
 }
diff-tree 8f128b2f34539051a2925cee7c023578946c015b (from 9ff23910b0d62e672707e12a93f162de304878cb)
Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Fri Feb 16 20:04:49 2007 +0000

    Increase vb->Size to allow space for clipped vertices in t_vb_index.c

diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index d9458b7..50bd6bf 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -55,7 +55,7 @@ _tnl_CreateContext( GLcontext *ctx )
 
    /* Initialize the VB.
     */
-   tnl->vb.Size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES;
+   tnl->vb.Size = ctx->Const.MaxArrayLockSize * 1.2 + MAX_CLIPPED_VERTICES;
 
 
    /* Initialize tnl state.
diff-tree 9ff23910b0d62e672707e12a93f162de304878cb (from 137b35ce1cbbeaeee62d969d1de27c0edd62be10)
Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Fri Feb 16 20:03:40 2007 +0000

    Enable debugging on debug builds...

diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h
index a73a3d6..ab88e83 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.h
+++ b/src/mesa/drivers/dri/i915tex/intel_context.h
@@ -363,8 +363,8 @@ __memcpy(void *to, const void *from, siz
 /* ================================================================
  * Debugging:
  */
-#define DO_DEBUG		0
-#if DO_DEBUG
+#if defined(DEBUG)
+#define DO_DEBUG 1
 extern int INTEL_DEBUG;
 #else
 #define INTEL_DEBUG		0
diff-tree 137b35ce1cbbeaeee62d969d1de27c0edd62be10 (from 54ef4398484f0c11b55d3fa66666b76ebd35ea73)
Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Fri Feb 16 19:17:15 2007 +0000

    Fix a couple more clipping bugs.

diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index c97cf5f..197fe32 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -344,7 +344,7 @@ void _tnl_draw_prims( GLcontext *ctx,
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    const GLuint TEST_SPLIT = 0;
-   const GLint max = TEST_SPLIT ? 8 : tnl->vb.Size - MAX_CLIPPED_VERTICES;
+   const GLint max = TEST_SPLIT ? 8 : (tnl->vb.Size - MAX_CLIPPED_VERTICES) * .8;
 
    if (0)
    {
diff --git a/src/mesa/tnl/t_vb_index.c b/src/mesa/tnl/t_vb_index.c
index 240b25f..444a810 100644
--- a/src/mesa/tnl/t_vb_index.c
+++ b/src/mesa/tnl/t_vb_index.c
@@ -167,7 +167,7 @@ static void check_flush( struct idx_cont
    assert(idx->nr_prims <= IDX_MAX_PRIM);
    assert(idx->nr_indices <= idx->index_buffer_size);
 
-   if (idx->hw_max_indexable_verts < idx->VB->Count + MAX_CLIPPED_VERTICES) {
+   if (idx->hw_max_indexable_verts <= idx->VB->Count + MAX_CLIPPED_VERTICES) {
       flush( idx );
    }
 
@@ -484,6 +484,9 @@ static GLboolean run_index_render( GLcon
 					   &idx->hw_max_indices))
       return GL_TRUE;
 
+   if (idx->hw_max_indexable_verts > VB->Size)
+      idx->hw_max_indexable_verts = VB->Size;
+
    idx->orig_VB_count = VB->Count;
    idx->nr_prims = 0;
    idx->nr_indices = 0;
diff-tree 54ef4398484f0c11b55d3fa66666b76ebd35ea73 (from bd56abc3441dfb192b7825a8407411f89827abd1)
Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Fri Feb 16 19:09:41 2007 +0000

    Update VB->Count after clipping.
    
    Don't keep overwriting vertices generated in clipping.  We need to keep
    them around until the primitives are emitted.

diff --git a/src/mesa/tnl/t_vb_index.c b/src/mesa/tnl/t_vb_index.c
index ebaac99..240b25f 100644
--- a/src/mesa/tnl/t_vb_index.c
+++ b/src/mesa/tnl/t_vb_index.c
@@ -346,8 +346,12 @@ static void polygon( struct idx_context 
 #define CTX_ARG struct idx_context *idx
 #define GET_REAL_CTX GLcontext *ctx = idx->ctx;
 
-#define CLIPPED_POLYGON( list, n ) polygon( idx, list, n )
-#define CLIPPED_LINE( a, b ) line( idx, a, b )
+#define CLIPPED_POLYGON( list, n ) \
+do { polygon( idx, list, n ); VB->Count = newvert; } while (0)
+
+#define CLIPPED_LINE( a, b ) \
+do { line( idx, a, b ); VB->Count = newvert; } while (0)
+
 
 #define W(i) coord[i][3]
 #define Z(i) coord[i][2]



More information about the mesa-commit mailing list