[Mesa-dev] [PATCH v3.5] intel/compiler: Add union types for prog_data and prog_key stages

2017-10-26 Thread Jordan Justen
Signed-off-by: Jordan Justen 
Reviewed-by: Jason Ekstrand 
Cc: Jason Ekstrand 
Cc: Kenneth Graunke 
---

 * Add comment (Ken)
 * No typedef (Jason)

 src/intel/compiler/brw_compiler.h | 20 
 1 file changed, 20 insertions(+)

diff --git a/src/intel/compiler/brw_compiler.h 
b/src/intel/compiler/brw_compiler.h
index 701b4a80bf1..6ad89171ce4 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -403,6 +403,16 @@ struct brw_cs_prog_key {
struct brw_sampler_prog_key_data tex;
 };
 
+/* brw_any_prog_key is any of the keys that map to an API stage */
+union brw_any_prog_key {
+   struct brw_vs_prog_key vs;
+   struct brw_tcs_prog_key tcs;
+   struct brw_tes_prog_key tes;
+   struct brw_gs_prog_key gs;
+   struct brw_wm_prog_key wm;
+   struct brw_cs_prog_key cs;
+};
+
 /*
  * Image metadata structure as laid out in the shader parameter
  * buffer.  Entries have to be 16B-aligned for the vec4 back-end to be
@@ -1066,6 +1076,16 @@ struct brw_clip_prog_data {
uint32_t total_grf;
 };
 
+/* brw_any_prog_data is prog_data for any stage that maps to an API stage */
+union brw_any_prog_data {
+   struct brw_vs_prog_data vs;
+   struct brw_tcs_prog_data tcs;
+   struct brw_tes_prog_data tes;
+   struct brw_gs_prog_data gs;
+   struct brw_wm_prog_data wm;
+   struct brw_cs_prog_data cs;
+};
+
 #define DEFINE_PROG_DATA_DOWNCAST(stage)   \
 static inline struct brw_##stage##_prog_data * \
 brw_##stage##_prog_data(struct brw_stage_prog_data *prog_data) \
-- 
2.15.0.rc2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3.5] intel/compiler: Add union types for prog_data and prog_key stages

2017-10-27 Thread Jason Ekstrand
On Thu, Oct 26, 2017 at 11:14 PM, Jordan Justen 
wrote:

> Signed-off-by: Jordan Justen 
> Reviewed-by: Jason Ekstrand 
> Cc: Jason Ekstrand 
> Cc: Kenneth Graunke 
> ---
>
>  * Add comment (Ken)
>  * No typedef (Jason)
>
>  src/intel/compiler/brw_compiler.h | 20 
>  1 file changed, 20 insertions(+)
>
> diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_
> compiler.h
> index 701b4a80bf1..6ad89171ce4 100644
> --- a/src/intel/compiler/brw_compiler.h
> +++ b/src/intel/compiler/brw_compiler.h
> @@ -403,6 +403,16 @@ struct brw_cs_prog_key {
> struct brw_sampler_prog_key_data tex;
>  };
>
> +/* brw_any_prog_key is any of the keys that map to an API stage */
> +union brw_any_prog_key {
> +   struct brw_vs_prog_key vs;
> +   struct brw_tcs_prog_key tcs;
> +   struct brw_tes_prog_key tes;
> +   struct brw_gs_prog_key gs;
> +   struct brw_wm_prog_key wm;
> +   struct brw_cs_prog_key cs;
> +};
> +
>  /*
>   * Image metadata structure as laid out in the shader parameter
>   * buffer.  Entries have to be 16B-aligned for the vec4 back-end to be
> @@ -1066,6 +1076,16 @@ struct brw_clip_prog_data {
> uint32_t total_grf;
>  };
>
> +/* brw_any_prog_data is prog_data for any stage that maps to an API stage
> */
> +union brw_any_prog_data {
>

For my usage, it'd be nice if you also throw stage_prog_data in here.


> +   struct brw_vs_prog_data vs;
> +   struct brw_tcs_prog_data tcs;
> +   struct brw_tes_prog_data tes;
> +   struct brw_gs_prog_data gs;
> +   struct brw_wm_prog_data wm;
> +   struct brw_cs_prog_data cs;
> +};
> +
>  #define DEFINE_PROG_DATA_DOWNCAST(stage)   \
>  static inline struct brw_##stage##_prog_data * \
>  brw_##stage##_prog_data(struct brw_stage_prog_data *prog_data) \
> --
> 2.15.0.rc2
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev