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
022db680
Commit
022db680
authored
May 23, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
May 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8/tests: Fix the depth clamping test.
parent
f147c1e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
49 deletions
+75
-49
visual.c
dlls/d3d8/tests/visual.c
+75
-49
No files found.
dlls/d3d8/tests/visual.c
View file @
022db680
...
...
@@ -140,9 +140,10 @@ static IDirect3DDevice8 *init_d3d8(void)
present_parameters
.
BackBufferHeight
=
480
;
present_parameters
.
BackBufferFormat
=
D3DFMT_A8R8G8B8
;
present_parameters
.
EnableAutoDepthStencil
=
TRUE
;
present_parameters
.
AutoDepthStencilFormat
=
D3DFMT_D
16
;
present_parameters
.
AutoDepthStencilFormat
=
D3DFMT_D
24S8
;
hr
=
IDirect3D8_CreateDevice
(
d3d8_ptr
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
present_parameters
.
hDeviceWindow
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device_ptr
);
hr
=
IDirect3D8_CreateDevice
(
d3d8_ptr
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
present_parameters
.
hDeviceWindow
,
D3DCREATE_HARDWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device_ptr
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_INVALIDCALL
||
broken
(
hr
==
D3DERR_NOTAVAILABLE
),
"IDirect3D_CreateDevice returned: %#08x
\n
"
,
hr
);
return
device_ptr
;
...
...
@@ -1292,59 +1293,63 @@ static void texop_test(IDirect3DDevice8 *device)
}
/* This test tests depth clamping / clipping behaviour:
* - When D3DRS_CLIPPING is disabled depth values are *clamped* to the
* minimum/maximum z value.
* - With software vertex processing, depth values are clamped to the
* minimum / maximum z value when D3DRS_CLIPPING is disabled, and clipped
* when D3DRS_CLIPPING is enabled. Pretransformed vertices behave the
* same as regular vertices here.
* - With hardware vertex processing, D3DRS_CLIPPING seems to be ignored.
* Normal vertices are always clipped. Pretransformed vertices are
* clipped when D3DPMISCCAPS_CLIPTLVERTS is set, clamped when it isn't.
* - The viewport's MinZ/MaxZ is irrelevant for this.
* - When D3DRS_CLIPPING is enabled depth values are clipped.
* - Pretransformed vertices behave the same as regular vertices.
*/
static
void
depth_clamp_test
(
IDirect3DDevice8
*
device
)
{
const
struct
tvertex
quad1
[]
=
{
{
0
,
0
,
5
.
0
f
,
1
.
0
,
0xff002b7f
},
{
640
,
0
,
5
.
0
f
,
1
.
0
,
0xff002b7f
},
{
0
,
480
,
5
.
0
f
,
1
.
0
,
0xff002b7f
},
{
640
,
480
,
5
.
0
f
,
1
.
0
,
0xff002b7f
},
{
0
.
0
f
,
0
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xff002b7f
},
{
640
.
0
f
,
0
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xff002b7f
},
{
0
.
0
f
,
480
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xff002b7f
},
{
640
.
0
f
,
480
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xff002b7f
},
};
const
struct
tvertex
quad2
[]
=
{
{
0
,
300
,
10
.
0
f
,
1
.
0
,
0xfff9e814
},
{
640
,
300
,
10
.
0
f
,
1
.
0
,
0xfff9e814
},
{
0
,
360
,
10
.
0
f
,
1
.
0
,
0xfff9e814
},
{
640
,
360
,
10
.
0
f
,
1
.
0
,
0xfff9e814
},
{
0
.
0
f
,
300
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xfff9e814
},
{
640
.
0
f
,
300
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xfff9e814
},
{
0
.
0
f
,
360
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xfff9e814
},
{
640
.
0
f
,
360
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xfff9e814
},
};
const
struct
vertex
quad3
[]
=
const
struct
t
vertex
quad3
[]
=
{
{
-
0
.
65
f
,
0
.
55
f
,
5
.
0
f
,
0xffffffff
},
{
-
0
.
35
f
,
0
.
55
f
,
5
.
0
f
,
0xffffffff
},
{
-
0
.
65
f
,
0
.
15
f
,
5
.
0
f
,
0xffffffff
},
{
-
0
.
35
f
,
0
.
15
f
,
5
.
0
f
,
0xffffffff
},
{
112
.
0
f
,
108
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xffffffff
},
{
208
.
0
f
,
108
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xffffffff
},
{
112
.
0
f
,
204
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xffffffff
},
{
208
.
0
f
,
204
.
0
f
,
5
.
0
f
,
1
.
0
f
,
0xffffffff
},
};
const
struct
vertex
quad4
[]
=
const
struct
t
vertex
quad4
[]
=
{
{
-
0
.
87
f
,
0
.
83
f
,
10
.
0
f
,
0xffffffff
},
{
-
0
.
65
f
,
0
.
83
f
,
10
.
0
f
,
0xffffffff
},
{
-
0
.
87
f
,
0
.
55
f
,
10
.
0
f
,
0xffffffff
},
{
-
0
.
65
f
,
0
.
55
f
,
10
.
0
f
,
0xffffffff
},
{
42
.
0
f
,
41
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xffffffff
},
{
112
.
0
f
,
41
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xffffffff
},
{
42
.
0
f
,
108
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xffffffff
},
{
112
.
0
f
,
108
.
0
f
,
10
.
0
f
,
1
.
0
f
,
0xffffffff
},
};
const
struct
vertex
quad5
[]
=
{
{
-
0
.
5
,
0
.
5
,
10
.
0
f
,
0xff14f914
},
{
0
.
5
,
0
.
5
,
10
.
0
f
,
0xff14f914
},
{
-
0
.
5
,
-
0
.
5
,
10
.
0
f
,
0xff14f914
},
{
0
.
5
,
-
0
.
5
,
10
.
0
f
,
0xff14f914
},
{
-
0
.
5
f
,
0
.
5
f
,
10
.
0
f
,
0xff14f914
},
{
0
.
5
f
,
0
.
5
f
,
10
.
0
f
,
0xff14f914
},
{
-
0
.
5
f
,
-
0
.
5
f
,
10
.
0
f
,
0xff14f914
},
{
0
.
5
f
,
-
0
.
5
f
,
10
.
0
f
,
0xff14f914
},
};
const
struct
t
vertex
quad6
[]
=
const
struct
vertex
quad6
[]
=
{
{
0
,
120
,
10
.
0
f
,
1
.
0
,
0xfff91414
},
{
640
,
120
,
10
.
0
f
,
1
.
0
,
0xfff91414
},
{
0
,
180
,
10
.
0
f
,
1
.
0
,
0xfff91414
},
{
640
,
180
,
10
.
0
f
,
1
.
0
,
0xfff91414
},
{
-
1
.
0
f
,
0
.
5
f
,
10
.
0
f
,
0xfff91414
},
{
1
.
0
f
,
0
.
5
f
,
10
.
0
f
,
0xfff91414
},
{
-
1
.
0
f
,
0
.
25
f
,
10
.
0
f
,
0xfff91414
},
{
1
.
0
f
,
0
.
25
f
,
10
.
0
f
,
0xfff91414
},
};
D3DVIEWPORT8
vp
;
D3DCOLOR
color
;
D3DCAPS8
caps
;
HRESULT
hr
;
vp
.
X
=
0
;
...
...
@@ -1354,10 +1359,13 @@ static void depth_clamp_test(IDirect3DDevice8 *device)
vp
.
MinZ
=
0
.
0
;
vp
.
MaxZ
=
7
.
5
;
hr
=
IDirect3DDevice8_GetDeviceCaps
(
device
,
&
caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get device caps, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetViewport
(
device
,
&
vp
);
ok
(
SUCCEEDED
(
hr
),
"SetViewport failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xff
ffffff
,
1
.
0
,
0
);
hr
=
IDirect3DDevice8_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xff
00ff00
,
1
.
0
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Clear failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_CLIPPING
,
FALSE
);
...
...
@@ -1380,22 +1388,24 @@ static void depth_clamp_test(IDirect3DDevice8 *device)
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad2
,
sizeof
(
*
quad2
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Set
VertexShader
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUS
E
);
ok
(
SUCCEEDED
(
hr
),
"Set
VertexShader
failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Set
RenderState
(
device
,
D3DRS_CLIPPING
,
TRU
E
);
ok
(
SUCCEEDED
(
hr
),
"Set
RenderState
failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad3
,
sizeof
(
*
quad3
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad4
,
sizeof
(
*
quad4
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_CLIPPING
,
TRU
E
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_CLIPPING
,
FALS
E
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexShader failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad5
,
sizeof
(
*
quad5
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Set
VertexShader
(
device
,
D3DFVF_XYZRHW
|
D3DFVF_DIFFUS
E
);
ok
(
SUCCEEDED
(
hr
),
"Set
VertexShader
failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Set
RenderState
(
device
,
D3DRS_CLIPPING
,
TRU
E
);
ok
(
SUCCEEDED
(
hr
),
"Set
RenderState
failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad6
,
sizeof
(
*
quad6
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed, hr %#x.
\n
"
,
hr
);
...
...
@@ -1403,16 +1413,32 @@ static void depth_clamp_test(IDirect3DDevice8 *device)
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"EndScene failed, hr %#x.
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
75
,
75
);
ok
(
color_match
(
color
,
0x00ffffff
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
150
,
150
);
ok
(
color_match
(
color
,
0x00ffffff
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00002b7f
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
330
);
ok
(
color_match
(
color
,
0x00f9e814
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
330
);
ok
(
color_match
(
color
,
0x00f9e814
,
1
),
"color 0x%08x.
\n
"
,
color
);
if
(
caps
.
PrimitiveMiscCaps
&
D3DPMISCCAPS_CLIPTLVERTS
)
{
color
=
getPixelColor
(
device
,
75
,
75
);
todo_wine
ok
(
color_match
(
color
,
0x0000ff00
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
150
,
150
);
todo_wine
ok
(
color_match
(
color
,
0x0000ff00
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
240
);
todo_wine
ok
(
color_match
(
color
,
0x0000ff00
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
330
);
todo_wine
ok
(
color_match
(
color
,
0x0000ff00
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
330
);
todo_wine
ok
(
color_match
(
color
,
0x0000ff00
,
1
),
"color 0x%08x.
\n
"
,
color
);
}
else
{
color
=
getPixelColor
(
device
,
75
,
75
);
ok
(
color_match
(
color
,
0x00ffffff
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
150
,
150
);
ok
(
color_match
(
color
,
0x00ffffff
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00002b7f
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
330
);
ok
(
color_match
(
color
,
0x00f9e814
,
1
),
"color 0x%08x.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
330
);
ok
(
color_match
(
color
,
0x00f9e814
,
1
),
"color 0x%08x.
\n
"
,
color
);
}
hr
=
IDirect3DDevice8_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\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