[Mesa-dev] [PATCH v2 08/19] i965/vs: Make vec4_vs_visitor class derived from vec4_visitor.
Kenneth Graunke
kenneth at whitecape.org
Wed Apr 10 13:11:41 PDT 2013
On 04/09/2013 03:11 PM, Paul Berry wrote:
> This patch just creates the derived class; later patches will migrate
> VS-specific functions and data structures from the base class into the
> derived class.
>
> Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
> Reviewed-by: Eric Anholt <eric at anholt.net>
> ---
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 2 +-
> src/mesa/drivers/dri/i965/brw_vec4.h | 11 +++++++++++
> src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 +++++++++++
> src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp | 15 ++++++++++++++-
> 4 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index 8a52910..6420e4d 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -1519,7 +1519,7 @@ brw_vs_emit(struct brw_context *brw,
> }
> }
>
> - vec4_visitor v(brw, c, prog_data, prog, shader, mem_ctx);
> + vec4_vs_visitor v(brw, c, prog_data, prog, shader, mem_ctx);
> if (!v.run()) {
> prog->LinkStatus = false;
> ralloc_strcat(&prog->InfoLog, v.fail_msg);
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
> index c98003d..5dbe128 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.h
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.h
> @@ -486,6 +486,17 @@ public:
> void dump_instructions();
> };
>
> +class vec4_vs_visitor : public vec4_visitor
> +{
> +public:
> + vec4_vs_visitor(struct brw_context *brw,
> + struct brw_vs_compile *c,
> + struct brw_vs_prog_data *prog_data,
> + struct gl_shader_program *prog,
> + struct brw_shader *shader,
> + void *mem_ctx);
> +};
> +
> /**
> * The vertex shader code generator.
> *
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 6bc9769..f5f53ad 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -3023,6 +3023,17 @@ vec4_visitor::~vec4_visitor()
> }
>
>
> +vec4_vs_visitor::vec4_vs_visitor(struct brw_context *brw,
> + struct brw_vs_compile *c,
> + struct brw_vs_prog_data *prog_data,
> + struct gl_shader_program *prog,
> + struct brw_shader *shader,
> + void *mem_ctx)
> + : vec4_visitor(brw, c, prog_data, prog, shader, mem_ctx)
> +{
> +}
> +
> +
> void
> vec4_visitor::fail(const char *format, ...)
> {
> diff --git a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
> index fb55714..418edd2 100644
> --- a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
> +++ b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
> @@ -42,6 +42,19 @@ public:
> vec4_visitor *v;
> };
>
> +
> +class register_coalesce_vec4_visitor : public vec4_visitor
> +{
> +public:
> + register_coalesce_vec4_visitor(struct brw_context *brw,
> + struct brw_vs_compile *c,
> + struct gl_shader_program *shader_prog)
> + : vec4_visitor(brw, c, NULL, shader_prog, NULL, NULL)
> + {
> + }
> +};
> +
> +
> void register_coalesce_test::SetUp()
> {
> brw = (struct brw_context *)calloc(1, sizeof(*brw));
> @@ -53,7 +66,7 @@ void register_coalesce_test::SetUp()
>
> shader_prog = ralloc(NULL, struct gl_shader_program);
>
> - v = new vec4_visitor(brw, c, NULL, shader_prog, NULL, NULL);
> + v = new register_coalesce_vec4_visitor(brw, c, shader_prog);
>
> _mesa_init_vertex_program(ctx, &c->vp->program, GL_VERTEX_SHADER, 0);
Huh? This seems like a separate change. A separate commit noting that
this is purely for a register coalescing test (not the coalescing code
itself) would be nice.
More information about the mesa-dev
mailing list