[PATCH 2/7] wined3d: Return a texture from wined3d_swapchain_get_back_buffer.

Henri Verbeet hverbeet at gmail.com
Mon Aug 31 06:01:08 CDT 2015


On 31 August 2015 at 00:25, Stefan Dösinger <stefan at codeweavers.com> wrote:
> +        wined3d_surface = wined3d_surface_from_resource(wined3d_resource);
>          surface_impl = wined3d_surface_get_parent(wined3d_surface);
This works, but it's a bit silly. You can just use
wined3d_resource_get_parent().

> diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
> index ce09450..cfc1a09 100644
> --- a/dlls/dxgi/swapchain.c
> +++ b/dlls/dxgi/swapchain.c
> @@ -152,13 +154,15 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
>
>      EnterCriticalSection(&dxgi_cs);
>
> -    if (!(backbuffer = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
> +    if (!(texture = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
>              buffer_idx, WINED3D_BACKBUFFER_TYPE_MONO)))
>      {
>          LeaveCriticalSection(&dxgi_cs);
>          return DXGI_ERROR_INVALID_CALL;
>      }
>
> +    resource = wined3d_texture_get_sub_resource(texture, 0);
> +    backbuffer = wined3d_surface_from_resource(resource);
>      parent = wined3d_surface_get_parent(backbuffer);
>      hr = IUnknown_QueryInterface(parent, riid, surface);
>      LeaveCriticalSection(&dxgi_cs);
And here you don't even need the sub-resource, because you want the
(d3d11) texture in the first place. I.e., you can just use
wined3d_texture_get_parent().



More information about the wine-devel mailing list