From cce9c8b3088a438dec86d499950002e2f0e95076 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 1 May 2024 15:38:12 -0600 Subject: [PATCH] wineopenxr: Lock d3d11 device in xrBeginFrame(). CW-Bug-Id: #23491 --- wineopenxr/make_openxr | 1 + wineopenxr/openxr.c | 16 ++++++++++++++++ wineopenxr/openxr_thunks.c | 9 --------- wineopenxr/openxr_thunks.h | 1 + 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/wineopenxr/make_openxr b/wineopenxr/make_openxr index c60d3b1f..74e56554 100755 --- a/wineopenxr/make_openxr +++ b/wineopenxr/make_openxr @@ -175,6 +175,7 @@ FUNCTION_OVERRIDES = { "xrCreateSwapchain" : {"dispatch" : True, "driver" : True, "thunk" : False}, "xrDestroySwapchain" : {"dispatch" : True, "driver" : True, "thunk" : False}, "xrEndFrame" : {"dispatch" : True, "driver" : True, "thunk" : False}, + "xrBeginFrame" : {"dispatch" : True, "driver" : True, "thunk" : False}, } NOT_OUR_FUNCTIONS = [ diff --git a/wineopenxr/openxr.c b/wineopenxr/openxr.c index cc4a2393..24e55f50 100644 --- a/wineopenxr/openxr.c +++ b/wineopenxr/openxr.c @@ -1878,6 +1878,22 @@ XrResult WINAPI wine_xrEndFrame(XrSession session, const XrFrameEndInfo *frameEn return res; } +XrResult WINAPI wine_xrBeginFrame(XrSession session, const XrFrameBeginInfo *frameBeginInfo) +{ + wine_XrSession *wine_session = (wine_XrSession *)session; + IDXGIVkInteropDevice2 *dxvk_device; + XrResult ret; + + WINE_TRACE("%p, %p\n", session, frameBeginInfo); + + if ((dxvk_device = wine_session->wine_instance->dxvk_device)) + dxvk_device->lpVtbl->LockSubmissionQueue(dxvk_device); + ret = xrBeginFrame(((wine_XrSession *)session)->session, frameBeginInfo); + 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 4ee3f595..344532fc 100644 --- a/wineopenxr/openxr_thunks.c +++ b/wineopenxr/openxr_thunks.c @@ -207,15 +207,6 @@ XrResult WINAPI wine_xrAttachSessionActionSets(XrSession session, const XrSessio return ret; } -XrResult WINAPI wine_xrBeginFrame(XrSession session, const XrFrameBeginInfo *frameBeginInfo) -{ - XrResult ret; - - WINE_TRACE("%p, %p\n", session, frameBeginInfo); - ret = xrBeginFrame(((wine_XrSession *)session)->session, frameBeginInfo); - return ret; -} - static XrResult WINAPI wine_xrBeginPlaneDetectionEXT(XrPlaneDetectorEXT planeDetector, const XrPlaneDetectorBeginInfoEXT *beginInfo) { XrResult ret; diff --git a/wineopenxr/openxr_thunks.h b/wineopenxr/openxr_thunks.h index ff0a90fc..9023a095 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_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); XrResult WINAPI wine_xrCreateApiLayerInstance(const XrInstanceCreateInfo *info, const XrApiLayerCreateInfo *layerInfo, XrInstance *instance);