<p dir="ltr"><br>
On May 12, 2015 5:56 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> For scalar GS support, we either need to add a third constructor which<br>
> takes the GS structures, or combine the existing two and pass the shader<br>
> stage.<br>
><br>
> Given that they're not significantly different, I opted for the latter.<br>
><br>
> Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_cs.cpp         |  6 ++-<br>
>  src/mesa/drivers/dri/i965/brw_fs.cpp         |  6 ++-<br>
>  src/mesa/drivers/dri/i965/brw_fs.h           | 15 ++------<br>
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 55 +++-------------------------<br>
>  src/mesa/drivers/dri/i965/brw_vec4.cpp       |  3 +-<br>
>  5 files changed, 20 insertions(+), 65 deletions(-)<br>
><br>
> I decided to go ahead and send this out now, as I've had a bunch of rebase<br>
> conflicts from it.  Thoughts?<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_cs.cpp b/src/mesa/drivers/dri/i965/brw_cs.cpp<br>
> index fc2d857..1f2a9d2 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_cs.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_cs.cpp<br>
> @@ -90,7 +90,8 @@ brw_cs_emit(struct brw_context *brw,<br>
><br>
>     /* Now the main event: Visit the shader IR and generate our CS IR for it.<br>
>      */<br>
> -   fs_visitor v8(brw, mem_ctx, key, prog_data, prog, cp, 8);<br>
> +   fs_visitor v8(brw, mem_ctx, MESA_SHADER_COMPUTE, key, &prog_data->base, prog,<br>
> +                 &cp->Base, 8);<br>
>     if (!v8.run_cs()) {<br>
>        fail_msg = v8.fail_msg;<br>
>     } else if (local_workgroup_size <= 8 * brw->max_cs_threads) {<br>
> @@ -98,7 +99,8 @@ brw_cs_emit(struct brw_context *brw,<br>
>        prog_data->simd_size = 8;<br>
>     }<br>
><br>
> -   fs_visitor v16(brw, mem_ctx, key, prog_data, prog, cp, 16);<br>
> +   fs_visitor v16(brw, mem_ctx, MESA_SHADER_COMPUTE, key, &prog_data->base, prog,<br>
> +                  &cp->Base, 16);<br>
>     if (likely(!(INTEL_DEBUG & DEBUG_NO16)) &&<br>
>         !fail_msg && !v8.simd16_unsupported &&<br>
>         local_workgroup_size <= 16 * brw->max_cs_threads) {<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> index 08664cf..b63ca23 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> @@ -4303,7 +4303,8 @@ brw_wm_fs_emit(struct brw_context *brw,<br>
><br>
>     /* Now the main event: Visit the shader IR and generate our FS IR for it.<br>
>      */<br>
> -   fs_visitor v(brw, mem_ctx, key, prog_data, prog, fp, 8);<br>
> +   fs_visitor v(brw, mem_ctx, MESA_SHADER_FRAGMENT, key, &prog_data->base,<br>
> +                prog, &fp->Base, 8);<br>
>     if (!v.run_fs()) {<br>
>        if (prog) {<br>
>           prog->LinkStatus = false;<br>
> @@ -4317,7 +4318,8 @@ brw_wm_fs_emit(struct brw_context *brw,<br>
>     }<br>
><br>
>     cfg_t *simd16_cfg = NULL;<br>
> -   fs_visitor v2(brw, mem_ctx, key, prog_data, prog, fp, 16);<br>
> +   fs_visitor v2(brw, mem_ctx, MESA_SHADER_FRAGMENT, key, &prog_data->base,<br>
> +                 prog, &fp->Base, 16);<br>
>     if (likely(!(INTEL_DEBUG & DEBUG_NO16) || brw->use_rep_send)) {<br>
>        if (!v.simd16_unsupported) {<br>
>           /* Try a SIMD16 compile */<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h<br>
> index 1d7de2e..e48c748 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs.h<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h<br>
> @@ -75,18 +75,11 @@ public:<br>
><br>
>     fs_visitor(struct brw_context *brw,<br>
>                void *mem_ctx,<br>
> -              const struct brw_wm_prog_key *key,<br>
> -              struct brw_wm_prog_data *prog_data,<br>
> +              gl_shader_stage stage,<br>
> +              const void *key,<br>
> +              struct brw_stage_prog_data *prog_data,<br>
>                struct gl_shader_program *shader_prog,<br>
> -              struct gl_fragment_program *fp,<br>
> -              unsigned dispatch_width);<br>
> -<br>
> -   fs_visitor(struct brw_context *brw,<br>
> -              void *mem_ctx,<br>
> -              const struct brw_vs_prog_key *key,<br>
> -              struct brw_vs_prog_data *prog_data,<br>
> -              struct gl_shader_program *shader_prog,<br>
> -              struct gl_vertex_program *cp,<br>
> +              struct gl_program *prog,<br>
>                unsigned dispatch_width);</p>
<p dir="ltr">You remove the definition of fs_visitor::init below. You should remove it from the header as well. Also, isn't there at least one more constructor you need to remove from the header?</p>
<p dir="ltr">Other than that, this seems sensible.</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>></p>
<p dir="ltr">><br>
>     fs_visitor(struct brw_context *brw,<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> index 78f269e..abaea5f 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> @@ -4144,64 +4144,21 @@ fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)<br>
><br>
>  fs_visitor::fs_visitor(struct brw_context *brw,<br>
>                         void *mem_ctx,<br>
> -                       const struct brw_wm_prog_key *key,<br>
> -                       struct brw_wm_prog_data *prog_data,<br>
> +                       gl_shader_stage stage,<br>
> +                       const void *key,<br>
> +                       struct brw_stage_prog_data *prog_data,<br>
>                         struct gl_shader_program *shader_prog,<br>
> -                       struct gl_fragment_program *fp,<br>
> +                       struct gl_program *prog,<br>
>                         unsigned dispatch_width)<br>
> -   : backend_visitor(brw, shader_prog, &fp->Base, &prog_data->base,<br>
> -                     MESA_SHADER_FRAGMENT),<br>
> +   : backend_visitor(brw, shader_prog, prog, prog_data, stage),<br>
>       reg_null_f(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_F)),<br>
>       reg_null_d(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_D)),<br>
>       reg_null_ud(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_UD)),<br>
> -     key(key), prog_data(&prog_data->base),<br>
> +     key(key), prog_data(prog_data),<br>
>       dispatch_width(dispatch_width), promoted_constants(0)<br>
>  {<br>
>     this->mem_ctx = mem_ctx;<br>
> -   init();<br>
> -}<br>
> -<br>
> -fs_visitor::fs_visitor(struct brw_context *brw,<br>
> -                       void *mem_ctx,<br>
> -                       const struct brw_vs_prog_key *key,<br>
> -                       struct brw_vs_prog_data *prog_data,<br>
> -                       struct gl_shader_program *shader_prog,<br>
> -                       struct gl_vertex_program *cp,<br>
> -                       unsigned dispatch_width)<br>
> -   : backend_visitor(brw, shader_prog, &cp->Base, &prog_data->base.base,<br>
> -                     MESA_SHADER_VERTEX),<br>
> -     reg_null_f(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_F)),<br>
> -     reg_null_d(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_D)),<br>
> -     reg_null_ud(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_UD)),<br>
> -     key(key), prog_data(&prog_data->base.base),<br>
> -     dispatch_width(dispatch_width), promoted_constants(0)<br>
> -{<br>
> -   this->mem_ctx = mem_ctx;<br>
> -   init();<br>
> -}<br>
><br>
> -fs_visitor::fs_visitor(struct brw_context *brw,<br>
> -                       void *mem_ctx,<br>
> -                       const struct brw_cs_prog_key *key,<br>
> -                       struct brw_cs_prog_data *prog_data,<br>
> -                       struct gl_shader_program *shader_prog,<br>
> -                       struct gl_compute_program *cp,<br>
> -                       unsigned dispatch_width)<br>
> -   : backend_visitor(brw, shader_prog, &cp->Base, &prog_data->base,<br>
> -                     MESA_SHADER_COMPUTE),<br>
> -     reg_null_f(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_F)),<br>
> -     reg_null_d(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_D)),<br>
> -     reg_null_ud(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_UD)),<br>
> -     key(key), prog_data(&prog_data->base),<br>
> -     dispatch_width(dispatch_width), promoted_constants(0)<br>
> -{<br>
> -   this->mem_ctx = mem_ctx;<br>
> -   init();<br>
> -}<br>
> -<br>
> -void<br>
> -fs_visitor::init()<br>
> -{<br>
>     switch (stage) {<br>
>     case MESA_SHADER_FRAGMENT:<br>
>        key_tex = &((const brw_wm_prog_key *) key)->tex;<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
> index 2841d98..e9681b7 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
> @@ -1895,7 +1895,8 @@ brw_vs_emit(struct brw_context *brw,<br>
>     }<br>
><br>
>     if (brw->scalar_vs && (prog || use_nir)) {<br>
> -      fs_visitor v(brw, mem_ctx, &c->key, prog_data, prog, &c->vp->program, 8);<br>
> +      fs_visitor v(brw, mem_ctx, MESA_SHADER_VERTEX, &c->key,<br>
> +                   &prog_data->base.base, prog, &c->vp->program.Base, 8);<br>
>        if (!v.run_vs()) {<br>
>           if (prog) {<br>
>              prog->LinkStatus = false;<br>
> --<br>
> 2.4.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>