On Mon, Oct 23, 2017 at 5:11 PM, Jordan Justen <jordan.l.jus...@intel.com>
wrote:

> Attached is the missing change to brw_vec4_gs_visitor.cpp, which Jason
> pointed out. The issue was hiding out in a compiler warning.
>

We should be able to drop the final_program_size variable.  I think that
would be a bit more fool-proof.  Other than that, this patch (with the
attached squash-in) is

Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net>


> -Jordan
>
> On 2017-10-22 13:01:25, Jordan Justen wrote:
> > The caller can now use brw_stage_prog_data::program_size which is set
> > by the brw_compile_* functions.
> >
> > Cc: Jason Ekstrand <ja...@jlekstrand.net>
> > Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
> > ---
> >  src/intel/blorp/blorp.c             | 10 ++++------
> >  src/intel/blorp/blorp_blit.c        |  5 ++---
> >  src/intel/blorp/blorp_clear.c       | 15 ++++++---------
> >  src/intel/blorp/blorp_priv.h        |  6 ++----
> >  src/intel/compiler/brw_compiler.h   |  6 ------
> >  src/intel/compiler/brw_fs.cpp       | 10 ++--------
> >  src/intel/compiler/brw_shader.cpp   |  8 ++++----
> >  src/intel/compiler/brw_vec4.cpp     |  8 ++++----
> >  src/intel/compiler/brw_vec4_tcs.cpp |  8 ++++----
> >  src/intel/vulkan/anv_pipeline.c     | 23 ++++++++++++-----------
> >  src/mesa/drivers/dri/i965/brw_cs.c  |  5 ++---
> >  src/mesa/drivers/dri/i965/brw_gs.c  |  5 ++---
> >  src/mesa/drivers/dri/i965/brw_tcs.c |  5 ++---
> >  src/mesa/drivers/dri/i965/brw_tes.c |  5 ++---
> >  src/mesa/drivers/dri/i965/brw_vs.c  | 11 +++++------
> >  src/mesa/drivers/dri/i965/brw_wm.c  |  5 ++---
> >  16 files changed, 55 insertions(+), 80 deletions(-)
> >
> > diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c
> > index 7cc6335f2f6..5faba75b8db 100644
> > --- a/src/intel/blorp/blorp.c
> > +++ b/src/intel/blorp/blorp.c
> > @@ -162,8 +162,7 @@ blorp_compile_fs(struct blorp_context *blorp, void
> *mem_ctx,
> >                   struct nir_shader *nir,
> >                   struct brw_wm_prog_key *wm_key,
> >                   bool use_repclear,
> > -                 struct brw_wm_prog_data *wm_prog_data,
> > -                 unsigned *program_size)
> > +                 struct brw_wm_prog_data *wm_prog_data)
> >  {
> >     const struct brw_compiler *compiler = blorp->compiler;
> >
> > @@ -194,7 +193,7 @@ blorp_compile_fs(struct blorp_context *blorp, void
> *mem_ctx,
> >     const unsigned *program =
> >        brw_compile_fs(compiler, blorp->driver_ctx, mem_ctx, wm_key,
> >                       wm_prog_data, nir, NULL, -1, -1, false,
> use_repclear,
> > -                     NULL, program_size, NULL);
> > +                     NULL, NULL);
> >
> >     return program;
> >  }
> > @@ -202,8 +201,7 @@ blorp_compile_fs(struct blorp_context *blorp, void
> *mem_ctx,
> >  const unsigned *
> >  blorp_compile_vs(struct blorp_context *blorp, void *mem_ctx,
> >                   struct nir_shader *nir,
> > -                 struct brw_vs_prog_data *vs_prog_data,
> > -                 unsigned *program_size)
> > +                 struct brw_vs_prog_data *vs_prog_data)
> >  {
> >     const struct brw_compiler *compiler = blorp->compiler;
> >
> > @@ -225,7 +223,7 @@ blorp_compile_vs(struct blorp_context *blorp, void
> *mem_ctx,
> >     const unsigned *program =
> >        brw_compile_vs(compiler, blorp->driver_ctx, mem_ctx,
> >                       &vs_key, vs_prog_data, nir,
> > -                     false, -1, program_size, NULL);
> > +                     false, -1, NULL);
> >
> >     return program;
> >  }
> > diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
> > index 4507046dae5..9b5c1f1f8c1 100644
> > --- a/src/intel/blorp/blorp_blit.c
> > +++ b/src/intel/blorp/blorp_blit.c
> > @@ -1308,7 +1308,6 @@ brw_blorp_get_blit_kernel(struct blorp_context
> *blorp,
> >     void *mem_ctx = ralloc_context(NULL);
> >
> >     const unsigned *program;
> > -   unsigned program_size;
> >     struct brw_wm_prog_data prog_data;
> >
> >     nir_shader *nir = brw_blorp_build_nir_shader(blorp, mem_ctx,
> prog_key);
> > @@ -1322,11 +1321,11 @@ brw_blorp_get_blit_kernel(struct blorp_context
> *blorp,
> >     wm_key.multisample_fbo = prog_key->rt_samples > 1;
> >
> >     program = blorp_compile_fs(blorp, mem_ctx, nir, &wm_key, false,
> > -                              &prog_data, &program_size);
> > +                              &prog_data);
> >
> >     bool result =
> >        blorp->upload_shader(blorp, prog_key, sizeof(*prog_key),
> > -                           program, program_size,
> > +                           program, prog_data.base.program_size,
> >                             &prog_data.base, sizeof(prog_data),
> >                             &params->wm_prog_kernel,
> &params->wm_prog_data);
> >
> > diff --git a/src/intel/blorp/blorp_clear.c
> b/src/intel/blorp/blorp_clear.c
> > index cd83fa13caf..8d758df155f 100644
> > --- a/src/intel/blorp/blorp_clear.c
> > +++ b/src/intel/blorp/blorp_clear.c
> > @@ -75,14 +75,13 @@ blorp_params_get_clear_kernel(struct blorp_context
> *blorp,
> >     brw_blorp_init_wm_prog_key(&wm_key);
> >
> >     struct brw_wm_prog_data prog_data;
> > -   unsigned program_size;
> >     const unsigned *program =
> >        blorp_compile_fs(blorp, mem_ctx, b.shader, &wm_key,
> use_replicated_data,
> > -                       &prog_data, &program_size);
> > +                       &prog_data);
> >
> >     bool result =
> >        blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key),
> > -                           program, program_size,
> > +                           program, prog_data.base.program_size,
> >                             &prog_data.base, sizeof(prog_data),
> >                             &params->wm_prog_kernel,
> &params->wm_prog_data);
> >
> > @@ -167,13 +166,12 @@ blorp_params_get_layer_offset_vs(struct
> blorp_context *blorp,
> >     struct brw_vs_prog_data vs_prog_data;
> >     memset(&vs_prog_data, 0, sizeof(vs_prog_data));
> >
> > -   unsigned program_size;
> >     const unsigned *program =
> > -      blorp_compile_vs(blorp, mem_ctx, b.shader, &vs_prog_data,
> &program_size);
> > +      blorp_compile_vs(blorp, mem_ctx, b.shader, &vs_prog_data);
> >
> >     bool result =
> >        blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key),
> > -                           program, program_size,
> > +                           program, vs_prog_data.base.base.
> program_size,
> >                             &vs_prog_data.base.base,
> sizeof(vs_prog_data),
> >                             &params->vs_prog_kernel,
> &params->vs_prog_data);
> >
> > @@ -864,14 +862,13 @@ blorp_params_get_mcs_partial_resolve_kernel(struct
> blorp_context *blorp,
> >     wm_key.multisample_fbo = true;
> >
> >     struct brw_wm_prog_data prog_data;
> > -   unsigned program_size;
> >     const unsigned *program =
> >        blorp_compile_fs(blorp, mem_ctx, b.shader, &wm_key, false,
> > -                       &prog_data, &program_size);
> > +                       &prog_data);
> >
> >     bool result =
> >        blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key),
> > -                           program, program_size,
> > +                           program, prog_data.base.program_size,
> >                             &prog_data.base, sizeof(prog_data),
> >                             &params->wm_prog_kernel,
> &params->wm_prog_data);
> >
> > diff --git a/src/intel/blorp/blorp_priv.h b/src/intel/blorp/blorp_priv.h
> > index c7d5d308da7..d91e436c1c5 100644
> > --- a/src/intel/blorp/blorp_priv.h
> > +++ b/src/intel/blorp/blorp_priv.h
> > @@ -342,14 +342,12 @@ blorp_compile_fs(struct blorp_context *blorp, void
> *mem_ctx,
> >                   struct nir_shader *nir,
> >                   struct brw_wm_prog_key *wm_key,
> >                   bool use_repclear,
> > -                 struct brw_wm_prog_data *wm_prog_data,
> > -                 unsigned *program_size);
> > +                 struct brw_wm_prog_data *wm_prog_data);
> >
> >  const unsigned *
> >  blorp_compile_vs(struct blorp_context *blorp, void *mem_ctx,
> >                   struct nir_shader *nir,
> > -                 struct brw_vs_prog_data *vs_prog_data,
> > -                 unsigned *program_size);
> > +                 struct brw_vs_prog_data *vs_prog_data);
> >
> >  bool
> >  blorp_ensure_sf_program(struct blorp_context *blorp,
> > diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_
> compiler.h
> > index b57834ddaa3..701b4a80bf1 100644
> > --- a/src/intel/compiler/brw_compiler.h
> > +++ b/src/intel/compiler/brw_compiler.h
> > @@ -1102,7 +1102,6 @@ brw_compile_vs(const struct brw_compiler
> *compiler, void *log_data,
> >                 const struct nir_shader *shader,
> >                 bool use_legacy_snorm_formula,
> >                 int shader_time_index,
> > -               unsigned *final_assembly_size,
> >                 char **error_str);
> >
> >  /**
> > @@ -1118,7 +1117,6 @@ brw_compile_tcs(const struct brw_compiler
> *compiler,
> >                  struct brw_tcs_prog_data *prog_data,
> >                  const struct nir_shader *nir,
> >                  int shader_time_index,
> > -                unsigned *final_assembly_size,
> >                  char **error_str);
> >
> >  /**
> > @@ -1135,7 +1133,6 @@ brw_compile_tes(const struct brw_compiler
> *compiler, void *log_data,
> >                  const struct nir_shader *shader,
> >                  struct gl_program *prog,
> >                  int shader_time_index,
> > -                unsigned *final_assembly_size,
> >                  char **error_str);
> >
> >  /**
> > @@ -1151,7 +1148,6 @@ brw_compile_gs(const struct brw_compiler
> *compiler, void *log_data,
> >                 const struct nir_shader *shader,
> >                 struct gl_program *prog,
> >                 int shader_time_index,
> > -               unsigned *final_assembly_size,
> >                 char **error_str);
> >
> >  /**
> > @@ -1202,7 +1198,6 @@ brw_compile_fs(const struct brw_compiler
> *compiler, void *log_data,
> >                 int shader_time_index16,
> >                 bool allow_spilling,
> >                 bool use_rep_send, struct brw_vue_map *vue_map,
> > -               unsigned *final_assembly_size,
> >                 char **error_str);
> >
> >  /**
> > @@ -1217,7 +1212,6 @@ brw_compile_cs(const struct brw_compiler
> *compiler, void *log_data,
> >                 struct brw_cs_prog_data *prog_data,
> >                 const struct nir_shader *shader,
> >                 int shader_time_index,
> > -               unsigned *final_assembly_size,
> >                 char **error_str);
> >
> >  static inline uint32_t
> > diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.
> cpp
> > index bb6955e667e..c1cf48697f0 100644
> > --- a/src/intel/compiler/brw_fs.cpp
> > +++ b/src/intel/compiler/brw_fs.cpp
> > @@ -6511,7 +6511,6 @@ brw_compile_fs(const struct brw_compiler
> *compiler, void *log_data,
> >                 int shader_time_index8, int shader_time_index16,
> >                 bool allow_spilling,
> >                 bool use_rep_send, struct brw_vue_map *vue_map,
> > -               unsigned *final_assembly_size,
> >                 char **error_str)
> >  {
> >     const struct gen_device_info *devinfo = compiler->devinfo;
> > @@ -6660,9 +6659,7 @@ brw_compile_fs(const struct brw_compiler
> *compiler, void *log_data,
> >        prog_data->reg_blocks_0 = brw_register_blocks(simd16_grf_used);
> >     }
> >
> > -   const unsigned *assembly = g.get_assembly(final_assembly_size);
> > -   prog_data->base.program_size = *final_assembly_size;
> > -   return assembly;
> > +   return g.get_assembly(&prog_data->base.program_size);
> >  }
> >
> >  fs_reg *
> > @@ -6749,7 +6746,6 @@ brw_compile_cs(const struct brw_compiler
> *compiler, void *log_data,
> >                 struct brw_cs_prog_data *prog_data,
> >                 const nir_shader *src_shader,
> >                 int shader_time_index,
> > -               unsigned *final_assembly_size,
> >                 char **error_str)
> >  {
> >     nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
> > @@ -6861,9 +6857,7 @@ brw_compile_cs(const struct brw_compiler
> *compiler, void *log_data,
> >
> >     g.generate_code(cfg, prog_data->simd_size);
> >
> > -   const unsigned *assembly = g.get_assembly(final_assembly_size);
> > -   prog_data->base.program_size = *final_assembly_size;
> > -   return assembly;
> > +   return g.get_assembly(&prog_data->base.program_size);
> >  }
> >
> >  /**
> > diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_
> shader.cpp
> > index 943dcd59cc1..790c5e70a16 100644
> > --- a/src/intel/compiler/brw_shader.cpp
> > +++ b/src/intel/compiler/brw_shader.cpp
> > @@ -1161,7 +1161,6 @@ brw_compile_tes(const struct brw_compiler
> *compiler,
> >                  const nir_shader *src_shader,
> >                  struct gl_program *prog,
> >                  int shader_time_index,
> > -                unsigned *final_assembly_size,
> >                  char **error_str)
> >  {
> >     const struct gen_device_info *devinfo = compiler->devinfo;
> > @@ -1249,6 +1248,7 @@ brw_compile_tes(const struct brw_compiler
> *compiler,
> >        brw_print_vue_map(stderr, &prog_data->base.vue_map);
> >     }
> >
> > +   unsigned final_assembly_size;
> >     if (is_scalar) {
> >        fs_visitor v(compiler, log_data, mem_ctx, (void *) key,
> >                     &prog_data->base.base, NULL, nir, 8,
> > @@ -1275,7 +1275,7 @@ brw_compile_tes(const struct brw_compiler
> *compiler,
> >
> >        g.generate_code(v.cfg, 8);
> >
> > -      assembly = g.get_assembly(final_assembly_size);
> > +      assembly = g.get_assembly(&final_assembly_size);
> >     } else {
> >        brw::vec4_tes_visitor v(compiler, log_data, key, prog_data,
> >                               nir, mem_ctx, shader_time_index);
> > @@ -1290,9 +1290,9 @@ brw_compile_tes(const struct brw_compiler
> *compiler,
> >
> >        assembly = brw_vec4_generate_assembly(compiler, log_data,
> mem_ctx, nir,
> >                                              &prog_data->base, v.cfg,
> > -                                            final_assembly_size);
> > +                                            &final_assembly_size);
> >     }
> >
> > -   prog_data->base.base.program_size = *final_assembly_size;
> > +   prog_data->base.base.program_size = final_assembly_size;
> >     return assembly;
> >  }
> > diff --git a/src/intel/compiler/brw_vec4.cpp
> b/src/intel/compiler/brw_vec4.cpp
> > index b7af8860e8f..b8db3ced0fe 100644
> > --- a/src/intel/compiler/brw_vec4.cpp
> > +++ b/src/intel/compiler/brw_vec4.cpp
> > @@ -2741,7 +2741,6 @@ brw_compile_vs(const struct brw_compiler
> *compiler, void *log_data,
> >                 const nir_shader *src_shader,
> >                 bool use_legacy_snorm_formula,
> >                 int shader_time_index,
> > -               unsigned *final_assembly_size,
> >                 char **error_str)
> >  {
> >     const bool is_scalar = compiler->scalar_stage[MESA_SHADER_VERTEX];
> > @@ -2856,6 +2855,7 @@ brw_compile_vs(const struct brw_compiler
> *compiler, void *log_data,
> >        brw_print_vue_map(stderr, &prog_data->base.vue_map);
> >     }
> >
> > +   unsigned final_assembly_size;
> >     if (is_scalar) {
> >        prog_data->base.dispatch_mode = DISPATCH_MODE_SIMD8;
> >
> > @@ -2884,7 +2884,7 @@ brw_compile_vs(const struct brw_compiler
> *compiler, void *log_data,
> >           g.enable_debug(debug_name);
> >        }
> >        g.generate_code(v.cfg, 8);
> > -      assembly = g.get_assembly(final_assembly_size);
> > +      assembly = g.get_assembly(&final_assembly_size);
> >     }
> >
> >     if (!assembly) {
> > @@ -2902,10 +2902,10 @@ brw_compile_vs(const struct brw_compiler
> *compiler, void *log_data,
> >
> >        assembly = brw_vec4_generate_assembly(compiler, log_data,
> mem_ctx,
> >                                              shader, &prog_data->base,
> v.cfg,
> > -                                            final_assembly_size);
> > +                                            &final_assembly_size);
> >     }
> >
> > -   prog_data->base.base.program_size = *final_assembly_size;
> > +   prog_data->base.base.program_size = final_assembly_size;
> >     return assembly;
> >  }
> >
> > diff --git a/src/intel/compiler/brw_vec4_tcs.cpp
> b/src/intel/compiler/brw_vec4_tcs.cpp
> > index 04feb6bdf17..17c52bd0993 100644
> > --- a/src/intel/compiler/brw_vec4_tcs.cpp
> > +++ b/src/intel/compiler/brw_vec4_tcs.cpp
> > @@ -382,7 +382,6 @@ brw_compile_tcs(const struct brw_compiler *compiler,
> >                  struct brw_tcs_prog_data *prog_data,
> >                  const nir_shader *src_shader,
> >                  int shader_time_index,
> > -                unsigned *final_assembly_size,
> >                  char **error_str)
> >  {
> >     const struct gen_device_info *devinfo = compiler->devinfo;
> > @@ -462,6 +461,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,
> >        brw_print_vue_map(stderr, &vue_prog_data->vue_map);
> >     }
> >
> > +   unsigned final_assembly_size;
> >     if (is_scalar) {
> >        fs_visitor v(compiler, log_data, mem_ctx, (void *) key,
> >                     &prog_data->base.base, NULL, nir, 8,
> > @@ -488,7 +488,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,
> >
> >        g.generate_code(v.cfg, 8);
> >
> > -      assembly = g.get_assembly(final_assembly_size);
> > +      assembly = g.get_assembly(&final_assembly_size);
> >     } else {
> >        vec4_tcs_visitor v(compiler, log_data, key, prog_data,
> >                           nir, mem_ctx, shader_time_index,
> &input_vue_map);
> > @@ -504,10 +504,10 @@ brw_compile_tcs(const struct brw_compiler
> *compiler,
> >
> >        assembly = brw_vec4_generate_assembly(compiler, log_data,
> mem_ctx, nir,
> >                                              &prog_data->base, v.cfg,
> > -                                            final_assembly_size);
> > +                                            &final_assembly_size);
> >     }
> >
> > -   prog_data->base.base.program_size = *final_assembly_size;
> > +   prog_data->base.base.program_size = final_assembly_size;
> >     return assembly;
> >  }
> >
> > diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_
> pipeline.c
> > index 51788928af8..6c320651416 100644
> > --- a/src/intel/vulkan/anv_pipeline.c
> > +++ b/src/intel/vulkan/anv_pipeline.c
> > @@ -523,15 +523,15 @@ anv_pipeline_compile_vs(struct anv_pipeline
> *pipeline,
> >                            nir->info.outputs_written,
> >                            nir->info.separate_shader);
> >
> > -      unsigned code_size;
> >        const unsigned *shader_code =
> >           brw_compile_vs(compiler, NULL, mem_ctx, &key, &prog_data, nir,
> > -                        false, -1, &code_size, NULL);
> > +                        false, -1, NULL);
> >        if (shader_code == NULL) {
> >           ralloc_free(mem_ctx);
> >           return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> >        }
> >
> > +      unsigned code_size = prog_data.base.base.program_size;
> >        bin = anv_pipeline_upload_kernel(pipeline, cache, sha1, 20,
> >                                         shader_code, code_size,
> >                                         &prog_data.base.base,
> sizeof(prog_data),
> > @@ -682,18 +682,18 @@ anv_pipeline_compile_tcs_tes(struct anv_pipeline
> *pipeline,
> >        tes_key.inputs_read = tcs_key.outputs_written;
> >        tes_key.patch_inputs_read = tcs_key.patch_outputs_written;
> >
> > -      unsigned code_size;
> >        const int shader_time_index = -1;
> >        const unsigned *shader_code;
> >
> >        shader_code =
> >           brw_compile_tcs(compiler, NULL, mem_ctx, &tcs_key,
> &tcs_prog_data,
> > -                         tcs_nir, shader_time_index, &code_size, NULL);
> > +                         tcs_nir, shader_time_index, NULL);
> >        if (shader_code == NULL) {
> >           ralloc_free(mem_ctx);
> >           return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> >        }
> >
> > +      unsigned code_size = tcs_prog_data.base.base.program_size;
> >        tcs_bin = anv_pipeline_upload_kernel(pipeline, cache,
> >                                             tcs_sha1, sizeof(tcs_sha1),
> >                                             shader_code, code_size,
> > @@ -708,12 +708,13 @@ anv_pipeline_compile_tcs_tes(struct anv_pipeline
> *pipeline,
> >        shader_code =
> >           brw_compile_tes(compiler, NULL, mem_ctx, &tes_key,
> >                           &tcs_prog_data.base.vue_map, &tes_prog_data,
> tes_nir,
> > -                         NULL, shader_time_index, &code_size, NULL);
> > +                         NULL, shader_time_index, NULL);
> >        if (shader_code == NULL) {
> >           ralloc_free(mem_ctx);
> >           return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> >        }
> >
> > +      code_size = tes_prog_data.base.base.program_size;
> >        tes_bin = anv_pipeline_upload_kernel(pipeline, cache,
> >                                             tes_sha1, sizeof(tes_sha1),
> >                                             shader_code, code_size,
> > @@ -785,16 +786,16 @@ anv_pipeline_compile_gs(struct anv_pipeline
> *pipeline,
> >                            nir->info.outputs_written,
> >                            nir->info.separate_shader);
> >
> > -      unsigned code_size;
> >        const unsigned *shader_code =
> >           brw_compile_gs(compiler, NULL, mem_ctx, &key, &prog_data, nir,
> > -                        NULL, -1, &code_size, NULL);
> > +                        NULL, -1, NULL);
> >        if (shader_code == NULL) {
> >           ralloc_free(mem_ctx);
> >           return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> >        }
> >
> >        /* TODO: SIMD8 GS */
> > +      const unsigned code_size = prog_data.base.base.program_size;
> >        bin = anv_pipeline_upload_kernel(pipeline, cache, sha1, 20,
> >                                         shader_code, code_size,
> >                                         &prog_data.base.base,
> sizeof(prog_data),
> > @@ -909,15 +910,15 @@ anv_pipeline_compile_fs(struct anv_pipeline
> *pipeline,
> >
> >        anv_fill_binding_table(&prog_data.base, num_rts);
> >
> > -      unsigned code_size;
> >        const unsigned *shader_code =
> >           brw_compile_fs(compiler, NULL, mem_ctx, &key, &prog_data, nir,
> > -                        NULL, -1, -1, true, false, NULL, &code_size,
> NULL);
> > +                        NULL, -1, -1, true, false, NULL, NULL);
> >        if (shader_code == NULL) {
> >           ralloc_free(mem_ctx);
> >           return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> >        }
> >
> > +      unsigned code_size = prog_data.base.program_size;
> >        bin = anv_pipeline_upload_kernel(pipeline, cache, sha1, 20,
> >                                         shader_code, code_size,
> >                                         &prog_data.base,
> sizeof(prog_data),
> > @@ -981,15 +982,15 @@ anv_pipeline_compile_cs(struct anv_pipeline
> *pipeline,
> >
> >        anv_fill_binding_table(&prog_data.base, 1);
> >
> > -      unsigned code_size;
> >        const unsigned *shader_code =
> >           brw_compile_cs(compiler, NULL, mem_ctx, &key, &prog_data, nir,
> > -                        -1, &code_size, NULL);
> > +                        -1, NULL);
> >        if (shader_code == NULL) {
> >           ralloc_free(mem_ctx);
> >           return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> >        }
> >
> > +      const unsigned code_size = prog_data.base.program_size;
> >        bin = anv_pipeline_upload_kernel(pipeline, cache, sha1, 20,
> >                                         shader_code, code_size,
> >                                         &prog_data.base,
> sizeof(prog_data),
> > diff --git a/src/mesa/drivers/dri/i965/brw_cs.c
> b/src/mesa/drivers/dri/i965/brw_cs.c
> > index be7680def7c..1a0e9f62c63 100644
> > --- a/src/mesa/drivers/dri/i965/brw_cs.c
> > +++ b/src/mesa/drivers/dri/i965/brw_cs.c
> > @@ -55,7 +55,6 @@ brw_codegen_cs_prog(struct brw_context *brw,
> >     const struct gen_device_info *devinfo = &brw->screen->devinfo;
> >     const GLuint *program;
> >     void *mem_ctx = ralloc_context(NULL);
> > -   GLuint program_size;
> >     struct brw_cs_prog_data prog_data;
> >     bool start_busy = false;
> >     double start_time = 0;
> > @@ -93,7 +92,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
> >     char *error_str;
> >     program = brw_compile_cs(brw->screen->compiler, brw, mem_ctx, key,
> >                              &prog_data, cp->program.nir, st_index,
> > -                            &program_size, &error_str);
> > +                            &error_str);
> >     if (program == NULL) {
> >        cp->program.sh.data->LinkStatus = linking_failure;
> >        ralloc_strcat(&cp->program.sh.data->InfoLog, error_str);
> > @@ -144,7 +143,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
> >     ralloc_steal(NULL, prog_data.base.pull_param);
> >     brw_upload_cache(&brw->cache, BRW_CACHE_CS_PROG,
> >                      key, sizeof(*key),
> > -                    program, program_size,
> > +                    program, prog_data.base.program_size,
> >                      &prog_data, sizeof(prog_data),
> >                      &brw->cs.base.prog_offset, &brw->cs.base.prog_data);
> >     ralloc_free(mem_ctx);
> > diff --git a/src/mesa/drivers/dri/i965/brw_gs.c
> b/src/mesa/drivers/dri/i965/brw_gs.c
> > index 007629cbbbe..e6e757ce686 100644
> > --- a/src/mesa/drivers/dri/i965/brw_gs.c
> > +++ b/src/mesa/drivers/dri/i965/brw_gs.c
> > @@ -112,12 +112,11 @@ brw_codegen_gs_prog(struct brw_context *brw,
> >        start_time = get_time();
> >     }
> >
> > -   unsigned program_size;
> >     char *error_str;
> >     const unsigned *program =
> >        brw_compile_gs(brw->screen->compiler, brw, mem_ctx, key,
> >                       &prog_data, gp->program.nir, &gp->program,
> > -                     st_index, &program_size, &error_str);
> > +                     st_index, &error_str);
> >     if (program == NULL) {
> >        ralloc_strcat(&gp->program.sh.data->InfoLog, error_str);
> >        _mesa_problem(NULL, "Failed to compile geometry shader: %s\n",
> error_str);
> > @@ -147,7 +146,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
> >     ralloc_steal(NULL, prog_data.base.base.pull_param);
> >     brw_upload_cache(&brw->cache, BRW_CACHE_GS_PROG,
> >                      key, sizeof(*key),
> > -                    program, program_size,
> > +                    program, prog_data.base.base.program_size,
> >                      &prog_data, sizeof(prog_data),
> >                      &stage_state->prog_offset, &brw->gs.base.prog_data);
> >     ralloc_free(mem_ctx);
> > diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c
> b/src/mesa/drivers/dri/i965/brw_tcs.c
> > index 6c9cb153d31..5ac728ee68f 100644
> > --- a/src/mesa/drivers/dri/i965/brw_tcs.c
> > +++ b/src/mesa/drivers/dri/i965/brw_tcs.c
> > @@ -226,11 +226,10 @@ brw_codegen_tcs_prog(struct brw_context *brw,
> struct brw_program *tcp,
> >        start_time = get_time();
> >     }
> >
> > -   unsigned program_size;
> >     char *error_str;
> >     const unsigned *program =
> >        brw_compile_tcs(compiler, brw, mem_ctx, key, &prog_data, nir,
> st_index,
> > -                      &program_size, &error_str);
> > +                      &error_str);
> >     if (program == NULL) {
> >        if (tep) {
> >           tep->program.sh.data->LinkStatus = linking_failure;
> > @@ -268,7 +267,7 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct
> brw_program *tcp,
> >     ralloc_steal(NULL, prog_data.base.base.pull_param);
> >     brw_upload_cache(&brw->cache, BRW_CACHE_TCS_PROG,
> >                      key, sizeof(*key),
> > -                    program, program_size,
> > +                    program, prog_data.base.base.program_size,
> >                      &prog_data, sizeof(prog_data),
> >                      &stage_state->prog_offset,
> &brw->tcs.base.prog_data);
> >     ralloc_free(mem_ctx);
> > diff --git a/src/mesa/drivers/dri/i965/brw_tes.c
> b/src/mesa/drivers/dri/i965/brw_tes.c
> > index 47f3b510a54..21f44ae74af 100644
> > --- a/src/mesa/drivers/dri/i965/brw_tes.c
> > +++ b/src/mesa/drivers/dri/i965/brw_tes.c
> > @@ -101,11 +101,10 @@ brw_codegen_tes_prog(struct brw_context *brw,
> >     brw_compute_tess_vue_map(&input_vue_map, key->inputs_read,
> >                              key->patch_inputs_read);
> >
> > -   unsigned program_size;
> >     char *error_str;
> >     const unsigned *program =
> >        brw_compile_tes(compiler, brw, mem_ctx, key, &input_vue_map,
> &prog_data,
> > -                      nir, &tep->program, st_index, &program_size,
> &error_str);
> > +                      nir, &tep->program, st_index, &error_str);
> >     if (program == NULL) {
> >        tep->program.sh.data->LinkStatus = linking_failure;
> >        ralloc_strcat(&tep->program.sh.data->InfoLog, error_str);
> > @@ -138,7 +137,7 @@ brw_codegen_tes_prog(struct brw_context *brw,
> >     ralloc_steal(NULL, prog_data.base.base.pull_param);
> >     brw_upload_cache(&brw->cache, BRW_CACHE_TES_PROG,
> >                      key, sizeof(*key),
> > -                    program, program_size,
> > +                    program, prog_data.base.base.program_size,
> >                      &prog_data, sizeof(prog_data),
> >                      &stage_state->prog_offset,
> &brw->tes.base.prog_data);
> >     ralloc_free(mem_ctx);
> > diff --git a/src/mesa/drivers/dri/i965/brw_vs.c
> b/src/mesa/drivers/dri/i965/brw_vs.c
> > index fb5ea4e7ed1..d308bb83332 100644
> > --- a/src/mesa/drivers/dri/i965/brw_vs.c
> > +++ b/src/mesa/drivers/dri/i965/brw_vs.c
> > @@ -159,7 +159,6 @@ brw_codegen_vs_prog(struct brw_context *brw,
> >  {
> >     const struct brw_compiler *compiler = brw->screen->compiler;
> >     const struct gen_device_info *devinfo = &brw->screen->devinfo;
> > -   GLuint program_size;
> >     const GLuint *program;
> >     struct brw_vs_prog_data prog_data;
> >     struct brw_stage_prog_data *stage_prog_data = &prog_data.base.base;
> > @@ -223,7 +222,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
> >     program = brw_compile_vs(compiler, brw, mem_ctx, key, &prog_data,
> >                              vp->program.nir,
> >                              !_mesa_is_gles3(&brw->ctx),
> > -                            st_index, &program_size, &error_str);
> > +                            st_index, &error_str);
> >     if (program == NULL) {
> >        if (!vp->program.is_arb_asm) {
> >           vp->program.sh.data->LinkStatus = linking_failure;
> > @@ -256,10 +255,10 @@ brw_codegen_vs_prog(struct brw_context *brw,
> >     ralloc_steal(NULL, prog_data.base.base.param);
> >     ralloc_steal(NULL, prog_data.base.base.pull_param);
> >     brw_upload_cache(&brw->cache, BRW_CACHE_VS_PROG,
> > -                   key, sizeof(struct brw_vs_prog_key),
> > -                   program, program_size,
> > -                   &prog_data, sizeof(prog_data),
> > -                   &brw->vs.base.prog_offset, &brw->vs.base.prog_data);
> > +                    key, sizeof(struct brw_vs_prog_key),
> > +                    program, prog_data.base.base.program_size,
> > +                    &prog_data, sizeof(prog_data),
> > +                    &brw->vs.base.prog_offset, &brw->vs.base.prog_data);
> >     ralloc_free(mem_ctx);
> >
> >     return true;
> > diff --git a/src/mesa/drivers/dri/i965/brw_wm.c
> b/src/mesa/drivers/dri/i965/brw_wm.c
> > index e511f0f70ba..601de18b041 100644
> > --- a/src/mesa/drivers/dri/i965/brw_wm.c
> > +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> > @@ -132,7 +132,6 @@ brw_codegen_wm_prog(struct brw_context *brw,
> >     void *mem_ctx = ralloc_context(NULL);
> >     struct brw_wm_prog_data prog_data;
> >     const GLuint *program;
> > -   GLuint program_size;
> >     bool start_busy = false;
> >     double start_time = 0;
> >
> > @@ -176,7 +175,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
> >                              key, &prog_data, fp->program.nir,
> >                              &fp->program, st_index8, st_index16,
> >                              true, false, vue_map,
> > -                            &program_size, &error_str);
> > +                            &error_str);
> >
> >     if (program == NULL) {
> >        if (!fp->program.is_arb_asm) {
> > @@ -213,7 +212,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
> >     ralloc_steal(NULL, prog_data.base.pull_param);
> >     brw_upload_cache(&brw->cache, BRW_CACHE_FS_PROG,
> >                      key, sizeof(struct brw_wm_prog_key),
> > -                    program, program_size,
> > +                    program, prog_data.base.program_size,
> >                      &prog_data, sizeof(prog_data),
> >                      &brw->wm.base.prog_offset, &brw->wm.base.prog_data);
> >
> > --
> > 2.15.0.rc0
> >
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to