[PATCH 6/7] dxgi: Store parents in textures.

Stefan Dösinger stefan at codeweavers.com
Sun Aug 30 17:25:04 CDT 2015


wined3d_surface_get_container will be removed again in the next patch.
---
 dlls/d3d11/device.c       |  2 +-
 dlls/dxgi/device.c        |  4 +++-
 dlls/dxgi/swapchain.c     | 12 ++----------
 dlls/wined3d/surface.c    |  5 +++++
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  1 +
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 9067de9..e9c7cc7 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2875,7 +2875,7 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent
     TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n",
             device_parent, container_parent, surface, parent, parent_ops);
 
-    *parent = container_parent;
+    *parent = NULL;
     *parent_ops = &d3d10_null_wined3d_parent_ops;
 
     return S_OK;
diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index 580baf2..0252a66 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -198,6 +198,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
     for (i = 0; i < surface_count; ++i)
     {
         struct wined3d_surface *wined3d_surface;
+        struct wined3d_texture *wined3d_texture;
         IUnknown *parent;
 
         if (FAILED(hr = device_parent->ops->create_swapchain_surface(device_parent,
@@ -207,7 +208,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
             goto fail;
         }
 
-        parent = wined3d_surface_get_parent(wined3d_surface);
+        wined3d_texture = wined3d_surface_get_container(wined3d_surface);
+        parent = wined3d_texture_get_parent(wined3d_texture);
         hr = IUnknown_QueryInterface(parent, &IID_IDXGISurface, (void **)&surface[i]);
         wined3d_surface_decref(wined3d_surface);
         if (FAILED(hr))
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index cfc1a09..10ae26d 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -144,8 +144,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
 {
     struct dxgi_swapchain *This = impl_from_IDXGISwapChain(iface);
     struct wined3d_texture *texture;
-    struct wined3d_resource *resource;
-    struct wined3d_surface *backbuffer;
     IUnknown *parent;
     HRESULT hr;
 
@@ -161,9 +159,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
         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);
+    parent = wined3d_texture_get_parent(texture);
     hr = IUnknown_QueryInterface(parent, riid, surface);
     LeaveCriticalSection(&dxgi_cs);
 
@@ -225,8 +221,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeBuffers(IDXGISwapChain *if
     struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
     struct wined3d_swapchain_desc wined3d_desc;
     struct wined3d_texture *texture;
-    struct wined3d_resource *resource;
-    struct wined3d_surface *surface;
     IUnknown *parent;
     unsigned int i;
     HRESULT hr;
@@ -243,9 +237,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeBuffers(IDXGISwapChain *if
     {
         texture = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain,
                 i, WINED3D_BACKBUFFER_TYPE_MONO);
-        resource = wined3d_texture_get_sub_resource(texture, 0);
-        surface = wined3d_surface_from_resource(resource);
-        parent = wined3d_surface_get_parent(surface);
+        parent = wined3d_texture_get_parent(texture);
         IUnknown_AddRef(parent);
         if (IUnknown_Release(parent))
         {
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f303d90..c1e8aa2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -5537,3 +5537,8 @@ HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct w
 
     return hr;
 }
+
+struct wined3d_texture * CDECL wined3d_surface_get_container(const struct wined3d_surface *surface)
+{
+    return surface->container;
+}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 9f714ef..1523722 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -225,6 +225,7 @@
 @ cdecl wined3d_surface_decref(ptr)
 @ cdecl wined3d_surface_from_resource(ptr)
 @ cdecl wined3d_surface_get_blt_status(ptr long)
+@ cdecl wined3d_surface_get_container(ptr)
 @ cdecl wined3d_surface_get_flip_status(ptr long)
 @ cdecl wined3d_surface_get_overlay_position(ptr ptr ptr)
 @ cdecl wined3d_surface_get_parent(ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 72a41b2..063d314 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2486,6 +2486,7 @@ HRESULT __cdecl wined3d_surface_blt(struct wined3d_surface *dst_surface, const R
 ULONG __cdecl wined3d_surface_decref(struct wined3d_surface *surface);
 struct wined3d_surface * __cdecl wined3d_surface_from_resource(struct wined3d_resource *resource);
 HRESULT __cdecl wined3d_surface_get_blt_status(const struct wined3d_surface *surface, DWORD flags);
+struct wined3d_texture * __cdecl wined3d_surface_get_container(const struct wined3d_surface *surface);
 HRESULT __cdecl wined3d_surface_get_flip_status(const struct wined3d_surface *surface, DWORD flags);
 HRESULT __cdecl wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y);
 void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface);
-- 
2.4.6




More information about the wine-patches mailing list