Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
9580c3f6
Commit
9580c3f6
authored
Oct 14, 2006
by
Ivan Gyurdiev
Committed by
Alexandre Julliard
Apr 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Add a test for the converted vertex decl.
parent
46c5d223
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
vertexdeclaration.c
dlls/d3d9/tests/vertexdeclaration.c
+75
-0
No files found.
dlls/d3d9/tests/vertexdeclaration.c
View file @
9580c3f6
...
...
@@ -643,6 +643,80 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
if
(
default_decl
)
IUnknown_Release
(
default_decl
);
}
/* Check whether a declaration converted from FVF is shared.
* Check whether refcounts behave as expected */
static
void
test_fvf_decl_management
(
IDirect3DDevice9
*
device
)
{
HRESULT
hr
;
IDirect3DVertexDeclaration9
*
result_decl1
=
NULL
;
IDirect3DVertexDeclaration9
*
result_decl2
=
NULL
;
IDirect3DVertexDeclaration9
*
result_decl3
=
NULL
;
int
ref1
,
ref2
,
ref3
;
DWORD
test_fvf1
=
D3DFVF_XYZRHW
;
DWORD
test_fvf2
=
D3DFVF_NORMAL
;
CONST
D3DVERTEXELEMENT9
test_elements1
[]
=
{
{
0
,
0
,
D3DDECLTYPE_FLOAT4
,
0
,
D3DDECLUSAGE_POSITIONT
,
0
},
D3DDECL_END
()
};
CONST
D3DVERTEXELEMENT9
test_elements2
[]
=
{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
0
,
D3DDECLUSAGE_NORMAL
,
0
},
D3DDECL_END
()
};
/* Clear down any current vertex declaration */
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
return
;
/* Conversion */
hr
=
IDirect3DDevice9_SetFVF
(
device
,
test_fvf1
);
ok
(
SUCCEEDED
(
hr
),
"SetFVF returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
return
;
/* Get converted decl (#1) */
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
result_decl1
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
return
;
/* Get converted decl again (#2) */
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
result_decl2
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
return
;
/* Conversion */
hr
=
IDirect3DDevice9_SetFVF
(
device
,
test_fvf2
);
ok
(
SUCCEEDED
(
hr
),
"SetFVF returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
return
;
/* The contents should correspond to the second conversion */
VDECL_CHECK
(
compare_elements
(
result_decl1
,
test_elements1
));
/* Get converted decl (#3) */
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
result_decl3
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
return
;
/* The object should be the same */
ok
(
result_decl1
==
result_decl2
,
"Declaration object changes on the second Get() call
\n
"
);
ok
(
result_decl2
!=
result_decl3
,
"Declaration object did not change during conversion
\n
"
);
/* The contents should correspond to the second conversion */
VDECL_CHECK
(
compare_elements
(
result_decl3
,
test_elements2
));
/* The refcounts should all be 1 */
ref1
=
get_refcount
((
IUnknown
*
)
result_decl1
);
ref2
=
get_refcount
((
IUnknown
*
)
result_decl2
);
ref3
=
get_refcount
((
IUnknown
*
)
result_decl3
);
ok
(
ref1
==
2
,
"Refcount #1 is %d, expected 2
\n
"
,
ref1
);
ok
(
ref2
==
2
,
"Refcount #2 is %d, expected 2
\n
"
,
ref2
);
ok
(
ref3
==
1
,
"Refcount #3 is %d, expected 1
\n
"
,
ref3
);
/* Clear down any current vertex declaration */
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
return
;
return
;
}
START_TEST
(
vertexdeclaration
)
{
static
D3DVERTEXELEMENT9
simple_decl
[]
=
{
...
...
@@ -676,4 +750,5 @@ START_TEST(vertexdeclaration)
test_get_set_vertex_declaration
(
device_ptr
,
decl_ptr
);
test_get_declaration
(
decl_ptr
,
simple_decl
,
simple_decl_num_elements
);
test_fvf_decl_conversion
(
device_ptr
);
test_fvf_decl_management
(
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