Re: [Mesa-dev] [PATCH 1/4] gallivm: convert size query to using a set of parameters.

2016-04-18 Thread Roland Scheidegger
Am 18.04.2016 um 04:49 schrieb Dave Airlie:
> From: Dave Airlie 
> 
> This isn't currently that easy to expand, so fix it up
> before expanding it later to include dynamic samplers.
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/gallium/auxiliary/draw/draw_llvm_sample.c | 22 ++-
>  src/gallium/auxiliary/gallivm/lp_bld_sample.h | 21 ---
>  src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 71 
> +++
>  src/gallium/auxiliary/gallivm/lp_bld_tgsi.h   |  9 +--
>  src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c   | 18 +++---
>  src/gallium/drivers/llvmpipe/lp_tex_sample.c  | 22 ++-
>  src/gallium/drivers/swr/swr_tex_sample.cpp| 22 ++-
>  7 files changed, 71 insertions(+), 114 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c 
> b/src/gallium/auxiliary/draw/draw_llvm_sample.c
> index cb31695..1845c05 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c
> @@ -251,30 +251,16 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct 
> lp_build_sampler_soa *base,
>  static void
>  draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa 
> *base,
>struct gallivm_state *gallivm,
> -  struct lp_type type,
> -  unsigned texture_unit,
> -  unsigned target,
> -  LLVMValueRef context_ptr,
> -  boolean is_sviewinfo,
> -  enum lp_sampler_lod_property 
> lod_property,
> -  LLVMValueRef explicit_lod, /* optional 
> */
> -  LLVMValueRef *sizes_out)
> +  const struct 
> lp_sampler_size_query_params *params)
>  {
> struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa 
> *)base;
>  
> -   assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
> +   assert(params->texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
>  
> lp_build_size_query_soa(gallivm,
> -   
> >dynamic_state.static_state[texture_unit].texture_state,
> +   
> >dynamic_state.static_state[params->texture_unit].texture_state,
> >dynamic_state.base,
> -   type,
> -   texture_unit,
> -   target,
> -   context_ptr,
> -   is_sviewinfo,
> -   lod_property,
> -   explicit_lod,
> -   sizes_out);
> +   params);
>  }
>  
>  struct lp_build_sampler_soa *
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h 
> b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
> index 902ae41..9ec051a 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
> @@ -110,7 +110,17 @@ struct lp_sampler_params
> LLVMValueRef *texel;
>  };
>  
> -
> +struct lp_sampler_size_query_params
> +{
> +   struct lp_type int_type;
> +   unsigned texture_unit;
> +   unsigned target;
> +   LLVMValueRef context_ptr;
> +   boolean is_sviewinfo;
> +   enum lp_sampler_lod_property lod_property;
> +   LLVMValueRef explicit_lod;
> +   LLVMValueRef *sizes_out;
> +};
>  /**
>   * Texture static state.
>   *
> @@ -606,14 +616,7 @@ void
>  lp_build_size_query_soa(struct gallivm_state *gallivm,
>  const struct lp_static_texture_state *static_state,
>  struct lp_sampler_dynamic_state *dynamic_state,
> -struct lp_type int_type,
> -unsigned texture_unit,
> -unsigned target,
> -LLVMValueRef context_ptr,
> -boolean is_sviewinfo,
> -enum lp_sampler_lod_property lod_property,
> -LLVMValueRef explicit_lod,
> -LLVMValueRef *sizes_out);
> +const struct lp_sampler_size_query_params *params);
>  
>  void
>  lp_build_sample_nop(struct gallivm_state *gallivm, 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
> b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> index 937948b..c16b1c9 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> @@ -3439,14 +3439,7 @@ void
>  lp_build_size_query_soa(struct gallivm_state *gallivm,
>  const struct lp_static_texture_state *static_state,
>  struct lp_sampler_dynamic_state *dynamic_state,
> -struct lp_type int_type,
> -unsigned 

[Mesa-dev] [PATCH 1/4] gallivm: convert size query to using a set of parameters.

2016-04-17 Thread Dave Airlie
From: Dave Airlie 

This isn't currently that easy to expand, so fix it up
before expanding it later to include dynamic samplers.

Signed-off-by: Dave Airlie 
---
 src/gallium/auxiliary/draw/draw_llvm_sample.c | 22 ++-
 src/gallium/auxiliary/gallivm/lp_bld_sample.h | 21 ---
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 71 +++
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h   |  9 +--
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c   | 18 +++---
 src/gallium/drivers/llvmpipe/lp_tex_sample.c  | 22 ++-
 src/gallium/drivers/swr/swr_tex_sample.cpp| 22 ++-
 7 files changed, 71 insertions(+), 114 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c 
b/src/gallium/auxiliary/draw/draw_llvm_sample.c
index cb31695..1845c05 100644
--- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
+++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c
@@ -251,30 +251,16 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct 
lp_build_sampler_soa *base,
 static void
 draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
   struct gallivm_state *gallivm,
-  struct lp_type type,
-  unsigned texture_unit,
-  unsigned target,
-  LLVMValueRef context_ptr,
-  boolean is_sviewinfo,
-  enum lp_sampler_lod_property 
lod_property,
-  LLVMValueRef explicit_lod, /* optional */
-  LLVMValueRef *sizes_out)
+  const struct 
lp_sampler_size_query_params *params)
 {
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa 
*)base;
 
-   assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
+   assert(params->texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
 
lp_build_size_query_soa(gallivm,
-   
>dynamic_state.static_state[texture_unit].texture_state,
+   
>dynamic_state.static_state[params->texture_unit].texture_state,
>dynamic_state.base,
-   type,
-   texture_unit,
-   target,
-   context_ptr,
-   is_sviewinfo,
-   lod_property,
-   explicit_lod,
-   sizes_out);
+   params);
 }
 
 struct lp_build_sampler_soa *
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 902ae41..9ec051a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -110,7 +110,17 @@ struct lp_sampler_params
LLVMValueRef *texel;
 };
 
-
+struct lp_sampler_size_query_params
+{
+   struct lp_type int_type;
+   unsigned texture_unit;
+   unsigned target;
+   LLVMValueRef context_ptr;
+   boolean is_sviewinfo;
+   enum lp_sampler_lod_property lod_property;
+   LLVMValueRef explicit_lod;
+   LLVMValueRef *sizes_out;
+};
 /**
  * Texture static state.
  *
@@ -606,14 +616,7 @@ void
 lp_build_size_query_soa(struct gallivm_state *gallivm,
 const struct lp_static_texture_state *static_state,
 struct lp_sampler_dynamic_state *dynamic_state,
-struct lp_type int_type,
-unsigned texture_unit,
-unsigned target,
-LLVMValueRef context_ptr,
-boolean is_sviewinfo,
-enum lp_sampler_lod_property lod_property,
-LLVMValueRef explicit_lod,
-LLVMValueRef *sizes_out);
+const struct lp_sampler_size_query_params *params);
 
 void
 lp_build_sample_nop(struct gallivm_state *gallivm, 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 937948b..c16b1c9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -3439,14 +3439,7 @@ void
 lp_build_size_query_soa(struct gallivm_state *gallivm,
 const struct lp_static_texture_state *static_state,
 struct lp_sampler_dynamic_state *dynamic_state,
-struct lp_type int_type,
-unsigned texture_unit,
-unsigned target,
-LLVMValueRef context_ptr,
-boolean is_sviewinfo,
-enum lp_sampler_lod_property lod_property,
-LLVMValueRef explicit_lod,
-