Mesa (main): zink: use memcmp for comparing dynamic state1 info

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 3 01:38:19 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue May 31 15:16:03 2022 -0400

zink: use memcmp for comparing dynamic state1 info

easier to expand

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

---

 src/gallium/drivers/zink/zink_pipeline.h | 2 +-
 src/gallium/drivers/zink/zink_program.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h
index 8bb323d0568..5da7f859f06 100644
--- a/src/gallium/drivers/zink/zink_pipeline.h
+++ b/src/gallium/drivers/zink/zink_pipeline.h
@@ -42,7 +42,7 @@ struct zink_vertex_elements_state;
 struct zink_pipeline_dynamic_state1 {
    uint8_t front_face; //VkFrontFace:1
    uint16_t num_viewports;
-   struct zink_depth_stencil_alpha_hw_state *depth_stencil_alpha_state;
+   struct zink_depth_stencil_alpha_hw_state *depth_stencil_alpha_state; //must be last
 };
 
 struct zink_gfx_pipeline_state {
diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 1c56255e546..8cdf3a28869 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -259,7 +259,7 @@ equals_gfx_pipeline_state(const void *a, const void *b)
       }
    }
    if (!sa->have_EXT_extended_dynamic_state) {
-      if (sa->dyn_state1.front_face != sb->dyn_state1.front_face)
+      if (memcmp(&sa->dyn_state1, &sb->dyn_state1, offsetof(struct zink_pipeline_dynamic_state1, depth_stencil_alpha_state)))
          return false;
       if (!!sa->dyn_state1.depth_stencil_alpha_state != !!sb->dyn_state1.depth_stencil_alpha_state ||
           (sa->dyn_state1.depth_stencil_alpha_state &&



More information about the mesa-commit mailing list