anv: Add workaround for sample mask with multisampling

The game Batman: Arkham Knight expects OpenGL behavior
with sample mask and multisampling which is different
from the Vulkan one.
This workaround fix changes key->ignore_sample_mask_out
value that is used for
prog_data->uses_omask definition in brv_fs.cpp(9740)
In that way prog_data->uses_omask also changes it value
and the cloak stops flickering.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6078

Signed-off-by: Viktoriia Palianytsia <v.palianytsia@globallogic.com>

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16551>
This commit is contained in:
Viktoriia Palianytsia 2022-05-17 09:36:26 +03:00 committed by Marge Bot
parent 7761b4d89e
commit e39a5f2b9f
5 changed files with 14 additions and 0 deletions

View file

@ -69,6 +69,7 @@ static const driOptionDescription anv_dri_options[] = {
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT(false)
DRI_CONF_VK_XWAYLAND_WAIT_READY(true)
DRI_CONF_ANV_ASSUME_FULL_SUBGROUPS(false)
DRI_CONF_ANV_SAMPLE_MASK_OUT_OPENGL_BEHAVIOUR(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
@ -1107,6 +1108,8 @@ anv_init_dri_options(struct anv_instance *instance)
driQueryOptionb(&instance->dri_options, "anv_assume_full_subgroups");
instance->limit_trig_input_range =
driQueryOptionb(&instance->dri_options, "limit_trig_input_range");
instance->sample_mask_out_opengl_behaviour =
driQueryOptionb(&instance->dri_options, "anv_sample_mask_out_opengl_behaviour");
}
VkResult anv_CreateInstance(

View file

@ -508,6 +508,9 @@ populate_wm_prog_key(const struct anv_graphics_pipeline *pipeline,
(ms_info->minSampleShading * ms_info->rasterizationSamples) > 1;
key->multisample_fbo = true;
}
if (device->physical->instance->sample_mask_out_opengl_behaviour)
key->ignore_sample_mask_out = !key->multisample_fbo;
}
key->coarse_pixel =

View file

@ -1086,6 +1086,7 @@ struct anv_instance {
*/
bool assume_full_subgroups;
bool limit_trig_input_range;
bool sample_mask_out_opengl_behaviour;
};
VkResult anv_init_wsi(struct anv_physical_device *physical_device);

View file

@ -926,6 +926,9 @@ TODO: document the other workarounds.
<application name="Wolfenstein: Youngblood(x64vk)" executable="Youngblood_x64vk.exe">
<option name="limit_trig_input_range" value="true" />
</application>
<application name="Batman™: Arkham Knight" executable="BatmanAK.exe">
<option name="anv_sample_mask_out_opengl_behaviour" value="true"/>
</application>
</device>
<device driver="virtio_gpu">

View file

@ -584,4 +584,8 @@
DRI_CONF_OPT_B(anv_assume_full_subgroups, def, \
"Allow assuming full subgroups requirement even when it's not specified explicitly")
#define DRI_CONF_ANV_SAMPLE_MASK_OUT_OPENGL_BEHAVIOUR(def) \
DRI_CONF_OPT_B(anv_sample_mask_out_opengl_behaviour, def, \
"Ignore sample mask out when having single sampled target")
#endif