Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2cc9b854
Commit
2cc9b854
authored
Feb 24, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Test depth fill results in test_color_fill().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f0b68737
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
6 deletions
+144
-6
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+38
-1
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+38
-1
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+34
-2
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+34
-2
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
2cc9b854
...
...
@@ -21,6 +21,7 @@
#include "wine/test.h"
#include <limits.h>
#include <math.h>
#include "d3d.h"
static
BOOL
is_ddraw64
=
sizeof
(
DWORD
)
!=
sizeof
(
DWORD
*
);
...
...
@@ -7269,6 +7270,7 @@ static void test_color_fill(void)
ULONG
refcount
;
HWND
window
;
unsigned
int
i
;
BOOL
is_warp
;
DDBLTFX
fx
;
RECT
rect
=
{
5
,
5
,
7
,
7
};
DWORD
*
color
;
...
...
@@ -7321,7 +7323,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_ZBUFFER
|
DDSCAPS_VIDEOMEMORY
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
,
FALS
E
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
xdeadbeef
,
TRU
E
,
{
0
,
0
,
0
,
{
0
},
{
0
},
{
0
},
{
0
},
{
0
}}
},
{
...
...
@@ -7427,6 +7429,7 @@ static void test_color_fill(void)
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ddraw
=
create_ddraw
();
ok
(
!!
ddraw
,
"Failed to create a ddraw object.
\n
"
);
is_warp
=
ddraw_is_warp
(
ddraw
);
if
(
!
(
device
=
create_device
(
ddraw
,
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
...
...
@@ -7462,6 +7465,9 @@ static void test_color_fill(void)
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
i
++
)
{
DWORD
expected_broken
=
tests
[
i
].
result
;
DWORD
mask
=
0xffffffffu
;
/* Some Windows drivers modify dwFillColor when it is used on P8 or FourCC formats. */
memset
(
&
fx
,
0
,
sizeof
(
fx
));
fx
.
dwSize
=
sizeof
(
fx
);
...
...
@@ -7496,6 +7502,21 @@ static void test_color_fill(void)
surface_desc
.
dwFlags
&=
~
DDSD_PIXELFORMAT
;
surface_desc
.
dwFlags
|=
DDSD_ZBUFFERBITDEPTH
;
U2
(
surface_desc
).
dwZBufferBitDepth
=
get_device_z_depth
(
device
);
mask
>>=
(
32
-
U2
(
surface_desc
).
dwZBufferBitDepth
);
/* Some drivers seem to convert depth values incorrectly or not at
* all. Affects at least AMD PALM, 8.17.10.1247. */
if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
)
{
DWORD
expected
;
float
f
,
g
;
expected
=
tests
[
i
].
result
&
mask
;
f
=
ceilf
(
log2f
(
expected
+
1
.
0
f
));
g
=
(
f
+
1
.
0
f
)
/
2
.
0
f
;
g
-=
(
int
)
g
;
expected_broken
=
(
expected
/
exp2f
(
f
)
-
g
)
*
256
;
expected_broken
*=
0x01010101
;
}
}
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
...
...
@@ -7531,6 +7552,22 @@ static void test_color_fill(void)
ok
(
hr
==
tests
[
i
].
depthfill_hr
,
"Blt returned %#x, expected %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
depthfill_hr
,
tests
[
i
].
name
);
if
(
SUCCEEDED
(
hr
)
&&
tests
[
i
].
check_result
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_Lock
(
surface
,
NULL
,
&
surface_desc
,
DDLOCK_READONLY
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
color
=
surface_desc
.
lpSurface
;
todo_wine_if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
&&
U2
(
surface_desc
).
dwZBufferBitDepth
!=
16
)
ok
((
*
color
&
mask
)
==
(
tests
[
i
].
result
&
mask
)
||
broken
((
*
color
&
mask
)
==
(
expected_broken
&
mask
))
||
broken
(
is_warp
&&
(
*
color
&
mask
)
==
(
~
0u
&
mask
))
/* Windows 8+ testbot. */
,
"Got clear result 0x%08x, expected 0x%08x, surface %s.
\n
"
,
*
color
&
mask
,
tests
[
i
].
result
&
mask
,
tests
[
i
].
name
);
hr
=
IDirectDrawSurface_Unlock
(
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
}
U5
(
fx
).
dwFillColor
=
0xdeadbeef
;
fx
.
dwROP
=
BLACKNESS
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_ROP
|
DDBLT_WAIT
,
&
fx
);
...
...
dlls/ddraw/tests/ddraw2.c
View file @
2cc9b854
...
...
@@ -23,6 +23,7 @@
#define COBJMACROS
#include "wine/test.h"
#include <limits.h>
#include <math.h>
#include "d3d.h"
static
BOOL
is_ddraw64
=
sizeof
(
DWORD
)
!=
sizeof
(
DWORD
*
);
...
...
@@ -8409,6 +8410,7 @@ static void test_color_fill(void)
IDirectDrawSurface
*
surface
,
*
surface2
;
DDSURFACEDESC
surface_desc
;
ULONG
refcount
;
BOOL
is_warp
;
HWND
window
;
unsigned
int
i
;
DDBLTFX
fx
;
...
...
@@ -8463,7 +8465,7 @@ static void test_color_fill(void)
},
{
DDSCAPS_ZBUFFER
|
DDSCAPS_VIDEOMEMORY
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
,
FALS
E
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
xdeadbeef
,
TRU
E
,
{
0
,
0
,
0
,
{
0
},
{
0
},
{
0
},
{
0
},
{
0
}}
},
{
...
...
@@ -8569,6 +8571,7 @@ static void test_color_fill(void)
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ddraw
=
create_ddraw
();
ok
(
!!
ddraw
,
"Failed to create a ddraw object.
\n
"
);
is_warp
=
ddraw_is_warp
(
ddraw
);
if
(
!
(
device
=
create_device
(
ddraw
,
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
...
...
@@ -8604,6 +8607,9 @@ static void test_color_fill(void)
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
i
++
)
{
DWORD
expected_broken
=
tests
[
i
].
result
;
DWORD
mask
=
0xffffffffu
;
/* Some Windows drivers modify dwFillColor when it is used on P8 or FourCC formats. */
memset
(
&
fx
,
0
,
sizeof
(
fx
));
fx
.
dwSize
=
sizeof
(
fx
);
...
...
@@ -8638,6 +8644,21 @@ static void test_color_fill(void)
surface_desc
.
dwFlags
&=
~
DDSD_PIXELFORMAT
;
surface_desc
.
dwFlags
|=
DDSD_ZBUFFERBITDEPTH
;
U2
(
surface_desc
).
dwZBufferBitDepth
=
get_device_z_depth
(
device
);
mask
>>=
(
32
-
U2
(
surface_desc
).
dwZBufferBitDepth
);
/* Some drivers seem to convert depth values incorrectly or not at
* all. Affects at least AMD PALM, 8.17.10.1247. */
if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
)
{
DWORD
expected
;
float
f
,
g
;
expected
=
tests
[
i
].
result
&
mask
;
f
=
ceilf
(
log2f
(
expected
+
1
.
0
f
));
g
=
(
f
+
1
.
0
f
)
/
2
.
0
f
;
g
-=
(
int
)
g
;
expected_broken
=
(
expected
/
exp2f
(
f
)
-
g
)
*
256
;
expected_broken
*=
0x01010101
;
}
}
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
...
...
@@ -8673,6 +8694,22 @@ static void test_color_fill(void)
ok
(
hr
==
tests
[
i
].
depthfill_hr
,
"Blt returned %#x, expected %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
depthfill_hr
,
tests
[
i
].
name
);
if
(
SUCCEEDED
(
hr
)
&&
tests
[
i
].
check_result
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_Lock
(
surface
,
NULL
,
&
surface_desc
,
DDLOCK_READONLY
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
color
=
surface_desc
.
lpSurface
;
todo_wine_if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
&&
U2
(
surface_desc
).
dwZBufferBitDepth
!=
16
)
ok
((
*
color
&
mask
)
==
(
tests
[
i
].
result
&
mask
)
||
broken
((
*
color
&
mask
)
==
(
expected_broken
&
mask
))
||
broken
(
is_warp
&&
(
*
color
&
mask
)
==
(
~
0u
&
mask
))
/* Windows 8+ testbot. */
,
"Got clear result 0x%08x, expected 0x%08x, surface %s.
\n
"
,
*
color
&
mask
,
tests
[
i
].
result
&
mask
,
tests
[
i
].
name
);
hr
=
IDirectDrawSurface_Unlock
(
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
}
U5
(
fx
).
dwFillColor
=
0xdeadbeef
;
fx
.
dwROP
=
BLACKNESS
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_ROP
|
DDBLT_WAIT
,
&
fx
);
...
...
dlls/ddraw/tests/ddraw4.c
View file @
2cc9b854
...
...
@@ -9359,12 +9359,12 @@ static void test_color_fill(void)
},
{
DDSCAPS_ZBUFFER
|
DDSCAPS_VIDEOMEMORY
,
0
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
,
FALS
E
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
xdeadbeef
,
TRU
E
,
{
0
,
0
,
0
,
{
0
},
{
0
},
{
0
},
{
0
},
{
0
}}
},
{
DDSCAPS_ZBUFFER
|
DDSCAPS_SYSTEMMEMORY
,
0
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"sysmem zbuffer"
,
0
,
FALS
E
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"sysmem zbuffer"
,
0
xdeadbeef
,
TRU
E
,
{
0
,
0
,
0
,
{
0
},
{
0
},
{
0
},
{
0
},
{
0
}}
},
{
...
...
@@ -9519,6 +9519,8 @@ static void test_color_fill(void)
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
i
++
)
{
DWORD
expected_broken
=
tests
[
i
].
result
;
/* Some Windows drivers modify dwFillColor when it is used on P8 or FourCC formats. */
memset
(
&
fx
,
0
,
sizeof
(
fx
));
fx
.
dwSize
=
sizeof
(
fx
);
...
...
@@ -9548,6 +9550,20 @@ static void test_color_fill(void)
continue
;
U4
(
surface_desc
).
ddpfPixelFormat
=
z_fmt
;
/* Some drivers seem to convert depth values incorrectly or not at
* all. Affects at least AMD PALM, 8.17.10.1247. */
if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
)
{
DWORD
expected
;
float
f
,
g
;
expected
=
tests
[
i
].
result
&
U3
(
z_fmt
).
dwZBitMask
;
f
=
ceilf
(
log2f
(
expected
+
1
.
0
f
));
g
=
(
f
+
1
.
0
f
)
/
2
.
0
f
;
g
-=
(
int
)
g
;
expected_broken
=
(
expected
/
exp2f
(
f
)
-
g
)
*
256
;
expected_broken
*=
0x01010101
;
}
}
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
...
...
@@ -9583,6 +9599,22 @@ static void test_color_fill(void)
ok
(
hr
==
tests
[
i
].
depthfill_hr
,
"Blt returned %#x, expected %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
depthfill_hr
,
tests
[
i
].
name
);
if
(
SUCCEEDED
(
hr
)
&&
tests
[
i
].
check_result
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface4_Lock
(
surface
,
NULL
,
&
surface_desc
,
DDLOCK_READONLY
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
color
=
surface_desc
.
lpSurface
;
todo_wine_if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
&&
U3
(
z_fmt
).
dwZBitMask
!=
0xffff
)
ok
((
*
color
&
U3
(
z_fmt
).
dwZBitMask
)
==
(
tests
[
i
].
result
&
U3
(
z_fmt
).
dwZBitMask
)
||
broken
((
*
color
&
U3
(
z_fmt
).
dwZBitMask
)
==
(
expected_broken
&
U3
(
z_fmt
).
dwZBitMask
)),
"Got clear result 0x%08x, expected 0x%08x, surface %s.
\n
"
,
*
color
&
U3
(
z_fmt
).
dwZBitMask
,
tests
[
i
].
result
&
U3
(
z_fmt
).
dwZBitMask
,
tests
[
i
].
name
);
hr
=
IDirectDrawSurface4_Unlock
(
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
}
U5
(
fx
).
dwFillColor
=
0xdeadbeef
;
fx
.
dwROP
=
BLACKNESS
;
hr
=
IDirectDrawSurface4_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_ROP
|
DDBLT_WAIT
,
&
fx
);
...
...
dlls/ddraw/tests/ddraw7.c
View file @
2cc9b854
...
...
@@ -9684,12 +9684,12 @@ static void test_color_fill(void)
},
{
DDSCAPS_ZBUFFER
|
DDSCAPS_VIDEOMEMORY
,
0
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
,
FALS
E
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"vidmem zbuffer"
,
0
xdeadbeef
,
TRU
E
,
{
0
,
0
,
0
,
{
0
},
{
0
},
{
0
},
{
0
},
{
0
}}
},
{
DDSCAPS_ZBUFFER
|
DDSCAPS_SYSTEMMEMORY
,
0
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"sysmem zbuffer"
,
0
,
FALS
E
,
DDERR_INVALIDPARAMS
,
DD_OK
,
TRUE
,
"sysmem zbuffer"
,
0
xdeadbeef
,
TRU
E
,
{
0
,
0
,
0
,
{
0
},
{
0
},
{
0
},
{
0
},
{
0
}}
},
{
...
...
@@ -9844,6 +9844,8 @@ static void test_color_fill(void)
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
i
++
)
{
DWORD
expected_broken
=
tests
[
i
].
result
;
/* Some Windows drivers modify dwFillColor when it is used on P8 or FourCC formats. */
memset
(
&
fx
,
0
,
sizeof
(
fx
));
fx
.
dwSize
=
sizeof
(
fx
);
...
...
@@ -9873,6 +9875,20 @@ static void test_color_fill(void)
continue
;
U4
(
surface_desc
).
ddpfPixelFormat
=
z_fmt
;
/* Some drivers seem to convert depth values incorrectly or not at
* all. Affects at least AMD PALM, 8.17.10.1247. */
if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
)
{
DWORD
expected
;
float
f
,
g
;
expected
=
tests
[
i
].
result
&
U3
(
z_fmt
).
dwZBitMask
;
f
=
ceilf
(
log2f
(
expected
+
1
.
0
f
));
g
=
(
f
+
1
.
0
f
)
/
2
.
0
f
;
g
-=
(
int
)
g
;
expected_broken
=
(
expected
/
exp2f
(
f
)
-
g
)
*
256
;
expected_broken
*=
0x01010101
;
}
}
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
...
...
@@ -9908,6 +9924,22 @@ static void test_color_fill(void)
ok
(
hr
==
tests
[
i
].
depthfill_hr
,
"Blt returned %#x, expected %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
depthfill_hr
,
tests
[
i
].
name
);
if
(
SUCCEEDED
(
hr
)
&&
tests
[
i
].
check_result
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface7_Lock
(
surface
,
NULL
,
&
surface_desc
,
DDLOCK_READONLY
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
color
=
surface_desc
.
lpSurface
;
todo_wine_if
(
tests
[
i
].
caps
&
DDSCAPS_VIDEOMEMORY
&&
U3
(
z_fmt
).
dwZBitMask
!=
0xffff
)
ok
((
*
color
&
U3
(
z_fmt
).
dwZBitMask
)
==
(
tests
[
i
].
result
&
U3
(
z_fmt
).
dwZBitMask
)
||
broken
((
*
color
&
U3
(
z_fmt
).
dwZBitMask
)
==
(
expected_broken
&
U3
(
z_fmt
).
dwZBitMask
)),
"Got clear result 0x%08x, expected 0x%08x, surface %s.
\n
"
,
*
color
&
U3
(
z_fmt
).
dwZBitMask
,
tests
[
i
].
result
&
U3
(
z_fmt
).
dwZBitMask
,
tests
[
i
].
name
);
hr
=
IDirectDrawSurface7_Unlock
(
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock surface, hr %#x, surface %s.
\n
"
,
hr
,
tests
[
i
].
name
);
}
U5
(
fx
).
dwFillColor
=
0xdeadbeef
;
fx
.
dwROP
=
BLACKNESS
;
hr
=
IDirectDrawSurface7_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_ROP
|
DDBLT_WAIT
,
&
fx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment