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
a89f2e63
Commit
a89f2e63
authored
Aug 22, 2013
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 23, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move volume sysmem allocation into a separate function.
parent
6ca8b274
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
16 deletions
+30
-16
volume.c
dlls/wined3d/volume.c
+30
-16
No files found.
dlls/wined3d/volume.c
View file @
a89f2e63
...
...
@@ -203,6 +203,19 @@ void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *
wined3d_volume_load_location
(
volume
,
context
,
WINED3D_LOCATION_TEXTURE_RGB
);
}
static
BOOL
volume_prepare_system_memory
(
struct
wined3d_volume
*
volume
)
{
if
(
volume
->
resource
.
allocatedMemory
)
return
TRUE
;
volume
->
resource
.
heap_memory
=
wined3d_resource_allocate_sysmem
(
volume
->
resource
.
size
);
if
(
!
volume
->
resource
.
heap_memory
)
return
FALSE
;
volume
->
resource
.
allocatedMemory
=
volume
->
resource
.
heap_memory
;
return
TRUE
;
}
static
void
volume_unload
(
struct
wined3d_resource
*
resource
)
{
struct
wined3d_volume
*
volume
=
volume_from_resource
(
resource
);
...
...
@@ -214,13 +227,19 @@ static void volume_unload(struct wined3d_resource *resource)
TRACE
(
"texture %p.
\n
"
,
resource
);
context
=
context_acquire
(
device
,
NULL
);
wined3d_volume_load_location
(
volume
,
context
,
WINED3D_LOCATION_SYSMEM
);
context_release
(
context
);
wined3d_volume_invalidate_location
(
volume
,
~
WINED3D_LOCATION_SYSMEM
);
if
(
volume_prepare_system_memory
(
volume
))
{
context
=
context_acquire
(
device
,
NULL
);
wined3d_volume_load_location
(
volume
,
context
,
WINED3D_LOCATION_SYSMEM
);
context_release
(
context
);
wined3d_volume_invalidate_location
(
volume
,
~
WINED3D_LOCATION_SYSMEM
);
}
else
{
ERR
(
"Out of memory when unloading volume %p.
\n
"
,
volume
);
wined3d_volume_validate_location
(
volume
,
WINED3D_LOCATION_DISCARDED
);
wined3d_volume_invalidate_location
(
volume
,
~
WINED3D_LOCATION_DISCARDED
);
}
/* The texture name is managed by the container. */
volume
->
flags
&=
~
WINED3D_VFLAG_ALLOCATED
;
...
...
@@ -306,16 +325,11 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
TRACE
(
"volume %p, map_desc %p, box %p, flags %#x.
\n
"
,
volume
,
map_desc
,
box
,
flags
);
if
(
!
volume
->
resource
.
allocatedMemory
)
if
(
!
volume
_prepare_system_memory
(
volume
)
)
{
volume
->
resource
.
heap_memory
=
wined3d_resource_allocate_sysmem
(
volume
->
resource
.
size
);
if
(
!
volume
->
resource
.
heap_memory
)
{
WARN
(
"Out of memory.
\n
"
);
map_desc
->
data
=
NULL
;
return
E_OUTOFMEMORY
;
}
volume
->
resource
.
allocatedMemory
=
volume
->
resource
.
heap_memory
;
WARN
(
"Out of memory.
\n
"
);
map_desc
->
data
=
NULL
;
return
E_OUTOFMEMORY
;
}
if
(
!
(
volume
->
locations
&
WINED3D_LOCATION_SYSMEM
))
...
...
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