i965/gen6/gs: use brw_gs_prog atom instead of brw_ff_gs_prog
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Tue, 1 Jul 2014 06:52:47 +0000 (08:52 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Fri, 19 Sep 2014 13:01:14 +0000 (15:01 +0200)
This is needed to support user-provided geometry shaders, since the
brw_ff_gs_prog atom in gen6 only takes care of implementing transform feedback
for vertex shaders.

If there is no user-provided geometry shader the implementation falls back to
the original code.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_gs.h
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/brw_vec4_gs.c

index fbd728f67c3021e2fcf3de6a3ffb5b8c3a2b850c..c0c4c13f13cb7903ba84f466c1b090e1bc884690 100644 (file)
@@ -243,6 +243,10 @@ brw_upload_ff_gs_prog(struct brw_context *brw)
    }
 }
 
+void gen6_brw_upload_ff_gs_prog(struct brw_context *brw)
+{
+   brw_upload_ff_gs_prog(brw);
+}
 
 const struct brw_tracked_state brw_ff_gs_prog = {
    .dirty = {
index f8f430c157a6fc6b53d88a3d3fffafd56b658b1c..a538948e9ac6aebdc4b1515ab61c384142061059 100644 (file)
@@ -110,5 +110,6 @@ void brw_ff_gs_lines(struct brw_ff_gs_compile *c);
 void gen6_sol_program(struct brw_ff_gs_compile *c,
                       struct brw_ff_gs_prog_key *key,
                       unsigned num_verts, bool check_edge_flag);
+void gen6_brw_upload_ff_gs_prog(struct brw_context *brw);
 
 #endif
index e94662122807fe727631c5fd43b09e05894fd743..87cc0eaba23dfb60e3b92fc7423ac30794d9ab20 100644 (file)
@@ -108,7 +108,7 @@ static const struct brw_tracked_state *gen4_atoms[] =
 static const struct brw_tracked_state *gen6_atoms[] =
 {
    &brw_vs_prog, /* must do before state base address */
-   &brw_ff_gs_prog, /* must do before state base address */
+   &brw_gs_prog, /* must do before state base address */
    &brw_wm_prog, /* must do before state base address */
 
    &gen6_clip_vp,
index b5b2a0f454fe5bae178dbb37b963f63f48405251..b00e584f7a2425ea15ecfea0cf861f8e9261deb5 100644 (file)
@@ -31,6 +31,7 @@
 #include "brw_context.h"
 #include "brw_vec4_gs_visitor.h"
 #include "brw_state.h"
+#include "brw_gs.h"
 
 
 static bool
@@ -272,6 +273,12 @@ brw_upload_gs_prog(struct brw_context *brw)
       (struct brw_geometry_program *) brw->geometry_program;
 
    if (gp == NULL) {
+      if (brw->gen == 6) {
+         if (brw->state.dirty.brw & BRW_NEW_TRANSFORM_FEEDBACK)
+            gen6_brw_upload_ff_gs_prog(brw);
+         return;
+      }
+
       /* No geometry shader.  Vertex data just passes straight through. */
       if (brw->state.dirty.brw & BRW_NEW_VUE_MAP_VS) {
          brw->vue_map_geom_out = brw->vue_map_vs;
@@ -327,7 +334,9 @@ brw_upload_gs_prog(struct brw_context *brw)
 const struct brw_tracked_state brw_gs_prog = {
    .dirty = {
       .mesa  = (_NEW_LIGHT | _NEW_BUFFERS | _NEW_TEXTURE),
-      .brw   = BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_VUE_MAP_VS,
+      .brw   = (BRW_NEW_GEOMETRY_PROGRAM |
+                BRW_NEW_VUE_MAP_VS |
+                BRW_NEW_TRANSFORM_FEEDBACK),
    },
    .emit = brw_upload_gs_prog
 };