Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4b95487b
Commit
4b95487b
authored
Nov 27, 2012
by
Stefan Dösinger
Committed by
Alexandre Julliard
Nov 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Don't create a wastefully large index buffer.
parent
fc847f86
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
23 deletions
+7
-23
ddraw_private.h
dlls/ddraw/ddraw_private.h
+1
-0
device.c
dlls/ddraw/device.c
+6
-23
No files found.
dlls/ddraw/ddraw_private.h
View file @
4b95487b
...
...
@@ -276,6 +276,7 @@ struct d3d_device
struct
wined3d_device
*
wined3d_device
;
struct
ddraw
*
ddraw
;
struct
wined3d_buffer
*
indexbuffer
;
UINT
indexbuffer_size
;
struct
ddraw_surface
*
target
;
/* Viewport management */
...
...
dlls/ddraw/device.c
View file @
4b95487b
...
...
@@ -240,7 +240,7 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface)
* care of that on uninit_3d(). */
/* Free the index buffer. */
wined3d_buffer_decref
(
This
->
indexbuffer
);
if
(
This
->
indexbuffer
)
wined3d_buffer_decref
(
This
->
indexbuffer
);
/* Set the device up to render to the front buffer since the back
* buffer will vanish soon. */
...
...
@@ -4039,8 +4039,6 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
struct
d3d_device
*
This
=
impl_from_IDirect3DDevice7
(
iface
);
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
;
WORD
*
LockedIndices
;
HRESULT
hr
;
...
...
@@ -4058,13 +4056,9 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
wined3d_device_set_vertex_declaration
(
This
->
wined3d_device
,
vb
->
wineD3DVertexDeclaration
);
/* check that the buffer is large enough to hold the indices,
* reallocate if necessary. */
wined3d_resource
=
wined3d_buffer_get_resource
(
This
->
indexbuffer
);
wined3d_resource_get_desc
(
wined3d_resource
,
&
desc
);
if
(
desc
.
size
<
IndexCount
*
sizeof
(
WORD
))
if
(
This
->
indexbuffer_size
<
IndexCount
*
sizeof
(
WORD
))
{
UINT
size
=
max
(
desc
.
size
*
2
,
IndexCount
*
sizeof
(
WORD
));
UINT
size
=
max
(
This
->
indexbuffer_
size
*
2
,
IndexCount
*
sizeof
(
WORD
));
struct
wined3d_buffer
*
buffer
;
TRACE
(
"Growing index buffer to %u bytes
\n
"
,
size
);
...
...
@@ -4073,13 +4067,14 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
WINED3D_POOL_DEFAULT
,
NULL
,
&
ddraw_null_wined3d_parent_ops
,
&
buffer
);
if
(
FAILED
(
hr
))
{
ERR
(
"(%p)
IWineD3DDevice::CreateIndexBuffer
failed with hr = %08x
\n
"
,
This
,
hr
);
ERR
(
"(%p)
wined3d_buffer_create_ib
failed with hr = %08x
\n
"
,
This
,
hr
);
wined3d_mutex_unlock
();
return
hr
;
}
wined3d_buffer_decref
(
This
->
indexbuffer
);
if
(
This
->
indexbuffer
)
wined3d_buffer_decref
(
This
->
indexbuffer
);
This
->
indexbuffer
=
buffer
;
This
->
indexbuffer_size
=
size
;
}
/* Copy the index stream into the index buffer. A new IWineD3DDevice
...
...
@@ -6529,17 +6524,6 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw,
device
->
legacy_projection
=
ident
;
device
->
legacy_clipspace
=
ident
;
/* Create an index buffer, it's needed for indexed drawing */
hr
=
wined3d_buffer_create_ib
(
ddraw
->
wined3d_device
,
0x40000
/* Length. Don't know how long it should be */
,
WINED3DUSAGE_DYNAMIC
/* Usage */
,
WINED3D_POOL_DEFAULT
,
NULL
,
&
ddraw_null_wined3d_parent_ops
,
&
device
->
indexbuffer
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to create an index buffer, hr %#x.
\n
"
,
hr
);
ddraw_handle_table_destroy
(
&
device
->
handle_table
);
return
hr
;
}
/* This is for convenience. */
device
->
wined3d_device
=
ddraw
->
wined3d_device
;
wined3d_device_incref
(
ddraw
->
wined3d_device
);
...
...
@@ -6549,7 +6533,6 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw,
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to set render target, hr %#x.
\n
"
,
hr
);
wined3d_buffer_decref
(
device
->
indexbuffer
);
ddraw_handle_table_destroy
(
&
device
->
handle_table
);
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