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
92cb56a2
Commit
92cb56a2
authored
Apr 21, 2015
by
Matteo Bruni
Committed by
Alexandre Julliard
Apr 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add a lighting test with non-affine worldview matrix.
parent
6c6f92ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
53 deletions
+55
-53
visual.c
dlls/d3d9/tests/visual.c
+55
-53
No files found.
dlls/d3d9/tests/visual.c
View file @
92cb56a2
...
@@ -262,6 +262,7 @@ static void lighting_test(void)
...
@@ -262,6 +262,7 @@ static void lighting_test(void)
ULONG
refcount
;
ULONG
refcount
;
HWND
window
;
HWND
window
;
HRESULT
hr
;
HRESULT
hr
;
unsigned
int
i
;
static
const
D3DMATRIX
mat
=
static
const
D3DMATRIX
mat
=
{{{
{{{
...
@@ -275,7 +276,7 @@ static void lighting_test(void)
...
@@ -275,7 +276,7 @@ static void lighting_test(void)
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
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
.
5
f
,
1
.
0
f
,
}}},
}}},
mat_transf
=
mat_transf
=
{{{
{{{
...
@@ -283,6 +284,13 @@ static void lighting_test(void)
...
@@ -283,6 +284,13 @@ static void lighting_test(void)
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
10
.
f
,
10
.
0
f
,
10
.
0
f
,
1
.
0
f
,
10
.
f
,
10
.
0
f
,
10
.
0
f
,
1
.
0
f
,
}}},
mat_nonaffine
=
{{{
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
,
-
1
.
0
f
,
10
.
f
,
10
.
0
f
,
10
.
0
f
,
0
.
0
f
,
}}};
}}};
static
const
struct
static
const
struct
{
{
...
@@ -343,8 +351,35 @@ static void lighting_test(void)
...
@@ -343,8 +351,35 @@ static void lighting_test(void)
{{
-
10
.
0
f
,
-
9
.
0
f
,
11
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xff0000ff
},
{{
-
10
.
0
f
,
-
9
.
0
f
,
11
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xff0000ff
},
{{
-
10
.
0
f
,
-
9
.
0
f
,
9
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xff0000ff
},
{{
-
10
.
0
f
,
-
9
.
0
f
,
9
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xff0000ff
},
{{
-
10
.
0
f
,
-
11
.
0
f
,
9
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xff0000ff
},
{{
-
10
.
0
f
,
-
11
.
0
f
,
9
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xff0000ff
},
},
translatedquad
[]
=
{
{{
-
11
.
0
f
,
-
11
.
0
f
,
-
10
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
},
0xff0000ff
},
{{
-
11
.
0
f
,
-
9
.
0
f
,
-
10
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
},
0xff0000ff
},
{{
-
9
.
0
f
,
-
9
.
0
f
,
-
10
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
},
0xff0000ff
},
{{
-
9
.
0
f
,
-
11
.
0
f
,
-
10
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
},
0xff0000ff
},
};
};
static
const
WORD
indices
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
static
const
WORD
indices
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
static
const
struct
{
const
D3DMATRIX
*
world_matrix
;
const
void
*
quad
;
unsigned
int
size
;
DWORD
expected
;
const
char
*
message
;
BOOL
todo
;
}
tests
[]
=
{
{
&
mat
,
nquad
,
sizeof
(
nquad
[
0
]),
0x000000ff
,
"Lit quad with light"
,
FALSE
},
{
&
mat_singular
,
nquad
,
sizeof
(
nquad
[
0
]),
0x000000ff
,
"Lit quad with singular world matrix"
,
FALSE
},
{
&
mat_transf
,
rotatedquad
,
sizeof
(
rotatedquad
[
0
]),
0x000000ff
,
"Lit quad with transformation matrix"
,
FALSE
},
{
&
mat_nonaffine
,
translatedquad
,
sizeof
(
translatedquad
[
0
]),
0x00000000
,
"Lit quad with non-affine matrix"
,
TRUE
},
};
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
...
@@ -424,66 +459,33 @@ static void lighting_test(void)
...
@@ -424,66 +459,33 @@ static void lighting_test(void)
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_LIGHTING
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to enable lighting, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_LightEnable
(
device
,
0
,
TRUE
);
hr
=
IDirect3DDevice9_LightEnable
(
device
,
0
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to enable light 0, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to enable light 0, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x.
\n
"
,
hr
);
{
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLD
,
tests
[
i
].
world_matrix
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set world transform, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
2
,
indices
,
D3DFMT_INDEX16
,
nquad
,
sizeof
(
nquad
[
0
]));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color
==
0x000000ff
,
"Lit quad with light has color 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLD
,
&
mat_singular
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set world transform, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
2
,
indices
,
D3DFMT_INDEX16
,
nquad
,
sizeof
(
nquad
[
0
]));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
160
,
240
);
ok
(
color
==
0x00ffffff
,
"Cleared area has color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
480
,
240
);
ok
(
color
==
0x000000ff
,
"Lit quad with singular world matrix has color 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLD
,
&
mat_transf
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set world transform, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
2
,
indices
,
D3DFMT_INDEX16
,
rotatedquad
,
sizeof
(
rotatedquad
[
0
])
);
2
,
indices
,
D3DFMT_INDEX16
,
tests
[
i
].
quad
,
tests
[
i
].
size
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
320
,
240
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color
==
0x000000ff
,
"Lit quad with transformation matrix has color 0x%08x.
\n
"
,
color
);
if
(
tests
[
i
].
todo
)
todo_wine
ok
(
color
==
tests
[
i
].
expected
,
"%s has color 0x%08x.
\n
"
,
tests
[
i
].
message
,
color
);
else
ok
(
color
==
tests
[
i
].
expected
,
"%s has color 0x%08x.
\n
"
,
tests
[
i
].
message
,
color
);
}
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLD
,
&
mat
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLD
,
&
mat
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set world transform, hr %#x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set world transform, hr %#x.
\n
"
,
hr
);
...
...
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