Mesa (main): lavapipe: add some asserts for descriptor dynamic offsets

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 5 02:35:16 UTC 2021


Module: Mesa
Branch: main
Commit: 64cee33984ff01ce9cda1a5f868f9ce50f0b7d66
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=64cee33984ff01ce9cda1a5f868f9ce50f0b7d66

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Nov  4 11:43:56 2021 -0400

lavapipe: add some asserts for descriptor dynamic offsets

ensure that this explodes if there aren't enough offsets

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13677>

---

 src/gallium/frontends/lavapipe/lvp_execute.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index 1e4422203cd..0c0b1c8adf3 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -1285,6 +1285,12 @@ static void handle_descriptor_sets(struct vk_cmd_queue_entry *cmd,
 
    for (i = 0; i < bds->descriptor_set_count; i++) {
       const struct lvp_descriptor_set *set = lvp_descriptor_set_from_handle(bds->descriptor_sets[i]);
+      /* verify that there's enough total offsets */
+      assert(set->layout->dynamic_offset_count <= dyn_info.dynamic_offset_count);
+      /* verify there's either no offsets... */
+      assert(!dyn_info.dynamic_offset_count ||
+             /* or that the total number of offsets required is <= the number remaining */
+             set->layout->dynamic_offset_count <= dyn_info.dynamic_offset_count - dyn_info.dyn_index);
 
       if (set->layout->shader_stages & VK_SHADER_STAGE_VERTEX_BIT)
          handle_set_stage(state, &dyn_info, set, MESA_SHADER_VERTEX, PIPE_SHADER_VERTEX);



More information about the mesa-commit mailing list