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
e103a7a5
Commit
e103a7a5
authored
May 03, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
May 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Get rid of IDirect3D8Impl.
parent
5a4c15b9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
139 additions
and
153 deletions
+139
-153
d3d8_main.c
dlls/d3d8/d3d8_main.c
+1
-1
d3d8_private.h
dlls/d3d8/d3d8_private.h
+5
-11
device.c
dlls/d3d8/device.c
+1
-1
directx.c
dlls/d3d8/directx.c
+132
-140
No files found.
dlls/d3d8/d3d8_main.c
View file @
e103a7a5
...
@@ -37,7 +37,7 @@ void WINAPI DebugSetMute(void) {
...
@@ -37,7 +37,7 @@ void WINAPI DebugSetMute(void) {
IDirect3D8
*
WINAPI
DECLSPEC_HOTPATCH
Direct3DCreate8
(
UINT
sdk_version
)
IDirect3D8
*
WINAPI
DECLSPEC_HOTPATCH
Direct3DCreate8
(
UINT
sdk_version
)
{
{
IDirect3D8Impl
*
object
;
struct
d3d8
*
object
;
TRACE
(
"sdk_version %#x.
\n
"
,
sdk_version
);
TRACE
(
"sdk_version %#x.
\n
"
,
sdk_version
);
...
...
dlls/d3d8/d3d8_private.h
View file @
e103a7a5
...
@@ -100,9 +100,6 @@
...
@@ -100,9 +100,6 @@
void
fixup_caps
(
WINED3DCAPS
*
pWineCaps
)
DECLSPEC_HIDDEN
;
void
fixup_caps
(
WINED3DCAPS
*
pWineCaps
)
DECLSPEC_HIDDEN
;
/* Direct3D8 Interfaces: */
typedef
struct
IDirect3DBaseTexture8Impl
IDirect3DBaseTexture8Impl
;
typedef
struct
IDirect3D8Impl
IDirect3D8Impl
;
typedef
struct
IDirect3DDevice8Impl
IDirect3DDevice8Impl
;
typedef
struct
IDirect3DDevice8Impl
IDirect3DDevice8Impl
;
typedef
struct
IDirect3DIndexBuffer8Impl
IDirect3DIndexBuffer8Impl
;
typedef
struct
IDirect3DIndexBuffer8Impl
IDirect3DIndexBuffer8Impl
;
typedef
struct
IDirect3DSurface8Impl
IDirect3DSurface8Impl
;
typedef
struct
IDirect3DSurface8Impl
IDirect3DSurface8Impl
;
...
@@ -110,17 +107,14 @@ typedef struct IDirect3DSwapChain8Impl IDirect3DSwapChain8Impl;
...
@@ -110,17 +107,14 @@ typedef struct IDirect3DSwapChain8Impl IDirect3DSwapChain8Impl;
typedef
struct
IDirect3DVolume8Impl
IDirect3DVolume8Impl
;
typedef
struct
IDirect3DVolume8Impl
IDirect3DVolume8Impl
;
typedef
struct
IDirect3DVertexBuffer8Impl
IDirect3DVertexBuffer8Impl
;
typedef
struct
IDirect3DVertexBuffer8Impl
IDirect3DVertexBuffer8Impl
;
/*****************************************************************************
struct
d3d8
* IDirect3D implementation structure
*/
struct
IDirect3D8Impl
{
{
IDirect3D8
IDirect3D8_iface
;
IDirect3D8
IDirect3D8_iface
;
LONG
ref
;
LONG
refcount
;
struct
wined3d
*
WineD3D
;
struct
wined3d
*
wined3d
;
};
};
BOOL
d3d8_init
(
IDirect3D8Impl
*
d3d8
)
DECLSPEC_HIDDEN
;
BOOL
d3d8_init
(
struct
d3d8
*
d3d8
)
DECLSPEC_HIDDEN
;
/*****************************************************************************
/*****************************************************************************
* IDirect3DDevice8 implementation structure
* IDirect3DDevice8 implementation structure
...
@@ -176,7 +170,7 @@ struct IDirect3DDevice8Impl
...
@@ -176,7 +170,7 @@ struct IDirect3DDevice8Impl
BOOL
lost
;
BOOL
lost
;
};
};
HRESULT
device_init
(
IDirect3DDevice8Impl
*
device
,
IDirect3D8Impl
*
parent
,
struct
wined3d
*
wined3d
,
UINT
adapter
,
HRESULT
device_init
(
IDirect3DDevice8Impl
*
device
,
struct
d3d8
*
parent
,
struct
wined3d
*
wined3d
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
)
DECLSPEC_HIDDEN
;
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
)
DECLSPEC_HIDDEN
;
/* ---------------- */
/* ---------------- */
...
...
dlls/d3d8/device.c
View file @
e103a7a5
...
@@ -3065,7 +3065,7 @@ static void setup_fpu(void)
...
@@ -3065,7 +3065,7 @@ static void setup_fpu(void)
#endif
#endif
}
}
HRESULT
device_init
(
IDirect3DDevice8Impl
*
device
,
IDirect3D8Impl
*
parent
,
struct
wined3d
*
wined3d
,
UINT
adapter
,
HRESULT
device_init
(
IDirect3DDevice8Impl
*
device
,
struct
d3d8
*
parent
,
struct
wined3d
*
wined3d
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
)
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
)
{
{
struct
wined3d_swapchain_desc
swapchain_desc
;
struct
wined3d_swapchain_desc
swapchain_desc
;
...
...
dlls/d3d8/directx.c
View file @
e103a7a5
...
@@ -37,251 +37,247 @@
...
@@ -37,251 +37,247 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d8
);
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d8
);
static
inline
IDirect3D8Impl
*
impl_from_IDirect3D8
(
IDirect3D8
*
iface
)
static
inline
struct
d3d8
*
impl_from_IDirect3D8
(
IDirect3D8
*
iface
)
{
{
return
CONTAINING_RECORD
(
iface
,
IDirect3D8Impl
,
IDirect3D8_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d8
,
IDirect3D8_iface
);
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_QueryInterface
(
LPDIRECT3D8
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
static
HRESULT
WINAPI
d3d8_QueryInterface
(
IDirect3D8
*
iface
,
REFIID
riid
,
void
**
out
)
{
{
TRACE
(
"iface %p, riid %s, o
bject %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppobj
);
TRACE
(
"iface %p, riid %s, o
ut %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
out
);
if
(
IsEqualGUID
(
riid
,
&
IID_IDirect3D8
)
if
(
IsEqualGUID
(
riid
,
&
IID_IDirect3D8
)
||
IsEqualGUID
(
riid
,
&
IID_IUnknown
))
||
IsEqualGUID
(
riid
,
&
IID_IUnknown
))
{
{
IUnknown_AddRef
(
iface
);
IUnknown_AddRef
(
iface
);
*
ppobj
=
iface
;
*
out
=
iface
;
return
S_OK
;
return
S_OK
;
}
}
WARN
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
riid
));
WARN
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
riid
));
*
ppobj
=
NULL
;
*
out
=
NULL
;
return
E_NOINTERFACE
;
return
E_NOINTERFACE
;
}
}
static
ULONG
WINAPI
IDirect3D8Impl_AddRef
(
LPDIRECT3D8
iface
)
static
ULONG
WINAPI
d3d8_AddRef
(
IDirect3D8
*
iface
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
ULONG
ref
count
=
InterlockedIncrement
(
&
d3d8
->
refcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
count
);
return
ref
;
return
ref
count
;
}
}
static
ULONG
WINAPI
IDirect3D8Impl_Release
(
LPDIRECT3D8
iface
)
static
ULONG
WINAPI
d3d8_Release
(
IDirect3D8
*
iface
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
ULONG
ref
count
=
InterlockedDecrement
(
&
d3d8
->
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
ref
==
0
)
{
TRACE
(
"Releasing wined3d %p
\n
"
,
This
->
WineD3D
);
if
(
!
refcount
)
{
wined3d_mutex_lock
();
wined3d_mutex_lock
();
wined3d_decref
(
This
->
WineD3D
);
wined3d_decref
(
d3d8
->
wined3d
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
d3d8
);
}
}
return
ref
;
return
ref
count
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_RegisterSoftwareDevice
(
LPDIRECT3D8
iface
,
static
HRESULT
WINAPI
d3d8_RegisterSoftwareDevice
(
IDirect3D8
*
iface
,
void
*
init_function
)
void
*
pInitializeFunction
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, init_function %p.
\n
"
,
iface
,
pInitializeF
unction
);
TRACE
(
"iface %p, init_function %p.
\n
"
,
iface
,
init_f
unction
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_register_software_device
(
This
->
WineD3D
,
pInitializeF
unction
);
hr
=
wined3d_register_software_device
(
d3d8
->
wined3d
,
init_f
unction
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
hr
;
return
hr
;
}
}
static
UINT
WINAPI
IDirect3D8Impl_GetAdapterCount
(
LPDIRECT3D8
iface
)
static
UINT
WINAPI
d3d8_GetAdapterCount
(
IDirect3D8
*
iface
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p.
\n
"
,
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_get_adapter_count
(
This
->
WineD3D
);
hr
=
wined3d_get_adapter_count
(
d3d8
->
wined3d
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_GetAdapterIdentifier
(
LPDIRECT3D8
iface
,
UINT
A
dapter
,
static
HRESULT
WINAPI
d3d8_GetAdapterIdentifier
(
IDirect3D8
*
iface
,
UINT
a
dapter
,
DWORD
Flags
,
D3DADAPTER_IDENTIFIER8
*
pI
dentifier
)
DWORD
flags
,
D3DADAPTER_IDENTIFIER8
*
i
dentifier
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
struct
wined3d_adapter_identifier
adapter_id
;
struct
wined3d_adapter_identifier
adapter_id
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, flags %#x, identifier %p.
\n
"
,
TRACE
(
"iface %p, adapter %u, flags %#x, identifier %p.
\n
"
,
iface
,
Adapter
,
Flags
,
pI
dentifier
);
iface
,
adapter
,
flags
,
i
dentifier
);
adapter_id
.
driver
=
pI
dentifier
->
Driver
;
adapter_id
.
driver
=
i
dentifier
->
Driver
;
adapter_id
.
driver_size
=
sizeof
(
pI
dentifier
->
Driver
);
adapter_id
.
driver_size
=
sizeof
(
i
dentifier
->
Driver
);
adapter_id
.
description
=
pI
dentifier
->
Description
;
adapter_id
.
description
=
i
dentifier
->
Description
;
adapter_id
.
description_size
=
sizeof
(
pI
dentifier
->
Description
);
adapter_id
.
description_size
=
sizeof
(
i
dentifier
->
Description
);
adapter_id
.
device_name
=
NULL
;
/* d3d9 only */
adapter_id
.
device_name
=
NULL
;
/* d3d9 only */
adapter_id
.
device_name_size
=
0
;
/* d3d9 only */
adapter_id
.
device_name_size
=
0
;
/* d3d9 only */
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_get_adapter_identifier
(
This
->
WineD3D
,
Adapter
,
F
lags
,
&
adapter_id
);
hr
=
wined3d_get_adapter_identifier
(
d3d8
->
wined3d
,
adapter
,
f
lags
,
&
adapter_id
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
pI
dentifier
->
DriverVersion
=
adapter_id
.
driver_version
;
i
dentifier
->
DriverVersion
=
adapter_id
.
driver_version
;
pI
dentifier
->
VendorId
=
adapter_id
.
vendor_id
;
i
dentifier
->
VendorId
=
adapter_id
.
vendor_id
;
pI
dentifier
->
DeviceId
=
adapter_id
.
device_id
;
i
dentifier
->
DeviceId
=
adapter_id
.
device_id
;
pI
dentifier
->
SubSysId
=
adapter_id
.
subsystem_id
;
i
dentifier
->
SubSysId
=
adapter_id
.
subsystem_id
;
pI
dentifier
->
Revision
=
adapter_id
.
revision
;
i
dentifier
->
Revision
=
adapter_id
.
revision
;
memcpy
(
&
pIdentifier
->
DeviceIdentifier
,
&
adapter_id
.
device_identifier
,
sizeof
(
pI
dentifier
->
DeviceIdentifier
));
memcpy
(
&
identifier
->
DeviceIdentifier
,
&
adapter_id
.
device_identifier
,
sizeof
(
i
dentifier
->
DeviceIdentifier
));
pI
dentifier
->
WHQLLevel
=
adapter_id
.
whql_level
;
i
dentifier
->
WHQLLevel
=
adapter_id
.
whql_level
;
return
hr
;
return
hr
;
}
}
static
UINT
WINAPI
IDirect3D8Impl_GetAdapterModeCount
(
LPDIRECT3D8
iface
,
UINT
A
dapter
)
static
UINT
WINAPI
d3d8_GetAdapterModeCount
(
IDirect3D8
*
iface
,
UINT
a
dapter
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u.
\n
"
,
iface
,
A
dapter
);
TRACE
(
"iface %p, adapter %u.
\n
"
,
iface
,
a
dapter
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_get_adapter_mode_count
(
This
->
WineD3D
,
A
dapter
,
0
);
hr
=
wined3d_get_adapter_mode_count
(
d3d8
->
wined3d
,
a
dapter
,
0
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_EnumAdapterModes
(
LPDIRECT3D8
iface
,
UINT
Adapter
,
UINT
Mode
,
static
HRESULT
WINAPI
d3d8_EnumAdapterModes
(
IDirect3D8
*
iface
,
UINT
adapter
,
UINT
mode_idx
,
D3DDISPLAYMODE
*
mode
)
D3DDISPLAYMODE
*
pMode
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, mode_idx %u, mode %p.
\n
"
,
TRACE
(
"iface %p, adapter %u, mode_idx %u, mode %p.
\n
"
,
iface
,
Adapter
,
Mode
,
pM
ode
);
iface
,
adapter
,
mode_idx
,
m
ode
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_enum_adapter_modes
(
This
->
WineD3D
,
A
dapter
,
WINED3DFMT_UNKNOWN
,
hr
=
wined3d_enum_adapter_modes
(
d3d8
->
wined3d
,
a
dapter
,
WINED3DFMT_UNKNOWN
,
Mode
,
(
struct
wined3d_display_mode
*
)
pM
ode
);
mode_idx
,
(
struct
wined3d_display_mode
*
)
m
ode
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
if
(
SUCCEEDED
(
hr
))
pMode
->
Format
=
d3dformat_from_wined3dformat
(
pMode
->
Format
);
if
(
SUCCEEDED
(
hr
))
mode
->
Format
=
d3dformat_from_wined3dformat
(
mode
->
Format
);
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_GetAdapterDisplayMode
(
LPDIRECT3D8
iface
,
UINT
Adapter
,
static
HRESULT
WINAPI
d3d8_GetAdapterDisplayMode
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDISPLAYMODE
*
mode
)
D3DDISPLAYMODE
*
pMode
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, mode %p.
\n
"
,
TRACE
(
"iface %p, adapter %u, mode %p.
\n
"
,
iface
,
Adapter
,
pM
ode
);
iface
,
adapter
,
m
ode
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_get_adapter_display_mode
(
This
->
WineD3D
,
Adapter
,
(
struct
wined3d_display_mode
*
)
pM
ode
);
hr
=
wined3d_get_adapter_display_mode
(
d3d8
->
wined3d
,
adapter
,
(
struct
wined3d_display_mode
*
)
m
ode
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
if
(
SUCCEEDED
(
hr
))
pMode
->
Format
=
d3dformat_from_wined3dformat
(
pMode
->
Format
);
if
(
SUCCEEDED
(
hr
))
mode
->
Format
=
d3dformat_from_wined3dformat
(
mode
->
Format
);
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_CheckDeviceType
(
LPDIRECT3D8
iface
,
UINT
Adapter
,
static
HRESULT
WINAPI
d3d8_CheckDeviceType
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
D3D
DEVTYPE
CheckType
,
D3DFORMAT
DisplayFormat
,
D3DFORMAT
BackBufferFormat
,
BOOL
W
indowed
)
D3D
FORMAT
display_format
,
D3DFORMAT
backbuffer_format
,
BOOL
w
indowed
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.
\n
"
,
TRACE
(
"iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.
\n
"
,
iface
,
Adapter
,
CheckType
,
DisplayFormat
,
BackBufferFormat
,
W
indowed
);
iface
,
adapter
,
device_type
,
display_format
,
backbuffer_format
,
w
indowed
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_check_device_type
(
This
->
WineD3D
,
Adapter
,
CheckType
,
wined3dformat_from_d3dformat
(
DisplayF
ormat
),
hr
=
wined3d_check_device_type
(
d3d8
->
wined3d
,
adapter
,
device_type
,
wined3dformat_from_d3dformat
(
display_f
ormat
),
wined3dformat_from_d3dformat
(
BackBufferFormat
),
W
indowed
);
wined3dformat_from_d3dformat
(
backbuffer_format
),
w
indowed
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_CheckDeviceFormat
(
LPDIRECT3D8
iface
,
UINT
Adapter
,
static
HRESULT
WINAPI
d3d8_CheckDeviceFormat
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
D3DDEVTYPE
DeviceType
,
D3DFORMAT
AdapterFormat
,
DWORD
Usage
,
D3DRESOURCETYPE
RType
,
D3DFORMAT
adapter_format
,
DWORD
usage
,
D3DRESOURCETYPE
resource_type
,
D3DFORMAT
format
)
D3DFORMAT
CheckFormat
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
enum
wined3d_resource_type
wined3d_rtype
;
enum
wined3d_resource_type
wined3d_rtype
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.
\n
"
,
TRACE
(
"iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.
\n
"
,
iface
,
Adapter
,
DeviceType
,
AdapterFormat
,
Usage
,
RType
,
CheckF
ormat
);
iface
,
adapter
,
device_type
,
adapter_format
,
usage
,
resource_type
,
f
ormat
);
switch
(
RType
)
{
switch
(
resource_type
)
{
case
D3DRTYPE_VERTEXBUFFER
:
case
D3DRTYPE_VERTEXBUFFER
:
case
D3DRTYPE_INDEXBUFFER
:
case
D3DRTYPE_INDEXBUFFER
:
wined3d_rtype
=
WINED3D_RTYPE_BUFFER
;
wined3d_rtype
=
WINED3D_RTYPE_BUFFER
;
break
;
break
;
default:
default:
wined3d_rtype
=
RT
ype
;
wined3d_rtype
=
resource_t
ype
;
break
;
break
;
}
}
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_check_device_format
(
This
->
WineD3D
,
Adapter
,
DeviceType
,
wined3dformat_from_d3dformat
(
AdapterF
ormat
),
hr
=
wined3d_check_device_format
(
d3d8
->
wined3d
,
adapter
,
device_type
,
wined3dformat_from_d3dformat
(
adapter_f
ormat
),
Usage
,
wined3d_rtype
,
wined3dformat_from_d3dformat
(
CheckF
ormat
),
WINED3D_SURFACE_TYPE_OPENGL
);
usage
,
wined3d_rtype
,
wined3dformat_from_d3dformat
(
f
ormat
),
WINED3D_SURFACE_TYPE_OPENGL
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_CheckDeviceMultiSampleType
(
IDirect3D8
*
iface
,
UINT
Adapter
,
static
HRESULT
WINAPI
d3d8_CheckDeviceMultiSampleType
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
D3DDEVTYPE
DeviceType
,
D3DFORMAT
SurfaceFormat
,
BOOL
Windowed
,
D3DFORMAT
format
,
BOOL
windowed
,
D3DMULTISAMPLE_TYPE
multisample_type
)
D3DMULTISAMPLE_TYPE
MultiSampleType
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x.
\n
"
,
TRACE
(
"iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x.
\n
"
,
iface
,
Adapter
,
DeviceType
,
SurfaceFormat
,
Windowed
,
MultiSampleT
ype
);
iface
,
adapter
,
device_type
,
format
,
windowed
,
multisample_t
ype
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_check_device_multisample_type
(
This
->
WineD3D
,
Adapter
,
DeviceT
ype
,
hr
=
wined3d_check_device_multisample_type
(
d3d8
->
wined3d
,
adapter
,
device_t
ype
,
wined3dformat_from_d3dformat
(
SurfaceFormat
),
W
indowed
,
wined3dformat_from_d3dformat
(
format
),
w
indowed
,
(
enum
wined3d_multisample_type
)
MultiSampleT
ype
,
NULL
);
(
enum
wined3d_multisample_type
)
multisample_t
ype
,
NULL
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_CheckDepthStencilMatch
(
IDirect3D8
*
iface
,
UINT
Adapter
,
static
HRESULT
WINAPI
d3d8_CheckDepthStencilMatch
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
D3DDEVTYPE
DeviceType
,
D3DFORMAT
AdapterFormat
,
D3DFORMAT
RenderTargetFormat
,
D3DFORMAT
adapter_format
,
D3DFORMAT
rt_format
,
D3DFORMAT
ds_format
)
D3DFORMAT
DepthStencilFormat
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.
\n
"
,
TRACE
(
"iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.
\n
"
,
iface
,
Adapter
,
DeviceType
,
AdapterFormat
,
RenderTargetFormat
,
DepthStencilF
ormat
);
iface
,
adapter
,
device_type
,
adapter_format
,
rt_format
,
ds_f
ormat
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
=
wined3d_check_depth_stencil_match
(
This
->
WineD3D
,
Adapter
,
DeviceT
ype
,
hr
=
wined3d_check_depth_stencil_match
(
d3d8
->
wined3d
,
adapter
,
device_t
ype
,
wined3dformat_from_d3dformat
(
AdapterFormat
),
wined3dformat_from_d3dformat
(
RenderTargetF
ormat
),
wined3dformat_from_d3dformat
(
adapter_format
),
wined3dformat_from_d3dformat
(
rt_f
ormat
),
wined3dformat_from_d3dformat
(
DepthStencilF
ormat
));
wined3dformat_from_d3dformat
(
ds_f
ormat
));
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
hr
;
return
hr
;
...
@@ -303,54 +299,50 @@ void fixup_caps(WINED3DCAPS *caps)
...
@@ -303,54 +299,50 @@ void fixup_caps(WINED3DCAPS *caps)
caps
->
StencilCaps
&=
~
WINED3DSTENCILCAPS_TWOSIDED
;
caps
->
StencilCaps
&=
~
WINED3DSTENCILCAPS_TWOSIDED
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl_GetDeviceCaps
(
LPDIRECT3D8
iface
,
UINT
Adapter
,
static
HRESULT
WINAPI
d3d8_GetDeviceCaps
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
D3DCAPS8
*
caps
)
D3DDEVTYPE
DeviceType
,
D3DCAPS8
*
pCaps
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HRESULT
hrc
=
D3D_OK
;
WINED3DCAPS
*
wined3d_caps
;
WINED3DCAPS
*
pWineCaps
;
HRESULT
hr
;
TRACE
(
"iface %p, adapter %u, device_type %#x, caps %p.
\n
"
,
iface
,
Adapter
,
DeviceType
,
pC
aps
);
TRACE
(
"iface %p, adapter %u, device_type %#x, caps %p.
\n
"
,
iface
,
adapter
,
device_type
,
c
aps
);
if
(
NULL
==
pCaps
){
if
(
!
caps
)
return
D3DERR_INVALIDCALL
;
if
(
!
(
wined3d_caps
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
wined3d_caps
))))
return
D3DERR_INVALIDCALL
;
return
D3DERR_INVALIDCALL
;
}
pWineCaps
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WINED3DCAPS
));
if
(
pWineCaps
==
NULL
){
return
D3DERR_INVALIDCALL
;
/*well this is what MSDN says to return*/
}
wined3d_mutex_lock
();
wined3d_mutex_lock
();
hr
c
=
wined3d_get_device_caps
(
This
->
WineD3D
,
Adapter
,
DeviceType
,
pWineC
aps
);
hr
=
wined3d_get_device_caps
(
d3d8
->
wined3d
,
adapter
,
device_type
,
wined3d_c
aps
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
fixup_caps
(
pWineC
aps
);
fixup_caps
(
wined3d_c
aps
);
WINECAPSTOD3D8CAPS
(
pCaps
,
pWineC
aps
)
WINECAPSTOD3D8CAPS
(
caps
,
wined3d_c
aps
)
HeapFree
(
GetProcessHeap
(),
0
,
pWineC
aps
);
HeapFree
(
GetProcessHeap
(),
0
,
wined3d_c
aps
);
TRACE
(
"(%p) returning %p
\n
"
,
This
,
pCaps
);
return
hr
;
return
hrc
;
}
}
static
HMONITOR
WINAPI
IDirect3D8Impl_GetAdapterMonitor
(
LPDIRECT3D8
iface
,
UINT
A
dapter
)
static
HMONITOR
WINAPI
d3d8_GetAdapterMonitor
(
IDirect3D8
*
iface
,
UINT
a
dapter
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
HMONITOR
ret
;
HMONITOR
ret
;
TRACE
(
"iface %p, adapter %u.
\n
"
,
iface
,
A
dapter
);
TRACE
(
"iface %p, adapter %u.
\n
"
,
iface
,
a
dapter
);
wined3d_mutex_lock
();
wined3d_mutex_lock
();
ret
=
wined3d_get_adapter_monitor
(
This
->
WineD3D
,
A
dapter
);
ret
=
wined3d_get_adapter_monitor
(
d3d8
->
wined3d
,
a
dapter
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
return
ret
;
return
ret
;
}
}
static
HRESULT
WINAPI
IDirect3D8Impl
_CreateDevice
(
IDirect3D8
*
iface
,
UINT
adapter
,
static
HRESULT
WINAPI
d3d8
_CreateDevice
(
IDirect3D8
*
iface
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
,
IDirect3DDevice8
**
device
)
IDirect3DDevice8
**
device
)
{
{
IDirect3D8Impl
*
This
=
impl_from_IDirect3D8
(
iface
);
struct
d3d8
*
d3d8
=
impl_from_IDirect3D8
(
iface
);
IDirect3DDevice8Impl
*
object
;
IDirect3DDevice8Impl
*
object
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -364,7 +356,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapte
...
@@ -364,7 +356,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapte
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
hr
=
device_init
(
object
,
This
,
This
->
WineD3D
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
);
hr
=
device_init
(
object
,
d3d8
,
d3d8
->
wined3d
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
WARN
(
"Failed to initialize device, hr %#x.
\n
"
,
hr
);
WARN
(
"Failed to initialize device, hr %#x.
\n
"
,
hr
);
...
@@ -378,37 +370,37 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapte
...
@@ -378,37 +370,37 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapte
return
D3D_OK
;
return
D3D_OK
;
}
}
static
const
struct
IDirect3D8Vtbl
Direct3D8_V
tbl
=
static
const
struct
IDirect3D8Vtbl
d3d8_v
tbl
=
{
{
/* IUnknown */
/* IUnknown */
IDirect3D8Impl
_QueryInterface
,
d3d8
_QueryInterface
,
IDirect3D8Impl
_AddRef
,
d3d8
_AddRef
,
IDirect3D8Impl
_Release
,
d3d8
_Release
,
/* IDirect3D8 */
/* IDirect3D8 */
IDirect3D8Impl
_RegisterSoftwareDevice
,
d3d8
_RegisterSoftwareDevice
,
IDirect3D8Impl
_GetAdapterCount
,
d3d8
_GetAdapterCount
,
IDirect3D8Impl
_GetAdapterIdentifier
,
d3d8
_GetAdapterIdentifier
,
IDirect3D8Impl
_GetAdapterModeCount
,
d3d8
_GetAdapterModeCount
,
IDirect3D8Impl
_EnumAdapterModes
,
d3d8
_EnumAdapterModes
,
IDirect3D8Impl
_GetAdapterDisplayMode
,
d3d8
_GetAdapterDisplayMode
,
IDirect3D8Impl
_CheckDeviceType
,
d3d8
_CheckDeviceType
,
IDirect3D8Impl
_CheckDeviceFormat
,
d3d8
_CheckDeviceFormat
,
IDirect3D8Impl
_CheckDeviceMultiSampleType
,
d3d8
_CheckDeviceMultiSampleType
,
IDirect3D8Impl
_CheckDepthStencilMatch
,
d3d8
_CheckDepthStencilMatch
,
IDirect3D8Impl
_GetDeviceCaps
,
d3d8
_GetDeviceCaps
,
IDirect3D8Impl
_GetAdapterMonitor
,
d3d8
_GetAdapterMonitor
,
IDirect3D8Impl_CreateDevice
d3d8_CreateDevice
,
};
};
BOOL
d3d8_init
(
IDirect3D8Impl
*
d3d8
)
BOOL
d3d8_init
(
struct
d3d8
*
d3d8
)
{
{
d3d8
->
IDirect3D8_iface
.
lpVtbl
=
&
Direct3D8_V
tbl
;
d3d8
->
IDirect3D8_iface
.
lpVtbl
=
&
d3d8_v
tbl
;
d3d8
->
ref
=
1
;
d3d8
->
ref
count
=
1
;
wined3d_mutex_lock
();
wined3d_mutex_lock
();
d3d8
->
WineD3D
=
wined3d_create
(
8
,
WINED3D_LEGACY_DEPTH_BIAS
);
d3d8
->
wined3d
=
wined3d_create
(
8
,
WINED3D_LEGACY_DEPTH_BIAS
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
if
(
!
d3d8
->
WineD3D
)
if
(
!
d3d8
->
wined3d
)
return
FALSE
;
return
FALSE
;
return
TRUE
;
return
TRUE
;
...
...
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