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
7f8ccf03
Commit
7f8ccf03
authored
Jan 19, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Add a separate function for stateblock initialization.
parent
d967973d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
81 deletions
+115
-81
d3d9_private.h
dlls/d3d9/d3d9_private.h
+2
-5
device.c
dlls/d3d9/device.c
+91
-0
stateblock.c
dlls/d3d9/stateblock.c
+22
-76
No files found.
dlls/d3d9/d3d9_private.h
View file @
7f8ccf03
...
...
@@ -187,11 +187,6 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_GetSwapChain
(
IDirect3DDevice9Ex
*
iface
,
UINT
iSwapChain
,
IDirect3DSwapChain9
**
pSwapChain
)
DECLSPEC_HIDDEN
;
extern
UINT
WINAPI
IDirect3DDevice9Impl_GetNumberOfSwapChains
(
IDirect3DDevice9Ex
*
iface
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_CreateStateBlock
(
IDirect3DDevice9Ex
*
iface
,
D3DSTATEBLOCKTYPE
Type
,
IDirect3DStateBlock9
**
ppSB
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_BeginStateBlock
(
IDirect3DDevice9Ex
*
iface
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_EndStateBlock
(
IDirect3DDevice9Ex
*
iface
,
IDirect3DStateBlock9
**
ppSB
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_SetVertexDeclaration
(
IDirect3DDevice9Ex
*
iface
,
IDirect3DVertexDeclaration9
*
pDecl
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_GetVertexDeclaration
(
IDirect3DDevice9Ex
*
iface
,
...
...
@@ -467,6 +462,8 @@ typedef struct IDirect3DStateBlock9Impl {
LPDIRECT3DDEVICE9EX
parentDevice
;
}
IDirect3DStateBlock9Impl
;
HRESULT
stateblock_init
(
IDirect3DStateBlock9Impl
*
stateblock
,
IDirect3DDevice9Impl
*
device
,
D3DSTATEBLOCKTYPE
type
,
IWineD3DStateBlock
*
wined3d_stateblock
)
DECLSPEC_HIDDEN
;
/* --------------------------- */
/* IDirect3DVertexDeclaration9 */
...
...
dlls/d3d9/device.c
View file @
7f8ccf03
...
...
@@ -1414,6 +1414,97 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9EX
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DDevice9Impl_CreateStateBlock
(
IDirect3DDevice9Ex
*
iface
,
D3DSTATEBLOCKTYPE
type
,
IDirect3DStateBlock9
**
stateblock
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IDirect3DStateBlock9Impl
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, type %#x, stateblock %p.
\n
"
,
iface
,
type
,
stateblock
);
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
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate stateblock memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
hr
=
stateblock_init
(
object
,
This
,
type
,
NULL
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize stateblock, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
TRACE
(
"Created stateblock %p.
\n
"
,
object
);
*
stateblock
=
(
IDirect3DStateBlock9
*
)
object
;
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DDevice9Impl_BeginStateBlock
(
IDirect3DDevice9Ex
*
iface
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
HRESULT
hr
;
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_BeginStateBlock
(
This
->
WineD3DDevice
);
wined3d_mutex_unlock
();
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DDevice9Impl_EndStateBlock
(
IDirect3DDevice9Ex
*
iface
,
IDirect3DStateBlock9
**
stateblock
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IWineD3DStateBlock
*
wined3d_stateblock
;
IDirect3DStateBlock9Impl
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, stateblock %p.
\n
"
,
iface
,
stateblock
);
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_EndStateBlock
(
This
->
WineD3DDevice
,
&
wined3d_stateblock
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
WARN
(
"IWineD3DDevice_EndStateBlock() failed, hr %#x.
\n
"
,
hr
);
return
hr
;
}
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate stateblock memory.
\n
"
);
IWineD3DStateBlock_Release
(
wined3d_stateblock
);
return
E_OUTOFMEMORY
;
}
hr
=
stateblock_init
(
object
,
This
,
0
,
wined3d_stateblock
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize stateblock, hr %#x.
\n
"
,
hr
);
IWineD3DStateBlock_Release
(
wined3d_stateblock
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
TRACE
(
"Created stateblock %p.
\n
"
,
object
);
*
stateblock
=
(
IDirect3DStateBlock9
*
)
object
;
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DDevice9Impl_SetClipStatus
(
LPDIRECT3DDEVICE9EX
iface
,
CONST
D3DCLIPSTATUS9
*
pClipStatus
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
HRESULT
hr
;
...
...
dlls/d3d9/stateblock.c
View file @
7f8ccf03
...
...
@@ -123,87 +123,33 @@ static const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl =
IDirect3DStateBlock9Impl_Apply
};
/* IDirect3DDevice9 IDirect3DStateBlock9 Methods follow: */
HRESULT
WINAPI
IDirect3DDevice9Impl_CreateStateBlock
(
LPDIRECT3DDEVICE9EX
iface
,
D3DSTATEBLOCKTYPE
Type
,
IDirect3DStateBlock9
**
ppStateBlock
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IDirect3DStateBlock9Impl
*
object
;
HRESULT
hrc
=
D3D_OK
;
TRACE
(
"iface %p, type %#x, stateblock %p.
\n
"
,
iface
,
Type
,
ppStateBlock
);
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
(
IDirect3DStateBlock9Impl
));
if
(
NULL
==
object
)
return
E_OUTOFMEMORY
;
object
->
lpVtbl
=
&
Direct3DStateBlock9_Vtbl
;
object
->
ref
=
1
;
wined3d_mutex_lock
();
hrc
=
IWineD3DDevice_CreateStateBlock
(
This
->
WineD3DDevice
,
(
WINED3DSTATEBLOCKTYPE
)
Type
,
&
object
->
wineD3DStateBlock
,
(
IUnknown
*
)
object
);
wined3d_mutex_unlock
();
if
(
hrc
!=
D3D_OK
){
FIXME
(
"(%p) Call to IWineD3DDevice_CreateStateBlock failed.
\n
"
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
}
else
{
IDirect3DDevice9Ex_AddRef
(
iface
);
object
->
parentDevice
=
iface
;
*
ppStateBlock
=
(
IDirect3DStateBlock9
*
)
object
;
TRACE
(
"(%p) : Created stateblock %p
\n
"
,
This
,
object
);
}
TRACE
(
"(%p) returning token (ptr to stateblock) of %p
\n
"
,
This
,
object
);
return
hrc
;
}
HRESULT
WINAPI
IDirect3DDevice9Impl_BeginStateBlock
(
IDirect3DDevice9Ex
*
iface
)
HRESULT
stateblock_init
(
IDirect3DStateBlock9Impl
*
stateblock
,
IDirect3DDevice9Impl
*
device
,
D3DSTATEBLOCKTYPE
type
,
IWineD3DStateBlock
*
wined3d_stateblock
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
HRESULT
hr
;
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_BeginStateBlock
(
This
->
WineD3DDevice
);
wined3d_mutex_unlock
();
return
hr
;
}
stateblock
->
lpVtbl
=
&
Direct3DStateBlock9_Vtbl
;
stateblock
->
ref
=
1
;
HRESULT
WINAPI
IDirect3DDevice9Impl_EndStateBlock
(
IDirect3DDevice9Ex
*
iface
,
IDirect3DStateBlock9
**
ppSB
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IWineD3DStateBlock
*
wineD3DStateBlock
;
IDirect3DStateBlock9Impl
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, stateblock %p.
\n
"
,
iface
,
ppSB
);
/* Tell wineD3D to endstateblock before anything else (in case we run out
* of memory later and cause locking problems) */
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_EndStateBlock
(
This
->
WineD3DDevice
,
&
wineD3DStateBlock
);
wined3d_mutex_unlock
();
if
(
hr
!=
D3D_OK
)
if
(
wined3d_stateblock
)
{
WARN
(
"IWineD3DDevice_EndStateBlock returned an error
\n
"
);
return
hr
;
stateblock
->
wineD3DStateBlock
=
wined3d_stateblock
;
}
/* allocate a new IDirectD3DStateBlock */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirect3DStateBlock9Impl
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
object
->
ref
=
1
;
object
->
lpVtbl
=
&
Direct3DStateBlock9_Vtbl
;
object
->
wineD3DStateBlock
=
wineD3DStateBlock
;
IDirect3DDevice9Ex_AddRef
(
iface
);
object
->
parentDevice
=
iface
;
*
ppSB
=
(
IDirect3DStateBlock9
*
)
object
;
TRACE
(
"(%p) Returning *ppSB %p, wineD3DStateBlock %p
\n
"
,
This
,
*
ppSB
,
wineD3DStateBlock
);
else
{
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_CreateStateBlock
(
device
->
WineD3DDevice
,
(
WINED3DSTATEBLOCKTYPE
)
type
,
&
stateblock
->
wineD3DStateBlock
,
(
IUnknown
*
)
stateblock
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d stateblock, hr %#x.
\n
"
,
hr
);
return
hr
;
}
}
stateblock
->
parentDevice
=
(
IDirect3DDevice9Ex
*
)
device
;
IDirect3DDevice9Ex_AddRef
(
stateblock
->
parentDevice
);
return
D3D_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