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
f9d82ed1
Commit
f9d82ed1
authored
Mar 10, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Handles aren't supposed to be pointers.
This might even make d3d8 a bit more 64-bit safe.
parent
cbc86300
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
24 deletions
+71
-24
device.c
dlls/d3d8/device.c
+71
-24
No files found.
dlls/d3d8/device.c
View file @
f9d82ed1
...
...
@@ -1283,91 +1283,138 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface
object
->
wineD3DStateBlock
=
wineD3DStateBlock
;
*
pToken
=
(
DWORD
)
object
;
TRACE
(
"(%p)Returning %p %p
\n
"
,
This
,
object
,
wineD3DStateBlock
);
*
pToken
=
d3d8_allocate_handle
(
&
This
->
handle_table
,
object
);
LeaveCriticalSection
(
&
d3d8_cs
);
if
(
*
pToken
==
D3D8_INVALID_HANDLE
)
{
ERR
(
"Failed to create a handle
\n
"
);
IDirect3DStateBlock8_Release
((
IDirect3DStateBlock8
*
)
object
);
return
E_FAIL
;
}
++*
pToken
;
TRACE
(
"Returning %#x (%p).
\n
"
,
*
pToken
,
object
);
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_ApplyStateBlock
(
LPDIRECT3DDEVICE8
iface
,
DWORD
Token
)
{
IDirect3DStateBlock8Impl
*
pSB
=
(
IDirect3DStateBlock8Impl
*
)
Token
;
IDirect3DDevice8Impl
*
This
=
(
IDirect3DDevice8Impl
*
)
iface
;
IDirect3DStateBlock8Impl
*
pSB
;
HRESULT
hr
;
TRACE
(
"(%p) %
p Relay
\n
"
,
This
,
pSB
);
TRACE
(
"(%p) %
#x Relay
\n
"
,
This
,
Token
);
EnterCriticalSection
(
&
d3d8_cs
);
pSB
=
d3d8_get_object
(
&
This
->
handle_table
,
Token
-
1
);
if
(
!
pSB
)
{
WARN
(
"Invalid handle (%#x) passed.
\n
"
,
Token
);
LeaveCriticalSection
(
&
d3d8_cs
);
return
D3DERR_INVALIDCALL
;
}
hr
=
IWineD3DStateBlock_Apply
(
pSB
->
wineD3DStateBlock
);
LeaveCriticalSection
(
&
d3d8_cs
);
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CaptureStateBlock
(
LPDIRECT3DDEVICE8
iface
,
DWORD
Token
)
{
IDirect3DStateBlock8Impl
*
pSB
=
(
IDirect3DStateBlock8Impl
*
)
Token
;
IDirect3DDevice8Impl
*
This
=
(
IDirect3DDevice8Impl
*
)
iface
;
IDirect3DStateBlock8Impl
*
pSB
;
HRESULT
hr
;
TRACE
(
"(%p) %
p Relay
\n
"
,
This
,
pSB
);
TRACE
(
"(%p) %
#x Relay
\n
"
,
This
,
Token
);
EnterCriticalSection
(
&
d3d8_cs
);
pSB
=
d3d8_get_object
(
&
This
->
handle_table
,
Token
-
1
);
if
(
!
pSB
)
{
WARN
(
"Invalid handle (%#x) passed.
\n
"
,
Token
);
LeaveCriticalSection
(
&
d3d8_cs
);
return
D3DERR_INVALIDCALL
;
}
hr
=
IWineD3DStateBlock_Capture
(
pSB
->
wineD3DStateBlock
);
LeaveCriticalSection
(
&
d3d8_cs
);
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_DeleteStateBlock
(
LPDIRECT3DDEVICE8
iface
,
DWORD
Token
)
{
IDirect3DStateBlock8Impl
*
pSB
=
(
IDirect3DStateBlock8Impl
*
)
Token
;
IDirect3DDevice8Impl
*
This
=
(
IDirect3DDevice8Impl
*
)
iface
;
IDirect3DStateBlock8Impl
*
pSB
;
TRACE
(
"(%p) Relay
\n
"
,
This
);
EnterCriticalSection
(
&
d3d8_cs
);
pSB
=
d3d8_free_handle
(
&
This
->
handle_table
,
Token
-
1
);
LeaveCriticalSection
(
&
d3d8_cs
);
if
(
!
pSB
)
{
WARN
(
"Invalid handle (%#x) passed.
\n
"
,
Token
);
return
D3DERR_INVALIDCALL
;
}
if
(
IUnknown_Release
((
IUnknown
*
)
pSB
))
{
ERR
(
"Stateblock %p has references left, this shouldn't happen.
\n
"
,
pSB
);
}
LeaveCriticalSection
(
&
d3d8_cs
);
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CreateStateBlock
(
LPDIRECT3DDEVICE8
iface
,
D3DSTATEBLOCKTYPE
Type
,
DWORD
*
pToken
)
{
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CreateStateBlock
(
IDirect3DDevice8
*
iface
,
D3DSTATEBLOCKTYPE
Type
,
DWORD
*
handle
)
{
IDirect3DDevice8Impl
*
This
=
(
IDirect3DDevice8Impl
*
)
iface
;
IDirect3DStateBlock8Impl
*
object
;
HRESULT
hrc
=
D3D_OK
;
HRESULT
hr
;
TRACE
(
"(%p) Relay
\n
"
,
This
);
if
(
Type
!=
D3DSBT_ALL
&&
Type
!=
D3DSBT_PIXELSTATE
&&
Type
!=
D3DSBT_VERTEXSTATE
)
{
if
(
Type
!=
D3DSBT_ALL
&&
Type
!=
D3DSBT_PIXELSTATE
&&
Type
!=
D3DSBT_VERTEXSTATE
)
{
WARN
(
"Unexpected stateblock type, returning D3DERR_INVALIDCALL
\n
"
);
return
D3DERR_INVALIDCALL
;
}
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirect3DStateBlock8Impl
));
if
(
NULL
==
object
)
{
*
pToken
=
0
;
if
(
!
object
)
{
ERR
(
"Failed to allocate memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
object
->
lpVtbl
=
&
Direct3DStateBlock8_Vtbl
;
object
->
ref
=
1
;
EnterCriticalSection
(
&
d3d8_cs
);
hrc
=
IWineD3DDevice_CreateStateBlock
(
This
->
WineD3DDevice
,
(
WINED3DSTATEBLOCKTYPE
)
Type
,
&
object
->
wineD3DStateBlock
,
(
IUnknown
*
)
object
);
hr
=
IWineD3DDevice_CreateStateBlock
(
This
->
WineD3DDevice
,
(
WINED3DSTATEBLOCKTYPE
)
Type
,
&
object
->
wineD3DStateBlock
,
(
IUnknown
*
)
object
);
if
(
FAILED
(
hr
))
{
LeaveCriticalSection
(
&
d3d8_cs
);
if
(
D3D_OK
!=
hrc
){
FIXME
(
"(%p) Call to IWineD3DDevice_CreateStateBlock failed.
\n
"
,
This
);
ERR
(
"IWineD3DDevice_CreateStateBlock failed, hr %#x
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
pToken
=
0
;
}
else
{
*
pToken
=
(
DWORD
)
object
;
TRACE
(
"(%p) returning token (ptr to stateblock) of %p
\n
"
,
This
,
object
);
return
hr
;
}
return
hrc
;
*
handle
=
d3d8_allocate_handle
(
&
This
->
handle_table
,
object
);
LeaveCriticalSection
(
&
d3d8_cs
);
if
(
*
handle
==
D3D8_INVALID_HANDLE
)
{
ERR
(
"Failed to allocate a handle.
\n
"
);
IDirect3DStateBlock8_Release
((
IDirect3DStateBlock8
*
)
object
);
return
E_FAIL
;
}
++*
handle
;
TRACE
(
"Returning %#x (%p).
\n
"
,
*
handle
,
object
);
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_SetClipStatus
(
LPDIRECT3DDEVICE8
iface
,
CONST
D3DCLIPSTATUS8
*
pClipStatus
)
{
...
...
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