From 231c4b7112128053b12016961e10d28062ea73fc Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 1 May 2024 15:47:03 -0600 Subject: [PATCH] wineopenxr: Lock d3d11 device in xrAcquireSwapchainImage(). CW-Bug-Id: #23491 --- wineopenxr/make_openxr | 1 + wineopenxr/openxr.c | 15 +++++++++++++++ wineopenxr/openxr_thunks.c | 9 --------- wineopenxr/openxr_thunks.h | 1 + 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/wineopenxr/make_openxr b/wineopenxr/make_openxr index 74e56554..c6b3dda3 100755 --- a/wineopenxr/make_openxr +++ b/wineopenxr/make_openxr @@ -176,6 +176,7 @@ FUNCTION_OVERRIDES = { "xrDestroySwapchain" : {"dispatch" : True, "driver" : True, "thunk" : False}, "xrEndFrame" : {"dispatch" : True, "driver" : True, "thunk" : False}, "xrBeginFrame" : {"dispatch" : True, "driver" : True, "thunk" : False}, + "xrAcquireSwapchainImage" : {"dispatch" : True, "driver" : True, "thunk" : False}, } NOT_OUR_FUNCTIONS = [ diff --git a/wineopenxr/openxr.c b/wineopenxr/openxr.c index 24e55f50..a4a50550 100644 --- a/wineopenxr/openxr.c +++ b/wineopenxr/openxr.c @@ -1894,6 +1894,21 @@ XrResult WINAPI wine_xrBeginFrame(XrSession session, const XrFrameBeginInfo *fra return ret; } +XrResult WINAPI wine_xrAcquireSwapchainImage(XrSwapchain swapchain, const XrSwapchainImageAcquireInfo *acquireInfo, uint32_t *index) +{ + wine_XrSession *wine_session = ((wine_XrSwapchain *)swapchain)->wine_session; + IDXGIVkInteropDevice2 *dxvk_device; + XrResult ret; + + WINE_TRACE("%p, %p, %p\n", swapchain, acquireInfo, index); + if ((dxvk_device = wine_session->wine_instance->dxvk_device)) + dxvk_device->lpVtbl->LockSubmissionQueue(dxvk_device); + ret = xrAcquireSwapchainImage(((wine_XrSwapchain *)swapchain)->swapchain, acquireInfo, index); + if (dxvk_device) + dxvk_device->lpVtbl->ReleaseSubmissionQueue(dxvk_device); + return ret; +} + /* wineopenxr API */ XrResult WINAPI __wineopenxr_GetVulkanInstanceExtensions(uint32_t buflen, uint32_t *outlen, char *buf) { diff --git a/wineopenxr/openxr_thunks.c b/wineopenxr/openxr_thunks.c index 344532fc..2d7e2a96 100644 --- a/wineopenxr/openxr_thunks.c +++ b/wineopenxr/openxr_thunks.c @@ -162,15 +162,6 @@ static XrResult WINAPI wine_xrAcquireEnvironmentDepthImageMETA(XrEnvironmentDept return ret; } -XrResult WINAPI wine_xrAcquireSwapchainImage(XrSwapchain swapchain, const XrSwapchainImageAcquireInfo *acquireInfo, uint32_t *index) -{ - XrResult ret; - - WINE_TRACE("%p, %p, %p\n", swapchain, acquireInfo, index); - ret = xrAcquireSwapchainImage(((wine_XrSwapchain *)swapchain)->swapchain, acquireInfo, index); - return ret; -} - static XrResult WINAPI wine_xrApplyForceFeedbackCurlMNDX(XrHandTrackerEXT handTracker, const XrForceFeedbackCurlApplyLocationsMNDX *locations) { XrResult ret; diff --git a/wineopenxr/openxr_thunks.h b/wineopenxr/openxr_thunks.h index 9023a095..50f78c69 100644 --- a/wineopenxr/openxr_thunks.h +++ b/wineopenxr/openxr_thunks.h @@ -25,6 +25,7 @@ #define WINE_XR_VERSION XR_API_VERSION_1_1 /* Functions for which we have custom implementations outside of the thunks. */ +XrResult WINAPI wine_xrAcquireSwapchainImage(XrSwapchain swapchain, const XrSwapchainImageAcquireInfo *acquireInfo, uint32_t *index); XrResult WINAPI wine_xrBeginFrame(XrSession session, const XrFrameBeginInfo *frameBeginInfo); XrResult WINAPI wine_xrConvertTimeToWin32PerformanceCounterKHR(XrInstance instance, XrTime time, LARGE_INTEGER *performanceCounter); XrResult WINAPI wine_xrConvertWin32PerformanceCounterToTimeKHR(XrInstance instance, const LARGE_INTEGER *performanceCounter, XrTime *time);