Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d9/device.c | 6 ++++++ dlls/d3d9/tests/device.c | 3 --- dlls/d3d9/tests/visual.c | 16 ++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 3d3d27332cbc..1c9a625223c6 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1623,6 +1623,12 @@ static HRESULT WINAPI d3d9_device_StretchRect(IDirect3DDevice9Ex *iface, IDirect goto done; }
+ if (dst->texture && !(dst_desc.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL))) + { + WARN("Destination is a texture.\n"); + goto done; + } + if (src_desc.usage & WINED3DUSAGE_DEPTHSTENCIL) { if (device->in_scene) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 0f3abf38ec06..6084fd209a79 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12342,7 +12342,6 @@ static void test_stretch_rect(void) IDirect3DTexture9_Release(dst_texture);
hr = IDirect3DDevice9_StretchRect(device, src, NULL, dst, NULL, D3DTEXF_NONE); - todo_wine_if(src_pool == D3DPOOL_DEFAULT && dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n", hr, src_format, dst_format, src_pool, dst_pool);
@@ -12355,7 +12354,6 @@ static void test_stretch_rect(void) ok(hr == expected_hr, "Got hr %#x, expected hr %#x (formats %#x/%#x, pool %#x).\n", hr, expected_hr, src_format, dst_format, src_pool); hr = IDirect3DDevice9_StretchRect(device, src_rt, NULL, dst, NULL, D3DTEXF_NONE); - todo_wine_if(dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pool %#x).\n", hr, src_format, dst_format, dst_pool);
@@ -12388,7 +12386,6 @@ static void test_stretch_rect(void) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n", hr, src_format, dst_format, src_pool, dst_pool); hr = IDirect3DDevice9_StretchRect(device, src_surface, NULL, dst, NULL, D3DTEXF_NONE); - todo_wine_if(src_pool == D3DPOOL_DEFAULT && dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n", hr, src_format, dst_format, src_pool, dst_pool);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 23fd1fbfaa4c..08d1849b36da 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -3743,7 +3743,7 @@ static void stretchrect_test(void)
/* offscreenplain ==> texture, same size (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* Fill the smaller offscreen surface with red. */ fill_surface(surf_offscreen32, 0xffff0000, 0); @@ -3769,7 +3769,7 @@ static void stretchrect_test(void)
/* offscreenplain ==> texture, scaling (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_offscreen32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/************************************************************* * Tests for when the source parameter is a regular texture. * @@ -3826,7 +3826,7 @@ static void stretchrect_test(void)
/* texture ==> texture, same size (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* Fill the surface of the smaller regular texture with red. */ /* Can't fill the surf_tex directly because it's created in D3DPOOL_DEFAULT. */ @@ -3855,7 +3855,7 @@ static void stretchrect_test(void)
/* texture ==> texture, scaling (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_tex32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/****************************************************************** * Tests for when the source parameter is a rendertarget texture. * @@ -3912,7 +3912,7 @@ static void stretchrect_test(void)
/* rendertarget texture ==> texture, same size (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* Fill the surface of the smaller rendertarget texture with red. */ /* Can't fill the surf_tex_rt directly because it's created in D3DPOOL_DEFAULT. */ @@ -3941,7 +3941,7 @@ static void stretchrect_test(void)
/* rendertarget texture ==> texture, scaling (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/****************************************************************** * Tests for when the source parameter is a rendertarget surface. * @@ -3995,7 +3995,7 @@ static void stretchrect_test(void)
/* rendertarget surface ==> texture, same size (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* Fill the surface of the smaller rendertarget texture with red. */ fill_surface(surf_rt32, 0xffff0000, 0); @@ -4021,7 +4021,7 @@ static void stretchrect_test(void)
/* rendertarget surface ==> texture, scaling (should fail). */ hr = IDirect3DDevice9_StretchRect(device, surf_rt32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* backbuffer ==> surface tests (no scaling). */ /* Blit with NULL rectangles. */