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
fae3a643
Commit
fae3a643
authored
Apr 11, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Get rid of IDirect3DVertexBufferImpl.
parent
5fc17b84
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
145 additions
and
158 deletions
+145
-158
ddraw.c
dlls/ddraw/ddraw.c
+2
-2
ddraw_private.h
dlls/ddraw/ddraw_private.h
+4
-8
device.c
dlls/ddraw/device.c
+4
-4
vertexbuffer.c
dlls/ddraw/vertexbuffer.c
+135
-144
No files found.
dlls/ddraw/ddraw.c
View file @
fae3a643
...
...
@@ -4527,7 +4527,7 @@ static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFER
IDirect3DVertexBuffer7
**
vertex_buffer
,
DWORD
flags
)
{
struct
ddraw
*
ddraw
=
impl_from_IDirect3D7
(
iface
);
IDirect3DVertexBufferImpl
*
object
;
struct
d3d_vertex_buffer
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, desc %p, vertex_buffer %p, flags %#x.
\n
"
,
...
...
@@ -4551,7 +4551,7 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER
IDirect3DVertexBuffer
**
vertex_buffer
,
DWORD
flags
,
IUnknown
*
outer_unknown
)
{
struct
ddraw
*
ddraw
=
impl_from_IDirect3D3
(
iface
);
IDirect3DVertexBufferImpl
*
object
;
struct
d3d_vertex_buffer
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, desc %p, vertex_buffer %p, flags %#x, outer_unknown %p.
\n
"
,
...
...
dlls/ddraw/ddraw_private.h
View file @
fae3a643
...
...
@@ -38,10 +38,6 @@
#include "wine/wined3d.h"
extern
const
struct
wined3d_parent_ops
ddraw_null_wined3d_parent_ops
DECLSPEC_HIDDEN
;
/* Typdef the interfaces */
typedef
struct
IDirect3DVertexBufferImpl
IDirect3DVertexBufferImpl
;
extern
DWORD
force_refresh_rate
DECLSPEC_HIDDEN
;
/*****************************************************************************
...
...
@@ -520,7 +516,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *execute_buffer,
/*****************************************************************************
* IDirect3DVertexBuffer
*****************************************************************************/
struct
IDirect3DVertexBufferImpl
struct
d3d_vertex_buffer
{
IDirect3DVertexBuffer7
IDirect3DVertexBuffer7_iface
;
IDirect3DVertexBuffer
IDirect3DVertexBuffer_iface
;
...
...
@@ -536,10 +532,10 @@ struct IDirect3DVertexBufferImpl
DWORD
fvf
;
};
HRESULT
d3d_vertex_buffer_create
(
IDirect3DVertexBufferImpl
**
vertex_buf
,
struct
ddraw
*
ddraw
,
HRESULT
d3d_vertex_buffer_create
(
struct
d3d_vertex_buffer
**
buffer
,
struct
ddraw
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
DECLSPEC_HIDDEN
;
IDirect3DVertexBufferImpl
*
unsafe_impl_from_IDirect3DVertexBuffer
(
IDirect3DVertexBuffer
*
iface
)
DECLSPEC_HIDDEN
;
IDirect3DVertexBufferImpl
*
unsafe_impl_from_IDirect3DVertexBuffer7
(
IDirect3DVertexBuffer7
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d_vertex_buffer
*
unsafe_impl_from_IDirect3DVertexBuffer
(
IDirect3DVertexBuffer
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d_vertex_buffer
*
unsafe_impl_from_IDirect3DVertexBuffer7
(
IDirect3DVertexBuffer7
*
iface
)
DECLSPEC_HIDDEN
;
/*****************************************************************************
* Helper functions from utils.c
...
...
dlls/ddraw/device.c
View file @
fae3a643
...
...
@@ -3996,7 +3996,7 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE
IDirect3DVertexBuffer7
*
D3DVertexBuf
,
DWORD
StartVertex
,
DWORD
NumVertices
,
DWORD
Flags
)
{
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice7
(
iface
);
IDirect3DVertexBufferImpl
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer7
(
D3DVertexBuf
);
struct
d3d_vertex_buffer
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer7
(
D3DVertexBuf
);
HRESULT
hr
;
DWORD
stride
;
...
...
@@ -4060,7 +4060,7 @@ static HRESULT WINAPI d3d_device3_DrawPrimitiveVB(IDirect3DDevice3 *iface, D3DPR
IDirect3DVertexBuffer
*
D3DVertexBuf
,
DWORD
StartVertex
,
DWORD
NumVertices
,
DWORD
Flags
)
{
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice3
(
iface
);
IDirect3DVertexBufferImpl
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer
(
D3DVertexBuf
);
struct
d3d_vertex_buffer
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer
(
D3DVertexBuf
);
TRACE
(
"iface %p, primitive_type %#x, vb %p, start_vertex %u, vertex_count %u, flags %#x.
\n
"
,
iface
,
PrimitiveType
,
D3DVertexBuf
,
StartVertex
,
NumVertices
,
Flags
);
...
...
@@ -4092,7 +4092,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
DWORD
StartVertex
,
DWORD
NumVertices
,
WORD
*
Indices
,
DWORD
IndexCount
,
DWORD
Flags
)
{
struct
d3d_device
*
This
=
impl_from_IDirect3DDevice7
(
iface
);
IDirect3DVertexBufferImpl
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer7
(
D3DVertexBuf
);
struct
d3d_vertex_buffer
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer7
(
D3DVertexBuf
);
DWORD
stride
=
get_flexible_vertex_size
(
vb
->
fvf
);
struct
wined3d_resource
*
wined3d_resource
;
struct
wined3d_resource_desc
desc
;
...
...
@@ -4208,7 +4208,7 @@ static HRESULT WINAPI d3d_device3_DrawIndexedPrimitiveVB(IDirect3DDevice3 *iface
DWORD
IndexCount
,
DWORD
Flags
)
{
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice3
(
iface
);
IDirect3DVertexBufferImpl
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer
(
D3DVertexBuf
);
struct
d3d_vertex_buffer
*
vb
=
unsafe_impl_from_IDirect3DVertexBuffer
(
D3DVertexBuf
);
TRACE
(
"iface %p, primitive_type %#x, vb %p, indices %p, index_count %u, flags %#x.
\n
"
,
iface
,
PrimitiveType
,
D3DVertexBuf
,
Indices
,
IndexCount
,
Flags
);
...
...
dlls/ddraw/vertexbuffer.c
View file @
fae3a643
...
...
@@ -26,14 +26,14 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ddraw
);
static
inline
IDirect3DVertexBufferImpl
*
impl_from_IDirect3DVertexBuffer
(
IDirect3DVertexBuffer
*
iface
)
static
inline
struct
d3d_vertex_buffer
*
impl_from_IDirect3DVertexBuffer
(
IDirect3DVertexBuffer
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirect3DVertexBufferImpl
,
IDirect3DVertexBuffer_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d_vertex_buffer
,
IDirect3DVertexBuffer_iface
);
}
static
inline
IDirect3DVertexBufferImpl
*
impl_from_IDirect3DVertexBuffer7
(
IDirect3DVertexBuffer7
*
iface
)
static
inline
struct
d3d_vertex_buffer
*
impl_from_IDirect3DVertexBuffer7
(
IDirect3DVertexBuffer7
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirect3DVertexBufferImpl
,
IDirect3DVertexBuffer7_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d_vertex_buffer
,
IDirect3DVertexBuffer7_iface
);
}
/*****************************************************************************
...
...
@@ -55,10 +55,9 @@ static inline IDirect3DVertexBufferImpl *impl_from_IDirect3DVertexBuffer7(IDirec
* E_NOINTERFACE if the interface wasn't found
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_QueryInterface
(
IDirect3DVertexBuffer7
*
iface
,
REFIID
riid
,
void
**
obj
)
static
HRESULT
WINAPI
d3d_vertex_buffer7_QueryInterface
(
IDirect3DVertexBuffer7
*
iface
,
REFIID
riid
,
void
**
obj
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
TRACE
(
"iface %p, riid %s, object %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
obj
);
...
...
@@ -75,7 +74,7 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBu
if
(
IsEqualGUID
(
&
IID_IDirect3DVertexBuffer
,
riid
)
)
{
IUnknown_AddRef
(
iface
);
*
obj
=
&
This
->
IDirect3DVertexBuffer_iface
;
*
obj
=
&
buffer
->
IDirect3DVertexBuffer_iface
;
TRACE
(
" Creating IDirect3DVertexBuffer interface %p
\n
"
,
*
obj
);
return
S_OK
;
}
...
...
@@ -86,18 +85,19 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBu
TRACE
(
" Creating IDirect3DVertexBuffer7 interface %p
\n
"
,
*
obj
);
return
S_OK
;
}
FIXME
(
"(%p): interface for IID %s NOT found!
\n
"
,
This
,
debugstr_guid
(
riid
));
WARN
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
}
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_1_QueryInterface
(
IDirect3DVertexBuffer
*
iface
,
REFIID
riid
,
void
**
obj
)
static
HRESULT
WINAPI
d3d_vertex_buffer1_QueryInterface
(
IDirect3DVertexBuffer
*
iface
,
REFIID
riid
,
void
**
obj
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer
(
iface
);
TRACE
(
"iface %p, riid %s, object %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
obj
);
return
IDirect3DVertexBuffer7_QueryInterface
(
&
This
->
IDirect3DVertexBuffer7_iface
,
riid
,
obj
);
return
d3d_vertex_buffer7_QueryInterface
(
&
buffer
->
IDirect3DVertexBuffer7_iface
,
riid
,
obj
);
}
/*****************************************************************************
...
...
@@ -109,23 +109,23 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertex
* The new refcount
*
*****************************************************************************/
static
ULONG
WINAPI
IDirect3DVertexBufferImpl
_AddRef
(
IDirect3DVertexBuffer7
*
iface
)
static
ULONG
WINAPI
d3d_vertex_buffer7
_AddRef
(
IDirect3DVertexBuffer7
*
iface
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
buffer
->
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
This
,
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
buffer
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
IDirect3DVertexBufferImpl_
1_AddRef
(
IDirect3DVertexBuffer
*
iface
)
static
ULONG
WINAPI
d3d_vertex_buffer
1_AddRef
(
IDirect3DVertexBuffer
*
iface
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
return
IDirect3DVertexBuffer7_AddRef
(
&
This
->
IDirect3DVertexBuffer7_iface
);
return
d3d_vertex_buffer7_AddRef
(
&
buffer
->
IDirect3DVertexBuffer7_iface
);
}
...
...
@@ -138,12 +138,12 @@ static ULONG WINAPI IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *if
* The new refcount
*
*****************************************************************************/
static
ULONG
WINAPI
IDirect3DVertexBufferImpl
_Release
(
IDirect3DVertexBuffer7
*
iface
)
static
ULONG
WINAPI
d3d_vertex_buffer7
_Release
(
IDirect3DVertexBuffer7
*
iface
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
buffer
->
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
This
,
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
buffer
,
ref
);
if
(
ref
==
0
)
{
...
...
@@ -155,31 +155,30 @@ static ULONG WINAPI IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *if
* stream source in wined3d, and they should get unset there before
* they are destroyed. */
wined3d_mutex_lock
();
wined3d_device_get_stream_source
(
This
->
ddraw
->
wined3d_device
,
wined3d_device_get_stream_source
(
buffer
->
ddraw
->
wined3d_device
,
0
,
&
curVB
,
&
offset
,
&
stride
);
if
(
curVB
==
This
->
wineD3DVertexBuffer
)
wined3d_device_set_stream_source
(
This
->
ddraw
->
wined3d_device
,
0
,
NULL
,
0
,
0
);
if
(
curVB
==
buffer
->
wineD3DVertexBuffer
)
wined3d_device_set_stream_source
(
buffer
->
ddraw
->
wined3d_device
,
0
,
NULL
,
0
,
0
);
if
(
curVB
)
wined3d_buffer_decref
(
curVB
);
/* For the GetStreamSource */
wined3d_vertex_declaration_decref
(
This
->
wineD3DVertexDeclaration
);
wined3d_buffer_decref
(
This
->
wineD3DVertexBuffer
);
wined3d_vertex_declaration_decref
(
buffer
->
wineD3DVertexDeclaration
);
wined3d_buffer_decref
(
buffer
->
wineD3DVertexBuffer
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
return
ref
;
}
static
ULONG
WINAPI
IDirect3DVertexBufferImpl_
1_Release
(
IDirect3DVertexBuffer
*
iface
)
static
ULONG
WINAPI
d3d_vertex_buffer
1_Release
(
IDirect3DVertexBuffer
*
iface
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
return
IDirect3DVertexBuffer7_Release
(
&
This
->
IDirect3DVertexBuffer7_iface
);
return
d3d_vertex_buffer7_Release
(
&
buffer
->
IDirect3DVertexBuffer7_iface
);
}
/*****************************************************************************
...
...
@@ -205,48 +204,52 @@ static ULONG WINAPI IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *i
* D3DERR_VERTEXBUFFEROPTIMIZED if called on an optimized buffer(WineD3D)
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_Lock
(
IDirect3DVertexBuffer7
*
iface
,
DWORD
Flags
,
void
**
Data
,
DWORD
*
S
ize
)
static
HRESULT
WINAPI
d3d_vertex_buffer7_Lock
(
IDirect3DVertexBuffer7
*
iface
,
DWORD
flags
,
void
**
data
,
DWORD
*
data_s
ize
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
wined3d_resource_desc
wined3d_desc
;
struct
wined3d_resource
*
wined3d_resource
;
HRESULT
hr
;
DWORD
wined3d_flags
=
0
;
TRACE
(
"iface %p, flags %#x, data %p, data_size %p.
\n
"
,
iface
,
Flags
,
Data
,
S
ize
);
TRACE
(
"iface %p, flags %#x, data %p, data_size %p.
\n
"
,
iface
,
flags
,
data
,
data_s
ize
);
/* Writeonly: Pointless. Event: Unsupported by native according to the sdk
* nosyslock: Not applicable
*/
if
(
!
(
Flags
&
DDLOCK_WAIT
))
wined3d_flags
|=
WINED3DLOCK_DONOTWAIT
;
if
(
Flags
&
DDLOCK_READONLY
)
wined3d_flags
|=
WINED3DLOCK_READONLY
;
if
(
Flags
&
DDLOCK_NOOVERWRITE
)
wined3d_flags
|=
WINED3DLOCK_NOOVERWRITE
;
if
(
Flags
&
DDLOCK_DISCARDCONTENTS
)
wined3d_flags
|=
WINED3DLOCK_DISCARD
;
if
(
!
(
flags
&
DDLOCK_WAIT
))
wined3d_flags
|=
WINED3DLOCK_DONOTWAIT
;
if
(
flags
&
DDLOCK_READONLY
)
wined3d_flags
|=
WINED3DLOCK_READONLY
;
if
(
flags
&
DDLOCK_NOOVERWRITE
)
wined3d_flags
|=
WINED3DLOCK_NOOVERWRITE
;
if
(
flags
&
DDLOCK_DISCARDCONTENTS
)
wined3d_flags
|=
WINED3DLOCK_DISCARD
;
wined3d_mutex_lock
();
if
(
S
ize
)
if
(
data_s
ize
)
{
/* Get the size, for returning it, and for locking */
wined3d_resource
=
wined3d_buffer_get_resource
(
This
->
wineD3DVertexBuffer
);
wined3d_resource
=
wined3d_buffer_get_resource
(
buffer
->
wineD3DVertexBuffer
);
wined3d_resource_get_desc
(
wined3d_resource
,
&
wined3d_desc
);
*
S
ize
=
wined3d_desc
.
size
;
*
data_s
ize
=
wined3d_desc
.
size
;
}
hr
=
wined3d_buffer_map
(
This
->
wineD3DVertexBuffer
,
0
,
0
,
(
BYTE
**
)
D
ata
,
wined3d_flags
);
hr
=
wined3d_buffer_map
(
buffer
->
wineD3DVertexBuffer
,
0
,
0
,
(
BYTE
**
)
d
ata
,
wined3d_flags
);
wined3d_mutex_unlock
();
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_1_Lock
(
IDirect3DVertexBuffer
*
iface
,
DWORD
Flags
,
void
**
Data
,
DWORD
*
S
ize
)
static
HRESULT
WINAPI
d3d_vertex_buffer1_Lock
(
IDirect3DVertexBuffer
*
iface
,
DWORD
flags
,
void
**
data
,
DWORD
*
data_s
ize
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer
(
iface
);
TRACE
(
"iface %p, flags %#x, data %p, data_size %p.
\n
"
,
iface
,
Flags
,
Data
,
S
ize
);
TRACE
(
"iface %p, flags %#x, data %p, data_size %p.
\n
"
,
iface
,
flags
,
data
,
data_s
ize
);
return
IDirect3DVertexBuffer7_Lock
(
&
This
->
IDirect3DVertexBuffer7_iface
,
Flags
,
Data
,
S
ize
);
return
d3d_vertex_buffer7_Lock
(
&
buffer
->
IDirect3DVertexBuffer7_iface
,
flags
,
data
,
data_s
ize
);
}
/*****************************************************************************
...
...
@@ -258,26 +261,26 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *if
* D3D_OK on success
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl
_Unlock
(
IDirect3DVertexBuffer7
*
iface
)
static
HRESULT
WINAPI
d3d_vertex_buffer7
_Unlock
(
IDirect3DVertexBuffer7
*
iface
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
wined3d_buffer_unmap
(
This
->
wineD3DVertexBuffer
);
wined3d_buffer_unmap
(
buffer
->
wineD3DVertexBuffer
);
wined3d_mutex_unlock
();
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_
1_Unlock
(
IDirect3DVertexBuffer
*
iface
)
static
HRESULT
WINAPI
d3d_vertex_buffer
1_Unlock
(
IDirect3DVertexBuffer
*
iface
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
return
IDirect3DVertexBuffer7_Unlock
(
&
This
->
IDirect3DVertexBuffer7_iface
);
return
d3d_vertex_buffer7_Unlock
(
&
buffer
->
IDirect3DVertexBuffer7_iface
);
}
...
...
@@ -303,18 +306,18 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *
* DDERR_INVALIDPARAMS If D3DVOP_TRANSFORM wasn't passed
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl
_ProcessVertices
(
IDirect3DVertexBuffer7
*
iface
,
DWORD
VertexOp
,
DWORD
DestIndex
,
DWORD
Count
,
IDirect3DVertexBuffer7
*
SrcB
uffer
,
DWORD
SrcIndex
,
IDirect3DDevice7
*
device
,
DWORD
F
lags
)
static
HRESULT
WINAPI
d3d_vertex_buffer7
_ProcessVertices
(
IDirect3DVertexBuffer7
*
iface
,
DWORD
vertex_op
,
DWORD
dst_idx
,
DWORD
count
,
IDirect3DVertexBuffer7
*
src_b
uffer
,
DWORD
src_idx
,
IDirect3DDevice7
*
device
,
DWORD
f
lags
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
IDirect3DVertexBufferImpl
*
Src
=
unsafe_impl_from_IDirect3DVertexBuffer7
(
SrcB
uffer
);
struct
d3d_vertex_buffer
*
dst_buffer_impl
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
d3d_vertex_buffer
*
src_buffer_impl
=
unsafe_impl_from_IDirect3DVertexBuffer7
(
src_b
uffer
);
struct
d3d_device
*
device_impl
=
unsafe_impl_from_IDirect3DDevice7
(
device
);
BOOL
oldClip
,
doClip
;
HRESULT
hr
;
TRACE
(
"iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.
\n
"
,
iface
,
VertexOp
,
DestIndex
,
Count
,
SrcBuffer
,
SrcIndex
,
device
,
F
lags
);
iface
,
vertex_op
,
dst_idx
,
count
,
src_buffer
,
src_idx
,
device
,
f
lags
);
/* Vertex operations:
* D3DVOP_CLIP: Clips vertices outside the viewing frustrum. Needs clipping information
...
...
@@ -326,7 +329,8 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexB
* WineD3D only transforms and clips the vertices by now, so EXTENTS and LIGHT
* are not implemented. Clipping is disabled ATM, because of unsure conditions.
*/
if
(
!
(
VertexOp
&
D3DVOP_TRANSFORM
)
)
return
DDERR_INVALIDPARAMS
;
if
(
!
(
vertex_op
&
D3DVOP_TRANSFORM
))
return
DDERR_INVALIDPARAMS
;
wined3d_mutex_lock
();
...
...
@@ -334,16 +338,16 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexB
* render states instead. Set the render states according to
* the vertex ops
*/
doClip
=
VertexOp
&
D3DVOP_CLIP
?
TRUE
:
FALSE
;
doClip
=
!!
(
vertex_op
&
D3DVOP_CLIP
)
;
wined3d_device_get_render_state
(
device_impl
->
wined3d_device
,
WINED3D_RS_CLIPPING
,
(
DWORD
*
)
&
oldClip
);
if
(
doClip
!=
oldClip
)
wined3d_device_set_render_state
(
device_impl
->
wined3d_device
,
WINED3D_RS_CLIPPING
,
doClip
);
wined3d_device_set_stream_source
(
device_impl
->
wined3d_device
,
0
,
Src
->
wineD3DVertexBuffer
,
0
,
get_flexible_vertex_size
(
Src
->
fvf
));
wined3d_device_set_vertex_declaration
(
device_impl
->
wined3d_device
,
Src
->
wineD3DVertexDeclaration
);
hr
=
wined3d_device_process_vertices
(
device_impl
->
wined3d_device
,
SrcIndex
,
DestInde
x
,
Count
,
This
->
wineD3DVertexBuffer
,
NULL
,
Flags
,
This
->
fvf
);
0
,
src_buffer_impl
->
wineD3DVertexBuffer
,
0
,
get_flexible_vertex_size
(
src_buffer_impl
->
fvf
));
wined3d_device_set_vertex_declaration
(
device_impl
->
wined3d_device
,
src_buffer_impl
->
wineD3DVertexDeclaration
);
hr
=
wined3d_device_process_vertices
(
device_impl
->
wined3d_device
,
src_idx
,
dst_id
x
,
count
,
dst_buffer_impl
->
wineD3DVertexBuffer
,
NULL
,
flags
,
dst_buffer_impl
->
fvf
);
/* Restore the states if needed */
if
(
doClip
!=
oldClip
)
...
...
@@ -354,20 +358,20 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexB
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_
1_ProcessVertices
(
IDirect3DVertexBuffer
*
iface
,
DWORD
VertexOp
,
DWORD
DestIndex
,
DWORD
Count
,
IDirect3DVertexBuffer
*
SrcB
uffer
,
DWORD
SrcIndex
,
IDirect3DDevice3
*
device
,
DWORD
F
lags
)
static
HRESULT
WINAPI
d3d_vertex_buffer
1_ProcessVertices
(
IDirect3DVertexBuffer
*
iface
,
DWORD
vertex_op
,
DWORD
dst_idx
,
DWORD
count
,
IDirect3DVertexBuffer
*
src_b
uffer
,
DWORD
src_idx
,
IDirect3DDevice3
*
device
,
DWORD
f
lags
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
IDirect3DVertexBufferImpl
*
Src
=
unsafe_impl_from_IDirect3DVertexBuffer
(
SrcB
uffer
);
struct
d3d_vertex_buffer
*
dst_buffer_impl
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
src_buffer_impl
=
unsafe_impl_from_IDirect3DVertexBuffer
(
src_b
uffer
);
struct
d3d_device
*
device_impl
=
unsafe_impl_from_IDirect3DDevice3
(
device
);
TRACE
(
"iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.
\n
"
,
iface
,
VertexOp
,
DestIndex
,
Count
,
SrcBuffer
,
SrcIndex
,
device
,
F
lags
);
iface
,
vertex_op
,
dst_idx
,
count
,
src_buffer
,
src_idx
,
device
,
f
lags
);
return
IDirect3DVertexBuffer7_ProcessVertices
(
&
This
->
IDirect3DVertexBuffer7_iface
,
VertexO
p
,
DestIndex
,
Count
,
&
Src
->
IDirect3DVertexBuffer7_iface
,
SrcInde
x
,
device_impl
?
&
device_impl
->
IDirect3DDevice7_iface
:
NULL
,
F
lags
);
return
d3d_vertex_buffer7_ProcessVertices
(
&
dst_buffer_impl
->
IDirect3DVertexBuffer7_iface
,
vertex_o
p
,
dst_idx
,
count
,
&
src_buffer_impl
->
IDirect3DVertexBuffer7_iface
,
src_id
x
,
device_impl
?
&
device_impl
->
IDirect3DDevice7_iface
:
NULL
,
f
lags
);
}
/*****************************************************************************
...
...
@@ -383,38 +387,36 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVerte
* D3D_OK on success
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_GetVertexBufferDesc
(
IDirect3DVertexBuffer7
*
iface
,
D3DVERTEXBUFFERDESC
*
Desc
)
static
HRESULT
WINAPI
d3d_vertex_buffer7_GetVertexBufferDesc
(
IDirect3DVertexBuffer7
*
iface
,
D3DVERTEXBUFFERDESC
*
desc
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
wined3d_resource_desc
wined3d_desc
;
struct
wined3d_resource
*
wined3d_resource
;
TRACE
(
"iface %p, desc %p.
\n
"
,
iface
,
D
esc
);
TRACE
(
"iface %p, desc %p.
\n
"
,
iface
,
d
esc
);
if
(
!
D
esc
)
return
DDERR_INVALIDPARAMS
;
if
(
!
d
esc
)
return
DDERR_INVALIDPARAMS
;
wined3d_mutex_lock
();
wined3d_resource
=
wined3d_buffer_get_resource
(
This
->
wineD3DVertexBuffer
);
wined3d_resource
=
wined3d_buffer_get_resource
(
buffer
->
wineD3DVertexBuffer
);
wined3d_resource_get_desc
(
wined3d_resource
,
&
wined3d_desc
);
wined3d_mutex_unlock
();
/* Now fill the
D
esc structure */
Desc
->
dwCaps
=
This
->
Caps
;
Desc
->
dwFVF
=
This
->
fvf
;
Desc
->
dwNumVertices
=
wined3d_desc
.
size
/
get_flexible_vertex_size
(
This
->
fvf
);
/* Now fill the
d
esc structure */
desc
->
dwCaps
=
buffer
->
Caps
;
desc
->
dwFVF
=
buffer
->
fvf
;
desc
->
dwNumVertices
=
wined3d_desc
.
size
/
get_flexible_vertex_size
(
buffer
->
fvf
);
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_1_GetVertexBufferDesc
(
IDirect3DVertexBuffer
*
iface
,
D3DVERTEXBUFFERDESC
*
Desc
)
static
HRESULT
WINAPI
d3d_vertex_buffer1_GetVertexBufferDesc
(
IDirect3DVertexBuffer
*
iface
,
D3DVERTEXBUFFERDESC
*
desc
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer
(
iface
);
TRACE
(
"iface %p, desc %p.
\n
"
,
iface
,
D
esc
);
TRACE
(
"iface %p, desc %p.
\n
"
,
iface
,
d
esc
);
return
IDirect3DVertexBuffer7_GetVertexBufferDesc
(
&
This
->
IDirect3DVertexBuffer7_iface
,
D
esc
);
return
d3d_vertex_buffer7_GetVertexBufferDesc
(
&
buffer
->
IDirect3DVertexBuffer7_iface
,
d
esc
);
}
...
...
@@ -431,17 +433,17 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DV
* D3D_OK, because it's a stub
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl
_Optimize
(
IDirect3DVertexBuffer7
*
iface
,
IDirect3DDevice7
*
D3DDevice
,
DWORD
F
lags
)
static
HRESULT
WINAPI
d3d_vertex_buffer7
_Optimize
(
IDirect3DVertexBuffer7
*
iface
,
IDirect3DDevice7
*
device
,
DWORD
f
lags
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer7
(
iface
);
static
BOOL
hide
=
FALSE
;
TRACE
(
"iface %p, device %p, flags %#x.
\n
"
,
iface
,
D3DDevice
,
F
lags
);
TRACE
(
"iface %p, device %p, flags %#x.
\n
"
,
iface
,
device
,
f
lags
);
if
(
!
hide
)
{
FIXME
(
"iface %p, device %p, flags %#x stub!
\n
"
,
iface
,
D3DDevice
,
F
lags
);
FIXME
(
"iface %p, device %p, flags %#x stub!
\n
"
,
iface
,
device
,
f
lags
);
hide
=
TRUE
;
}
...
...
@@ -449,22 +451,22 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_Optimize(IDirect3DVertexBuffer7
* of it once we use OpenGL vertex buffers
*/
wined3d_mutex_lock
();
This
->
Caps
|=
D3DVBCAPS_OPTIMIZED
;
buffer
->
Caps
|=
D3DVBCAPS_OPTIMIZED
;
wined3d_mutex_unlock
();
return
DD_OK
;
}
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_
1_Optimize
(
IDirect3DVertexBuffer
*
iface
,
IDirect3DDevice3
*
device
,
DWORD
F
lags
)
static
HRESULT
WINAPI
d3d_vertex_buffer
1_Optimize
(
IDirect3DVertexBuffer
*
iface
,
IDirect3DDevice3
*
device
,
DWORD
f
lags
)
{
IDirect3DVertexBufferImpl
*
This
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_vertex_buffer
*
buffer
=
impl_from_IDirect3DVertexBuffer
(
iface
);
struct
d3d_device
*
device_impl
=
unsafe_impl_from_IDirect3DDevice3
(
device
);
TRACE
(
"iface %p, device %p, flags %#x.
\n
"
,
iface
,
device
,
F
lags
);
TRACE
(
"iface %p, device %p, flags %#x.
\n
"
,
iface
,
device
,
f
lags
);
return
IDirect3DVertexBuffer7_Optimize
(
&
This
->
IDirect3DVertexBuffer7_iface
,
device_impl
?
&
device_impl
->
IDirect3DDevice7_iface
:
NULL
,
F
lags
);
return
d3d_vertex_buffer7_Optimize
(
&
buffer
->
IDirect3DVertexBuffer7_iface
,
device_impl
?
&
device_impl
->
IDirect3DDevice7_iface
:
NULL
,
f
lags
);
}
/*****************************************************************************
...
...
@@ -489,18 +491,12 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer
* D3D_OK on success, or DDERR_*
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DVertexBufferImpl_ProcessVerticesStrided
(
IDirect3DVertexBuffer7
*
iface
,
DWORD
VertexOp
,
DWORD
DestIndex
,
DWORD
Count
,
D3DDRAWPRIMITIVESTRIDEDDATA
*
StrideData
,
DWORD
VertexTypeDesc
,
IDirect3DDevice7
*
D3DDevice
,
DWORD
Flags
)
static
HRESULT
WINAPI
d3d_vertex_buffer7_ProcessVerticesStrided
(
IDirect3DVertexBuffer7
*
iface
,
DWORD
vertex_op
,
DWORD
dst_idx
,
DWORD
count
,
D3DDRAWPRIMITIVESTRIDEDDATA
*
data
,
DWORD
fvf
,
IDirect3DDevice7
*
device
,
DWORD
flags
)
{
FIXME
(
"iface %p, vertex_op %#x, dst_idx %u, count %u, data %p,
vertex_type
%#x, device %p, flags %#x stub!
\n
"
,
iface
,
VertexOp
,
DestIndex
,
Count
,
StrideData
,
VertexTypeDesc
,
D3DDevice
,
F
lags
);
FIXME
(
"iface %p, vertex_op %#x, dst_idx %u, count %u, data %p,
fvf
%#x, device %p, flags %#x stub!
\n
"
,
iface
,
vertex_op
,
dst_idx
,
count
,
data
,
fvf
,
device
,
f
lags
);
return
DD_OK
;
}
...
...
@@ -511,38 +507,33 @@ IDirect3DVertexBufferImpl_ProcessVerticesStrided(IDirect3DVertexBuffer7 *iface,
static
const
struct
IDirect3DVertexBuffer7Vtbl
d3d_vertex_buffer7_vtbl
=
{
/*** IUnknown Methods ***/
IDirect3DVertexBufferImpl_QueryInterface
,
IDirect3DVertexBufferImpl_AddRef
,
IDirect3DVertexBufferImpl_Release
,
/*** IDirect3DVertexBuffer Methods ***/
IDirect3DVertexBufferImpl_Lock
,
IDirect3DVertexBufferImpl_Unlock
,
IDirect3DVertexBufferImpl_ProcessVertices
,
IDirect3DVertexBufferImpl_GetVertexBufferDesc
,
IDirect3DVertexBufferImpl_Optimize
,
/*** IDirect3DVertexBuffer7 Methods ***/
IDirect3DVertexBufferImpl_ProcessVerticesStrided
d3d_vertex_buffer7_QueryInterface
,
d3d_vertex_buffer7_AddRef
,
d3d_vertex_buffer7_Release
,
d3d_vertex_buffer7_Lock
,
d3d_vertex_buffer7_Unlock
,
d3d_vertex_buffer7_ProcessVertices
,
d3d_vertex_buffer7_GetVertexBufferDesc
,
d3d_vertex_buffer7_Optimize
,
d3d_vertex_buffer7_ProcessVerticesStrided
,
};
static
const
struct
IDirect3DVertexBufferVtbl
d3d_vertex_buffer1_vtbl
=
{
/*** IUnknown Methods ***/
IDirect3DVertexBufferImpl_1_QueryInterface
,
IDirect3DVertexBufferImpl_1_AddRef
,
IDirect3DVertexBufferImpl_1_Release
,
/*** IDirect3DVertexBuffer Methods ***/
IDirect3DVertexBufferImpl_1_Lock
,
IDirect3DVertexBufferImpl_1_Unlock
,
IDirect3DVertexBufferImpl_1_ProcessVertices
,
IDirect3DVertexBufferImpl_1_GetVertexBufferDesc
,
IDirect3DVertexBufferImpl_1_Optimize
d3d_vertex_buffer1_QueryInterface
,
d3d_vertex_buffer1_AddRef
,
d3d_vertex_buffer1_Release
,
d3d_vertex_buffer1_Lock
,
d3d_vertex_buffer1_Unlock
,
d3d_vertex_buffer1_ProcessVertices
,
d3d_vertex_buffer1_GetVertexBufferDesc
,
d3d_vertex_buffer1_Optimize
,
};
HRESULT
d3d_vertex_buffer_create
(
IDirect3DVertexBufferImpl
**
vertex_buf
,
struct
ddraw
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
HRESULT
d3d_vertex_buffer_create
(
struct
d3d_vertex_buffer
**
vertex_buf
,
struct
ddraw
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
{
IDirect3DVertexBufferImpl
*
buffer
;
struct
d3d_vertex_buffer
*
buffer
;
DWORD
usage
;
HRESULT
hr
=
D3D_OK
;
...
...
@@ -601,7 +592,7 @@ end:
return
hr
;
}
IDirect3DVertexBufferImpl
*
unsafe_impl_from_IDirect3DVertexBuffer
(
IDirect3DVertexBuffer
*
iface
)
struct
d3d_vertex_buffer
*
unsafe_impl_from_IDirect3DVertexBuffer
(
IDirect3DVertexBuffer
*
iface
)
{
if
(
!
iface
)
return
NULL
;
...
...
@@ -610,7 +601,7 @@ IDirect3DVertexBufferImpl *unsafe_impl_from_IDirect3DVertexBuffer(IDirect3DVerte
return
impl_from_IDirect3DVertexBuffer
(
iface
);
}
IDirect3DVertexBufferImpl
*
unsafe_impl_from_IDirect3DVertexBuffer7
(
IDirect3DVertexBuffer7
*
iface
)
struct
d3d_vertex_buffer
*
unsafe_impl_from_IDirect3DVertexBuffer7
(
IDirect3DVertexBuffer7
*
iface
)
{
if
(
!
iface
)
return
NULL
;
...
...
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