Commit 1f676a96 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d9: Reject blits to regular textures.

parent 514ffe8a
......@@ -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)
......
......@@ -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);
......
......@@ -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. */
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