On Mon, Jun 24, 2019 at 4:24 PM Conor McCarthy <cmccarthy(a)codeweavers.com> wrote:
static DXGI_FORMAT dxgi_format_from_vk_format(VkFormat vk_format) @@ -2177,17 +2181,122 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetBuffer(IDXGISwapChain3 *ifac static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d12_swapchain_SetFullscreenState(IDXGISwapChain3 *iface, BOOL fullscreen, IDXGIOutput *target)
If possible, we would like to share more code with wined3d instead of copying wined3d_swapchain_set_fullscreen() to d3d12_swapchain_SetFullscreenState().
+static HRESULT d3d12_swapchain_fullscreen_init(struct d3d12_swapchain *swapchain) +{ + IDXGISwapChain3 *iface = &swapchain->IDXGISwapChain3_iface; + IDXGIOutput *output; + HRESULT hr; + + if (FAILED(hr = d3d12_swapchain_GetContainingOutput(iface, &output))) + { + ERR("Failed to get containing output, hr %#x.\n", hr); + return hr; + } + + if (FAILED(hr = dxgi_output_get_display_mode(output, &swapchain->original_mode))) + ERR("Failed to get current display mode, hr %#x.\n", hr); + + IDXGIOutput_Release(output); + + return hr; +}
This probably should go into d3d12_swapchain_init().
+ if(FAILED(hr = d3d12_swapchain_fullscreen_init(object)))
Coding style.
+ { + heap_free(object); + return hr; + }
This introduces a memory leak. All objects in d3d12_swapchain structure are leaked.