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
27ca37db
Commit
27ca37db
authored
May 21, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
May 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Get rid of IDirect3DIndexBuffer8Impl.
parent
9b085a92
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
54 deletions
+46
-54
buffer.c
dlls/d3d8/buffer.c
+36
-36
d3d8_private.h
dlls/d3d8/d3d8_private.h
+6
-14
device.c
dlls/d3d8/device.c
+4
-4
No files found.
dlls/d3d8/buffer.c
View file @
27ca37db
...
...
@@ -316,9 +316,9 @@ IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVer
return
impl_from_IDirect3DVertexBuffer8
(
iface
);
}
static
inline
IDirect3DIndexBuffer8Impl
*
impl_from_IDirect3DIndexBuffer8
(
IDirect3DIndexBuffer8
*
iface
)
static
inline
struct
d3d8_indexbuffer
*
impl_from_IDirect3DIndexBuffer8
(
IDirect3DIndexBuffer8
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirect3DIndexBuffer8Impl
,
IDirect3DIndexBuffer8_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d8_indexbuffer
,
IDirect3DIndexBuffer8_iface
);
}
static
HRESULT
WINAPI
d3d8_indexbuffer_QueryInterface
(
IDirect3DIndexBuffer8
*
iface
,
REFIID
riid
,
void
**
object
)
...
...
@@ -342,16 +342,16 @@ static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *ifa
static
ULONG
WINAPI
d3d8_indexbuffer_AddRef
(
IDirect3DIndexBuffer8
*
iface
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
buffer
->
ref
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
buffer
->
ref
count
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
refcount
==
1
)
{
IDirect3DDevice8_AddRef
(
buffer
->
parent
D
evice
);
IDirect3DDevice8_AddRef
(
buffer
->
parent
_d
evice
);
wined3d_mutex_lock
();
wined3d_buffer_incref
(
buffer
->
wine
D3DIndexB
uffer
);
wined3d_buffer_incref
(
buffer
->
wine
d3d_b
uffer
);
wined3d_mutex_unlock
();
}
...
...
@@ -360,17 +360,17 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface)
static
ULONG
WINAPI
d3d8_indexbuffer_Release
(
IDirect3DIndexBuffer8
*
iface
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
buffer
->
ref
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
buffer
->
ref
count
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
{
IDirect3DDevice8
*
device
=
buffer
->
parent
D
evice
;
IDirect3DDevice8
*
device
=
buffer
->
parent
_d
evice
;
wined3d_mutex_lock
();
wined3d_buffer_decref
(
buffer
->
wine
D3DIndexB
uffer
);
wined3d_buffer_decref
(
buffer
->
wine
d3d_b
uffer
);
wined3d_mutex_unlock
();
/* Release the device last, as it may cause the device to be destroyed. */
...
...
@@ -383,11 +383,11 @@ static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface)
static
HRESULT
WINAPI
d3d8_indexbuffer_GetDevice
(
IDirect3DIndexBuffer8
*
iface
,
IDirect3DDevice8
**
device
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
TRACE
(
"iface %p, device %p.
\n
"
,
iface
,
device
);
*
device
=
buffer
->
parent
D
evice
;
*
device
=
buffer
->
parent
_d
evice
;
IDirect3DDevice8_AddRef
(
*
device
);
TRACE
(
"Returning device %p.
\n
"
,
*
device
);
...
...
@@ -398,7 +398,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetDevice(IDirect3DIndexBuffer8 *iface,
static
HRESULT
WINAPI
d3d8_indexbuffer_SetPrivateData
(
IDirect3DIndexBuffer8
*
iface
,
REFGUID
guid
,
const
void
*
data
,
DWORD
data_size
,
DWORD
flags
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
wined3d_resource
*
resource
;
HRESULT
hr
;
...
...
@@ -406,7 +406,7 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa
iface
,
debugstr_guid
(
guid
),
data
,
data_size
,
flags
);
wined3d_mutex_lock
();
resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
D3DIndexB
uffer
);
resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
d3d_b
uffer
);
hr
=
wined3d_resource_set_private_data
(
resource
,
guid
,
data
,
data_size
,
flags
);
wined3d_mutex_unlock
();
...
...
@@ -416,7 +416,7 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa
static
HRESULT
WINAPI
d3d8_indexbuffer_GetPrivateData
(
IDirect3DIndexBuffer8
*
iface
,
REFGUID
guid
,
void
*
data
,
DWORD
*
data_size
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
wined3d_resource
*
resource
;
HRESULT
hr
;
...
...
@@ -424,7 +424,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *ifa
iface
,
debugstr_guid
(
guid
),
data
,
data_size
);
wined3d_mutex_lock
();
resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
D3DIndexB
uffer
);
resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
d3d_b
uffer
);
hr
=
wined3d_resource_get_private_data
(
resource
,
guid
,
data
,
data_size
);
wined3d_mutex_unlock
();
...
...
@@ -433,14 +433,14 @@ static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *ifa
static
HRESULT
WINAPI
d3d8_indexbuffer_FreePrivateData
(
IDirect3DIndexBuffer8
*
iface
,
REFGUID
guid
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
wined3d_resource
*
resource
;
HRESULT
hr
;
TRACE
(
"iface %p, guid %s.
\n
"
,
iface
,
debugstr_guid
(
guid
));
wined3d_mutex_lock
();
resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
D3DIndexB
uffer
);
resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
d3d_b
uffer
);
hr
=
wined3d_resource_free_private_data
(
resource
,
guid
);
wined3d_mutex_unlock
();
...
...
@@ -449,13 +449,13 @@ static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *if
static
DWORD
WINAPI
d3d8_indexbuffer_SetPriority
(
IDirect3DIndexBuffer8
*
iface
,
DWORD
priority
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
DWORD
previous
;
TRACE
(
"iface %p, priority %u.
\n
"
,
iface
,
priority
);
wined3d_mutex_lock
();
previous
=
wined3d_buffer_set_priority
(
buffer
->
wine
D3DIndexB
uffer
,
priority
);
previous
=
wined3d_buffer_set_priority
(
buffer
->
wine
d3d_b
uffer
,
priority
);
wined3d_mutex_unlock
();
return
previous
;
...
...
@@ -463,13 +463,13 @@ static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, D
static
DWORD
WINAPI
d3d8_indexbuffer_GetPriority
(
IDirect3DIndexBuffer8
*
iface
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
DWORD
priority
;
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
priority
=
wined3d_buffer_get_priority
(
buffer
->
wine
D3DIndexB
uffer
);
priority
=
wined3d_buffer_get_priority
(
buffer
->
wine
d3d_b
uffer
);
wined3d_mutex_unlock
();
return
priority
;
...
...
@@ -477,12 +477,12 @@ static DWORD WINAPI d3d8_indexbuffer_GetPriority(IDirect3DIndexBuffer8 *iface)
static
void
WINAPI
d3d8_indexbuffer_PreLoad
(
IDirect3DIndexBuffer8
*
iface
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
wined3d_buffer_preload
(
buffer
->
wine
D3DIndexB
uffer
);
wined3d_buffer_preload
(
buffer
->
wine
d3d_b
uffer
);
wined3d_mutex_unlock
();
}
...
...
@@ -496,14 +496,14 @@ static D3DRESOURCETYPE WINAPI d3d8_indexbuffer_GetType(IDirect3DIndexBuffer8 *if
static
HRESULT
WINAPI
d3d8_indexbuffer_Lock
(
IDirect3DIndexBuffer8
*
iface
,
UINT
offset
,
UINT
size
,
BYTE
**
data
,
DWORD
flags
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p, offset %u, size %u, data %p, flags %#x.
\n
"
,
iface
,
offset
,
size
,
data
,
flags
);
wined3d_mutex_lock
();
hr
=
wined3d_buffer_map
(
buffer
->
wine
D3DIndexB
uffer
,
offset
,
size
,
data
,
flags
);
hr
=
wined3d_buffer_map
(
buffer
->
wine
d3d_b
uffer
,
offset
,
size
,
data
,
flags
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -511,12 +511,12 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, UINT o
static
HRESULT
WINAPI
d3d8_indexbuffer_Unlock
(
IDirect3DIndexBuffer8
*
iface
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
wined3d_buffer_unmap
(
buffer
->
wine
D3DIndexB
uffer
);
wined3d_buffer_unmap
(
buffer
->
wine
d3d_b
uffer
);
wined3d_mutex_unlock
();
return
D3D_OK
;
...
...
@@ -525,14 +525,14 @@ static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface)
static
HRESULT
WINAPI
d3d8_indexbuffer_GetDesc
(
IDirect3DIndexBuffer8
*
iface
,
D3DINDEXBUFFER_DESC
*
desc
)
{
IDirect3DIndexBuffer8Impl
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
d3d8_indexbuffer
*
buffer
=
impl_from_IDirect3DIndexBuffer8
(
iface
);
struct
wined3d_resource_desc
wined3d_desc
;
struct
wined3d_resource
*
wined3d_resource
;
TRACE
(
"iface %p, desc %p.
\n
"
,
iface
,
desc
);
wined3d_mutex_lock
();
wined3d_resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
D3DIndexB
uffer
);
wined3d_resource
=
wined3d_buffer_get_resource
(
buffer
->
wine
d3d_b
uffer
);
wined3d_resource_get_desc
(
wined3d_resource
,
&
wined3d_desc
);
wined3d_mutex_unlock
();
...
...
@@ -576,18 +576,18 @@ static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops =
d3d8_indexbuffer_wined3d_object_destroyed
,
};
HRESULT
indexbuffer_init
(
IDirect3DIndexBuffer8Impl
*
buffer
,
struct
d3d8_device
*
device
,
HRESULT
indexbuffer_init
(
struct
d3d8_indexbuffer
*
buffer
,
struct
d3d8_device
*
device
,
UINT
size
,
DWORD
usage
,
D3DFORMAT
format
,
D3DPOOL
pool
)
{
HRESULT
hr
;
buffer
->
IDirect3DIndexBuffer8_iface
.
lpVtbl
=
&
d3d8_indexbuffer_vtbl
;
buffer
->
ref
=
1
;
buffer
->
ref
count
=
1
;
buffer
->
format
=
wined3dformat_from_d3dformat
(
format
);
wined3d_mutex_lock
();
hr
=
wined3d_buffer_create_ib
(
device
->
wined3d_device
,
size
,
usage
&
WINED3DUSAGE_MASK
,
(
enum
wined3d_pool
)
pool
,
buffer
,
&
d3d8_indexbuffer_wined3d_parent_ops
,
&
buffer
->
wine
D3DIndexB
uffer
);
(
enum
wined3d_pool
)
pool
,
buffer
,
&
d3d8_indexbuffer_wined3d_parent_ops
,
&
buffer
->
wine
d3d_b
uffer
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
...
...
@@ -595,13 +595,13 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, struct d3d8_device *
return
hr
;
}
buffer
->
parent
D
evice
=
&
device
->
IDirect3DDevice8_iface
;
IUnknown_AddRef
(
buffer
->
parent
D
evice
);
buffer
->
parent
_d
evice
=
&
device
->
IDirect3DDevice8_iface
;
IUnknown_AddRef
(
buffer
->
parent
_d
evice
);
return
D3D_OK
;
}
IDirect3DIndexBuffer8Impl
*
unsafe_impl_from_IDirect3DIndexBuffer8
(
IDirect3DIndexBuffer8
*
iface
)
struct
d3d8_indexbuffer
*
unsafe_impl_from_IDirect3DIndexBuffer8
(
IDirect3DIndexBuffer8
*
iface
)
{
if
(
!
iface
)
return
NULL
;
...
...
dlls/d3d8/d3d8_private.h
View file @
27ca37db
...
...
@@ -100,7 +100,6 @@
void
fixup_caps
(
WINED3DCAPS
*
pWineCaps
)
DECLSPEC_HIDDEN
;
typedef
struct
IDirect3DIndexBuffer8Impl
IDirect3DIndexBuffer8Impl
;
typedef
struct
IDirect3DSurface8Impl
IDirect3DSurface8Impl
;
typedef
struct
IDirect3DSwapChain8Impl
IDirect3DSwapChain8Impl
;
typedef
struct
IDirect3DVolume8Impl
IDirect3DVolume8Impl
;
...
...
@@ -256,25 +255,18 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, struct d3d8_device
UINT
size
,
DWORD
usage
,
DWORD
fvf
,
D3DPOOL
pool
)
DECLSPEC_HIDDEN
;
IDirect3DVertexBuffer8Impl
*
unsafe_impl_from_IDirect3DVertexBuffer8
(
IDirect3DVertexBuffer8
*
iface
)
DECLSPEC_HIDDEN
;
/* --------------------- */
/* IDirect3DIndexBuffer8 */
/* --------------------- */
/*****************************************************************************
* IDirect3DIndexBuffer8 implementation structure
*/
struct
IDirect3DIndexBuffer8Impl
struct
d3d8_indexbuffer
{
IDirect3DIndexBuffer8
IDirect3DIndexBuffer8_iface
;
LONG
ref
;
struct
wined3d_buffer
*
wine
D3DIndexB
uffer
;
IDirect3DDevice8
*
parent
D
evice
;
LONG
ref
count
;
struct
wined3d_buffer
*
wine
d3d_b
uffer
;
IDirect3DDevice8
*
parent
_d
evice
;
enum
wined3d_format_id
format
;
};
HRESULT
indexbuffer_init
(
IDirect3DIndexBuffer8Impl
*
buffer
,
struct
d3d8_device
*
device
,
HRESULT
indexbuffer_init
(
struct
d3d8_indexbuffer
*
buffer
,
struct
d3d8_device
*
device
,
UINT
size
,
DWORD
usage
,
D3DFORMAT
format
,
D3DPOOL
pool
)
DECLSPEC_HIDDEN
;
IDirect3DIndexBuffer8Impl
*
unsafe_impl_from_IDirect3DIndexBuffer8
(
IDirect3DIndexBuffer8
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d8_indexbuffer
*
unsafe_impl_from_IDirect3DIndexBuffer8
(
IDirect3DIndexBuffer8
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d8_texture
{
...
...
dlls/d3d8/device.c
View file @
27ca37db
...
...
@@ -804,7 +804,7 @@ static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UIN
DWORD
usage
,
D3DFORMAT
format
,
D3DPOOL
pool
,
IDirect3DIndexBuffer8
**
buffer
)
{
struct
d3d8_device
*
device
=
impl_from_IDirect3DDevice8
(
iface
);
IDirect3DIndexBuffer8Impl
*
object
;
struct
d3d8_indexbuffer
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, size %u, usage %#x, format %#x, pool %#x, buffer %p.
\n
"
,
...
...
@@ -2325,7 +2325,7 @@ static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface,
IDirect3DIndexBuffer8
*
buffer
,
UINT
base_vertex_idx
)
{
struct
d3d8_device
*
device
=
impl_from_IDirect3DDevice8
(
iface
);
IDirect3DIndexBuffer8Impl
*
ib
=
unsafe_impl_from_IDirect3DIndexBuffer8
(
buffer
);
struct
d3d8_indexbuffer
*
ib
=
unsafe_impl_from_IDirect3DIndexBuffer8
(
buffer
);
HRESULT
hr
;
TRACE
(
"iface %p, buffer %p, base_vertex_idx %u.
\n
"
,
iface
,
buffer
,
base_vertex_idx
);
...
...
@@ -2339,7 +2339,7 @@ static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface,
wined3d_mutex_lock
();
wined3d_device_set_base_vertex_index
(
device
->
wined3d_device
,
base_vertex_idx
);
hr
=
wined3d_device_set_index_buffer
(
device
->
wined3d_device
,
ib
?
ib
->
wine
D3DIndexB
uffer
:
NULL
,
ib
?
ib
->
wine
d3d_b
uffer
:
NULL
,
ib
?
ib
->
format
:
WINED3DFMT_UNKNOWN
);
wined3d_mutex_unlock
();
...
...
@@ -2351,7 +2351,7 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
{
struct
d3d8_device
*
device
=
impl_from_IDirect3DDevice8
(
iface
);
struct
wined3d_buffer
*
wined3d_buffer
=
NULL
;
IDirect3DIndexBuffer8Impl
*
buffer_impl
;
struct
d3d8_indexbuffer
*
buffer_impl
;
HRESULT
hr
;
TRACE
(
"iface %p, buffer %p, base_vertex_index %p.
\n
"
,
iface
,
buffer
,
base_vertex_index
);
...
...
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