=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d8/tests: Do not assume surface size and format in get_rt_readback().

Alexandre Julliard julliard at winehq.org
Thu Jan 5 14:09:05 CST 2017


Module: wine
Branch: master
Commit: 73cb1b01d51667cf8767c3df5266c2ba0dfb658c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=73cb1b01d51667cf8767c3df5266c2ba0dfb658c

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Jan  5 11:50:52 2017 +0100

d3d8/tests: Do not assume surface size and format in get_rt_readback().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d8/tests/visual.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index bf7058c..fa3d4f3 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -65,13 +65,17 @@ struct surface_readback
 
 static void get_rt_readback(IDirect3DSurface8 *surface, struct surface_readback *rb)
 {
-    IDirect3DDevice8 *device;
     IDirect3DTexture8 *tex = NULL;
+    IDirect3DDevice8 *device;
+    D3DSURFACE_DESC desc;
     HRESULT hr;
 
     memset(rb, 0, sizeof(*rb));
-    IDirect3DSurface8_GetDevice(surface, &device);
-    hr = IDirect3DDevice8_CreateTexture(device, 640, 480, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &tex);
+    hr = IDirect3DSurface8_GetDevice(surface, &device);
+    ok(SUCCEEDED(hr), "Failed to get device, hr %#x.\n", hr);
+    hr = IDirect3DSurface8_GetDesc(surface, &desc);
+    ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
+    hr = IDirect3DDevice8_CreateTexture(device, desc.Width, desc.Height, 1, 0, desc.Format, D3DPOOL_SYSTEMMEM, &tex);
     if (FAILED(hr) || !tex)
     {
         trace("Can't create an offscreen plain surface to read the render target data, hr %#x.\n", hr);




More information about the wine-cvs mailing list