From ae8b066da5862b4cfc510b3a9a0e1273f9f6edd4 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Wed, 19 Feb 2014 15:14:02 +0100 Subject: i965: Move up duplicated fields from stage-specific prog_data to brw_stage_prog_data. There doesn't seem to be any reason for nr_params, nr_pull_params, param, and pull_param to be duplicated in the stage-specific subclasses of brw_stage_prog_data. Moving their definition to the common base class will allow some code sharing in a future commit, the removal of brw_vec4_prog_data_compare and brw_*_prog_data_free, and the simplification of the stage-specific brw_*_prog_data_compare. Reviewed-by: Paul Berry --- src/mesa/drivers/dri/i965/brw_vs.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/mesa/drivers/dri/i965/brw_vs.c') diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 092d53af3f5..3e319a650b8 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -182,12 +182,12 @@ brw_vs_prog_data_compare(const void *in_a, const void *in_b) const struct brw_vs_prog_data *a = in_a; const struct brw_vs_prog_data *b = in_b; - /* Compare the base vec4 structure. */ - if (!brw_vec4_prog_data_compare(&a->base, &b->base)) + /* Compare the base structure. */ + if (!brw_stage_prog_data_compare(&a->base.base, &b->base.base)) return false; /* Compare the rest of the struct. */ - const unsigned offset = sizeof(struct brw_vec4_prog_data); + const unsigned offset = sizeof(struct brw_stage_prog_data); if (memcmp(((char *) a) + offset, ((char *) b) + offset, sizeof(struct brw_vs_prog_data) - offset)) { return false; @@ -206,6 +206,7 @@ do_vs_prog(struct brw_context *brw, const GLuint *program; struct brw_vs_compile c; struct brw_vs_prog_data prog_data; + struct brw_stage_prog_data *stage_prog_data = &prog_data.base.base; void *mem_ctx; int i; struct gl_shader *vs = NULL; @@ -241,8 +242,8 @@ do_vs_prog(struct brw_context *brw, */ param_count += c.key.base.nr_userclip_plane_consts * 4; - prog_data.base.param = rzalloc_array(NULL, const float *, param_count); - prog_data.base.pull_param = rzalloc_array(NULL, const float *, param_count); + stage_prog_data->param = rzalloc_array(NULL, const float *, param_count); + stage_prog_data->pull_param = rzalloc_array(NULL, const float *, param_count); GLbitfield64 outputs_written = vp->program.Base.OutputsWritten; prog_data.inputs_read = vp->program.Base.InputsRead; @@ -545,12 +546,3 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) return success; } - - -void -brw_vs_prog_data_free(const void *in_prog_data) -{ - const struct brw_vs_prog_data *prog_data = in_prog_data; - - brw_vec4_prog_data_free(&prog_data->base); -} -- cgit v1.2.3