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
949f7b45
Commit
949f7b45
authored
Apr 12, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: COM cleanup for the IDirect3DVertexDeclaration9 interface.
parent
81ed6e0c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
32 deletions
+48
-32
buffer.c
dlls/d3d9/buffer.c
+0
-1
d3d9_private.h
dlls/d3d9/d3d9_private.h
+4
-1
device.c
dlls/d3d9/device.c
+6
-5
shader.c
dlls/d3d9/shader.c
+0
-1
surface.c
dlls/d3d9/surface.c
+0
-1
vertexdeclaration.c
dlls/d3d9/vertexdeclaration.c
+38
-23
No files found.
dlls/d3d9/buffer.c
View file @
949f7b45
...
...
@@ -19,7 +19,6 @@
*/
#include "config.h"
#include <assert.h>
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d9
);
...
...
dlls/d3d9/d3d9_private.h
View file @
949f7b45
...
...
@@ -23,6 +23,7 @@
#ifndef __WINE_D3D9_PRIVATE_H
#define __WINE_D3D9_PRIVATE_H
#include <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
...
...
@@ -386,7 +387,7 @@ HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Im
*/
typedef
struct
IDirect3DVertexDeclaration9Impl
{
/* IUnknown fields */
const
IDirect3DVertexDeclaration9Vtbl
*
lpVtbl
;
IDirect3DVertexDeclaration9
IDirect3DVertexDeclaration9_iface
;
LONG
ref
;
D3DVERTEXELEMENT9
*
elements
;
...
...
@@ -402,6 +403,8 @@ typedef struct IDirect3DVertexDeclaration9Impl {
HRESULT
d3d9_vertex_declaration_create
(
IDirect3DDevice9Impl
*
device
,
const
D3DVERTEXELEMENT9
*
elements
,
IDirect3DVertexDeclaration9Impl
**
declaration
)
DECLSPEC_HIDDEN
;
IDirect3DVertexDeclaration9Impl
*
unsafe_impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
DECLSPEC_HIDDEN
;
/* ---------------------- */
/* IDirect3DVertexShader9 */
...
...
dlls/d3d9/device.c
View file @
949f7b45
...
...
@@ -2058,7 +2058,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(IDirect3DDevice9Ex *i
{
IDirect3DDevice9Impl
*
This
=
impl_from_IDirect3DDevice9Ex
(
iface
);
IDirect3DVertexBuffer9Impl
*
dest
=
unsafe_impl_from_IDirect3DVertexBuffer9
(
pDestBuffer
);
IDirect3DVertexDeclaration9Impl
*
Decl
=
(
IDirect3DVertexDeclaration9Impl
*
)
pVertexDecl
;
IDirect3DVertexDeclaration9Impl
*
Decl
=
unsafe_impl_from_IDirect3DVertexDeclaration9
(
pVertexDecl
)
;
HRESULT
hr
;
TRACE
(
"iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, declaration %p, flags %#x.
\n
"
,
...
...
@@ -2088,7 +2088,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(IDirect3DDevi
}
if
(
SUCCEEDED
(
hr
=
d3d9_vertex_declaration_create
(
device
,
elements
,
&
object
)))
*
declaration
=
(
IDirect3DVertexDeclaration9
*
)
object
;
*
declaration
=
&
object
->
IDirect3DVertexDeclaration9_iface
;
return
hr
;
}
...
...
@@ -2097,13 +2097,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(IDirect3DDevice9
IDirect3DVertexDeclaration9
*
declaration
)
{
IDirect3DDevice9Impl
*
This
=
impl_from_IDirect3DDevice9Ex
(
iface
);
IDirect3DVertexDeclaration9Impl
*
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
(
This
->
wined3d_device
,
decl
aration
?
((
IDirect3DVertexDeclaration9Impl
*
)
declaration
)
->
wineD3DVertexDeclaration
:
NULL
);
decl
_impl
?
decl_impl
->
wineD3DVertexDeclaration
:
NULL
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -2184,7 +2185,7 @@ static struct wined3d_vertex_declaration *device_get_fvf_declaration(IDirect3DDe
fvf_decls
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
fvf_decls
,
sizeof
(
*
fvf_decls
)
*
(
device
->
fvf_decl_size
+
grow
));
if
(
!
fvf_decls
)
{
IDirect3DVertexDeclaration9_Release
(
(
IDirect3DVertexDeclaration9
*
)
d3d9_declaration
);
IDirect3DVertexDeclaration9_Release
(
&
d3d9_declaration
->
IDirect3DVertexDeclaration9_iface
);
return
NULL
;
}
device
->
fvf_decls
=
fvf_decls
;
...
...
@@ -2194,7 +2195,7 @@ static struct wined3d_vertex_declaration *device_get_fvf_declaration(IDirect3DDe
d3d9_declaration
->
convFVF
=
fvf
;
wined3d_declaration
=
d3d9_declaration
->
wineD3DVertexDeclaration
;
wined3d_vertex_declaration_incref
(
wined3d_declaration
);
IDirect3DVertexDeclaration9_Release
(
(
IDirect3DVertexDeclaration9
*
)
d3d9_declaration
);
IDirect3DVertexDeclaration9_Release
(
&
d3d9_declaration
->
IDirect3DVertexDeclaration9_iface
);
memmove
(
fvf_decls
+
low
+
1
,
fvf_decls
+
low
,
sizeof
(
*
fvf_decls
)
*
(
device
->
fvf_decl_count
-
low
));
fvf_decls
[
low
].
decl
=
wined3d_declaration
;
...
...
dlls/d3d9/shader.c
View file @
949f7b45
...
...
@@ -18,7 +18,6 @@
*/
#include "config.h"
#include <assert.h>
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d9
);
...
...
dlls/d3d9/surface.c
View file @
949f7b45
...
...
@@ -20,7 +20,6 @@
*/
#include "config.h"
#include <assert.h>
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d9
);
...
...
dlls/d3d9/vertexdeclaration.c
View file @
949f7b45
...
...
@@ -53,6 +53,11 @@ static D3DDECLTYPE_INFO const d3d_dtype_lookup[D3DDECLTYPE_UNUSED] = {
#define D3D_DECL_SIZE(type) d3d_dtype_lookup[type].size
#define D3D_DECL_TYPESIZE(type) d3d_dtype_lookup[type].typesize
static
inline
IDirect3DVertexDeclaration9Impl
*
impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirect3DVertexDeclaration9Impl
,
IDirect3DVertexDeclaration9_iface
);
}
HRESULT
vdecl_convert_fvf
(
DWORD
fvf
,
D3DVERTEXELEMENT9
**
ppVertexElements
)
{
...
...
@@ -213,34 +218,36 @@ static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_QueryInterface(IDirect3DVe
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
IDirect3DVertexDeclaration9Impl_AddRef
(
LPDIRECT3DVERTEXDECLARATION9
iface
)
{
IDirect3DVertexDeclaration9Impl
*
This
=
(
IDirect3DVertexDeclaration9Impl
*
)
iface
;
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
static
ULONG
WINAPI
IDirect3DVertexDeclaration9Impl_AddRef
(
IDirect3DVertexDeclaration9
*
iface
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
declaration
->
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
ref
==
1
)
{
IDirect3DDevice9Ex_AddRef
(
This
->
parentDevice
);
IDirect3DDevice9Ex_AddRef
(
declaration
->
parentDevice
);
wined3d_mutex_lock
();
wined3d_vertex_declaration_incref
(
This
->
wineD3DVertexDeclaration
);
wined3d_vertex_declaration_incref
(
declaration
->
wineD3DVertexDeclaration
);
wined3d_mutex_unlock
();
}
return
ref
;
}
static
ULONG
WINAPI
IDirect3DVertexDeclaration9Impl_Release
(
LPDIRECT3DVERTEXDECLARATION9
iface
)
{
IDirect3DVertexDeclaration9Impl
*
This
=
(
IDirect3DVertexDeclaration9Impl
*
)
iface
;
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
static
ULONG
WINAPI
IDirect3DVertexDeclaration9Impl_Release
(
IDirect3DVertexDeclaration9
*
iface
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
declaration
->
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
IDirect3DDevice9Ex
*
parentDevice
=
This
->
parentDevice
;
IDirect3DDevice9Ex
*
parentDevice
=
declaration
->
parentDevice
;
wined3d_mutex_lock
();
wined3d_vertex_declaration_decref
(
This
->
wineD3DVertexDeclaration
);
wined3d_vertex_declaration_decref
(
declaration
->
wineD3DVertexDeclaration
);
wined3d_mutex_unlock
();
/* Release the device last, as it may cause the device to be destroyed. */
...
...
@@ -253,11 +260,11 @@ static ULONG WINAPI IDirect3DVertexDeclaration9Impl_Release(LPDIRECT3DVERTEXDECL
static
HRESULT
WINAPI
IDirect3DVertexDeclaration9Impl_GetDevice
(
IDirect3DVertexDeclaration9
*
iface
,
IDirect3DDevice9
**
device
)
{
IDirect3DVertexDeclaration9Impl
*
This
=
(
IDirect3DVertexDeclaration9Impl
*
)
iface
;
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
)
;
TRACE
(
"iface %p, device %p.
\n
"
,
iface
,
device
);
*
device
=
(
IDirect3DDevice9
*
)
This
->
parentDevice
;
*
device
=
(
IDirect3DDevice9
*
)
declaration
->
parentDevice
;
IDirect3DDevice9_AddRef
(
*
device
);
TRACE
(
"Returning device %p.
\n
"
,
*
device
);
...
...
@@ -265,21 +272,21 @@ static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_GetDevice(IDirect3DVertexD
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DVertexDeclaration9Impl_GetDeclaration
(
LPDIRECT3DVERTEXDECLARATION9
iface
,
D3DVERTEXELEMENT9
*
pDecl
,
UINT
*
pNumElements
)
{
IDirect3DVertexDeclaration9Impl
*
This
=
(
IDirect3DVertexDeclaration9Impl
*
)
iface
;
static
HRESULT
WINAPI
IDirect3DVertexDeclaration9Impl_GetDeclaration
(
IDirect3DVertexDeclaration9
*
iface
,
D3DVERTEXELEMENT9
*
elements
,
UINT
*
element_count
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
impl_from_IDirect3DVertexDeclaration9
(
iface
);
TRACE
(
"iface %p, elements %p, element_count %p.
\n
"
,
iface
,
pDecl
,
pNumElements
);
TRACE
(
"iface %p, elements %p, element_count %p.
\n
"
,
iface
,
elements
,
element_count
);
*
pNumElements
=
This
->
element_count
;
*
element_count
=
declaration
->
element_count
;
/* Passing a NULL pDecl is used to just retrieve the number of elements */
if
(
!
pDecl
)
{
TRACE
(
"NULL pDecl passed. Returning D3D_OK.
\n
"
);
/* Passing a NULL elements is used to just retrieve the number of elements */
if
(
!
elements
)
return
D3D_OK
;
}
TRACE
(
"Copying %p to %p
\n
"
,
This
->
elements
,
pDecl
);
CopyMemory
(
pDecl
,
This
->
elements
,
This
->
element_count
*
sizeof
(
D3DVERTEXELEMENT9
)
);
TRACE
(
"Copying %p to %p
.
\n
"
,
declaration
->
elements
,
elements
);
memcpy
(
elements
,
declaration
->
elements
,
sizeof
(
*
declaration
->
elements
)
*
declaration
->
element_count
);
return
D3D_OK
;
}
...
...
@@ -295,6 +302,14 @@ static const IDirect3DVertexDeclaration9Vtbl Direct3DVertexDeclaration9_Vtbl =
IDirect3DVertexDeclaration9Impl_GetDeclaration
};
IDirect3DVertexDeclaration9Impl
*
unsafe_impl_from_IDirect3DVertexDeclaration9
(
IDirect3DVertexDeclaration9
*
iface
)
{
if
(
!
iface
)
return
NULL
;
assert
(
iface
->
lpVtbl
==
&
Direct3DVertexDeclaration9_Vtbl
);
return
CONTAINING_RECORD
(
iface
,
IDirect3DVertexDeclaration9Impl
,
IDirect3DVertexDeclaration9_iface
);
}
static
void
STDMETHODCALLTYPE
d3d9_vertexdeclaration_wined3d_object_destroyed
(
void
*
parent
)
{
IDirect3DVertexDeclaration9Impl
*
declaration
=
parent
;
...
...
@@ -367,7 +382,7 @@ static HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declarati
return
hr
;
}
declaration
->
lpVtbl
=
&
Direct3DVertexDeclaration9_Vtbl
;
declaration
->
IDirect3DVertexDeclaration9_iface
.
lpVtbl
=
&
Direct3DVertexDeclaration9_Vtbl
;
declaration
->
ref
=
1
;
element_count
=
wined3d_element_count
+
1
;
...
...
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