Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8c91486e
Commit
8c91486e
authored
Feb 24, 2021
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d11/tests: Add a test for layered clears.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
54b2bb52
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
15 deletions
+75
-15
d3d11.c
dlls/d3d11/tests/d3d11.c
+75
-15
No files found.
dlls/d3d11/tests/d3d11.c
View file @
8c91486e
...
...
@@ -15434,18 +15434,20 @@ static void test_clear_render_target_view_1d(void)
static
void
test_clear_render_target_view_2d
(
void
)
{
static
const
DWORD
expected_color
=
0xbf4c7f19
,
expected_srgb_color
=
0xbf95bc59
;
static
const
float
c
olo
r
[]
=
{
0
.
1
f
,
0
.
5
f
,
0
.
3
f
,
0
.
75
f
};
static
const
float
c
lear_colou
r
[]
=
{
0
.
1
f
,
0
.
5
f
,
0
.
3
f
,
0
.
75
f
};
static
const
float
green
[]
=
{
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
5
f
};
static
const
float
blue
[]
=
{
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
5
f
};
ID3D11RenderTargetView
*
rtv
[
3
],
*
srgb_rtv
;
ID3D11Texture2D
*
texture
,
*
srgb_texture
;
struct
d3d11_test_context
test_context
;
ID3D11RenderTargetView
*
rtv
,
*
srgb_rtv
;
D3D11_RENDER_TARGET_VIEW_DESC
rtv_desc
;
D3D11_TEXTURE2D_DESC
texture_desc
;
ID3D11DeviceContext
*
context
;
struct
resource_readback
rb
;
ID3D11Device
*
device
;
unsigned
int
i
,
j
;
DWORD
colour
;
HRESULT
hr
;
if
(
!
init_test_context
(
&
test_context
,
NULL
))
...
...
@@ -15472,27 +15474,27 @@ static void test_clear_render_target_view_2d(void)
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
texture_desc
,
NULL
,
&
srgb_texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create texture, hr %#x.
\n
"
,
hr
);
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
texture
,
NULL
,
&
rtv
);
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
texture
,
NULL
,
&
rtv
[
0
]
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create render target view, hr %#x.
\n
"
,
hr
);
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
srgb_texture
,
NULL
,
&
srgb_rtv
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create render target view, hr %#x.
\n
"
,
hr
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
test_context
.
backbuffer_rtv
,
c
olo
r
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
test_context
.
backbuffer_rtv
,
c
lear_colou
r
);
check_texture_color
(
test_context
.
backbuffer
,
expected_color
,
1
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
rtv
,
colo
r
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
rtv
[
0
],
clear_colou
r
);
check_texture_color
(
texture
,
expected_color
,
1
);
if
(
!
enable_debug_layer
)
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
NULL
,
green
);
check_texture_color
(
texture
,
expected_color
,
1
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
srgb_rtv
,
c
olo
r
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
srgb_rtv
,
c
lear_colou
r
);
check_texture_color
(
srgb_texture
,
expected_srgb_color
,
1
);
ID3D11RenderTargetView_Release
(
srgb_rtv
);
ID3D11RenderTargetView_Release
(
rtv
);
ID3D11RenderTargetView_Release
(
rtv
[
0
]
);
ID3D11Texture2D_Release
(
srgb_texture
);
ID3D11Texture2D_Release
(
texture
);
...
...
@@ -15509,30 +15511,88 @@ static void test_clear_render_target_view_2d(void)
rtv_desc
.
Format
=
DXGI_FORMAT_R8G8B8A8_UNORM
;
rtv_desc
.
ViewDimension
=
D3D11_RTV_DIMENSION_TEXTURE2D
;
U
(
rtv_desc
).
Texture2D
.
MipSlice
=
0
;
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
texture
,
&
rtv_desc
,
&
rtv
);
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
texture
,
&
rtv_desc
,
&
rtv
[
0
]
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create render target view, hr %#x.
\n
"
,
hr
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
rtv
,
colo
r
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
rtv
[
0
],
clear_colou
r
);
check_texture_color
(
texture
,
expected_color
,
1
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
srgb_rtv
,
c
olo
r
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
srgb_rtv
,
c
lear_colou
r
);
get_texture_readback
(
texture
,
0
,
&
rb
);
for
(
i
=
0
;
i
<
4
;
++
i
)
{
for
(
j
=
0
;
j
<
4
;
++
j
)
{
BOOL
broken_device
=
is_warp_device
(
device
)
||
is_nvidia_device
(
device
);
DWORD
colo
r
=
get_readback_color
(
&
rb
,
80
+
i
*
160
,
60
+
j
*
120
,
0
);
ok
(
compare_color
(
color
,
expected_srgb_color
,
1
)
||
broken
(
compare_color
(
color
,
expected_color
,
1
)
&&
broken_device
),
"Got unexpected colo
r 0x%08x.
\n
"
,
colo
r
);
colou
r
=
get_readback_color
(
&
rb
,
80
+
i
*
160
,
60
+
j
*
120
,
0
);
ok
(
compare_color
(
colo
u
r
,
expected_srgb_color
,
1
)
||
broken
(
compare_color
(
colo
u
r
,
expected_color
,
1
)
&&
broken_device
),
"Got unexpected colo
ur 0x%08x.
\n
"
,
colou
r
);
}
}
release_resource_readback
(
&
rb
);
ID3D11RenderTargetView_Release
(
srgb_rtv
);
ID3D11RenderTargetView_Release
(
rtv
);
ID3D11RenderTargetView_Release
(
rtv
[
0
]
);
ID3D11Texture2D_Release
(
texture
);
texture_desc
.
Width
=
16
;
texture_desc
.
Height
=
16
;
texture_desc
.
ArraySize
=
5
;
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
texture_desc
,
NULL
,
&
texture
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
rtv_desc
.
ViewDimension
=
D3D11_RTV_DIMENSION_TEXTURE2DARRAY
;
U
(
rtv_desc
).
Texture2DArray
.
MipSlice
=
0
;
U
(
rtv_desc
).
Texture2DArray
.
FirstArraySlice
=
0
;
U
(
rtv_desc
).
Texture2DArray
.
ArraySize
=
5
;
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
texture
,
&
rtv_desc
,
&
rtv
[
0
]);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
U
(
rtv_desc
).
Texture2DArray
.
FirstArraySlice
=
1
;
U
(
rtv_desc
).
Texture2DArray
.
ArraySize
=
3
;
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
texture
,
&
rtv_desc
,
&
rtv
[
1
]);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
U
(
rtv_desc
).
Texture2DArray
.
FirstArraySlice
=
2
;
U
(
rtv_desc
).
Texture2DArray
.
ArraySize
=
1
;
hr
=
ID3D11Device_CreateRenderTargetView
(
device
,
(
ID3D11Resource
*
)
texture
,
&
rtv_desc
,
&
rtv
[
2
]);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
rtv
[
0
],
blue
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
rtv
[
1
],
green
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
rtv
[
2
],
clear_colour
);
get_texture_readback
(
texture
,
0
,
&
rb
);
colour
=
get_readback_color
(
&
rb
,
8
,
8
,
0
);
todo_wine
ok
(
compare_color
(
colour
,
0x80ff0000
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
release_resource_readback
(
&
rb
);
get_texture_readback
(
texture
,
1
,
&
rb
);
colour
=
get_readback_color
(
&
rb
,
8
,
8
,
0
);
todo_wine
ok
(
compare_color
(
colour
,
0x8000ff00
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
release_resource_readback
(
&
rb
);
get_texture_readback
(
texture
,
2
,
&
rb
);
colour
=
get_readback_color
(
&
rb
,
8
,
8
,
0
);
ok
(
compare_color
(
colour
,
0xbf4c7f19
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
release_resource_readback
(
&
rb
);
get_texture_readback
(
texture
,
3
,
&
rb
);
colour
=
get_readback_color
(
&
rb
,
8
,
8
,
0
);
todo_wine
ok
(
compare_color
(
colour
,
0x8000ff00
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
release_resource_readback
(
&
rb
);
get_texture_readback
(
texture
,
4
,
&
rb
);
colour
=
get_readback_color
(
&
rb
,
8
,
8
,
0
);
todo_wine
ok
(
compare_color
(
colour
,
0x80ff0000
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
release_resource_readback
(
&
rb
);
ID3D11RenderTargetView_Release
(
rtv
[
2
]);
ID3D11RenderTargetView_Release
(
rtv
[
1
]);
ID3D11RenderTargetView_Release
(
rtv
[
0
]);
ID3D11Texture2D_Release
(
texture
);
release_test_context
(
&
test_context
);
}
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