anv: Mask out invalid stages in foreach_stage

This commit is contained in:
Jason Ekstrand 2015-12-23 11:24:23 -08:00
parent 5644b1cece
commit 72ceb99bab
1 changed files with 4 additions and 1 deletions

View 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)))