[v2 4/4] wined3d: introduce a new wined3d_texture_blt function
Riccardo Bortolato
rikyz619 at gmail.com
Tue Oct 13 11:45:42 CDT 2015
initial usage in d3d8.
finally remove wined3d_surface member from d3d8_surface as it's now unused.
Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
---
dlls/d3d8/d3d8_private.h | 3 +--
dlls/d3d8/device.c | 14 +++++++-------
dlls/d3d8/surface.c | 3 +--
dlls/wined3d/texture.c | 19 +++++++++++++++++++
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 3 +++
6 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 3069487..a564ee8 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -229,7 +229,6 @@ struct d3d8_surface
struct d3d8_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;
IDirect3DDevice8 *parent_device;
@@ -239,7 +238,7 @@ struct d3d8_surface
struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN;
void surface_init(struct d3d8_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;
+ const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
struct d3d8_vertexbuffer
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 2b11923..82d1586 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1093,8 +1093,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
if (!rect_count && !src_rects && !dst_points)
{
RECT rect = {0, 0, src_w, src_h};
- wined3d_surface_blt(dst->wined3d_surface, &rect,
- src->wined3d_surface, &rect, 0, NULL, WINED3D_TEXF_POINT);
+ wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &rect,
+ src->wined3d_texture, src->sub_resource_idx, &rect, 0, NULL, WINED3D_TEXF_POINT);
}
else
{
@@ -1109,8 +1109,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
RECT dst_rect = {dst_points[i].x, dst_points[i].y,
dst_points[i].x + w, dst_points[i].y + h};
- wined3d_surface_blt(dst->wined3d_surface, &dst_rect,
- src->wined3d_surface, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
+ wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
+ src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
}
}
else
@@ -1121,8 +1121,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
UINT h = src_rects[i].bottom - src_rects[i].top;
RECT dst_rect = {0, 0, w, h};
- wined3d_surface_blt(dst->wined3d_surface, &dst_rect,
- src->wined3d_surface, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
+ wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
+ src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
}
}
}
@@ -3010,7 +3010,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, sub_resource_idx, surface, parent_ops);
+ surface_init(d3d_surface, wined3d_texture, sub_resource_idx, parent_ops);
*parent = d3d_surface;
TRACE("Created surface %p.\n", d3d_surface);
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 077502d..8153340 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -301,14 +301,13 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops =
};
void surface_init(struct d3d8_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
- struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops)
+ const struct wined3d_parent_ops **parent_ops)
{
IDirect3DBaseTexture8 *texture;
surface->IDirect3DSurface8_iface.lpVtbl = &d3d8_surface_vtbl;
d3d8_resource_init(&surface->resource);
surface->resource.refcount = 0;
- surface->wined3d_surface = wined3d_surface;
list_init(&surface->rtv_entry);
surface->container = wined3d_texture_get_parent(wined3d_texture);
surface->wined3d_texture = wined3d_texture;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index d5f9591..827807b 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1431,6 +1431,25 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
return WINED3D_OK;
}
+HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect_in,
+ struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect_in, DWORD flags,
+ const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
+{
+ struct wined3d_resource *dst_resource, *src_resource;
+
+ TRACE("dst_texture %p, dst_sub_resource_idx %u, src_texture %p, src_sub_resource_idx %u.\n",
+ dst_texture, dst_sub_resource_idx, src_texture, src_sub_resource_idx);
+
+ dst_resource = wined3d_texture_get_sub_resource(dst_texture, dst_sub_resource_idx);
+ src_resource = wined3d_texture_get_sub_resource(src_texture, src_sub_resource_idx);
+
+ if (!dst_resource || !src_resource)
+ return WINED3DERR_INVALIDCALL;
+
+ return wined3d_surface_blt(surface_from_resource(dst_resource), dst_rect_in,
+ surface_from_resource(src_resource), src_rect_in, flags, fx, filter);
+}
+
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
UINT level_count, DWORD surface_flags, const struct wined3d_sub_resource_data *data, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 1569e24..22c6d23 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -259,6 +259,7 @@
@ cdecl wined3d_swapchain_set_window(ptr ptr)
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
+@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
@ cdecl wined3d_texture_create(ptr ptr long long ptr ptr ptr ptr)
@ cdecl wined3d_texture_decref(ptr)
@ cdecl wined3d_texture_generate_mipmaps(ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index b29ee76..44b2845 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2531,6 +2531,9 @@ void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, H
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region);
+HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in,
+ struct wined3d_texture *src_texture, unsigned int src_idx, const RECT *src_rect_in, DWORD flags,
+ const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter);
HRESULT __cdecl wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
UINT level_count, DWORD surface_flags, const struct wined3d_sub_resource_data *data, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture);
--
1.9.1
More information about the wine-patches
mailing list