diff --git a/vrclient_x64/gen_wrapper.py b/vrclient_x64/gen_wrapper.py index 16e3d058..68cc4db6 100755 --- a/vrclient_x64/gen_wrapper.py +++ b/vrclient_x64/gen_wrapper.py @@ -159,7 +159,7 @@ def ivrcompositor_post_present_handoff(cppname, method): return "ivrcompositor_post_present_handoff" def ivrcompositor_wait_get_poses(cppname, method): - for version in ["021", "022"]: + for version in ["016", "018", "019", "020", "021", "022"]: if version in cppname: return "ivrcompositor_wait_get_poses" return None diff --git a/vrclient_x64/vrclient_main.c b/vrclient_x64/vrclient_main.c index 1ad827e9..3bc25258 100644 --- a/vrclient_x64/vrclient_main.c +++ b/vrclient_x64/vrclient_main.c @@ -25,6 +25,7 @@ #include "flatapi.h" +#include "cppIVRClientCore_IVRClientCore_003.h" #include "cppIVRCompositor_IVRCompositor_021.h" #include "cppIVRCompositor_IVRCompositor_022.h" @@ -482,6 +483,14 @@ VRCompositorError ivrcompositor_008_submit( return cpp_func(linux_side, eye, api, texture, bounds, flags); } +static void *our_compositor; + +static void get_our_compositor(void) +{ + void *client_core = vrclient_VRClientCoreFactory("IVRClientCore_003", NULL); + our_compositor = cppIVRClientCore_IVRClientCore_003_GetGenericInterface(client_core, "IVRCompositor_022", NULL); +} + EVRCompositorError ivrcompositor_submit( EVRCompositorError (*cpp_func)(void *, EVREye, Texture_t *, VRTextureBounds_t *, EVRSubmitFlags), void *linux_side, EVREye eye, Texture_t *texture, VRTextureBounds_t *bounds, EVRSubmitFlags flags, @@ -514,6 +523,8 @@ EVRCompositorError ivrcompositor_submit( wine_texture->lpVtbl->GetDevice(wine_texture, &device); if (user_data->d3d11_device != device) { + void *timing_compositor = linux_side; + if (user_data->d3d11_device) FIXME("Previous submit was from different D3D11 device.\n"); @@ -534,17 +545,23 @@ EVRCompositorError ivrcompositor_submit( TRACE("Enabling explicit timing mode.\n"); switch (version) { + /* older, supported versions */ case 21: cppIVRCompositor_IVRCompositor_021_SetExplicitTimingMode(linux_side, VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff); break; - case 22: - cppIVRCompositor_IVRCompositor_022_SetExplicitTimingMode(linux_side, - VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff); - break; default: - FIXME("Version %u not supported.\n", version); - user_data->wined3d_device = NULL; + { + if(!our_compositor){ + TRACE("Performing hack for old compositor version %u.\n", version); + get_our_compositor(); + } + timing_compositor = our_compositor; + } + /* fall through, below version MUST match version in get_our_compositor() */ + case 22: + cppIVRCompositor_IVRCompositor_022_SetExplicitTimingMode(timing_compositor, + VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff); break; } } @@ -796,6 +813,7 @@ static CDECL void d3d11_explicit_timing_callback(const void *data, unsigned int { const struct explicit_timing_data *callback_data = data; EVRCompositorError error; + void *timing_compositor = callback_data->linux_side; TRACE("data {%p, %u}\n", data, data_size); @@ -804,11 +822,18 @@ static CDECL void d3d11_explicit_timing_callback(const void *data, unsigned int case 21: error = cppIVRCompositor_IVRCompositor_021_SubmitExplicitTimingData(callback_data->linux_side); break; - case 22: - error = cppIVRCompositor_IVRCompositor_022_SubmitExplicitTimingData(callback_data->linux_side); - break; default: - ERR("Unexpected version %#x\n", callback_data->version); + { + if(!our_compositor){ + TRACE("Performing hack for old compositor version %u.\n", callback_data->version); + get_our_compositor(); + } + timing_compositor = our_compositor; + } + /* fall through, below version MUST match version in get_our_compositor() */ + case 22: + error = cppIVRCompositor_IVRCompositor_022_SubmitExplicitTimingData(timing_compositor); + break; } if (error) diff --git a/vrclient_x64/winIVRCompositor.c b/vrclient_x64/winIVRCompositor.c index 6177f2b1..9122a14b 100644 --- a/vrclient_x64/winIVRCompositor.c +++ b/vrclient_x64/winIVRCompositor.c @@ -942,7 +942,7 @@ DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_020_WaitGetPoses, 28) EVRCompositorError __thiscall winIVRCompositor_IVRCompositor_020_WaitGetPoses(winIVRCompositor_IVRCompositor_020 *_this, TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount) { TRACE("%p\n", _this); - return cppIVRCompositor_IVRCompositor_020_WaitGetPoses(_this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount); + return ivrcompositor_wait_get_poses(cppIVRCompositor_IVRCompositor_020_WaitGetPoses, _this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount, 20, &_this->user_data); } DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_020_GetLastPoses, 28) @@ -1373,7 +1373,7 @@ DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_019_WaitGetPoses, 28) EVRCompositorError __thiscall winIVRCompositor_IVRCompositor_019_WaitGetPoses(winIVRCompositor_IVRCompositor_019 *_this, TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount) { TRACE("%p\n", _this); - return cppIVRCompositor_IVRCompositor_019_WaitGetPoses(_this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount); + return ivrcompositor_wait_get_poses(cppIVRCompositor_IVRCompositor_019_WaitGetPoses, _this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount, 19, &_this->user_data); } DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_019_GetLastPoses, 28) @@ -1795,7 +1795,7 @@ DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_018_WaitGetPoses, 28) EVRCompositorError __thiscall winIVRCompositor_IVRCompositor_018_WaitGetPoses(winIVRCompositor_IVRCompositor_018 *_this, TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount) { TRACE("%p\n", _this); - return cppIVRCompositor_IVRCompositor_018_WaitGetPoses(_this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount); + return ivrcompositor_wait_get_poses(cppIVRCompositor_IVRCompositor_018_WaitGetPoses, _this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount, 18, &_this->user_data); } DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_018_GetLastPoses, 28) @@ -2199,7 +2199,7 @@ DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_016_WaitGetPoses, 28) EVRCompositorError __thiscall winIVRCompositor_IVRCompositor_016_WaitGetPoses(winIVRCompositor_IVRCompositor_016 *_this, TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount) { TRACE("%p\n", _this); - return cppIVRCompositor_IVRCompositor_016_WaitGetPoses(_this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount); + return ivrcompositor_wait_get_poses(cppIVRCompositor_IVRCompositor_016_WaitGetPoses, _this->linux_side, pRenderPoseArray, unRenderPoseArrayCount, pGamePoseArray, unGamePoseArrayCount, 16, &_this->user_data); } DEFINE_THISCALL_WRAPPER(winIVRCompositor_IVRCompositor_016_GetLastPoses, 28)