From 5731ebac404a142fb1c1d1f0755d22beed40528a Mon Sep 17 00:00:00 2001 From: Felix DeGrood Date: Mon, 15 May 2023 22:44:45 +0000 Subject: [PATCH] anv: override vendorID for Cyberpunk 2077 A recent update to Cyberpunk 2077 enables XeSS code for Intel GPUs which is causing the game to crash in the XeSS libraries. As a temporary work around, stop identifying as Intel for Cyberpunk so XeSS falls back to the cross-vendor path. References: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8860 Reviewed-by: Kenneth Graunke Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_device.c | 5 +++++ src/intel/vulkan/anv_private.h | 1 + src/util/00-mesa-defaults.conf | 3 +++ src/util/driconf.h | 3 +++ 4 files changed, 12 insertions(+) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 44a591531c0..da9e05b9ced 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -85,6 +85,7 @@ static const driOptionDescription anv_dri_options[] = { DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(false) DRI_CONF_LIMIT_TRIG_INPUT_RANGE(false) DRI_CONF_ANV_MESH_CONV_PRIM_ATTRS_TO_VERT_ATTRS(-2) + DRI_CONF_FORCE_VK_VENDOR(0) DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY @@ -1500,6 +1501,8 @@ anv_init_dri_options(struct anv_instance *instance) driQueryOptioni(&instance->dri_options, "generated_indirect_threshold"); instance->query_clear_with_blorp_threshold = driQueryOptioni(&instance->dri_options, "query_clear_with_blorp_threshold"); + instance->force_vk_vendor = + driQueryOptioni(&instance->dri_options, "force_vk_vendor"); } VkResult anv_CreateInstance( @@ -1749,6 +1752,8 @@ void anv_GetPhysicalDeviceProperties( .sparseProperties = {0}, /* Broadwell doesn't do sparse. */ }; + if (unlikely(pdevice->instance->force_vk_vendor)) + pProperties->vendorID = pdevice->instance->force_vk_vendor; snprintf(pProperties->deviceName, sizeof(pProperties->deviceName), "%s", pdevice->info.name); memcpy(pProperties->pipelineCacheUUID, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 8c4099e3b7b..b6401c44782 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1037,6 +1037,7 @@ struct anv_instance { float lower_depth_range_rate; unsigned generated_indirect_threshold; unsigned query_clear_with_blorp_threshold; + unsigned force_vk_vendor; /* HW workarounds */ bool no_16bit; diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index b5f8b233a7d..a58831bc304 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -1056,6 +1056,9 @@ TODO: document the other workarounds. + +