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
cdedb06a
Commit
cdedb06a
authored
Apr 16, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Apr 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add a test for timestamp queries.
parent
b7c5e341
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
149 additions
and
0 deletions
+149
-0
device.c
dlls/d3d9/tests/device.c
+149
-0
No files found.
dlls/d3d9/tests/device.c
View file @
cdedb06a
...
@@ -3869,6 +3869,154 @@ static void test_occlusion_query_states(void)
...
@@ -3869,6 +3869,154 @@ static void test_occlusion_query_states(void)
DestroyWindow
(
window
);
DestroyWindow
(
window
);
}
}
static
void
test_timestamp_query
(
void
)
{
static
const
float
point
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
};
IDirect3DQuery9
*
query
,
*
disjoint_query
,
*
freq_query
;
unsigned
int
data_size
,
i
;
IDirect3DDevice9
*
device
;
IDirect3D9
*
d3d9
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
UINT64
timestamp
,
freq
;
BOOL
disjoint
;
window
=
CreateWindowA
(
"d3d9_test_wc"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
d3d9
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
ok
(
!!
d3d9
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d9
,
window
,
window
,
TRUE
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D9_Release
(
d3d9
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice9_CreateQuery
(
device
,
D3DQUERYTYPE_TIMESTAMPFREQ
,
&
freq_query
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_NOTAVAILABLE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Timestamp queries are not supported, skipping tests.
\n
"
);
IDirect3DDevice9_Release
(
device
);
IDirect3D9_Release
(
d3d9
);
DestroyWindow
(
window
);
return
;
}
data_size
=
IDirect3DQuery9_GetDataSize
(
freq_query
);
ok
(
data_size
==
sizeof
(
UINT64
),
"Query data size is %u, 8 expected.
\n
"
,
data_size
);
hr
=
IDirect3DDevice9_CreateQuery
(
device
,
D3DQUERYTYPE_TIMESTAMPDISJOINT
,
&
disjoint_query
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
data_size
=
IDirect3DQuery9_GetDataSize
(
disjoint_query
);
ok
(
data_size
==
sizeof
(
BOOL
),
"Query data size is %u, 4 expected.
\n
"
,
data_size
);
hr
=
IDirect3DDevice9_CreateQuery
(
device
,
D3DQUERYTYPE_TIMESTAMP
,
&
query
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
data_size
=
IDirect3DQuery9_GetDataSize
(
query
);
ok
(
data_size
==
sizeof
(
UINT64
),
"Query data size is %u, 8 expected.
\n
"
,
data_size
);
hr
=
IDirect3DQuery9_Issue
(
freq_query
,
D3DISSUE_END
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
500
;
++
i
)
{
if
((
hr
=
IDirect3DQuery9_GetData
(
freq_query
,
NULL
,
0
,
D3DGETDATA_FLUSH
))
!=
S_FALSE
)
break
;
Sleep
(
10
);
}
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
freq_query
,
&
freq
,
sizeof
(
freq
),
D3DGETDATA_FLUSH
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
query
,
NULL
,
0
,
D3DGETDATA_FLUSH
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
query
,
&
timestamp
,
sizeof
(
timestamp
),
D3DGETDATA_FLUSH
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
disjoint_query
,
D3DISSUE_END
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
disjoint_query
,
D3DISSUE_BEGIN
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
disjoint_query
,
D3DISSUE_BEGIN
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
query
,
&
timestamp
,
sizeof
(
timestamp
),
D3DGETDATA_FLUSH
);
ok
(
hr
==
S_FALSE
||
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set FVF, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_POINTLIST
,
1
,
point
,
3
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
query
,
D3DISSUE_END
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
500
;
++
i
)
{
if
((
hr
=
IDirect3DQuery9_GetData
(
query
,
NULL
,
0
,
D3DGETDATA_FLUSH
))
!=
S_FALSE
)
break
;
Sleep
(
10
);
}
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
query
,
&
timestamp
,
sizeof
(
timestamp
),
D3DGETDATA_FLUSH
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
query
,
&
timestamp
,
sizeof
(
timestamp
),
D3DGETDATA_FLUSH
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
query
,
D3DISSUE_BEGIN
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
query
,
D3DISSUE_END
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
query
,
D3DISSUE_END
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
disjoint_query
,
D3DISSUE_END
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
500
;
++
i
)
{
if
((
hr
=
IDirect3DQuery9_GetData
(
disjoint_query
,
NULL
,
0
,
D3DGETDATA_FLUSH
))
!=
S_FALSE
)
break
;
Sleep
(
10
);
}
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
disjoint_query
,
&
disjoint
,
sizeof
(
disjoint
),
D3DGETDATA_FLUSH
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
/* It's not strictly necessary for the TIMESTAMP query to be inside
* a TIMESTAMP_DISJOINT query. */
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_POINTLIST
,
1
,
point
,
3
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_Issue
(
query
,
D3DISSUE_END
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
500
;
++
i
)
{
if
((
hr
=
IDirect3DQuery9_GetData
(
query
,
NULL
,
0
,
D3DGETDATA_FLUSH
))
!=
S_FALSE
)
break
;
Sleep
(
10
);
}
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DQuery9_GetData
(
query
,
&
timestamp
,
sizeof
(
timestamp
),
D3DGETDATA_FLUSH
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
IDirect3DQuery9_Release
(
query
);
IDirect3DQuery9_Release
(
disjoint_query
);
IDirect3DQuery9_Release
(
freq_query
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
IDirect3D9_Release
(
d3d9
);
DestroyWindow
(
window
);
}
static
void
test_get_set_vertex_shader
(
void
)
static
void
test_get_set_vertex_shader
(
void
)
{
{
IDirect3DVertexShader9
*
current_shader
=
NULL
;
IDirect3DVertexShader9
*
current_shader
=
NULL
;
...
@@ -7903,6 +8051,7 @@ START_TEST(device)
...
@@ -7903,6 +8051,7 @@ START_TEST(device)
test_vertex_buffer_alignment
();
test_vertex_buffer_alignment
();
test_query_support
();
test_query_support
();
test_occlusion_query_states
();
test_occlusion_query_states
();
test_timestamp_query
();
test_get_set_vertex_shader
();
test_get_set_vertex_shader
();
test_vertex_shader_constant
();
test_vertex_shader_constant
();
test_get_set_pixel_shader
();
test_get_set_pixel_shader
();
...
...
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