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
a8f37083
Commit
a8f37083
authored
Apr 11, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Use a separate device for lighting_test().
parent
32919f40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
63 deletions
+62
-63
visual.c
dlls/d3d9/tests/visual.c
+62
-63
No files found.
dlls/d3d9/tests/visual.c
View file @
a8f37083
...
...
@@ -266,50 +266,71 @@ struct nvertex
DWORD
diffuse
;
};
static
void
lighting_test
(
IDirect3DDevice9
*
device
)
static
void
lighting_test
(
void
)
{
HRESULT
hr
;
DWORD
fvf
=
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
;
DWORD
nfvf
=
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
|
D3DFVF_NORMAL
;
DWORD
color
;
D3DMATERIAL9
material
,
old_material
;
DWORD
cop
,
carg
;
DWORD
old_colorwrite
;
float
mat
[
16
]
=
{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
};
DWORD
fvf
=
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
;
IDirect3DDevice9
*
device
;
D3DMATERIAL9
material
;
IDirect3D9
*
d3d
;
D3DCOLOR
color
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
st
ruct
vertex
unlitquad
[
]
=
st
atic
const
float
mat
[
16
]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
0
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
};
static
const
struct
vertex
unlitquad
[]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
0
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
};
static
const
struct
vertex
litquad
[]
=
{
{
-
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xff00ff00
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0xff00ff00
},
{
0
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0xff00ff00
},
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xff00ff00
},
};
st
ruct
vertex
litquad
[]
=
st
atic
const
struct
vertex
lighting_test
[]
=
{
{
-
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xff
00ff00
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0xff00ff
00
},
{
0
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0xff
00ff00
},
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
0xff00ff
00
},
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0x80
00ff00
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0x800000
00
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0x80
00ff00
},
{
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0x800000
00
},
};
struct
nvertex
unlitnquad
[]
=
st
atic
const
st
ruct
nvertex
unlitnquad
[]
=
{
{
0
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
{
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
{
0
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
{
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xff0000ff
},
};
struct
nvertex
litnquad
[]
=
st
atic
const
st
ruct
nvertex
litnquad
[]
=
{
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
{
0
.
0
f
,
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
{
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
{
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
{
0
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
{
0
.
0
f
,
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
{
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
{
1
.
0
f
,
0
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0xffffff00
},
};
WORD
Indices
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
static
const
WORD
Indices
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
d3d
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d
,
window
,
window
,
TRUE
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %08x
\n
"
,
hr
);
...
...
@@ -337,8 +358,6 @@ static void lighting_test(IDirect3DDevice9 *device)
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_CULLMODE
,
D3DCULL_NONE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState failed with %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetRenderState
(
device
,
D3DRS_COLORWRITEENABLE
,
&
old_colorwrite
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetRenderState failed with %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_COLORWRITEENABLE
,
D3DCOLORWRITEENABLE_RED
|
D3DCOLORWRITEENABLE_GREEN
|
D3DCOLORWRITEENABLE_BLUE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState failed with %08x
\n
"
,
hr
);
...
...
@@ -395,8 +414,6 @@ static void lighting_test(IDirect3DDevice9 *device)
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirect3DDevice9_GetMaterial
(
device
,
&
old_material
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetMaterial returned %08x
\n
"
,
hr
);
memset
(
&
material
,
0
,
sizeof
(
material
));
material
.
Diffuse
.
r
=
0
.
0
;
material
.
Diffuse
.
g
=
0
.
0
;
...
...
@@ -423,10 +440,6 @@ static void lighting_test(IDirect3DDevice9 *device)
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_SPECULARMATERIALSOURCE
,
D3DMCS_MATERIAL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
&
cop
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetTextureStageState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
&
carg
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetTextureStageState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_SELECTARG1
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTextureStageState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_DIFFUSE
|
D3DTA_ALPHAREPLICATE
);
...
...
@@ -434,13 +447,8 @@ static void lighting_test(IDirect3DDevice9 *device)
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_BeginScene returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
struct
vertex
lighting_test
[]
=
{
{
-
1
.
0
,
-
1
.
0
,
0
.
1
,
0x8000ff00
},
{
1
.
0
,
-
1
.
0
,
0
.
1
,
0x80000000
},
{
-
1
.
0
,
1
.
0
,
0
.
1
,
0x8000ff00
},
{
1
.
0
,
1
.
0
,
0
.
1
,
0x80000000
}
};
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetFVF failed, hr=%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
lighting_test
,
sizeof
(
lighting_test
[
0
]));
...
...
@@ -454,20 +462,11 @@ static void lighting_test(IDirect3DDevice9 *device)
ok
(
color
==
0x00ffffff
,
"Lit vertex alpha test returned color %08x, expected 0x00ffffff
\n
"
,
color
);
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
cop
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTextureStageState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_DIFFUSEMATERIALSOURCE
,
D3DMCS_COLOR1
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_SPECULARMATERIALSOURCE
,
D3DMCS_COLOR2
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_LIGHTING
,
FALSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_COLORWRITEENABLE
,
old_colorwrite
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState failed with %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
carg
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTextureStageState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetMaterial
(
device
,
&
old_material
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetMaterial returned %08x
\n
"
,
hr
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
done:
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
}
static
void
clear_test
(
void
)
...
...
@@ -16766,11 +16765,11 @@ START_TEST(visual)
/* Now execute the real tests */
depth_clamp_test
(
device_ptr
);
stretchrect_test
(
device_ptr
);
lighting_test
(
device_ptr
);
cleanup_device
(
device_ptr
);
device_ptr
=
NULL
;
lighting_test
();
clear_test
();
color_fill_test
();
fog_test
();
...
...
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