[Mesa-dev] [PATCH 03/20] i965: Allocate space on the gather pool for plain uniforms

Francisco Jerez currojerez at riseup.net
Fri Oct 23 08:11:49 PDT 2015


Abdiel Janulgue <abdiel.janulgue at linux.intel.com> writes:

> Reserve space in the gather pool where the gathered uniforms are flushed.
>
> Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> ---
>  src/mesa/drivers/dri/i965/gen6_vs_state.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> index 6653a6d..b78166e 100644
> --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> @@ -120,6 +120,14 @@ gen6_upload_push_constants(struct brw_context *brw,
>         */
>        assert(stage_state->push_const_size <= 32);
>     }
> +   /* Allocate gather pool space for uniform and UBO entries in 512-bit chunks*/

Missing punctuation and space at the end of the comment.

> +   if (brw->gather_pool.bo != NULL) {
> +      if (prog_data->nr_params > 0) {
> +         int num_consts = ALIGN(prog_data->nr_params, 4) / 4;
> +         stage_state->push_const_offset = brw->gather_pool.next_offset;
> +         brw->gather_pool.next_offset += (ALIGN(num_consts, 4) / 4) * 64;
> +      }

This whole if-statement could be simplified to:

| if (brw->gather_pool.bo != NULL) {
|    stage_state->push_const_offset = brw->gather_pool.next_offset;
|    brw->gather_pool.next_offset += DIV_ROUND_UP(prog_data->nr_params, 16);
| }

And shouldn't this be doing something to make sure that there's enough
room left in the pool to hold all push constants of the shader in order
to avoid overflow?

> +   }
>  }
>  
>  static void
> -- 
> 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/20151023/503dbdf9/attachment.sig>


More information about the mesa-dev mailing list