[Mesa-dev] [PATCH 04/10] i965/vec4: Do not mark used direct surfaces in VS_OPCODE_PULL_CONSTANT_LOAD

Francisco Jerez currojerez at riseup.net
Fri Oct 30 06:38:04 PDT 2015


Iago Toral Quiroga <itoral at igalia.com> writes:

> Right now the generator marks direct surfaces as used but leaves marking of
> indirect surfaces to the caller. Just make the callers handle marking in both
> cases for consistency.
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 9 ---------
>  src/mesa/drivers/dri/i965/brw_vec4_nir.cpp       | 6 ++++--
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   | 7 +++++--
>  3 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> index 8bc21df..ebb353a 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> @@ -925,8 +925,6 @@ generate_pull_constant_load(struct brw_codegen *p,
>  			   2, /* mlen */
>                             true, /* header_present */
>  			   1 /* rlen */);
> -
> -   brw_mark_surface_used(&prog_data->base, surf_index);
>  }
>  
>  static void
> @@ -981,9 +979,6 @@ generate_pull_constant_load_gen7(struct brw_codegen *p,
>                                inst->header_size != 0,
>                                BRW_SAMPLER_SIMD_MODE_SIMD4X2,
>                                0);
> -
> -      brw_mark_surface_used(&prog_data->base, surf_index.dw1.ud);
> -
>     } else {
>  
>        struct brw_reg addr = vec1(retype(brw_address_reg(0), BRW_REGISTER_TYPE_UD));
> @@ -1013,10 +1008,6 @@ generate_pull_constant_load_gen7(struct brw_codegen *p,
>                                inst->header_size != 0,
>                                BRW_SAMPLER_SIMD_MODE_SIMD4X2,
>                                0);
> -
> -      /* visitor knows more than we do about the surface limit required,
> -       * so has already done marking.
> -       */
>     }
>  }
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> index 0f04f65..efbdaa9 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> @@ -749,8 +749,10 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
>           /* The block index is a constant, so just emit the binding table entry
>            * as an immediate.
>            */
> -         surf_index = src_reg(prog_data->base.binding_table.ubo_start +
> -                              const_block_index->u[0]);
> +         unsigned index = prog_data->base.binding_table.ubo_start +
> +                          const_block_index->u[0];

const.

> +         surf_index = src_reg(index);
> +         brw_mark_surface_used(&prog_data->base, index);
>        } else {
>           /* The block index is not a constant. Evaluate the index expression
>            * per-channel and add the base UBO index; we have to select a value
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index b8f90f2..0126ad9 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -1729,14 +1729,17 @@ vec4_visitor::emit_pull_constant_load(bblock_t *block, vec4_instruction *inst,
>  				      int base_offset)
>  {
>     int reg_offset = base_offset + orig_src.reg_offset;
> -   src_reg index = src_reg(prog_data->base.binding_table.pull_constants_start);
> +   unsigned index = prog_data->base.binding_table.pull_constants_start;
> +   src_reg surf_index = src_reg(index);

Again it doesn't seem particularly useful to introduce another
declaration here for the register.  With these fixed:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

>     src_reg offset = get_pull_constant_offset(block, inst, orig_src.reladdr,
>                                               reg_offset);
>  
>     emit_pull_constant_load_reg(temp,
> -                               index,
> +                               surf_index,
>                                 offset,
>                                 block, inst);
> +
> +   brw_mark_surface_used(&prog_data->base, index);
>  }
>  
>  /**
> -- 
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151030/2ecbf69f/attachment.sig>


More information about the mesa-dev mailing list