[PATCH 3/7] wined3d: make wined3d_device_get_front_buffer_data work with wined3d_texture and sub_resource_index

Riccardo Bortolato rikyz619 at gmail.com
Mon Oct 12 10:23:33 CDT 2015


Implemented the needed changes in d3d8 and d3d9

Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
---
 dlls/d3d8/device.c        | 2 +-
 dlls/d3d9/device.c        | 2 +-
 dlls/wined3d/device.c     | 9 +++++----
 dlls/wined3d/wined3d.spec | 2 +-
 include/wine/wined3d.h    | 2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 0648f51..65600fd 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1166,7 +1166,7 @@ static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirec
     }
 
     wined3d_mutex_lock();
-    hr = wined3d_device_get_front_buffer_data(device->wined3d_device, 0, dst_impl->wined3d_surface);
+    hr = wined3d_device_get_front_buffer_data(device->wined3d_device, 0, 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 f49664e..6dfa037 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1264,7 +1264,7 @@ static HRESULT WINAPI d3d9_device_GetFrontBufferData(IDirect3DDevice9Ex *iface,
     TRACE("iface %p, swapchain %u, dst_surface %p.\n", iface, swapchain, dst_surface);
 
     wined3d_mutex_lock();
-    hr = wined3d_device_get_front_buffer_data(device->wined3d_device, swapchain, dst_impl->wined3d_surface);
+    hr = wined3d_device_get_front_buffer_data(device->wined3d_device, swapchain, dst_impl->wined3d_texture, dst_impl->sub_resource_idx);
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index def042a..6c1af7e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3651,16 +3651,17 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
 }
 
 HRESULT CDECL wined3d_device_get_front_buffer_data(const struct wined3d_device *device,
-        UINT swapchain_idx, struct wined3d_surface *dst_surface)
+        UINT swapchain_idx, struct wined3d_texture *texture, unsigned int sub_resource_idx)
 {
+    struct wined3d_resource *sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx);
     struct wined3d_swapchain *swapchain;
 
-    TRACE("device %p, swapchain_idx %u, dst_surface %p.\n", device, swapchain_idx, dst_surface);
+    TRACE("device %p, swapchain_idx %u, texture %p, sub_index %u.\n", device, swapchain_idx, texture, sub_resource_idx);
 
-    if (!(swapchain = wined3d_device_get_swapchain(device, swapchain_idx)))
+    if (!sub_resource || !(swapchain = wined3d_device_get_swapchain(device, swapchain_idx)))
         return WINED3DERR_INVALIDCALL;
 
-    return wined3d_swapchain_get_front_buffer_data(swapchain, dst_surface);
+    return wined3d_swapchain_get_front_buffer_data(swapchain, surface_from_resource(sub_resource));
 }
 
 HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes)
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index c4ebd35..24cc089 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -56,7 +56,7 @@
 @ cdecl wined3d_device_get_depth_stencil_view(ptr)
 @ cdecl wined3d_device_get_device_caps(ptr ptr)
 @ cdecl wined3d_device_get_display_mode(ptr long ptr ptr)
-@ cdecl wined3d_device_get_front_buffer_data(ptr long ptr)
+@ cdecl wined3d_device_get_front_buffer_data(ptr long ptr long)
 @ cdecl wined3d_device_get_gamma_ramp(ptr long ptr)
 @ cdecl wined3d_device_get_geometry_shader(ptr)
 @ cdecl wined3d_device_get_gs_cb(ptr long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index a82777e..923822e 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2160,7 +2160,7 @@ HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *devi
 HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx,
         struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);
 HRESULT __cdecl wined3d_device_get_front_buffer_data(const struct wined3d_device *device,
-        UINT swapchain_idx, struct wined3d_surface *dst_surface);
+        UINT swapchain_idx, struct wined3d_texture *texture, unsigned int sub_resource_idx);
 void __cdecl wined3d_device_get_gamma_ramp(const struct wined3d_device *device,
         UINT swapchain_idx, struct wined3d_gamma_ramp *ramp);
 struct wined3d_shader * __cdecl wined3d_device_get_geometry_shader(const struct wined3d_device *device);
-- 
1.9.1




More information about the wine-patches mailing list