[Mesa-dev] [PATCH v2 4/4] i965/state: Add compute pipeline with empty atom lists

Kenneth Graunke kenneth at whitecape.org
Sun Mar 15 21:39:16 PDT 2015


On Wednesday, March 11, 2015 11:53:40 AM Jordan Justen wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_context.h      |  2 ++
>  src/mesa/drivers/dri/i965/brw_state.h        |  1 +
>  src/mesa/drivers/dri/i965/brw_state_upload.c | 28 +++++++++++++++++++++++++++-
>  3 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index e693f50..f15cd7c 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -151,6 +151,7 @@ struct brw_wm_prog_data;
>  
>  enum brw_pipeline {
>     BRW_RENDER_PIPELINE,
> +   BRW_COMPUTE_PIPELINE,
>  
>     BRW_NUM_PIPELINES
>  };
> @@ -1395,6 +1396,7 @@ struct brw_context
>  
>     int num_atoms[BRW_NUM_PIPELINES];
>     const struct brw_tracked_state render_atoms[57];
> +   const struct brw_tracked_state compute_atoms[0];
>  
>     /* If (INTEL_DEBUG & DEBUG_BATCH) */
>     struct {

I'm uncomfortable with this.  My understanding is that zero-length
arrays are a GCC extension from the pre-C99 days corresponding to (more
or less) a variable-length array...which are usually used at the end of
a structure.  They indicate that there /is/ array data there, but some
arbitrary amount.

This is in the middle of a structure, and with no actual data, the
pointer just points...at the next (totally unrelated) field?

I'd feel a lot more confident if you changed this to compute_atoms[1].
Then it'd be a real array with real storage.  num_atoms will be 0
anyway; there shouldn't be any harm in overallocating it.

With that change,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150315/68f77df5/attachment.sig>


More information about the mesa-dev mailing list