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

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Aug 25 16:13:10 2021 -0400

zink: verify program key sizes before checking for default variant

currently keys for shaders are always the same size, but this will change
in the future, at which point the keysize becomes relevant

Reviewed-by: Hoe Hao Cheng <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12547>

---

 src/gallium/drivers/zink/zink_program.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_program.c 
b/src/gallium/drivers/zink/zink_program.c
index cf70f4f94a0..12777d21d37 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -208,7 +208,7 @@ get_shader_module_for_stage(struct zink_context *ctx, 
struct zink_shader *zs, st
       /* if comparing against the existing default, use the base variant key 
size since
        * we're only checking the stage-specific data
        */
-      key.is_default_variant = !memcmp(tmp->data, &key, key.size);
+      key.is_default_variant = tmp->size == key.size && !memcmp(tmp->data, 
&key, key.size);
    } else
       key.is_default_variant = true;
 

Reply via email to