Henri Verbeet : d3d9: Implement texture creation from system memory.

Alexandre Julliard julliard at winehq.org
Fri Dec 2 10:58:28 CST 2011


Module: wine
Branch: master
Commit: b171d5f95d3120e58b0f3eec646e8123c4f6b404
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b171d5f95d3120e58b0f3eec646e8123c4f6b404

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Dec  2 08:15:50 2011 +0100

d3d9: Implement texture creation from system memory.

---

 dlls/d3d9/device.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 2be0002..cdaac6d 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -693,13 +693,23 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(IDirect3DDevice9Ex *ifa
 {
     IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
     IDirect3DTexture9Impl *object;
+    BOOL set_mem = FALSE;
     HRESULT hr;
 
     TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p, shared_handle %p.\n",
             iface, width, height, levels, usage, format, pool, texture, shared_handle);
 
     if (shared_handle)
-        FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+    {
+        if (pool == D3DPOOL_SYSTEMMEM)
+        {
+            if (levels != 1)
+                return D3DERR_INVALIDCALL;
+            set_mem = TRUE;
+        }
+        else
+            FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+    }
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
@@ -716,6 +726,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(IDirect3DDevice9Ex *ifa
         return hr;
     }
 
+    if (set_mem)
+    {
+        struct wined3d_resource *resource;
+        IDirect3DSurface9Impl *surface;
+
+        resource = wined3d_texture_get_sub_resource(object->wined3d_texture, 0);
+        surface = wined3d_resource_get_parent(resource);
+        wined3d_surface_set_mem(surface->wined3d_surface, *shared_handle);
+    }
+
     TRACE("Created texture %p.\n", object);
     *texture = &object->IDirect3DTexture9_iface;
 




More information about the wine-cvs mailing list