Intel/anv: The cloak is flickering in Batman:Arkham Knight
The game Batman:Arkham Night appears to have a bug with Batman's cloak. It is flickering. After investigation regression was found. It happens because of this MR: !5156 (merged)
Problematic code is placed in brw_fs.cpp file:
prog_data->uses_omask = !key->ignore_sample_mask_out &&
(shader->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK));
After working with it I can say that changing code to
prog_data->uses_omask = (key->ignore_sample_mask_out || key->multisample_fbo) &&
(shader->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK));
solves the problem, but it can change logic of MR.
Piglit has tests for sample mask on OpenGL: builtin-gl-sample-mask and builtin-gl-sample-mask-simple. As I can see - ignore_sample_mask_out is always false(so !ignore_sample_mask_out is always true) which always determs prog_data->uses_omask as true(only for Vulkan, OpenGL changes it based on multisampling) and because of that cloak is flickering. Any information in Vulkan specification about this was not found.
Bug reproduced on latest Mesa version. It seems that bug appears not only on my system but here are characteristics: