[PATCH 1/4] d3d9/tests: Use GetRenderTargetData() for reading back pixels.

Henri Verbeet hverbeet at codeweavers.com
Thu Nov 18 13:50:38 CST 2010


This is the recommended way to read back render targets. It's also much faster
on current wined3d, but that's mostly a side effect of imperfections in our
resource location management.
---
 dlls/d3d9/tests/visual.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index f2eb4b4..d2c5df5 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -110,8 +110,9 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
     D3DLOCKED_RECT lockedRect;
     RECT rectToLock = {x, y, x+1, y+1};
 
-    hr = IDirect3DDevice9_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8, 0, 0, TRUE, &surf, NULL);
-    if(FAILED(hr) || !surf )  /* This is not a test */
+    hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 640, 480,
+            D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surf, NULL);
+    if (FAILED(hr) || !surf)
     {
         trace("Can't create an offscreen plain surface to read the render target data, hr=%08x\n", hr);
         return 0xdeadbeef;
@@ -125,8 +126,8 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
         goto out;
     }
 
-    hr = IDirect3DDevice9_StretchRect(device, target, NULL, surf, NULL, D3DTEXF_POINT);
-    if(FAILED(hr))
+    hr = IDirect3DDevice9_GetRenderTargetData(device, target, surf);
+    if (FAILED(hr))
     {
         trace("Can't read the render target data, hr=%08x\n", hr);
         ret = 0xdeadbeec;
-- 
1.7.2.2




More information about the wine-patches mailing list