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
67230fc0
Commit
67230fc0
authored
Dec 04, 2012
by
Stefan Dösinger
Committed by
Alexandre Julliard
Dec 04, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Create a dynamic buffer if DDLOCK_DISCARDCONTENTS is used.
parent
0432f6f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
8 deletions
+45
-8
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-0
vertexbuffer.c
dlls/ddraw/vertexbuffer.c
+43
-8
No files found.
dlls/ddraw/ddraw_private.h
View file @
67230fc0
...
@@ -527,6 +527,8 @@ struct d3d_vertex_buffer
...
@@ -527,6 +527,8 @@ struct d3d_vertex_buffer
/*** Storage for D3D7 specific things ***/
/*** Storage for D3D7 specific things ***/
DWORD
Caps
;
DWORD
Caps
;
DWORD
fvf
;
DWORD
fvf
;
DWORD
size
;
BOOL
dynamic
;
};
};
HRESULT
d3d_vertex_buffer_create
(
struct
d3d_vertex_buffer
**
buffer
,
struct
ddraw
*
ddraw
,
HRESULT
d3d_vertex_buffer_create
(
struct
d3d_vertex_buffer
**
buffer
,
struct
ddraw
*
ddraw
,
...
...
dlls/ddraw/vertexbuffer.c
View file @
67230fc0
...
@@ -185,6 +185,27 @@ static ULONG WINAPI d3d_vertex_buffer1_Release(IDirect3DVertexBuffer *iface)
...
@@ -185,6 +185,27 @@ static ULONG WINAPI d3d_vertex_buffer1_Release(IDirect3DVertexBuffer *iface)
* IDirect3DVertexBuffer Methods
* IDirect3DVertexBuffer Methods
*****************************************************************************/
*****************************************************************************/
static
HRESULT
d3d_vertex_buffer_create_wined3d_buffer
(
struct
d3d_vertex_buffer
*
buffer
,
BOOL
dynamic
,
struct
wined3d_buffer
**
wined3d_buffer
)
{
DWORD
usage
=
WINED3DUSAGE_STATICDECL
;
enum
wined3d_pool
pool
;
if
(
buffer
->
Caps
&
D3DVBCAPS_SYSTEMMEMORY
)
pool
=
WINED3D_POOL_SYSTEM_MEM
;
else
pool
=
WINED3D_POOL_DEFAULT
;
if
(
buffer
->
Caps
&
D3DVBCAPS_WRITEONLY
)
usage
|=
WINED3DUSAGE_WRITEONLY
;
if
(
dynamic
)
usage
|=
WINED3DUSAGE_DYNAMIC
;
return
wined3d_buffer_create_vb
(
buffer
->
ddraw
->
wined3d_device
,
buffer
->
size
,
usage
,
pool
,
buffer
,
&
ddraw_null_wined3d_parent_ops
,
wined3d_buffer
);
}
/*****************************************************************************
/*****************************************************************************
* IDirect3DVertexBuffer7::Lock
* IDirect3DVertexBuffer7::Lock
*
*
...
@@ -225,8 +246,28 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
...
@@ -225,8 +246,28 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
if
(
flags
&
DDLOCK_NOOVERWRITE
)
if
(
flags
&
DDLOCK_NOOVERWRITE
)
wined3d_flags
|=
WINED3D_MAP_NOOVERWRITE
;
wined3d_flags
|=
WINED3D_MAP_NOOVERWRITE
;
if
(
flags
&
DDLOCK_DISCARDCONTENTS
)
if
(
flags
&
DDLOCK_DISCARDCONTENTS
)
{
wined3d_flags
|=
WINED3D_MAP_DISCARD
;
wined3d_flags
|=
WINED3D_MAP_DISCARD
;
if
(
!
buffer
->
dynamic
)
{
struct
wined3d_buffer
*
new_buffer
;
wined3d_mutex_lock
();
hr
=
d3d_vertex_buffer_create_wined3d_buffer
(
buffer
,
TRUE
,
&
new_buffer
);
if
(
SUCCEEDED
(
hr
))
{
buffer
->
dynamic
=
TRUE
;
wined3d_buffer_decref
(
buffer
->
wineD3DVertexBuffer
);
buffer
->
wineD3DVertexBuffer
=
new_buffer
;
}
else
{
WARN
(
"Failed to create a dynamic buffer
\n
"
);
}
wined3d_mutex_unlock
();
}
}
wined3d_mutex_lock
();
wined3d_mutex_lock
();
if
(
data_size
)
if
(
data_size
)
{
{
...
@@ -534,7 +575,6 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
...
@@ -534,7 +575,6 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
struct
ddraw
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
struct
ddraw
*
ddraw
,
D3DVERTEXBUFFERDESC
*
desc
)
{
{
struct
d3d_vertex_buffer
*
buffer
;
struct
d3d_vertex_buffer
*
buffer
;
DWORD
usage
;
HRESULT
hr
=
D3D_OK
;
HRESULT
hr
=
D3D_OK
;
TRACE
(
"Vertex buffer description:
\n
"
);
TRACE
(
"Vertex buffer description:
\n
"
);
...
@@ -554,16 +594,11 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
...
@@ -554,16 +594,11 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
buffer
->
ddraw
=
ddraw
;
buffer
->
ddraw
=
ddraw
;
buffer
->
Caps
=
desc
->
dwCaps
;
buffer
->
Caps
=
desc
->
dwCaps
;
buffer
->
fvf
=
desc
->
dwFVF
;
buffer
->
fvf
=
desc
->
dwFVF
;
buffer
->
size
=
get_flexible_vertex_size
(
desc
->
dwFVF
)
*
desc
->
dwNumVertices
;
usage
=
desc
->
dwCaps
&
D3DVBCAPS_WRITEONLY
?
WINED3DUSAGE_WRITEONLY
:
0
;
usage
|=
WINED3DUSAGE_STATICDECL
;
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_buffer_create_vb
(
ddraw
->
wined3d_device
,
hr
=
d3d_vertex_buffer_create_wined3d_buffer
(
buffer
,
FALSE
,
&
buffer
->
wineD3DVertexBuffer
);
get_flexible_vertex_size
(
desc
->
dwFVF
)
*
desc
->
dwNumVertices
,
usage
,
desc
->
dwCaps
&
D3DVBCAPS_SYSTEMMEMORY
?
WINED3D_POOL_SYSTEM_MEM
:
WINED3D_POOL_DEFAULT
,
buffer
,
&
ddraw_null_wined3d_parent_ops
,
&
buffer
->
wineD3DVertexBuffer
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
WARN
(
"Failed to create wined3d vertex buffer, hr %#x.
\n
"
,
hr
);
WARN
(
"Failed to create wined3d vertex buffer, hr %#x.
\n
"
,
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