Module: wine Branch: master Commit: 53f795af0ac138846d70aba3bb3802ed98ddf1a5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=53f795af0ac138846d70aba3bb...
Author: Riccardo Bortolato rikyz619@gmail.com Date: Fri Oct 16 13:59:17 2015 +0200
wined3d: Make wined3d_swapchain_get_front_buffer_data work with wined3d_texture and sub_resource_idx.
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/d3d8/device.c | 3 ++- 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, 15 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 271c4ec..406cc7e 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1158,7 +1158,8 @@ static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirec }
wined3d_mutex_lock(); - hr = wined3d_swapchain_get_front_buffer_data(device->implicit_swapchain->wined3d_swapchain, dst_impl->wined3d_surface); + hr = wined3d_swapchain_get_front_buffer_data(device->implicit_swapchain->wined3d_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 507b3dd..a191b71 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1288,7 +1288,7 @@ static HRESULT WINAPI d3d9_device_GetFrontBufferData(IDirect3DDevice9Ex *iface, wined3d_mutex_lock(); if (swapchain < device->implicit_swapchain_count) hr = wined3d_swapchain_get_front_buffer_data(device->implicit_swapchains[swapchain]->wined3d_swapchain, - dst_impl->wined3d_surface); + 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 27bcf70..e965bda 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 1b39e9d..4dc8be1 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -244,7 +244,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 7d407bb..c5cfc4a 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2505,7 +2505,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);