Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
bbcd75bf
Commit
bbcd75bf
authored
Aug 17, 2017
by
Paul Gofman
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add test for indexed vertex blending.
parent
eeaa0102
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
252 additions
and
0 deletions
+252
-0
visual.c
dlls/d3d9/tests/visual.c
+252
-0
No files found.
dlls/d3d9/tests/visual.c
View file @
bbcd75bf
...
...
@@ -21796,6 +21796,257 @@ done:
DestroyWindow
(
window
);
}
static
void
do_test_indexed_vertex_blending
(
IDirect3DDevice9
*
device
,
const
char
*
test_id_str
)
{
D3DCAPS9
caps
;
D3DCOLOR
color
;
HRESULT
hr
;
unsigned
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
;
DWORD
matrixIndices
;
}
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
},
0x06070405
},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
}},
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
},
0x06070405
},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
25
f
,
0
.
25
f
,
0
.
25
f
},
0x06070405
},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
25
f
,
0
.
25
f
,
0
.
25
f
},
0x06070405
},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
25
f
,
0
.
25
f
,
0
.
25
f
},
0x06070405
}},
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
},
0x06070405
},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
5
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
5
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
5
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
}},
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
},
0x06070405
},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
1
.
0
f
},
0x06070405
},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
0x06070405
}},
quad_fullscreen_points
,
quad_fullscreen_empty_points
}
};
memset
(
&
caps
,
0
,
sizeof
(
caps
));
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get device caps, hr %#x.
\n
"
,
hr
);
if
(
caps
.
MaxVertexBlendMatrixIndex
<
7
||
caps
.
MaxVertexBlendMatrices
<
4
)
{
todo_wine
win_skip
(
"(%s) Too few vertex blend matrices supported: MaxVertexBlendMatrices=%u, MaxVertexBlendMatrixIndex=%u.
\n
"
,
test_id_str
,
caps
.
MaxVertexBlendMatrices
,
caps
.
MaxVertexBlendMatrixIndex
);
return
;
}
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
(
5
),
&
upper_left
);
ok
(
hr
==
D3D_OK
,
"(%s) IDirect3DDevice9_SetTransform returned %08x.
\n
"
,
test_id_str
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
4
),
&
lower_left
);
ok
(
hr
==
D3D_OK
,
"(%s) IDirect3DDevice9_SetTransform returned %08x.
\n
"
,
test_id_str
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
7
),
&
lower_right
);
ok
(
hr
==
D3D_OK
,
"(%s) IDirect3DDevice9_SetTransform returned %08x.
\n
"
,
test_id_str
,
hr
);
hr
=
IDirect3DDevice9_SetTransform
(
device
,
D3DTS_WORLDMATRIX
(
6
),
&
upper_right
);
ok
(
hr
==
D3D_OK
,
"(%s) IDirect3DDevice9_SetTransform returned %08x.
\n
"
,
test_id_str
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_VERTEXBLEND
,
D3DVBF_3WEIGHTS
);
ok
(
hr
==
D3D_OK
,
"(%s) IDirect3DDevice9_SetRenderState failed %08x.
\n
"
,
test_id_str
,
hr
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_INDEXEDVERTEXBLENDENABLE
,
TRUE
);
ok
(
hr
==
D3D_OK
,
"(%s) IDirect3DDevice9_SetRenderState D3DRS_INDEXEDVERTEXBLENDENABLE failed %08x.
\n
"
,
test_id_str
,
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, hr %08x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZB4
|
D3DFVF_LASTBETA_UBYTE4
);
ok
(
SUCCEEDED
(
hr
),
"(%s) Failed to set FVF, hr %#x.
\n
"
,
test_id_str
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
tests
[
i
].
vertex_data
,
6
*
sizeof
(
float
)
+
sizeof
(
DWORD
));
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
);
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
),
"(%s) Expected quad at %dx%d.
\n
"
,
test_id_str
,
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
),
"(%s) Unexpected quad at %dx%d.
\n
"
,
test_id_str
,
point
->
x
,
point
->
y
);
++
point
;
}
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
}
}
static
void
test_indexed_vertex_blending
(
void
)
{
D3DPRESENT_PARAMETERS
present_parameters
=
{
0
};
IDirect3DDevice9
*
device
;
IDirect3D9
*
d3d
;
ULONG
refcount
;
HWND
window
;
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
"
);
present_parameters
.
Windowed
=
TRUE
;
present_parameters
.
hDeviceWindow
=
window
;
present_parameters
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
present_parameters
.
BackBufferWidth
=
640
;
present_parameters
.
BackBufferHeight
=
480
;
present_parameters
.
BackBufferFormat
=
D3DFMT_A8R8G8B8
;
present_parameters
.
EnableAutoDepthStencil
=
TRUE
;
present_parameters
.
AutoDepthStencilFormat
=
D3DFMT_D24S8
;
if
(
SUCCEEDED
(
IDirect3D9_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
window
,
D3DCREATE_HARDWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device
)))
{
do_test_indexed_vertex_blending
(
device
,
"IVB hardware"
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
else
skip
(
"Failed to create a HAL device, skipping test.
\n
"
);
if
(
SUCCEEDED
(
IDirect3D9_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
window
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device
)))
{
do_test_indexed_vertex_blending
(
device
,
"IVB software"
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
else
skip
(
"Failed to create a HAL device with software processing, skipping test.
\n
"
);
if
(
SUCCEEDED
(
IDirect3D9_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
window
,
D3DCREATE_MIXED_VERTEXPROCESSING
,
&
present_parameters
,
&
device
)))
{
do_test_indexed_vertex_blending
(
device
,
"IVB mixed"
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
else
skip
(
"Failed to create a HAL device with mixed processing, skipping tests.
\n
"
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
}
static
void
test_updatetexture
(
void
)
{
BOOL
r32f_supported
,
ati2n_supported
,
do_visual_test
;
...
...
@@ -27744,6 +27995,7 @@ START_TEST(visual)
test_multisample_mismatch
();
test_texcoordindex
();
test_vertex_blending
();
test_indexed_vertex_blending
();
test_updatetexture
();
test_depthbias
();
test_flip
();
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