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
937522ff
Commit
937522ff
authored
Mar 11, 2015
by
Stefan Dösinger
Committed by
Alexandre Julliard
Mar 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add a test for signed formats.
parent
a46cad41
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
436 additions
and
0 deletions
+436
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+230
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+206
-0
No files found.
dlls/ddraw/tests/ddraw4.c
View file @
937522ff
...
...
@@ -8075,6 +8075,235 @@ static void test_surface_desc_lock(void)
DestroyWindow
(
window
);
}
static
void
test_signed_formats
(
void
)
{
HRESULT
hr
;
IDirect3DDevice3
*
device
;
IDirect3D3
*
d3d
;
IDirectDraw4
*
ddraw
;
IDirectDrawSurface4
*
surface
,
*
rt
;
IDirect3DTexture2
*
texture
;
IDirect3DViewport3
*
viewport
;
DDSURFACEDESC2
surface_desc
;
ULONG
refcount
;
HWND
window
;
D3DCOLOR
color
,
expected_color
;
D3DRECT
clear_rect
;
static
struct
{
struct
vec3
position
;
struct
vec2
texcoord
;
}
quad
[]
=
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
1
.
0
f
}},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
0
.
0
f
}},
};
/* See test_signed_formats() in dlls/d3d9/tests/visual.c for an explanation
* of these values. */
static
const
USHORT
content_v8u8
[
4
][
4
]
=
{
{
0x0000
,
0x7f7f
,
0x8880
,
0x0000
},
{
0x0080
,
0x8000
,
0x7f00
,
0x007f
},
{
0x193b
,
0xe8c8
,
0x0808
,
0xf8f8
},
{
0x4444
,
0xc0c0
,
0xa066
,
0x22e0
},
};
static
const
DWORD
content_x8l8v8u8
[
4
][
4
]
=
{
{
0x00000000
,
0x00ff7f7f
,
0x00008880
,
0x00ff0000
},
{
0x00000080
,
0x00008000
,
0x00007f00
,
0x0000007f
},
{
0x0041193b
,
0x0051e8c8
,
0x00040808
,
0x00fff8f8
},
{
0x00824444
,
0x0000c0c0
,
0x00c2a066
,
0x009222e0
},
};
static
const
USHORT
content_l6v5u5
[
4
][
4
]
=
{
{
0x0000
,
0xfdef
,
0x0230
,
0xfc00
},
{
0x0010
,
0x0200
,
0x01e0
,
0x000f
},
{
0x4067
,
0x53b9
,
0x0421
,
0xffff
},
{
0x8108
,
0x0318
,
0xc28c
,
0x909c
},
};
static
const
struct
{
const
char
*
name
;
const
void
*
content
;
SIZE_T
pixel_size
;
BOOL
blue
;
unsigned
int
slop
,
slop_broken
;
DDPIXELFORMAT
format
;
}
formats
[]
=
{
{
"D3DFMT_V8U8"
,
content_v8u8
,
sizeof
(
WORD
),
FALSE
,
1
,
0
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_BUMPDUDV
,
0
,
{
16
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00000000
},
{
0x00000000
}
}
},
{
"D3DFMT_X8L8V8U8"
,
content_x8l8v8u8
,
sizeof
(
DWORD
),
TRUE
,
1
,
0
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_BUMPDUDV
|
DDPF_BUMPLUMINANCE
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0x00000000
}
}
},
{
"D3DFMT_L6V5U5"
,
content_l6v5u5
,
sizeof
(
WORD
),
TRUE
,
4
,
7
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_BUMPDUDV
|
DDPF_BUMPLUMINANCE
,
0
,
{
16
},
{
0x0000001f
},
{
0x000003e0
},
{
0x0000fc00
},
{
0x00000000
}
}
},
/* No V16U16 or Q8W8V8U8 support in ddraw. */
};
static
const
D3DCOLOR
expected_colors
[
4
][
4
]
=
{
{
0x00808080
,
0x00fefeff
,
0x00010780
,
0x008080ff
},
{
0x00018080
,
0x00800180
,
0x0080fe80
,
0x00fe8080
},
{
0x00ba98a0
,
0x004767a8
,
0x00888881
,
0x007878ff
},
{
0x00c3c3c0
,
0x003f3f80
,
0x00e51fe1
,
0x005fa2c8
},
};
unsigned
int
i
,
width
,
x
,
y
;
D3DDEVICEDESC
device_desc
,
hel_desc
;
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
memset
(
&
device_desc
,
0
,
sizeof
(
device_desc
));
device_desc
.
dwSize
=
sizeof
(
device_desc
);
memset
(
&
hel_desc
,
0
,
sizeof
(
hel_desc
));
hel_desc
.
dwSize
=
sizeof
(
hel_desc
);
hr
=
IDirect3DDevice3_GetCaps
(
device
,
&
device_desc
,
&
hel_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get device caps, hr %#x.
\n
"
,
hr
);
if
(
!
(
device_desc
.
dwTextureOpCaps
&
D3DTEXOPCAPS_BLENDFACTORALPHA
))
{
skip
(
"D3DTOP_BLENDFACTORALPHA not supported, skipping bumpmap format tests.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice3_GetDirect3D
(
device
,
&
d3d
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3D3_QueryInterface
(
d3d
,
&
IID_IDirectDraw4
,
(
void
**
)
&
ddraw
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get ddraw interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_GetRenderTarget
(
device
,
&
rt
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface4_GetSurfaceDesc
(
rt
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
viewport
=
create_viewport
(
device
,
0
,
0
,
surface_desc
.
dwWidth
,
surface_desc
.
dwHeight
);
hr
=
IDirect3DDevice3_SetCurrentViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to activate the viewport, hr %#x.
\n
"
,
hr
);
U1
(
clear_rect
).
x1
=
0
;
U2
(
clear_rect
).
y1
=
0
;
U3
(
clear_rect
).
x2
=
surface_desc
.
dwWidth
;
U4
(
clear_rect
).
y2
=
surface_desc
.
dwHeight
;
hr
=
IDirect3DDevice3_SetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
D3DZB_FALSE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
/* dst = tex * 0.5 + 1.0 * (1.0 - 0.5) = tex * 0.5 + 0.5 */
hr
=
IDirect3DDevice3_SetRenderState
(
device
,
D3DRENDERSTATE_TEXTUREFACTOR
,
0x80ffffff
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_BLENDFACTORALPHA
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture stage state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture stage state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG2
,
D3DTA_TFACTOR
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture stage state, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
formats
)
/
sizeof
(
*
formats
);
i
++
)
{
for
(
width
=
1
;
width
<
5
;
width
+=
3
)
{
hr
=
IDirect3DViewport3_Clear2
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
,
0x00000000
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear viewport, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
|
DDSD_CAPS
;
surface_desc
.
dwWidth
=
width
;
surface_desc
.
dwHeight
=
4
;
U4
(
surface_desc
).
ddpfPixelFormat
=
formats
[
i
].
format
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_VIDEOMEMORY
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
if
(
FAILED
(
hr
))
{
skip
(
"%s textures not supported, skipping.
\n
"
,
formats
[
i
].
name
);
continue
;
}
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
hr
=
IDirectDrawSurface4_QueryInterface
(
surface
,
&
IID_IDirect3DTexture2
,
(
void
**
)
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get Direct3DTexture2 interface, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
hr
=
IDirect3DDevice3_SetTexture
(
device
,
0
,
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
IDirect3DTexture2_Release
(
texture
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface4_Lock
(
surface
,
NULL
,
&
surface_desc
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock surface, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
for
(
y
=
0
;
y
<
4
;
y
++
)
{
memcpy
((
char
*
)
surface_desc
.
lpSurface
+
y
*
surface_desc
.
lPitch
,
(
char
*
)
formats
[
i
].
content
+
y
*
4
*
formats
[
i
].
pixel_size
,
width
*
formats
[
i
].
pixel_size
);
}
hr
=
IDirectDrawSurface4_Unlock
(
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock surface, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
hr
=
IDirect3DDevice3_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DFVF_XYZ
|
D3DFVF_TEX1
,
quad
,
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
for
(
y
=
0
;
y
<
4
;
y
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
expected_color
=
expected_colors
[
y
][
x
];
if
(
!
formats
[
i
].
blue
)
expected_color
|=
0x000000ff
;
color
=
get_surface_color
(
rt
,
80
+
160
*
x
,
60
+
120
*
y
);
ok
(
compare_color
(
color
,
expected_color
,
formats
[
i
].
slop
)
||
broken
(
compare_color
(
color
,
expected_color
,
formats
[
i
].
slop_broken
)),
"Expected color 0x%08x, got 0x%08x, format %s, location %ux%u.
\n
"
,
expected_color
,
color
,
formats
[
i
].
name
,
x
,
y
);
}
}
IDirectDrawSurface4_Release
(
surface
);
}
}
destroy_viewport
(
device
,
viewport
);
IDirectDrawSurface4_Release
(
rt
);
IDirectDraw4_Release
(
ddraw
);
IDirect3D3_Release
(
d3d
);
done:
refcount
=
IDirect3DDevice3_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw4
)
{
IDirectDraw4
*
ddraw
;
...
...
@@ -8153,4 +8382,5 @@ START_TEST(ddraw4)
test_vb_writeonly
();
test_lost_device
();
test_surface_desc_lock
();
test_signed_formats
();
}
dlls/ddraw/tests/ddraw7.c
View file @
937522ff
...
...
@@ -8309,6 +8309,211 @@ done:
DestroyWindow
(
window
);
}
static
void
test_signed_formats
(
void
)
{
HRESULT
hr
;
IDirect3DDevice7
*
device
;
IDirect3D7
*
d3d
;
IDirectDraw7
*
ddraw
;
IDirectDrawSurface7
*
surface
,
*
rt
;
DDSURFACEDESC2
surface_desc
;
ULONG
refcount
;
HWND
window
;
D3DCOLOR
color
,
expected_color
;
static
struct
{
struct
vec3
position
;
struct
vec2
texcoord
;
}
quad
[]
=
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
1
.
0
f
}},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
0
.
0
f
}},
};
/* See test_signed_formats() in dlls/d3d9/tests/visual.c for an explanation
* of these values. */
static
const
USHORT
content_v8u8
[
4
][
4
]
=
{
{
0x0000
,
0x7f7f
,
0x8880
,
0x0000
},
{
0x0080
,
0x8000
,
0x7f00
,
0x007f
},
{
0x193b
,
0xe8c8
,
0x0808
,
0xf8f8
},
{
0x4444
,
0xc0c0
,
0xa066
,
0x22e0
},
};
static
const
DWORD
content_x8l8v8u8
[
4
][
4
]
=
{
{
0x00000000
,
0x00ff7f7f
,
0x00008880
,
0x00ff0000
},
{
0x00000080
,
0x00008000
,
0x00007f00
,
0x0000007f
},
{
0x0041193b
,
0x0051e8c8
,
0x00040808
,
0x00fff8f8
},
{
0x00824444
,
0x0000c0c0
,
0x00c2a066
,
0x009222e0
},
};
static
const
USHORT
content_l6v5u5
[
4
][
4
]
=
{
{
0x0000
,
0xfdef
,
0x0230
,
0xfc00
},
{
0x0010
,
0x0200
,
0x01e0
,
0x000f
},
{
0x4067
,
0x53b9
,
0x0421
,
0xffff
},
{
0x8108
,
0x0318
,
0xc28c
,
0x909c
},
};
static
const
struct
{
const
char
*
name
;
const
void
*
content
;
SIZE_T
pixel_size
;
BOOL
blue
;
unsigned
int
slop
,
slop_broken
;
DDPIXELFORMAT
format
;
}
formats
[]
=
{
{
"D3DFMT_V8U8"
,
content_v8u8
,
sizeof
(
WORD
),
FALSE
,
1
,
0
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_BUMPDUDV
,
0
,
{
16
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00000000
},
{
0x00000000
}
}
},
{
"D3DFMT_X8L8V8U8"
,
content_x8l8v8u8
,
sizeof
(
DWORD
),
TRUE
,
1
,
0
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_BUMPDUDV
|
DDPF_BUMPLUMINANCE
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0x00000000
}
}
},
{
"D3DFMT_L6V5U5"
,
content_l6v5u5
,
sizeof
(
WORD
),
TRUE
,
4
,
7
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_BUMPDUDV
|
DDPF_BUMPLUMINANCE
,
0
,
{
16
},
{
0x0000001f
},
{
0x000003e0
},
{
0x0000fc00
},
{
0x00000000
}
}
},
/* No V16U16 or Q8W8V8U8 support in ddraw. */
};
static
const
D3DCOLOR
expected_colors
[
4
][
4
]
=
{
{
0x00808080
,
0x00fefeff
,
0x00010780
,
0x008080ff
},
{
0x00018080
,
0x00800180
,
0x0080fe80
,
0x00fe8080
},
{
0x00ba98a0
,
0x004767a8
,
0x00888881
,
0x007878ff
},
{
0x00c3c3c0
,
0x003f3f80
,
0x00e51fe1
,
0x005fa2c8
},
};
unsigned
int
i
,
width
,
x
,
y
;
D3DDEVICEDESC7
device_desc
;
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice7_GetCaps
(
device
,
&
device_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get device caps, hr %#x.
\n
"
,
hr
);
if
(
!
(
device_desc
.
dwTextureOpCaps
&
D3DTEXOPCAPS_BLENDFACTORALPHA
))
{
skip
(
"D3DTOP_BLENDFACTORALPHA not supported, skipping bumpmap format tests.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice7_GetDirect3D
(
device
,
&
d3d
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3D7_QueryInterface
(
d3d
,
&
IID_IDirectDraw7
,
(
void
**
)
&
ddraw
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get ddraw interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_GetRenderTarget
(
device
,
&
rt
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
D3DZB_FALSE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
/* dst = tex * 0.5 + 1.0 * (1.0 - 0.5) = tex * 0.5 + 0.5 */
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_TEXTUREFACTOR
,
0x80ffffff
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_BLENDFACTORALPHA
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture stage state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture stage state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG2
,
D3DTA_TFACTOR
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture stage state, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
formats
)
/
sizeof
(
*
formats
);
i
++
)
{
for
(
width
=
1
;
width
<
5
;
width
+=
3
)
{
hr
=
IDirect3DDevice7_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0x00000000
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
|
DDSD_CAPS
;
surface_desc
.
dwWidth
=
width
;
surface_desc
.
dwHeight
=
4
;
U4
(
surface_desc
).
ddpfPixelFormat
=
formats
[
i
].
format
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_VIDEOMEMORY
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
if
(
FAILED
(
hr
))
{
skip
(
"%s textures not supported, skipping.
\n
"
,
formats
[
i
].
name
);
continue
;
}
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
hr
=
IDirect3DDevice7_SetTexture
(
device
,
0
,
surface
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface7_Lock
(
surface
,
NULL
,
&
surface_desc
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock surface, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
for
(
y
=
0
;
y
<
4
;
y
++
)
{
memcpy
((
char
*
)
surface_desc
.
lpSurface
+
y
*
surface_desc
.
lPitch
,
(
char
*
)
formats
[
i
].
content
+
y
*
4
*
formats
[
i
].
pixel_size
,
width
*
formats
[
i
].
pixel_size
);
}
hr
=
IDirectDrawSurface7_Unlock
(
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock surface, hr %#x, format %s.
\n
"
,
hr
,
formats
[
i
].
name
);
hr
=
IDirect3DDevice7_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DFVF_XYZ
|
D3DFVF_TEX1
,
quad
,
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
for
(
y
=
0
;
y
<
4
;
y
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
expected_color
=
expected_colors
[
y
][
x
];
if
(
!
formats
[
i
].
blue
)
expected_color
|=
0x000000ff
;
color
=
get_surface_color
(
rt
,
80
+
160
*
x
,
60
+
120
*
y
);
ok
(
compare_color
(
color
,
expected_color
,
formats
[
i
].
slop
)
||
broken
(
compare_color
(
color
,
expected_color
,
formats
[
i
].
slop_broken
)),
"Expected color 0x%08x, got 0x%08x, format %s, location %ux%u.
\n
"
,
expected_color
,
color
,
formats
[
i
].
name
,
x
,
y
);
}
}
IDirectDrawSurface7_Release
(
surface
);
}
}
IDirectDrawSurface7_Release
(
rt
);
IDirectDraw7_Release
(
ddraw
);
IDirect3D7_Release
(
d3d
);
done:
refcount
=
IDirect3DDevice7_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -8398,4 +8603,5 @@ START_TEST(ddraw7)
test_fog_interpolation
();
test_negative_fixedfunction_fog
();
test_table_fog_zw
();
test_signed_formats
();
}
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