[Mesa-dev] [PATCH 15/18] i965/wm/gen6: Refactor push constant state uploading
Matt Turner
mattst88 at gmail.com
Thu Apr 23 11:53:53 PDT 2015
On Wed, Apr 22, 2015 at 1:47 PM, Topi Pohjolainen
<topi.pohjolainen at intel.com> wrote:
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
> src/mesa/drivers/dri/i965/brw_state.h | 5 ++++
> src/mesa/drivers/dri/i965/gen6_wm_state.c | 50 ++++++++++++++++++-------------
> 2 files changed, 34 insertions(+), 21 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
> index ca3274d..5be8035 100644
> --- a/src/mesa/drivers/dri/i965/brw_state.h
> +++ b/src/mesa/drivers/dri/i965/brw_state.h
> @@ -300,6 +300,11 @@ gen6_wm_state_set_programs(const struct brw_wm_prog_data *prog_data,
> uint32_t *ksp0, uint32_t *ksp2,
> uint32_t *dw4, uint32_t *dw5, uint32_t *dw6);
>
> +void
> +gen6_upload_constant_state(struct brw_context *brw,
> + const struct brw_wm_prog_data *prog_data,
> + const struct brw_stage_state *stage_state);
> +
> /* gen6_sf_state.c */
> void
> calculate_attr_overrides(const struct brw_context *brw,
> diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c
> index bc921e5..9edaf81 100644
> --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
> @@ -96,26 +96,11 @@ gen6_wm_state_set_programs(const struct brw_wm_prog_data *prog_data,
> }
> }
>
> -static void
> -upload_wm_state(struct brw_context *brw)
> +void
> +gen6_upload_constant_state(struct brw_context *brw,
> + const struct brw_wm_prog_data *prog_data,
> + const struct brw_stage_state *stage_state)
> {
> - struct gl_context *ctx = &brw->ctx;
> - /* BRW_NEW_FRAGMENT_PROGRAM */
> - const struct brw_fragment_program *fp =
> - brw_fragment_program_const(brw->fragment_program);
> - /* BRW_NEW_FS_PROG_DATA */
> - const struct brw_wm_prog_data *prog_data = brw->wm.prog_data;
> - uint32_t dw2, dw4, dw5, dw6, ksp0, ksp2;
> -
> - /* _NEW_BUFFERS */
> - bool multisampled_fbo = ctx->DrawBuffer->Visual.samples > 1;
> -
> - /* We can't fold this into gen6_upload_wm_push_constants(), because
> - * according to the SNB PRM, vol 2 part 1 section 7.2.2
> - * (3DSTATE_CONSTANT_PS [DevSNB]):
> - *
> - * "[DevSNB]: This packet must be followed by WM_STATE."
> - */
> if (prog_data->base.nr_params == 0) {
> /* Disable the push constant buffers. */
> BEGIN_BATCH(5);
> @@ -133,13 +118,36 @@ upload_wm_state(struct brw_context *brw)
> /* Pointer to the WM constant buffer. Covered by the set of
> * state flags from gen6_upload_wm_push_constants.
> */
> - OUT_BATCH(brw->wm.base.push_const_offset +
> - brw->wm.base.push_const_size - 1);
> + OUT_BATCH(stage_state->push_const_offset +
> + stage_state->push_const_size - 1);
Tab.
More information about the mesa-dev
mailing list