HansKristian-Work / vkd3d-proton

Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.
GNU Lesser General Public License v2.1
1.77k stars 184 forks source link

Skyrim Upscaler Mod - d3d12_shared_fence_QueryInterface not implemented #1344

Open ecbfry opened 1 year ago

ecbfry commented 1 year ago

Skyrim Upscaler https://www.nexusmods.com/skyrimspecialedition/mods/80343 is a new mod for Skyrim SE that implements DLSS/FSR2/XeSS in game.

DLSS is reported to work under linux (assuming the right nvidia hardware).

The FSR2 implementation uses a DX11/DX12 hybrid solution, so unlike Skyrim SE, it requires DX12 support to work. However, running the mod under proton with dxvk and vkd3d-proton results in a freeze shortly after selecting FSR2 in the in game mod gui.

The vkd3d log shows a warning: d3d12_shared_fence_QueryInterface not implemented, followed by error message: d3d12_validate_resource_flags: ALLOW_SIMULTANEOUS_ACCESS and ALLOW_DEPTH_STENCIL is not allowed.

Now, I don't know if this is within the scope of vkd3d-proton, or would require an api that is not yet implemented in wine/proton. Can you shed any light on this?

Many thanks. Here is the vkd3d.log, can supply other logs if they would be of any help.

ecbfry commented 1 year ago

Meant to add: the mod author states:

If you mean using FSR2 on linux it won't work. Proton haven't implemented API interop currently, every api involving sharing is returned with unimplemented error code.

Iglu47 commented 1 year ago

Manual installation for Steam-version (without Mod Organizer 2/Vortex):

So, the following can now be found in the %game_root% directory:

./SkyrimSELauncher.exe
./skse64_loader.exe
./skse64_1_6_640.dll
./Data/Scripts/*
./Data/SKSE/Plugins/SkyrimUpscaler.dll
./Data/SKSE/Plugins/SkyrimUpscaler.ini
./Data/SKSE/Plugins/versionlib-1-6-640-0.bin
./Data/UpscalerBasePlugin/ffx_fsr2_api_dx12_x64.dll
./Data/UpscalerBasePlugin/ffx_fsr2_api_x64.dll
./Data/UpscalerBasePlugin/PDPerfPlugin.dll

_it's probably preferable to disable FSR by default so you can make sure everything (except this one) works. In %game_root%/Data/SKSE/Plugins/SkyrimUpscaler.ini set mEnableUpscaler to false_

  1. ~Launch the game through skse64_loader.exe~ Make backup of SkyrimSELauncher.exe, rename skse64_loader.exe into SkyrimSELauncher.exe and launch the game through Proton as usual.
  2. Press the ‘End’ key in the main menu. The tool will appear 🎉
And the game will be freeze if enable FSR

![skyrim_fsr](https://user-images.githubusercontent.com/25866099/209765179-a4e0dab1-c782-4966-9425-a8fcc924191d.png)

https://github.com/doitsujin/dxvk/issues/3132 related

Iglu47 commented 1 year ago

terminal output with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation during hangup (it's with Wine build patched for sharedgpures support, but it's not from Proton experimental_7.0. So it still has a small chance of being invalid.)

0c04:err:d3d12_validate_resource_flags: ALLOW_SIMULTANEOUS_ACCESS and ALLOW_DEPTH_STENCIL is not allowed.
VUID-vkQueueSubmit2-semaphore-03873(ERROR / SPEC): msgNum: -2139599761 - Validation Error: [ VUID-vkQueueSubmit2-semaphore-03873 ] Object 0: handle = 0xb95fc20000003512, type = VK_OBJECT_TYPE_SEMAPHORE; Object 1: handle = 0x7d59fab0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x80784c6f | vkQueueSubmit2(): pSubmits[0].pWaitSemaphoreInfos[0] Queue VkQueue 0x7d59fab0[] is waiting on semaphore (VkSemaphore 0xb95fc20000003512[]) that has no way to be signaled. The Vulkan spec states: Any semaphore member of any element of the pWaitSemaphoreInfos member of any element of pSubmits that was created with a VkSemaphoreTypeKHR of VK_SEMAPHORE_TYPE_BINARY_KHR must reference a semaphore signal operation that has been submitted for execution and any semaphore signal operations on which it depends (if any) must have also been submitted for execution (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkQueueSubmit2-semaphore-03873)
    Objects: 2
        [0] 0xb95fc20000003512, type: 5, name: NULL
        [1] 0x7d59fab0, type: 4, name: NULL
0c04:err:d3d12_command_allocator_Reset: There are still 1 pending command lists awaiting execution from command allocator iface 00000000009403d0!
VUID-vkQueueSubmit2-semaphore-03873(ERROR / SPEC): msgNum: -2139599761 - Validation Error: [ VUID-vkQueueSubmit2-semaphore-03873 ] Object 0: handle = 0x26cde100000035aa, type = VK_OBJECT_TYPE_SEMAPHORE; Object 1: handle = 0x7d59fab0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x80784c6f | vkQueueSubmit2(): pSubmits[0].pWaitSemaphoreInfos[0] Queue VkQueue 0x7d59fab0[] is waiting on semaphore (VkSemaphore 0x26cde100000035aa[]) that has no way to be signaled. The Vulkan spec states: Any semaphore member of any element of the pWaitSemaphoreInfos member of any element of pSubmits that was created with a VkSemaphoreTypeKHR of VK_SEMAPHORE_TYPE_BINARY_KHR must reference a semaphore signal operation that has been submitted for execution and any semaphore signal operations on which it depends (if any) must have also been submitted for execution (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkQueueSubmit2-semaphore-03873)
    Objects: 2
        [0] 0x26cde100000035aa, type: 5, name: NULL
        [1] 0x7d59fab0, type: 4, name: NULL
VUID-vkQueueSubmit2-semaphore-03873(ERROR / SPEC): msgNum: -2139599761 - Validation Error: [ VUID-vkQueueSubmit2-semaphore-03873 ] Object 0: handle = 0xee647e0000000009, type = VK_OBJECT_TYPE_SEMAPHORE; Object 1: handle = 0x7d59fab0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x80784c6f | vkQueueSubmit2(): pSubmits[0].pWaitSemaphoreInfos[0] Queue VkQueue 0x7d59fab0[] is waiting on semaphore (VkSemaphore 0xee647e0000000009[]) that has no way to be signaled. The Vulkan spec states: Any semaphore member of any element of the pWaitSemaphoreInfos member of any element of pSubmits that was created with a VkSemaphoreTypeKHR of VK_SEMAPHORE_TYPE_BINARY_KHR must reference a semaphore signal operation that has been submitted for execution and any semaphore signal operations on which it depends (if any) must have also been submitted for execution (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkQueueSubmit2-semaphore-03873)
    Objects: 2
        [0] 0xee647e0000000009, type: 5, name: NULL
        [1] 0x7d59fab0, type: 4, name: NULL
UNASSIGNED-CoreValidation-DrawState-QueueForwardProgress(ERROR / SPEC): msgNum: -400166253 - Validation Error: [ UNASSIGNED-CoreValidation-DrawState-QueueForwardProgress ] Object 0: handle = 0xb95fc20000003512, type = VK_OBJECT_TYPE_SEMAPHORE; Object 1: handle = 0x7dcddbd0, type = VK_OBJECT_TYPE_QUEUE; Object 2: handle = 0x7dcddbd0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0xe825f293 | vkQueueSubmit2(): pSubmits[0].pSignalSemaphoreInfos[0] is signaling VkQueue 0x7dcddbd0[] (VkSemaphore 0xb95fc20000003512[]) that was previously signaled by VkQueue 0x7dcddbd0[] but has not since been waited on by any queue.
    Objects: 3
        [0] 0xb95fc20000003512, type: 5, name: NULL
        [1] 0x7dcddbd0, type: 4, name: NULL
        [2] 0x7dcddbd0, type: 4, name: NULL
VUID-vkQueueSubmit2-semaphore-03873(ERROR / SPEC): msgNum: -2139599761 - Validation Error: [ VUID-vkQueueSubmit2-semaphore-03873 ] Object 0: handle = 0x26cde100000035aa, type = VK_OBJECT_TYPE_SEMAPHORE; Object 1: handle = 0x7d59fab0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x80784c6f | vkQueueSubmit2(): pSubmits[0].pWaitSemaphoreInfos[0] Queue VkQueue 0x7d59fab0[] is waiting on semaphore (VkSemaphore 0x26cde100000035aa[]) that has no way to be signaled. The Vulkan spec states: Any semaphore member of any element of the pWaitSemaphoreInfos member of any element of pSubmits that was created with a VkSemaphoreTypeKHR of VK_SEMAPHORE_TYPE_BINARY_KHR must reference a semaphore signal operation that has been submitted for execution and any semaphore signal operations on which it depends (if any) must have also been submitted for execution (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkQueueSubmit2-semaphore-03873)
    Objects: 2
        [0] 0x26cde100000035aa, type: 5, name: NULL
        [1] 0x7d59fab0, type: 4, name: NULL
ScarecrowDM commented 1 year ago

Sorry for the bump, but in case someone needs a test case with a different game, the mod is also now available for Fallout 4. And yes, it doesn't work as well (it dies with the same _err:d3d12_validate_resource_flags: ALLOW_SIMULTANEOUS_ACCESS and ALLOW_DEPTHSTENCIL is not allowed message).

shinjitumala commented 6 months ago

Hi. Looks like the API returns success now but now the upscaler crashes at a different part of the mod in both DLSS and FSR2. I'm not sure if it's directly related to this issue but I've seen other users report the same crash as well.

CrashLogger Log (truncated, when PROTON_ENABLE_NVAPI=1 PROTON_HIDE_NVIDIA_GPU=0)

Skyrim SSE v1.6.640
CrashLoggerSSE v1-8-0-0 Feb  1 2023 00:20:05

Unhandled exception "EXCEPTION_ACCESS_VIOLATION" at 0x000033F1F0B4 SkyrimUpscaler.dll+008F0B4   mov rax, [rcx]

SYSTEM SPECS:
    OS: Microsoft Windows 10 Pro v10.0.19043
    CPU: GenuineIntel Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    GPU #1: Nvidia GA102 [GeForce RTX 3080]
    PHYSICAL MEMORY: 11.33 GB/31.28 GB

PROBABLE CALL STACK:
    [ 0] 0x000033F1F0B4        SkyrimUpscaler.dll+008F0B4   mov rax, [rcx] |  F:\GithubMods\DLSS\SkyrimUpscaler\src\DXGIProxy.cpp:71 ?GetBuffer@DXGISwapChainProxy@@UEAAJIAEBU_GUID@@PEAPEAX@Z F:\GithubMods\DLSS\SkyrimUpscaler\src\DXGIProxy.cpp:62 ?GetBuffer@DXGISwapChainProxy@@UEAAJIAEBU_GUID@@PEAPEAX@Z
    [ 1] 0x0000006C0144                 d3d11.dll+0050144
    [ 2] 0x000033ECE4EC        SkyrimUpscaler.dll+003E4EC   cmp byte ptr [0x0000000033FC1728], 0x00 |  F:\GithubMods\DLSS\SkyrimUpscaler\src\UpscalerHooks.cpp:341 ?thunk@D3D11CreateDeviceAndSwapChain_Hook@UpscalerHooks@@SAJPEAUIDXGIAdapter@@W4D3D_DRIVER_TYPE@@PEAUHINSTANCE__@@IPEBW4D3D_FEATURE_LEVEL@@IIPEBUDXGI_SWAP_CHAIN_DESC@@PEAPEAUIDXGISwapChain@@PEAPEAUID3D11Device@@PEAW46@PEAPEAUID3D11DeviceContext@@@Z
    [ 3] 0x00003A0C8BF4      SSEDisplayTweaks.dll+0028BF4
    [ 4] 0x000140DC03D5              SkyrimSE.exe+0DC03D5 -> 77396+0x2C5    mov rcx, [0x00000001430C0F88]

In the upscaler log, it successfully checks for GPU features. SkyrimUpscaler.log:

[info] Loaded plugin nvngx_dlss.dll 901906432
[info] Loaded plugin ffx_fsr2_api_x64.dll 711720960
[info] Loaded plugin ffx_fsr2_api_dx12_x64.dll 872218624
[info] Loaded plugin ffx_fsr2_api_vk_x64.dll 0
[info] Loaded plugin dxil.dll 0
[info] Loaded plugin dxcompiler.dll 0
[info] Loaded plugin XeFX_Loader.dll 817561600
[info] Loaded plugin XeFX.dll 875167744
[info] Loaded plugin libxess.dll 937426944
[info] Loaded plugin PDPerfPlugin.dll 875364352
[info] Installed upscaler hooks
[info] Calling original D3D11CreateDeviceAndSwapChain
[info] hk_IDXGIFactory_CreateSwapChain created original SwapChain : 3840 x 2160 Format: 28
[info] Cpp Message:Log has initialized
[info] Setup DirectX11 graphic device successfully!
[info] NVSDK_NGX_D3D11_Init = 0x00000001, info: NVSDK_NGX_Result_Success
[info] NVSDK_NGX_D3D11_GetCapabilityParameters = 0x00000001, info: NVSDK_NGX_Result_Success
[info] NVIDIA DLSS Minimum driver version was reported as : 445.0
[info] Create D3D11 Texture2D Success : 0x00000000
[info] m_RecommendedSettingsMap[0].OptimalRenderSizeX = 2560
[info] m_RecommendedSettingsMap[0].OptimalRenderSizeY = 1440
[info] id = 0 NGX_D3D11_CREATE_DLSS_EXT = 0x00000001, info: NVSDK_NGX_Result_Success
[info] NVSDK_NGX_Parameter_DLSSMode = 1
ScarecrowDM commented 6 months ago

Skyrim Upscaler runs through DX11 only now (at least for FSR2, although XeSS also works fine for me) so you are likely facing an unrelated issue.

KingKrouch commented 3 months ago

Sorry for the bump, but in case someone needs a test case with a different game, the mod is also now available for Fallout 4. And yes, it doesn't work as well (it dies with the same _err:d3d12_validate_resource_flags: ALLOW_SIMULTANEOUS_ACCESS and ALLOW_DEPTHSTENCIL is not allowed message).

I can confirm that this also happens with the FSR 3/DLSS 3/XeSS mod for Fallout 4.