diff options
author | Kenneth Graunke <[email protected]> | 2015-09-30 17:04:23 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-12-11 13:11:15 -0800 |
commit | 86a6eda9bcbf00da550beffcfaba9e20f62ef84a (patch) | |
tree | de6a891ebf9acfa92639a900ffb9b3b2a8055318 /src | |
parent | c59d1b1fd1ac5dca3b769f42fe0e42a11c10d4b8 (diff) |
i965: Add tessellation shader push constant support.
Based on a patch by Chris Forbes.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state_upload.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_ds_state.c | 29 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_hs_state.c | 29 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen8_ds_state.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen8_hs_state.c | 14 |
7 files changed, 63 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index fd3d3746579..1cc4c7b1282 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1236,7 +1236,7 @@ struct brw_context } perfmon; int num_atoms[BRW_NUM_PIPELINES]; - const struct brw_tracked_state render_atoms[74]; + const struct brw_tracked_state render_atoms[76]; const struct brw_tracked_state compute_atoms[10]; /* If (INTEL_DEBUG & DEBUG_BATCH) */ diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 986406bab19..d29b997b963 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -143,6 +143,7 @@ extern const struct brw_tracked_state gen7_depthbuffer; extern const struct brw_tracked_state gen7_clip_state; extern const struct brw_tracked_state gen7_ds_state; extern const struct brw_tracked_state gen7_gs_state; +extern const struct brw_tracked_state gen7_tcs_push_constants; extern const struct brw_tracked_state gen7_hs_state; extern const struct brw_tracked_state gen7_l3_state; extern const struct brw_tracked_state gen7_ps_state; @@ -152,6 +153,7 @@ extern const struct brw_tracked_state gen7_sf_clip_viewport; extern const struct brw_tracked_state gen7_sf_state; extern const struct brw_tracked_state gen7_sol_state; extern const struct brw_tracked_state gen7_te_state; +extern const struct brw_tracked_state gen7_tes_push_constants; extern const struct brw_tracked_state gen7_urb; extern const struct brw_tracked_state gen7_vs_state; extern const struct brw_tracked_state gen7_wm_state; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index a31e3f4eead..cf3cf97daea 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -294,6 +294,8 @@ static const struct brw_tracked_state *gen8_render_atoms[] = &brw_wm_image_surfaces, /* Before wm push/pull constants and binding table */ &gen6_vs_push_constants, /* Before vs_state */ + &gen7_tcs_push_constants, + &gen7_tes_push_constants, &gen6_gs_push_constants, /* Before gs_state */ &gen6_wm_push_constants, /* Before wm_surfaces and constant_buffer */ diff --git a/src/mesa/drivers/dri/i965/gen7_ds_state.c b/src/mesa/drivers/dri/i965/gen7_ds_state.c index 79993b6d9f0..4d3d94f68a6 100644 --- a/src/mesa/drivers/dri/i965/gen7_ds_state.c +++ b/src/mesa/drivers/dri/i965/gen7_ds_state.c @@ -27,6 +27,35 @@ #include "intel_batchbuffer.h" static void +gen7_upload_tes_push_constants(struct brw_context *brw) +{ + struct brw_stage_state *stage_state = &brw->tes.base; + /* BRW_NEW_TESS_EVAL_PROGRAM */ + const struct brw_tess_eval_program *tep = + (struct brw_tess_eval_program *) brw->tess_eval_program; + + if (tep) { + /* BRW_NEW_TES_PROG_DATA */ + const struct brw_stage_prog_data *prog_data = &brw->tes.prog_data->base.base; + gen6_upload_push_constants(brw, &tep->program.Base, prog_data, + stage_state, AUB_TRACE_VS_CONSTANTS); + } + + gen7_upload_constant_state(brw, stage_state, tep, _3DSTATE_CONSTANT_DS); +} + +const struct brw_tracked_state gen7_tes_push_constants = { + .dirty = { + .mesa = _NEW_PROGRAM_CONSTANTS, + .brw = BRW_NEW_BATCH | + BRW_NEW_PUSH_CONSTANT_ALLOCATION | + BRW_NEW_TESS_EVAL_PROGRAM | + BRW_NEW_TES_PROG_DATA, + }, + .emit = gen7_upload_tes_push_constants, +}; + +static void gen7_upload_ds_state(struct brw_context *brw) { /* Disable the DS Unit */ diff --git a/src/mesa/drivers/dri/i965/gen7_hs_state.c b/src/mesa/drivers/dri/i965/gen7_hs_state.c index ae55f340f52..fcaa9197857 100644 --- a/src/mesa/drivers/dri/i965/gen7_hs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_hs_state.c @@ -27,6 +27,35 @@ #include "intel_batchbuffer.h" static void +gen7_upload_tcs_push_constants(struct brw_context *brw) +{ + struct brw_stage_state *stage_state = &brw->tcs.base; + /* BRW_NEW_TESS_CTRL_PROGRAM */ + const struct brw_tess_ctrl_program *tcp = + (struct brw_tess_ctrl_program *) brw->tess_ctrl_program; + + if (tcp) { + /* BRW_NEW_TCS_PROG_DATA */ + const struct brw_stage_prog_data *prog_data = &brw->tcs.prog_data->base.base; + gen6_upload_push_constants(brw, &tcp->program.Base, prog_data, + stage_state, AUB_TRACE_VS_CONSTANTS); + } + + gen7_upload_constant_state(brw, stage_state, tcp, _3DSTATE_CONSTANT_HS); +} + +const struct brw_tracked_state gen7_tcs_push_constants = { + .dirty = { + .mesa = _NEW_PROGRAM_CONSTANTS, + .brw = BRW_NEW_BATCH | + BRW_NEW_PUSH_CONSTANT_ALLOCATION | + BRW_NEW_TESS_CTRL_PROGRAM | + BRW_NEW_TCS_PROG_DATA, + }, + .emit = gen7_upload_tcs_push_constants, +}; + +static void gen7_upload_hs_state(struct brw_context *brw) { /* Disable the HS Unit */ diff --git a/src/mesa/drivers/dri/i965/gen8_ds_state.c b/src/mesa/drivers/dri/i965/gen8_ds_state.c index 3dcf3d394aa..4ce4ab30e11 100644 --- a/src/mesa/drivers/dri/i965/gen8_ds_state.c +++ b/src/mesa/drivers/dri/i965/gen8_ds_state.c @@ -30,20 +30,6 @@ static void gen8_upload_ds_state(struct brw_context *brw) { /* Disable the DS Unit */ - BEGIN_BATCH(11); - OUT_BATCH(_3DSTATE_CONSTANT_DS << 16 | (11 - 2)); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); - int ds_pkt_len = brw->gen >= 9 ? 11 : 9; BEGIN_BATCH(ds_pkt_len); OUT_BATCH(_3DSTATE_DS << 16 | (ds_pkt_len - 2)); diff --git a/src/mesa/drivers/dri/i965/gen8_hs_state.c b/src/mesa/drivers/dri/i965/gen8_hs_state.c index c7e4c5004a9..62e714d522c 100644 --- a/src/mesa/drivers/dri/i965/gen8_hs_state.c +++ b/src/mesa/drivers/dri/i965/gen8_hs_state.c @@ -30,20 +30,6 @@ static void gen8_upload_hs_state(struct brw_context *brw) { /* Disable the HS Unit */ - BEGIN_BATCH(11); - OUT_BATCH(_3DSTATE_CONSTANT_HS << 16 | (11 - 2)); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); - BEGIN_BATCH(9); OUT_BATCH(_3DSTATE_HS << 16 | (9 - 2)); OUT_BATCH(0); |