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
a6e96956
Commit
a6e96956
authored
Dec 14, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Dec 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store the resource heap memory pointer separately.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55773
parent
e7d7ac77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
resource.c
dlls/wined3d/resource.c
+8
-11
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/resource.c
View file @
a6e96956
...
...
@@ -208,6 +208,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource
->
parent_ops
=
parent_ops
;
resource
->
resource_ops
=
resource_ops
;
resource
->
map_binding
=
WINED3D_LOCATION_SYSMEM
;
resource
->
heap_pointer
=
NULL
;
resource
->
heap_memory
=
NULL
;
/* Check that we have enough video ram left */
...
...
@@ -331,12 +332,11 @@ void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
static
BOOL
wined3d_resource_allocate_sysmem
(
struct
wined3d_resource
*
resource
)
{
void
**
p
;
/* Overallocate and add padding to the allocated pointer, to guard against
* games (for instance Railroad Tycoon 2) writing before the locked resource
* memory pointer.
*/
SIZE_T
align
=
RESOURCE_ALIGNMENT
+
sizeof
(
*
p
)
;
static
const
SIZE_T
align
=
RESOURCE_ALIGNMENT
;
void
*
mem
;
if
(
!
(
mem
=
heap_alloc_zero
(
resource
->
size
+
align
)))
...
...
@@ -345,10 +345,8 @@ static BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
return
FALSE
;
}
p
=
(
void
**
)(((
ULONG_PTR
)
mem
+
align
)
&
~
(
RESOURCE_ALIGNMENT
-
1
))
-
1
;
*
p
=
mem
;
resource
->
heap_memory
=
++
p
;
resource
->
heap_memory
=
(
void
*
)(((
ULONG_PTR
)
mem
+
align
)
&
~
(
RESOURCE_ALIGNMENT
-
1
));
resource
->
heap_pointer
=
mem
;
return
TRUE
;
}
...
...
@@ -363,13 +361,12 @@ BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource)
void
wined3d_resource_free_sysmem
(
struct
wined3d_resource
*
resource
)
{
void
**
p
=
resource
->
heap_memory
;
if
(
!
p
)
if
(
!
resource
->
heap_memory
)
return
;
heap_free
(
*
(
--
p
));
resource
->
heap_memory
=
NULL
;
heap_free
(
resource
->
heap_pointer
);
resource
->
heap_pointer
=
NULL
;
}
GLbitfield
wined3d_resource_gl_storage_flags
(
const
struct
wined3d_resource
*
resource
)
...
...
dlls/wined3d/wined3d_private.h
View file @
a6e96956
...
...
@@ -3199,6 +3199,7 @@ struct wined3d_resource
UINT
depth
;
UINT
size
;
unsigned
int
priority
;
void
*
heap_pointer
;
void
*
heap_memory
;
uint32_t
pin_sysmem
:
1
;
...
...
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