Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
66aa4dcc
Commit
66aa4dcc
authored
Feb 28, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Don't trust what EnumDevices() tells us about the supported Z buffer formats.
parent
9677805e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
75 deletions
+47
-75
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+23
-40
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+24
-35
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
66aa4dcc
...
...
@@ -238,11 +238,11 @@ static IDirectDraw *create_ddraw(void)
static
IDirect3DDevice
*
create_device
(
IDirectDraw
*
ddraw
,
HWND
window
,
DWORD
coop_level
)
{
static
const
DWORD
z_depths
[]
=
{
32
,
24
,
16
};
IDirectDrawSurface
*
surface
,
*
ds
;
IDirect3DDevice
*
device
=
NULL
;
DDSURFACEDESC
surface_desc
;
DWORD
z_depth
=
0
;
IDirect3D
*
d3d
;
unsigned
int
i
;
HRESULT
hr
;
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
window
,
coop_level
);
...
...
@@ -271,51 +271,34 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
IDirectDrawClipper_Release
(
clipper
);
}
hr
=
IDirectDraw_QueryInterface
(
ddraw
,
&
IID_IDirect3D
,
(
void
**
)
&
d3d
);
if
(
FAILED
(
hr
))
/* We used to use EnumDevices() for this, but it seems
* D3DDEVICEDESC.dwDeviceZBufferBitDepth only has a very casual
* relationship with reality. */
for
(
i
=
0
;
i
<
sizeof
(
z_depths
)
/
sizeof
(
*
z_depths
);
++
i
)
{
IDirectDrawSurface_Release
(
surface
);
return
NULL
;
}
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_ZBUFFERBITDEPTH
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_ZBUFFER
;
U2
(
surface_desc
).
dwZBufferBitDepth
=
z_depths
[
i
];
surface_desc
.
dwWidth
=
640
;
surface_desc
.
dwHeight
=
480
;
if
(
FAILED
(
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
ds
,
NULL
)))
continue
;
hr
=
IDirect3D_EnumDevices
(
d3d
,
enum_z_fmt
,
&
z_depth
);
ok
(
SUCCEEDED
(
hr
),
"Failed to enumerate z-formats, hr %#x.
\n
"
,
hr
);
IDirect3D_Release
(
d3d
);
if
(
FAILED
(
hr
)
||
!
z_depth
)
{
IDirectDrawSurface_Release
(
surface
);
return
NULL
;
}
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface
,
ds
);
ok
(
SUCCEEDED
(
hr
),
"Failed to attach depth buffer, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
ds
);
if
(
FAILED
(
hr
))
continue
;
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_ZBUFFERBITDEPTH
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_ZBUFFER
;
U2
(
surface_desc
).
dwZBufferBitDepth
=
z_depth
;
surface_desc
.
dwWidth
=
640
;
surface_desc
.
dwHeight
=
480
;
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
ds
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create depth buffer, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IDirectDrawSurface_Release
(
surface
);
return
NULL
;
}
if
(
SUCCEEDED
(
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirect3DHALDevice
,
(
void
**
)
&
device
)))
break
;
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface
,
ds
);
ok
(
SUCCEEDED
(
hr
),
"Failed to attach depth buffer, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
ds
);
if
(
FAILED
(
hr
))
{
IDirectDrawSurface_Release
(
surface
);
return
NULL
;
IDirectDrawSurface_DeleteAttachedSurface
(
surface
,
0
,
ds
);
}
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirect3DHALDevice
,
(
void
**
)
&
device
);
IDirectDrawSurface_Release
(
surface
);
if
(
FAILED
(
hr
))
return
NULL
;
return
device
;
}
...
...
dlls/ddraw/tests/ddraw2.c
View file @
66aa4dcc
...
...
@@ -177,11 +177,12 @@ static IDirectDraw2 *create_ddraw(void)
static
IDirect3DDevice2
*
create_device
(
IDirectDraw2
*
ddraw
,
HWND
window
,
DWORD
coop_level
)
{
static
const
DWORD
z_depths
[]
=
{
32
,
24
,
16
};
IDirectDrawSurface
*
surface
,
*
ds
;
IDirect3DDevice2
*
device
=
NULL
;
DDSURFACEDESC
surface_desc
;
DWORD
z_depth
=
0
;
IDirect3D2
*
d3d
;
unsigned
int
i
;
HRESULT
hr
;
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
window
,
coop_level
);
...
...
@@ -217,47 +218,35 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c
return
NULL
;
}
hr
=
IDirect3D2_EnumDevices
(
d3d
,
enum_z_fmt
,
&
z_depth
);
ok
(
SUCCEEDED
(
hr
),
"Failed to enumerate z-formats, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
)
||
!
z_depth
)
/* We used to use EnumDevices() for this, but it seems
* D3DDEVICEDESC.dwDeviceZBufferBitDepth only has a very casual
* relationship with reality. */
for
(
i
=
0
;
i
<
sizeof
(
z_depths
)
/
sizeof
(
*
z_depths
);
++
i
)
{
IDirect3D2_Release
(
d3d
);
IDirectDrawSurface_Release
(
surface
);
return
NULL
;
}
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_ZBUFFERBITDEPTH
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_ZBUFFER
;
U2
(
surface_desc
).
dwZBufferBitDepth
=
z_depths
[
i
];
surface_desc
.
dwWidth
=
640
;
surface_desc
.
dwHeight
=
480
;
if
(
FAILED
(
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
ds
,
NULL
)))
continue
;
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_ZBUFFERBITDEPTH
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_ZBUFFER
;
U2
(
surface_desc
).
dwZBufferBitDepth
=
z_depth
;
surface_desc
.
dwWidth
=
640
;
surface_desc
.
dwHeight
=
480
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
ds
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create depth buffer, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IDirect3D2_Release
(
d3d
);
IDirectDrawSurface_Release
(
surface
);
return
NULL
;
}
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface
,
ds
);
ok
(
SUCCEEDED
(
hr
),
"Failed to attach depth buffer, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
ds
);
if
(
FAILED
(
hr
))
continue
;
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface
,
ds
);
ok
(
SUCCEEDED
(
hr
),
"Failed to attach depth buffer, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
ds
);
if
(
FAILED
(
hr
))
{
IDirect3D2_Release
(
d3d
);
IDirectDrawSurface_Release
(
surface
);
return
NULL
;
if
(
SUCCEEDED
(
hr
=
IDirect3D2_CreateDevice
(
d3d
,
&
IID_IDirect3DHALDevice
,
surface
,
&
device
)))
break
;
IDirectDrawSurface_DeleteAttachedSurface
(
surface
,
0
,
ds
);
}
hr
=
IDirect3D2_CreateDevice
(
d3d
,
&
IID_IDirect3DHALDevice
,
surface
,
&
device
);
IDirect3D2_Release
(
d3d
);
IDirectDrawSurface_Release
(
surface
);
if
(
FAILED
(
hr
))
return
NULL
;
return
device
;
}
...
...
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