radv: add a workaround for illegal depth/stencil descriptors with No Man's Sky

Using descriptors with both depth and stencil aspects is illegal in
Vulkan and this hangs the GPU.

Use NULL descriptors to mitigate the issue. Note that AMDVLK also
ignores them.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13325
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit cb4e0c4140)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38268>
This commit is contained in:
Samuel Pitoiset 2025-10-31 10:35:40 +01:00 committed by Dylan Baker
parent 3ddddf78b4
commit 1e885e7a88
5 changed files with 44 additions and 1 deletions

View file

@ -24,7 +24,7 @@
"description": "radv: add a workaround for illegal depth/stencil descriptors with No Man's Sky",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -0,0 +1,35 @@
/*
* Copyright © 2025 Valve Corporation
*
* SPDX-License-Identifier: MIT
*/
#include "radv_device.h"
#include "radv_entrypoints.h"
#include "radv_image_view.h"
VKAPI_ATTR VkResult VKAPI_CALL
no_mans_sky_CreateImageView(VkDevice _device, const VkImageViewCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkImageView *pView)
{
VK_FROM_HANDLE(radv_device, device, _device);
VkResult result;
result = device->layer_dispatch.app.CreateImageView(_device, pCreateInfo, pAllocator, pView);
if (result != VK_SUCCESS)
return result;
VK_FROM_HANDLE(radv_image_view, iview, *pView);
if ((iview->vk.aspects == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) &&
(iview->vk.usage &
(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT))) {
/* No Man's Sky creates descriptors with depth/stencil aspects (only when Intel XESS is
* enabled apparently). and this is illegal in Vulkan. Ignore them by using NULL descriptors
* to workaroud GPU hangs.
*/
memset(&iview->descriptor, 0, sizeof(iview->descriptor));
}
return result;
}

View file

@ -21,6 +21,7 @@ radv_entrypoints_gen_command += [
'--device-prefix', 'metro_exodus',
'--device-prefix', 'rage2',
'--device-prefix', 'quantic_dream',
'--device-prefix', 'no_mans_sky',
# Command buffer annotation layer entrypoints
'--device-prefix', 'annotate',
@ -40,6 +41,7 @@ libradv_files = files(
'layers/radv_metro_exodus.c',
'layers/radv_rage2.c',
'layers/radv_quantic_dream.c',
'layers/radv_no_mans_sky.c',
'layers/radv_rmv_layer.c',
'layers/radv_rra_layer.c',
'layers/radv_sqtt_layer.c',

View file

@ -792,6 +792,8 @@ init_dispatch_tables(struct radv_device *device, struct radv_physical_device *pd
add_entrypoints(&b, &rage2_device_entrypoints, RADV_APP_DISPATCH_TABLE);
} else if (!strcmp(instance->drirc.debug.app_layer, "quanticdream")) {
add_entrypoints(&b, &quantic_dream_device_entrypoints, RADV_APP_DISPATCH_TABLE);
} else if (!strcmp(instance->drirc.debug.app_layer, "no_mans_sky")) {
add_entrypoints(&b, &no_mans_sky_device_entrypoints, RADV_APP_DISPATCH_TABLE);
}
if (instance->vk.trace_mode & RADV_TRACE_MODE_RGP)

View file

@ -302,5 +302,9 @@ Application bugs worked around in this file:
<application name="Total War: WARHAMMER III" application_name_match="TotalWarhammer3">
<option name="radv_disable_depth_storage" value="true"/>
</application>
<application name="No Man's Sky" application_name_match="No Man's Sky">
<option name="radv_app_layer" value="no_mans_sky" />
</application>
</device>
</driconf>