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
310849de
Commit
310849de
authored
Apr 02, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d11/tests: Introduce and use check_readback_data_u16.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
86aaebc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
43 deletions
+58
-43
d3d11.c
dlls/d3d11/tests/d3d11.c
+58
-43
No files found.
dlls/d3d11/tests/d3d11.c
View file @
310849de
...
...
@@ -936,11 +936,16 @@ static void *get_readback_data(struct resource_readback *rb,
return
(
BYTE
*
)
rb
->
map_desc
.
pData
+
z
*
rb
->
map_desc
.
DepthPitch
+
y
*
rb
->
map_desc
.
RowPitch
+
x
*
byte_width
;
}
static
BYTE
get_readback_
byte
(
struct
resource_readback
*
rb
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
static
BYTE
get_readback_
u8
(
struct
resource_readback
*
rb
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
{
return
*
(
BYTE
*
)
get_readback_data
(
rb
,
x
,
y
,
z
,
sizeof
(
BYTE
));
}
static
WORD
get_readback_u16
(
struct
resource_readback
*
rb
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
{
return
*
(
WORD
*
)
get_readback_data
(
rb
,
x
,
y
,
z
,
sizeof
(
WORD
));
}
static
DWORD
get_readback_color
(
struct
resource_readback
*
rb
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
{
return
*
(
DWORD
*
)
get_readback_data
(
rb
,
x
,
y
,
z
,
sizeof
(
DWORD
));
...
...
@@ -980,12 +985,12 @@ static DWORD get_texture_color(ID3D11Texture2D *texture, unsigned int x, unsigne
return
color
;
}
#define check_readback_data_
byte(a, b, c, d) check_readback_data_byte
_(__LINE__, a, b, c, d)
static
void
check_readback_data_
byte
_
(
unsigned
int
line
,
struct
resource_readback
*
rb
,
#define check_readback_data_
u8(a, b, c, d) check_readback_data_u8
_(__LINE__, a, b, c, d)
static
void
check_readback_data_
u8
_
(
unsigned
int
line
,
struct
resource_readback
*
rb
,
const
RECT
*
rect
,
BYTE
expected_value
,
BYTE
max_diff
)
{
unsigned
int
x
=
0
,
y
=
0
,
z
=
0
;
BOOL
all_match
=
TRU
E
;
BOOL
all_match
=
FALS
E
;
RECT
default_rect
;
BYTE
value
=
0
;
...
...
@@ -1001,30 +1006,61 @@ static void check_readback_data_byte_(unsigned int line, struct resource_readbac
{
for
(
x
=
rect
->
left
;
x
<
rect
->
right
;
++
x
)
{
value
=
get_readback_byte
(
rb
,
x
,
y
,
z
);
if
(
!
compare_color
(
value
,
expected_value
,
max_diff
))
{
all_match
=
FALSE
;
break
;
}
value
=
get_readback_u8
(
rb
,
x
,
y
,
z
);
if
(
abs
((
int
)
value
-
(
int
)
expected_value
)
>
max_diff
)
goto
done
;
}
if
(
!
all_match
)
break
;
}
if
(
!
all_match
)
break
;
}
all_match
=
TRUE
;
done:
ok_
(
__FILE__
,
line
)(
all_match
,
"Got 0x%02x, expected 0x%02x at (%u, %u, %u), sub-resource %u.
\n
"
,
value
,
expected_value
,
x
,
y
,
z
,
rb
->
sub_resource_idx
);
}
#define check_readback_data_u16(a, b, c, d) check_readback_data_u16_(__LINE__, a, b, c, d)
static
void
check_readback_data_u16_
(
unsigned
int
line
,
struct
resource_readback
*
rb
,
const
RECT
*
rect
,
WORD
expected_value
,
BYTE
max_diff
)
{
unsigned
int
x
=
0
,
y
=
0
,
z
=
0
;
BOOL
all_match
=
FALSE
;
RECT
default_rect
;
WORD
value
=
0
;
if
(
!
rect
)
{
SetRect
(
&
default_rect
,
0
,
0
,
rb
->
width
,
rb
->
height
);
rect
=
&
default_rect
;
}
for
(
z
=
0
;
z
<
rb
->
depth
;
++
z
)
{
for
(
y
=
rect
->
top
;
y
<
rect
->
bottom
;
++
y
)
{
for
(
x
=
rect
->
left
;
x
<
rect
->
right
;
++
x
)
{
value
=
get_readback_u16
(
rb
,
x
,
y
,
z
);
if
(
abs
((
int
)
value
-
(
int
)
expected_value
)
>
max_diff
)
goto
done
;
}
}
}
all_match
=
TRUE
;
done:
ok_
(
__FILE__
,
line
)(
all_match
,
"Got 0x%04x, expected 0x%04x at (%u, %u, %u), sub-resource %u.
\n
"
,
value
,
expected_value
,
x
,
y
,
z
,
rb
->
sub_resource_idx
);
}
#define check_readback_data_color(a, b, c, d) check_readback_data_color_(__LINE__, a, b, c, d)
static
void
check_readback_data_color_
(
unsigned
int
line
,
struct
resource_readback
*
rb
,
const
RECT
*
rect
,
DWORD
expected_color
,
BYTE
max_diff
)
{
unsigned
int
x
=
0
,
y
=
0
,
z
=
0
;
BOOL
all_match
=
TRU
E
;
BOOL
all_match
=
FALS
E
;
RECT
default_rect
;
DWORD
color
=
0
;
...
...
@@ -1042,17 +1078,13 @@ static void check_readback_data_color_(unsigned int line, struct resource_readba
{
color
=
get_readback_color
(
rb
,
x
,
y
,
z
);
if
(
!
compare_color
(
color
,
expected_color
,
max_diff
))
{
all_match
=
FALSE
;
break
;
}
goto
done
;
}
if
(
!
all_match
)
break
;
}
if
(
!
all_match
)
break
;
}
all_match
=
TRUE
;
done:
ok_
(
__FILE__
,
line
)(
all_match
,
"Got 0x%08x, expected 0x%08x at (%u, %u, %u), sub-resource %u.
\n
"
,
color
,
expected_color
,
x
,
y
,
z
,
rb
->
sub_resource_idx
);
...
...
@@ -25514,14 +25546,7 @@ static void test_depth_bias(void)
break
;
case
DXGI_FORMAT_D16_UNORM
:
get_texture_readback
(
texture
,
0
,
&
rb
);
for
(
y
=
0
;
y
<
texture_desc
.
Height
;
++
y
)
{
for
(
x
=
0
;
x
<
texture_desc
.
Width
;
++
x
)
{
u16
=
get_readback_data
(
&
rb
,
x
,
y
,
0
,
sizeof
(
*
u16
));
ok
(
*
u16
==
0xffff
,
"Got unexpected value %#x.
\n
"
,
*
u16
);
}
}
check_readback_data_u16
(
&
rb
,
NULL
,
0xffffu
,
0
);
release_resource_readback
(
&
rb
);
break
;
default:
...
...
@@ -25586,17 +25611,7 @@ static void test_depth_bias(void)
depth
=
min
(
max
(
0
.
0
f
,
quads
[
i
].
z
+
bias
),
1
.
0
f
);
get_texture_readback
(
texture
,
0
,
&
rb
);
for
(
y
=
0
;
y
<
texture_desc
.
Height
;
++
y
)
{
expected_value
=
depth
*
65535
.
0
f
+
0
.
5
f
;
for
(
x
=
0
;
x
<
texture_desc
.
Width
;
++
x
)
{
u16
=
get_readback_data
(
&
rb
,
x
,
y
,
0
,
sizeof
(
*
u16
));
ok
(
abs
(
*
u16
-
expected_value
)
<=
1
,
"Got value %#x (%.8e), expected %#x (%.8e).
\n
"
,
*
u16
,
*
u16
/
65535
.
0
f
,
expected_value
,
expected_value
/
65535
.
0
f
);
}
}
check_readback_data_u16
(
&
rb
,
NULL
,
depth
*
65535
.
0
f
+
0
.
5
f
,
1
);
release_resource_readback
(
&
rb
);
break
;
default:
...
...
@@ -29007,7 +29022,7 @@ static void test_render_a8(void)
ID3D11DeviceContext_OMSetRenderTargets
(
context
,
1
,
&
rtv
,
NULL
);
draw_quad
(
&
test_context
);
get_texture_readback
(
texture
,
0
,
&
rb
);
check_readback_data_
byte
(
&
rb
,
NULL
,
0xff
,
0
);
check_readback_data_
u8
(
&
rb
,
NULL
,
0xff
,
0
);
release_resource_readback
(
&
rb
);
ID3D11DeviceContext_ClearRenderTargetView
(
context
,
test_context
.
backbuffer_rtv
,
black
);
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