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
64dd435e
Commit
64dd435e
authored
Mar 13, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Only use a single allocation for each struct private_data.
parent
36796199
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
34 deletions
+16
-34
resource.c
dlls/wined3d/resource.c
+16
-34
No files found.
dlls/wined3d/resource.c
View file @
64dd435e
...
...
@@ -33,14 +33,12 @@ struct private_data
GUID
tag
;
DWORD
flags
;
/* DDSPD_* */
DWORD
size
;
union
{
void
*
data
;
BYTE
data
[
1
]
;
IUnknown
*
object
;
}
ptr
;
DWORD
size
;
};
static
DWORD
resource_access_from_pool
(
enum
wined3d_pool
pool
)
...
...
@@ -207,40 +205,32 @@ HRESULT CDECL wined3d_resource_set_private_data(struct wined3d_resource *resourc
const
void
*
data
,
DWORD
data_size
,
DWORD
flags
)
{
struct
private_data
*
d
;
const
void
*
ptr
=
data
;
TRACE
(
"resource %p, riid %s, data %p, data_size %u, flags %#x.
\n
"
,
resource
,
debugstr_guid
(
guid
),
data
,
data_size
,
flags
);
if
(
flags
&
WINED3DSPD_IUNKNOWN
&&
data_size
!=
sizeof
(
IUnknown
*
)
)
if
(
flags
&
WINED3DSPD_IUNKNOWN
)
{
WARN
(
"IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.
\n
"
,
data_size
);
return
WINED3DERR_INVALIDCALL
;
if
(
data_size
!=
sizeof
(
IUnknown
*
))
{
WARN
(
"IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.
\n
"
,
data_size
);
return
WINED3DERR_INVALIDCALL
;
}
ptr
=
&
data
;
}
d
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
d
));
if
(
!
d
)
return
E_OUTOFMEMORY
;
if
(
!
(
d
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
struct
private_data
,
ptr
.
data
[
data_size
]))))
return
E_OUTOFMEMORY
;
wined3d_resource_free_private_data
(
resource
,
guid
);
d
->
tag
=
*
guid
;
d
->
flags
=
flags
;
d
->
size
=
data_size
;
memcpy
(
d
->
ptr
.
data
,
ptr
,
data_size
);
if
(
flags
&
WINED3DSPD_IUNKNOWN
)
{
d
->
ptr
.
object
=
(
IUnknown
*
)
data
;
d
->
size
=
sizeof
(
IUnknown
*
);
IUnknown_AddRef
(
d
->
ptr
.
object
);
}
else
{
d
->
ptr
.
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
data_size
);
if
(
!
d
->
ptr
.
data
)
{
HeapFree
(
GetProcessHeap
(),
0
,
d
);
return
E_OUTOFMEMORY
;
}
d
->
size
=
data_size
;
memcpy
(
d
->
ptr
.
data
,
data
,
data_size
);
}
wined3d_resource_free_private_data
(
resource
,
guid
);
list_add_tail
(
&
resource
->
privateData
,
&
d
->
entry
);
return
WINED3D_OK
;
...
...
@@ -294,16 +284,8 @@ HRESULT CDECL wined3d_resource_free_private_data(struct wined3d_resource *resour
if
(
!
data
)
return
WINED3DERR_NOTFOUND
;
if
(
data
->
flags
&
WINED3DSPD_IUNKNOWN
)
{
if
(
data
->
ptr
.
object
)
IUnknown_Release
(
data
->
ptr
.
object
);
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
data
->
ptr
.
data
);
}
IUnknown_Release
(
data
->
ptr
.
object
);
list_remove
(
&
data
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
WINED3D_OK
;
...
...
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