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
a61f68fc
Commit
a61f68fc
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: Properly use the index buffer as a dynamic buffer.
parent
108fcb69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
ddraw_private.h
dlls/ddraw/ddraw_private.h
+1
-0
device.c
dlls/ddraw/device.c
+9
-3
No files found.
dlls/ddraw/ddraw_private.h
View file @
a61f68fc
...
...
@@ -277,6 +277,7 @@ struct d3d_device
struct
ddraw
*
ddraw
;
struct
wined3d_buffer
*
indexbuffer
;
UINT
indexbuffer_size
;
UINT
indexbuffer_pos
;
struct
ddraw_surface
*
target
;
/* Viewport management */
...
...
dlls/ddraw/device.c
View file @
a61f68fc
...
...
@@ -4041,6 +4041,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
DWORD
stride
=
get_flexible_vertex_size
(
vb
->
fvf
);
WORD
*
LockedIndices
;
HRESULT
hr
;
UINT
ib_pos
=
This
->
indexbuffer_pos
;
TRACE
(
"iface %p, primitive_type %#x, vb %p, start_vertex %u, vertex_count %u, indices %p, index_count %u, flags %#x.
\n
"
,
iface
,
PrimitiveType
,
D3DVertexBuf
,
StartVertex
,
NumVertices
,
Indices
,
IndexCount
,
Flags
);
...
...
@@ -4075,14 +4076,18 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
if
(
This
->
indexbuffer
)
wined3d_buffer_decref
(
This
->
indexbuffer
);
This
->
indexbuffer
=
buffer
;
This
->
indexbuffer_size
=
size
;
ib_pos
=
0
;
}
if
(
This
->
indexbuffer_size
-
IndexCount
*
sizeof
(
WORD
)
<
ib_pos
)
ib_pos
=
0
;
/* Copy the index stream into the index buffer. A new IWineD3DDevice
* method could be created which takes an user pointer containing the
* indices or a SetData-Method for the index buffer, which overrides the
* index buffer data with our pointer. */
hr
=
wined3d_buffer_map
(
This
->
indexbuffer
,
0
,
IndexCount
*
sizeof
(
WORD
),
(
BYTE
**
)
&
LockedIndices
,
0
);
hr
=
wined3d_buffer_map
(
This
->
indexbuffer
,
ib_pos
,
IndexCount
*
sizeof
(
WORD
),
(
BYTE
**
)
&
LockedIndices
,
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to map buffer, hr %#x.
\n
"
,
hr
);
...
...
@@ -4091,6 +4096,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
}
memcpy
(
LockedIndices
,
Indices
,
IndexCount
*
sizeof
(
WORD
));
wined3d_buffer_unmap
(
This
->
indexbuffer
);
This
->
indexbuffer_pos
=
ib_pos
+
IndexCount
*
sizeof
(
WORD
);
/* Set the index stream */
wined3d_device_set_base_vertex_index
(
This
->
wined3d_device
,
StartVertex
);
...
...
@@ -4107,7 +4113,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
wined3d_device_set_primitive_type
(
This
->
wined3d_device
,
PrimitiveType
);
hr
=
wined3d_device_draw_indexed_primitive
(
This
->
wined3d_device
,
0
,
IndexCount
);
hr
=
wined3d_device_draw_indexed_primitive
(
This
->
wined3d_device
,
ib_pos
/
sizeof
(
WORD
)
,
IndexCount
);
wined3d_mutex_unlock
();
...
...
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