[Mesa-dev] [PATCH 5/6] i965/vs: Remove 'c'/vs_compile from vec4_vs_visitor.
Pohjolainen, Topi
topi.pohjolainen at intel.com
Fri Jul 3 01:29:33 PDT 2015
On Wed, Jul 01, 2015 at 03:03:35PM -0700, Kenneth Graunke wrote:
> At this point, the brw_vs_compile structure only contains the key and
> gl_vertex_program pointer. We may as well pass and store them directly;
> it's simpler and more convenient (key-> instead of vs_compile->key...).
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 4 ++--
> src/mesa/drivers/dri/i965/brw_vec4_vp.cpp | 9 +++------
> src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 11 ++++++-----
> src/mesa/drivers/dri/i965/brw_vs.h | 6 ++++--
> 4 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index e5db268..42d014c 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -1953,8 +1953,8 @@ brw_vs_emit(struct brw_context *brw,
> if (!assembly) {
> prog_data->base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT;
>
> - vec4_vs_visitor v(brw->intelScreen->compiler, brw,
> - c, prog_data, prog, mem_ctx, st_index,
> + vec4_vs_visitor v(brw->intelScreen->compiler, brw, &c->key, prog_data,
> + &c->vp->program, prog, mem_ctx, st_index,
> !_mesa_is_gles3(&brw->ctx));
> if (!v.run(brw_select_clip_planes(&brw->ctx))) {
> if (prog) {
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
> index dcbd240..d1a72d7 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
> @@ -394,8 +394,7 @@ vec4_vs_visitor::emit_program_code()
> * pull constants. Do that now.
> */
> if (this->need_all_constants_in_pull_buffer) {
> - const struct gl_program_parameter_list *params =
> - vs_compile->vp->program.Base.Parameters;
> + const struct gl_program_parameter_list *params = vp->Base.Parameters;
> unsigned i;
> for (i = 0; i < params->NumParameters * 4; i++) {
> stage_prog_data->pull_param[i] =
> @@ -415,8 +414,7 @@ vec4_vs_visitor::setup_vp_regs()
> vp_temp_regs[i] = src_reg(this, glsl_type::vec4_type);
>
> /* PROGRAM_STATE_VAR etc. */
> - struct gl_program_parameter_list *plist =
> - vs_compile->vp->program.Base.Parameters;
> + struct gl_program_parameter_list *plist = vp->Base.Parameters;
> for (unsigned p = 0; p < plist->NumParameters; p++) {
> unsigned components = plist->Parameters[p].Size;
>
> @@ -486,8 +484,7 @@ vec4_vs_visitor::get_vp_dst_reg(const prog_dst_register &dst)
> src_reg
> vec4_vs_visitor::get_vp_src_reg(const prog_src_register &src)
> {
> - struct gl_program_parameter_list *plist =
> - vs_compile->vp->program.Base.Parameters;
> + struct gl_program_parameter_list *plist = vp->Base.Parameters;
>
> src_reg result;
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
> index 35b601a..b7ec8b9 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
> @@ -36,7 +36,7 @@ vec4_vs_visitor::emit_prolog()
>
> for (int i = 0; i < VERT_ATTRIB_MAX; i++) {
> if (vs_prog_data->inputs_read & BITFIELD64_BIT(i)) {
> - uint8_t wa_flags = vs_compile->key.gl_attrib_wa_flags[i];
> + uint8_t wa_flags = key->gl_attrib_wa_flags[i];
> dst_reg reg(ATTR, i);
> dst_reg reg_d = reg;
> reg_d.type = BRW_REGISTER_TYPE_D;
> @@ -213,20 +213,21 @@ vec4_vs_visitor::emit_thread_end()
>
> vec4_vs_visitor::vec4_vs_visitor(const struct brw_compiler *compiler,
> void *log_data,
> - struct brw_vs_compile *vs_compile,
> + const struct brw_vs_prog_key *key,
> struct brw_vs_prog_data *vs_prog_data,
> + struct gl_vertex_program *vp,
> struct gl_shader_program *prog,
> void *mem_ctx,
> int shader_time_index,
> bool use_legacy_snorm_formula)
> : vec4_visitor(compiler, log_data,
> - &vs_compile->vp->program.Base,
> - &vs_compile->key.base, &vs_prog_data->base, prog,
> + &vp->Base, &key->base, &vs_prog_data->base, prog,
> MESA_SHADER_VERTEX,
> mem_ctx, false /* no_spills */,
> shader_time_index),
> - vs_compile(vs_compile),
> + key(key),
> vs_prog_data(vs_prog_data),
> + vp(vp),
> use_legacy_snorm_formula(use_legacy_snorm_formula)
> {
> }
> diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
> index 3a131b0..0481c44 100644
> --- a/src/mesa/drivers/dri/i965/brw_vs.h
> +++ b/src/mesa/drivers/dri/i965/brw_vs.h
> @@ -91,8 +91,9 @@ class vec4_vs_visitor : public vec4_visitor
> public:
> vec4_vs_visitor(const struct brw_compiler *compiler,
> void *log_data,
> - struct brw_vs_compile *vs_compile,
> + const struct brw_vs_prog_key *key,
> struct brw_vs_prog_data *vs_prog_data,
> + struct gl_vertex_program *vp,
> struct gl_shader_program *prog,
> void *mem_ctx,
> int shader_time_index,
> @@ -113,8 +114,9 @@ private:
> dst_reg get_vp_dst_reg(const prog_dst_register &dst);
> src_reg get_vp_src_reg(const prog_src_register &src);
>
> - struct brw_vs_compile * const vs_compile;
> + const struct brw_vs_prog_key *const key;
> struct brw_vs_prog_data * const vs_prog_data;
> + struct gl_vertex_program *vp;
I guess you dropped the const qualifier by accident telling that the pointer
value is constant. Furthermore, I think we can make the pointer itself to
represent read-only data - in the backend we don't alter it anymore.
const struct gl_vertex_program * const vp;
With that:
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> src_reg *vp_temp_regs;
> src_reg vp_addr_reg;
>
> --
> 2.4.4
>
> _______________________________________________
> 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