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
afd1fe43
Commit
afd1fe43
authored
Jul 22, 2011
by
Matteo Bruni
Committed by
Alexandre Julliard
Jul 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add a couple of fog tests.
parent
0c348116
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
140 additions
and
6 deletions
+140
-6
visual.c
dlls/d3d9/tests/visual.c
+140
-6
No files found.
dlls/d3d9/tests/visual.c
View file @
afd1fe43
...
...
@@ -928,6 +928,50 @@ static void fog_test(IDirect3DDevice9 *device)
};
WORD
Indices
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
const
float
ident_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
};
const
float
world_mat1
[
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
.
5
f
,
1
.
0
f
};
const
float
world_mat2
[
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
,
1
.
0
f
,
1
.
0
f
};
const
float
proj_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
,
-
1
.
0
f
,
1
.
0
f
};
const
struct
sVertex
far_quad1
[]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
5
f
,
0xffff0000
,
0xff000000
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
5
f
,
0xffff0000
,
0xff000000
},
{
0
.
0
f
,
0
.
0
f
,
0
.
5
f
,
0xffff0000
,
0xff000000
},
{
0
.
0
f
,
-
1
.
0
f
,
0
.
5
f
,
0xffff0000
,
0xff000000
},
};
const
struct
sVertex
far_quad2
[]
=
{
{
-
1
.
0
f
,
0
.
0
f
,
1
.
5
f
,
0xffff0000
,
0xff000000
},
{
-
1
.
0
f
,
1
.
0
f
,
1
.
5
f
,
0xffff0000
,
0xff000000
},
{
0
.
0
f
,
1
.
0
f
,
1
.
5
f
,
0xffff0000
,
0xff000000
},
{
0
.
0
f
,
0
.
0
f
,
1
.
5
f
,
0xffff0000
,
0xff000000
},
};
memset
(
&
caps
,
0
,
sizeof
(
caps
));
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetDeviceCaps returned %08x
\n
"
,
hr
);
...
...
@@ -1144,15 +1188,105 @@ static void fog_test(IDirect3DDevice9 *device)
break
;
}
}
if
(
caps
.
RasterCaps
&
D3DPRASTERCAPS_FOGTABLE
)
{
/* A simple fog + non-identity world matrix test */
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
0
),
(
const
D3DMATRIX
*
)
world_mat1
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTransform returned %#08x
\n
"
,
hr
);
start
=
0
.
0
;
end
=
1
.
0
;
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGSTART
,
*
((
DWORD
*
)
&
start
));
ok
(
hr
==
D3D_OK
,
"Setting fog start returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGEND
,
*
((
DWORD
*
)
&
end
));
ok
(
hr
==
D3D_OK
,
"Setting fog end returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGTABLEMODE
,
D3DFOG_LINEAR
);
ok
(
hr
==
D3D_OK
,
"Setting fog table mode to D3DFOG_LINEAR returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGVERTEXMODE
,
D3DFOG_NONE
);
ok
(
hr
==
D3D_OK
,
"Turning off vertex fog returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffff00ff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear returned %#08x
\n
"
,
hr
);
if
(
IDirect3DDevice9_BeginScene
(
device
)
==
D3D_OK
)
{
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
|
D3DFVF_SPECULAR
);
ok
(
hr
==
D3D_OK
,
"SetVertexShader returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
2
,
Indices
,
D3DFMT_INDEX16
,
far_quad1
,
sizeof
(
far_quad1
[
0
]));
ok
(
hr
==
D3D_OK
,
"DrawIndexedPrimitiveUP returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
2
,
Indices
,
D3DFMT_INDEX16
,
far_quad2
,
sizeof
(
far_quad2
[
0
]));
ok
(
hr
==
D3D_OK
,
"DrawIndexedPrimitiveUP returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
hr
==
D3D_OK
,
"EndScene returned %#08x
\n
"
,
hr
);
}
else
{
ok
(
FALSE
,
"BeginScene failed
\n
"
);
}
color
=
getPixelColor
(
device
,
160
,
360
);
ok
(
color_match
(
color
,
0x00ff0000
,
4
),
"Unfogged quad has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
160
,
120
);
ok
(
color
==
0x0000ff00
,
"Fogged out quad has color %08x
\n
"
,
color
);
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
/* Test fog behavior with an orthogonal (but non-identity) projection matrix */
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
0
),
(
const
D3DMATRIX
*
)
world_mat2
);
ok
(
hr
==
D3D_OK
,
"SetTransform returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_PROJECTION
,
(
const
D3DMATRIX
*
)
proj_mat
);
ok
(
hr
==
D3D_OK
,
"SetTransform returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffff00ff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"Clear returned %#08x
\n
"
,
hr
);
if
(
IDirect3DDevice9_BeginScene
(
device
)
==
D3D_OK
)
{
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
|
D3DFVF_SPECULAR
);
ok
(
hr
==
D3D_OK
,
"SetVertexShader returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
2
,
Indices
,
D3DFMT_INDEX16
,
untransformed_1
,
sizeof
(
untransformed_1
[
0
]));
ok
(
hr
==
D3D_OK
,
"DrawIndexedPrimitiveUP returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitiveUP
(
device
,
D3DPT_TRIANGLELIST
,
0
,
4
,
2
,
Indices
,
D3DFMT_INDEX16
,
untransformed_2
,
sizeof
(
untransformed_2
[
0
]));
ok
(
hr
==
D3D_OK
,
"DrawIndexedPrimitiveUP returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
hr
==
D3D_OK
,
"EndScene returned %#08x
\n
"
,
hr
);
}
else
{
ok
(
FALSE
,
"BeginScene failed
\n
"
);
}
color
=
getPixelColor
(
device
,
160
,
360
);
todo_wine
ok
(
color_match
(
color
,
0x00e51900
,
4
),
"Partially fogged quad has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
160
,
120
);
ok
(
color
==
0x0000ff00
,
"Fogged out quad has color %08x
\n
"
,
color
);
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
0
),
(
const
D3DMATRIX
*
)
ident_mat
);
ok
(
hr
==
D3D_OK
,
"SetTransform returned %#08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_PROJECTION
,
(
const
D3DMATRIX
*
)
ident_mat
);
ok
(
hr
==
D3D_OK
,
"SetTransform returned %#08x
\n
"
,
hr
);
}
else
{
skip
(
"D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests
\n
"
);
}
/* Turn off the fog master switch to avoid confusing other tests */
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGENABLE
,
FALSE
);
ok
(
hr
==
D3D_OK
,
"Turning off fog calculations returned %08x
\n
"
,
hr
);
start
=
0
.
0
;
end
=
1
.
0
;
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGSTART
,
*
((
DWORD
*
)
&
start
));
ok
(
hr
==
D3D_OK
,
"Setting fog start returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGEND
,
*
((
DWORD
*
)
&
end
));
ok
(
hr
==
D3D_OK
,
"Setting fog end returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGVERTEXMODE
,
D3DFOG_LINEAR
);
ok
(
hr
==
D3D_OK
,
"Setting fog vertex mode to D3DFOG_LINEAR returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_FOGTABLEMODE
,
D3DFOG_LINEAR
);
...
...
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