mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 14:45:53 +00:00
[WINESYNC]d3dx9: Use temporary surface in D3DXSaveSurfaceToFileInMemory() for unmappable textures.
Fixes a regression triggered by commit 949dbbd31f450178c90ea8267097a975b77c3219. Signed-off-by: Paul Gofman <gofmanp@gmail.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 092c14b9d86ee1e96e465908cc524ec85988d0ff by Paul Gofman <gofmanp@gmail.com>
This commit is contained in:
parent
9e1d68edb0
commit
a1f2064705
3 changed files with 49 additions and 16 deletions
|
@ -1253,16 +1253,30 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
|
|||
|
||||
static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device)
|
||||
{
|
||||
HRESULT hr;
|
||||
RECT rect;
|
||||
ID3DXBuffer *buffer;
|
||||
IDirect3DSurface9 *surface;
|
||||
static const struct
|
||||
{
|
||||
DWORD usage;
|
||||
D3DPOOL pool;
|
||||
}
|
||||
test_access_types[] =
|
||||
{
|
||||
{0, D3DPOOL_MANAGED},
|
||||
{0, D3DPOOL_DEFAULT},
|
||||
{D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT},
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
DWORD magic;
|
||||
struct dds_header header;
|
||||
BYTE *data;
|
||||
} *dds;
|
||||
IDirect3DSurface9 *surface;
|
||||
IDirect3DTexture9 *texture;
|
||||
ID3DXBuffer *buffer;
|
||||
unsigned int i;
|
||||
HRESULT hr;
|
||||
RECT rect;
|
||||
|
||||
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 4, 4, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surface, NULL);
|
||||
if (FAILED(hr)) {
|
||||
|
@ -1317,6 +1331,27 @@ static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device)
|
|||
ID3DXBuffer_Release(buffer);
|
||||
|
||||
IDirect3DSurface9_Release(surface);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(test_access_types); ++i)
|
||||
{
|
||||
hr = IDirect3DDevice9_CreateTexture(device, 4, 4, 0, test_access_types[i].usage,
|
||||
D3DFMT_A8R8G8B8, test_access_types[i].pool, &texture, NULL);
|
||||
ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i);
|
||||
|
||||
hr = IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface);
|
||||
ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i);
|
||||
|
||||
hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_DDS, surface, NULL, NULL);
|
||||
ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i);
|
||||
ID3DXBuffer_Release(buffer);
|
||||
|
||||
hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_BMP, surface, NULL, NULL);
|
||||
ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i);
|
||||
ID3DXBuffer_Release(buffer);
|
||||
|
||||
IDirect3DSurface9_Release(surface);
|
||||
IDirect3DTexture9_Release(texture);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_D3DXSaveSurfaceToFile(IDirect3DDevice9 *device)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue