[PATCH 3/5] wined3d: make wined3d_swapchain_get_front_buffer_data work with wined3d_texture and sub_resource_idx
Riccardo Bortolato
rikyz619 at gmail.com
Thu Oct 15 08:41:25 CDT 2015
updated all wined3d, d3d8 and d3d9 calls
Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
---
dlls/d3d8/device.c | 2 +-
dlls/d3d9/device.c | 2 +-
dlls/d3d9/swapchain.c | 2 +-
dlls/wined3d/swapchain.c | 12 +++++++++---
dlls/wined3d/wined3d.spec | 2 +-
include/wine/wined3d.h | 2 +-
6 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 04881cd..bc34371 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1170,7 +1170,7 @@ static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirec
if (!(swapchain = wined3d_device_get_swapchain(device->wined3d_device, 0)))
hr = D3DERR_INVALIDCALL;
else
- hr = wined3d_swapchain_get_front_buffer_data(swapchain, dst_impl->wined3d_surface);
+ hr = wined3d_swapchain_get_front_buffer_data(swapchain, dst_impl->wined3d_texture, dst_impl->sub_resource_idx);
wined3d_mutex_unlock();
return hr;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 1f77cbf..19fb5fc 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1268,7 +1268,7 @@ static HRESULT WINAPI d3d9_device_GetFrontBufferData(IDirect3DDevice9Ex *iface,
if (!(swapchain = wined3d_device_get_swapchain(device->wined3d_device, swapchain_idx)))
hr = D3DERR_INVALIDCALL;
else
- hr = wined3d_swapchain_get_front_buffer_data(swapchain, dst_impl->wined3d_surface);
+ hr = wined3d_swapchain_get_front_buffer_data(swapchain, dst_impl->wined3d_texture, dst_impl->sub_resource_idx);
wined3d_mutex_unlock();
return hr;
diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c
index c995afb..91a22a3 100644
--- a/dlls/d3d9/swapchain.c
+++ b/dlls/d3d9/swapchain.c
@@ -142,7 +142,7 @@ static HRESULT WINAPI d3d9_swapchain_GetFrontBufferData(IDirect3DSwapChain9Ex *i
TRACE("iface %p, surface %p.\n", iface, surface);
wined3d_mutex_lock();
- hr = wined3d_swapchain_get_front_buffer_data(swapchain->wined3d_swapchain, dst->wined3d_surface);
+ hr = wined3d_swapchain_get_front_buffer_data(swapchain->wined3d_swapchain, dst->wined3d_texture, dst->sub_resource_idx);
wined3d_mutex_unlock();
return hr;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 0a1373f..86565bf 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -156,13 +156,19 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
}
HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain,
- struct wined3d_surface *dst_surface)
+ struct wined3d_texture *dst_texture, unsigned int sub_resource_idx)
{
- struct wined3d_surface *src_surface;
+ struct wined3d_surface *src_surface, *dst_surface;
+ struct wined3d_resource *sub_resource;
RECT src_rect, dst_rect;
- TRACE("swapchain %p, dst_surface %p.\n", swapchain, dst_surface);
+ TRACE("swapchain %p, dst_texture %p, sub_resource_idx %u.\n", swapchain, dst_texture, sub_resource_idx);
+ if (!(sub_resource = wined3d_texture_get_sub_resource(dst_texture, sub_resource_idx)) ||
+ sub_resource->type != WINED3D_RTYPE_SURFACE)
+ return WINED3DERR_INVALIDCALL;
+
+ dst_surface = surface_from_resource(sub_resource);
src_surface = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0));
SetRect(&src_rect, 0, 0, src_surface->resource.width, src_surface->resource.height);
dst_rect = src_rect;
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 6356665..c5cc3ed 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -245,7 +245,7 @@
@ cdecl wined3d_swapchain_get_back_buffer(ptr long long)
@ cdecl wined3d_swapchain_get_device(ptr)
@ cdecl wined3d_swapchain_get_display_mode(ptr ptr ptr)
-@ cdecl wined3d_swapchain_get_front_buffer_data(ptr ptr)
+@ cdecl wined3d_swapchain_get_front_buffer_data(ptr ptr long)
@ cdecl wined3d_swapchain_get_gamma_ramp(ptr ptr)
@ cdecl wined3d_swapchain_get_parent(ptr)
@ cdecl wined3d_swapchain_get_desc(ptr ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index fc0b40e..a0e50ee 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2507,7 +2507,7 @@ struct wined3d_device * __cdecl wined3d_swapchain_get_device(const struct wined3
HRESULT __cdecl wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain,
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);
HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain,
- struct wined3d_surface *dst_surface);
+ struct wined3d_texture *dst_texture, unsigned int sub_resource_idx);
HRESULT __cdecl wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
struct wined3d_gamma_ramp *ramp);
void * __cdecl wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain);
--
1.9.1
More information about the wine-patches
mailing list