summaryrefslogtreecommitdiffstats
path: root/src/intel/compiler/brw_compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/compiler/brw_compiler.h')
-rw-r--r--src/intel/compiler/brw_compiler.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index 6753a8daf08..038f3f95512 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -1222,6 +1222,35 @@ brw_stage_has_packed_dispatch(const struct gen_device_info *devinfo,
}
}
+/**
+ * Computes the first varying slot in the URB produced by the previous stage
+ * that is used in the next stage. We do this by testing the varying slots in
+ * the previous stage's vue map against the inputs read in the next stage.
+ *
+ * Note that:
+ *
+ * - Each URB offset contains two varying slots and we can only skip a
+ * full offset if both slots are unused, so the value we return here is always
+ * rounded down to the closest multiple of two.
+ *
+ * - gl_Layer and gl_ViewportIndex don't have their own varying slots, they are
+ * part of the vue header, so if these are read we can't skip anything.
+ */
+static inline int
+brw_compute_first_urb_slot_required(uint64_t inputs_read,
+ const struct brw_vue_map *prev_stage_vue_map)
+{
+ if ((inputs_read & (VARYING_BIT_LAYER | VARYING_BIT_VIEWPORT)) == 0) {
+ for (int i = 0; i < prev_stage_vue_map->num_slots; i++) {
+ int varying = prev_stage_vue_map->slot_to_varying[i];
+ if (varying > 0 && (inputs_read & BITFIELD64_BIT(varying)) != 0)
+ return ROUND_DOWN_TO(i, 2);
+ }
+ }
+
+ return 0;
+}
+
#ifdef __cplusplus
} /* extern "C" */
#endif