Module: wine Branch: master Commit: df1101ff6820059c3a4298d6e7f901733b7c9636 URL: http://source.winehq.org/git/wine.git/?a=commit;h=df1101ff6820059c3a4298d6e7...
Author: Riccardo Bortolato rikyz619@gmail.com Date: Mon Oct 12 12:44:10 2015 +0200
d3d9: Make use of wined3d_texture_map in d3d9_surface_LockRect.
Also store wined3d_texture and sub_resource_idx in d3d9_surface.
Signed-off-by: Riccardo Bortolato rikyz619@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d9/d3d9_private.h | 4 +++- dlls/d3d9/device.c | 2 +- dlls/d3d9/surface.c | 11 +++++++---- 3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index ea0d3e6..dc9ae1c 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -214,6 +214,8 @@ struct d3d9_surface { IDirect3DSurface9 IDirect3DSurface9_iface; struct d3d9_resource resource; + struct wined3d_texture *wined3d_texture; + unsigned int sub_resource_idx; struct wined3d_surface *wined3d_surface; struct list rtv_entry; struct wined3d_rendertarget_view *wined3d_rtv; @@ -224,7 +226,7 @@ struct d3d9_surface };
struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9_surface *surface) DECLSPEC_HIDDEN; -void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, +void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 5df36f3..f49664e 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3545,7 +3545,7 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent if (!(d3d_surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_surface)))) return E_OUTOFMEMORY;
- surface_init(d3d_surface, wined3d_texture_get_parent(wined3d_texture), surface, parent_ops); + surface_init(d3d_surface, wined3d_texture, sub_resource_idx, surface, parent_ops); *parent = d3d_surface; TRACE("Created surface %p.\n", d3d_surface);
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index 7dc6e70..ec5b420 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -251,7 +251,8 @@ static HRESULT WINAPI d3d9_surface_LockRect(IDirect3DSurface9 *iface, }
wined3d_mutex_lock(); - hr = wined3d_surface_map(surface->wined3d_surface, &map_desc, rect ? &box : NULL, flags); + hr = wined3d_texture_map(surface->wined3d_texture, surface->sub_resource_idx, + &map_desc, rect ? &box : NULL, flags); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) @@ -356,7 +357,7 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops = surface_wined3d_object_destroyed, };
-void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, +void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) { struct wined3d_resource_desc desc; @@ -367,9 +368,11 @@ void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, surface->resource.refcount = 0; surface->wined3d_surface = wined3d_surface; list_init(&surface->rtv_entry); - surface->container = container_parent; + surface->container = wined3d_texture_get_parent(wined3d_texture); + surface->wined3d_texture = wined3d_texture; + surface->sub_resource_idx = sub_resource_idx;
- if (container_parent && SUCCEEDED(IUnknown_QueryInterface(container_parent, + if (surface->container && SUCCEEDED(IUnknown_QueryInterface(surface->container, &IID_IDirect3DBaseTexture9, (void **)&texture))) { surface->texture = unsafe_impl_from_IDirect3DBaseTexture9(texture);