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
399cf7e4
Commit
399cf7e4
authored
Jul 03, 2015
by
Józef Kucia
Committed by
Alexandre Julliard
Jul 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add basic tests for vertex blending.
parent
4a8e0ec3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
212 additions
and
0 deletions
+212
-0
visual.c
dlls/d3d9/tests/visual.c
+212
-0
No files found.
dlls/d3d9/tests/visual.c
View file @
399cf7e4
...
...
@@ -19077,6 +19077,217 @@ static void test_texcoordindex(void)
DestroyWindow
(
window
);
}
static
void
test_vertex_blending
(
void
)
{
IDirect3DDevice9
*
device
;
IDirect3D9
*
d3d
;
D3DCAPS9
caps
;
D3DCOLOR
color
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
int
i
;
static
const
D3DMATRIX
view_mat
=
{{{
2
.
0
f
/
10
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
2
.
0
f
/
10
.
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
}}},
upper_left
=
{{{
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
,
-
4
.
0
f
,
4
.
0
f
,
0
.
0
f
,
1
.
0
f
}}},
lower_left
=
{{{
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
,
-
4
.
0
f
,
-
4
.
0
f
,
0
.
0
f
,
1
.
0
f
}}},
upper_right
=
{{{
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
,
4
.
0
f
,
4
.
0
f
,
0
.
0
f
,
1
.
0
f
}}},
lower_right
=
{{{
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
,
4
.
0
f
,
-
4
.
0
f
,
0
.
0
f
,
1
.
0
f
}}};
static
const
POINT
quad_upper_right_points
[]
=
{
{
576
,
48
},
{
-
1
,
-
1
},
},
quad_upper_right_empty_points
[]
=
{
{
64
,
48
},
{
64
,
432
},
{
576
,
432
},
{
320
,
240
},
{
-
1
,
-
1
}
},
quad_center_points
[]
=
{
{
320
,
240
},
{
-
1
,
-
1
}
},
quad_center_empty_points
[]
=
{
{
64
,
48
},
{
576
,
48
},
{
64
,
432
},
{
576
,
432
},
{
-
1
,
-
1
}
},
quad_upper_center_points
[]
=
{
{
320
,
48
},
{
-
1
,
-
1
}
},
quad_upper_center_empty_points
[]
=
{
{
320
,
240
},
{
64
,
48
},
{
576
,
48
},
{
-
1
,
-
1
}
},
quad_fullscreen_points
[]
=
{
{
320
,
48
},
{
320
,
240
},
{
64
,
48
},
{
576
,
48
},
{
64
,
432
},
{
576
,
432
},
{
-
1
,
-
1
}
},
quad_fullscreen_empty_points
[]
=
{
{
-
1
,
-
1
}
};
static
const
struct
{
struct
{
struct
vec3
position
;
struct
vec3
blendweights
;
}
vertex_data
[
4
];
const
POINT
*
quad_points
;
const
POINT
*
empty_points
;
}
tests
[]
=
{
/* upper right */
{
{{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
}}},
quad_upper_right_points
,
quad_upper_right_empty_points
},
/* center */
{
{{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
25
f
,
0
.
25
f
,
0
.
25
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
25
f
,
0
.
25
f
,
0
.
25
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
25
f
,
0
.
25
f
,
0
.
25
f
}},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
25
f
,
0
.
25
f
,
0
.
25
f
}}},
quad_center_points
,
quad_center_empty_points
},
/* upper center */
{
{{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
5
f
,
0
.
0
f
,
0
.
0
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
5
f
,
0
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
5
f
,
0
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
5
f
,
0
.
0
f
,
0
.
0
f
}}},
quad_upper_center_points
,
quad_upper_center_empty_points
},
/* full screen */
{
{{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
,
0
.
0
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
1
.
0
f
}},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
}}},
quad_fullscreen_points
,
quad_fullscreen_empty_points
}
};
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
d3d
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d
,
window
,
window
,
TRUE
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get device caps, hr %#x.
\n
"
,
hr
);
if
(
caps
.
MaxVertexBlendMatrices
<
4
)
{
skip
(
"Only %u vertex blend matrices supported, skipping tests.
\n
"
,
caps
.
MaxVertexBlendMatrices
);
IDirect3DDevice9_Release
(
device
);
goto
done
;
}
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_LIGHTING
,
FALSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_VIEW
,
&
view_mat
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTransform returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
0
),
&
upper_left
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTransform returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
1
),
&
lower_left
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTransform returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
2
),
&
lower_right
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTransform returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
3
),
&
upper_right
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTransform returned %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_VERTEXBLEND
,
D3DVBF_3WEIGHTS
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState failed %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
const
POINT
*
point
;
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xff000000
,
0
.
0
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear %08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZB3
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set FVF, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
tests
[
i
].
vertex_data
,
6
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Present failed with %08x
\n
"
,
hr
);
point
=
tests
[
i
].
quad_points
;
while
(
point
->
x
!=
-
1
&&
point
->
y
!=
-
1
)
{
color
=
getPixelColor
(
device
,
point
->
x
,
point
->
y
);
ok
(
color_match
(
color
,
0x00ffffff
,
1
),
"Expected quad at %dx%d.
\n
"
,
point
->
x
,
point
->
y
);
++
point
;
}
point
=
tests
[
i
].
empty_points
;
while
(
point
->
x
!=
-
1
&&
point
->
y
!=
-
1
)
{
color
=
getPixelColor
(
device
,
point
->
x
,
point
->
y
);
ok
(
color_match
(
color
,
0x00000000
,
1
),
"Unexpected quad at %dx%d.
\n
"
,
point
->
x
,
point
->
y
);
++
point
;
}
}
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
done:
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
}
START_TEST
(
visual
)
{
D3DADAPTER_IDENTIFIER9
identifier
;
...
...
@@ -19192,4 +19403,5 @@ START_TEST(visual)
test_signed_formats
();
test_multisample_mismatch
();
test_texcoordindex
();
test_vertex_blending
();
}
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