[Mesa-dev] [PATCH 10/53] i965: stop passing gl_shader_program to brw_assign_common_binding_table_offsets()

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Jan 3 17:39:37 UTC 2017


Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

A tiny suggestion further down.

On 03/01/17 02:43, Timothy Arceri wrote:
> We now get eventhing we need directly from gl_program so there is

Everything? :)

> no need for this.
> ---
>   src/mesa/drivers/dri/i965/brw_cs.c       | 5 ++---
>   src/mesa/drivers/dri/i965/brw_gs.c       | 6 ++----
>   src/mesa/drivers/dri/i965/brw_shader.cpp | 5 -----
>   src/mesa/drivers/dri/i965/brw_shader.h   | 1 -
>   src/mesa/drivers/dri/i965/brw_tcs.c      | 2 +-
>   src/mesa/drivers/dri/i965/brw_tes.c      | 2 +-
>   src/mesa/drivers/dri/i965/brw_vs.c       | 2 +-
>   src/mesa/drivers/dri/i965/brw_wm.c       | 6 ++----
>   8 files changed, 9 insertions(+), 20 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
> index f220846..8658406 100644
> --- a/src/mesa/drivers/dri/i965/brw_cs.c
> +++ b/src/mesa/drivers/dri/i965/brw_cs.c
> @@ -36,7 +36,6 @@
>   
>   static void
>   assign_cs_binding_table_offsets(const struct gen_device_info *devinfo,
> -                                const struct gl_shader_program *shader_prog,
>                                   const struct gl_program *prog,
>                                   struct brw_cs_prog_data *prog_data)
>   {
> @@ -47,7 +46,7 @@ assign_cs_binding_table_offsets(const struct gen_device_info *devinfo,
>      next_binding_table_offset++;
>   
>      brw_assign_common_binding_table_offsets(MESA_SHADER_COMPUTE, devinfo,
> -                                           shader_prog, prog, &prog_data->base,
> +                                           prog, &prog_data->base,
>                                              next_binding_table_offset);
>   }
>   
> @@ -81,7 +80,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
>         prog_data.base.total_shared = cp->program.info.cs.shared_size;
>      }
>   
> -   assign_cs_binding_table_offsets(devinfo, prog, &cp->program, &prog_data);
> +   assign_cs_binding_table_offsets(devinfo, &cp->program, &prog_data);
>   
>      /* Allocate the references to the uniforms that will end up in the
>       * prog_data associated with the compiled program, and which will be freed
> diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
> index 7886737..5896726 100644
> --- a/src/mesa/drivers/dri/i965/brw_gs.c
> +++ b/src/mesa/drivers/dri/i965/brw_gs.c
> @@ -74,7 +74,6 @@ brw_gs_debug_recompile(struct brw_context *brw, struct gl_program *prog,
>   
>   static void
>   assign_gs_binding_table_offsets(const struct gen_device_info *devinfo,
> -                                const struct gl_shader_program *shader_prog,
>                                   const struct gl_program *prog,
>                                   struct brw_gs_prog_data *prog_data)
>   {
> @@ -84,8 +83,7 @@ assign_gs_binding_table_offsets(const struct gen_device_info *devinfo,
>      uint32_t reserved = devinfo->gen == 6 ? BRW_MAX_SOL_BINDINGS : 0;
>   
>      brw_assign_common_binding_table_offsets(MESA_SHADER_GEOMETRY, devinfo,
> -                                           shader_prog, prog,
> -                                           &prog_data->base.base,
> +                                           prog, &prog_data->base.base,
>                                              reserved);
>   }
>   
> @@ -104,7 +102,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
>   
>      memset(&prog_data, 0, sizeof(prog_data));
>   
> -   assign_gs_binding_table_offsets(devinfo, prog, &gp->program, &prog_data);
> +   assign_gs_binding_table_offsets(devinfo, &gp->program, &prog_data);
>   
>      /* Allocate the references to the uniforms that will end up in the
>       * prog_data associated with the compiled program, and which will be freed
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index 267f5fb..1ada15d 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
> @@ -1181,17 +1181,12 @@ backend_shader::calculate_cfg()
>   uint32_t
>   brw_assign_common_binding_table_offsets(gl_shader_stage stage,

Looks like you could even drop the stage argument here (in another patch 
possibly).
It doesn't appear to be used and you could get it from gl_program.

>                                           const struct gen_device_info *devinfo,
> -                                        const struct gl_shader_program *shader_prog,
>                                           const struct gl_program *prog,
>                                           struct brw_stage_prog_data *stage_prog_data,
>                                           uint32_t next_binding_table_offset)
>   {
> -   const struct gl_linked_shader *shader = NULL;
>      int num_textures = util_last_bit(prog->SamplersUsed);
>   
> -   if (shader_prog)
> -      shader = shader_prog->_LinkedShaders[stage];
> -
>      stage_prog_data->binding_table.texture_start = next_binding_table_offset;
>      next_binding_table_offset += num_textures;
>   
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
> index e8b34d5..bd03204 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.h
> +++ b/src/mesa/drivers/dri/i965/brw_shader.h
> @@ -258,7 +258,6 @@ struct brw_gs_compile
>   uint32_t
>   brw_assign_common_binding_table_offsets(gl_shader_stage stage,
>                                           const struct gen_device_info *devinfo,
> -                                        const struct gl_shader_program *shader_prog,
>                                           const struct gl_program *prog,
>                                           struct brw_stage_prog_data *stage_prog_data,
>                                           uint32_t next_binding_table_offset);
> diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
> index 3f8798a..0978776 100644
> --- a/src/mesa/drivers/dri/i965/brw_tcs.c
> +++ b/src/mesa/drivers/dri/i965/brw_tcs.c
> @@ -211,7 +211,7 @@ brw_codegen_tcs_prog(struct brw_context *brw,
>   
>      if (tcp) {
>         brw_assign_common_binding_table_offsets(MESA_SHADER_TESS_CTRL, devinfo,
> -                                              shader_prog, &tcp->program,
> +                                              &tcp->program,
>                                                 &prog_data.base.base, 0);
>   
>         prog_data.base.base.image_param =
> diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
> index 9adde20..520963b 100644
> --- a/src/mesa/drivers/dri/i965/brw_tes.c
> +++ b/src/mesa/drivers/dri/i965/brw_tes.c
> @@ -92,7 +92,7 @@ brw_codegen_tes_prog(struct brw_context *brw,
>      memset(&prog_data, 0, sizeof(prog_data));
>   
>      brw_assign_common_binding_table_offsets(MESA_SHADER_TESS_EVAL, devinfo,
> -                                           shader_prog, &tep->program,
> +                                           &tep->program,
>                                              &prog_data.base.base, 0);
>   
>      switch (tep->program.info.tes.spacing) {
> diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
> index 2720f82..3961375 100644
> --- a/src/mesa/drivers/dri/i965/brw_vs.c
> +++ b/src/mesa/drivers/dri/i965/brw_vs.c
> @@ -161,7 +161,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
>   
>      mem_ctx = ralloc_context(NULL);
>   
> -   brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX, devinfo, prog,
> +   brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX, devinfo,
>                                              &vp->program, &prog_data.base.base,
>                                              0);
>   
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
> index 3a800ad..674678f 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> @@ -43,7 +43,6 @@
>   
>   static void
>   assign_fs_binding_table_offsets(const struct gen_device_info *devinfo,
> -                                const struct gl_shader_program *shader_prog,
>                                   const struct gl_program *prog,
>                                   const struct brw_wm_prog_key *key,
>                                   struct brw_wm_prog_data *prog_data)
> @@ -58,7 +57,7 @@ assign_fs_binding_table_offsets(const struct gen_device_info *devinfo,
>   
>      next_binding_table_offset =
>         brw_assign_common_binding_table_offsets(MESA_SHADER_FRAGMENT, devinfo,
> -                                              shader_prog, prog, &prog_data->base,
> +                                              prog, &prog_data->base,
>                                                 next_binding_table_offset);
>   
>      if (prog->nir->info->outputs_read && !key->coherent_fb_fetch) {
> @@ -156,8 +155,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
>      if (!prog)
>         prog_data.base.use_alt_mode = true;
>   
> -   assign_fs_binding_table_offsets(devinfo, prog, &fp->program, key,
> -                                   &prog_data);
> +   assign_fs_binding_table_offsets(devinfo, &fp->program, key, &prog_data);
>   
>      /* Allocate the references to the uniforms that will end up in the
>       * prog_data associated with the compiled program, and which will be freed




More information about the mesa-dev mailing list