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
f451c7b5
Commit
f451c7b5
authored
Feb 27, 2019
by
Józef Kucia
Committed by
Alexandre Julliard
Feb 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d12/tests: Add test for backbuffer index after changing sync interval.
Signed-off-by:
Józef Kucia
<
jkucia@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0510bca6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
d3d12.c
dlls/d3d12/tests/d3d12.c
+77
-0
No files found.
dlls/d3d12/tests/d3d12.c
View file @
f451c7b5
...
@@ -1009,6 +1009,82 @@ static void test_swapchain_size_mismatch(void)
...
@@ -1009,6 +1009,82 @@ static void test_swapchain_size_mismatch(void)
destroy_test_context
(
&
context
);
destroy_test_context
(
&
context
);
}
}
static
void
test_swapchain_backbuffer_index
(
void
)
{
static
const
float
green
[]
=
{
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
};
unsigned
int
previous_index
,
expected_index
,
index
,
i
;
ID3D12GraphicsCommandList
*
command_list
;
ID3D12Resource
*
backbuffers
[
2
];
struct
test_context_desc
desc
;
struct
test_context
context
;
unsigned
int
sync_interval
;
IDXGISwapChain3
*
swapchain
;
ID3D12CommandQueue
*
queue
;
ID3D12Device
*
device
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
RECT
rect
;
BOOL
ret
;
desc
.
no_pipeline
=
TRUE
;
if
(
!
init_test_context
(
&
context
,
&
desc
))
return
;
device
=
context
.
device
;
command_list
=
context
.
list
;
queue
=
context
.
queue
;
window
=
create_window
(
WS_VISIBLE
);
ret
=
GetClientRect
(
window
,
&
rect
);
ok
(
ret
,
"Failed to get client rect.
\n
"
);
swapchain
=
create_swapchain
(
queue
,
window
,
DXGI_FORMAT_B8G8R8A8_UNORM
,
rect
.
right
,
rect
.
bottom
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
backbuffers
);
++
i
)
{
hr
=
IDXGISwapChain3_GetBuffer
(
swapchain
,
i
,
&
IID_ID3D12Resource
,
(
void
**
)
&
backbuffers
[
i
]);
ok
(
hr
==
S_OK
,
"Failed to get swapchain buffer %u, hr %#x.
\n
"
,
i
,
hr
);
}
previous_index
=
1
;
for
(
i
=
0
;
i
<
20
;
++
i
)
{
index
=
IDXGISwapChain3_GetCurrentBackBufferIndex
(
swapchain
);
ID3D12Device_CreateRenderTargetView
(
device
,
backbuffers
[
index
],
NULL
,
context
.
rtv
);
expected_index
=
(
previous_index
+
1
)
%
2
;
ok
(
index
==
expected_index
,
"Test %u: Got index %u, expected %u.
\n
"
,
i
,
index
,
expected_index
);
transition_sub_resource_state
(
command_list
,
backbuffers
[
index
],
0
,
D3D12_RESOURCE_STATE_PRESENT
,
D3D12_RESOURCE_STATE_RENDER_TARGET
);
ID3D12GraphicsCommandList_ClearRenderTargetView
(
command_list
,
context
.
rtv
,
green
,
0
,
NULL
);
transition_sub_resource_state
(
command_list
,
backbuffers
[
index
],
0
,
D3D12_RESOURCE_STATE_RENDER_TARGET
,
D3D12_RESOURCE_STATE_PRESENT
);
hr
=
ID3D12GraphicsCommandList_Close
(
command_list
);
ok
(
hr
==
S_OK
,
"Failed to close command list, hr %#x.
\n
"
,
hr
);
exec_command_list
(
queue
,
command_list
);
if
(
i
<=
4
||
(
8
<=
i
&&
i
<=
14
))
sync_interval
=
1
;
else
sync_interval
=
0
;
hr
=
IDXGISwapChain3_Present
(
swapchain
,
sync_interval
,
0
);
ok
(
hr
==
S_OK
,
"Failed to present, hr %#x.
\n
"
,
hr
);
wait_queue_idle
(
device
,
queue
);
reset_command_list
(
command_list
,
context
.
allocator
);
previous_index
=
index
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
backbuffers
);
++
i
)
ID3D12Resource_Release
(
backbuffers
[
i
]);
refcount
=
IDXGISwapChain3_Release
(
swapchain
);
ok
(
!
refcount
,
"Swapchain has %u references left.
\n
"
,
refcount
);
DestroyWindow
(
window
);
destroy_test_context
(
&
context
);
}
START_TEST
(
d3d12
)
START_TEST
(
d3d12
)
{
{
BOOL
enable_debug_layer
=
FALSE
;
BOOL
enable_debug_layer
=
FALSE
;
...
@@ -1039,4 +1115,5 @@ START_TEST(d3d12)
...
@@ -1039,4 +1115,5 @@ START_TEST(d3d12)
test_draw
();
test_draw
();
test_swapchain_draw
();
test_swapchain_draw
();
test_swapchain_size_mismatch
();
test_swapchain_size_mismatch
();
test_swapchain_backbuffer_index
();
}
}
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