[Mesa-dev] [PATCH 2/4] i965: Split out per-stage dirty-bit checking into separate functions
Ian Romanick
idr at freedesktop.org
Fri Mar 20 18:02:29 PDT 2015
With the tabs converted to spaces, this patch is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
On 03/20/2015 05:49 PM, Carl Worth wrote:
> The dirty-bit checking from each brw_upload_<stage>_prog function is
> split out into its a new brw_<stage>_state_dirty function.
>
> This commit is intended to have no functional change. It exists in
> preparation for some upcoming code movement in preparation for the
> shader cache.
> ---
> src/mesa/drivers/dri/i965/brw_ff_gs.c | 16 ++++++++++-----
> src/mesa/drivers/dri/i965/brw_gs.c | 16 ++++++++++-----
> src/mesa/drivers/dri/i965/brw_vs.c | 24 +++++++++++++---------
> src/mesa/drivers/dri/i965/brw_wm.c | 38 ++++++++++++++++++++---------------
> 4 files changed, 59 insertions(+), 35 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_ff_gs.c b/src/mesa/drivers/dri/i965/brw_ff_gs.c
> index 1dec2ab..c589171 100644
> --- a/src/mesa/drivers/dri/i965/brw_ff_gs.c
> +++ b/src/mesa/drivers/dri/i965/brw_ff_gs.c
> @@ -147,6 +147,16 @@ static void compile_ff_gs_prog(struct brw_context *brw,
> ralloc_free(mem_ctx);
> }
>
> +static bool
> +brw_ff_gs_state_dirty(struct brw_context *brw)
> +{
> + return brw_state_dirty(brw,
> + _NEW_LIGHT,
> + BRW_NEW_PRIMITIVE |
> + BRW_NEW_TRANSFORM_FEEDBACK |
> + BRW_NEW_VS_PROG_DATA);
> +}
> +
> static void
> brw_ff_gs_populate_key(struct brw_context *brw,
> struct brw_ff_gs_prog_key *key)
> @@ -227,11 +237,7 @@ brw_upload_ff_gs_prog(struct brw_context *brw)
> {
> struct brw_ff_gs_prog_key key;
>
> - if (!brw_state_dirty(brw,
> - _NEW_LIGHT,
> - BRW_NEW_PRIMITIVE |
> - BRW_NEW_TRANSFORM_FEEDBACK |
> - BRW_NEW_VS_PROG_DATA))
> + if (!brw_ff_gs_state_dirty(brw))
> return;
>
> /* Populate the key:
> diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
> index 3458df3..c45e217 100644
> --- a/src/mesa/drivers/dri/i965/brw_gs.c
> +++ b/src/mesa/drivers/dri/i965/brw_gs.c
> @@ -288,6 +288,16 @@ do_gs_prog(struct brw_context *brw,
> return true;
> }
>
> +static bool
> +brw_gs_state_dirty(struct brw_context *brw)
> +{
> + return brw_state_dirty(brw,
> + _NEW_TEXTURE,
> + BRW_NEW_GEOMETRY_PROGRAM |
> + BRW_NEW_TRANSFORM_FEEDBACK |
> + BRW_NEW_VUE_MAP_VS);
> +}
> +
> static void
> brw_gs_populate_key(struct brw_context *brw,
> struct brw_gs_prog_key *key)
> @@ -322,11 +332,7 @@ brw_upload_gs_prog(struct brw_context *brw)
> struct brw_geometry_program *gp =
> (struct brw_geometry_program *) brw->geometry_program;
>
> - if (!brw_state_dirty(brw,
> - _NEW_TEXTURE,
> - BRW_NEW_GEOMETRY_PROGRAM |
> - BRW_NEW_TRANSFORM_FEEDBACK |
> - BRW_NEW_VUE_MAP_VS))
> + if (!brw_gs_state_dirty(brw))
> return;
>
> if (gp == NULL) {
> diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
> index b8e91c1..2c76d25 100644
> --- a/src/mesa/drivers/dri/i965/brw_vs.c
> +++ b/src/mesa/drivers/dri/i965/brw_vs.c
> @@ -401,6 +401,20 @@ brw_setup_vue_key_clip_info(struct brw_context *brw,
> }
> }
>
> +static bool
> +brw_vs_state_dirty(struct brw_context *brw)
> +{
> + return brw_state_dirty(brw,
> + _NEW_BUFFERS |
> + _NEW_LIGHT |
> + _NEW_POINT |
> + _NEW_POLYGON |
> + _NEW_TEXTURE |
> + _NEW_TRANSFORM,
> + BRW_NEW_VERTEX_PROGRAM |
> + BRW_NEW_VS_ATTRIB_WORKAROUNDS);
> +}
> +
> static void
> brw_vs_populate_key(struct brw_context *brw,
> struct brw_vs_prog_key *key)
> @@ -459,15 +473,7 @@ brw_upload_vs_prog(struct brw_context *brw)
> struct brw_vertex_program *vp =
> (struct brw_vertex_program *)brw->vertex_program;
>
> - if (!brw_state_dirty(brw,
> - _NEW_BUFFERS |
> - _NEW_LIGHT |
> - _NEW_POINT |
> - _NEW_POLYGON |
> - _NEW_TEXTURE |
> - _NEW_TRANSFORM,
> - BRW_NEW_VERTEX_PROGRAM |
> - BRW_NEW_VS_ATTRIB_WORKAROUNDS))
> + if (!brw_vs_state_dirty(brw))
> return;
>
> brw_vs_populate_key(brw, &key);
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
> index a0eda3a8..e9cb133 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> @@ -421,6 +421,27 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
> }
> }
>
> +static bool
> +brw_wm_state_dirty (struct brw_context *brw)
> +{
> + return brw_state_dirty(brw,
> + _NEW_BUFFERS |
> + _NEW_COLOR |
> + _NEW_DEPTH |
> + _NEW_FRAG_CLAMP |
> + _NEW_HINT |
> + _NEW_LIGHT |
> + _NEW_LINE |
> + _NEW_MULTISAMPLE |
> + _NEW_POLYGON |
> + _NEW_STENCIL |
> + _NEW_TEXTURE,
> + BRW_NEW_FRAGMENT_PROGRAM |
> + BRW_NEW_REDUCED_PRIMITIVE |
> + BRW_NEW_STATS_WM |
> + BRW_NEW_VUE_MAP_GEOM_OUT);
> +}
> +
> static void brw_wm_populate_key( struct brw_context *brw,
> struct brw_wm_prog_key *key )
> {
> @@ -590,22 +611,7 @@ brw_upload_wm_prog(struct brw_context *brw)
> struct brw_fragment_program *fp = (struct brw_fragment_program *)
> brw->fragment_program;
>
> - if (!brw_state_dirty(brw,
> - _NEW_BUFFERS |
> - _NEW_COLOR |
> - _NEW_DEPTH |
> - _NEW_FRAG_CLAMP |
> - _NEW_HINT |
> - _NEW_LIGHT |
> - _NEW_LINE |
> - _NEW_MULTISAMPLE |
> - _NEW_POLYGON |
> - _NEW_STENCIL |
> - _NEW_TEXTURE,
> - BRW_NEW_FRAGMENT_PROGRAM |
> - BRW_NEW_REDUCED_PRIMITIVE |
> - BRW_NEW_STATS_WM |
> - BRW_NEW_VUE_MAP_GEOM_OUT))
> + if (!brw_wm_state_dirty(brw))
> return;
>
> brw_wm_populate_key(brw, &key);
>
More information about the mesa-dev
mailing list