[Mesa-dev] [PATCH 3/4] i965: Rename do_<stage>_prog to brw_<stage>_compile

Ian Romanick idr at freedesktop.org
Fri Mar 20 19:01:35 PDT 2015


On 03/20/2015 06:15 PM, Chris Forbes wrote:
> I think that having both the existing `struct brw_vs_compile` and a
> function with the same name is going to cause confusion. (same with
> the other non-fs stages)

That's a good point... and I agree.  We should be able to come up with
reasonable names for the functions that don't conflict.

> On Sat, Mar 21, 2015 at 2:04 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 03/20/2015 06:02 PM, Ian Romanick wrote:
>>> On 03/20/2015 05:49 PM, Carl Worth wrote:
>>>> The rename here is in preparation for these functions to be exported
>>>> to other files.
>>>
>>> I think I'd wait on this until you're also going to make them
>>> non-static.  Otherwise it's just extra churn.
>>
>> Which happens in the next patch.  I'd bring that part of patch 4 into
>> this patch.  With that and tabs, this patch is
>>
>> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>>
>>> And tabs. :)
>>>
>>> One other comment below.
>>>> This commit is intended to have no functional change. It exists in
>>>> preparation for some upcoming code movement in preparation for the
>>>> shader cache.
>>>> ---
>>>>  src/mesa/drivers/dri/i965/brw_ff_gs.c |  7 ++++---
>>>>  src/mesa/drivers/dri/i965/brw_fs.cpp  |  2 +-
>>>>  src/mesa/drivers/dri/i965/brw_gs.c    | 14 +++++++-------
>>>>  src/mesa/drivers/dri/i965/brw_vs.c    | 14 +++++++-------
>>>>  src/mesa/drivers/dri/i965/brw_wm.c    | 14 ++++++++------
>>>>  src/mesa/drivers/dri/i965/brw_wm.h    |  8 ++++----
>>>>  6 files changed, 31 insertions(+), 28 deletions(-)
>>>>
>>>> diff --git a/src/mesa/drivers/dri/i965/brw_ff_gs.c b/src/mesa/drivers/dri/i965/brw_ff_gs.c
>>>> index c589171..8bc0a1c 100644
>>>> --- a/src/mesa/drivers/dri/i965/brw_ff_gs.c
>>>> +++ b/src/mesa/drivers/dri/i965/brw_ff_gs.c
>>>> @@ -45,8 +45,9 @@
>>>>
>>>>  #include "util/ralloc.h"
>>>>
>>>> -static void compile_ff_gs_prog(struct brw_context *brw,
>>>> -                               struct brw_ff_gs_prog_key *key)
>>>> +static void
>>>> +brw_ff_gs_compile(struct brw_context *brw,
>>>> +              struct brw_ff_gs_prog_key *key)
>>>>  {
>>>>     struct brw_ff_gs_compile c;
>>>>     const GLuint *program;
>>>> @@ -253,7 +254,7 @@ brw_upload_ff_gs_prog(struct brw_context *brw)
>>>>        if (!brw_search_cache(&brw->cache, BRW_CACHE_FF_GS_PROG,
>>>>                          &key, sizeof(key),
>>>>                          &brw->ff_gs.prog_offset, &brw->ff_gs.prog_data)) {
>>>> -     compile_ff_gs_prog( brw, &key );
>>>> +     brw_ff_gs_compile(brw, &key);
>>>>        }
>>>>     }
>>>>  }
>>>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>>>> index 780be80..24eb076 100644
>>>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>>>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>>>> @@ -4177,7 +4177,7 @@ brw_fs_precompile(struct gl_context *ctx,
>>>>     uint32_t old_prog_offset = brw->wm.base.prog_offset;
>>>>     struct brw_wm_prog_data *old_prog_data = brw->wm.prog_data;
>>>>
>>>> -   bool success = do_wm_prog(brw, shader_prog, bfp, &key);
>>>> +   bool success = brw_wm_compile(brw, shader_prog, bfp, &key);
>>>>
>>>>     brw->wm.base.prog_offset = old_prog_offset;
>>>>     brw->wm.prog_data = old_prog_data;
>>>> diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
>>>> index c45e217..a0da919 100644
>>>> --- a/src/mesa/drivers/dri/i965/brw_gs.c
>>>> +++ b/src/mesa/drivers/dri/i965/brw_gs.c
>>>> @@ -35,10 +35,10 @@
>>>>
>>>>
>>>>  static bool
>>>> -do_gs_prog(struct brw_context *brw,
>>>> -           struct gl_shader_program *prog,
>>>> -           struct brw_geometry_program *gp,
>>>> -           struct brw_gs_prog_key *key)
>>>> +brw_gs_compile(struct brw_context *brw,
>>>> +           struct gl_shader_program *prog,
>>>> +           struct brw_geometry_program *gp,
>>>> +           struct brw_gs_prog_key *key)
>>>>  {
>>>>     struct brw_stage_state *stage_state = &brw->gs.base;
>>>>     struct brw_gs_compile c;
>>>> @@ -363,8 +363,8 @@ brw_upload_gs_prog(struct brw_context *brw)
>>>>                           &key, sizeof(key),
>>>>                           &stage_state->prog_offset, &brw->gs.prog_data)) {
>>>>        bool success =
>>>> -         do_gs_prog(brw, ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY], gp,
>>>> -                    &key);
>>>> +         brw_gs_compile(brw, ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY],
>>>> +                    gp, &key);
>>>>        assert(success);
>>>>        (void)success;
>>>>     }
>>>> @@ -400,7 +400,7 @@ brw_gs_precompile(struct gl_context *ctx,
>>>>      */
>>>>     key.input_varyings = gp->Base.InputsRead;
>>>>
>>>> -   success = do_gs_prog(brw, shader_prog, bgp, &key);
>>>> +   success = brw_gs_compile(brw, shader_prog, bgp, &key);
>>>>
>>>>     brw->gs.base.prog_offset = old_prog_offset;
>>>>     brw->gs.prog_data = old_prog_data;
>>>> diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
>>>> index 2c76d25..e5a55a7 100644
>>>> --- a/src/mesa/drivers/dri/i965/brw_vs.c
>>>> +++ b/src/mesa/drivers/dri/i965/brw_vs.c
>>>> @@ -188,10 +188,10 @@ brw_vs_prog_data_compare(const void *in_a, const void *in_b)
>>>>  }
>>>>
>>>>  static bool
>>>> -do_vs_prog(struct brw_context *brw,
>>>> -       struct gl_shader_program *prog,
>>>> -       struct brw_vertex_program *vp,
>>>> -       struct brw_vs_prog_key *key)
>>>> +brw_vs_compile(struct brw_context *brw,
>>>> +           struct gl_shader_program *prog,
>>>> +           struct brw_vertex_program *vp,
>>>> +           struct brw_vs_prog_key *key)
>>>>  {
>>>>     GLuint program_size;
>>>>     const GLuint *program;
>>>> @@ -482,8 +482,8 @@ brw_upload_vs_prog(struct brw_context *brw)
>>>>                       &key, sizeof(key),
>>>>                       &brw->vs.base.prog_offset, &brw->vs.prog_data)) {
>>>>        bool success =
>>>> -         do_vs_prog(brw, ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX], vp,
>>>> -                    &key);
>>>> +         brw_vs_compile(brw,ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX],
>>>> +                    vp, &key);
>>>>        (void) success;
>>>>        assert(success);
>>>>     }
>>>> @@ -524,7 +524,7 @@ brw_vs_precompile(struct gl_context *ctx,
>>>>        (prog->OutputsWritten & (VARYING_BIT_COL0 | VARYING_BIT_COL1 |
>>>>                                 VARYING_BIT_BFC0 | VARYING_BIT_BFC1));
>>>>
>>>> -   success = do_vs_prog(brw, shader_prog, bvp, &key);
>>>> +   success = brw_vs_compile(brw, shader_prog, bvp, &key);
>>>>
>>>>     brw->vs.base.prog_offset = old_prog_offset;
>>>>     brw->vs.prog_data = old_prog_data;
>>>> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
>>>> index e9cb133..15cd6aa 100644
>>>> --- a/src/mesa/drivers/dri/i965/brw_wm.c
>>>> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
>>>> @@ -159,10 +159,11 @@ brw_wm_prog_data_compare(const void *in_a, const void *in_b)
>>>>   * Depending on the instructions used (i.e. flow control instructions)
>>>>   * we'll use one of two code generators.
>>>>   */
>>>> -bool do_wm_prog(struct brw_context *brw,
>>>> -            struct gl_shader_program *prog,
>>>> -            struct brw_fragment_program *fp,
>>>> -            struct brw_wm_prog_key *key)
>>>> +bool
>>>> +brw_wm_compile(struct brw_context *brw,
>>>> +           struct gl_shader_program *prog,
>>>> +           struct brw_fragment_program *fp,
>>>> +           struct brw_wm_prog_key *key)
>>>
>>> Some day can we s/wm/fs/ on the whole code base?
>>>
>>>>  {
>>>>     struct gl_context *ctx = &brw->ctx;
>>>>     void *mem_ctx = ralloc_context(NULL);
>>>> @@ -619,8 +620,9 @@ brw_upload_wm_prog(struct brw_context *brw)
>>>>     if (!brw_search_cache(&brw->cache, BRW_CACHE_FS_PROG,
>>>>                       &key, sizeof(key),
>>>>                       &brw->wm.base.prog_offset, &brw->wm.prog_data)) {
>>>> -      bool success = do_wm_prog(brw, ctx->_Shader->_CurrentFragmentProgram, fp,
>>>> -                            &key);
>>>> +      bool success =
>>>> +     brw_wm_compile(brw, ctx->_Shader->_CurrentFragmentProgram,
>>>> +                    fp, &key);
>>>>        (void) success;
>>>>        assert(success);
>>>>     }
>>>> diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
>>>> index 32d1ce3..ea7abe3 100644
>>>> --- a/src/mesa/drivers/dri/i965/brw_wm.h
>>>> +++ b/src/mesa/drivers/dri/i965/brw_wm.h
>>>> @@ -78,10 +78,10 @@ GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog
>>>>  struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
>>>>
>>>>  bool brw_color_buffer_write_enabled(struct brw_context *brw);
>>>> -bool do_wm_prog(struct brw_context *brw,
>>>> -            struct gl_shader_program *prog,
>>>> -            struct brw_fragment_program *fp,
>>>> -            struct brw_wm_prog_key *key);
>>>> +bool brw_wm_compile(struct brw_context *brw,
>>>> +                struct gl_shader_program *prog,
>>>> +                struct brw_fragment_program *fp,
>>>> +                struct brw_wm_prog_key *key);
>>>>  void brw_wm_debug_recompile(struct brw_context *brw,
>>>>                              struct gl_shader_program *prog,
>>>>                              const struct brw_wm_prog_key *key);
>>>>
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list