[Mesa-dev] [Mesa-dev, 1/5] i965: Support CS in update_stage_texture_surfaces

Kristian Høgsberg krh at bitplanet.net
Wed Sep 9 12:17:24 PDT 2015


Jordan Justen <jordan.l.justen at intel.com> writes:

> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
>
> ---
> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 72aad96..0eb5361 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -804,7 +804,7 @@ update_stage_texture_surfaces(struct brw_context *brw,
>                                struct brw_stage_state *stage_state,
>                                bool for_gather)
>  {
> -   if (!prog)
> +   if (!prog || !stage_state->prog_data)
>        return;

Why do we need to test for stage_state->prog_data being NULL now? This
atom always run after brw_upload_cs_prog(), which sets

  brw->cs.base.prog_data = &brw->cs.prog_data->base;

which shouldn't change after that.

Other that that,

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

>     struct gl_context *ctx = &brw->ctx;
> @@ -848,10 +848,14 @@ brw_update_texture_surfaces(struct brw_context *brw)
>     /* BRW_NEW_FRAGMENT_PROGRAM */
>     struct gl_program *fs = (struct gl_program *) brw->fragment_program;
>  
> +   /* BRW_NEW_COMPUTE_PROGRAM */
> +   struct gl_program *cs = (struct gl_program *) brw->compute_program;
> +
>     /* _NEW_TEXTURE */
>     update_stage_texture_surfaces(brw, vs, &brw->vs.base, false);
>     update_stage_texture_surfaces(brw, gs, &brw->gs.base, false);
>     update_stage_texture_surfaces(brw, fs, &brw->wm.base, false);
> +   update_stage_texture_surfaces(brw, cs, &brw->cs.base, false);
>  
>     /* emit alternate set of surface state for gather. this
>      * allows the surface format to be overriden for only the
> @@ -863,6 +867,8 @@ brw_update_texture_surfaces(struct brw_context *brw)
>           update_stage_texture_surfaces(brw, gs, &brw->gs.base, true);
>        if (fs && fs->UsesGather)
>           update_stage_texture_surfaces(brw, fs, &brw->wm.base, true);
> +      if (cs && cs->UsesGather)
> +         update_stage_texture_surfaces(brw, cs, &brw->cs.base, true);
>     }
>  
>     brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
> @@ -872,6 +878,7 @@ const struct brw_tracked_state brw_texture_surfaces = {
>     .dirty = {
>        .mesa = _NEW_TEXTURE,
>        .brw = BRW_NEW_BATCH |
> +             BRW_NEW_COMPUTE_PROGRAM |
>               BRW_NEW_FRAGMENT_PROGRAM |
>               BRW_NEW_FS_PROG_DATA |
>               BRW_NEW_GEOMETRY_PROGRAM |


More information about the mesa-dev mailing list