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
da50331b
Commit
da50331b
authored
Jan 08, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8/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
9b1b5894
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
7 deletions
+77
-7
visual.c
dlls/d3d8/tests/visual.c
+76
-6
d3d8.h
include/d3d8.h
+1
-1
No files found.
dlls/d3d8/tests/visual.c
View file @
da50331b
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
/* See comment in dlls/d3d9/tests/visual.c for general guidelines */
/* See comment in dlls/d3d9/tests/visual.c for general guidelines */
#include <limits.h>
#include <math.h>
#include <math.h>
#define COBJMACROS
#define COBJMACROS
...
@@ -62,6 +63,30 @@ static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
...
@@ -62,6 +63,30 @@ static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
return
TRUE
;
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_IDENTIFIER8
*
identifier
)
static
BOOL
adapter_is_warp
(
const
D3DADAPTER_IDENTIFIER8
*
identifier
)
{
{
return
!
strcmp
(
identifier
->
Driver
,
"d3d10warp.dll"
);
return
!
strcmp
(
identifier
->
Driver
,
"d3d10warp.dll"
);
...
@@ -10448,11 +10473,14 @@ static void test_color_vertex(void)
...
@@ -10448,11 +10473,14 @@ static void test_color_vertex(void)
static
void
test_sysmem_draw
(
void
)
static
void
test_sysmem_draw
(
void
)
{
{
IDirect3DVertexBuffer8
*
vb
,
*
vb_s0
,
*
vb_s1
;
IDirect3DVertexBuffer8
*
vb
,
*
vb_s0
,
*
vb_s1
,
*
dst_vb
;
D3DPRESENT_PARAMETERS
present_parameters
=
{
0
};
IDirect3DIndexBuffer8
*
ib
;
IDirect3DIndexBuffer8
*
ib
;
IDirect3DDevice8
*
device
;
IDirect3DDevice8
*
device
;
struct
vec4
*
dst_data
;
IDirect3D8
*
d3d
;
IDirect3D8
*
d3d
;
D3DCOLOR
colour
;
D3DCOLOR
colour
;
unsigned
int
i
;
ULONG
refcount
;
ULONG
refcount
;
HWND
window
;
HWND
window
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -10474,10 +10502,10 @@ static void test_sysmem_draw(void)
...
@@ -10474,10 +10502,10 @@ static void test_sysmem_draw(void)
}
}
quad
[]
=
quad
[]
=
{
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
0xffff0000
},
{{
-
0
.
5
f
,
-
0
.
5
f
,
0
.
0
f
},
0xffff0000
},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
0xff00ff00
},
{{
-
0
.
5
f
,
0
.
5
f
,
0
.
0
f
},
0xff00ff00
},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
0xff0000ff
},
{{
0
.
5
f
,
-
0
.
5
f
,
0
.
0
f
},
0xff0000ff
},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
0xffffffff
},
{{
0
.
5
f
,
0
.
5
f
,
0
.
0
f
},
0xffffffff
},
};
};
static
const
struct
vec3
quad_s0
[]
=
static
const
struct
vec3
quad_s0
[]
=
{
{
...
@@ -10510,7 +10538,17 @@ static void test_sysmem_draw(void)
...
@@ -10510,7 +10538,17 @@ static void test_sysmem_draw(void)
d3d
=
Direct3DCreate8
(
D3D_SDK_VERSION
);
d3d
=
Direct3DCreate8
(
D3D_SDK_VERSION
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d
,
window
,
window
,
TRUE
)))
present_parameters
.
BackBufferWidth
=
640
;
present_parameters
.
BackBufferHeight
=
480
;
present_parameters
.
BackBufferFormat
=
D3DFMT_A8R8G8B8
;
present_parameters
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
present_parameters
.
hDeviceWindow
=
window
;
present_parameters
.
Windowed
=
TRUE
;
present_parameters
.
EnableAutoDepthStencil
=
TRUE
;
present_parameters
.
AutoDepthStencilFormat
=
D3DFMT_D24S8
;
if
(
FAILED
(
hr
=
IDirect3D8_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
window
,
D3DCREATE_MIXED_VERTEXPROCESSING
,
&
present_parameters
,
&
device
)))
{
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D8_Release
(
d3d
);
IDirect3D8_Release
(
d3d
);
...
@@ -10547,6 +10585,37 @@ static void test_sysmem_draw(void)
...
@@ -10547,6 +10585,37 @@ static void test_sysmem_draw(void)
colour
=
getPixelColor
(
device
,
320
,
240
);
colour
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
colour
,
0x00007f7f
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
ok
(
color_match
(
colour
,
0x00007f7f
,
1
),
"Got unexpected colour 0x%08x.
\n
"
,
colour
);
hr
=
IDirect3DDevice8_CreateVertexBuffer
(
device
,
ARRAY_SIZE
(
quad
)
*
sizeof
(
*
dst_data
),
0
,
D3DFVF_XYZRHW
,
D3DPOOL_SYSTEMMEM
,
&
dst_vb
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SOFTWAREVERTEXPROCESSING
,
TRUE
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetStreamSource
(
device
,
0
,
vb
,
sizeof
(
*
quad
));
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_ProcessVertices
(
device
,
0
,
0
,
ARRAY_SIZE
(
quad
),
dst_vb
,
0
);
todo_wine
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer8_Lock
(
dst_vb
,
0
,
0
,
(
BYTE
**
)
&
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
,
4
),
"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
=
IDirect3DVertexBuffer8_Unlock
(
dst_vb
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SOFTWAREVERTEXPROCESSING
,
FALSE
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetStreamSource
(
device
,
0
,
vb
,
sizeof
(
*
quad
));
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_CreateIndexBuffer
(
device
,
sizeof
(
indices
),
0
,
hr
=
IDirect3DDevice8_CreateIndexBuffer
(
device
,
sizeof
(
indices
),
0
,
D3DFMT_INDEX16
,
D3DPOOL_SYSTEMMEM
,
&
ib
);
D3DFMT_INDEX16
,
D3DPOOL_SYSTEMMEM
,
&
ib
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
...
@@ -10633,6 +10702,7 @@ static void test_sysmem_draw(void)
...
@@ -10633,6 +10702,7 @@ static void test_sysmem_draw(void)
IDirect3DVertexBuffer8_Release
(
vb_s0
);
IDirect3DVertexBuffer8_Release
(
vb_s0
);
IDirect3DDevice8_DeleteVertexShader
(
device
,
vs
);
IDirect3DDevice8_DeleteVertexShader
(
device
,
vs
);
IDirect3DIndexBuffer8_Release
(
ib
);
IDirect3DIndexBuffer8_Release
(
ib
);
IDirect3DVertexBuffer8_Release
(
dst_vb
);
IDirect3DVertexBuffer8_Release
(
vb
);
IDirect3DVertexBuffer8_Release
(
vb
);
refcount
=
IDirect3DDevice8_Release
(
device
);
refcount
=
IDirect3DDevice8_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
...
...
include/d3d8.h
View file @
da50331b
...
@@ -1014,7 +1014,7 @@ DECLARE_INTERFACE_(IDirect3DDevice8,IUnknown)
...
@@ -1014,7 +1014,7 @@ DECLARE_INTERFACE_(IDirect3DDevice8,IUnknown)
#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e)
#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e)
#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d)
#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d)
#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h)
#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h)
#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->lpVtbl->
p
rocessVertices(p,a,b,c,d,e)
#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->lpVtbl->
P
rocessVertices(p,a,b,c,d,e)
#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->lpVtbl->CreateVertexShader(p,a,b,c,d)
#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->lpVtbl->CreateVertexShader(p,a,b,c,d)
#define IDirect3DDevice8_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a)
#define IDirect3DDevice8_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a)
#define IDirect3DDevice8_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a)
#define IDirect3DDevice8_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a)
...
...
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