Wine-Devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
March 2020
- 72 participants
- 969 discussions
March 13, 2020
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/ucrtbase/tests/misc.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
2
1
[resend PATCH 1/2] d3d9/tests: Add tests for allowed filters for StrecthRect().
by Paul Gofman March 13, 2020
by Paul Gofman March 13, 2020
March 13, 2020
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com>
---
dlls/d3d9/tests/visual.c | 301 ++++++++++++++++-----------------------
1 file changed, 121 insertions(+), 180 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 2294d434ba..4fe11ed161 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -3828,16 +3828,17 @@ static void fill_surface(IDirect3DSurface9 *surface, DWORD color, DWORD flags)
static void stretchrect_test(void)
{
- IDirect3DSurface9 *surf_tex_rt32, *surf_tex_rt64, *surf_tex_rt_dest64, *surf_tex_rt_dest640_480;
- IDirect3DSurface9 *surf_offscreen32, *surf_offscreen64, *surf_offscreen_dest64;
+ static IDirect3DSurface9 *surf_tex_rt32, *surf_tex_rt64, *surf_tex_rt_dest64, *surf_tex_rt_dest640_480;
+ static IDirect3DSurface9 *surf_offscreen32, *surf_offscreen64, *surf_offscreen_dest64;
IDirect3DTexture9 *tex_rt32, *tex_rt64, *tex_rt_dest64, *tex_rt_dest640_480;
- IDirect3DSurface9 *surf_tex32, *surf_tex64, *surf_tex_dest64;
- IDirect3DSurface9 *surf_rt32, *surf_rt64, *surf_rt_dest64;
+ static IDirect3DSurface9 *surf_tex32, *surf_tex64, *surf_tex_dest64;
+ static IDirect3DSurface9 *surf_rt32, *surf_rt64, *surf_rt_dest64;
IDirect3DTexture9 *tex32, *tex64, *tex_dest64;
IDirect3DSurface9 *surf_temp32, *surf_temp64;
- IDirect3DSurface9 *backbuffer;
+ static IDirect3DSurface9 *backbuffer;
IDirect3DDevice9 *device;
IDirect3D9 *d3d;
+ unsigned int i;
D3DCOLOR color;
ULONG refcount;
HWND window;
@@ -3852,6 +3853,75 @@ static void stretchrect_test(void)
static const RECT dst_rect64 = {0, 0, 64, 64};
static const RECT dst_rect64_flipy = {0, 64, 64, 0};
+ static const struct error_condition_test
+ {
+ IDirect3DSurface9 **src;
+ const RECT *src_rect;
+ IDirect3DSurface9 **dst;
+ const RECT *dst_rect;
+ D3DTEXTUREFILTERTYPE filter;
+ BOOL allowed;
+ BOOL todo;
+ }
+ error_condition_tests[] =
+ {
+ {&surf_offscreen64, &src_rect64_flipy, &surf_offscreen_dest64, &dst_rect64, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64, &surf_offscreen_dest64, &dst_rect64_flipy, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE,},
+ {&surf_offscreen64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_offscreen32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_offscreen32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex64, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex_rt64, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex_rt64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex_rt64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex_rt64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex_rt64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex_rt64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex_rt32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex_rt32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_rt64, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_rt64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_rt64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_rt64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_rt64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_rt64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_rt32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_rt32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&backbuffer, &src_rect_flipy, &surf_tex_rt_dest640_480, &dst_rect, D3DTEXF_NONE},
+ {&backbuffer, &src_rect, &surf_tex_rt_dest640_480, &dst_rect_flipy, D3DTEXF_NONE},
+ /* Test filter. */
+ {&surf_offscreen64, NULL, &surf_offscreen_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_offscreen64, NULL, &surf_offscreen_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen32, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_offscreen32, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_PYRAMIDALQUAD, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_GAUSSIANQUAD, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_CONVOLUTIONMONO, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, 0xbadf, FALSE, TRUE},
+ {&surf_tex64, NULL, &surf_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_tex64, NULL, &surf_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_rt64, NULL, &surf_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_tex_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_tex_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&backbuffer, NULL, &surf_tex_rt_dest640_480, NULL, D3DTEXF_NONE, TRUE},
+ {&backbuffer, NULL, &surf_tex_rt_dest640_480, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ };
+
window = create_window();
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
@@ -3864,70 +3934,70 @@ static void stretchrect_test(void)
/* Create our temporary surfaces in system memory. */
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32,
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surf_temp32, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64,
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surf_temp64, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create offscreen plain surfaces in D3DPOOL_DEFAULT. */
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf_offscreen32, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf_offscreen64, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf_offscreen_dest64, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create render target surfaces. */
hr = IDirect3DDevice9_CreateRenderTarget(device, 32, 32,
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &surf_rt32, NULL );
- ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateRenderTarget(device, 64, 64,
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &surf_rt64, NULL );
- ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateRenderTarget(device, 64, 64,
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &surf_rt_dest64, NULL );
- ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
- ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create render target textures. */
hr = IDirect3DDevice9_CreateTexture(device, 32, 32, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt32, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt_dest64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 640, 480, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt_dest640_480, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt32, 0, &surf_tex_rt32);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt64, 0, &surf_tex_rt64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt_dest64, 0, &surf_tex_rt_dest64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt_dest640_480, 0, &surf_tex_rt_dest640_480);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create regular textures in D3DPOOL_DEFAULT. */
hr = IDirect3DDevice9_CreateTexture(device, 32, 32, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex32, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_dest64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex32, 0, &surf_tex32);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex64, 0, &surf_tex64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_dest64, 0, &surf_tex_dest64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/**********************************************************************
* Tests for when the source parameter is an offscreen plain surface. *
@@ -3945,35 +4015,19 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
surf_offscreen_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64_flipy,
- surf_offscreen_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
- surf_offscreen_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* offscreenplain ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xff00ff00, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* offscreenplain ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -3984,32 +4038,16 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* offscreenplain ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* Fill the smaller offscreen surface with red. */
fill_surface(surf_offscreen32, 0xffff0000, 0);
- /* offscreenplain ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* offscreenplain ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4019,10 +4057,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* offscreenplain ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/*************************************************************
* Tests for when the source parameter is a regular texture. *
*************************************************************/
@@ -4031,32 +4065,20 @@ static void stretchrect_test(void)
/* Can't fill the surf_tex directly because it's created in D3DPOOL_DEFAULT. */
fill_surface(surf_temp64, 0xff0000ff, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp64, NULL, surf_tex64, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* texture ==> offscreenplain, same size. */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* texture ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xff0000ff, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* texture ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -4067,35 +4089,19 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* texture ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- 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. */
fill_surface(surf_temp32, 0xffff0000, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp32, NULL, surf_tex32, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* texture ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* texture ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4105,10 +4111,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* texture ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/******************************************************************
* Tests for when the source parameter is a rendertarget texture. *
******************************************************************/
@@ -4117,32 +4119,20 @@ static void stretchrect_test(void)
/* Can't fill the surf_tex_rt directly because it's created in D3DPOOL_DEFAULT. */
fill_surface(surf_temp64, 0xffffffff, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp64, NULL, surf_tex_rt64, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* rendertarget texture ==> offscreenplain, same size. */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* rendertarget texture ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xffffffff, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* rendertarget texture ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -4153,35 +4143,19 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* rendertarget texture ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- 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. */
fill_surface(surf_temp32, 0xffff0000, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp32, NULL, surf_tex_rt32, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* rendertarget texture ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* rendertarget texture ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4191,10 +4165,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* rendertarget texture ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/******************************************************************
* Tests for when the source parameter is a rendertarget surface. *
******************************************************************/
@@ -4202,30 +4172,18 @@ static void stretchrect_test(void)
/* Fill the surface of the rendertarget surface with black. */
fill_surface(surf_rt64, 0xff000000, 0);
- /* rendertarget texture ==> offscreenplain, same size. */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* rendertarget surface ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xff000000, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* rendertarget surface ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -4236,32 +4194,16 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* rendertarget surface ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- 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);
- /* rendertarget surface ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* rendertarget surface ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4271,10 +4213,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* rendertarget surface ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* backbuffer ==> surface tests (no scaling). */
/* Blit with NULL rectangles. */
hr = IDirect3DDevice9_StretchRect(device, backbuffer, NULL, surf_tex_rt_dest640_480, NULL, D3DTEXF_NONE);
@@ -4283,14 +4221,17 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, backbuffer, &src_rect,
surf_tex_rt_dest640_480, &dst_rect, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, backbuffer, &src_rect_flipy,
- surf_tex_rt_dest640_480, &dst_rect, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, backbuffer, &src_rect,
- surf_tex_rt_dest640_480, &dst_rect_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+
+ /* Test error conditions. */
+ for (i = 0; i < ARRAY_SIZE(error_condition_tests); ++i)
+ {
+ const struct error_condition_test *test = &error_condition_tests[i];
+
+ hr = IDirect3DDevice9_StretchRect(device, *test->src, test->src_rect, *test->dst,
+ test->dst_rect, test->filter);
+ todo_wine_if(test->todo)
+ ok(hr == test->allowed ? D3D_OK : D3DERR_INVALIDCALL, "Test %u, got unexpected hr %#x.\n", i, hr);
+ }
/* TODO: Test format conversions. */
--
2.24.1
1
1
[PATCH 4/5] msvcrt: Use public onexit table declarations in importlib.
by Jacek Caban March 13, 2020
by Jacek Caban March 13, 2020
March 13, 2020
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/msvcrt/onexit.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
1
0
March 13, 2020
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/ucrtbase/tests/misc.c | 88 ++++++++++++++++----------------------
1 file changed, 37 insertions(+), 51 deletions(-)
1
0
March 13, 2020
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
include/msvcrt/corecrt_startup.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
1
0
[PATCH 1/2] d3d9/tests: Add tests for allowed filters for StrecthRect().
by Paul Gofman March 13, 2020
by Paul Gofman March 13, 2020
March 13, 2020
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com>
---
dlls/d3d9/tests/visual.c | 301 ++++++++++++++++-----------------------
1 file changed, 121 insertions(+), 180 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 0e71e23018..3eb29d0e92 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -3828,16 +3828,17 @@ static void fill_surface(IDirect3DSurface9 *surface, DWORD color, DWORD flags)
static void stretchrect_test(void)
{
- IDirect3DSurface9 *surf_tex_rt32, *surf_tex_rt64, *surf_tex_rt_dest64, *surf_tex_rt_dest640_480;
- IDirect3DSurface9 *surf_offscreen32, *surf_offscreen64, *surf_offscreen_dest64;
+ static IDirect3DSurface9 *surf_tex_rt32, *surf_tex_rt64, *surf_tex_rt_dest64, *surf_tex_rt_dest640_480;
+ static IDirect3DSurface9 *surf_offscreen32, *surf_offscreen64, *surf_offscreen_dest64;
IDirect3DTexture9 *tex_rt32, *tex_rt64, *tex_rt_dest64, *tex_rt_dest640_480;
- IDirect3DSurface9 *surf_tex32, *surf_tex64, *surf_tex_dest64;
- IDirect3DSurface9 *surf_rt32, *surf_rt64, *surf_rt_dest64;
+ static IDirect3DSurface9 *surf_tex32, *surf_tex64, *surf_tex_dest64;
+ static IDirect3DSurface9 *surf_rt32, *surf_rt64, *surf_rt_dest64;
IDirect3DTexture9 *tex32, *tex64, *tex_dest64;
IDirect3DSurface9 *surf_temp32, *surf_temp64;
- IDirect3DSurface9 *backbuffer;
+ static IDirect3DSurface9 *backbuffer;
IDirect3DDevice9 *device;
IDirect3D9 *d3d;
+ unsigned int i;
D3DCOLOR color;
ULONG refcount;
HWND window;
@@ -3852,6 +3853,75 @@ static void stretchrect_test(void)
static const RECT dst_rect64 = {0, 0, 64, 64};
static const RECT dst_rect64_flipy = {0, 64, 64, 0};
+ static const struct error_condition_test
+ {
+ IDirect3DSurface9 **src;
+ const RECT *src_rect;
+ IDirect3DSurface9 **dst;
+ const RECT *dst_rect;
+ D3DTEXTUREFILTERTYPE filter;
+ BOOL allowed;
+ BOOL todo;
+ }
+ error_condition_tests[] =
+ {
+ {&surf_offscreen64, &src_rect64_flipy, &surf_offscreen_dest64, &dst_rect64, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64, &surf_offscreen_dest64, &dst_rect64_flipy, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64, D3DTEXF_NONE,},
+ {&surf_offscreen64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE,},
+ {&surf_offscreen64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_offscreen32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_offscreen32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex64, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex_rt64, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex_rt64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex_rt64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex_rt64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_tex_rt64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_tex_rt64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_tex_rt32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_tex_rt32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_rt64, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_rt64, &src_rect64_flipy, &surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE},
+ {&surf_rt64, &src_rect64, &surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_rt64, &src_rect64_flipy, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_rt64, &src_rect64, &surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE},
+ {&surf_rt64, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&surf_rt32, NULL, &surf_offscreen64, NULL, D3DTEXF_NONE, FALSE, TRUE},
+ {&surf_rt32, NULL, &surf_tex_dest64, NULL, D3DTEXF_NONE},
+ {&backbuffer, &src_rect_flipy, &surf_tex_rt_dest640_480, &dst_rect, D3DTEXF_NONE},
+ {&backbuffer, &src_rect, &surf_tex_rt_dest640_480, &dst_rect_flipy, D3DTEXF_NONE},
+ /* Test filter. */
+ {&surf_offscreen64, NULL, &surf_offscreen_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_offscreen64, NULL, &surf_offscreen_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen32, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_offscreen32, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_PYRAMIDALQUAD, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_GAUSSIANQUAD, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_CONVOLUTIONMONO, FALSE, TRUE},
+ {&surf_offscreen64, NULL, &surf_tex_rt_dest64, NULL, 0xbadf, FALSE, TRUE},
+ {&surf_tex64, NULL, &surf_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_tex64, NULL, &surf_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_rt64, NULL, &surf_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_tex_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_tex_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&surf_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_NONE, TRUE},
+ {&surf_rt64, NULL, &surf_tex_rt_dest64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ {&backbuffer, NULL, &surf_tex_rt_dest640_480, NULL, D3DTEXF_NONE, TRUE},
+ {&backbuffer, NULL, &surf_tex_rt_dest640_480, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
+ };
+
window = create_window();
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
@@ -3864,70 +3934,70 @@ static void stretchrect_test(void)
/* Create our temporary surfaces in system memory. */
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32,
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surf_temp32, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64,
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surf_temp64, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create offscreen plain surfaces in D3DPOOL_DEFAULT. */
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf_offscreen32, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf_offscreen64, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf_offscreen_dest64, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create render target surfaces. */
hr = IDirect3DDevice9_CreateRenderTarget(device, 32, 32,
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &surf_rt32, NULL );
- ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateRenderTarget(device, 64, 64,
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &surf_rt64, NULL );
- ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateRenderTarget(device, 64, 64,
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &surf_rt_dest64, NULL );
- ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
- ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create render target textures. */
hr = IDirect3DDevice9_CreateTexture(device, 32, 32, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt32, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt_dest64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 640, 480, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_rt_dest640_480, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt32, 0, &surf_tex_rt32);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt64, 0, &surf_tex_rt64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt_dest64, 0, &surf_tex_rt_dest64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_rt_dest640_480, 0, &surf_tex_rt_dest640_480);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Create regular textures in D3DPOOL_DEFAULT. */
hr = IDirect3DDevice9_CreateTexture(device, 32, 32, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex32, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tex_dest64, NULL);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex32, 0, &surf_tex32);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex64, 0, &surf_tex64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(tex_dest64, 0, &surf_tex_dest64);
- ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/**********************************************************************
* Tests for when the source parameter is an offscreen plain surface. *
@@ -3945,35 +4015,19 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
surf_offscreen_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64_flipy,
- surf_offscreen_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
- surf_offscreen_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* offscreenplain ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xff00ff00, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* offscreenplain ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -3984,32 +4038,16 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* offscreenplain ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* Fill the smaller offscreen surface with red. */
fill_surface(surf_offscreen32, 0xffff0000, 0);
- /* offscreenplain ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* offscreenplain ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_offscreen32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4019,10 +4057,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* offscreenplain ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_offscreen32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/*************************************************************
* Tests for when the source parameter is a regular texture. *
*************************************************************/
@@ -4031,32 +4065,20 @@ static void stretchrect_test(void)
/* Can't fill the surf_tex directly because it's created in D3DPOOL_DEFAULT. */
fill_surface(surf_temp64, 0xff0000ff, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp64, NULL, surf_tex64, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* texture ==> offscreenplain, same size. */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* texture ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xff0000ff, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* texture ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -4067,35 +4089,19 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* texture ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- 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. */
fill_surface(surf_temp32, 0xffff0000, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp32, NULL, surf_tex32, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* texture ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* texture ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4105,10 +4111,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* texture ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/******************************************************************
* Tests for when the source parameter is a rendertarget texture. *
******************************************************************/
@@ -4117,32 +4119,20 @@ static void stretchrect_test(void)
/* Can't fill the surf_tex_rt directly because it's created in D3DPOOL_DEFAULT. */
fill_surface(surf_temp64, 0xffffffff, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp64, NULL, surf_tex_rt64, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* rendertarget texture ==> offscreenplain, same size. */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* rendertarget texture ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xffffffff, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* rendertarget texture ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -4153,35 +4143,19 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* rendertarget texture ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- 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. */
fill_surface(surf_temp32, 0xffff0000, 0);
hr = IDirect3DDevice9_UpdateSurface(device, surf_temp32, NULL, surf_tex_rt32, NULL);
- ok(SUCCEEDED(hr), "Failed to update surface, hr %#x.\n", hr);
-
- /* rendertarget texture ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* rendertarget texture ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4191,10 +4165,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* rendertarget texture ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_tex_rt32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/******************************************************************
* Tests for when the source parameter is a rendertarget surface. *
******************************************************************/
@@ -4202,30 +4172,18 @@ static void stretchrect_test(void)
/* Fill the surface of the rendertarget surface with black. */
fill_surface(surf_rt64, 0xff000000, 0);
- /* rendertarget texture ==> offscreenplain, same size. */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* rendertarget surface ==> rendertarget texture, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 32, 32);
ok(color == 0xff000000, "Got unexpected color 0x%08x.\n", color);
/* Blit without scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64_flipy,
- surf_tex_rt_dest64, &dst_rect64, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
- surf_tex_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
/* rendertarget surface ==> rendertarget surface, same size. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_rt_dest64, NULL, D3DTEXF_NONE);
@@ -4236,32 +4194,16 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
surf_rt_dest64, &dst_rect64, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64_flipy,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, &src_rect64,
- surf_rt_dest64, &dst_rect64_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
- /* rendertarget surface ==> texture, same size (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt64, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- 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);
- /* rendertarget surface ==> offscreenplain, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt32, NULL, surf_offscreen64, NULL, D3DTEXF_NONE);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* rendertarget surface ==> rendertarget texture, scaling. */
hr = IDirect3DDevice9_StretchRect(device, surf_rt32, NULL, surf_tex_rt_dest64, NULL, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* We can't lock rendertarget textures, so copy to our temp surface first. */
hr = IDirect3DDevice9_GetRenderTargetData(device, surf_tex_rt_dest64, surf_temp64);
- ok(SUCCEEDED(hr), "Failed to get render target data, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColorFromSurface(surf_temp64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
@@ -4271,10 +4213,6 @@ static void stretchrect_test(void)
color = getPixelColorFromSurface(surf_rt_dest64, 48, 48);
ok(color == 0xffff0000, "Got unexpected color 0x%08x.\n", color);
- /* rendertarget surface ==> texture, scaling (should fail). */
- hr = IDirect3DDevice9_StretchRect(device, surf_rt32, NULL, surf_tex_dest64, NULL, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-
/* backbuffer ==> surface tests (no scaling). */
/* Blit with NULL rectangles. */
hr = IDirect3DDevice9_StretchRect(device, backbuffer, NULL, surf_tex_rt_dest640_480, NULL, D3DTEXF_NONE);
@@ -4283,14 +4221,17 @@ static void stretchrect_test(void)
hr = IDirect3DDevice9_StretchRect(device, backbuffer, &src_rect,
surf_tex_rt_dest640_480, &dst_rect, D3DTEXF_NONE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through src_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, backbuffer, &src_rect_flipy,
- surf_tex_rt_dest640_480, &dst_rect, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Flipping in y-direction through dst_rect, no scaling (not allowed). */
- hr = IDirect3DDevice9_StretchRect(device, backbuffer, &src_rect,
- surf_tex_rt_dest640_480, &dst_rect_flipy, D3DTEXF_NONE);
- ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+
+ /* Test error conditions. */
+ for (i = 0; i < ARRAY_SIZE(error_condition_tests); ++i)
+ {
+ const struct error_condition_test *test = &error_condition_tests[i];
+
+ hr = IDirect3DDevice9_StretchRect(device, *test->src, test->src_rect, *test->dst,
+ test->dst_rect, test->filter);
+ todo_wine_if(test->todo)
+ ok(hr == test->allowed ? D3D_OK : D3DERR_INVALIDCALL, "Test %u, got unexpected hr %#x.\n", i, hr);
+ }
/* TODO: Test format conversions. */
--
2.24.1
2
2
[PATCH 1/9] mfplat: Implement MFCreateMediaBufferFromMediaType() for audio types.
by Nikolay Sivov March 13, 2020
by Nikolay Sivov March 13, 2020
March 13, 2020
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/mfplat/buffer.c | 62 ++++++++++++++++++++++++++++++++++
dlls/mfplat/mfplat.spec | 1 +
dlls/mfplat/tests/mfplat.c | 68 ++++++++++++++++++++++++++++++++++++++
include/mfapi.h | 2 ++
4 files changed, 133 insertions(+)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index 590288e344..b1d353a59b 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -448,6 +448,68 @@ HRESULT WINAPI MFCreate2DMediaBuffer(DWORD width, DWORD height, DWORD fourcc, BO
return create_2d_buffer(width, height, fourcc, buffer);
}
+static unsigned int buffer_get_aligned_length(unsigned int length, unsigned int alignment)
+{
+ length = (length + alignment) / alignment;
+ length *= alignment;
+
+ return length;
+}
+
+HRESULT WINAPI MFCreateMediaBufferFromMediaType(IMFMediaType *media_type, LONGLONG duration, DWORD min_length,
+ DWORD alignment, IMFMediaBuffer **buffer)
+{
+ UINT32 length = 0, block_alignment;
+ LONGLONG avg_length;
+ HRESULT hr;
+ GUID major;
+
+ TRACE("%p, %s, %u, %u, %p.\n", media_type, wine_dbgstr_longlong(duration), min_length, alignment, buffer);
+
+ if (!media_type)
+ return E_INVALIDARG;
+
+ if (FAILED(hr = IMFMediaType_GetMajorType(media_type, &major)))
+ return hr;
+
+ if (IsEqualGUID(&major, &MFMediaType_Audio))
+ {
+ block_alignment = 0;
+ if (FAILED(IMFMediaType_GetUINT32(media_type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &block_alignment)))
+ WARN("Block alignment was not specified.\n");
+
+ if (block_alignment)
+ {
+ avg_length = 0;
+
+ if (duration)
+ {
+ length = 0;
+ if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, &length)))
+ {
+ /* 100 ns -> 1 s */
+ avg_length = length * duration / (10 * 1000 * 1000);
+ }
+ }
+
+ alignment = max(16, alignment);
+
+ length = buffer_get_aligned_length(avg_length + 1, alignment);
+ length = buffer_get_aligned_length(length, block_alignment);
+ }
+ else
+ length = 0;
+
+ length = max(length, min_length);
+
+ return create_1d_buffer(length, MF_1_BYTE_ALIGNMENT, buffer);
+ }
+ else
+ FIXME("Major type %s is not supported.\n", debugstr_guid(&major));
+
+ return E_NOTIMPL;
+}
+
static HRESULT WINAPI sample_QueryInterface(IMFSample *iface, REFIID riid, void **out)
{
TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), out);
diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec
index 2fb6388a31..9f08d1aff2 100644
--- a/dlls/mfplat/mfplat.spec
+++ b/dlls/mfplat/mfplat.spec
@@ -52,6 +52,7 @@
@ stdcall MFCreateMFByteStreamOnStreamEx(ptr ptr)
@ stdcall MFCreateMFByteStreamWrapper(ptr ptr)
@ stub MFCreateMFVideoFormatFromMFMediaType
+@ stdcall MFCreateMediaBufferFromMediaType(ptr int64 long long ptr)
@ stub MFCreateMediaBufferWrapper
@ stdcall MFCreateMediaEvent(long ptr long ptr ptr)
@ stdcall MFCreateMediaType(ptr)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 31194db77f..7134c62a79 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -95,6 +95,8 @@ static HRESULT (WINAPI *pMFGetPlaneSize)(DWORD format, DWORD width, DWORD height
static HRESULT (WINAPI *pMFGetStrideForBitmapInfoHeader)(DWORD format, DWORD width, LONG *stride);
static HRESULT (WINAPI *pMFCreate2DMediaBuffer)(DWORD width, DWORD height, DWORD fourcc, BOOL bottom_up,
IMFMediaBuffer **buffer);
+static HRESULT (WINAPI *pMFCreateMediaBufferFromMediaType)(IMFMediaType *media_type, LONGLONG duration, DWORD min_length,
+ DWORD min_alignment, IMFMediaBuffer **buffer);
static const WCHAR fileschemeW[] = L"file://";
@@ -665,6 +667,7 @@ static void init_functions(void)
X(MFCreate2DMediaBuffer);
X(MFCreateDXGIDeviceManager);
X(MFCreateSourceResolver);
+ X(MFCreateMediaBufferFromMediaType);
X(MFCreateMFByteStreamOnStream);
X(MFCreateTransformActivate);
X(MFGetPlaneSize);
@@ -4587,6 +4590,70 @@ static void test_MFCreate2DMediaBuffer(void)
IMFMediaBuffer_Release(buffer);
}
+static void test_MFCreateMediaBufferFromMediaType(void)
+{
+ static struct audio_buffer_test
+ {
+ unsigned int duration;
+ unsigned int min_length;
+ unsigned int min_alignment;
+ unsigned int block_alignment;
+ unsigned int bytes_per_second;
+ unsigned int buffer_length;
+ } audio_tests[] =
+ {
+ { 0, 0, 0, 4, 0, 20 },
+ { 0, 16, 0, 4, 0, 20 },
+ { 0, 0, 32, 4, 0, 36 },
+ { 0, 64, 32, 4, 0, 64 },
+ { 1, 0, 0, 4, 16, 36 },
+ { 2, 0, 0, 4, 16, 52 },
+ };
+ IMFMediaBuffer *buffer;
+ UINT32 length;
+ HRESULT hr;
+ IMFMediaType *media_type;
+ unsigned int i;
+
+ if (!pMFCreateMediaBufferFromMediaType)
+ {
+ win_skip("MFCreateMediaBufferFromMediaType() is not available.\n");
+ return;
+ }
+
+ hr = pMFCreateMediaBufferFromMediaType(NULL, 0, 0, 0, &buffer);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+
+ hr = MFCreateMediaType(&media_type);
+ ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
+
+ hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
+ ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(audio_tests); ++i)
+ {
+ const struct audio_buffer_test *ptr = &audio_tests[i];
+
+ hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, ptr->block_alignment);
+ ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
+
+ hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, ptr->bytes_per_second);
+ ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
+
+ hr = pMFCreateMediaBufferFromMediaType(media_type, ptr->duration * 10000000, ptr->min_length,
+ ptr->min_alignment, &buffer);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFMediaBuffer_GetMaxLength(buffer, &length);
+ ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr);
+ ok(ptr->buffer_length == length, "%d: unexpected buffer length %u, expected %u.\n", i, length, ptr->buffer_length);
+
+ IMFMediaBuffer_Release(buffer);
+ }
+
+ IMFMediaType_Release(media_type);
+}
+
START_TEST(mfplat)
{
char **argv;
@@ -4640,6 +4707,7 @@ START_TEST(mfplat)
test_queue_com();
test_MFGetStrideForBitmapInfoHeader();
test_MFCreate2DMediaBuffer();
+ test_MFCreateMediaBufferFromMediaType();
CoUninitialize();
}
diff --git a/include/mfapi.h b/include/mfapi.h
index 9f4db44d1e..9c22b6bfd8 100644
--- a/include/mfapi.h
+++ b/include/mfapi.h
@@ -411,6 +411,8 @@ HRESULT WINAPI MFCreateDXGIDeviceManager(UINT *token, IMFDXGIDeviceManager **man
HRESULT WINAPI MFCreateEventQueue(IMFMediaEventQueue **queue);
HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE openmode, MF_FILE_FLAGS flags,
LPCWSTR url, IMFByteStream **bytestream);
+HRESULT WINAPI MFCreateMediaBufferFromMediaType(IMFMediaType *media_type, LONGLONG duration, DWORD min_length,
+ DWORD min_alignment, IMFMediaBuffer **buffer);
HRESULT WINAPI MFCreateMediaEvent(MediaEventType type, REFGUID extended_type, HRESULT status,
const PROPVARIANT *value, IMFMediaEvent **event);
HRESULT WINAPI MFCreateMediaType(IMFMediaType **type);
--
2.25.1
2
9
March 13, 2020
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/d3d9/tests/device.c | 299 +++++++++++++++++++++++----------------
1 file changed, 174 insertions(+), 125 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index d00a26b942c..64802bb15db 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -150,7 +150,8 @@ static BOOL adapter_is_warp(const D3DADAPTER_IDENTIFIER9 *identifier)
return !strcmp(identifier->Driver, "d3d10warp.dll");
}
-static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, const struct device_desc *desc)
+static IDirect3DDevice9 *create_device_on_adapter(IDirect3D9 *d3d9, unsigned int adapter_idx,
+ HWND focus_window, const struct device_desc *desc)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
IDirect3DDevice9 *device;
@@ -185,12 +186,12 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, cons
behavior_flags |= D3DCREATE_FPU_PRESERVE;
}
- if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_idx, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
- if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_idx, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
@@ -200,13 +201,18 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, cons
& ~(D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING))
| D3DCREATE_HARDWARE_VERTEXPROCESSING;
- if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_idx, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
return NULL;
}
+static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, const struct device_desc *desc)
+{
+ return create_device_on_adapter(d3d9, D3DADAPTER_DEFAULT, focus_window, desc);
+}
+
static HRESULT reset_device(IDirect3DDevice9 *device, const struct device_desc *desc)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
@@ -12555,8 +12561,41 @@ static void test_stretch_rect(void)
DestroyWindow(window);
}
+#define test_device_caps_adapter_group(a, b, c) _test_device_caps_adapter_group(a, b, c, __LINE__)
+static void _test_device_caps_adapter_group(const D3DCAPS9 *caps, unsigned int adapter_idx,
+ unsigned int adapter_count, int line)
+{
+ ok_(__FILE__, line)(caps->AdapterOrdinal == adapter_idx, "Expect AdapterOrdinal %u, got %u.\n",
+ adapter_idx, caps->AdapterOrdinal);
+ /* Single GPU */
+ if (caps->NumberOfAdaptersInGroup == adapter_count)
+ {
+ ok_(__FILE__, line)(caps->MasterAdapterOrdinal == 0,
+ "Expect MasterAdapterOrdinal %u, got %u.\n", 0, caps->MasterAdapterOrdinal);
+ ok_(__FILE__, line)(caps->AdapterOrdinalInGroup == caps->AdapterOrdinal,
+ "Expect AdapterOrdinalInGroup %u, got %u.\n", caps->AdapterOrdinal,
+ caps->AdapterOrdinalInGroup);
+ ok_(__FILE__, line)(caps->NumberOfAdaptersInGroup ==
+ (caps->AdapterOrdinalInGroup ? 0 : adapter_count),
+ "Expect NumberOfAdaptersInGroup %u, got %u.\n",
+ (caps->AdapterOrdinalInGroup ? 0 : adapter_count),
+ caps->NumberOfAdaptersInGroup);
+ }
+ /* Multiple GPUs and each GPU has only one output */
+ else if (caps->NumberOfAdaptersInGroup == 1)
+ {
+ ok_(__FILE__, line)(caps->MasterAdapterOrdinal == caps->AdapterOrdinal,
+ "Expect MasterAdapterOrdinal %u, got %u.\n", caps->AdapterOrdinal,
+ caps->MasterAdapterOrdinal);
+ ok_(__FILE__, line)(caps->AdapterOrdinalInGroup == 0,
+ "Expect AdapterOrdinalInGroup %u, got %u.\n", 0, caps->AdapterOrdinalInGroup);
+ }
+ /* TODO: Test other multi-GPU setup */
+}
+
static void test_device_caps(void)
{
+ unsigned int adapter_idx, adapter_count;
IDirect3DDevice9 *device;
IDirect3D9 *d3d;
ULONG refcount;
@@ -12568,129 +12607,139 @@ static void test_device_caps(void)
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
- if (!(device = create_device(d3d, window, NULL)))
+ adapter_count = IDirect3D9_GetAdapterCount(d3d);
+ for (adapter_idx = 0; adapter_idx < adapter_count; ++adapter_idx)
{
- skip("Failed to create a D3D device.\n");
- IDirect3D9_Release(d3d);
- DestroyWindow(window);
- return;
+ /* Test IDirect3D9_GetDeviceCaps */
+ hr = IDirect3D9_GetDeviceCaps(d3d, adapter_idx, D3DDEVTYPE_HAL, &caps);
+ ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "GetDeviceCaps failed, hr %#x.\n", hr);
+ if (hr == D3DERR_NOTAVAILABLE)
+ {
+ skip("No Direct3D support, skipping test.\n");
+ break;
+ }
+ test_device_caps_adapter_group(&caps, adapter_idx, adapter_count);
+
+ /* Test IDirect3DDevice9_GetDeviceCaps */
+ device = create_device_on_adapter(d3d, adapter_idx, window, NULL);
+ ok(!!device, "Failed to create a D3D device on adapter %u.\n", adapter_idx);
+ hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
+ ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
+
+ test_device_caps_adapter_group(&caps, adapter_idx, adapter_count);
+ ok(!(caps.Caps & ~D3DCAPS_READ_SCANLINE), "Caps field has unexpected flags %#x.\n", caps.Caps);
+ ok(!(caps.Caps2 & ~(D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_FULLSCREENGAMMA
+ | D3DCAPS2_CANRENDERWINDOWED | D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_RESERVED
+ | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_CANAUTOGENMIPMAP
+ | D3DCAPS2_CANSHARERESOURCE)),
+ "Caps2 field has unexpected flags %#x.\n", caps.Caps2);
+ /* AMD doesn't filter all the ddraw / d3d9 caps. Consider that behavior
+ * broken. */
+ ok(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
+ | D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION | D3DCAPS3_COPY_TO_VIDMEM
+ | D3DCAPS3_COPY_TO_SYSTEMMEM | D3DCAPS3_DXVAHD | D3DCAPS3_DXVAHD_LIMITED
+ | D3DCAPS3_RESERVED)),
+ "Caps3 field has unexpected flags %#x.\n", caps.Caps3);
+ ok(!(caps.PrimitiveMiscCaps & ~(D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP
+ | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW
+ | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS
+ | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP
+ | D3DPMISCCAPS_NULLREFERENCE | D3DPMISCCAPS_INDEPENDENTWRITEMASKS
+ | D3DPMISCCAPS_PERSTAGECONSTANT | D3DPMISCCAPS_FOGANDSPECULARALPHA
+ | D3DPMISCCAPS_SEPARATEALPHABLEND | D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
+ | D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING | D3DPMISCCAPS_FOGVERTEXCLAMPED
+ | D3DPMISCCAPS_POSTBLENDSRGBCONVERT)),
+ "PrimitiveMiscCaps field has unexpected flags %#x.\n", caps.PrimitiveMiscCaps);
+ ok(!(caps.RasterCaps & ~(D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_ZTEST
+ | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE
+ | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR
+ | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER
+ | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE
+ | D3DPRASTERCAPS_SCISSORTEST | D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
+ | D3DPRASTERCAPS_DEPTHBIAS | D3DPRASTERCAPS_MULTISAMPLE_TOGGLE))
+ || broken(!(caps.RasterCaps & ~0x0f736191)),
+ "RasterCaps field has unexpected flags %#x.\n", caps.RasterCaps);
+ /* D3DPBLENDCAPS_SRCCOLOR2 and D3DPBLENDCAPS_INVSRCCOLOR2 are only
+ * advertised on the reference rasterizer and WARP. */
+ ok(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
+ | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
+ | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
+ | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
+ | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR))
+ || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
+ | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
+ | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
+ | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
+ | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR
+ | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))),
+ "SrcBlendCaps field has unexpected flags %#x.\n", caps.SrcBlendCaps);
+ ok(!(caps.DestBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
+ | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
+ | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
+ | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
+ | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR))
+ || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
+ | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
+ | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
+ | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
+ | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR
+ | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))),
+ "DestBlendCaps field has unexpected flags %#x.\n", caps.DestBlendCaps);
+ ok(!(caps.TextureCaps & ~(D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2
+ | D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_SQUAREONLY
+ | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE
+ | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PROJECTED
+ | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP
+ | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP
+ | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2
+ | D3DPTEXTURECAPS_NOPROJECTEDBUMPENV)),
+ "TextureCaps field has unexpected flags %#x.\n", caps.TextureCaps);
+ ok(!(caps.TextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
+ | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
+ | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT
+ | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_CONVOLUTIONMONO
+ | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
+ | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
+ | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)),
+ "TextureFilterCaps field has unexpected flags %#x.\n", caps.TextureFilterCaps);
+ ok(!(caps.CubeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
+ | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
+ | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT
+ | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
+ | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
+ | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)),
+ "CubeTextureFilterCaps field has unexpected flags %#x.\n", caps.CubeTextureFilterCaps);
+ ok(!(caps.VolumeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
+ | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
+ | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT
+ | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
+ | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
+ | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)),
+ "VolumeTextureFilterCaps field has unexpected flags %#x.\n", caps.VolumeTextureFilterCaps);
+ ok(!(caps.LineCaps & ~(D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST | D3DLINECAPS_BLEND
+ | D3DLINECAPS_ALPHACMP | D3DLINECAPS_FOG | D3DLINECAPS_ANTIALIAS)),
+ "LineCaps field has unexpected flags %#x.\n", caps.LineCaps);
+ ok(!(caps.StencilCaps & ~(D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE
+ | D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT
+ | D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR | D3DSTENCILCAPS_TWOSIDED)),
+ "StencilCaps field has unexpected flags %#x.\n", caps.StencilCaps);
+ ok(!(caps.VertexProcessingCaps & ~(D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7
+ | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER
+ | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_TEXGEN_SPHEREMAP
+ | D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER)),
+ "VertexProcessingCaps field has unexpected flags %#x.\n", caps.VertexProcessingCaps);
+ /* Both Nvidia and AMD give 10 here. */
+ ok(caps.MaxActiveLights <= 10,
+ "MaxActiveLights field has unexpected value %u.\n", caps.MaxActiveLights);
+ /* AMD gives 6, Nvidia returns 8. */
+ ok(caps.MaxUserClipPlanes <= 8,
+ "MaxUserClipPlanes field has unexpected value %u.\n", caps.MaxUserClipPlanes);
+ ok(caps.MaxVertexW == 0.0f || caps.MaxVertexW >= 1e10f,
+ "MaxVertexW field has unexpected value %.8e.\n", caps.MaxVertexW);
+
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
}
-
- hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
- ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
-
- ok(!(caps.Caps & ~D3DCAPS_READ_SCANLINE), "Caps field has unexpected flags %#x.\n", caps.Caps);
- ok(!(caps.Caps2 & ~(D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_FULLSCREENGAMMA
- | D3DCAPS2_CANRENDERWINDOWED | D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_RESERVED
- | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_CANAUTOGENMIPMAP
- | D3DCAPS2_CANSHARERESOURCE)),
- "Caps2 field has unexpected flags %#x.\n", caps.Caps2);
- /* AMD doesn't filter all the ddraw / d3d9 caps. Consider that behavior
- * broken. */
- ok(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
- | D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION | D3DCAPS3_COPY_TO_VIDMEM
- | D3DCAPS3_COPY_TO_SYSTEMMEM | D3DCAPS3_DXVAHD | D3DCAPS3_DXVAHD_LIMITED
- | D3DCAPS3_RESERVED)),
- "Caps3 field has unexpected flags %#x.\n", caps.Caps3);
- ok(!(caps.PrimitiveMiscCaps & ~(D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP
- | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW
- | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS
- | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP
- | D3DPMISCCAPS_NULLREFERENCE | D3DPMISCCAPS_INDEPENDENTWRITEMASKS
- | D3DPMISCCAPS_PERSTAGECONSTANT | D3DPMISCCAPS_FOGANDSPECULARALPHA
- | D3DPMISCCAPS_SEPARATEALPHABLEND | D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
- | D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING | D3DPMISCCAPS_FOGVERTEXCLAMPED
- | D3DPMISCCAPS_POSTBLENDSRGBCONVERT)),
- "PrimitiveMiscCaps field has unexpected flags %#x.\n", caps.PrimitiveMiscCaps);
- ok(!(caps.RasterCaps & ~(D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_ZTEST
- | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE
- | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR
- | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER
- | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE
- | D3DPRASTERCAPS_SCISSORTEST | D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
- | D3DPRASTERCAPS_DEPTHBIAS | D3DPRASTERCAPS_MULTISAMPLE_TOGGLE))
- || broken(!(caps.RasterCaps & ~0x0f736191)),
- "RasterCaps field has unexpected flags %#x.\n", caps.RasterCaps);
- /* D3DPBLENDCAPS_SRCCOLOR2 and D3DPBLENDCAPS_INVSRCCOLOR2 are only
- * advertised on the reference rasterizer and WARP. */
- ok(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR))
- || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR
- | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))),
- "SrcBlendCaps field has unexpected flags %#x.\n", caps.SrcBlendCaps);
- ok(!(caps.DestBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR))
- || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR
- | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))),
- "DestBlendCaps field has unexpected flags %#x.\n", caps.DestBlendCaps);
- ok(!(caps.TextureCaps & ~(D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2
- | D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_SQUAREONLY
- | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE
- | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PROJECTED
- | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP
- | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP
- | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2
- | D3DPTEXTURECAPS_NOPROJECTEDBUMPENV)),
- "TextureCaps field has unexpected flags %#x.\n", caps.TextureCaps);
- ok(!(caps.TextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
- | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_CONVOLUTIONMONO
- | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
- | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)),
- "TextureFilterCaps field has unexpected flags %#x.\n", caps.TextureFilterCaps);
- ok(!(caps.CubeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
- | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
- | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)),
- "CubeTextureFilterCaps field has unexpected flags %#x.\n", caps.CubeTextureFilterCaps);
- ok(!(caps.VolumeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
- | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
- | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)),
- "VolumeTextureFilterCaps field has unexpected flags %#x.\n", caps.VolumeTextureFilterCaps);
- ok(!(caps.LineCaps & ~(D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST | D3DLINECAPS_BLEND
- | D3DLINECAPS_ALPHACMP | D3DLINECAPS_FOG | D3DLINECAPS_ANTIALIAS)),
- "LineCaps field has unexpected flags %#x.\n", caps.LineCaps);
- ok(!(caps.StencilCaps & ~(D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE
- | D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT
- | D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR | D3DSTENCILCAPS_TWOSIDED)),
- "StencilCaps field has unexpected flags %#x.\n", caps.StencilCaps);
- ok(!(caps.VertexProcessingCaps & ~(D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7
- | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER
- | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_TEXGEN_SPHEREMAP
- | D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER)),
- "VertexProcessingCaps field has unexpected flags %#x.\n", caps.VertexProcessingCaps);
- /* Both Nvidia and AMD give 10 here. */
- ok(caps.MaxActiveLights <= 10,
- "MaxActiveLights field has unexpected value %u.\n", caps.MaxActiveLights);
- /* AMD gives 6, Nvidia returns 8. */
- ok(caps.MaxUserClipPlanes <= 8,
- "MaxUserClipPlanes field has unexpected value %u.\n", caps.MaxUserClipPlanes);
- ok(caps.MaxVertexW == 0.0f || caps.MaxVertexW >= 1e10f,
- "MaxVertexW field has unexpected value %.8e.\n", caps.MaxVertexW);
-
- refcount = IDirect3DDevice9_Release(device);
- ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D9_Release(d3d);
DestroyWindow(window);
}
--
2.20.1
2
1
[tools] testbot/LogUtils: Optimise the _GetLineKey() line cleanup.
by Francois Gouget March 13, 2020
by Francois Gouget March 13, 2020
March 13, 2020
Most line cleanups are mutually exclusive so stop trying after the first
successful attempt.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/LogUtils.pm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index bf933a007d..57229bc40d 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -1048,15 +1048,15 @@ sub _GetLineKey($)
return undef if (!defined $Line);
# Remove the line number
- $Line =~ s/^([_a-z0-9]+\.c:)\d+:( Test (?:failed|succeeded inside todo block): )/$1$2/;
+ $Line =~ s/^([_a-z0-9]+\.c:)\d+:( Test (?:failed|succeeded inside todo block): )/$1$2/
# Remove the crash code address: it changes whenever the test is recompiled
- $Line =~ s/^(Unhandled exception: .* code) \(0x[0-9a-fA-F]{8,16}\)\.$/$1/;
- # and the process id
- $Line =~ s/^[0-9a-f]+:([_a-z0-9]+: unhandled exception [0-9a-fA-F]{8} at )[0-9a-fA-F]{8,16}$/$1/;
+ or $Line =~ s/^(Unhandled exception: .* code) \(0x[0-9a-fA-F]{8,16}\)\.$/$1/
+ # or the process id in Wine's exc_filter() lines
+ or $Line =~ s/^[0-9a-f]+:([_a-z0-9]+: unhandled exception [0-9a-fA-F]{8} at )[0-9a-fA-F]{8,16}$/$1/
# The exact amount of data printed does not change the error
- $Line =~ s/^([_.a-z0-9-]+:[_a-z0-9]* prints too much data )\(\d+ bytes\)$/$1/;
+ or $Line =~ s/^([_.a-z0-9-]+:[_a-z0-9]* prints too much data )\(\d+ bytes\)$/$1/;
# Note: The 'done (258)' lines are modified by ParseWineTestReport() and
# no longer contain the pid. So they need no further change here.
--
2.20.1
1
0
[tools] testbot/PatchUtils: Detect when make_unicode needs to be run.
by Francois Gouget March 13, 2020
by Francois Gouget March 13, 2020
March 13, 2020
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/Build/Utils.pm | 10 ++++++++++
testbot/lib/WineTestBot/PatchUtils.pm | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/testbot/lib/Build/Utils.pm b/testbot/lib/Build/Utils.pm
index cc61e31d7a..c4250781e3 100644
--- a/testbot/lib/Build/Utils.pm
+++ b/testbot/lib/Build/Utils.pm
@@ -157,6 +157,16 @@ sub ApplyPatch($$)
return undef;
}
}
+ if ($Impacts->{MakeUnicode})
+ {
+ InfoMsg "\nRunning make_unicode\n";
+ system("cd '$DataDir/$Dir/' && set -x && ./tools/make_unicode");
+ if ($? != 0)
+ {
+ LogMsg "make_unicode failed\n";
+ return undef;
+ }
+ }
if ($Impacts->{MakeVulkan})
{
InfoMsg "\nRunning make_vulkan\n";
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index f55dc4bdfe..eaa9868942 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -341,6 +341,11 @@ sub GetPatchImpacts($)
$Impacts->{PatchedRoot} = $Impacts->{MakeVulkan} = 1;
$Impacts->{IsWinePatch} = 1;
}
+ elsif ($Line =~ m=^--- \w+/tools/make_unicode$=)
+ {
+ $Impacts->{PatchedRoot} = $Impacts->{MakeUnicode} = 1;
+ $Impacts->{IsWinePatch} = 1;
+ }
elsif ($Line =~ m=^--- /dev/null$=)
{
$Change = "new";
--
2.20.1
1
0