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
d010dac8
Commit
d010dac8
authored
Jun 15, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jun 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Rename d3d_vertex_buffer_init() and have it allocate the object too.
parent
b02457a1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
36 deletions
+32
-36
ddraw.c
dlls/ddraw/ddraw.c
+6
-22
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-2
vertexbuffer.c
dlls/ddraw/vertexbuffer.c
+24
-12
No files found.
dlls/ddraw/ddraw.c
View file @
d010dac8
...
...
@@ -4952,32 +4952,16 @@ static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFER
if
(
!
vertex_buffer
||
!
desc
)
return
DDERR_INVALIDPARAMS
;
TRACE
(
"Vertex buffer description:
\n
"
);
TRACE
(
" dwSize %u
\n
"
,
desc
->
dwSize
);
TRACE
(
" dwCaps %#x
\n
"
,
desc
->
dwCaps
);
TRACE
(
" FVF %#x
\n
"
,
desc
->
dwFVF
);
TRACE
(
" dwNumVertices %u
\n
"
,
desc
->
dwNumVertices
);
/* Now create the vertex buffer */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate vertex buffer memory.
\n
"
);
return
DDERR_OUTOFMEMORY
;
}
hr
=
d3d_vertex_buffer_init
(
object
,
This
,
desc
);
if
(
FAILED
(
hr
))
hr
=
d3d_vertex_buffer_create
(
&
object
,
This
,
desc
);
if
(
hr
==
D3D_OK
)
{
WARN
(
"Failed to initialize vertex buffer, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
TRACE
(
"Created vertex buffer %p.
\n
"
,
object
);
*
vertex_buffer
=
(
IDirect3DVertexBuffer7
*
)
object
;
}
else
WARN
(
"Failed to create vertex buffer, hr %#x.
\n
"
,
hr
);
return
D3D_OK
;
return
hr
;
}
static
HRESULT
WINAPI
d3d3_CreateVertexBuffer
(
IDirect3D3
*
iface
,
D3DVERTEXBUFFERDESC
*
desc
,
...
...
dlls/ddraw/ddraw_private.h
View file @
d010dac8
...
...
@@ -534,8 +534,8 @@ struct IDirect3DVertexBufferImpl
DWORD
fvf
;
};
HRESULT
d3d_vertex_buffer_
init
(
IDirect3DVertexBufferImpl
*
buffer
,
IDirectDrawImpl
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
DECLSPEC_HIDDEN
;
HRESULT
d3d_vertex_buffer_
create
(
IDirect3DVertexBufferImpl
**
vertex_buf
,
IDirectDrawImpl
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
DECLSPEC_HIDDEN
;
static
inline
IDirect3DVertexBufferImpl
*
vb_from_vb1
(
IDirect3DVertexBuffer
*
iface
)
{
...
...
dlls/ddraw/vertexbuffer.c
View file @
d010dac8
...
...
@@ -526,11 +526,22 @@ static const struct IDirect3DVertexBufferVtbl d3d_vertex_buffer1_vtbl =
IDirect3DVertexBufferImpl_1_Optimize
};
HRESULT
d3d_vertex_buffer_
init
(
IDirect3DVertexBufferImpl
*
buffer
,
IDirectDrawImpl
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
HRESULT
d3d_vertex_buffer_
create
(
IDirect3DVertexBufferImpl
**
vertex_buf
,
IDirectDrawImpl
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
{
IDirect3DVertexBufferImpl
*
buffer
;
DWORD
usage
;
HRESULT
hr
;
HRESULT
hr
=
D3D_OK
;
TRACE
(
"Vertex buffer description:
\n
"
);
TRACE
(
" dwSize %u
\n
"
,
desc
->
dwSize
);
TRACE
(
" dwCaps %#x
\n
"
,
desc
->
dwCaps
);
TRACE
(
" FVF %#x
\n
"
,
desc
->
dwFVF
);
TRACE
(
" dwNumVertices %u
\n
"
,
desc
->
dwNumVertices
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
buffer
));
if
(
!
buffer
)
return
DDERR_OUTOFMEMORY
;
buffer
->
lpVtbl
=
&
d3d_vertex_buffer7_vtbl
;
buffer
->
IDirect3DVertexBuffer_vtbl
=
&
d3d_vertex_buffer1_vtbl
;
...
...
@@ -552,12 +563,9 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer,
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
;
hr
=
DDERR_INVALIDPARAMS
;
goto
end
;
}
buffer
->
wineD3DVertexDeclaration
=
ddraw_find_decl
(
ddraw
,
desc
->
dwFVF
);
...
...
@@ -565,13 +573,17 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer,
{
ERR
(
"Failed to find vertex declaration for fvf %#x.
\n
"
,
desc
->
dwFVF
);
wined3d_buffer_decref
(
buffer
->
wineD3DVertexBuffer
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
DDERR_INVALIDPARAMS
;
hr
=
DDERR_INVALIDPARAMS
;
goto
end
;
}
wined3d_vertex_declaration_incref
(
buffer
->
wineD3DVertexDeclaration
);
end:
LeaveCriticalSection
(
&
ddraw_cs
);
if
(
hr
==
D3D_OK
)
*
vertex_buf
=
buffer
;
else
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
D3D_OK
;
return
hr
;
}
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