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
fea46645
Commit
fea46645
authored
Nov 17, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 17, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Add a separate function for device initialization.
parent
7676c664
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
117 deletions
+121
-117
d3d8_private.h
dlls/d3d8/d3d8_private.h
+3
-10
device.c
dlls/d3d8/device.c
+101
-3
directx.c
dlls/d3d8/directx.c
+17
-104
No files found.
dlls/d3d8/d3d8_private.h
View file @
fea46645
...
...
@@ -148,16 +148,6 @@ struct IDirect3D8Impl
IWineD3D
*
WineD3D
;
};
/* ---------------- */
/* IDirect3DDevice8 */
/* ---------------- */
/*****************************************************************************
* Predeclare the interface implementation structures
*/
extern
const
IDirect3DDevice8Vtbl
Direct3DDevice8_Vtbl
DECLSPEC_HIDDEN
;
extern
const
IWineD3DDeviceParentVtbl
d3d8_wined3d_device_parent_vtbl
DECLSPEC_HIDDEN
;
/*****************************************************************************
* IDirect3DDevice8 implementation structure
*/
...
...
@@ -211,6 +201,9 @@ struct IDirect3DDevice8Impl
BOOL
inDestruction
;
};
HRESULT
device_init
(
IDirect3DDevice8Impl
*
device
,
IWineD3D
*
wined3d
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
)
DECLSPEC_HIDDEN
;
/* ---------------- */
/* IDirect3DVolume8 */
/* ---------------- */
...
...
dlls/d3d8/device.c
View file @
fea46645
...
...
@@ -2469,8 +2469,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 ifa
return
rc
;
}
const
IDirect3DDevice8Vtbl
Direct3DDevice8_Vtbl
=
static
const
IDirect3DDevice8Vtbl
Direct3DDevice8_Vtbl
=
{
IDirect3DDevice8Impl_QueryInterface
,
IDirect3DDevice8Impl_AddRef
,
...
...
@@ -2798,7 +2797,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return
hr
;
}
const
IWineD3DDeviceParentVtbl
d3d8_wined3d_device_parent_vtbl
=
static
const
IWineD3DDeviceParentVtbl
d3d8_wined3d_device_parent_vtbl
=
{
/* IUnknown methods */
device_parent_QueryInterface
,
...
...
@@ -2812,3 +2811,102 @@ const IWineD3DDeviceParentVtbl d3d8_wined3d_device_parent_vtbl =
device_parent_CreateVolume
,
device_parent_CreateSwapChain
,
};
HRESULT
device_init
(
IDirect3DDevice8Impl
*
device
,
IWineD3D
*
wined3d
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
)
{
WINED3DPRESENT_PARAMETERS
wined3d_parameters
;
HRESULT
hr
;
device
->
lpVtbl
=
&
Direct3DDevice8_Vtbl
;
device
->
device_parent_vtbl
=
&
d3d8_wined3d_device_parent_vtbl
;
device
->
ref
=
1
;
device
->
handle_table
.
entries
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
D3D8_INITIAL_HANDLE_TABLE_SIZE
*
sizeof
(
*
device
->
handle_table
.
entries
));
if
(
!
device
->
handle_table
.
entries
)
{
ERR
(
"Failed to allocate handle table memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
device
->
handle_table
.
table_size
=
D3D8_INITIAL_HANDLE_TABLE_SIZE
;
wined3d_mutex_lock
();
hr
=
IWineD3D_CreateDevice
(
wined3d
,
adapter
,
device_type
,
focus_window
,
flags
,
(
IUnknown
*
)
device
,
(
IWineD3DDeviceParent
*
)
&
device
->
device_parent_vtbl
,
&
device
->
WineD3DDevice
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d device, hr %#x.
\n
"
,
hr
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
device
->
handle_table
.
entries
);
return
hr
;
}
if
(
flags
&
D3DCREATE_MULTITHREADED
)
IWineD3DDevice_SetMultithreaded
(
device
->
WineD3DDevice
);
wined3d_parameters
.
BackBufferWidth
=
parameters
->
BackBufferWidth
;
wined3d_parameters
.
BackBufferHeight
=
parameters
->
BackBufferHeight
;
wined3d_parameters
.
BackBufferFormat
=
wined3dformat_from_d3dformat
(
parameters
->
BackBufferFormat
);
wined3d_parameters
.
BackBufferCount
=
parameters
->
BackBufferCount
;
wined3d_parameters
.
MultiSampleType
=
parameters
->
MultiSampleType
;
wined3d_parameters
.
MultiSampleQuality
=
0
;
/* d3d9 only */
wined3d_parameters
.
SwapEffect
=
parameters
->
SwapEffect
;
wined3d_parameters
.
hDeviceWindow
=
parameters
->
hDeviceWindow
;
wined3d_parameters
.
Windowed
=
parameters
->
Windowed
;
wined3d_parameters
.
EnableAutoDepthStencil
=
parameters
->
EnableAutoDepthStencil
;
wined3d_parameters
.
AutoDepthStencilFormat
=
wined3dformat_from_d3dformat
(
parameters
->
AutoDepthStencilFormat
);
wined3d_parameters
.
Flags
=
parameters
->
Flags
;
wined3d_parameters
.
FullScreen_RefreshRateInHz
=
parameters
->
FullScreen_RefreshRateInHz
;
wined3d_parameters
.
PresentationInterval
=
parameters
->
FullScreen_PresentationInterval
;
wined3d_parameters
.
AutoRestoreDisplayMode
=
TRUE
;
hr
=
IWineD3DDevice_Init3D
(
device
->
WineD3DDevice
,
&
wined3d_parameters
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize 3D, hr %#x.
\n
"
,
hr
);
IWineD3DDevice_Release
(
device
->
WineD3DDevice
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
device
->
handle_table
.
entries
);
return
hr
;
}
hr
=
IWineD3DDevice_SetRenderState
(
device
->
WineD3DDevice
,
WINED3DRS_POINTSIZE_MIN
,
0
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to set minimum pointsize, hr %#x.
\n
"
,
hr
);
goto
err
;
}
parameters
->
BackBufferWidth
=
wined3d_parameters
.
BackBufferWidth
;
parameters
->
BackBufferHeight
=
wined3d_parameters
.
BackBufferHeight
;
parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
BackBufferFormat
);
parameters
->
BackBufferCount
=
wined3d_parameters
.
BackBufferCount
;
parameters
->
MultiSampleType
=
wined3d_parameters
.
MultiSampleType
;
parameters
->
SwapEffect
=
wined3d_parameters
.
SwapEffect
;
parameters
->
hDeviceWindow
=
wined3d_parameters
.
hDeviceWindow
;
parameters
->
Windowed
=
wined3d_parameters
.
Windowed
;
parameters
->
EnableAutoDepthStencil
=
wined3d_parameters
.
EnableAutoDepthStencil
;
parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
AutoDepthStencilFormat
);
parameters
->
Flags
=
wined3d_parameters
.
Flags
;
parameters
->
FullScreen_RefreshRateInHz
=
wined3d_parameters
.
FullScreen_RefreshRateInHz
;
parameters
->
FullScreen_PresentationInterval
=
wined3d_parameters
.
PresentationInterval
;
device
->
declArraySize
=
16
;
device
->
decls
=
HeapAlloc
(
GetProcessHeap
(),
0
,
device
->
declArraySize
*
sizeof
(
*
device
->
decls
));
if
(
!
device
->
decls
)
{
ERR
(
"Failed to allocate FVF vertex delcaration map memory.
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
err
;
}
return
D3D_OK
;
err:
wined3d_mutex_lock
();
IWineD3DDevice_Uninit3D
(
device
->
WineD3DDevice
,
D3D8CB_DestroySwapChain
);
IWineD3DDevice_Release
(
device
->
WineD3DDevice
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
device
->
handle_table
.
entries
);
return
hr
;
}
dlls/d3d8/directx.c
View file @
fea46645
...
...
@@ -341,122 +341,35 @@ ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
return
IUnknown_Release
(
swapChainParent
);
}
static
HRESULT
WINAPI
IDirect3D8Impl_CreateDevice
(
LPDIRECT3D8
iface
,
UINT
Adapter
,
D3DDEVTYPE
DeviceType
,
HWND
hFocusWindow
,
DWORD
BehaviourFlags
,
D3DPRESENT_PARAMETERS
*
pPresentationParameters
,
IDirect3DDevice8
**
ppReturnedDeviceInterface
)
{
IDirect3D8Impl
*
This
=
(
IDirect3D8Impl
*
)
iface
;
IDirect3DDevice8Impl
*
object
=
NULL
;
WINED3DPRESENT_PARAMETERS
localParameters
;
static
HRESULT
WINAPI
IDirect3D8Impl_CreateDevice
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
,
IDirect3DDevice8
**
device
)
{
IDirect3D8Impl
*
This
=
(
IDirect3D8Impl
*
)
iface
;
IDirect3DDevice8Impl
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, device %p.
\n
"
,
iface
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
pPresentationParameters
,
ppReturnedDeviceInterface
);
iface
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
,
device
);
/* Check the validity range of the adapter parameter */
if
(
Adapter
>=
IDirect3D8Impl_GetAdapterCount
(
iface
))
{
*
ppReturnedDeviceInterface
=
NULL
;
return
D3DERR_INVALIDCALL
;
}
/* Allocate the storage for the device object */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirect3DDevice8Impl
));
if
(
NULL
==
object
)
{
FIXME
(
"Allocation of memory failed
\n
"
);
*
ppReturnedDeviceInterface
=
NULL
;
return
D3DERR_OUTOFVIDEOMEMORY
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate device memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
object
->
lpVtbl
=
&
Direct3DDevice8_Vtbl
;
object
->
device_parent_vtbl
=
&
d3d8_wined3d_device_parent_vtbl
;
object
->
ref
=
1
;
object
->
handle_table
.
entries
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
D3D8_INITIAL_HANDLE_TABLE_SIZE
*
sizeof
(
*
object
->
handle_table
.
entries
));
object
->
handle_table
.
table_size
=
D3D8_INITIAL_HANDLE_TABLE_SIZE
;
*
ppReturnedDeviceInterface
=
(
IDirect3DDevice8
*
)
object
;
/* Allocate an associated WineD3DDevice object */
wined3d_mutex_lock
();
hr
=
IWineD3D_CreateDevice
(
This
->
WineD3D
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
(
IUnknown
*
)
object
,
(
IWineD3DDeviceParent
*
)
&
object
->
device_parent_vtbl
,
&
object
->
WineD3DDevice
);
if
(
hr
!=
D3D_OK
)
{
hr
=
device_init
(
object
,
This
->
WineD3D
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize device, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
ppReturnedDeviceInterface
=
NULL
;
wined3d_mutex_unlock
();
return
hr
;
}
TRACE
(
"(%p) : Created Device %p
\n
"
,
This
,
object
);
localParameters
.
BackBufferWidth
=
pPresentationParameters
->
BackBufferWidth
;
localParameters
.
BackBufferHeight
=
pPresentationParameters
->
BackBufferHeight
;
localParameters
.
BackBufferFormat
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
BackBufferFormat
);
localParameters
.
BackBufferCount
=
pPresentationParameters
->
BackBufferCount
;
localParameters
.
MultiSampleType
=
pPresentationParameters
->
MultiSampleType
;
localParameters
.
MultiSampleQuality
=
0
;
/* d3d9 only */
localParameters
.
SwapEffect
=
pPresentationParameters
->
SwapEffect
;
localParameters
.
hDeviceWindow
=
pPresentationParameters
->
hDeviceWindow
;
localParameters
.
Windowed
=
pPresentationParameters
->
Windowed
;
localParameters
.
EnableAutoDepthStencil
=
pPresentationParameters
->
EnableAutoDepthStencil
;
localParameters
.
AutoDepthStencilFormat
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
AutoDepthStencilFormat
);
localParameters
.
Flags
=
pPresentationParameters
->
Flags
;
localParameters
.
FullScreen_RefreshRateInHz
=
pPresentationParameters
->
FullScreen_RefreshRateInHz
;
localParameters
.
PresentationInterval
=
pPresentationParameters
->
FullScreen_PresentationInterval
;
localParameters
.
AutoRestoreDisplayMode
=
TRUE
;
if
(
BehaviourFlags
&
D3DCREATE_MULTITHREADED
)
{
IWineD3DDevice_SetMultithreaded
(
object
->
WineD3DDevice
);
}
hr
=
IWineD3DDevice_Init3D
(
object
->
WineD3DDevice
,
&
localParameters
);
if
(
hr
!=
D3D_OK
)
{
wined3d_mutex_unlock
();
FIXME
(
"(%p) D3D Initialization failed for WineD3DDevice %p
\n
"
,
This
,
object
->
WineD3DDevice
);
goto
err
;
}
hr
=
IWineD3DDevice_SetRenderState
(
object
->
WineD3DDevice
,
WINED3DRS_POINTSIZE_MIN
,
0
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
FIXME
(
"(%p) SetRenderState failed
\n
"
,
This
);
goto
err
;
}
TRACE
(
"Created device %p.
\n
"
,
object
);
*
device
=
(
IDirect3DDevice8
*
)
object
;
pPresentationParameters
->
BackBufferWidth
=
localParameters
.
BackBufferWidth
;
pPresentationParameters
->
BackBufferHeight
=
localParameters
.
BackBufferHeight
;
pPresentationParameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
localParameters
.
BackBufferFormat
);
pPresentationParameters
->
BackBufferCount
=
localParameters
.
BackBufferCount
;
pPresentationParameters
->
MultiSampleType
=
localParameters
.
MultiSampleType
;
pPresentationParameters
->
SwapEffect
=
localParameters
.
SwapEffect
;
pPresentationParameters
->
hDeviceWindow
=
localParameters
.
hDeviceWindow
;
pPresentationParameters
->
Windowed
=
localParameters
.
Windowed
;
pPresentationParameters
->
EnableAutoDepthStencil
=
localParameters
.
EnableAutoDepthStencil
;
pPresentationParameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
localParameters
.
AutoDepthStencilFormat
);
pPresentationParameters
->
Flags
=
localParameters
.
Flags
;
pPresentationParameters
->
FullScreen_RefreshRateInHz
=
localParameters
.
FullScreen_RefreshRateInHz
;
pPresentationParameters
->
FullScreen_PresentationInterval
=
localParameters
.
PresentationInterval
;
object
->
declArraySize
=
16
;
object
->
decls
=
HeapAlloc
(
GetProcessHeap
(),
0
,
object
->
declArraySize
*
sizeof
(
*
object
->
decls
));
if
(
!
object
->
decls
)
{
ERR
(
"Out of memory
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
err
;
}
return
D3D_OK
;
err:
*
ppReturnedDeviceInterface
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
object
->
decls
);
wined3d_mutex_lock
();
IWineD3DDevice_Uninit3D
(
object
->
WineD3DDevice
,
D3D8CB_DestroySwapChain
);
IWineD3DDevice_Release
(
object
->
WineD3DDevice
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
const
IDirect3D8Vtbl
Direct3D8_Vtbl
=
...
...
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