From 72ceb99bab592e1ce01bc7855c45bfe58a188b6f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 23 Dec 2015 11:24:23 -0800 Subject: [PATCH] anv: Mask out invalid stages in foreach_stage --- src/vulkan/anv_private.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index b632f6e85a9..6bd18952492 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1235,8 +1235,11 @@ mesa_to_vk_shader_stage(gl_shader_stage mesa_stage) return (1 << mesa_stage); } +#define ANV_STAGE_MASK ((1 << MESA_SHADER_STAGES) - 1) + #define anv_foreach_stage(stage, stage_bits) \ - for (gl_shader_stage stage, __tmp = (gl_shader_stage)(stage_bits);\ + for (gl_shader_stage stage, \ + __tmp = (gl_shader_stage)((stage_bits) & ANV_STAGE_MASK); \ stage = __builtin_ffs(__tmp) - 1, __tmp; \ __tmp &= ~(1 << (stage))) -- 2.30.2