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
0e955dae
Commit
0e955dae
authored
Aug 19, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Add a separate function for vertex buffer initialization.
parent
e2021722
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
42 deletions
+57
-42
ddraw.c
dlls/ddraw/ddraw.c
+3
-37
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-3
vertexbuffer.c
dlls/ddraw/vertexbuffer.c
+52
-2
No files found.
dlls/ddraw/ddraw.c
View file @
0e955dae
...
...
@@ -4739,9 +4739,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
static
HRESULT
WINAPI
d3d7_CreateVertexBuffer
(
IDirect3D7
*
iface
,
D3DVERTEXBUFFERDESC
*
desc
,
IDirect3DVertexBuffer7
**
vertex_buffer
,
DWORD
flags
)
{
IDirectDrawImpl
*
ddraw
=
ddraw_from_d3d7
(
iface
);
IDirect3DVertexBufferImpl
*
object
;
DWORD
usage
;
HRESULT
hr
;
TRACE
(
"iface %p, desc %p, vertex_buffer %p, flags %#x.
\n
"
,
...
...
@@ -4763,49 +4761,17 @@ static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFER
return
DDERR_OUTOFMEMORY
;
}
object
->
ref
=
1
;
object
->
lpVtbl
=
&
IDirect3DVertexBuffer7_Vtbl
;
object
->
IDirect3DVertexBuffer_vtbl
=
&
IDirect3DVertexBuffer1_Vtbl
;
object
->
ddraw
=
ddraw
;
object
->
Caps
=
desc
->
dwCaps
;
object
->
fvf
=
desc
->
dwFVF
;
usage
=
desc
->
dwCaps
&
D3DVBCAPS_WRITEONLY
?
WINED3DUSAGE_WRITEONLY
:
0
;
usage
|=
WINED3DUSAGE_STATICDECL
;
EnterCriticalSection
(
&
ddraw_cs
);
hr
=
IWineD3DDevice_CreateVertexBuffer
(
ddraw
->
wineD3DDevice
,
get_flexible_vertex_size
(
desc
->
dwFVF
)
*
desc
->
dwNumVertices
,
usage
,
desc
->
dwCaps
&
D3DVBCAPS_SYSTEMMEMORY
?
WINED3DPOOL_SYSTEMMEM
:
WINED3DPOOL_DEFAULT
,
&
object
->
wineD3DVertexBuffer
,
(
IUnknown
*
)
object
,
&
ddraw_null_wined3d_parent_ops
);
hr
=
d3d_vertex_buffer_init
(
object
,
ddraw_from_d3d7
(
iface
),
desc
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d vertex buffer, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
LeaveCriticalSection
(
&
ddraw_cs
);
if
(
hr
==
WINED3DERR_INVALIDCALL
)
return
DDERR_INVALIDPARAMS
;
else
return
hr
;
}
object
->
wineD3DVertexDeclaration
=
ddraw_find_decl
(
ddraw
,
desc
->
dwFVF
);
if
(
!
object
->
wineD3DVertexDeclaration
)
{
ERR
(
"Failed to find vertex declaration for fvf %#x.
\n
"
,
desc
->
dwFVF
);
IWineD3DBuffer_Release
(
object
->
wineD3DVertexBuffer
);
WARN
(
"Failed to initialize vertex buffer, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
DDERR_INVALIDPARAMS
;
return
hr
;
}
IWineD3DVertexDeclaration_AddRef
(
object
->
wineD3DVertexDeclaration
);
TRACE
(
"Created vertex buffer %p.
\n
"
,
object
);
*
vertex_buffer
=
(
IDirect3DVertexBuffer7
*
)
object
;
LeaveCriticalSection
(
&
ddraw_cs
);
return
D3D_OK
;
}
...
...
dlls/ddraw/ddraw_private.h
View file @
0e955dae
...
...
@@ -643,9 +643,8 @@ struct IDirect3DVertexBufferImpl
DWORD
fvf
;
};
/* The Vtables */
extern
const
IDirect3DVertexBuffer7Vtbl
IDirect3DVertexBuffer7_Vtbl
DECLSPEC_HIDDEN
;
extern
const
IDirect3DVertexBufferVtbl
IDirect3DVertexBuffer1_Vtbl
DECLSPEC_HIDDEN
;
HRESULT
d3d_vertex_buffer_init
(
IDirect3DVertexBufferImpl
*
buffer
,
IDirectDrawImpl
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
DECLSPEC_HIDDEN
;
static
inline
IDirect3DVertexBufferImpl
*
vb_from_vb1
(
IDirect3DVertexBuffer
*
iface
)
{
...
...
dlls/ddraw/vertexbuffer.c
View file @
0e955dae
...
...
@@ -553,7 +553,7 @@ IDirect3DVertexBufferImpl_ProcessVerticesStrided(IDirect3DVertexBuffer7 *iface,
* The VTables
*****************************************************************************/
const
IDirect3DVertexBuffer7Vtbl
IDirect3DVertexBuffer7_V
tbl
=
static
const
struct
IDirect3DVertexBuffer7Vtbl
d3d_vertex_buffer7_v
tbl
=
{
/*** IUnknown Methods ***/
IDirect3DVertexBufferImpl_QueryInterface
,
...
...
@@ -569,7 +569,7 @@ const IDirect3DVertexBuffer7Vtbl IDirect3DVertexBuffer7_Vtbl =
IDirect3DVertexBufferImpl_ProcessVerticesStrided
};
const
IDirect3DVertexBufferVtbl
IDirect3DVertexBuffer1_V
tbl
=
static
const
struct
IDirect3DVertexBufferVtbl
d3d_vertex_buffer1_v
tbl
=
{
/*** IUnknown Methods ***/
Thunk_IDirect3DVertexBufferImpl_1_QueryInterface
,
...
...
@@ -582,3 +582,53 @@ const IDirect3DVertexBufferVtbl IDirect3DVertexBuffer1_Vtbl =
Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc
,
Thunk_IDirect3DVertexBufferImpl_1_Optimize
};
HRESULT
d3d_vertex_buffer_init
(
IDirect3DVertexBufferImpl
*
buffer
,
IDirectDrawImpl
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
{
DWORD
usage
;
HRESULT
hr
;
buffer
->
lpVtbl
=
&
d3d_vertex_buffer7_vtbl
;
buffer
->
IDirect3DVertexBuffer_vtbl
=
&
d3d_vertex_buffer1_vtbl
;
buffer
->
ref
=
1
;
buffer
->
ddraw
=
ddraw
;
buffer
->
Caps
=
desc
->
dwCaps
;
buffer
->
fvf
=
desc
->
dwFVF
;
usage
=
desc
->
dwCaps
&
D3DVBCAPS_WRITEONLY
?
WINED3DUSAGE_WRITEONLY
:
0
;
usage
|=
WINED3DUSAGE_STATICDECL
;
EnterCriticalSection
(
&
ddraw_cs
);
hr
=
IWineD3DDevice_CreateVertexBuffer
(
ddraw
->
wineD3DDevice
,
get_flexible_vertex_size
(
desc
->
dwFVF
)
*
desc
->
dwNumVertices
,
usage
,
desc
->
dwCaps
&
D3DVBCAPS_SYSTEMMEMORY
?
WINED3DPOOL_SYSTEMMEM
:
WINED3DPOOL_DEFAULT
,
&
buffer
->
wineD3DVertexBuffer
,
(
IUnknown
*
)
buffer
,
&
ddraw_null_wined3d_parent_ops
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d vertex buffer, hr %#x.
\n
"
,
hr
);
LeaveCriticalSection
(
&
ddraw_cs
);
if
(
hr
==
WINED3DERR_INVALIDCALL
)
return
DDERR_INVALIDPARAMS
;
else
return
hr
;
}
buffer
->
wineD3DVertexDeclaration
=
ddraw_find_decl
(
ddraw
,
desc
->
dwFVF
);
if
(
!
buffer
->
wineD3DVertexDeclaration
)
{
ERR
(
"Failed to find vertex declaration for fvf %#x.
\n
"
,
desc
->
dwFVF
);
IWineD3DBuffer_Release
(
buffer
->
wineD3DVertexBuffer
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
DDERR_INVALIDPARAMS
;
}
IWineD3DVertexDeclaration_AddRef
(
buffer
->
wineD3DVertexDeclaration
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
D3D_OK
;
}
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