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
c04f8ce0
Commit
c04f8ce0
authored
Feb 01, 2011
by
Matteo Bruni
Committed by
Alexandre Julliard
Feb 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add a test for clip planes.
parent
75386a99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
0 deletions
+133
-0
visual.c
dlls/d3d9/tests/visual.c
+133
-0
No files found.
dlls/d3d9/tests/visual.c
View file @
c04f8ce0
...
...
@@ -11207,6 +11207,138 @@ static void shadow_test(IDirect3DDevice9 *device)
IDirect3D9_Release
(
d3d9
);
}
static
void
clip_planes
(
IDirect3DDevice9
*
device
,
const
char
*
test_name
)
{
const
struct
vertex
quad1
[]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0xfff9e814
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0xfff9e814
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0xfff9e814
},
{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0xfff9e814
},
};
const
struct
vertex
quad2
[]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0xff002b7f
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0xff002b7f
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0xff002b7f
},
{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0xff002b7f
},
};
D3DCOLOR
color
;
HRESULT
hr
;
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
1
.
0
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Clear failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginScene failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
SUCCEEDED
(
hr
),
"SetFVF failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_CLIPPLANEENABLE
,
0
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState 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_SetRenderState
(
device
,
D3DRS_CLIPPLANEENABLE
,
0x1
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState 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
);
color
=
getPixelColor
(
device
,
1
,
240
);
ok
(
color_match
(
color
,
0x00002b7f
,
1
),
"%s test: color 0x%08x.
\n
"
,
test_name
,
color
);
color
=
getPixelColor
(
device
,
638
,
240
);
ok
(
color_match
(
color
,
0x00002b7f
,
1
),
"%s test: color 0x%08x.
\n
"
,
test_name
,
color
);
color
=
getPixelColor
(
device
,
1
,
241
);
ok
(
color_match
(
color
,
0x00f9e814
,
1
),
"%s test: color 0x%08x.
\n
"
,
test_name
,
color
);
color
=
getPixelColor
(
device
,
638
,
241
);
ok
(
color_match
(
color
,
0x00f9e814
,
1
),
"%s test: color 0x%08x.
\n
"
,
test_name
,
color
);
}
static
void
clip_planes_test
(
IDirect3DDevice9
*
device
)
{
const
float
plane0
[
4
]
=
{
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
5
f
/
480
.
0
f
};
/* a quarter-pixel offset */
const
DWORD
shader_code
[]
=
{
0xfffe0200
,
/* vs_2_0 */
0x0200001f
,
0x80000000
,
0x900f0000
,
/* dcl_position v0 */
0x0200001f
,
0x8000000a
,
0x900f0001
,
/* dcl_color0 v1 */
0x02000001
,
0xc00f0000
,
0x90e40000
,
/* mov oPos, v0 */
0x02000001
,
0xd00f0000
,
0x90e40001
,
/* mov oD0, v1 */
0x0000ffff
/* end */
};
IDirect3DVertexShader9
*
shader
;
IDirect3DTexture9
*
offscreen
=
NULL
;
IDirect3DSurface9
*
offscreen_surface
,
*
original_rt
;
HRESULT
hr
;
hr
=
IDirect3DDevice9_GetRenderTarget
(
device
,
0
,
&
original_rt
);
ok
(
SUCCEEDED
(
hr
),
"GetRenderTarget 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
,
FALSE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZWRITEENABLE
,
FALSE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_CLIPPING
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexShader
(
device
,
NULL
);
hr
=
IDirect3DDevice9_SetPixelShader
(
device
,
NULL
);
IDirect3DDevice9_SetClipPlane
(
device
,
0
,
plane0
);
clip_planes
(
device
,
"Onscreen FFP"
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
640
,
480
,
1
,
D3DUSAGE_RENDERTARGET
,
D3DFMT_A8R8G8B8
,
D3DPOOL_DEFAULT
,
&
offscreen
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"CreateTexture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
offscreen
,
0
,
&
offscreen_surface
);
ok
(
SUCCEEDED
(
hr
),
"GetSurfaceLevel failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
offscreen_surface
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderTarget failed, hr=%08x
\n
"
,
hr
);
clip_planes
(
device
,
"Offscreen FFP"
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateVertexShader
(
device
,
shader_code
,
&
shader
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_CreateVertexShader returned %08x
\n
"
,
hr
);
IDirect3DDevice9_SetVertexShader
(
device
,
shader
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetVertexShader returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
original_rt
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderTarget failed, hr=%08x
\n
"
,
hr
);
clip_planes
(
device
,
"Onscreen vertex shader"
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
offscreen_surface
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderTarget failed, hr=%08x
\n
"
,
hr
);
clip_planes
(
device
,
"Offscreen vertex shader"
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_CLIPPLANEENABLE
,
0
);
hr
=
IDirect3DDevice9_SetVertexShader
(
device
,
NULL
);
IDirect3DVertexShader9_Release
(
shader
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
original_rt
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderTarget failed, hr=%08x
\n
"
,
hr
);
IDirect3DSurface9_Release
(
original_rt
);
if
(
offscreen
)
{
IDirect3DSurface9_Release
(
offscreen_surface
);
IDirect3DTexture9_Release
(
offscreen
);
}
}
static
void
fp_special_test
(
IDirect3DDevice9
*
device
)
{
static
const
DWORD
vs_header
[]
=
...
...
@@ -11694,6 +11826,7 @@ START_TEST(visual)
fp_special_test
(
device_ptr
);
depth_bounds_test
(
device_ptr
);
srgbwrite_format_test
(
device_ptr
);
clip_planes_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