From 08c3f24be4955f9fc305d59b62494151db7b8cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 27 Sep 2023 10:41:04 +0200 Subject: [PATCH] vrclient: Inline some IVROverlay override code. CW-Bug-Id: #22729 --- vrclient_x64/vrclient_x64/vroverlay_manual.c | 317 ++++++++++++------- 1 file changed, 198 insertions(+), 119 deletions(-) diff --git a/vrclient_x64/vrclient_x64/vroverlay_manual.c b/vrclient_x64/vrclient_x64/vroverlay_manual.c index c967756d..df86d644 100644 --- a/vrclient_x64/vrclient_x64/vroverlay_manual.c +++ b/vrclient_x64/vrclient_x64/vroverlay_manual.c @@ -43,108 +43,79 @@ WINE_DEFAULT_DEBUG_CHANNEL(vrclient); -static EVROverlayError ivroverlay_set_overlay_texture_dxvk( EVROverlayError (*cpp_func)( void *, VROverlayHandle_t, const Texture_t * ), - void *linux_side, VROverlayHandle_t overlayHandle, - const Texture_t *texture, unsigned int version, - IDXGIVkInteropSurface *dxvk_surface ) +struct set_overlay_texture_state { + struct Texture_t texture; struct VRVulkanTextureData_t vkdata; - IDXGIVkInteropDevice *dxvk_device; - struct Texture_t vktexture; VkImageLayout image_layout; - VkImageCreateInfo image_info; VkImageSubresourceRange subresources; + IDXGIVkInteropSurface *dxvk_surface; + IDXGIVkInteropDevice *dxvk_device; +}; - EVRCompositorError err; +static void load_overlay_texture_dxvk( const Texture_t *texture, struct set_overlay_texture_state *state ) +{ + VkImageCreateInfo image_info; + IUnknown *texture_iface; - vktexture = vrclient_translate_texture_dxvk( texture, &vkdata, dxvk_surface, &dxvk_device, &image_layout, &image_info ); + TRACE( "texture = %p\n", texture ); - subresources.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - subresources.baseMipLevel = 0; - subresources.levelCount = image_info.mipLevels; - subresources.baseArrayLayer = 0; - subresources.layerCount = image_info.arrayLayers; + if (!(texture_iface = texture->handle)) + { + WARN( "No D3D11 texture %p.\n", texture ); + return; + } - dxvk_device->lpVtbl->TransitionSurfaceLayout( dxvk_device, dxvk_surface, &subresources, - image_layout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ); - dxvk_device->lpVtbl->FlushRenderingCommands( dxvk_device ); - dxvk_device->lpVtbl->LockSubmissionQueue( dxvk_device ); + if (FAILED(texture_iface->lpVtbl->QueryInterface( texture_iface, &IID_IDXGIVkInteropSurface, + (void **)&state->dxvk_surface ))) + { + WARN( "Invalid D3D11 texture %p.\n", texture ); + return; + } - err = cpp_func( linux_side, overlayHandle, &vktexture ); + state->texture = vrclient_translate_texture_dxvk( texture, &state->vkdata, state->dxvk_surface, &state->dxvk_device, + &state->image_layout, &image_info ); - dxvk_device->lpVtbl->ReleaseSubmissionQueue( dxvk_device ); - dxvk_device->lpVtbl->TransitionSurfaceLayout( dxvk_device, dxvk_surface, &subresources, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, image_layout ); + state->subresources.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + state->subresources.baseMipLevel = 0; + state->subresources.levelCount = image_info.mipLevels; + state->subresources.baseArrayLayer = 0; + state->subresources.layerCount = image_info.arrayLayers; - dxvk_device->lpVtbl->Release( dxvk_device ); - dxvk_surface->lpVtbl->Release( dxvk_surface ); - return err; + state->dxvk_device->lpVtbl->TransitionSurfaceLayout( state->dxvk_device, state->dxvk_surface, &state->subresources, + state->image_layout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ); + state->dxvk_device->lpVtbl->FlushRenderingCommands( state->dxvk_device ); + state->dxvk_device->lpVtbl->LockSubmissionQueue( state->dxvk_device ); } -static EVROverlayError ivroverlay_set_overlay_texture_vulkan( EVROverlayError (*cpp_func)( void *, VROverlayHandle_t, const Texture_t * ), - void *linux_side, VROverlayHandle_t overlay_handle, - const Texture_t *texture, unsigned int version ) +static void free_unix_overlay_texture_dxvk( struct set_overlay_texture_state *state ) { - struct VRVulkanTextureData_t our_vkdata, *their_vkdata; - Texture_t our_texture; + if (!state->dxvk_device) return; + + state->dxvk_device->lpVtbl->ReleaseSubmissionQueue( state->dxvk_device ); + state->dxvk_device->lpVtbl->TransitionSurfaceLayout( state->dxvk_device, state->dxvk_surface, &state->subresources, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, state->image_layout ); + state->dxvk_device->lpVtbl->Release( state->dxvk_device ); + state->dxvk_surface->lpVtbl->Release( state->dxvk_surface ); +} + +static void load_overlay_texture_vulkan( const Texture_t *texture, struct set_overlay_texture_state *state ) +{ + struct VRVulkanTextureData_t *their_vkdata; + + TRACE( "texture = %p\n", texture ); their_vkdata = texture->handle; - our_vkdata = *their_vkdata; - our_vkdata.m_pDevice = get_native_VkDevice( our_vkdata.m_pDevice ); - our_vkdata.m_pPhysicalDevice = get_native_VkPhysicalDevice( our_vkdata.m_pPhysicalDevice ); - our_vkdata.m_pInstance = get_native_VkInstance( our_vkdata.m_pInstance ); - our_vkdata.m_pQueue = get_native_VkQueue( our_vkdata.m_pQueue ); + state->vkdata = *their_vkdata; + state->vkdata.m_pDevice = get_native_VkDevice( their_vkdata->m_pDevice ); + state->vkdata.m_pPhysicalDevice = get_native_VkPhysicalDevice( their_vkdata->m_pPhysicalDevice ); + state->vkdata.m_pInstance = get_native_VkInstance( their_vkdata->m_pInstance ); + state->vkdata.m_pQueue = get_native_VkQueue( their_vkdata->m_pQueue ); - our_texture = *texture; - our_texture.handle = &our_vkdata; - - return cpp_func( linux_side, overlay_handle, &our_texture ); -} - -static EVROverlayError ivroverlay_set_overlay_texture( EVROverlayError (*cpp_func)( void *, VROverlayHandle_t, const Texture_t * ), - void *linux_side, VROverlayHandle_t overlayHandle, - const Texture_t *texture, unsigned int version ) -{ - IUnknown *texture_iface; - HRESULT hr; - - TRACE( "%p, overlayHandle = %s, texture = %p\n", linux_side, wine_dbgstr_longlong( overlayHandle ), texture ); - - switch (texture->eType) - { - case TextureType_DirectX: - { - IDXGIVkInteropSurface *dxvk_surface; - - TRACE( "D3D11\n" ); - - if (!texture->handle) - { - WARN( "No D3D11 texture %p.\n", texture ); - return cpp_func( linux_side, overlayHandle, texture ); - } - - texture_iface = texture->handle; - - if (SUCCEEDED(hr = texture_iface->lpVtbl->QueryInterface( texture_iface, &IID_IDXGIVkInteropSurface, - (void **)&dxvk_surface ))) - { - return ivroverlay_set_overlay_texture_dxvk( cpp_func, linux_side, overlayHandle, texture, version, dxvk_surface ); - } - - WARN( "Invalid D3D11 texture %p.\n", texture ); - return cpp_func( linux_side, overlayHandle, texture ); - } - - case TextureType_Vulkan: - TRACE( "Vulkan\n" ); - return ivroverlay_set_overlay_texture_vulkan( cpp_func, linux_side, overlayHandle, texture, version ); - - default: - return cpp_func( linux_side, overlayHandle, texture ); - } + state->texture = *texture; + state->texture.handle = &state->vkdata; } VROverlayError __thiscall winIVROverlay_IVROverlay_001_SetOverlayTexture( struct w_steam_iface *_this, @@ -194,179 +165,287 @@ VROverlayError __thiscall winIVROverlay_IVROverlay_005_SetOverlayTexture( struct EVROverlayError __thiscall winIVROverlay_IVROverlay_007_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_007_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 7 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_007_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_008_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_008_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 8 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_008_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_010_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_010_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 10 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_010_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_011_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_011_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 11 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_011_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_012_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_012_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 12 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_012_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_013_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_013_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 13 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_013_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_014_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_014_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 14 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_014_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_016_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_016_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 16 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_016_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_017_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_017_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 17 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_017_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_018_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_018_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 18 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_018_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_019_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_019_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 19 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_019_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_020_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_020_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 20 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_020_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_021_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_021_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 21 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_021_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_022_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_022_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 22 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_022_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_024_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_024_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 24 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_024_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_025_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_025_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 25 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_025_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_026_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_026_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 26 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_026_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; } EVROverlayError __thiscall winIVROverlay_IVROverlay_027_SetOverlayTexture( struct w_steam_iface *_this, VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) { + struct set_overlay_texture_state state = {.texture = *pTexture}; EVROverlayError _ret; + TRACE( "%p\n", _this ); - _ret = ivroverlay_set_overlay_texture( cppIVROverlay_IVROverlay_027_SetOverlayTexture, - _this->u_iface, ulOverlayHandle, pTexture, 27 ); + + if (pTexture->eType == TextureType_DirectX) load_overlay_texture_dxvk( pTexture, &state ); + if (pTexture->eType == TextureType_Vulkan) load_overlay_texture_vulkan( pTexture, &state ); + _ret = cppIVROverlay_IVROverlay_027_SetOverlayTexture( _this->u_iface, ulOverlayHandle, &state.texture ); + if (pTexture->eType == TextureType_DirectX) free_unix_overlay_texture_dxvk( &state ); + return _ret; }