hasvk: Add Vulkan API version override

This allows to use a driconf to override the API version and expose Vulkan 1.3.
That can be used in conjunction with certain games like for example Brawlhalla
which benefits from some DXVK +2.0 features.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26433>
This commit is contained in:
ratatouillegamer 2023-11-30 15:58:49 -03:00 committed by Marge Bot
parent c13de0509c
commit 9de6928746
3 changed files with 10 additions and 1 deletions

View file

@ -70,6 +70,7 @@ static const driOptionDescription anv_dri_options[] = {
DRI_CONF_ANV_ASSUME_FULL_SUBGROUPS(false)
DRI_CONF_ANV_SAMPLE_MASK_OUT_OPENGL_BEHAVIOUR(false)
DRI_CONF_NO_16BIT(false)
DRI_CONF_ANV_HASVK_OVERRIDE_API_VERSION(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
@ -1333,6 +1334,8 @@ anv_init_dri_options(struct anv_instance *instance)
driQueryOptionf(&instance->dri_options, "lower_depth_range_rate");
instance->no_16bit =
driQueryOptionb(&instance->dri_options, "no_16bit");
instance->report_vk_1_3 =
driQueryOptionb(&instance->dri_options, "hasvk_report_vk_1_3_version");
}
VkResult anv_CreateInstance(
@ -1571,7 +1574,8 @@ void anv_GetPhysicalDeviceProperties(
#ifdef ANDROID
.apiVersion = ANV_API_VERSION,
#else
.apiVersion = pdevice->use_softpin ? ANV_API_VERSION_1_3 : ANV_API_VERSION_1_2,
.apiVersion = (pdevice->use_softpin || pdevice->instance->report_vk_1_3) ?
ANV_API_VERSION_1_3 : ANV_API_VERSION_1_2,
#endif
.driverVersion = vk_get_driver_version(),
.vendorID = 0x8086,

View file

@ -948,6 +948,7 @@ struct anv_instance {
bool limit_trig_input_range;
bool sample_mask_out_opengl_behaviour;
float lower_depth_range_rate;
bool report_vk_1_3;
/* HW workarounds */
bool no_16bit;

View file

@ -750,6 +750,10 @@
DRI_CONF_OPT_B(anv_disable_fcv, def, \
"Disable FCV optimization")
#define DRI_CONF_ANV_HASVK_OVERRIDE_API_VERSION(def) \
DRI_CONF_OPT_B(hasvk_report_vk_1_3_version, def, \
"Override intel_hasvk API version")
/**
* \brief DZN specific configuration options
*/