radv: add a workaround for illegal depth/stencil descriptors with No Man's Sky
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38180>
This commit is contained in:
Samuel Pitoiset 2025-10-31 10:35:40 +01:00 committed by Marge Bot
parent 82b7cdeac9
commit cb4e0c4140
4 changed files with 43 additions and 0 deletions

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

@ -305,5 +305,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>