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
93ed5d3b
Commit
93ed5d3b
authored
Aug 26, 2015
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8/tests: Test presentation parameter combinations.
parent
9261bbb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
148 additions
and
0 deletions
+148
-0
device.c
dlls/d3d8/tests/device.c
+148
-0
No files found.
dlls/d3d8/tests/device.c
View file @
93ed5d3b
...
@@ -7249,6 +7249,153 @@ static void test_resource_priority(void)
...
@@ -7249,6 +7249,153 @@ static void test_resource_priority(void)
DestroyWindow
(
window
);
DestroyWindow
(
window
);
}
}
static
void
test_swapchain_parameters
(
void
)
{
IDirect3DDevice8
*
device
;
IDirect3D8
*
d3d
;
IDirect3DSurface8
*
backbuffer
;
HWND
window
;
HRESULT
hr
;
unsigned
int
i
,
j
;
D3DPRESENT_PARAMETERS
present_parameters
,
present_parameters_windowed
=
{
0
};
static
const
struct
{
BOOL
windowed
;
UINT
backbuffer_count
;
D3DSWAPEFFECT
swap_effect
;
HRESULT
hr
;
}
tests
[]
=
{
/* Swap effect 0 is not allowed. */
{
TRUE
,
1
,
0
,
D3DERR_INVALIDCALL
},
{
FALSE
,
1
,
0
,
D3DERR_INVALIDCALL
},
/* All (non-ex) swap effects are allowed in
* windowed and fullscreen mode. */
{
TRUE
,
1
,
D3DSWAPEFFECT_DISCARD
,
D3D_OK
},
{
TRUE
,
1
,
D3DSWAPEFFECT_FLIP
,
D3D_OK
},
{
FALSE
,
1
,
D3DSWAPEFFECT_DISCARD
,
D3D_OK
},
{
FALSE
,
1
,
D3DSWAPEFFECT_FLIP
,
D3D_OK
},
{
FALSE
,
1
,
D3DSWAPEFFECT_COPY
,
D3D_OK
},
/* Only one backbuffer in copy mode. Reset allows it for
* some reason. */
{
TRUE
,
0
,
D3DSWAPEFFECT_COPY
,
D3D_OK
},
{
TRUE
,
1
,
D3DSWAPEFFECT_COPY
,
D3D_OK
},
{
TRUE
,
2
,
D3DSWAPEFFECT_COPY
,
D3DERR_INVALIDCALL
},
{
FALSE
,
2
,
D3DSWAPEFFECT_COPY
,
D3DERR_INVALIDCALL
},
/* Ok with the others, in fullscreen and windowed mode. */
{
TRUE
,
2
,
D3DSWAPEFFECT_DISCARD
,
D3D_OK
},
{
TRUE
,
2
,
D3DSWAPEFFECT_FLIP
,
D3D_OK
},
{
FALSE
,
2
,
D3DSWAPEFFECT_DISCARD
,
D3D_OK
},
{
FALSE
,
2
,
D3DSWAPEFFECT_FLIP
,
D3D_OK
},
/* 3 is the highest allowed backbuffer count. */
{
TRUE
,
3
,
D3DSWAPEFFECT_DISCARD
,
D3D_OK
},
{
TRUE
,
4
,
D3DSWAPEFFECT_DISCARD
,
D3DERR_INVALIDCALL
},
{
TRUE
,
4
,
D3DSWAPEFFECT_FLIP
,
D3DERR_INVALIDCALL
},
{
FALSE
,
4
,
D3DSWAPEFFECT_DISCARD
,
D3DERR_INVALIDCALL
},
{
FALSE
,
4
,
D3DSWAPEFFECT_FLIP
,
D3DERR_INVALIDCALL
},
};
window
=
CreateWindowA
(
"static"
,
"d3d8_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
d3d
=
Direct3DCreate8
(
D3D_SDK_VERSION
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d
,
window
,
NULL
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D8_Release
(
d3d
);
DestroyWindow
(
window
);
return
;
}
IDirect3DDevice8_Release
(
device
);
present_parameters_windowed
.
BackBufferWidth
=
registry_mode
.
dmPelsWidth
;
present_parameters_windowed
.
BackBufferHeight
=
registry_mode
.
dmPelsHeight
;
present_parameters_windowed
.
hDeviceWindow
=
window
;
present_parameters_windowed
.
BackBufferFormat
=
D3DFMT_X8R8G8B8
;
present_parameters_windowed
.
SwapEffect
=
D3DSWAPEFFECT_COPY
;
present_parameters_windowed
.
Windowed
=
TRUE
;
present_parameters_windowed
.
BackBufferCount
=
1
;
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
++
i
)
{
UINT
bb_count
=
tests
[
i
].
backbuffer_count
?
tests
[
i
].
backbuffer_count
:
1
;
memset
(
&
present_parameters
,
0
,
sizeof
(
present_parameters
));
present_parameters
.
BackBufferWidth
=
registry_mode
.
dmPelsWidth
;
present_parameters
.
BackBufferHeight
=
registry_mode
.
dmPelsHeight
;
present_parameters
.
hDeviceWindow
=
window
;
present_parameters
.
BackBufferFormat
=
D3DFMT_X8R8G8B8
;
present_parameters
.
SwapEffect
=
tests
[
i
].
swap_effect
;
present_parameters
.
Windowed
=
tests
[
i
].
windowed
;
present_parameters
.
BackBufferCount
=
tests
[
i
].
backbuffer_count
;
hr
=
IDirect3D8_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
window
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device
);
ok
(
hr
==
tests
[
i
].
hr
,
"Expected hr %x, got %x, test %u.
\n
"
,
tests
[
i
].
hr
,
hr
,
i
);
if
(
SUCCEEDED
(
hr
))
{
for
(
j
=
0
;
j
<
bb_count
;
++
j
)
{
hr
=
IDirect3DDevice8_GetBackBuffer
(
device
,
j
,
D3DBACKBUFFER_TYPE_MONO
,
&
backbuffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get backbuffer %u, hr %#x, test %u.
\n
"
,
j
,
hr
,
i
);
IDirect3DSurface8_Release
(
backbuffer
);
}
hr
=
IDirect3DDevice8_GetBackBuffer
(
device
,
j
,
D3DBACKBUFFER_TYPE_MONO
,
&
backbuffer
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Got unexpected hr %x, test %u.
\n
"
,
hr
,
i
);
IDirect3DDevice8_Release
(
device
);
}
hr
=
IDirect3D8_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
window
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
present_parameters_windowed
,
&
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create device, hr %#x, test %u.
\n
"
,
hr
,
i
);
memset
(
&
present_parameters
,
0
,
sizeof
(
present_parameters
));
present_parameters
.
BackBufferWidth
=
registry_mode
.
dmPelsWidth
;
present_parameters
.
BackBufferHeight
=
registry_mode
.
dmPelsHeight
;
present_parameters
.
hDeviceWindow
=
window
;
present_parameters
.
BackBufferFormat
=
D3DFMT_X8R8G8B8
;
present_parameters
.
SwapEffect
=
tests
[
i
].
swap_effect
;
present_parameters
.
Windowed
=
tests
[
i
].
windowed
;
present_parameters
.
BackBufferCount
=
tests
[
i
].
backbuffer_count
;
hr
=
IDirect3DDevice8_Reset
(
device
,
&
present_parameters
);
ok
(
hr
==
tests
[
i
].
hr
,
"Expected hr %x, got %x, test %u.
\n
"
,
tests
[
i
].
hr
,
hr
,
i
);
if
(
FAILED
(
hr
))
{
hr
=
IDirect3DDevice8_Reset
(
device
,
&
present_parameters_windowed
);
ok
(
SUCCEEDED
(
hr
),
"Failed to reset device, hr %#x, test %u.
\n
"
,
hr
,
i
);
}
else
{
for
(
j
=
0
;
j
<
bb_count
;
++
j
)
{
hr
=
IDirect3DDevice8_GetBackBuffer
(
device
,
j
,
D3DBACKBUFFER_TYPE_MONO
,
&
backbuffer
);
if
(
j
)
todo_wine
ok
(
SUCCEEDED
(
hr
),
"Failed to get backbuffer %u, hr %#x, test %u.
\n
"
,
j
,
hr
,
i
);
else
ok
(
SUCCEEDED
(
hr
),
"Failed to get backbuffer %u, hr %#x, test %u.
\n
"
,
j
,
hr
,
i
);
if
(
SUCCEEDED
(
hr
))
IDirect3DSurface8_Release
(
backbuffer
);
}
hr
=
IDirect3DDevice8_GetBackBuffer
(
device
,
j
,
D3DBACKBUFFER_TYPE_MONO
,
&
backbuffer
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Got unexpected hr %x, test %u.
\n
"
,
hr
,
i
);
}
IDirect3DDevice8_Release
(
device
);
}
IDirect3D8_Release
(
d3d
);
DestroyWindow
(
window
);
}
START_TEST
(
device
)
START_TEST
(
device
)
{
{
HMODULE
d3d8_handle
=
LoadLibraryA
(
"d3d8.dll"
);
HMODULE
d3d8_handle
=
LoadLibraryA
(
"d3d8.dll"
);
...
@@ -7347,6 +7494,7 @@ START_TEST(device)
...
@@ -7347,6 +7494,7 @@ START_TEST(device)
test_writeonly_resource
();
test_writeonly_resource
();
test_lost_device
();
test_lost_device
();
test_resource_priority
();
test_resource_priority
();
test_swapchain_parameters
();
UnregisterClassA
(
"d3d8_test_wc"
,
GetModuleHandleA
(
NULL
));
UnregisterClassA
(
"d3d8_test_wc"
,
GetModuleHandleA
(
NULL
));
}
}
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