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
de9eeba7
Commit
de9eeba7
authored
Nov 21, 2023
by
Brendan McGrath
Committed by
Alexandre Julliard
Nov 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Add test for multithreaded draw.
Tests that Direct2D can not access D2D exclusive resources whilst the Direct 2D lock is held
parent
7fd9c158
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
8 deletions
+42
-8
d2d1.c
dlls/d2d1/tests/d2d1.c
+42
-8
No files found.
dlls/d2d1/tests/d2d1.c
View file @
de9eeba7
...
...
@@ -1163,13 +1163,13 @@ static IDXGISwapChain *create_d3d10_swapchain(ID3D10Device1 *device, HWND window
}
static
ID2D1RenderTarget
*
create_render_target_desc
(
IDXGISurface
*
surface
,
const
D2D1_RENDER_TARGET_PROPERTIES
*
desc
,
BOOL
d3d11
)
const
D2D1_RENDER_TARGET_PROPERTIES
*
desc
,
BOOL
d3d11
,
D2D1_FACTORY_TYPE
factory_type
)
{
ID2D1RenderTarget
*
render_target
;
ID2D1Factory
*
factory
;
HRESULT
hr
;
hr
=
D2D1CreateFactory
(
D2D1_FACTORY_TYPE_SINGLE_THREADED
,
&
IID_ID2D1Factory
,
NULL
,
(
void
**
)
&
factory
);
hr
=
D2D1CreateFactory
(
factory_type
,
&
IID_ID2D1Factory
,
NULL
,
(
void
**
)
&
factory
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1Factory_CreateDxgiSurfaceRenderTarget
(
factory
,
surface
,
desc
,
&
render_target
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -1178,7 +1178,7 @@ static ID2D1RenderTarget *create_render_target_desc(IDXGISurface *surface,
return
render_target
;
}
static
ID2D1RenderTarget
*
create_render_target
(
IDXGISurface
*
surface
,
BOOL
d3d11
)
static
ID2D1RenderTarget
*
create_render_target
(
IDXGISurface
*
surface
,
BOOL
d3d11
,
D2D1_FACTORY_TYPE
factory_type
)
{
D2D1_RENDER_TARGET_PROPERTIES
desc
;
...
...
@@ -1190,7 +1190,7 @@ static ID2D1RenderTarget *create_render_target(IDXGISurface *surface, BOOL d3d11
desc
.
usage
=
D2D1_RENDER_TARGET_USAGE_NONE
;
desc
.
minLevel
=
D2D1_FEATURE_LEVEL_DEFAULT
;
return
create_render_target_desc
(
surface
,
&
desc
,
d3d11
);
return
create_render_target_desc
(
surface
,
&
desc
,
d3d11
,
factory_type
);
}
#define release_test_context(ctx) release_test_context_(__LINE__, ctx)
...
...
@@ -1216,8 +1216,9 @@ static void release_test_context_(unsigned int line, struct d2d1_test_context *c
ok_
(
__FILE__
,
line
)(
!
ref
,
"Device has %lu references left.
\n
"
,
ref
);
}
#define init_test_context(ctx, d3d11) init_test_context_(__LINE__, ctx, d3d11)
static
BOOL
init_test_context_
(
unsigned
int
line
,
struct
d2d1_test_context
*
ctx
,
BOOL
d3d11
)
#define init_test_context(ctx, d3d11) init_test_context_(__LINE__, ctx, d3d11, D2D1_FACTORY_TYPE_SINGLE_THREADED)
#define init_test_multithreaded_context(ctx, d3d11) init_test_context_(__LINE__, ctx, d3d11, D2D1_FACTORY_TYPE_MULTI_THREADED)
static
BOOL
init_test_context_
(
unsigned
int
line
,
struct
d2d1_test_context
*
ctx
,
BOOL
d3d11
,
D2D1_FACTORY_TYPE
factory_type
)
{
HRESULT
hr
;
...
...
@@ -1237,7 +1238,7 @@ static BOOL init_test_context_(unsigned int line, struct d2d1_test_context *ctx,
hr
=
IDXGISwapChain_GetBuffer
(
ctx
->
swapchain
,
0
,
&
IID_IDXGISurface
,
(
void
**
)
&
ctx
->
surface
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Failed to get buffer, hr %#lx.
\n
"
,
hr
);
ctx
->
rt
=
create_render_target
(
ctx
->
surface
,
d3d11
);
ctx
->
rt
=
create_render_target
(
ctx
->
surface
,
d3d11
,
factory_type
);
if
(
!
ctx
->
rt
&&
d3d11
)
{
todo_wine
win_skip_
(
__FILE__
,
line
)(
"Skipping d3d11 tests.
\n
"
);
...
...
@@ -4887,7 +4888,7 @@ static void test_alpha_mode(BOOL d3d11)
rt_desc
.
dpiY
=
0
.
0
f
;
rt_desc
.
usage
=
D2D1_RENDER_TARGET_USAGE_NONE
;
rt_desc
.
minLevel
=
D2D1_FEATURE_LEVEL_DEFAULT
;
rt
=
create_render_target_desc
(
ctx
.
surface
,
&
rt_desc
,
d3d11
);
rt
=
create_render_target_desc
(
ctx
.
surface
,
&
rt_desc
,
d3d11
,
D2D1_FACTORY_TYPE_SINGLE_THREADED
);
ok
(
!!
rt
,
"Failed to create render target.
\n
"
);
ID2D1RenderTarget_SetAntialiasMode
(
rt
,
D2D1_ANTIALIAS_MODE_ALIASED
);
...
...
@@ -10694,8 +10695,23 @@ static DWORD WINAPI mt_factory_test_thread_func(void *param)
return
0
;
}
static
DWORD
WINAPI
mt_factory_test_thread_draw_func
(
void
*
param
)
{
ID2D1RenderTarget
*
rt
=
param
;
D2D1_COLOR_F
color
;
HRESULT
hr
;
ID2D1RenderTarget_BeginDraw
(
rt
);
set_color
(
&
color
,
1
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
);
ID2D1RenderTarget_Clear
(
rt
,
&
color
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
return
0
;
}
static
void
test_mt_factory
(
BOOL
d3d11
)
{
struct
d2d1_test_context
ctx
;
ID2D1Multithread
*
multithread
;
ID2D1Factory
*
factory
;
HANDLE
thread
;
...
...
@@ -10750,6 +10766,24 @@ static void test_mt_factory(BOOL d3d11)
ID2D1Multithread_Release
(
multithread
);
ID2D1Factory_Release
(
factory
);
if
(
!
init_test_multithreaded_context
(
&
ctx
,
d3d11
))
return
;
hr
=
ID2D1Factory_QueryInterface
(
ctx
.
factory
,
&
IID_ID2D1Multithread
,
(
void
**
)
&
multithread
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1Multithread_Enter
(
multithread
);
thread
=
CreateThread
(
NULL
,
0
,
mt_factory_test_thread_draw_func
,
ctx
.
rt
,
0
,
NULL
);
ok
(
!!
thread
,
"Failed to create a thread.
\n
"
);
ret
=
WaitForSingleObject
(
thread
,
1000
);
todo_wine
ok
(
ret
==
WAIT_TIMEOUT
,
"Expected timeout.
\n
"
);
ID2D1Multithread_Leave
(
multithread
);
WaitForSingleObject
(
thread
,
INFINITE
);
CloseHandle
(
thread
);
ID2D1Multithread_Release
(
multithread
);
release_test_context
(
&
ctx
);
}
#define check_system_properties(effect, is_builtin) check_system_properties_(__LINE__, effect, is_builtin)
...
...
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