=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: ddraw/tests: Add a YV12 blit test.
Alexandre Julliard
julliard at winehq.org
Mon Nov 14 13:33:58 CST 2011
Module: wine
Branch: master
Commit: edfeec60b164caccf6375cff91b3fc142fe2dbd7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=edfeec60b164caccf6375cff91b3fc142fe2dbd7
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Tue Nov 8 23:05:08 2011 +0100
ddraw/tests: Add a YV12 blit test.
---
dlls/ddraw/tests/overlay.c | 49 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/tests/overlay.c b/dlls/ddraw/tests/overlay.c
index 6288be1..ded7c5a 100644
--- a/dlls/ddraw/tests/overlay.c
+++ b/dlls/ddraw/tests/overlay.c
@@ -194,10 +194,10 @@ static void yv12_test(void)
{
HRESULT hr;
DDSURFACEDESC2 desc;
- IDirectDrawSurface7 *surface;
+ IDirectDrawSurface7 *surface, *dst;
char *base;
RECT rect = {13, 17, 14, 18};
- unsigned int offset;
+ unsigned int offset, y;
surface = create_overlay(256, 256, MAKEFOURCC('Y','V','1','2'));
if(!surface) {
@@ -220,7 +220,23 @@ static void yv12_test(void)
/* The overlay pitch seems to have 256 byte alignment */
ok((U1(desc).lPitch & 0xff) == 0, "Expected 256 byte aligned pitch, got %u\n", U1(desc).lPitch);
+ /* Fill the surface with some data for the blit test */
base = desc.lpSurface;
+ /* Luminance */
+ for (y = 0; y < desc.dwHeight; y++)
+ {
+ memset(base + desc.lPitch * y, 0x10, desc.dwWidth);
+ }
+ /* V */
+ for (; y < desc.dwHeight + desc.dwHeight / 4; y++)
+ {
+ memset(base + desc.lPitch * y, 0x20, desc.dwWidth);
+ }
+ /* U */
+ for (; y < desc.dwHeight + desc.dwHeight / 2; y++)
+ {
+ memset(base + desc.lPitch * y, 0x30, desc.dwWidth);
+ }
hr = IDirectDrawSurface7_Unlock(surface, NULL);
ok(hr == DD_OK, "IDirectDrawSurface7_Unlock returned 0x%08x, expected DD_OK\n", hr);
@@ -237,6 +253,35 @@ static void yv12_test(void)
hr = IDirectDrawSurface7_Unlock(surface, NULL);
ok(hr == DD_OK, "IDirectDrawSurface7_Unlock returned 0x%08x, expected DD_OK\n", hr);
+ dst = create_overlay(256, 256, MAKEFOURCC('Y','V','1','2'));
+ if (!dst)
+ {
+ /* Windows XP with a Radeon X1600 GPU refuses to create a second overlay surface,
+ * DDERR_NOOVERLAYHW, making the blit tests moot */
+ skip("Could not create a second YV12 surface, skipping blit test\n");
+ goto cleanup;
+ }
+
+ hr = IDirectDrawSurface7_Blt(dst, NULL, surface, NULL, 0, NULL);
+ ok(hr == DD_OK, "IDirectDrawSurface7_Blt returned 0x%08x, expected DD_OK\n", hr);
+
+ memset(&desc, 0, sizeof(desc));
+ desc.dwSize = sizeof(desc);
+ hr = IDirectDrawSurface7_Lock(dst, NULL, &desc, 0, NULL);
+ ok(hr == DD_OK, "IDirectDrawSurface7_Lock returned 0x%08x, expected DD_OK\n", hr);
+
+ base = desc.lpSurface;
+ ok(base[0] == 0x10, "Y data is 0x%02x, expected 0x10\n", base[0]);
+ base += desc.dwHeight * desc.lPitch;
+ todo_wine ok(base[0] == 0x20, "V data is 0x%02x, expected 0x20\n", base[0]);
+ base += desc.dwHeight / 4 * desc.lPitch;
+ todo_wine ok(base[0] == 0x30, "U data is 0x%02x, expected 0x30\n", base[0]);
+
+ hr = IDirectDrawSurface7_Unlock(dst, NULL);
+ ok(hr == DD_OK, "IDirectDrawSurface7_Unlock returned 0x%08x, expected DD_OK\n", hr);
+
+ IDirectDrawSurface7_Release(dst);
+cleanup:
IDirectDrawSurface7_Release(surface);
}
More information about the wine-cvs
mailing list