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
26344ce3
Commit
26344ce3
authored
Mar 06, 2007
by
H. Verbeet
Committed by
Alexandre Julliard
Mar 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Add a mova rounding test.
parent
2384bdde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
1 deletion
+108
-1
visual.c
dlls/d3d9/tests/visual.c
+108
-1
No files found.
dlls/d3d9/tests/visual.c
View file @
26344ce3
/*
* Copyright
(C) 2005
Henri Verbeet
* Copyright
2005, 2007
Henri Verbeet
* Copyright (C) 2007 Stefan Dsinger(for CodeWeavers)
*
* This library is free software; you can redistribute it and/or
...
...
@@ -314,9 +314,108 @@ static void clear_test(IDirect3DDevice9 *device)
ok
(
color
==
0x00ffffff
,
"Clear rectangle 4(neg, neg) has color %08x
\n
"
,
color
);
}
typedef
struct
{
float
in
[
4
];
DWORD
out
;
}
test_data_t
;
/*
* c7 rounded ARGB
* -2.4 -2 0x00ffff00
* -1.6 -2 0x00ffff00
* -0.4 0 0x0000ffff
* 0.4 0 0x0000ffff
* 1.6 2 0x00ff00ff
* 2.4 2 0x00ff00ff
*/
static
void
test_mova
(
IDirect3DDevice9
*
device
)
{
static
const
DWORD
mova_test
[]
=
{
0xfffe0200
,
/* vs_2_0 */
0x0200001f
,
0x80000000
,
0x900f0000
,
/* dcl_position v0 */
0x05000051
,
0xa00f0000
,
0x3f800000
,
0x00000000
,
0x00000000
,
0x3f800000
,
/* def c0, 1.0, 0.0, 0.0, 1.0 */
0x05000051
,
0xa00f0001
,
0x3f800000
,
0x3f800000
,
0x00000000
,
0x3f800000
,
/* def c1, 1.0, 1.0, 0.0, 1.0 */
0x05000051
,
0xa00f0002
,
0x00000000
,
0x3f800000
,
0x00000000
,
0x3f800000
,
/* def c2, 0.0, 1.0, 0.0, 1.0 */
0x05000051
,
0xa00f0003
,
0x00000000
,
0x3f800000
,
0x3f800000
,
0x3f800000
,
/* def c3, 0.0, 1.0, 1.0, 1.0 */
0x05000051
,
0xa00f0004
,
0x00000000
,
0x00000000
,
0x3f800000
,
0x3f800000
,
/* def c4, 0.0, 0.0, 1.0, 1.0 */
0x05000051
,
0xa00f0005
,
0x3f800000
,
0x00000000
,
0x3f800000
,
0x3f800000
,
/* def c5, 1.0, 0.0, 1.0, 1.0 */
0x05000051
,
0xa00f0006
,
0x3f800000
,
0x3f800000
,
0x3f800000
,
0x3f800000
,
/* def c6, 1.0, 1.0, 1.0, 1.0 */
0x0200002e
,
0xb0010000
,
0xa0000007
,
/* mova a0.x, c7.x */
0x03000001
,
0xd00f0000
,
0xa0e42003
,
0xb0000000
,
/* mov oD0, c[a0.x + 3] */
0x02000001
,
0xc00f0000
,
0x90e40000
,
/* mov oPos, v0 */
0x0000ffff
/* END */
};
static
const
test_data_t
test_data
[]
=
{
{{
-
2
.
4
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x00ffff00
},
{{
-
1
.
6
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x00ffff00
},
{{
-
0
.
4
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x0000ffff
},
{{
0
.
4
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x0000ffff
},
{{
1
.
6
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x00ff00ff
},
{{
2
.
4
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x00ff00ff
}
};
static
const
float
quad
[][
3
]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
};
static
const
D3DVERTEXELEMENT9
decl_elements
[]
=
{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
D3DDECL_END
()
};
IDirect3DVertexDeclaration9
*
vertex_declaration
=
NULL
;
IDirect3DVertexShader9
*
mova_shader
=
NULL
;
HRESULT
hr
;
int
i
;
hr
=
IDirect3DDevice9_CreateVertexShader
(
device
,
mova_test
,
&
mova_shader
);
ok
(
SUCCEEDED
(
hr
),
"CreateVertexShader failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexShader
(
device
,
mova_shader
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexShader failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateVertexDeclaration
(
device
,
decl_elements
,
&
vertex_declaration
);
ok
(
SUCCEEDED
(
hr
),
"CreateVertexDeclaration failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
vertex_declaration
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed (%08x)
\n
"
,
hr
);
for
(
i
=
0
;
i
<
(
sizeof
(
test_data
)
/
sizeof
(
test_data_t
));
++
i
)
{
DWORD
color
;
hr
=
IDirect3DDevice9_SetVertexShaderConstantF
(
device
,
7
,
test_data
[
i
].
in
,
1
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexShaderConstantF failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginScene failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quad
[
0
],
3
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"EndScene failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (%08x)
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color
==
test_data
[
i
].
out
,
"Expected color %08x, got %08x (for input %f)
\n
"
,
test_data
[
i
].
out
,
color
,
test_data
[
i
].
in
[
0
]);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Clear failed (%08x)
\n
"
,
hr
);
}
IDirect3DVertexDeclaration9_Release
(
vertex_declaration
);
IDirect3DVertexShader9_Release
(
mova_shader
);
}
START_TEST
(
visual
)
{
IDirect3DDevice9
*
device_ptr
;
D3DCAPS9
caps
;
HRESULT
hr
;
DWORD
color
;
...
...
@@ -330,6 +429,8 @@ START_TEST(visual)
device_ptr
=
init_d3d9
();
if
(
!
device_ptr
)
return
;
IDirect3DDevice9_GetDeviceCaps
(
device_ptr
,
&
caps
);
/* Check for the reliability of the returned data */
hr
=
IDirect3DDevice9_Clear
(
device_ptr
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffff0000
,
0
.
0
,
0
);
if
(
FAILED
(
hr
))
...
...
@@ -365,6 +466,12 @@ START_TEST(visual)
lighting_test
(
device_ptr
);
clear_test
(
device_ptr
);
if
(
caps
.
VertexShaderVersion
>=
D3DVS_VERSION
(
2
,
0
))
{
test_mova
(
device_ptr
);
}
else
skip
(
"No vs_2_0 support
\n
"
);
cleanup
:
if
(
device_ptr
)
IDirect3DDevice9_Release
(
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