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
bdd42942
Commit
bdd42942
authored
Jun 01, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Jun 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Get rid of IDirect3DVertexDeclaration9Impl.
parent
79d62ca1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
81 deletions
+67
-81
d3d9_private.h
dlls/d3d9/d3d9_private.h
+12
-24
device.c
dlls/d3d9/device.c
+11
-11
vertexdeclaration.c
dlls/d3d9/vertexdeclaration.c
+44
-46
No files found.
dlls/d3d9/d3d9_private.h
View file @
bdd42942
...
...
@@ -256,32 +256,20 @@ struct d3d9_stateblock
HRESULT
stateblock_init
(
struct
d3d9_stateblock
*
stateblock
,
struct
d3d9_device
*
device
,
D3DSTATEBLOCKTYPE
type
,
struct
wined3d_stateblock
*
wined3d_stateblock
)
DECLSPEC_HIDDEN
;
/* --------------------------- */
/* IDirect3DVertexDeclaration9 */
/* --------------------------- */
/*****************************************************************************
* IDirect3DVertexDeclaration implementation structure
*/
typedef
struct
IDirect3DVertexDeclaration9Impl
{
/* IUnknown fields */
IDirect3DVertexDeclaration9
IDirect3DVertexDeclaration9_iface
;
LONG
ref
;
D3DVERTEXELEMENT9
*
elements
;
UINT
element_count
;
/* IDirect3DVertexDeclaration9 fields */
struct
wined3d_vertex_declaration
*
wineD3DVertexDeclaration
;
DWORD
convFVF
;
/* Parent reference */
LPDIRECT3DDEVICE9EX
parentDevice
;
}
IDirect3DVertexDeclaration9Impl
;
struct
d3d9_vertex_declaration
{
IDirect3DVertexDeclaration9
IDirect3DVertexDeclaration9_iface
;
LONG
refcount
;
D3DVERTEXELEMENT9
*
elements
;
UINT
element_count
;
struct
wined3d_vertex_declaration
*
wined3d_declaration
;
DWORD
fvf
;
IDirect3DDevice9Ex
*
parent_device
;
};
HRESULT
d3d9_vertex_declaration_create
(
struct
d3d9_device
*
device
,
const
D3DVERTEXELEMENT9
*
elements
,
IDirect3DVertexDeclaration9Impl
**
declaration
)
DECLSPEC_HIDDEN
;
IDirect3DVertexDeclaration9Impl
*
unsafe_impl_from_IDirect3DVertexDeclaration9
(
const
D3DVERTEXELEMENT9
*
elements
,
struct
d3d9_vertex_declaration
**
declaration
)
DECLSPEC_HIDDEN
;
struct
d3d9_vertex_declaration
*
unsafe_impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
DECLSPEC_HIDDEN
;
/* ---------------------- */
...
...
dlls/d3d9/device.c
View file @
bdd42942
...
...
@@ -2019,7 +2019,7 @@ static HRESULT WINAPI d3d9_device_ProcessVertices(IDirect3DDevice9Ex *iface,
{
struct
d3d9_device
*
device
=
impl_from_IDirect3DDevice9Ex
(
iface
);
struct
d3d9_vertexbuffer
*
dst_impl
=
unsafe_impl_from_IDirect3DVertexBuffer9
(
dst_buffer
);
IDirect3DVertexDeclaration9Impl
*
decl_impl
=
unsafe_impl_from_IDirect3DVertexDeclaration9
(
declaration
);
struct
d3d9_vertex_declaration
*
decl_impl
=
unsafe_impl_from_IDirect3DVertexDeclaration9
(
declaration
);
HRESULT
hr
;
TRACE
(
"iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, declaration %p, flags %#x.
\n
"
,
...
...
@@ -2027,7 +2027,7 @@ static HRESULT WINAPI d3d9_device_ProcessVertices(IDirect3DDevice9Ex *iface,
wined3d_mutex_lock
();
hr
=
wined3d_device_process_vertices
(
device
->
wined3d_device
,
src_start_idx
,
dst_idx
,
vertex_count
,
dst_impl
->
wined3d_buffer
,
decl_impl
?
decl_impl
->
wine
D3DVertexD
eclaration
:
NULL
,
dst_impl
->
wined3d_buffer
,
decl_impl
?
decl_impl
->
wine
d3d_d
eclaration
:
NULL
,
flags
,
dst_impl
->
fvf
);
wined3d_mutex_unlock
();
...
...
@@ -2038,7 +2038,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexDeclaration(IDirect3DDevice9Ex *if
const
D3DVERTEXELEMENT9
*
elements
,
IDirect3DVertexDeclaration9
**
declaration
)
{
struct
d3d9_device
*
device
=
impl_from_IDirect3DDevice9Ex
(
iface
);
IDirect3DVertexDeclaration9Impl
*
object
;
struct
d3d9_vertex_declaration
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, elements %p, declaration %p.
\n
"
,
iface
,
elements
,
declaration
);
...
...
@@ -2059,14 +2059,14 @@ static HRESULT WINAPI d3d9_device_SetVertexDeclaration(IDirect3DDevice9Ex *iface
IDirect3DVertexDeclaration9
*
declaration
)
{
struct
d3d9_device
*
device
=
impl_from_IDirect3DDevice9Ex
(
iface
);
IDirect3DVertexDeclaration9Impl
*
decl_impl
=
unsafe_impl_from_IDirect3DVertexDeclaration9
(
declaration
);
struct
d3d9_vertex_declaration
*
decl_impl
=
unsafe_impl_from_IDirect3DVertexDeclaration9
(
declaration
);
HRESULT
hr
;
TRACE
(
"iface %p, declaration %p.
\n
"
,
iface
,
declaration
);
wined3d_mutex_lock
();
hr
=
wined3d_device_set_vertex_declaration
(
device
->
wined3d_device
,
decl_impl
?
decl_impl
->
wine
D3DVertexD
eclaration
:
NULL
);
decl_impl
?
decl_impl
->
wine
d3d_d
eclaration
:
NULL
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -2077,7 +2077,7 @@ static HRESULT WINAPI d3d9_device_GetVertexDeclaration(IDirect3DDevice9Ex *iface
{
struct
d3d9_device
*
device
=
impl_from_IDirect3DDevice9Ex
(
iface
);
struct
wined3d_vertex_declaration
*
wined3d_declaration
=
NULL
;
IDirect3DVertexDeclaration9Impl
*
declaration_impl
;
struct
d3d9_vertex_declaration
*
declaration_impl
;
HRESULT
hr
;
TRACE
(
"iface %p, declaration %p.
\n
"
,
iface
,
declaration
);
...
...
@@ -2107,7 +2107,7 @@ static struct wined3d_vertex_declaration *device_get_fvf_declaration(struct d3d9
{
struct
wined3d_vertex_declaration
*
wined3d_declaration
;
struct
fvf_declaration
*
fvf_decls
=
device
->
fvf_decls
;
IDirect3DVertexDeclaration9Impl
*
d3d9_declaration
;
struct
d3d9_vertex_declaration
*
d3d9_declaration
;
D3DVERTEXELEMENT9
*
elements
;
int
p
,
low
,
high
;
/* deliberately signed */
HRESULT
hr
;
...
...
@@ -2156,8 +2156,8 @@ static struct wined3d_vertex_declaration *device_get_fvf_declaration(struct d3d9
device
->
fvf_decl_size
+=
grow
;
}
d3d9_declaration
->
convFVF
=
fvf
;
wined3d_declaration
=
d3d9_declaration
->
wine
D3DVertexD
eclaration
;
d3d9_declaration
->
fvf
=
fvf
;
wined3d_declaration
=
d3d9_declaration
->
wine
d3d_d
eclaration
;
wined3d_vertex_declaration_incref
(
wined3d_declaration
);
IDirect3DVertexDeclaration9_Release
(
&
d3d9_declaration
->
IDirect3DVertexDeclaration9_iface
);
...
...
@@ -2205,7 +2205,7 @@ static HRESULT WINAPI d3d9_device_GetFVF(IDirect3DDevice9Ex *iface, DWORD *fvf)
{
struct
d3d9_device
*
device
=
impl_from_IDirect3DDevice9Ex
(
iface
);
struct
wined3d_vertex_declaration
*
wined3d_declaration
;
IDirect3DVertexDeclaration9Impl
*
d3d9_declaration
;
struct
d3d9_vertex_declaration
*
d3d9_declaration
;
HRESULT
hr
;
TRACE
(
"iface %p, fvf %p.
\n
"
,
iface
,
fvf
);
...
...
@@ -2222,7 +2222,7 @@ static HRESULT WINAPI d3d9_device_GetFVF(IDirect3DDevice9Ex *iface, DWORD *fvf)
if
(
wined3d_declaration
)
{
d3d9_declaration
=
wined3d_vertex_declaration_get_parent
(
wined3d_declaration
);
*
fvf
=
d3d9_declaration
->
convFVF
;
*
fvf
=
d3d9_declaration
->
fvf
;
wined3d_vertex_declaration_decref
(
wined3d_declaration
);
}
else
...
...
dlls/d3d9/vertexdeclaration.c
View file @
bdd42942
...
...
@@ -51,9 +51,9 @@ d3d_dtype_lookup[] =
/* D3DDECLTYPE_FLOAT16_4 */
{
WINED3DFMT_R16G16B16A16_FLOAT
,
4
,
sizeof
(
short
int
)}
};
static
inline
IDirect3DVertexDeclaration9Impl
*
impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
static
inline
struct
d3d9_vertex_declaration
*
impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirect3DVertexDeclaration9Impl
,
IDirect3DVertexDeclaration9_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d9_vertex_declaration
,
IDirect3DVertexDeclaration9_iface
);
}
HRESULT
vdecl_convert_fvf
(
...
...
@@ -197,8 +197,7 @@ HRESULT vdecl_convert_fvf(
return
D3D_OK
;
}
/* IDirect3DVertexDeclaration9 IUnknown parts follow: */
static
HRESULT
WINAPI
IDirect3DVertexDeclaration9Impl_QueryInterface
(
IDirect3DVertexDeclaration9
*
iface
,
static
HRESULT
WINAPI
d3d9_vertex_declaration_QueryInterface
(
IDirect3DVertexDeclaration9
*
iface
,
REFIID
riid
,
void
**
out
)
{
TRACE
(
"iface %p, riid %s, out %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
out
);
...
...
@@ -217,53 +216,52 @@ static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_QueryInterface(IDirect3DVe
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
IDirect3DVertexDeclaration9Impl
_AddRef
(
IDirect3DVertexDeclaration9
*
iface
)
static
ULONG
WINAPI
d3d9_vertex_declaration
_AddRef
(
IDirect3DVertexDeclaration9
*
iface
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
declaration
->
ref
);
struct
d3d9_vertex_declaration
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
ULONG
ref
count
=
InterlockedIncrement
(
&
declaration
->
refcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
count
);
if
(
ref
==
1
)
if
(
ref
count
==
1
)
{
IDirect3DDevice9Ex_AddRef
(
declaration
->
parent
D
evice
);
IDirect3DDevice9Ex_AddRef
(
declaration
->
parent
_d
evice
);
wined3d_mutex_lock
();
wined3d_vertex_declaration_incref
(
declaration
->
wine
D3DVertexD
eclaration
);
wined3d_vertex_declaration_incref
(
declaration
->
wine
d3d_d
eclaration
);
wined3d_mutex_unlock
();
}
return
ref
;
return
ref
count
;
}
static
ULONG
WINAPI
IDirect3DVertexDeclaration9Impl
_Release
(
IDirect3DVertexDeclaration9
*
iface
)
static
ULONG
WINAPI
d3d9_vertex_declaration
_Release
(
IDirect3DVertexDeclaration9
*
iface
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
declaration
->
ref
);
struct
d3d9_vertex_declaration
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
ULONG
ref
count
=
InterlockedDecrement
(
&
declaration
->
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
count
);
if
(
!
ref
)
if
(
!
ref
count
)
{
IDirect3DDevice9Ex
*
parent
Device
=
declaration
->
parentD
evice
;
IDirect3DDevice9Ex
*
parent
_device
=
declaration
->
parent_d
evice
;
wined3d_mutex_lock
();
wined3d_vertex_declaration_decref
(
declaration
->
wine
D3DVertexD
eclaration
);
wined3d_vertex_declaration_decref
(
declaration
->
wine
d3d_d
eclaration
);
wined3d_mutex_unlock
();
/* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice9Ex_Release
(
parent
D
evice
);
IDirect3DDevice9Ex_Release
(
parent
_d
evice
);
}
return
ref
;
return
refcount
;
}
/* IDirect3DVertexDeclaration9 Interface follow: */
static
HRESULT
WINAPI
IDirect3DVertexDeclaration9Impl_GetDevice
(
IDirect3DVertexDeclaration9
*
iface
,
IDirect3DDevice9
**
device
)
static
HRESULT
WINAPI
d3d9_vertex_declaration_GetDevice
(
IDirect3DVertexDeclaration9
*
iface
,
IDirect3DDevice9
**
device
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
struct
d3d9_vertex_declaration
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
TRACE
(
"iface %p, device %p.
\n
"
,
iface
,
device
);
*
device
=
(
IDirect3DDevice9
*
)
declaration
->
parent
D
evice
;
*
device
=
(
IDirect3DDevice9
*
)
declaration
->
parent
_d
evice
;
IDirect3DDevice9_AddRef
(
*
device
);
TRACE
(
"Returning device %p.
\n
"
,
*
device
);
...
...
@@ -271,10 +269,10 @@ static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_GetDevice(IDirect3DVertexD
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DVertexDeclaration9Impl
_GetDeclaration
(
IDirect3DVertexDeclaration9
*
iface
,
static
HRESULT
WINAPI
d3d9_vertex_declaration
_GetDeclaration
(
IDirect3DVertexDeclaration9
*
iface
,
D3DVERTEXELEMENT9
*
elements
,
UINT
*
element_count
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
struct
d3d9_vertex_declaration
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
TRACE
(
"iface %p, elements %p, element_count %p.
\n
"
,
iface
,
elements
,
element_count
);
...
...
@@ -290,28 +288,28 @@ static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_GetDeclaration(IDirect3DVe
return
D3D_OK
;
}
static
const
IDirect3DVertexDeclaration9Vtbl
Direct3DVertexDeclaration9_V
tbl
=
static
const
struct
IDirect3DVertexDeclaration9Vtbl
d3d9_vertex_declaration_v
tbl
=
{
/* IUnknown */
IDirect3DVertexDeclaration9Impl
_QueryInterface
,
IDirect3DVertexDeclaration9Impl
_AddRef
,
IDirect3DVertexDeclaration9Impl
_Release
,
d3d9_vertex_declaration
_QueryInterface
,
d3d9_vertex_declaration
_AddRef
,
d3d9_vertex_declaration
_Release
,
/* IDirect3DVertexDeclaration9 */
IDirect3DVertexDeclaration9Impl
_GetDevice
,
IDirect3DVertexDeclaration9Impl_GetDeclaration
d3d9_vertex_declaration
_GetDevice
,
d3d9_vertex_declaration_GetDeclaration
,
};
IDirect3DVertexDeclaration9Impl
*
unsafe_impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
struct
d3d9_vertex_declaration
*
unsafe_impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
{
if
(
!
iface
)
return
NULL
;
assert
(
iface
->
lpVtbl
==
&
Direct3DVertexDeclaration9_V
tbl
);
return
CONTAINING_RECORD
(
iface
,
IDirect3DVertexDeclaration9Impl
,
IDirect3DVertexDeclaration9_iface
);
assert
(
iface
->
lpVtbl
==
&
d3d9_vertex_declaration_v
tbl
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d9_vertex_declaration
,
IDirect3DVertexDeclaration9_iface
);
}
static
void
STDMETHODCALLTYPE
d3d9_vertexdeclaration_wined3d_object_destroyed
(
void
*
parent
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
parent
;
struct
d3d9_vertex_declaration
*
declaration
=
parent
;
HeapFree
(
GetProcessHeap
(),
0
,
declaration
->
elements
);
HeapFree
(
GetProcessHeap
(),
0
,
declaration
);
}
...
...
@@ -366,7 +364,7 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elem
return
D3D_OK
;
}
static
HRESULT
vertexdeclaration_init
(
IDirect3DVertexDeclaration9Impl
*
declaration
,
static
HRESULT
vertexdeclaration_init
(
struct
d3d9_vertex_declaration
*
declaration
,
struct
d3d9_device
*
device
,
const
D3DVERTEXELEMENT9
*
elements
)
{
struct
wined3d_vertex_element
*
wined3d_elements
;
...
...
@@ -381,8 +379,8 @@ static HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declarati
return
hr
;
}
declaration
->
IDirect3DVertexDeclaration9_iface
.
lpVtbl
=
&
Direct3DVertexDeclaration9_V
tbl
;
declaration
->
ref
=
1
;
declaration
->
IDirect3DVertexDeclaration9_iface
.
lpVtbl
=
&
d3d9_vertex_declaration_v
tbl
;
declaration
->
ref
count
=
1
;
element_count
=
wined3d_element_count
+
1
;
declaration
->
elements
=
HeapAlloc
(
GetProcessHeap
(),
0
,
element_count
*
sizeof
(
*
declaration
->
elements
));
...
...
@@ -397,7 +395,7 @@ static HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declarati
wined3d_mutex_lock
();
hr
=
wined3d_vertex_declaration_create
(
device
->
wined3d_device
,
wined3d_elements
,
wined3d_element_count
,
declaration
,
&
d3d9_vertexdeclaration_wined3d_parent_ops
,
&
declaration
->
wine
D3DVertexD
eclaration
);
declaration
,
&
d3d9_vertexdeclaration_wined3d_parent_ops
,
&
declaration
->
wine
d3d_d
eclaration
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
wined3d_elements
);
if
(
FAILED
(
hr
))
...
...
@@ -407,16 +405,16 @@ static HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declarati
return
hr
;
}
declaration
->
parent
D
evice
=
&
device
->
IDirect3DDevice9Ex_iface
;
IDirect3DDevice9Ex_AddRef
(
declaration
->
parent
D
evice
);
declaration
->
parent
_d
evice
=
&
device
->
IDirect3DDevice9Ex_iface
;
IDirect3DDevice9Ex_AddRef
(
declaration
->
parent
_d
evice
);
return
D3D_OK
;
}
HRESULT
d3d9_vertex_declaration_create
(
struct
d3d9_device
*
device
,
const
D3DVERTEXELEMENT9
*
elements
,
IDirect3DVertexDeclaration9Impl
**
declaration
)
const
D3DVERTEXELEMENT9
*
elements
,
struct
d3d9_vertex_declaration
**
declaration
)
{
IDirect3DVertexDeclaration9Impl
*
object
;
struct
d3d9_vertex_declaration
*
object
;
HRESULT
hr
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
...
...
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