diff options
author | Samuel Iglesias Gonsalvez <[email protected]> | 2014-07-02 14:52:40 +0200 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2014-09-19 15:01:15 +0200 |
commit | 406e04113fb23c514cc63bdab9a46476261d6f10 (patch) | |
tree | 0c0e8ca7af5a6dfe55eb4389c740099b00189d94 /src/mesa/drivers | |
parent | 96012dfe80121c5d6f5f9c87149aa4ed1da567cb (diff) |
i965/gs: Reuse gen6 constant push buffers setup code in gen7+.
The code required for gen6 and gen7+ is almost the same, so reuse it.
Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Acked-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state_upload.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_gs_state.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_gs_state.c | 33 |
3 files changed, 7 insertions, 36 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 59d5936a514..c0b3c8b284b 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -197,7 +197,7 @@ static const struct brw_tracked_state *gen7_atoms[] = &gen6_depth_stencil_state, /* must do before cc unit */ &gen6_vs_push_constants, /* Before vs_state */ - &gen7_gs_push_constants, /* Before gs_state */ + &gen6_gs_push_constants, /* Before gs_state */ &gen6_wm_push_constants, /* Before wm_surfaces and constant_buffer */ /* Surface state setup. Must come before the VS/WM unit. The binding @@ -271,7 +271,7 @@ static const struct brw_tracked_state *gen8_atoms[] = &gen6_color_calc_state, &gen6_vs_push_constants, /* Before vs_state */ - &gen7_gs_push_constants, /* Before gs_state */ + &gen6_gs_push_constants, /* Before gs_state */ &gen6_wm_push_constants, /* Before wm_surfaces and constant_buffer */ /* Surface state setup. Must come before the VS/WM unit. The binding diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c index 917a3faa478..6b4e99386f0 100644 --- a/src/mesa/drivers/dri/i965/gen6_gs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c @@ -33,18 +33,22 @@ static void gen6_upload_gs_push_constants(struct brw_context *brw) { + struct brw_stage_state *stage_state = &brw->gs.base; + /* BRW_NEW_GEOMETRY_PROGRAM */ const struct brw_geometry_program *gp = (struct brw_geometry_program *) brw->geometry_program; if (gp) { /* CACHE_NEW_GS_PROG */ - struct brw_stage_state *stage_state = &brw->gs.base; struct brw_stage_prog_data *prog_data = &brw->gs.prog_data->base.base; gen6_upload_push_constants(brw, &gp->program.Base, prog_data, stage_state, AUB_TRACE_VS_CONSTANTS); } + + if (brw->gen >= 7) + gen7_upload_constant_state(brw, stage_state, gp, _3DSTATE_CONSTANT_GS); } const struct brw_tracked_state gen6_gs_push_constants = { diff --git a/src/mesa/drivers/dri/i965/gen7_gs_state.c b/src/mesa/drivers/dri/i965/gen7_gs_state.c index e3e175eb31f..4fe1354262e 100644 --- a/src/mesa/drivers/dri/i965/gen7_gs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_gs_state.c @@ -26,39 +26,6 @@ #include "brw_defines.h" #include "intel_batchbuffer.h" - -static void -gen7_upload_gs_push_constants(struct brw_context *brw) -{ - const struct brw_stage_state *stage_state = &brw->gs.base; - /* BRW_NEW_GEOMETRY_PROGRAM */ - const struct brw_geometry_program *gp = - (struct brw_geometry_program *) brw->geometry_program; - - if (gp) { - /* CACHE_NEW_GS_PROG */ - const struct brw_stage_prog_data *prog_data = &brw->gs.prog_data->base.base; - struct brw_stage_state *stage_state = &brw->gs.base; - - gen6_upload_push_constants(brw, &gp->program.Base, prog_data, - stage_state, AUB_TRACE_VS_CONSTANTS); - } - - gen7_upload_constant_state(brw, stage_state, gp, _3DSTATE_CONSTANT_GS); -} - -const struct brw_tracked_state gen7_gs_push_constants = { - .dirty = { - .mesa = _NEW_TRANSFORM | _NEW_PROGRAM_CONSTANTS, - .brw = (BRW_NEW_BATCH | - BRW_NEW_GEOMETRY_PROGRAM | - BRW_NEW_PUSH_CONSTANT_ALLOCATION), - .cache = CACHE_NEW_GS_PROG, - }, - .emit = gen7_upload_gs_push_constants, -}; - - static void upload_gs_state(struct brw_context *brw) { |