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
9b1b5894
Commit
9b1b5894
authored
Jan 08, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add a test for ProcessVertices() on D3DPOOL_SYSTEMMEM buffers.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9fa65a87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
5 deletions
+50
-5
visual.c
dlls/d3d9/tests/visual.c
+50
-5
No files found.
dlls/d3d9/tests/visual.c
View file @
9b1b5894
...
...
@@ -28,6 +28,7 @@
* causes visible results in games can be tested in a way that does not depend on pixel exactness
*/
#include <limits.h>
#include <math.h>
#define COBJMACROS
...
...
@@ -73,6 +74,30 @@ static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
return
TRUE
;
}
static
BOOL
compare_float
(
float
f
,
float
g
,
unsigned
int
ulps
)
{
int
x
=
*
(
int
*
)
&
f
;
int
y
=
*
(
int
*
)
&
g
;
if
(
x
<
0
)
x
=
INT_MIN
-
x
;
if
(
y
<
0
)
y
=
INT_MIN
-
y
;
if
(
abs
(
x
-
y
)
>
ulps
)
return
FALSE
;
return
TRUE
;
}
static
BOOL
compare_vec4
(
const
struct
vec4
*
vec
,
float
x
,
float
y
,
float
z
,
float
w
,
unsigned
int
ulps
)
{
return
compare_float
(
vec
->
x
,
x
,
ulps
)
&&
compare_float
(
vec
->
y
,
y
,
ulps
)
&&
compare_float
(
vec
->
z
,
z
,
ulps
)
&&
compare_float
(
vec
->
w
,
w
,
ulps
);
}
static
BOOL
adapter_is_warp
(
const
D3DADAPTER_IDENTIFIER9
*
identifier
)
{
return
!
strcmp
(
identifier
->
Driver
,
"d3d10warp.dll"
);
...
...
@@ -24199,12 +24224,14 @@ static void test_color_vertex(void)
static
void
test_sysmem_draw
(
void
)
{
IDirect3DVertexBuffer9
*
vb
,
*
vb_s0
,
*
vb_s1
,
*
dst_vb
;
IDirect3DVertexDeclaration9
*
vertex_declaration
;
IDirect3DVertexBuffer9
*
vb
,
*
vb_s0
,
*
vb_s1
;
IDirect3DIndexBuffer9
*
ib
;
IDirect3DDevice9
*
device
;
struct
vec4
*
dst_data
;
IDirect3D9
*
d3d
;
D3DCOLOR
colour
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
...
...
@@ -24223,10 +24250,10 @@ static void test_sysmem_draw(void)
}
quad
[]
=
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
0xffff0000
},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
0xff00ff00
},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
0xff0000ff
},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
0xffffffff
},
{{
-
0
.
5
f
,
-
0
.
5
f
,
0
.
0
f
},
0xffff0000
},
{{
-
0
.
5
f
,
0
.
5
f
,
0
.
0
f
},
0xff00ff00
},
{{
0
.
5
f
,
-
0
.
5
f
,
0
.
0
f
},
0xff0000ff
},
{{
0
.
5
f
,
0
.
5
f
,
0
.
0
f
},
0xffffffff
},
};
static
const
struct
vec3
quad_s0
[]
=
{
...
...
@@ -24296,6 +24323,23 @@ static void test_sysmem_draw(void)
colour
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
colour
,
0x00007f7f
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
hr
=
IDirect3DDevice9_CreateVertexBuffer
(
device
,
ARRAY_SIZE
(
quad
)
*
sizeof
(
*
dst_data
),
0
,
D3DFVF_XYZRHW
,
D3DPOOL_SYSTEMMEM
,
&
dst_vb
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_ProcessVertices
(
device
,
0
,
0
,
ARRAY_SIZE
(
quad
),
dst_vb
,
NULL
,
0
);
todo_wine
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer9_Lock
(
dst_vb
,
0
,
0
,
(
void
**
)
&
dst_data
,
0
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
quad
);
++
i
)
{
todo_wine
ok
(
compare_vec4
(
&
dst_data
[
i
],
quad
[
i
].
position
.
x
*
320
.
0
f
+
320
.
0
f
,
-
quad
[
i
].
position
.
y
*
240
.
0
f
+
240
.
0
f
,
0
.
0
f
,
1
.
0
f
,
1
),
"Got unexpected vertex %u {%.8e, %.8e, %.8e, %.8e}.
\n
"
,
i
,
dst_data
[
i
].
x
,
dst_data
[
i
].
y
,
dst_data
[
i
].
z
,
dst_data
[
i
].
w
);
}
hr
=
IDirect3DVertexBuffer9_Unlock
(
dst_vb
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateIndexBuffer
(
device
,
sizeof
(
indices
),
0
,
D3DFMT_INDEX16
,
D3DPOOL_SYSTEMMEM
,
&
ib
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
...
...
@@ -24379,6 +24423,7 @@ static void test_sysmem_draw(void)
IDirect3DVertexBuffer9_Release
(
vb_s0
);
IDirect3DVertexDeclaration9_Release
(
vertex_declaration
);
IDirect3DIndexBuffer9_Release
(
ib
);
IDirect3DVertexBuffer9_Release
(
dst_vb
);
IDirect3DVertexBuffer9_Release
(
vb
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
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