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

Keith Whitwell keithw at kemper.freedesktop.org
Mon Mar 19 21:44:27 UTC 2007


 src/mesa/drivers/dri/i915tex/intel_idx_render.c |   42 +++++++++--------
 src/mesa/drivers/dri/i915tex/intel_metaops.c    |   57 +++++++++++++-----------
 src/mesa/drivers/dri/i915tex/intel_tris.c       |    6 +-
 src/mesa/main/state.c                           |   27 ++++++-----
 4 files changed, 73 insertions(+), 59 deletions(-)

New commits:
diff-tree 527be7b2878f024f572a230b499f11ef1a62f8bf (from 33c201791f1fede943ef5b38457deee74556ad39)
Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Mon Mar 19 21:39:50 2007 +0000

    make sure bindprogram notifications are made when texenvprogram active

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 55fb455..449b85a 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -943,6 +943,7 @@ update_arrays( GLcontext *ctx )
 static void
 update_program(GLcontext *ctx)
 {
+
    /* For now, just set the _Enabled (really enabled) flags.
     * In the future we may have to check other state to be sure we really
     * have a runable program or shader.
@@ -954,20 +955,24 @@ update_program(GLcontext *ctx)
    ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
       && ctx->ATIFragmentShader.Current->Instructions;
       
-   ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
-   ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
+   if (ctx->_UseTexEnvProgram) {
+      const struct gl_fragment_program *prev = ctx->FragmentProgram._Current;
 
-   if (ctx->_MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) {
-#if 0
-      if (!ctx->_TexEnvProgram)
-	 ctx->_TexEnvProgram = (struct gl_fragment_program *)
-	    ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
-      ctx->FragmentProgram._Current = ctx->_TexEnvProgram;
-#endif
+      ctx->FragmentProgram._Active = GL_TRUE;
 
-      if (ctx->_UseTexEnvProgram)
-	 ctx->FragmentProgram._Active = GL_TRUE;
+      if (ctx->FragmentProgram._Enabled) 
+	 ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
+     
+      if (ctx->FragmentProgram._Current != prev && ctx->Driver.BindProgram) {
+	 ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
+				 (struct gl_program *) ctx->FragmentProgram._Current);
+      }
+   } 
+   else {
+      ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
+      ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
    }
+
 }
 
 
diff-tree 33c201791f1fede943ef5b38457deee74556ad39 (from 5b9c70fb0e6ee395888d805de78aec5b9462f37a)
Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Mon Mar 19 19:22:57 2007 +0000

    make the link between state emit and batch packet size stronger

diff --git a/src/mesa/drivers/dri/i915tex/intel_idx_render.c b/src/mesa/drivers/dri/i915tex/intel_idx_render.c
index 4aceaf8..c0e78c0 100644
--- a/src/mesa/drivers/dri/i915tex/intel_idx_render.c
+++ b/src/mesa/drivers/dri/i915tex/intel_idx_render.c
@@ -187,30 +187,32 @@ static void emit_prims( GLcontext *ctx,
        * emitting batch commands while holding the lock.
        */
 /*       intelRenderPrimitive() */
-      intel_emit_hardware_state(intel, 1 + (nr+1)/2);
-
-      /* XXX: Can emit upto 64k indices, need to split larger prims
-       */
-      BEGIN_BATCH(1 + (nr+1)/2, INTEL_BATCH_CLIPRECTS);
-      OUT_BATCH( _3DPRIMITIVE | 
-		 hw_prim | 
-		 PRIM_INDIRECT | 
-		 PRIM_INDIRECT_ELTS | 
-		 nr );
+      {
+	 GLuint dwords = 1 + (nr+1)/2;
+	 intel_emit_hardware_state(intel, dwords);
+
+	 /* XXX: Can emit upto 64k indices, need to split larger prims
+	  */
+	 BEGIN_BATCH( dwords, INTEL_BATCH_CLIPRECTS );
+	 OUT_BATCH( _3DPRIMITIVE | 
+		    hw_prim | 
+		    PRIM_INDIRECT | 
+		    PRIM_INDIRECT_ELTS | 
+		    nr );
       
-      /* Pack indices into 16bits 
-       */
-      for (j = 0; j < nr-1; j += 2) {
-	 OUT_BATCH( (offset + indices[start+j]) | ((offset + indices[start+j+1])<<16) );
+	 /* Pack indices into 16bits 
+	  */
+	 for (j = 0; j < nr-1; j += 2) {
+	    OUT_BATCH( (offset + indices[start+j]) | ((offset + indices[start+j+1])<<16) );
+	 }
+
+	 if (j < nr)
+	    OUT_BATCH( (offset + indices[start+j]) );
+	 
+	 ADVANCE_BATCH();
       }
-
-      if (j < nr)
-	 OUT_BATCH( (offset + indices[start+j]) );
-
-      ADVANCE_BATCH();
    }
 
-
    DBG("%s - done\n", __FUNCTION__);
 }
 
diff --git a/src/mesa/drivers/dri/i915tex/intel_metaops.c b/src/mesa/drivers/dri/i915tex/intel_metaops.c
index 8a5bc8d..d9728c5 100644
--- a/src/mesa/drivers/dri/i915tex/intel_metaops.c
+++ b/src/mesa/drivers/dri/i915tex/intel_metaops.c
@@ -405,36 +405,41 @@ intel_meta_draw_poly(struct intel_contex
                      GLfloat z, GLuint color, GLfloat tex[][2])
 {
    GLint i;
-
    intel_update_software_state( intel );
-   intel_emit_hardware_state( intel, 2+n*intel->vertex_size );
-
-   /* All 3d primitives should be emitted with INTEL_BATCH_CLIPRECTS,
-    * otherwise the drawing origin (DR4) might not be set correctly.
-    *
-    * XXX: use the vb for vertices!
-    */
-   BEGIN_BATCH(2+n*intel->vertex_size, INTEL_BATCH_CLIPRECTS);
 
-   OUT_BATCH( _3DPRIMITIVE |
-	      PRIM3D_TRIFAN | 
-	      (n * intel->vertex_size - 1 ));
-
-
-   for (i = 0; i < n; i++) {
-      OUT_BATCH_F( xy[i][0] );
-      OUT_BATCH_F( xy[i][1] );
-      OUT_BATCH_F( z );
-      OUT_BATCH( color );
-      if (intel->vertex_size == 6) {
-	 OUT_BATCH_F( tex[i][0] );
-	 OUT_BATCH_F( tex[i][1] );
-      }
-      else {
-	 assert(intel->vertex_size == 4);
+   {
+      /* Must be after call to intel_update_software_state():
+       */
+      GLuint dwords = 2+n*intel->vertex_size;
+      intel_emit_hardware_state( intel, dwords );
+
+      /* All 3d primitives should be emitted with INTEL_BATCH_CLIPRECTS,
+       * otherwise the drawing origin (DR4) might not be set correctly.
+       *
+       * XXX: use the vb for vertices!
+       */
+      BEGIN_BATCH(dwords, INTEL_BATCH_CLIPRECTS);
+
+      OUT_BATCH( _3DPRIMITIVE |
+		 PRIM3D_TRIFAN | 
+		 (n * intel->vertex_size - 1 ));
+
+
+      for (i = 0; i < n; i++) {
+	 OUT_BATCH_F( xy[i][0] );
+	 OUT_BATCH_F( xy[i][1] );
+	 OUT_BATCH_F( z );
+	 OUT_BATCH( color );
+	 if (intel->vertex_size == 6) {
+	    OUT_BATCH_F( tex[i][0] );
+	    OUT_BATCH_F( tex[i][1] );
+	 }
+	 else {
+	    assert(intel->vertex_size == 4);
+	 }
       }
+      ADVANCE_BATCH();
    }
-   ADVANCE_BATCH();
 }
 
 void
diff --git a/src/mesa/drivers/dri/i915tex/intel_tris.c b/src/mesa/drivers/dri/i915tex/intel_tris.c
index 79faddc..ec53ebd 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tris.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tris.c
@@ -68,12 +68,14 @@ intel_flush_inline_primitive(struct inte
    intel->prim.flush = 0;
 
    if (used) {
+      GLuint dwords = 2;
+
       /* Need a loop to ensure the batch gets emitted to the same
        * batchbuffer as the hardware state:
        */
-      intel_emit_hardware_state( intel, 2 );
+      intel_emit_hardware_state( intel, dwords );
 
-      BEGIN_BATCH(2, 0);
+      BEGIN_BATCH( dwords, INTEL_BATCH_CLIPRECTS );
       OUT_BATCH(_3DPRIMITIVE |
 		intel->prim.primitive | 
 		PRIM_INDIRECT |



More information about the mesa-commit mailing list