Commit 27b72fa8 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9/tests: Use GetRenderTargetData() for reading back pixels.

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.
parent 89250247
...@@ -110,8 +110,9 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y) ...@@ -110,8 +110,9 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
D3DLOCKED_RECT lockedRect; D3DLOCKED_RECT lockedRect;
RECT rectToLock = {x, y, x+1, y+1}; RECT rectToLock = {x, y, x+1, y+1};
hr = IDirect3DDevice9_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8, 0, 0, TRUE, &surf, NULL); hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 640, 480,
if(FAILED(hr) || !surf ) /* This is not a test */ 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); trace("Can't create an offscreen plain surface to read the render target data, hr=%08x\n", hr);
return 0xdeadbeef; return 0xdeadbeef;
...@@ -125,8 +126,8 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y) ...@@ -125,8 +126,8 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
goto out; goto out;
} }
hr = IDirect3DDevice9_StretchRect(device, target, NULL, surf, NULL, D3DTEXF_POINT); hr = IDirect3DDevice9_GetRenderTargetData(device, target, surf);
if(FAILED(hr)) if (FAILED(hr))
{ {
trace("Can't read the render target data, hr=%08x\n", hr); trace("Can't read the render target data, hr=%08x\n", hr);
ret = 0xdeadbeec; ret = 0xdeadbeec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment