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
4d289c0c
Commit
4d289c0c
authored
Jan 13, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
May 07, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Upload only the used range of indices in d3d_device7_DrawIndexedPrimitive().
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=44863
parent
498f0f11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
device.c
dlls/ddraw/device.c
+14
-4
No files found.
dlls/ddraw/device.c
View file @
4d289c0c
...
@@ -3582,9 +3582,11 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
...
@@ -3582,9 +3582,11 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
WORD
*
indices
,
DWORD
index_count
,
DWORD
flags
)
WORD
*
indices
,
DWORD
index_count
,
DWORD
flags
)
{
{
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice7
(
iface
);
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice7
(
iface
);
unsigned
int
idx_size
=
index_count
*
sizeof
(
*
indices
);
unsigned
short
min_index
=
USHRT_MAX
,
max_index
=
0
;
unsigned
int
i
;
HRESULT
hr
;
HRESULT
hr
;
UINT
stride
=
get_flexible_vertex_size
(
fvf
);
UINT
stride
=
get_flexible_vertex_size
(
fvf
);
UINT
vtx_size
=
stride
*
vertex_count
,
idx_size
=
index_count
*
sizeof
(
*
indices
);
UINT
vb_pos
,
ib_pos
;
UINT
vb_pos
,
ib_pos
;
TRACE
(
"iface %p, primitive_type %#x, fvf %#lx, vertices %p, vertex_count %lu, "
TRACE
(
"iface %p, primitive_type %#x, fvf %#lx, vertices %p, vertex_count %lu, "
...
@@ -3597,11 +3599,19 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
...
@@ -3597,11 +3599,19 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
return
D3D_OK
;
return
D3D_OK
;
}
}
/* Prince of Persia 3D creates large vertex buffers but only actually uses
* a few vertices from them. This improves performance dramatically. */
for
(
i
=
0
;
i
<
index_count
;
++
i
)
{
min_index
=
min
(
min_index
,
indices
[
i
]);
max_index
=
max
(
max_index
,
indices
[
i
]);
}
/* Set the D3DDevice's FVF */
/* Set the D3DDevice's FVF */
wined3d_mutex_lock
();
wined3d_mutex_lock
();
if
(
FAILED
(
hr
=
wined3d_streaming_buffer_upload
(
device
->
wined3d_device
,
if
(
FAILED
(
hr
=
wined3d_streaming_buffer_upload
(
device
->
wined3d_device
,
&
device
->
vertex_buffer
,
&
device
->
vertex_buffer
,
vertices
,
vtx_siz
e
,
stride
,
&
vb_pos
)))
(
char
*
)
vertices
+
(
min_index
*
stride
),
(
max_index
+
1
-
min_index
)
*
strid
e
,
stride
,
&
vb_pos
)))
goto
done
;
goto
done
;
if
(
FAILED
(
hr
=
wined3d_streaming_buffer_upload
(
device
->
wined3d_device
,
if
(
FAILED
(
hr
=
wined3d_streaming_buffer_upload
(
device
->
wined3d_device
,
...
@@ -3618,7 +3628,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
...
@@ -3618,7 +3628,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
wined3d_primitive_type_from_ddraw
(
primitive_type
),
0
);
wined3d_primitive_type_from_ddraw
(
primitive_type
),
0
);
wined3d_device_apply_stateblock
(
device
->
wined3d_device
,
device
->
state
);
wined3d_device_apply_stateblock
(
device
->
wined3d_device
,
device
->
state
);
d3d_device_sync_surfaces
(
device
);
d3d_device_sync_surfaces
(
device
);
wined3d_device_context_draw_indexed
(
device
->
immediate_context
,
vb_pos
/
stride
,
wined3d_device_context_draw_indexed
(
device
->
immediate_context
,
(
int
)(
vb_pos
/
stride
)
-
min_index
,
ib_pos
/
sizeof
(
*
indices
),
index_count
,
0
,
0
);
ib_pos
/
sizeof
(
*
indices
),
index_count
,
0
,
0
);
done:
done:
...
...
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