anv: Mask out invalid stages in foreach_stage
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 23 Dec 2015 19:24:23 +0000 (11:24 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 23 Dec 2015 21:49:56 +0000 (13:49 -0800)
src/vulkan/anv_private.h

index b632f6e85a989376d50ee86eb9421af962ff0a9a..6bd1895249287317f1b90671083a678fc3e838b8 100644 (file)
@@ -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)))