[Mesa-dev] [PATCH 12/21] intel/compiler: Add a helper for growing the prog_data::param array

Jason Ekstrand jason at jlekstrand.net
Fri Sep 29 21:25:12 UTC 2017


---
 src/intel/compiler/brw_compiler.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index 1ec79f6..f9679a3 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -28,6 +28,7 @@
 #include "common/gen_device_info.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
+#include "util/ralloc.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -604,6 +605,18 @@ struct brw_stage_prog_data {
    uint32_t *pull_param;
 };
 
+static inline uint32_t *
+brw_stage_prog_data_add_params(struct brw_stage_prog_data *prog_data,
+                               unsigned nr_new_params)
+{
+   unsigned old_nr_params = prog_data->nr_params;
+   prog_data->nr_params += nr_new_params;
+   prog_data->param = reralloc(ralloc_parent(prog_data->param),
+                               prog_data->param, uint32_t,
+                               prog_data->nr_params);
+   return prog_data->param + old_nr_params;
+}
+
 static inline void
 brw_mark_surface_used(struct brw_stage_prog_data *prog_data,
                       unsigned surf_index)
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list