intel/compiler: Add a helper for growing the prog_data::param array
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 29 Sep 2017 18:05:55 +0000 (11:05 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 13 Oct 2017 05:39:30 +0000 (22:39 -0700)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_compiler.h

index 26e8f464ef6069e3c94b09e0c8959f43db70c709..e20465812789129dc862a2f27575aece256062a7 100644 (file)
@@ -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" {
@@ -603,6 +604,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)