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

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Mar 24 07:39:07 2021 -0400

zink: isolate gfx stage bits when updating shader modules

ensure that we don't overflow the array here

Fixes: b2247a37247 ("zink: add compute programs and pipelines")

Acked-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9798>

---

 src/gallium/drivers/zink/zink_program.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_program.c 
b/src/gallium/drivers/zink/zink_program.c
index f9a4af10010..fe897397e31 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -352,12 +352,13 @@ update_shader_modules(struct zink_context *ctx, struct 
zink_shader *stages[ZINK_
 {
    struct zink_shader *dirty[ZINK_SHADER_COUNT] = {NULL};
 
-   if (!ctx->dirty_shader_stages)
+   unsigned gfx_bits = u_bit_consecutive(PIPE_SHADER_VERTEX, 5);
+   unsigned dirty_shader_stages = ctx->dirty_shader_stages & gfx_bits;
+   if (!dirty_shader_stages)
       return;
    /* we need to map pipe_shader_type -> gl_shader_stage so we can ensure that 
we're compiling
     * the shaders in pipeline order and have builtin input/output locations 
match up after being compacted
     */
-   unsigned dirty_shader_stages = ctx->dirty_shader_stages;
    while (dirty_shader_stages) {
       unsigned type = u_bit_scan(&dirty_shader_stages);
       dirty[tgsi_processor_to_shader_stage(type)] = stages[type];

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to