From: Samuel Iglesias Gonsalvez Date: Tue, 1 Jul 2014 06:52:47 +0000 (+0200) Subject: i965/gen6/gs: use brw_gs_prog atom instead of brw_ff_gs_prog X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc383cb55b9d342a77b44328cb4acb5bbdf4a80c;p=mesa.git i965/gen6/gs: use brw_gs_prog atom instead of brw_ff_gs_prog 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 Reviewed-by: Jordan Justen Acked-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index fbd728f67c3..c0c4c13f13c 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -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 = { diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h index f8f430c157a..a538948e9ac 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -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 diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index e9466212280..87cc0eaba23 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -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, diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c b/src/mesa/drivers/dri/i965/brw_vec4_gs.c index b5b2a0f454f..b00e584f7a2 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c @@ -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 };