Mesa (main): zink: store min required stride values on the vertex state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 19 03:54:42 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Apr 18 15:48:56 2022 -0400

zink: store min required stride values on the vertex state

this will be useful shortly

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

---

 src/gallium/drivers/zink/zink_state.c | 2 ++
 src/gallium/drivers/zink/zink_state.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c
index a9cb615cc37..802389985cf 100644
--- a/src/gallium/drivers/zink/zink_state.c
+++ b/src/gallium/drivers/zink/zink_state.c
@@ -32,6 +32,7 @@
 #include "util/u_dual_blend.h"
 #include "util/u_memory.h"
 #include "util/u_helpers.h"
+#include "vulkan/util/vk_format.h"
 
 #include <math.h>
 
@@ -118,6 +119,7 @@ zink_create_vertex_elements_state(struct pipe_context *pctx,
          ves->hw_state.attribs[i].format = format;
          assert(ves->hw_state.attribs[i].format != VK_FORMAT_UNDEFINED);
          ves->hw_state.attribs[i].offset = elem->src_offset;
+         ves->min_stride[binding] = MAX2(ves->min_stride[binding], elem->src_offset + vk_format_get_blocksize(format));
       }
    }
    assert(num_decomposed + num_elements <= PIPE_MAX_ATTRIBS);
diff --git a/src/gallium/drivers/zink/zink_state.h b/src/gallium/drivers/zink/zink_state.h
index 502982df5a2..09dec833ca4 100644
--- a/src/gallium/drivers/zink/zink_state.h
+++ b/src/gallium/drivers/zink/zink_state.h
@@ -53,6 +53,7 @@ struct zink_vertex_elements_state {
    } bindings[PIPE_MAX_ATTRIBS];
    uint32_t divisor[PIPE_MAX_ATTRIBS];
    uint8_t binding_map[PIPE_MAX_ATTRIBS];
+   uint32_t min_stride[PIPE_MAX_ATTRIBS]; //for dynamic_state1
    uint32_t decomposed_attrs;
    unsigned decomposed_attrs_size;
    uint32_t decomposed_attrs_without_w;



More information about the mesa-commit mailing list