From f0887911a35df3170972564c64d10597bd833535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 27 Sep 2023 08:40:10 +0200 Subject: [PATCH] vrclient: Use manual methods for IVRRenderModels overrides. CW-Bug-Id: #22729 --- vrclient_x64/gen_wrapper.py | 18 +---- vrclient_x64/vrclient_x64/vrclient_private.h | 10 --- .../vrclient_x64/vrrendermodels_manual.c | 76 ++++++++++++++++--- .../vrclient_x64/winIVRRenderModels.c | 58 ++------------ 4 files changed, 78 insertions(+), 84 deletions(-) diff --git a/vrclient_x64/gen_wrapper.py b/vrclient_x64/gen_wrapper.py index b014294c..eabfb145 100755 --- a/vrclient_x64/gen_wrapper.py +++ b/vrclient_x64/gen_wrapper.py @@ -257,6 +257,9 @@ all_versions = {} MANUAL_METHODS = { "IVRSystem_GetDXGIOutputInfo": True, "IVRSystem_GetOutputDevice": lambda ver, abi: ver > 16, + "IVRRenderModels_LoadTextureD3D11_Async": True, + "IVRRenderModels_FreeTextureD3D11": True, + "IVRRenderModels_LoadIntoTextureD3D11_Async": True, } @@ -313,18 +316,6 @@ def ivrcompositor_wait_get_poses(cppname, method): def ivrcompositor_get_vulkan_device_extensions_required(cppname, method): return "ivrcompositor_get_vulkan_device_extensions_required" -def ivrrendermodels_load_texture_d3d11_async(cppname, method): - assert "004" in cppname or "005" in cppname or "006" in cppname - return "ivrrendermodels_load_texture_d3d11_async" - -def ivrrendermodels_free_texture_d3d11(cppname, method): - assert "004" in cppname or "005" in cppname or "006" in cppname - return "ivrrendermodels_free_texture_d3d11" - -def ivrrendermodels_load_into_texture_d3d11_async(cppname, method): - assert "005" in cppname or "006" in cppname - return "ivrrendermodels_load_into_texture_d3d11_async" - def ivrmailbox_undoc3(cppname, method): assert "001" in cppname return "ivrmailbox_undoc3" @@ -371,9 +362,6 @@ method_overrides = [ ("IVRCompositor", "PostPresentHandoff", ivrcompositor_post_present_handoff), ("IVRCompositor", "WaitGetPoses", ivrcompositor_wait_get_poses), ("IVRCompositor", "GetVulkanDeviceExtensionsRequired", ivrcompositor_get_vulkan_device_extensions_required), - ("IVRRenderModels", "LoadTextureD3D11_Async", ivrrendermodels_load_texture_d3d11_async), - ("IVRRenderModels", "FreeTextureD3D11", ivrrendermodels_free_texture_d3d11), - ("IVRRenderModels", "LoadIntoTextureD3D11_Async", ivrrendermodels_load_into_texture_d3d11_async), ("IVRMailbox", "undoc3", ivrmailbox_undoc3), ("IVROverlay", "SetOverlayTexture", ivroverlay_set_overlay_texture), ("IVRInput", "GetDigitalActionData", ivrinput_get_digital_action_data), diff --git a/vrclient_x64/vrclient_x64/vrclient_private.h b/vrclient_x64/vrclient_x64/vrclient_private.h index 2b1e3ca7..1b1374ad 100644 --- a/vrclient_x64/vrclient_x64/vrclient_private.h +++ b/vrclient_x64/vrclient_x64/vrclient_private.h @@ -145,16 +145,6 @@ uint32_t ivrcompositor_get_vulkan_device_extensions_required( void *linux_side, VkPhysicalDevice_T *phys_dev, char *value, uint32_t bufsize, unsigned int version); -EVRRenderModelError ivrrendermodels_load_texture_d3d11_async( - EVRRenderModelError (*cpp_func)(void *, TextureID_t, void *, void **), - void *linux_side, TextureID_t texture_id, void *d3d11_device, void **dst_texture, unsigned int version); -EVRRenderModelError ivrrendermodels_load_into_texture_d3d11_async( - EVRRenderModelError (*cpp_func)(void *, TextureID_t, void *), - void *linux_side, TextureID_t texture_id, void *dst_texture, unsigned int version); -void ivrrendermodels_free_texture_d3d11( - void (*cpp_func)(void *, void *), - void *linux_side, void *dst_texture, unsigned int version); - EVROverlayError ivroverlay_set_overlay_texture( EVROverlayError (*cpp_func)(void *, VROverlayHandle_t, const Texture_t *), void *linux_side, VROverlayHandle_t overlayHandle, const Texture_t *texture, diff --git a/vrclient_x64/vrclient_x64/vrrendermodels_manual.c b/vrclient_x64/vrclient_x64/vrrendermodels_manual.c index 9ec0e1d1..a6cda608 100644 --- a/vrclient_x64/vrclient_x64/vrrendermodels_manual.c +++ b/vrclient_x64/vrclient_x64/vrrendermodels_manual.c @@ -6,6 +6,7 @@ #include "winbase.h" #include "wine/debug.h" +#include "dxvk-interop.h" #include "vrclient_defs.h" #include "vrclient_private.h" @@ -150,9 +151,8 @@ static void free_linux_texture_map( void *linux_side, struct winRenderModel_Text } } -EVRRenderModelError ivrrendermodels_load_texture_d3d11_async( EVRRenderModelError (*cpp_func)( void *, TextureID_t, void *, void ** ), - void *linux_side, TextureID_t texture_id, - void *device, void **dst_texture, unsigned int version ) +static EVRRenderModelError ivrrendermodels_load_texture_d3d11_async( void *linux_side, TextureID_t texture_id, + void *device, void **dst_texture, unsigned int version ) { struct winRenderModel_TextureMap_t_1237 *texture_map; EVRRenderModelError error; @@ -209,9 +209,8 @@ EVRRenderModelError ivrrendermodels_load_texture_d3d11_async( EVRRenderModelErro return error; } -EVRRenderModelError ivrrendermodels_load_into_texture_d3d11_async( EVRRenderModelError (*cpp_func)( void *, TextureID_t, void * ), - void *linux_side, TextureID_t texture_id, - void *dst_texture, unsigned int version ) +static EVRRenderModelError ivrrendermodels_load_into_texture_d3d11_async( void *linux_side, TextureID_t texture_id, + void *dst_texture, unsigned int version ) { struct winRenderModel_TextureMap_t_1237 *texture_map; IUnknown *unk = dst_texture; @@ -248,9 +247,68 @@ EVRRenderModelError ivrrendermodels_load_into_texture_d3d11_async( EVRRenderMode return error; } -void ivrrendermodels_free_texture_d3d11( void (*cpp_func)( void *, void * ), void *linux_side, - void *dst_texture, unsigned int version ) +EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_004_LoadTextureD3D11_Async( struct w_steam_iface *_this, TextureID_t textureId, + void *pD3D11Device, void **ppD3D11Texture2D ) { - ID3D11Texture2D *d3d11_texture = dst_texture; + EVRRenderModelError _ret; + TRACE( "%p\n", _this ); + _ret = ivrrendermodels_load_texture_d3d11_async( _this->u_iface, textureId, pD3D11Device, ppD3D11Texture2D, 4 ); + return _ret; +} + +EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_005_LoadTextureD3D11_Async( struct w_steam_iface *_this, TextureID_t textureId, + void *pD3D11Device, void **ppD3D11Texture2D ) +{ + EVRRenderModelError _ret; + TRACE( "%p\n", _this ); + _ret = ivrrendermodels_load_texture_d3d11_async( _this->u_iface, textureId, pD3D11Device, ppD3D11Texture2D, 5 ); + return _ret; +} + +EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_006_LoadTextureD3D11_Async( struct w_steam_iface *_this, TextureID_t textureId, + void *pD3D11Device, void **ppD3D11Texture2D ) +{ + EVRRenderModelError _ret; + TRACE( "%p\n", _this ); + _ret = ivrrendermodels_load_texture_d3d11_async( _this->u_iface, textureId, pD3D11Device, ppD3D11Texture2D, 6 ); + return _ret; +} + +void __thiscall winIVRRenderModels_IVRRenderModels_004_FreeTextureD3D11( struct w_steam_iface *_this, void *pD3D11Texture2D ) +{ + ID3D11Texture2D *d3d11_texture = pD3D11Texture2D; + TRACE( "%p\n", _this ); + d3d11_texture->lpVtbl->Release( d3d11_texture ); +} + +EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_005_LoadIntoTextureD3D11_Async( struct w_steam_iface *_this, TextureID_t textureId, + void *pDstTexture ) +{ + EVRRenderModelError _ret; + TRACE( "%p\n", _this ); + _ret = ivrrendermodels_load_into_texture_d3d11_async( _this->u_iface, textureId, pDstTexture, 5 ); + return _ret; +} + +void __thiscall winIVRRenderModels_IVRRenderModels_005_FreeTextureD3D11( struct w_steam_iface *_this, void *pD3D11Texture2D ) +{ + ID3D11Texture2D *d3d11_texture = pD3D11Texture2D; + TRACE( "%p\n", _this ); + d3d11_texture->lpVtbl->Release( d3d11_texture ); +} + +EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_006_LoadIntoTextureD3D11_Async( struct w_steam_iface *_this, TextureID_t textureId, + void *pDstTexture ) +{ + EVRRenderModelError _ret; + TRACE( "%p\n", _this ); + _ret = ivrrendermodels_load_into_texture_d3d11_async( _this->u_iface, textureId, pDstTexture, 6 ); + return _ret; +} + +void __thiscall winIVRRenderModels_IVRRenderModels_006_FreeTextureD3D11( struct w_steam_iface *_this, void *pD3D11Texture2D ) +{ + ID3D11Texture2D *d3d11_texture = pD3D11Texture2D; + TRACE( "%p\n", _this ); d3d11_texture->lpVtbl->Release( d3d11_texture ); } diff --git a/vrclient_x64/vrclient_x64/winIVRRenderModels.c b/vrclient_x64/vrclient_x64/winIVRRenderModels.c index 83c5157d..34f64a40 100644 --- a/vrclient_x64/vrclient_x64/winIVRRenderModels.c +++ b/vrclient_x64/vrclient_x64/winIVRRenderModels.c @@ -335,19 +335,9 @@ void __thiscall winIVRRenderModels_IVRRenderModels_004_FreeTexture(struct w_stea cppIVRRenderModels_IVRRenderModels_004_FreeTexture(_this->u_iface, pTexture); } -EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_004_LoadTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D) -{ - EVRRenderModelError _ret; - TRACE("%p\n", _this); - _ret = ivrrendermodels_load_texture_d3d11_async(cppIVRRenderModels_IVRRenderModels_004_LoadTextureD3D11_Async, _this->u_iface, textureId, pD3D11Device, ppD3D11Texture2D, 4); - return _ret; -} +extern EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_004_LoadTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D); -void __thiscall winIVRRenderModels_IVRRenderModels_004_FreeTextureD3D11(struct w_steam_iface *_this, void *pD3D11Texture2D) -{ - TRACE("%p\n", _this); - ivrrendermodels_free_texture_d3d11(cppIVRRenderModels_IVRRenderModels_004_FreeTextureD3D11, _this->u_iface, pD3D11Texture2D, 4); -} +extern void __thiscall winIVRRenderModels_IVRRenderModels_004_FreeTextureD3D11(struct w_steam_iface *_this, void *pD3D11Texture2D); uint32_t __thiscall winIVRRenderModels_IVRRenderModels_004_GetRenderModelName(struct w_steam_iface *_this, uint32_t unRenderModelIndex, char *pchRenderModelName, uint32_t unRenderModelNameLen) { @@ -539,27 +529,11 @@ void __thiscall winIVRRenderModels_IVRRenderModels_005_FreeTexture(struct w_stea cppIVRRenderModels_IVRRenderModels_005_FreeTexture(_this->u_iface, pTexture); } -EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_005_LoadTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D) -{ - EVRRenderModelError _ret; - TRACE("%p\n", _this); - _ret = ivrrendermodels_load_texture_d3d11_async(cppIVRRenderModels_IVRRenderModels_005_LoadTextureD3D11_Async, _this->u_iface, textureId, pD3D11Device, ppD3D11Texture2D, 5); - return _ret; -} +extern EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_005_LoadTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D); -EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_005_LoadIntoTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pDstTexture) -{ - EVRRenderModelError _ret; - TRACE("%p\n", _this); - _ret = ivrrendermodels_load_into_texture_d3d11_async(cppIVRRenderModels_IVRRenderModels_005_LoadIntoTextureD3D11_Async, _this->u_iface, textureId, pDstTexture, 5); - return _ret; -} +extern EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_005_LoadIntoTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pDstTexture); -void __thiscall winIVRRenderModels_IVRRenderModels_005_FreeTextureD3D11(struct w_steam_iface *_this, void *pD3D11Texture2D) -{ - TRACE("%p\n", _this); - ivrrendermodels_free_texture_d3d11(cppIVRRenderModels_IVRRenderModels_005_FreeTextureD3D11, _this->u_iface, pD3D11Texture2D, 5); -} +extern void __thiscall winIVRRenderModels_IVRRenderModels_005_FreeTextureD3D11(struct w_steam_iface *_this, void *pD3D11Texture2D); uint32_t __thiscall winIVRRenderModels_IVRRenderModels_005_GetRenderModelName(struct w_steam_iface *_this, uint32_t unRenderModelIndex, char *pchRenderModelName, uint32_t unRenderModelNameLen) { @@ -784,27 +758,11 @@ void __thiscall winIVRRenderModels_IVRRenderModels_006_FreeTexture(struct w_stea cppIVRRenderModels_IVRRenderModels_006_FreeTexture(_this->u_iface, pTexture); } -EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_006_LoadTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D) -{ - EVRRenderModelError _ret; - TRACE("%p\n", _this); - _ret = ivrrendermodels_load_texture_d3d11_async(cppIVRRenderModels_IVRRenderModels_006_LoadTextureD3D11_Async, _this->u_iface, textureId, pD3D11Device, ppD3D11Texture2D, 6); - return _ret; -} +extern EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_006_LoadTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D); -EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_006_LoadIntoTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pDstTexture) -{ - EVRRenderModelError _ret; - TRACE("%p\n", _this); - _ret = ivrrendermodels_load_into_texture_d3d11_async(cppIVRRenderModels_IVRRenderModels_006_LoadIntoTextureD3D11_Async, _this->u_iface, textureId, pDstTexture, 6); - return _ret; -} +extern EVRRenderModelError __thiscall winIVRRenderModels_IVRRenderModels_006_LoadIntoTextureD3D11_Async(struct w_steam_iface *_this, TextureID_t textureId, void *pDstTexture); -void __thiscall winIVRRenderModels_IVRRenderModels_006_FreeTextureD3D11(struct w_steam_iface *_this, void *pD3D11Texture2D) -{ - TRACE("%p\n", _this); - ivrrendermodels_free_texture_d3d11(cppIVRRenderModels_IVRRenderModels_006_FreeTextureD3D11, _this->u_iface, pD3D11Texture2D, 6); -} +extern void __thiscall winIVRRenderModels_IVRRenderModels_006_FreeTextureD3D11(struct w_steam_iface *_this, void *pD3D11Texture2D); uint32_t __thiscall winIVRRenderModels_IVRRenderModels_006_GetRenderModelName(struct w_steam_iface *_this, uint32_t unRenderModelIndex, char *pchRenderModelName, uint32_t unRenderModelNameLen) {