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
526909f8
Commit
526909f8
authored
Oct 09, 2023
by
Matteo Bruni
Committed by
Alexandre Julliard
Oct 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9/tests: Get rid of unnecessary branches in D3DXLoadMeshTest().
parent
e4cdcb1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
66 deletions
+60
-66
mesh.c
dlls/d3dx9_36/tests/mesh.c
+60
-66
No files found.
dlls/d3dx9_36/tests/mesh.c
View file @
526909f8
...
...
@@ -2383,6 +2383,8 @@ static void D3DXLoadMeshTest(void)
D3DXMATRIX
transform
;
struct
test_context
*
test_context
;
ID3DXAnimationController
*
controller
;
D3DXMESHCONTAINER
*
container
;
unsigned
int
i
;
if
(
!
(
test_context
=
new_test_context
()))
{
...
...
@@ -2418,26 +2420,24 @@ static void D3DXLoadMeshTest(void)
hr
=
D3DXLoadMeshHierarchyFromXInMemory
(
simple_xfile
,
sizeof
(
simple_xfile
)
-
1
,
D3DXMESH_MANAGED
,
device
,
&
alloc_hier
,
NULL
,
&
frame_hier
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
D3DXMESHCONTAINER
*
container
=
frame_hier
->
pMeshContainer
;
ok
(
frame_hier
->
Name
==
NULL
,
"Expected NULL, got '%s'
\n
"
,
frame_hier
->
Name
);
D3DXMatrixIdentity
(
&
transform
);
check_matrix
(
&
frame_hier
->
TransformationMatrix
,
&
transform
);
ok
(
!
strcmp
(
container
->
Name
,
""
),
"Expected '', got '%s'
\n
"
,
container
->
Name
);
ok
(
container
->
MeshData
.
Type
==
D3DXMESHTYPE_MESH
,
"Expected %d, got %d
\n
"
,
D3DXMESHTYPE_MESH
,
container
->
MeshData
.
Type
);
mesh
=
container
->
MeshData
.
pMesh
;
check_vertex_buffer
(
mesh
,
simple_vertex_buffer
,
ARRAY_SIZE
(
simple_vertex_buffer
),
simple_fvf
);
check_index_buffer
(
mesh
,
simple_index_buffer
,
ARRAY_SIZE
(
simple_index_buffer
),
sizeof
(
*
simple_index_buffer
));
check_materials
(
container
->
pMaterials
,
container
->
NumMaterials
,
NULL
,
0
);
check_generated_effects
(
container
->
pMaterials
,
container
->
NumMaterials
,
container
->
pEffects
);
check_generated_adjacency
(
mesh
,
container
->
pAdjacency
,
0
.
0
f
);
hr
=
D3DXFrameDestroy
(
frame_hier
,
&
alloc_hier
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
frame_hier
=
NULL
;
}
container
=
frame_hier
->
pMeshContainer
;
ok
(
frame_hier
->
Name
==
NULL
,
"Expected NULL, got '%s'
\n
"
,
frame_hier
->
Name
);
D3DXMatrixIdentity
(
&
transform
);
check_matrix
(
&
frame_hier
->
TransformationMatrix
,
&
transform
);
ok
(
!
strcmp
(
container
->
Name
,
""
),
"Expected '', got '%s'
\n
"
,
container
->
Name
);
ok
(
container
->
MeshData
.
Type
==
D3DXMESHTYPE_MESH
,
"Expected %d, got %d
\n
"
,
D3DXMESHTYPE_MESH
,
container
->
MeshData
.
Type
);
mesh
=
container
->
MeshData
.
pMesh
;
check_vertex_buffer
(
mesh
,
simple_vertex_buffer
,
ARRAY_SIZE
(
simple_vertex_buffer
),
simple_fvf
);
check_index_buffer
(
mesh
,
simple_index_buffer
,
ARRAY_SIZE
(
simple_index_buffer
),
sizeof
(
*
simple_index_buffer
));
check_materials
(
container
->
pMaterials
,
container
->
NumMaterials
,
NULL
,
0
);
check_generated_effects
(
container
->
pMaterials
,
container
->
NumMaterials
,
container
->
pEffects
);
check_generated_adjacency
(
mesh
,
container
->
pAdjacency
,
0
.
0
f
);
hr
=
D3DXFrameDestroy
(
frame_hier
,
&
alloc_hier
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
frame_hier
=
NULL
;
controller
=
(
ID3DXAnimationController
*
)
0xdeadbeef
;
hr
=
D3DXLoadMeshHierarchyFromXInMemory
(
box_anim_xfile
,
sizeof
(
box_anim_xfile
)
-
1
,
...
...
@@ -2459,59 +2459,54 @@ static void D3DXLoadMeshTest(void)
hr
=
D3DXLoadMeshHierarchyFromXInMemory
(
box_xfile
,
sizeof
(
box_xfile
)
-
1
,
D3DXMESH_MANAGED
,
device
,
&
alloc_hier
,
NULL
,
&
frame_hier
,
&
controller
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
D3DXMESHCONTAINER
*
container
=
frame_hier
->
pMeshContainer
;
container
=
frame_hier
->
pMeshContainer
;
ok
(
!
controller
,
"Animation Controller returned.
\n
"
);
ok
(
frame_hier
->
Name
==
NULL
,
"Expected NULL, got '%s'
\n
"
,
frame_hier
->
Name
);
D3DXMatrixIdentity
(
&
transform
);
check_matrix
(
&
frame_hier
->
TransformationMatrix
,
&
transform
);
ok
(
!
strcmp
(
container
->
Name
,
""
),
"Expected '', got '%s'
\n
"
,
container
->
Name
);
ok
(
container
->
MeshData
.
Type
==
D3DXMESHTYPE_MESH
,
"Expected %d, got %d
\n
"
,
D3DXMESHTYPE_MESH
,
container
->
MeshData
.
Type
);
mesh
=
container
->
MeshData
.
pMesh
;
check_vertex_buffer
(
mesh
,
box_vertex_buffer
,
ARRAY_SIZE
(
box_vertex_buffer
),
box_fvf
);
check_index_buffer
(
mesh
,
box_index_buffer
,
ARRAY_SIZE
(
box_index_buffer
),
sizeof
(
*
box_index_buffer
));
check_materials
(
container
->
pMaterials
,
container
->
NumMaterials
,
box_materials
,
ARRAY_SIZE
(
box_materials
));
check_generated_effects
(
container
->
pMaterials
,
container
->
NumMaterials
,
container
->
pEffects
);
check_generated_adjacency
(
mesh
,
container
->
pAdjacency
,
0
.
0
f
);
hr
=
D3DXFrameDestroy
(
frame_hier
,
&
alloc_hier
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
frame_hier
=
NULL
;
hr
=
D3DXLoadMeshHierarchyFromXInMemory
(
framed_xfile
,
sizeof
(
framed_xfile
)
-
1
,
D3DXMESH_MANAGED
,
device
,
&
alloc_hier
,
NULL
,
&
frame_hier
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
container
=
frame_hier
->
pMeshContainer
;
ok
(
!
controller
,
"Animation Controller returned.
\n
"
);
ok
(
frame_hier
->
Name
==
NULL
,
"Expected NULL, got '%s'
\n
"
,
frame_hier
->
Name
);
D3DXMatrixIdentity
(
&
transform
);
check_matrix
(
&
frame_hier
->
TransformationMatrix
,
&
transform
);
ok
(
!
strcmp
(
frame_hier
->
Name
,
""
),
"Expected '', got '%s'
\n
"
,
frame_hier
->
Name
);
/* last frame transform replaces the first */
D3DXMatrixIdentity
(
&
transform
);
transform
.
m
[
3
][
2
]
=
3
.
0
;
check_matrix
(
&
frame_hier
->
TransformationMatrix
,
&
transform
);
for
(
i
=
0
;
i
<
3
;
++
i
)
{
ok
(
!
strcmp
(
container
->
Name
,
""
),
"Expected '', got '%s'
\n
"
,
container
->
Name
);
ok
(
container
->
MeshData
.
Type
==
D3DXMESHTYPE_MESH
,
"Expected %d, got %d
\n
"
,
D3DXMESHTYPE_MESH
,
container
->
MeshData
.
Type
);
D3DXMESHTYPE_MESH
,
container
->
MeshData
.
Type
);
mesh
=
container
->
MeshData
.
pMesh
;
check_vertex_buffer
(
mesh
,
box_vertex_buffer
,
ARRAY_SIZE
(
box_vertex_buffer
),
box
_fvf
);
check_index_buffer
(
mesh
,
box_index_buffer
,
ARRAY_SIZE
(
box_index_buffer
),
sizeof
(
*
box
_index_buffer
));
check_materials
(
container
->
pMaterials
,
container
->
NumMaterials
,
box_materials
,
ARRAY_SIZE
(
box_materials
)
);
check_vertex_buffer
(
mesh
,
framed_vertex_buffers
[
i
],
ARRAY_SIZE
(
framed_vertex_buffers
[
0
]),
framed
_fvf
);
check_index_buffer
(
mesh
,
framed_index_buffer
,
ARRAY_SIZE
(
framed_index_buffer
),
sizeof
(
*
framed
_index_buffer
));
check_materials
(
container
->
pMaterials
,
container
->
NumMaterials
,
NULL
,
0
);
check_generated_effects
(
container
->
pMaterials
,
container
->
NumMaterials
,
container
->
pEffects
);
check_generated_adjacency
(
mesh
,
container
->
pAdjacency
,
0
.
0
f
);
hr
=
D3DXFrameDestroy
(
frame_hier
,
&
alloc_hier
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
frame_hier
=
NULL
;
container
=
container
->
pNextMeshContainer
;
}
hr
=
D3DXLoadMeshHierarchyFromXInMemory
(
framed_xfile
,
sizeof
(
framed_xfile
)
-
1
,
D3DXMESH_MANAGED
,
device
,
&
alloc_hier
,
NULL
,
&
frame_hier
,
NULL
);
ok
(
container
==
NULL
,
"Expected NULL, got %p
\n
"
,
container
);
hr
=
D3DXFrameDestroy
(
frame_hier
,
&
alloc_hier
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
D3DXMESHCONTAINER
*
container
=
frame_hier
->
pMeshContainer
;
int
i
;
ok
(
!
strcmp
(
frame_hier
->
Name
,
""
),
"Expected '', got '%s'
\n
"
,
frame_hier
->
Name
);
/* last frame transform replaces the first */
D3DXMatrixIdentity
(
&
transform
);
transform
.
m
[
3
][
2
]
=
3
.
0
;
check_matrix
(
&
frame_hier
->
TransformationMatrix
,
&
transform
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
ok
(
!
strcmp
(
container
->
Name
,
""
),
"Expected '', got '%s'
\n
"
,
container
->
Name
);
ok
(
container
->
MeshData
.
Type
==
D3DXMESHTYPE_MESH
,
"Expected %d, got %d
\n
"
,
D3DXMESHTYPE_MESH
,
container
->
MeshData
.
Type
);
mesh
=
container
->
MeshData
.
pMesh
;
check_vertex_buffer
(
mesh
,
framed_vertex_buffers
[
i
],
ARRAY_SIZE
(
framed_vertex_buffers
[
0
]),
framed_fvf
);
check_index_buffer
(
mesh
,
framed_index_buffer
,
ARRAY_SIZE
(
framed_index_buffer
),
sizeof
(
*
framed_index_buffer
));
check_materials
(
container
->
pMaterials
,
container
->
NumMaterials
,
NULL
,
0
);
check_generated_effects
(
container
->
pMaterials
,
container
->
NumMaterials
,
container
->
pEffects
);
check_generated_adjacency
(
mesh
,
container
->
pAdjacency
,
0
.
0
f
);
container
=
container
->
pNextMeshContainer
;
}
ok
(
container
==
NULL
,
"Expected NULL, got %p
\n
"
,
container
);
hr
=
D3DXFrameDestroy
(
frame_hier
,
&
alloc_hier
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
frame_hier
=
NULL
;
}
frame_hier
=
NULL
;
hr
=
D3DXLoadMeshFromXInMemory
(
NULL
,
0
,
D3DXMESH_MANAGED
,
...
...
@@ -2541,8 +2536,7 @@ static void D3DXLoadMeshTest(void)
hr
=
D3DXLoadMeshFromXInMemory
(
simple_xfile
,
sizeof
(
simple_xfile
)
-
1
,
D3DXMESH_MANAGED
,
device
,
NULL
,
NULL
,
NULL
,
NULL
,
&
mesh
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#lx
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IUnknown_Release
(
mesh
);
IUnknown_Release
(
mesh
);
test_LoadMeshFromX
(
device
,
simple_xfile
,
simple_vertex_buffer
,
simple_fvf
,
simple_index_buffer
,
default_materials
,
TRUE
);
test_LoadMeshFromX
(
device
,
box_xfile
,
box_vertex_buffer
,
box_fvf
,
box_index_buffer
,
box_materials
,
TRUE
);
...
...
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