Module: Mesa Branch: main Commit: 9de692874650cd24e2a46a8ad8280c2338d85cba URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9de692874650cd24e2a46a8ad8280c2338d85cba
Author: ratatouillegamer <ratatouillemo...@gmail.com> Date: Thu Nov 30 15:58:49 2023 -0300 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.landwer...@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26433> --- src/intel/vulkan_hasvk/anv_device.c | 6 +++++- src/intel/vulkan_hasvk/anv_private.h | 1 + src/util/driconf.h | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan_hasvk/anv_device.c b/src/intel/vulkan_hasvk/anv_device.c index cb4c5b5b7b4..4463c09eac6 100644 --- a/src/intel/vulkan_hasvk/anv_device.c +++ b/src/intel/vulkan_hasvk/anv_device.c @@ -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, diff --git a/src/intel/vulkan_hasvk/anv_private.h b/src/intel/vulkan_hasvk/anv_private.h index aec64f5cecc..84e1b69f7fd 100644 --- a/src/intel/vulkan_hasvk/anv_private.h +++ b/src/intel/vulkan_hasvk/anv_private.h @@ -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; diff --git a/src/util/driconf.h b/src/util/driconf.h index 941d15a2f50..643cb166446 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -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 */