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
96a74e0c
Commit
96a74e0c
authored
Mar 24, 2014
by
Stefan Dösinger
Committed by
Alexandre Julliard
Mar 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Introduce a resource structure.
parent
f3aa4812
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
32 deletions
+59
-32
buffer.c
dlls/d3d9/buffer.c
+12
-8
d3d9_main.c
dlls/d3d9/d3d9_main.c
+9
-0
d3d9_private.h
dlls/d3d9/d3d9_private.h
+13
-5
device.c
dlls/d3d9/device.c
+1
-1
surface.c
dlls/d3d9/surface.c
+6
-4
texture.c
dlls/d3d9/texture.c
+12
-10
volume.c
dlls/d3d9/volume.c
+6
-4
No files found.
dlls/d3d9/buffer.c
View file @
96a74e0c
...
...
@@ -50,7 +50,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface(IDirect3DVertexBuffer9 *i
static
ULONG
WINAPI
d3d9_vertexbuffer_AddRef
(
IDirect3DVertexBuffer9
*
iface
)
{
struct
d3d9_vertexbuffer
*
buffer
=
impl_from_IDirect3DVertexBuffer9
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
buffer
->
refcount
);
ULONG
refcount
=
InterlockedIncrement
(
&
buffer
->
re
source
.
re
fcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
refcount
);
...
...
@@ -68,7 +68,7 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface)
static
ULONG
WINAPI
d3d9_vertexbuffer_Release
(
IDirect3DVertexBuffer9
*
iface
)
{
struct
d3d9_vertexbuffer
*
buffer
=
impl_from_IDirect3DVertexBuffer9
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
buffer
->
refcount
);
ULONG
refcount
=
InterlockedDecrement
(
&
buffer
->
re
source
.
re
fcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
...
...
@@ -275,7 +275,9 @@ static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl =
static
void
STDMETHODCALLTYPE
d3d9_vertexbuffer_wined3d_object_destroyed
(
void
*
parent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
parent
);
struct
d3d9_vertexbuffer
*
buffer
=
parent
;
d3d9_resource_cleanup
(
&
buffer
->
resource
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
static
const
struct
wined3d_parent_ops
d3d9_vertexbuffer_wined3d_parent_ops
=
...
...
@@ -289,8 +291,8 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *
HRESULT
hr
;
buffer
->
IDirect3DVertexBuffer9_iface
.
lpVtbl
=
&
d3d9_vertexbuffer_vtbl
;
buffer
->
refcount
=
1
;
buffer
->
fvf
=
fvf
;
d3d9_resource_init
(
&
buffer
->
resource
);
wined3d_mutex_lock
();
hr
=
wined3d_buffer_create_vb
(
device
->
wined3d_device
,
size
,
usage
&
WINED3DUSAGE_MASK
,
...
...
@@ -344,7 +346,7 @@ static HRESULT WINAPI d3d9_indexbuffer_QueryInterface(IDirect3DIndexBuffer9 *ifa
static
ULONG
WINAPI
d3d9_indexbuffer_AddRef
(
IDirect3DIndexBuffer9
*
iface
)
{
struct
d3d9_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer9
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
buffer
->
refcount
);
ULONG
refcount
=
InterlockedIncrement
(
&
buffer
->
re
source
.
re
fcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
refcount
);
...
...
@@ -362,7 +364,7 @@ static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface)
static
ULONG
WINAPI
d3d9_indexbuffer_Release
(
IDirect3DIndexBuffer9
*
iface
)
{
struct
d3d9_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer9
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
buffer
->
refcount
);
ULONG
refcount
=
InterlockedDecrement
(
&
buffer
->
re
source
.
re
fcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
...
...
@@ -567,7 +569,9 @@ static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl =
static
void
STDMETHODCALLTYPE
d3d9_indexbuffer_wined3d_object_destroyed
(
void
*
parent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
parent
);
struct
d3d9_indexbuffer
*
buffer
=
parent
;
d3d9_resource_cleanup
(
&
buffer
->
resource
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
static
const
struct
wined3d_parent_ops
d3d9_indexbuffer_wined3d_parent_ops
=
...
...
@@ -581,8 +585,8 @@ HRESULT indexbuffer_init(struct d3d9_indexbuffer *buffer, struct d3d9_device *de
HRESULT
hr
;
buffer
->
IDirect3DIndexBuffer9_iface
.
lpVtbl
=
&
d3d9_indexbuffer_vtbl
;
buffer
->
refcount
=
1
;
buffer
->
format
=
wined3dformat_from_d3dformat
(
format
);
d3d9_resource_init
(
&
buffer
->
resource
);
wined3d_mutex_lock
();
hr
=
wined3d_buffer_create_ib
(
device
->
wined3d_device
,
size
,
usage
&
WINED3DUSAGE_MASK
,
...
...
dlls/d3d9/d3d9_main.c
View file @
96a74e0c
...
...
@@ -162,3 +162,12 @@ void WINAPI D3DPERF_SetRegion(D3DCOLOR color, const WCHAR *name)
{
FIXME
(
"color 0x%08x, name %s stub!
\n
"
,
color
,
debugstr_w
(
name
));
}
void
d3d9_resource_cleanup
(
struct
d3d9_resource
*
resource
)
{
}
void
d3d9_resource_init
(
struct
d3d9_resource
*
resource
)
{
resource
->
refcount
=
1
;
}
dlls/d3d9/d3d9_private.h
View file @
96a74e0c
...
...
@@ -166,10 +166,18 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
,
D3DDISPLAYMODEEX
*
mode
)
DECLSPEC_HIDDEN
;
struct
d3d9_resource
{
LONG
refcount
;
};
void
d3d9_resource_cleanup
(
struct
d3d9_resource
*
resource
)
DECLSPEC_HIDDEN
;
void
d3d9_resource_init
(
struct
d3d9_resource
*
resource
)
DECLSPEC_HIDDEN
;
struct
d3d9_volume
{
IDirect3DVolume9
IDirect3DVolume9_iface
;
LONG
refcount
;
struct
d3d9_resource
resource
;
struct
wined3d_volume
*
wined3d_volume
;
IUnknown
*
container
;
IUnknown
*
forwardReference
;
...
...
@@ -192,7 +200,7 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha
struct
d3d9_surface
{
IDirect3DSurface9
IDirect3DSurface9_iface
;
LONG
refcount
;
struct
d3d9_resource
resource
;
struct
wined3d_surface
*
wined3d_surface
;
IDirect3DDevice9Ex
*
parent_device
;
IUnknown
*
container
;
...
...
@@ -207,7 +215,7 @@ struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface
struct
d3d9_vertexbuffer
{
IDirect3DVertexBuffer9
IDirect3DVertexBuffer9_iface
;
LONG
refcount
;
struct
d3d9_resource
resource
;
struct
wined3d_buffer
*
wined3d_buffer
;
IDirect3DDevice9Ex
*
parent_device
;
DWORD
fvf
;
...
...
@@ -220,7 +228,7 @@ struct d3d9_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVerte
struct
d3d9_indexbuffer
{
IDirect3DIndexBuffer9
IDirect3DIndexBuffer9_iface
;
LONG
refcount
;
struct
d3d9_resource
resource
;
struct
wined3d_buffer
*
wined3d_buffer
;
IDirect3DDevice9Ex
*
parent_device
;
enum
wined3d_format_id
format
;
...
...
@@ -233,7 +241,7 @@ struct d3d9_indexbuffer *unsafe_impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBu
struct
d3d9_texture
{
IDirect3DBaseTexture9
IDirect3DBaseTexture9_iface
;
LONG
refcount
;
struct
d3d9_resource
resource
;
struct
wined3d_texture
*
wined3d_texture
;
IDirect3DDevice9Ex
*
parent_device
;
};
...
...
dlls/d3d9/device.c
View file @
96a74e0c
...
...
@@ -581,7 +581,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
}
surface
=
wined3d_resource_get_parent
(
resource
);
if
(
surface
->
refcount
)
if
(
surface
->
re
source
.
re
fcount
)
{
WARN
(
"Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
surface
,
resource
);
return
D3DERR_INVALIDCALL
;
...
...
dlls/d3d9/surface.c
View file @
96a74e0c
...
...
@@ -61,7 +61,7 @@ static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
return
IUnknown_AddRef
(
surface
->
forwardReference
);
}
refcount
=
InterlockedIncrement
(
&
surface
->
refcount
);
refcount
=
InterlockedIncrement
(
&
surface
->
re
source
.
re
fcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
refcount
==
1
)
...
...
@@ -89,7 +89,7 @@ static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
return
IUnknown_Release
(
surface
->
forwardReference
);
}
refcount
=
InterlockedDecrement
(
&
surface
->
refcount
);
refcount
=
InterlockedDecrement
(
&
surface
->
re
source
.
re
fcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
...
...
@@ -385,7 +385,9 @@ static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl =
static
void
STDMETHODCALLTYPE
surface_wined3d_object_destroyed
(
void
*
parent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
parent
);
struct
d3d9_surface
*
surface
=
parent
;
d3d9_resource_cleanup
(
&
surface
->
resource
);
HeapFree
(
GetProcessHeap
(),
0
,
surface
);
}
static
const
struct
wined3d_parent_ops
d3d9_surface_wined3d_parent_ops
=
...
...
@@ -399,7 +401,7 @@ void surface_init(struct d3d9_surface *surface, struct wined3d_surface *wined3d_
struct
wined3d_resource_desc
desc
;
surface
->
IDirect3DSurface9_iface
.
lpVtbl
=
&
d3d9_surface_vtbl
;
surface
->
refcount
=
1
;
d3d9_resource_init
(
&
surface
->
resource
)
;
wined3d_resource_get_desc
(
wined3d_surface_get_resource
(
wined3d_surface
),
&
desc
);
switch
(
d3dformat_from_wined3dformat
(
desc
.
format
))
...
...
dlls/d3d9/texture.c
View file @
96a74e0c
...
...
@@ -61,7 +61,7 @@ static HRESULT WINAPI d3d9_texture_2d_QueryInterface(IDirect3DTexture9 *iface, R
static
ULONG
WINAPI
d3d9_texture_2d_AddRef
(
IDirect3DTexture9
*
iface
)
{
struct
d3d9_texture
*
texture
=
impl_from_IDirect3DTexture9
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
refcount
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
re
source
.
re
fcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
...
...
@@ -79,7 +79,7 @@ static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface)
static
ULONG
WINAPI
d3d9_texture_2d_Release
(
IDirect3DTexture9
*
iface
)
{
struct
d3d9_texture
*
texture
=
impl_from_IDirect3DTexture9
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
refcount
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
re
source
.
re
fcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
...
...
@@ -472,7 +472,7 @@ static HRESULT WINAPI d3d9_texture_cube_QueryInterface(IDirect3DCubeTexture9 *if
static
ULONG
WINAPI
d3d9_texture_cube_AddRef
(
IDirect3DCubeTexture9
*
iface
)
{
struct
d3d9_texture
*
texture
=
impl_from_IDirect3DCubeTexture9
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
refcount
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
re
source
.
re
fcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
...
...
@@ -490,7 +490,7 @@ static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface)
static
ULONG
WINAPI
d3d9_texture_cube_Release
(
IDirect3DCubeTexture9
*
iface
)
{
struct
d3d9_texture
*
texture
=
impl_from_IDirect3DCubeTexture9
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
refcount
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
re
source
.
re
fcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
...
...
@@ -911,7 +911,7 @@ static HRESULT WINAPI d3d9_texture_3d_QueryInterface(IDirect3DVolumeTexture9 *if
static
ULONG
WINAPI
d3d9_texture_3d_AddRef
(
IDirect3DVolumeTexture9
*
iface
)
{
struct
d3d9_texture
*
texture
=
impl_from_IDirect3DVolumeTexture9
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
refcount
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
re
source
.
re
fcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
...
...
@@ -929,7 +929,7 @@ static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface)
static
ULONG
WINAPI
d3d9_texture_3d_Release
(
IDirect3DVolumeTexture9
*
iface
)
{
struct
d3d9_texture
*
texture
=
impl_from_IDirect3DVolumeTexture9
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
refcount
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
re
source
.
re
fcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
...
...
@@ -1298,7 +1298,9 @@ struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture
static
void
STDMETHODCALLTYPE
d3d9_texture_wined3d_object_destroyed
(
void
*
parent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
parent
);
struct
d3d9_texture
*
texture
=
parent
;
d3d9_resource_cleanup
(
&
texture
->
resource
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
}
static
const
struct
wined3d_parent_ops
d3d9_texture_wined3d_parent_ops
=
...
...
@@ -1314,7 +1316,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
HRESULT
hr
;
texture
->
IDirect3DBaseTexture9_iface
.
lpVtbl
=
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_2d_vtbl
;
texture
->
refcount
=
1
;
d3d9_resource_init
(
&
texture
->
resource
)
;
desc
.
resource_type
=
WINED3D_RTYPE_TEXTURE
;
desc
.
format
=
wined3dformat_from_d3dformat
(
format
);
...
...
@@ -1355,7 +1357,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
HRESULT
hr
;
texture
->
IDirect3DBaseTexture9_iface
.
lpVtbl
=
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_cube_vtbl
;
texture
->
refcount
=
1
;
d3d9_resource_init
(
&
texture
->
resource
)
;
desc
.
resource_type
=
WINED3D_RTYPE_CUBE_TEXTURE
;
desc
.
format
=
wined3dformat_from_d3dformat
(
format
);
...
...
@@ -1395,7 +1397,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
HRESULT
hr
;
texture
->
IDirect3DBaseTexture9_iface
.
lpVtbl
=
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_3d_vtbl
;
texture
->
refcount
=
1
;
d3d9_resource_init
(
&
texture
->
resource
)
;
desc
.
resource_type
=
WINED3D_RTYPE_VOLUME_TEXTURE
;
desc
.
format
=
wined3dformat_from_d3dformat
(
format
);
...
...
dlls/d3d9/volume.c
View file @
96a74e0c
...
...
@@ -60,7 +60,7 @@ static ULONG WINAPI d3d9_volume_AddRef(IDirect3DVolume9 *iface)
return
IUnknown_AddRef
(
volume
->
forwardReference
);
}
refcount
=
InterlockedIncrement
(
&
volume
->
refcount
);
refcount
=
InterlockedIncrement
(
&
volume
->
re
source
.
re
fcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
refcount
==
1
)
...
...
@@ -86,7 +86,7 @@ static ULONG WINAPI d3d9_volume_Release(IDirect3DVolume9 *iface)
return
IUnknown_Release
(
volume
->
forwardReference
);
}
refcount
=
InterlockedDecrement
(
&
volume
->
refcount
);
refcount
=
InterlockedDecrement
(
&
volume
->
re
source
.
re
fcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
...
...
@@ -266,7 +266,9 @@ static const struct IDirect3DVolume9Vtbl d3d9_volume_vtbl =
static
void
STDMETHODCALLTYPE
volume_wined3d_object_destroyed
(
void
*
parent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
parent
);
struct
d3d9_volume
*
volume
=
parent
;
d3d9_resource_cleanup
(
&
volume
->
resource
);
HeapFree
(
GetProcessHeap
(),
0
,
volume
);
}
static
const
struct
wined3d_parent_ops
d3d9_volume_wined3d_parent_ops
=
...
...
@@ -278,7 +280,7 @@ void volume_init(struct d3d9_volume *volume, struct wined3d_volume *wined3d_volu
const
struct
wined3d_parent_ops
**
parent_ops
)
{
volume
->
IDirect3DVolume9_iface
.
lpVtbl
=
&
d3d9_volume_vtbl
;
volume
->
refcount
=
1
;
d3d9_resource_init
(
&
volume
->
resource
)
;
wined3d_volume_incref
(
wined3d_volume
);
volume
->
wined3d_volume
=
wined3d_volume
;
...
...
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