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
fe80b4ea
Commit
fe80b4ea
authored
Jul 15, 2005
by
Oliver Stieber
Committed by
Alexandre Julliard
Jul 15, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Get/Set/Free private data in resource.
parent
a221e0e2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
4 deletions
+120
-4
resource.c
dlls/wined3d/resource.c
+100
-4
wined3d_private.h
dlls/wined3d/wined3d_private.h
+20
-0
No files found.
dlls/wined3d/resource.c
View file @
fe80b4ea
...
...
@@ -81,18 +81,114 @@ HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DD
return
D3D_OK
;
}
/* Private Date is not implemented yet */
static
PrivateData
**
IWineD3DResourceImpl_FindPrivateData
(
IWineD3DResourceImpl
*
This
,
REFGUID
tag
)
{
PrivateData
**
data
;
for
(
data
=
&
This
->
resource
.
privateData
;
*
data
!=
NULL
;
data
=
&
(
*
data
)
->
next
)
{
if
(
IsEqualGUID
(
&
(
*
data
)
->
tag
,
tag
))
break
;
}
return
data
;
}
HRESULT
WINAPI
IWineD3DResourceImpl_SetPrivateData
(
IWineD3DResource
*
iface
,
REFGUID
refguid
,
CONST
void
*
pData
,
DWORD
SizeOfData
,
DWORD
Flags
)
{
IWineD3DResourceImpl
*
This
=
(
IWineD3DResourceImpl
*
)
iface
;
FIXME
(
"(%p) : stub
\n
"
,
This
);
return
D3D_OK
;
PrivateData
**
data
;
TRACE
(
"(%p) : %p %p %ld %ld
\n
"
,
This
,
refguid
,
pData
,
SizeOfData
,
Flags
);
data
=
IWineD3DResourceImpl_FindPrivateData
(
This
,
refguid
);
if
(
*
data
==
NULL
)
{
*
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
**
data
));
if
(
NULL
==
*
data
)
return
E_OUTOFMEMORY
;
(
*
data
)
->
tag
=
*
refguid
;
(
*
data
)
->
flags
=
Flags
;
#if 0
(*data)->uniquenessValue = This->uniquenessValue;
#endif
if
(
Flags
&
D3DSPD_IUNKNOWN
)
{
(
*
data
)
->
ptr
.
object
=
(
LPUNKNOWN
)
pData
;
(
*
data
)
->
size
=
sizeof
(
LPUNKNOWN
);
IUnknown_AddRef
((
*
data
)
->
ptr
.
object
);
}
else
{
(
*
data
)
->
ptr
.
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
SizeOfData
);
if
(
NULL
==
(
*
data
)
->
ptr
.
data
)
{
HeapFree
(
GetProcessHeap
(),
0
,
*
data
);
return
E_OUTOFMEMORY
;
}
}
/* link it in */
(
*
data
)
->
next
=
This
->
resource
.
privateData
;
This
->
resource
.
privateData
=
*
data
;
return
D3D_OK
;
}
else
{
/* I don't actually know how windows handles this case. The only
* reason I don't just call FreePrivateData is because I want to
* guarantee SetPrivateData working when using LPUNKNOWN or data
* that is no larger than the old data. */
return
E_FAIL
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DResourceImpl_GetPrivateData
(
IWineD3DResource
*
iface
,
REFGUID
refguid
,
void
*
pData
,
DWORD
*
pSizeOfData
)
{
IWineD3DResourceImpl
*
This
=
(
IWineD3DResourceImpl
*
)
iface
;
FIXME
(
"(%p) : stub
\n
"
,
This
);
return
D3D_OK
;
PrivateData
**
data
;
TRACE
(
"(%p) : %p %p %p
\n
"
,
This
,
refguid
,
pData
,
pSizeOfData
);
data
=
IWineD3DResourceImpl_FindPrivateData
(
This
,
refguid
);
if
(
*
data
==
NULL
)
return
D3DERR_NOTFOUND
;
#if 0 /* This may not be right. */
if (((*data)->flags & D3DSPD_VOLATILE)
&& (*data)->uniquenessValue != This->uniquenessValue)
return DDERR_EXPIRED;
#endif
if
(
*
pSizeOfData
<
(
*
data
)
->
size
)
{
*
pSizeOfData
=
(
*
data
)
->
size
;
return
D3DERR_MOREDATA
;
}
if
((
*
data
)
->
flags
&
D3DSPD_IUNKNOWN
)
{
*
(
LPUNKNOWN
*
)
pData
=
(
*
data
)
->
ptr
.
object
;
IUnknown_AddRef
((
*
data
)
->
ptr
.
object
);
}
else
{
memcpy
(
pData
,
(
*
data
)
->
ptr
.
data
,
(
*
data
)
->
size
);
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DResourceImpl_FreePrivateData
(
IWineD3DResource
*
iface
,
REFGUID
refguid
)
{
IWineD3DResourceImpl
*
This
=
(
IWineD3DResourceImpl
*
)
iface
;
FIXME
(
"(%p) : stub
\n
"
,
This
);
return
D3D_OK
;
PrivateData
**
data
;
TRACE
(
"(%p) : %p
\n
"
,
This
,
refguid
);
/* TODO: move this code off into a linked list class */
data
=
IWineD3DResourceImpl_FindPrivateData
(
This
,
refguid
);
if
(
*
data
==
NULL
)
return
D3DERR_NOTFOUND
;
*
data
=
(
*
data
)
->
next
;
if
((
*
data
)
->
flags
&
D3DSPD_IUNKNOWN
)
{
if
((
*
data
)
->
ptr
.
object
!=
NULL
)
IUnknown_Release
((
*
data
)
->
ptr
.
object
);
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
(
*
data
)
->
ptr
.
data
);
}
HeapFree
(
GetProcessHeap
(),
0
,
*
data
);
return
D3D_OK
;
}
/* Priority support is not implemented yet */
...
...
dlls/wined3d/wined3d_private.h
View file @
fe80b4ea
...
...
@@ -448,6 +448,25 @@ typedef struct IWineD3DDeviceImpl
extern
const
IWineD3DDeviceVtbl
IWineD3DDevice_Vtbl
;
/* Support for IWineD3DResource ::Set/Get/FreePrivateData. I don't think
* anybody uses it for much so a good implementation is optional. */
typedef
struct
PrivateData
{
struct
PrivateData
*
next
;
GUID
tag
;
DWORD
flags
;
/* DDSPD_* */
DWORD
uniqueness_value
;
union
{
LPVOID
data
;
LPUNKNOWN
object
;
}
ptr
;
DWORD
size
;
}
PrivateData
;
/*****************************************************************************
* IWineD3DResource implementation structure
*/
...
...
@@ -465,6 +484,7 @@ typedef struct IWineD3DResourceClass
DWORD
usage
;
WINED3DFORMAT
format
;
BYTE
*
allocatedMemory
;
PrivateData
*
privateData
;
}
IWineD3DResourceClass
;
...
...
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