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
261246ef
Commit
261246ef
authored
Sep 16, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass a resource to wined3d_resource_allocate_sysmem().
parent
2b2bf64d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
18 deletions
+21
-18
buffer.c
dlls/wined3d/buffer.c
+2
-1
resource.c
dlls/wined3d/resource.c
+9
-8
surface.c
dlls/wined3d/surface.c
+5
-6
volume.c
dlls/wined3d/volume.c
+4
-2
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/buffer.c
View file @
261246ef
...
...
@@ -500,7 +500,8 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, struct wined3d_context *con
/* AllocatedMemory exists if the buffer is double buffered or has no buffer object at all */
if
(
This
->
resource
.
allocatedMemory
)
return
This
->
resource
.
allocatedMemory
;
This
->
resource
.
heap_memory
=
wined3d_resource_allocate_sysmem
(
This
->
resource
.
size
);
if
(
!
wined3d_resource_allocate_sysmem
(
&
This
->
resource
))
ERR
(
"Failed to allocate system memory.
\n
"
);
This
->
resource
.
allocatedMemory
=
This
->
resource
.
heap_memory
;
if
(
This
->
buffer_type_hint
==
GL_ELEMENT_ARRAY_BUFFER_ARB
)
...
...
dlls/wined3d/resource.c
View file @
261246ef
...
...
@@ -120,11 +120,10 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
if
(
size
)
{
resource
->
heap_memory
=
wined3d_resource_allocate_sysmem
(
size
);
if
(
!
resource
->
heap_memory
)
if
(
!
wined3d_resource_allocate_sysmem
(
resource
))
{
ERR
(
"
Out of memory!
\n
"
);
return
WINED3DERR_OUTOFVIDEO
MEMORY
;
ERR
(
"
Failed to allocate system memory.
\n
"
);
return
E_OUTOF
MEMORY
;
}
}
else
...
...
@@ -344,19 +343,21 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st
desc
->
size
=
resource
->
size
;
}
void
*
wined3d_resource_allocate_sysmem
(
SIZE_T
siz
e
)
BOOL
wined3d_resource_allocate_sysmem
(
struct
wined3d_resource
*
resourc
e
)
{
void
**
p
;
SIZE_T
align
=
RESOURCE_ALIGNMENT
-
1
+
sizeof
(
*
p
);
void
*
mem
;
if
(
!
(
mem
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
+
align
)))
return
NULL
;
if
(
!
(
mem
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
resource
->
size
+
align
)))
return
FALSE
;
p
=
(
void
**
)(((
ULONG_PTR
)
mem
+
align
)
&
~
(
RESOURCE_ALIGNMENT
-
1
))
-
1
;
*
p
=
mem
;
return
++
p
;
resource
->
heap_memory
=
++
p
;
return
TRUE
;
}
void
wined3d_resource_free_sysmem
(
void
*
mem
)
...
...
dlls/wined3d/surface.c
View file @
261246ef
...
...
@@ -587,9 +587,8 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
{
/* Whatever surface we have, make sure that there is memory allocated
* for the downloaded copy, or a PBO to map. */
if
(
!
surface
->
resource
.
heap_memory
)
surface
->
resource
.
heap_memory
=
wined3d_resource_allocate_sysmem
(
surface
->
resource
.
size
);
if
(
!
surface
->
resource
.
heap_memory
&&
!
wined3d_resource_allocate_sysmem
(
&
surface
->
resource
))
ERR
(
"Failed to allocate system memory.
\n
"
);
surface
->
resource
.
allocatedMemory
=
surface
->
resource
.
heap_memory
;
if
(
surface
->
flags
&
SFLAG_INSYSMEM
)
...
...
@@ -1432,7 +1431,7 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win
else
{
if
(
!
surface
->
resource
.
heap_memory
)
surface
->
resource
.
heap_memory
=
wined3d_resource_allocate_sysmem
(
surface
->
resource
.
siz
e
);
wined3d_resource_allocate_sysmem
(
&
surface
->
resourc
e
);
else
if
(
!
(
surface
->
flags
&
SFLAG_CLIENT
))
ERR
(
"Surface %p has heap_memory %p and flags %#x.
\n
"
,
surface
,
surface
->
resource
.
heap_memory
,
surface
->
flags
);
...
...
@@ -1458,9 +1457,9 @@ static BOOL surface_init_sysmem(struct wined3d_surface *surface)
{
if
(
!
surface
->
resource
.
heap_memory
)
{
if
(
!
(
surface
->
resource
.
heap_memory
=
wined3d_resource_allocate_sysmem
(
surface
->
resource
.
size
)
))
if
(
!
wined3d_resource_allocate_sysmem
(
&
surface
->
resource
))
{
ERR
(
"Failed to allocate memory.
\n
"
);
ERR
(
"Failed to allocate
system
memory.
\n
"
);
return
FALSE
;
}
}
...
...
dlls/wined3d/volume.c
View file @
261246ef
...
...
@@ -391,9 +391,11 @@ 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
)
if
(
!
wined3d_resource_allocate_sysmem
(
&
volume
->
resource
))
{
ERR
(
"Failed to allocate system memory.
\n
"
);
return
FALSE
;
}
volume
->
resource
.
allocatedMemory
=
volume
->
resource
.
heap_memory
;
return
TRUE
;
}
...
...
dlls/wined3d/wined3d_private.h
View file @
261246ef
...
...
@@ -1984,7 +1984,6 @@ struct wined3d_resource_ops
void
(
*
resource_unload
)(
struct
wined3d_resource
*
resource
);
};
void
*
wined3d_resource_allocate_sysmem
(
SIZE_T
size
)
DECLSPEC_HIDDEN
;
void
wined3d_resource_free_sysmem
(
void
*
mem
)
DECLSPEC_HIDDEN
;
struct
wined3d_resource
...
...
@@ -2025,6 +2024,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
const
struct
wined3d_resource_ops
*
resource_ops
)
DECLSPEC_HIDDEN
;
DWORD
resource_set_priority
(
struct
wined3d_resource
*
resource
,
DWORD
priority
)
DECLSPEC_HIDDEN
;
void
resource_unload
(
struct
wined3d_resource
*
resource
)
DECLSPEC_HIDDEN
;
BOOL
wined3d_resource_allocate_sysmem
(
struct
wined3d_resource
*
resource
)
DECLSPEC_HIDDEN
;
DWORD
wined3d_resource_sanitize_map_flags
(
const
struct
wined3d_resource
*
resource
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
GLbitfield
wined3d_resource_gl_map_flags
(
DWORD
d3d_flags
)
DECLSPEC_HIDDEN
;
...
...
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