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
6ecdad06
Commit
6ecdad06
authored
Apr 11, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 12, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add some depth buffer tests.
parent
d4303865
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
130 additions
and
0 deletions
+130
-0
visual.c
dlls/d3d9/tests/visual.c
+130
-0
No files found.
dlls/d3d9/tests/visual.c
View file @
6ecdad06
...
...
@@ -10853,6 +10853,135 @@ static void depth_clamp_test(IDirect3DDevice9 *device)
ok
(
SUCCEEDED
(
hr
),
"SetViewport failed, hr %#x.
\n
"
,
hr
);
}
static
void
depth_buffer_test
(
IDirect3DDevice9
*
device
)
{
static
const
struct
vertex
quad1
[]
=
{
{
-
1
.
0
,
1
.
0
,
0
.
33
f
,
0xff00ff00
},
{
1
.
0
,
1
.
0
,
0
.
33
f
,
0xff00ff00
},
{
-
1
.
0
,
-
1
.
0
,
0
.
33
f
,
0xff00ff00
},
{
1
.
0
,
-
1
.
0
,
0
.
33
f
,
0xff00ff00
},
};
static
const
struct
vertex
quad2
[]
=
{
{
-
1
.
0
,
1
.
0
,
0
.
50
f
,
0xffff00ff
},
{
1
.
0
,
1
.
0
,
0
.
50
f
,
0xffff00ff
},
{
-
1
.
0
,
-
1
.
0
,
0
.
50
f
,
0xffff00ff
},
{
1
.
0
,
-
1
.
0
,
0
.
50
f
,
0xffff00ff
},
};
static
const
struct
vertex
quad3
[]
=
{
{
-
1
.
0
,
1
.
0
,
0
.
66
f
,
0xffff0000
},
{
1
.
0
,
1
.
0
,
0
.
66
f
,
0xffff0000
},
{
-
1
.
0
,
-
1
.
0
,
0
.
66
f
,
0xffff0000
},
{
1
.
0
,
-
1
.
0
,
0
.
66
f
,
0xffff0000
},
};
static
const
DWORD
expected_colors
[
4
][
4
]
=
{
{
0x000000ff
,
0x000000ff
,
0x0000ff00
,
0x00ff0000
},
{
0x000000ff
,
0x000000ff
,
0x0000ff00
,
0x00ff0000
},
{
0x0000ff00
,
0x0000ff00
,
0x0000ff00
,
0x00ff0000
},
{
0x00ff0000
,
0x00ff0000
,
0x00ff0000
,
0x00ff0000
},
};
IDirect3DSurface9
*
backbuffer
,
*
rt1
,
*
rt2
,
*
rt3
;
unsigned
int
i
,
j
;
D3DVIEWPORT9
vp
;
D3DCOLOR
color
;
HRESULT
hr
;
vp
.
X
=
0
;
vp
.
Y
=
0
;
vp
.
Width
=
640
;
vp
.
Height
=
480
;
vp
.
MinZ
=
0
.
0
;
vp
.
MaxZ
=
1
.
0
;
hr
=
IDirect3DDevice9_SetViewport
(
device
,
&
vp
);
ok
(
SUCCEEDED
(
hr
),
"SetViewport failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_LIGHTING
,
FALSE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZENABLE
,
D3DZB_TRUE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZWRITEENABLE
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZFUNC
,
D3DCMP_LESSEQUAL
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
SUCCEEDED
(
hr
),
"SetFVF failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetRenderTarget
(
device
,
0
,
&
backbuffer
);
ok
(
SUCCEEDED
(
hr
),
"GetRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateRenderTarget
(
device
,
320
,
240
,
D3DFMT_A8R8G8B8
,
D3DMULTISAMPLE_NONE
,
0
,
FALSE
,
&
rt1
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"CreateRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateRenderTarget
(
device
,
480
,
360
,
D3DFMT_A8R8G8B8
,
D3DMULTISAMPLE_NONE
,
0
,
FALSE
,
&
rt2
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"CreateRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateRenderTarget
(
device
,
640
,
480
,
D3DFMT_A8R8G8B8
,
D3DMULTISAMPLE_NONE
,
0
,
FALSE
,
&
rt3
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"CreateRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
rt3
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xff0000ff
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Clear failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
backbuffer
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xff0000ff
,
1
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Clear failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
rt1
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xffffffff
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Clear failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
rt2
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderTarget failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginScene failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad2
,
sizeof
(
*
quad2
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"EndScene failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
backbuffer
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderTarget failed, hr %#x.
\n
"
,
hr
);
IDirect3DSurface9_Release
(
backbuffer
);
IDirect3DSurface9_Release
(
rt3
);
IDirect3DSurface9_Release
(
rt2
);
IDirect3DSurface9_Release
(
rt1
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZWRITEENABLE
,
FALSE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginScene failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad1
,
sizeof
(
*
quad1
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad3
,
sizeof
(
*
quad3
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"EndScene failed, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
4
;
++
i
)
{
for
(
j
=
0
;
j
<
4
;
++
j
)
{
unsigned
int
x
=
80
*
((
2
*
j
)
+
1
);
unsigned
int
y
=
60
*
((
2
*
i
)
+
1
);
color
=
getPixelColor
(
device
,
x
,
y
);
ok
(
color_match
(
color
,
expected_colors
[
i
][
j
],
0
),
"Expected color 0x%08x at %u,%u, got 0x%08x.
\n
"
,
expected_colors
[
i
][
j
],
x
,
y
,
color
);
}
}
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
}
START_TEST
(
visual
)
{
IDirect3DDevice9
*
device_ptr
;
...
...
@@ -11021,6 +11150,7 @@ START_TEST(visual)
texop_range_test
(
device_ptr
);
alphareplicate_test
(
device_ptr
);
dp3_alpha_test
(
device_ptr
);
depth_buffer_test
(
device_ptr
);
cleanup
:
if
(
device_ptr
)
{
...
...
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