swrast-dri: Silence several "warning: unused parameter"
[mesa.git] / src / mesa / drivers / dri / i965 / brw_gs.c
index 001cd62f8cac8a20f922409a8a1b4ef41d040bf0..0a37485171ea6351d4b84eb89409f54e2773e2e5 100644 (file)
@@ -42,7 +42,7 @@
 #include "brw_state.h"
 #include "brw_gs.h"
 
-#include "../glsl/ralloc.h"
+#include "glsl/ralloc.h"
 
 static void compile_gs_prog( struct brw_context *brw,
                             struct brw_gs_prog_key *key )
@@ -62,17 +62,10 @@ static void compile_gs_prog( struct brw_context *brw,
    memset(&c, 0, sizeof(c));
    
    c.key = *key;
-   /* Need to locate the two positions present in vertex + header.
-    * These are currently hardcoded:
-    */
-   c.nr_attrs = brw_count_bits(c.key.attrs);
-
-   if (intel->gen >= 5)
-       c.nr_regs = (c.nr_attrs + 1) / 2 + 3;  /* are vertices packed, or reg-aligned? */
-   else
-       c.nr_regs = (c.nr_attrs + 1) / 2 + 1;  /* are vertices packed, or reg-aligned? */
-
-   c.nr_bytes = c.nr_regs * REG_SIZE;
+   /* The geometry shader needs to access the entire VUE. */
+   struct brw_vue_map vue_map;
+   brw_compute_vue_map(&vue_map, intel, c.key.nr_userclip, c.key.attrs);
+   c.nr_regs = (vue_map.num_slots + 1)/2;
 
    mem_ctx = NULL;
    
@@ -121,14 +114,11 @@ static void compile_gs_prog( struct brw_context *brw,
       printf("\n");
     }
 
-   /* Upload
-    */
-   drm_intel_bo_unreference(brw->gs.prog_bo);
-   brw->gs.prog_bo = brw_upload_cache(&brw->cache, BRW_GS_PROG,
-                                     &c.key, sizeof(c.key),
-                                     program, program_size,
-                                     &c.prog_data, sizeof(c.prog_data),
-                                     &brw->gs.prog_data);
+   brw_upload_cache(&brw->cache, BRW_GS_PROG,
+                   &c.key, sizeof(c.key),
+                   program, program_size,
+                   &c.prog_data, sizeof(c.prog_data),
+                   &brw->gs.prog_offset, &brw->gs.prog_data);
    ralloc_free(mem_ctx);
 }
 
@@ -168,6 +158,9 @@ static void populate_key( struct brw_context *brw,
       key->pv_first = GL_TRUE;
    }
 
+   /* _NEW_TRANSFORM */
+   key->nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
+
    key->need_gs_prog = (intel->gen >= 6)
       ? 0
       : (brw->primitive == GL_QUADS ||
@@ -189,22 +182,20 @@ static void prepare_gs_prog(struct brw_context *brw)
       brw->gs.prog_active = key.need_gs_prog;
    }
 
-   drm_intel_bo_unreference(brw->gs.prog_bo);
-   brw->gs.prog_bo = NULL;
-
    if (brw->gs.prog_active) {
-      brw->gs.prog_bo = brw_search_cache(&brw->cache, BRW_GS_PROG,
-                                        &key, sizeof(key),
-                                        &brw->gs.prog_data);
-      if (brw->gs.prog_bo == NULL)
+      if (!brw_search_cache(&brw->cache, BRW_GS_PROG,
+                           &key, sizeof(key),
+                           &brw->gs.prog_offset, &brw->gs.prog_data)) {
         compile_gs_prog( brw, &key );
+      }
    }
 }
 
 
 const struct brw_tracked_state brw_gs_prog = {
    .dirty = {
-      .mesa  = _NEW_LIGHT,
+      .mesa  = (_NEW_LIGHT |
+                _NEW_TRANSFORM),
       .brw   = BRW_NEW_PRIMITIVE,
       .cache = CACHE_NEW_VS_PROG
    },