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
861ade43
Commit
861ade43
authored
Feb 12, 2015
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Test rhw table fog z vs rhw.
parent
77eb58b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
0 deletions
+118
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+118
-0
No files found.
dlls/ddraw/tests/ddraw7.c
View file @
861ade43
...
...
@@ -8180,6 +8180,123 @@ static void test_negative_fixedfunction_fog(void)
DestroyWindow
(
window
);
}
static
void
test_table_fog_zw
(
void
)
{
HRESULT
hr
;
IDirect3DDevice7
*
device
;
IDirectDrawSurface7
*
rt
;
ULONG
refcount
;
HWND
window
;
D3DCOLOR
color
;
static
struct
{
struct
vec4
position
;
D3DCOLOR
diffuse
;
}
quad
[]
=
{
{{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xffff0000
},
{{
640
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xffff0000
},
{{
0
.
0
f
,
480
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xffff0000
},
{{
640
.
0
f
,
480
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0xffff0000
},
};
static
D3DMATRIX
identity
=
{
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
};
D3DDEVICEDESC7
caps
;
static
const
struct
{
float
z
,
w
;
D3DZBUFFERTYPE
z_test
;
D3DCOLOR
color
;
}
tests
[]
=
{
{
0
.
7
f
,
0
.
0
f
,
D3DZB_TRUE
,
0x004cb200
},
{
0
.
7
f
,
0
.
0
f
,
D3DZB_FALSE
,
0x004cb200
},
{
0
.
7
f
,
0
.
3
f
,
D3DZB_TRUE
,
0x004cb200
},
{
0
.
7
f
,
0
.
3
f
,
D3DZB_FALSE
,
0x004cb200
},
{
0
.
7
f
,
3
.
0
f
,
D3DZB_TRUE
,
0x004cb200
},
{
0
.
7
f
,
3
.
0
f
,
D3DZB_FALSE
,
0x004cb200
},
{
0
.
3
f
,
0
.
0
f
,
D3DZB_TRUE
,
0x00b24c00
},
{
0
.
3
f
,
0
.
0
f
,
D3DZB_FALSE
,
0x00b24c00
},
};
unsigned
int
i
;
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice7_GetCaps
(
device
,
&
caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get device caps, hr %#x.
\n
"
,
hr
);
if
(
!
(
caps
.
dpcTriCaps
.
dwRasterCaps
&
D3DPRASTERCAPS_FOGTABLE
))
{
skip
(
"D3DPRASTERCAPS_FOGTABLE not supported, skipping POSITIONT table fog test.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice7_GetRenderTarget
(
device
,
&
rt
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_LIGHTING
,
FALSE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_FOGENABLE
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_FOGCOLOR
,
0x0000ff00
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_CLIPPING
,
FALSE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
/* Work around an AMD Windows driver bug. Needs a proj matrix applied redundantly. */
hr
=
IDirect3DDevice7_SetTransform
(
device
,
D3DTRANSFORMSTATE_PROJECTION
,
&
identity
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set projection transform, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_FOGTABLEMODE
,
D3DFOG_LINEAR
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
++
i
)
{
hr
=
IDirect3DDevice7_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0x000000ff
,
1
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x.
\n
"
,
hr
);
quad
[
0
].
position
.
z
=
tests
[
i
].
z
;
quad
[
1
].
position
.
z
=
tests
[
i
].
z
;
quad
[
2
].
position
.
z
=
tests
[
i
].
z
;
quad
[
3
].
position
.
z
=
tests
[
i
].
z
;
quad
[
0
].
position
.
w
=
tests
[
i
].
w
;
quad
[
1
].
position
.
w
=
tests
[
i
].
w
;
quad
[
2
].
position
.
w
=
tests
[
i
].
w
;
quad
[
3
].
position
.
w
=
tests
[
i
].
w
;
hr
=
IDirect3DDevice7_SetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
tests
[
i
].
z_test
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DFVF_XYZRHW
|
D3DFVF_DIFFUSE
,
quad
,
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
0
,
240
);
ok
(
compare_color
(
color
,
tests
[
i
].
color
,
2
),
"Got unexpected color 0x%08x, expected 0x%8x, case %u.
\n
"
,
color
,
tests
[
i
].
color
,
i
);
}
IDirectDrawSurface7_Release
(
rt
);
done:
refcount
=
IDirect3DDevice7_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -8268,4 +8385,5 @@ START_TEST(ddraw7)
test_surface_desc_lock
();
test_fog_interpolation
();
test_negative_fixedfunction_fog
();
test_table_fog_zw
();
}
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