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
8b5a3bc8
Commit
8b5a3bc8
authored
Jul 15, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Aug 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Allocate GPU BOs for discard maps on deferred contexts.
parent
4e219458
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
4 deletions
+46
-4
cs.c
dlls/wined3d/cs.c
+46
-4
No files found.
dlls/wined3d/cs.c
View file @
8b5a3bc8
...
...
@@ -29,6 +29,7 @@ struct wined3d_deferred_upload
{
struct
wined3d_resource
*
resource
;
unsigned
int
sub_resource_idx
;
struct
wined3d_bo
*
bo
;
uint8_t
*
sysmem
,
*
map_ptr
;
struct
wined3d_box
box
;
uint32_t
upload_flags
;
...
...
@@ -4137,7 +4138,9 @@ static bool wined3d_deferred_context_map_upload_bo(struct wined3d_device_context
{
struct
wined3d_deferred_context
*
deferred
=
wined3d_deferred_context_from_context
(
context
);
const
struct
wined3d_format
*
format
=
resource
->
format
;
struct
wined3d_device
*
device
=
context
->
device
;
struct
wined3d_deferred_upload
*
upload
;
struct
wined3d_bo_address
addr
;
uint8_t
*
sysmem
;
size_t
size
;
...
...
@@ -4174,6 +4177,24 @@ static bool wined3d_deferred_context_map_upload_bo(struct wined3d_device_context
deferred
->
upload_count
+
1
,
sizeof
(
*
deferred
->
uploads
)))
return
false
;
upload
=
&
deferred
->
uploads
[
deferred
->
upload_count
++
];
if
((
flags
&
WINED3D_MAP_DISCARD
)
&&
device
->
adapter
->
adapter_ops
->
adapter_alloc_bo
(
device
,
resource
,
sub_resource_idx
,
&
addr
))
{
upload
->
bo
=
addr
.
buffer_object
;
upload
->
sysmem
=
NULL
;
TRACE
(
"Allocated BO %s.
\n
"
,
debug_bo_address
(
&
addr
));
wined3d_device_bo_map_lock
(
device
);
upload
->
map_ptr
=
addr
.
buffer_object
->
map_ptr
;
wined3d_device_bo_map_unlock
(
device
);
upload
->
map_ptr
+=
addr
.
buffer_object
->
memory_offset
;
assert
(
upload
->
map_ptr
);
}
else
{
if
(
!
deferred
->
upload_heap
)
{
if
(
!
(
deferred
->
upload_heap
=
HeapCreate
(
0
,
0
,
0
)))
...
...
@@ -4195,13 +4216,15 @@ static bool wined3d_deferred_context_map_upload_bo(struct wined3d_device_context
if
(
!
(
sysmem
=
HeapAlloc
(
deferred
->
upload_heap
,
0
,
size
+
RESOURCE_ALIGNMENT
-
1
)))
return
false
;
upload
=
&
deferred
->
uploads
[
deferred
->
upload_count
++
];
upload
->
bo
=
NULL
;
upload
->
sysmem
=
sysmem
;
upload
->
map_ptr
=
(
void
*
)
align
((
size_t
)
upload
->
sysmem
,
RESOURCE_ALIGNMENT
);
}
upload
->
upload_flags
=
UPLOAD_BO_UPLOAD_ON_UNMAP
;
upload
->
resource
=
resource
;
wined3d_resource_incref
(
resource
);
upload
->
sub_resource_idx
=
sub_resource_idx
;
upload
->
sysmem
=
sysmem
;
upload
->
map_ptr
=
(
void
*
)
align
((
size_t
)
upload
->
sysmem
,
RESOURCE_ALIGNMENT
);
upload
->
box
=
*
box
;
map_desc
->
data
=
upload
->
map_ptr
;
...
...
@@ -4217,7 +4240,9 @@ static bool wined3d_deferred_context_unmap_upload_bo(struct wined3d_device_conte
if
((
upload
=
deferred_context_get_upload
(
deferred
,
resource
,
sub_resource_idx
)))
{
*
box
=
upload
->
box
;
bo
->
addr
.
buffer_object
=
0
;
if
((
bo
->
addr
.
buffer_object
=
upload
->
bo
))
bo
->
addr
.
addr
=
NULL
;
else
bo
->
addr
.
addr
=
upload
->
map_ptr
;
bo
->
flags
=
upload
->
upload_flags
;
upload
->
upload_flags
=
0
;
...
...
@@ -4456,12 +4481,29 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
static
void
wined3d_command_list_destroy_object
(
void
*
object
)
{
struct
wined3d_command_list
*
list
=
object
;
struct
wined3d_context
*
context
;
unsigned
int
i
;
TRACE
(
"list %p.
\n
"
,
list
);
context
=
context_acquire
(
list
->
device
,
NULL
,
0
);
for
(
i
=
0
;
i
<
list
->
upload_count
;
++
i
)
{
struct
wined3d_bo
*
bo
;
if
((
bo
=
list
->
uploads
[
i
].
bo
))
{
wined3d_context_destroy_bo
(
context
,
bo
);
heap_free
(
bo
);
}
else
{
HeapFree
(
list
->
upload_heap
,
0
,
list
->
uploads
[
i
].
sysmem
);
}
}
context_release
(
context
);
if
(
list
->
upload_heap
)
{
...
...
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