Henri Verbeet : d3d10core: Implement d3d10_texture2d_Map().

Alexandre Julliard julliard at winehq.org
Thu Jul 12 18:00:32 CDT 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Jul 12 13:44:23 2012 +0200

d3d10core: Implement d3d10_texture2d_Map().

---

 dlls/d3d10core/texture.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dlls/d3d10core/texture.c b/dlls/d3d10core/texture.c
index 5908cd0..718d019 100644
--- a/dlls/d3d10core/texture.c
+++ b/dlls/d3d10core/texture.c
@@ -150,13 +150,32 @@ static UINT STDMETHODCALLTYPE d3d10_texture2d_GetEvictionPriority(ID3D10Texture2
 
 /* ID3D10Texture2D methods */
 
-static HRESULT STDMETHODCALLTYPE d3d10_texture2d_Map(ID3D10Texture2D *iface, UINT sub_resource,
+static HRESULT STDMETHODCALLTYPE d3d10_texture2d_Map(ID3D10Texture2D *iface, UINT sub_resource_idx,
         D3D10_MAP map_type, UINT map_flags, D3D10_MAPPED_TEXTURE2D *mapped_texture)
 {
-    FIXME("iface %p, sub_resource %u, map_type %u, map_flags %#x, mapped_texture %p stub!\n",
-            iface, sub_resource, map_type, map_flags, mapped_texture);
+    struct d3d10_texture2d *texture = impl_from_ID3D10Texture2D(iface);
+    struct wined3d_map_desc wined3d_map_desc;
+    struct wined3d_resource *sub_resource;
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p.\n",
+            iface, sub_resource_idx, map_type, map_flags, mapped_texture);
+
+    if (map_type != D3D10_MAP_READ_WRITE)
+        FIXME("Ignoring map_type %#x.\n", map_type);
+    if (map_flags)
+        FIXME("Ignoring map_flags %#x.\n", map_flags);
+
+    if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
+        hr = E_INVALIDARG;
+    else if (SUCCEEDED(hr = wined3d_surface_map(wined3d_surface_from_resource(sub_resource),
+            &wined3d_map_desc, NULL, 0)))
+    {
+        mapped_texture->pData = wined3d_map_desc.data;
+        mapped_texture->RowPitch = wined3d_map_desc.row_pitch;
+    }
+
+    return hr;
 }
 
 static void STDMETHODCALLTYPE d3d10_texture2d_Unmap(ID3D10Texture2D *iface, UINT sub_resource_idx)




More information about the wine-cvs mailing list