summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_program.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2014-02-19 15:14:02 +0100
committerFrancisco Jerez <currojerez@riseup.net>2014-02-19 16:27:22 +0100
commitae8b066da5862b4cfc510b3a9a0e1273f9f6edd4 (patch)
tree700ad532f65cbba9e8e76710e0c27b44f40528dc /src/mesa/drivers/dri/i965/brw_program.c
parent7f00c5f1a3e0db20a89cfedefd53cbe817fec9e3 (diff)
downloadexternal_mesa3d-ae8b066da5862b4cfc510b3a9a0e1273f9f6edd4.zip
external_mesa3d-ae8b066da5862b4cfc510b3a9a0e1273f9f6edd4.tar.gz
external_mesa3d-ae8b066da5862b4cfc510b3a9a0e1273f9f6edd4.tar.bz2
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 <stereotype441@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_program.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 1e35191..f69c312 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -544,3 +544,29 @@ brw_destroy_shader_time(struct brw_context *brw)
drm_intel_bo_unreference(brw->shader_time.bo);
brw->shader_time.bo = NULL;
}
+
+bool
+brw_stage_prog_data_compare(const struct brw_stage_prog_data *a,
+ const struct brw_stage_prog_data *b)
+{
+ /* Compare all the struct up to the pointers. */
+ if (memcmp(a, b, offsetof(struct brw_stage_prog_data, param)))
+ return false;
+
+ if (memcmp(a->param, b->param, a->nr_params * sizeof(void *)))
+ return false;
+
+ if (memcmp(a->pull_param, b->pull_param, a->nr_pull_params * sizeof(void *)))
+ return false;
+
+ return true;
+}
+
+void
+brw_stage_prog_data_free(const void *p)
+{
+ struct brw_stage_prog_data *prog_data = (struct brw_stage_prog_data *)p;
+
+ ralloc_free(prog_data->param);
+ ralloc_free(prog_data->pull_param);
+}