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
94c9b0b4
Commit
94c9b0b4
authored
Dec 02, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Get rid of the WINED3DPRESENT_PARAMETERS typedef.
parent
a51b03f1
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
510 additions
and
503 deletions
+510
-503
device.c
dlls/d3d10core/device.c
+3
-3
device.c
dlls/d3d8/device.c
+77
-77
swapchain.c
dlls/d3d8/swapchain.c
+30
-30
device.c
dlls/d3d9/device.c
+86
-85
swapchain.c
dlls/d3d9/swapchain.c
+50
-48
ddraw.c
dlls/ddraw/ddraw.c
+23
-23
device.c
dlls/dxgi/device.c
+4
-4
dxgi_private.h
dlls/dxgi/dxgi_private.h
+1
-1
factory.c
dlls/dxgi/factory.c
+19
-22
swapchain.c
dlls/dxgi/swapchain.c
+2
-2
context.c
dlls/wined3d/context.c
+2
-2
device.c
dlls/wined3d/device.c
+107
-98
stateblock.c
dlls/wined3d/stateblock.c
+2
-2
surface.c
dlls/wined3d/surface.c
+5
-5
swapchain.c
dlls/wined3d/swapchain.c
+71
-73
wined3d.spec
dlls/wined3d/wined3d.spec
+1
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
wined3d.h
include/wine/wined3d.h
+25
-25
winedxgi.idl
include/wine/winedxgi.idl
+1
-1
No files found.
dlls/d3d10core/device.c
View file @
94c9b0b4
...
...
@@ -1513,13 +1513,13 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
}
static
HRESULT
CDECL
device_parent_create_swapchain
(
struct
wined3d_device_parent
*
device_parent
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
struct
wined3d_swapchain
**
swapchain
)
struct
wined3d_swapchain_desc
*
desc
,
struct
wined3d_swapchain
**
swapchain
)
{
struct
d3d10_device
*
device
=
device_from_wined3d_device_parent
(
device_parent
);
IWineDXGIDevice
*
wine_device
;
HRESULT
hr
;
TRACE
(
"device_parent %p,
present_parameters %p, swapchain %p
\n
"
,
device_parent
,
present_parameters
,
swapchain
);
TRACE
(
"device_parent %p,
desc %p, swapchain %p
\n
"
,
device_parent
,
desc
,
swapchain
);
hr
=
d3d10_device_QueryInterface
(
&
device
->
ID3D10Device_iface
,
&
IID_IWineDXGIDevice
,
(
void
**
)
&
wine_device
);
...
...
@@ -1529,7 +1529,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
return
E_FAIL
;
}
hr
=
IWineDXGIDevice_create_swapchain
(
wine_device
,
present_parameters
,
swapchain
);
hr
=
IWineDXGIDevice_create_swapchain
(
wine_device
,
desc
,
swapchain
);
IWineDXGIDevice_Release
(
wine_device
);
if
(
FAILED
(
hr
))
{
...
...
dlls/d3d8/device.c
View file @
94c9b0b4
...
...
@@ -561,30 +561,30 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(IDirect3DDevice8 *iface,
D3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
IDirect3DDevice8Impl
*
This
=
impl_from_IDirect3DDevice8
(
iface
);
WINED3DPRESENT_PARAMETERS
localParameters
;
struct
wined3d_swapchain_desc
swapchain_desc
;
HRESULT
hr
;
TRACE
(
"iface %p, present_parameters %p.
\n
"
,
iface
,
pPresentationParameters
);
wined3d_mutex_lock
();
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
;
hr
=
wined3d_device_reset
(
This
->
wined3d_device
,
&
localParameters
,
reset_enum_callback
);
swapchain_desc
.
backbuffer_width
=
pPresentationParameters
->
BackBufferWidth
;
swapchain_desc
.
backbuffer_height
=
pPresentationParameters
->
BackBufferHeight
;
swapchain_desc
.
backbuffer_format
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
BackBufferFormat
);
swapchain_desc
.
backbuffer_count
=
pPresentationParameters
->
BackBufferCount
;
swapchain_desc
.
multisample_type
=
pPresentationParameters
->
MultiSampleType
;
swapchain_desc
.
multisample_quality
=
0
;
/* d3d9 only */
swapchain_desc
.
swap_effect
=
pPresentationParameters
->
SwapEffect
;
swapchain_desc
.
device_window
=
pPresentationParameters
->
hDeviceWindow
;
swapchain_desc
.
windowed
=
pPresentationParameters
->
Windowed
;
swapchain_desc
.
enable_auto_depth_stencil
=
pPresentationParameters
->
EnableAutoDepthStencil
;
swapchain_desc
.
auto_depth_stencil_format
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
AutoDepthStencilFormat
);
swapchain_desc
.
flags
=
pPresentationParameters
->
Flags
;
swapchain_desc
.
refresh_rate
=
pPresentationParameters
->
FullScreen_RefreshRateInHz
;
swapchain_desc
.
swap_interval
=
pPresentationParameters
->
FullScreen_PresentationInterval
;
swapchain_desc
.
auto_restore_display_mode
=
TRUE
;
hr
=
wined3d_device_reset
(
This
->
wined3d_device
,
&
swapchain_desc
,
reset_enum_callback
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
wined3d_device_set_render_state
(
This
->
wined3d_device
,
WINED3DRS_POINTSIZE_MIN
,
0
);
...
...
@@ -2946,29 +2946,29 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
}
static
HRESULT
CDECL
device_parent_create_swapchain
(
struct
wined3d_device_parent
*
device_parent
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
struct
wined3d_swapchain
**
swapchain
)
struct
wined3d_swapchain_desc
*
desc
,
struct
wined3d_swapchain
**
swapchain
)
{
IDirect3DDevice8Impl
*
device
=
device_from_device_parent
(
device_parent
);
D3DPRESENT_PARAMETERS
local_parameters
;
IDirect3DSwapChain8
*
d3d_swapchain
;
HRESULT
hr
;
TRACE
(
"device_parent %p,
present_parameters %p, swapchain %p.
\n
"
,
device_parent
,
present_parameters
,
swapchain
);
TRACE
(
"device_parent %p,
desc %p, swapchain %p.
\n
"
,
device_parent
,
desc
,
swapchain
);
/* Copy the presentation parameters */
local_parameters
.
BackBufferWidth
=
present_parameters
->
BackBufferW
idth
;
local_parameters
.
BackBufferHeight
=
present_parameters
->
BackBufferH
eight
;
local_parameters
.
BackBufferFormat
=
d3dformat_from_wined3dformat
(
present_parameters
->
BackBufferF
ormat
);
local_parameters
.
BackBufferCount
=
present_parameters
->
BackBufferC
ount
;
local_parameters
.
MultiSampleType
=
present_parameters
->
MultiSampleT
ype
;
local_parameters
.
SwapEffect
=
present_parameters
->
SwapE
ffect
;
local_parameters
.
hDeviceWindow
=
present_parameters
->
hDeviceW
indow
;
local_parameters
.
Windowed
=
present_parameters
->
W
indowed
;
local_parameters
.
EnableAutoDepthStencil
=
present_parameters
->
EnableAutoDepthS
tencil
;
local_parameters
.
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
present_parameters
->
AutoDepthStencilF
ormat
);
local_parameters
.
Flags
=
present_parameters
->
F
lags
;
local_parameters
.
FullScreen_RefreshRateInHz
=
present_parameters
->
FullScreen_RefreshRateInHz
;
local_parameters
.
FullScreen_PresentationInterval
=
present_parameters
->
PresentationI
nterval
;
local_parameters
.
BackBufferWidth
=
desc
->
backbuffer_w
idth
;
local_parameters
.
BackBufferHeight
=
desc
->
backbuffer_h
eight
;
local_parameters
.
BackBufferFormat
=
d3dformat_from_wined3dformat
(
desc
->
backbuffer_f
ormat
);
local_parameters
.
BackBufferCount
=
desc
->
backbuffer_c
ount
;
local_parameters
.
MultiSampleType
=
desc
->
multisample_t
ype
;
local_parameters
.
SwapEffect
=
desc
->
swap_e
ffect
;
local_parameters
.
hDeviceWindow
=
desc
->
device_w
indow
;
local_parameters
.
Windowed
=
desc
->
w
indowed
;
local_parameters
.
EnableAutoDepthStencil
=
desc
->
enable_auto_depth_s
tencil
;
local_parameters
.
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
desc
->
auto_depth_stencil_f
ormat
);
local_parameters
.
Flags
=
desc
->
f
lags
;
local_parameters
.
FullScreen_RefreshRateInHz
=
desc
->
refresh_rate
;
local_parameters
.
FullScreen_PresentationInterval
=
desc
->
swap_i
nterval
;
hr
=
IDirect3DDevice8_CreateAdditionalSwapChain
(
&
device
->
IDirect3DDevice8_iface
,
&
local_parameters
,
&
d3d_swapchain
);
...
...
@@ -2984,19 +2984,19 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
IDirect3DSwapChain8_Release
(
d3d_swapchain
);
/* Copy back the presentation parameters */
present_parameters
->
BackBufferW
idth
=
local_parameters
.
BackBufferWidth
;
present_parameters
->
BackBufferH
eight
=
local_parameters
.
BackBufferHeight
;
present_parameters
->
BackBufferF
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
BackBufferFormat
);
present_parameters
->
BackBufferC
ount
=
local_parameters
.
BackBufferCount
;
present_parameters
->
MultiSampleT
ype
=
local_parameters
.
MultiSampleType
;
present_parameters
->
SwapE
ffect
=
local_parameters
.
SwapEffect
;
present_parameters
->
hDeviceW
indow
=
local_parameters
.
hDeviceWindow
;
present_parameters
->
W
indowed
=
local_parameters
.
Windowed
;
present_parameters
->
EnableAutoDepthS
tencil
=
local_parameters
.
EnableAutoDepthStencil
;
present_parameters
->
AutoDepthStencilF
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
AutoDepthStencilFormat
);
present_parameters
->
F
lags
=
local_parameters
.
Flags
;
present_parameters
->
FullScreen_RefreshRateInHz
=
local_parameters
.
FullScreen_RefreshRateInHz
;
present_parameters
->
PresentationI
nterval
=
local_parameters
.
FullScreen_PresentationInterval
;
desc
->
backbuffer_w
idth
=
local_parameters
.
BackBufferWidth
;
desc
->
backbuffer_h
eight
=
local_parameters
.
BackBufferHeight
;
desc
->
backbuffer_f
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
BackBufferFormat
);
desc
->
backbuffer_c
ount
=
local_parameters
.
BackBufferCount
;
desc
->
multisample_t
ype
=
local_parameters
.
MultiSampleType
;
desc
->
swap_e
ffect
=
local_parameters
.
SwapEffect
;
desc
->
device_w
indow
=
local_parameters
.
hDeviceWindow
;
desc
->
w
indowed
=
local_parameters
.
Windowed
;
desc
->
enable_auto_depth_s
tencil
=
local_parameters
.
EnableAutoDepthStencil
;
desc
->
auto_depth_stencil_f
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
AutoDepthStencilFormat
);
desc
->
f
lags
=
local_parameters
.
Flags
;
desc
->
refresh_rate
=
local_parameters
.
FullScreen_RefreshRateInHz
;
desc
->
swap_i
nterval
=
local_parameters
.
FullScreen_PresentationInterval
;
return
hr
;
}
...
...
@@ -3032,7 +3032,7 @@ static void setup_fpu(void)
HRESULT
device_init
(
IDirect3DDevice8Impl
*
device
,
IDirect3D8Impl
*
parent
,
struct
wined3d
*
wined3d
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
)
{
WINED3DPRESENT_PARAMETERS
wined3d_parameters
;
struct
wined3d_swapchain_desc
swapchain_desc
;
HRESULT
hr
;
device
->
IDirect3DDevice8_iface
.
lpVtbl
=
&
Direct3DDevice8_Vtbl
;
...
...
@@ -3085,23 +3085,23 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IDirect3D8Impl *parent, struct
if
(
flags
&
D3DCREATE_MULTITHREADED
)
wined3d_device_set_multithreaded
(
device
->
wined3d_device
);
wined3d_parameters
.
BackBufferW
idth
=
parameters
->
BackBufferWidth
;
wined3d_parameters
.
BackBufferH
eight
=
parameters
->
BackBufferHeight
;
wined3d_parameters
.
BackBufferF
ormat
=
wined3dformat_from_d3dformat
(
parameters
->
BackBufferFormat
);
wined3d_parameters
.
BackBufferC
ount
=
parameters
->
BackBufferCount
;
wined3d_parameters
.
MultiSampleT
ype
=
parameters
->
MultiSampleType
;
wined3d_parameters
.
MultiSampleQ
uality
=
0
;
/* d3d9 only */
wined3d_parameters
.
SwapE
ffect
=
parameters
->
SwapEffect
;
wined3d_parameters
.
hDeviceW
indow
=
parameters
->
hDeviceWindow
;
wined3d_parameters
.
W
indowed
=
parameters
->
Windowed
;
wined3d_parameters
.
EnableAutoDepthS
tencil
=
parameters
->
EnableAutoDepthStencil
;
wined3d_parameters
.
AutoDepthStencilF
ormat
=
wined3dformat_from_d3dformat
(
parameters
->
AutoDepthStencilFormat
);
wined3d_parameters
.
F
lags
=
parameters
->
Flags
;
wined3d_parameters
.
FullScreen_RefreshRateInHz
=
parameters
->
FullScreen_RefreshRateInHz
;
wined3d_parameters
.
PresentationI
nterval
=
parameters
->
FullScreen_PresentationInterval
;
wined3d_parameters
.
AutoRestoreDisplayM
ode
=
TRUE
;
hr
=
wined3d_device_init_3d
(
device
->
wined3d_device
,
&
wined3d_parameters
);
swapchain_desc
.
backbuffer_w
idth
=
parameters
->
BackBufferWidth
;
swapchain_desc
.
backbuffer_h
eight
=
parameters
->
BackBufferHeight
;
swapchain_desc
.
backbuffer_f
ormat
=
wined3dformat_from_d3dformat
(
parameters
->
BackBufferFormat
);
swapchain_desc
.
backbuffer_c
ount
=
parameters
->
BackBufferCount
;
swapchain_desc
.
multisample_t
ype
=
parameters
->
MultiSampleType
;
swapchain_desc
.
multisample_q
uality
=
0
;
/* d3d9 only */
swapchain_desc
.
swap_e
ffect
=
parameters
->
SwapEffect
;
swapchain_desc
.
device_w
indow
=
parameters
->
hDeviceWindow
;
swapchain_desc
.
w
indowed
=
parameters
->
Windowed
;
swapchain_desc
.
enable_auto_depth_s
tencil
=
parameters
->
EnableAutoDepthStencil
;
swapchain_desc
.
auto_depth_stencil_f
ormat
=
wined3dformat_from_d3dformat
(
parameters
->
AutoDepthStencilFormat
);
swapchain_desc
.
f
lags
=
parameters
->
Flags
;
swapchain_desc
.
refresh_rate
=
parameters
->
FullScreen_RefreshRateInHz
;
swapchain_desc
.
swap_i
nterval
=
parameters
->
FullScreen_PresentationInterval
;
swapchain_desc
.
auto_restore_display_m
ode
=
TRUE
;
hr
=
wined3d_device_init_3d
(
device
->
wined3d_device
,
&
swapchain_desc
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize 3D, hr %#x.
\n
"
,
hr
);
...
...
@@ -3120,19 +3120,19 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IDirect3D8Impl *parent, struct
goto
err
;
}
parameters
->
BackBufferWidth
=
wined3d_parameters
.
BackBufferW
idth
;
parameters
->
BackBufferHeight
=
wined3d_parameters
.
BackBufferH
eight
;
parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
BackBufferF
ormat
);
parameters
->
BackBufferCount
=
wined3d_parameters
.
BackBufferC
ount
;
parameters
->
MultiSampleType
=
wined3d_parameters
.
MultiSampleT
ype
;
parameters
->
SwapEffect
=
wined3d_parameters
.
SwapE
ffect
;
parameters
->
hDeviceWindow
=
wined3d_parameters
.
hDeviceW
indow
;
parameters
->
Windowed
=
wined3d_parameters
.
W
indowed
;
parameters
->
EnableAutoDepthStencil
=
wined3d_parameters
.
EnableAutoDepthS
tencil
;
parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
AutoDepthStencilF
ormat
);
parameters
->
Flags
=
wined3d_parameters
.
F
lags
;
parameters
->
FullScreen_RefreshRateInHz
=
wined3d_parameters
.
FullScreen_RefreshRateInHz
;
parameters
->
FullScreen_PresentationInterval
=
wined3d_parameters
.
PresentationI
nterval
;
parameters
->
BackBufferWidth
=
swapchain_desc
.
backbuffer_w
idth
;
parameters
->
BackBufferHeight
=
swapchain_desc
.
backbuffer_h
eight
;
parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
swapchain_desc
.
backbuffer_f
ormat
);
parameters
->
BackBufferCount
=
swapchain_desc
.
backbuffer_c
ount
;
parameters
->
MultiSampleType
=
swapchain_desc
.
multisample_t
ype
;
parameters
->
SwapEffect
=
swapchain_desc
.
swap_e
ffect
;
parameters
->
hDeviceWindow
=
swapchain_desc
.
device_w
indow
;
parameters
->
Windowed
=
swapchain_desc
.
w
indowed
;
parameters
->
EnableAutoDepthStencil
=
swapchain_desc
.
enable_auto_depth_s
tencil
;
parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
swapchain_desc
.
auto_depth_stencil_f
ormat
);
parameters
->
Flags
=
swapchain_desc
.
f
lags
;
parameters
->
FullScreen_RefreshRateInHz
=
swapchain_desc
.
refresh_rate
;
parameters
->
FullScreen_PresentationInterval
=
swapchain_desc
.
swap_i
nterval
;
device
->
declArraySize
=
16
;
device
->
decls
=
HeapAlloc
(
GetProcessHeap
(),
0
,
device
->
declArraySize
*
sizeof
(
*
device
->
decls
));
...
...
dlls/d3d8/swapchain.c
View file @
94c9b0b4
...
...
@@ -151,47 +151,47 @@ static const struct wined3d_parent_ops d3d8_swapchain_wined3d_parent_ops =
HRESULT
swapchain_init
(
IDirect3DSwapChain8Impl
*
swapchain
,
IDirect3DDevice8Impl
*
device
,
D3DPRESENT_PARAMETERS
*
present_parameters
)
{
WINED3DPRESENT_PARAMETERS
wined3d_parameters
;
struct
wined3d_swapchain_desc
desc
;
HRESULT
hr
;
swapchain
->
ref
=
1
;
swapchain
->
IDirect3DSwapChain8_iface
.
lpVtbl
=
&
Direct3DSwapChain8_Vtbl
;
wined3d_parameters
.
BackBufferW
idth
=
present_parameters
->
BackBufferWidth
;
wined3d_parameters
.
BackBufferH
eight
=
present_parameters
->
BackBufferHeight
;
wined3d_parameters
.
BackBufferF
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
BackBufferFormat
);
wined3d_parameters
.
BackBufferC
ount
=
max
(
1
,
present_parameters
->
BackBufferCount
);
wined3d_parameters
.
MultiSampleT
ype
=
present_parameters
->
MultiSampleType
;
wined3d_parameters
.
MultiSampleQ
uality
=
0
;
/* d3d9 only */
wined3d_parameters
.
SwapE
ffect
=
present_parameters
->
SwapEffect
;
wined3d_parameters
.
hDeviceW
indow
=
present_parameters
->
hDeviceWindow
;
wined3d_parameters
.
W
indowed
=
present_parameters
->
Windowed
;
wined3d_parameters
.
EnableAutoDepthS
tencil
=
present_parameters
->
EnableAutoDepthStencil
;
wined3d_parameters
.
AutoDepthStencilF
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
AutoDepthStencilFormat
);
wined3d_parameters
.
F
lags
=
present_parameters
->
Flags
;
wined3d_parameters
.
FullScreen_RefreshRateInHz
=
present_parameters
->
FullScreen_RefreshRateInHz
;
wined3d_parameters
.
PresentationI
nterval
=
present_parameters
->
FullScreen_PresentationInterval
;
wined3d_parameters
.
AutoRestoreDisplayM
ode
=
TRUE
;
desc
.
backbuffer_w
idth
=
present_parameters
->
BackBufferWidth
;
desc
.
backbuffer_h
eight
=
present_parameters
->
BackBufferHeight
;
desc
.
backbuffer_f
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
BackBufferFormat
);
desc
.
backbuffer_c
ount
=
max
(
1
,
present_parameters
->
BackBufferCount
);
desc
.
multisample_t
ype
=
present_parameters
->
MultiSampleType
;
desc
.
multisample_q
uality
=
0
;
/* d3d9 only */
desc
.
swap_e
ffect
=
present_parameters
->
SwapEffect
;
desc
.
device_w
indow
=
present_parameters
->
hDeviceWindow
;
desc
.
w
indowed
=
present_parameters
->
Windowed
;
desc
.
enable_auto_depth_s
tencil
=
present_parameters
->
EnableAutoDepthStencil
;
desc
.
auto_depth_stencil_f
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
AutoDepthStencilFormat
);
desc
.
f
lags
=
present_parameters
->
Flags
;
desc
.
refresh_rate
=
present_parameters
->
FullScreen_RefreshRateInHz
;
desc
.
swap_i
nterval
=
present_parameters
->
FullScreen_PresentationInterval
;
desc
.
auto_restore_display_m
ode
=
TRUE
;
wined3d_mutex_lock
();
hr
=
wined3d_swapchain_create
(
device
->
wined3d_device
,
&
wined3d_parameters
,
hr
=
wined3d_swapchain_create
(
device
->
wined3d_device
,
&
desc
,
SURFACE_OPENGL
,
swapchain
,
&
d3d8_swapchain_wined3d_parent_ops
,
&
swapchain
->
wined3d_swapchain
);
wined3d_mutex_unlock
();
present_parameters
->
BackBufferWidth
=
wined3d_parameters
.
BackBufferW
idth
;
present_parameters
->
BackBufferHeight
=
wined3d_parameters
.
BackBufferH
eight
;
present_parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
BackBufferF
ormat
);
present_parameters
->
BackBufferCount
=
wined3d_parameters
.
BackBufferC
ount
;
present_parameters
->
MultiSampleType
=
wined3d_parameters
.
MultiSampleT
ype
;
present_parameters
->
SwapEffect
=
wined3d_parameters
.
SwapE
ffect
;
present_parameters
->
hDeviceWindow
=
wined3d_parameters
.
hDeviceW
indow
;
present_parameters
->
Windowed
=
wined3d_parameters
.
W
indowed
;
present_parameters
->
EnableAutoDepthStencil
=
wined3d_parameters
.
EnableAutoDepthS
tencil
;
present_parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
AutoDepthStencilF
ormat
);
present_parameters
->
Flags
=
wined3d_parameters
.
F
lags
;
present_parameters
->
FullScreen_RefreshRateInHz
=
wined3d_parameters
.
FullScreen_RefreshRateInHz
;
present_parameters
->
FullScreen_PresentationInterval
=
wined3d_parameters
.
PresentationI
nterval
;
present_parameters
->
BackBufferWidth
=
desc
.
backbuffer_w
idth
;
present_parameters
->
BackBufferHeight
=
desc
.
backbuffer_h
eight
;
present_parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
desc
.
backbuffer_f
ormat
);
present_parameters
->
BackBufferCount
=
desc
.
backbuffer_c
ount
;
present_parameters
->
MultiSampleType
=
desc
.
multisample_t
ype
;
present_parameters
->
SwapEffect
=
desc
.
swap_e
ffect
;
present_parameters
->
hDeviceWindow
=
desc
.
device_w
indow
;
present_parameters
->
Windowed
=
desc
.
w
indowed
;
present_parameters
->
EnableAutoDepthStencil
=
desc
.
enable_auto_depth_s
tencil
;
present_parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
desc
.
auto_depth_stencil_f
ormat
);
present_parameters
->
Flags
=
desc
.
f
lags
;
present_parameters
->
FullScreen_RefreshRateInHz
=
desc
.
refresh_rate
;
present_parameters
->
FullScreen_PresentationInterval
=
desc
.
swap_i
nterval
;
if
(
FAILED
(
hr
))
{
...
...
dlls/d3d9/device.c
View file @
94c9b0b4
...
...
@@ -549,7 +549,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevi
D3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
IDirect3DDevice9Impl
*
This
=
impl_from_IDirect3DDevice9Ex
(
iface
);
WINED3DPRESENT_PARAMETERS
localParameters
;
struct
wined3d_swapchain_desc
swapchain_desc
;
HRESULT
hr
;
TRACE
(
"iface %p, present_parameters %p.
\n
"
,
iface
,
pPresentationParameters
);
...
...
@@ -564,23 +564,23 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevi
*/
wined3d_mutex_lock
();
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
=
pPresentationParameters
->
MultiSampleQuality
;
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
->
PresentationInterval
;
localParameters
.
AutoRestoreDisplayMode
=
TRUE
;
hr
=
wined3d_device_reset
(
This
->
wined3d_device
,
&
localParameters
,
reset_enum_callback
);
swapchain_desc
.
backbuffer_width
=
pPresentationParameters
->
BackBufferWidth
;
swapchain_desc
.
backbuffer_height
=
pPresentationParameters
->
BackBufferHeight
;
swapchain_desc
.
backbuffer_format
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
BackBufferFormat
);
swapchain_desc
.
backbuffer_count
=
pPresentationParameters
->
BackBufferCount
;
swapchain_desc
.
multisample_type
=
pPresentationParameters
->
MultiSampleType
;
swapchain_desc
.
multisample_quality
=
pPresentationParameters
->
MultiSampleQuality
;
swapchain_desc
.
swap_effect
=
pPresentationParameters
->
SwapEffect
;
swapchain_desc
.
device_window
=
pPresentationParameters
->
hDeviceWindow
;
swapchain_desc
.
windowed
=
pPresentationParameters
->
Windowed
;
swapchain_desc
.
enable_auto_depth_stencil
=
pPresentationParameters
->
EnableAutoDepthStencil
;
swapchain_desc
.
auto_depth_stencil_format
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
AutoDepthStencilFormat
);
swapchain_desc
.
flags
=
pPresentationParameters
->
Flags
;
swapchain_desc
.
refresh_rate
=
pPresentationParameters
->
FullScreen_RefreshRateInHz
;
swapchain_desc
.
swap_interval
=
pPresentationParameters
->
PresentationInterval
;
swapchain_desc
.
auto_restore_display_mode
=
TRUE
;
hr
=
wined3d_device_reset
(
This
->
wined3d_device
,
&
swapchain_desc
,
reset_enum_callback
);
if
(
FAILED
(
hr
))
This
->
notreset
=
TRUE
;
else
...
...
@@ -3243,30 +3243,30 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
}
static
HRESULT
CDECL
device_parent_create_swapchain
(
struct
wined3d_device_parent
*
device_parent
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
struct
wined3d_swapchain
**
swapchain
)
struct
wined3d_swapchain_desc
*
desc
,
struct
wined3d_swapchain
**
swapchain
)
{
struct
IDirect3DDevice9Impl
*
device
=
device_from_device_parent
(
device_parent
);
D3DPRESENT_PARAMETERS
local_parameters
;
IDirect3DSwapChain9
*
d3d_swapchain
;
HRESULT
hr
;
TRACE
(
"device_parent %p,
present_parameters %p, swapchain %p
\n
"
,
device_parent
,
present_parameters
,
swapchain
);
TRACE
(
"device_parent %p,
desc %p, swapchain %p
\n
"
,
device_parent
,
desc
,
swapchain
);
/* Copy the presentation parameters */
local_parameters
.
BackBufferWidth
=
present_parameters
->
BackBufferW
idth
;
local_parameters
.
BackBufferHeight
=
present_parameters
->
BackBufferH
eight
;
local_parameters
.
BackBufferFormat
=
d3dformat_from_wined3dformat
(
present_parameters
->
BackBufferF
ormat
);
local_parameters
.
BackBufferCount
=
present_parameters
->
BackBufferC
ount
;
local_parameters
.
MultiSampleType
=
present_parameters
->
MultiSampleT
ype
;
local_parameters
.
MultiSampleQuality
=
present_parameters
->
MultiSampleQ
uality
;
local_parameters
.
SwapEffect
=
present_parameters
->
SwapE
ffect
;
local_parameters
.
hDeviceWindow
=
present_parameters
->
hDeviceW
indow
;
local_parameters
.
Windowed
=
present_parameters
->
W
indowed
;
local_parameters
.
EnableAutoDepthStencil
=
present_parameters
->
EnableAutoDepthS
tencil
;
local_parameters
.
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
present_parameters
->
AutoDepthStencilF
ormat
);
local_parameters
.
Flags
=
present_parameters
->
F
lags
;
local_parameters
.
FullScreen_RefreshRateInHz
=
present_parameters
->
FullScreen_RefreshRateInHz
;
local_parameters
.
PresentationInterval
=
present_parameters
->
PresentationI
nterval
;
local_parameters
.
BackBufferWidth
=
desc
->
backbuffer_w
idth
;
local_parameters
.
BackBufferHeight
=
desc
->
backbuffer_h
eight
;
local_parameters
.
BackBufferFormat
=
d3dformat_from_wined3dformat
(
desc
->
backbuffer_f
ormat
);
local_parameters
.
BackBufferCount
=
desc
->
backbuffer_c
ount
;
local_parameters
.
MultiSampleType
=
desc
->
multisample_t
ype
;
local_parameters
.
MultiSampleQuality
=
desc
->
multisample_q
uality
;
local_parameters
.
SwapEffect
=
desc
->
swap_e
ffect
;
local_parameters
.
hDeviceWindow
=
desc
->
device_w
indow
;
local_parameters
.
Windowed
=
desc
->
w
indowed
;
local_parameters
.
EnableAutoDepthStencil
=
desc
->
enable_auto_depth_s
tencil
;
local_parameters
.
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
desc
->
auto_depth_stencil_f
ormat
);
local_parameters
.
Flags
=
desc
->
f
lags
;
local_parameters
.
FullScreen_RefreshRateInHz
=
desc
->
refresh_rate
;
local_parameters
.
PresentationInterval
=
desc
->
swap_i
nterval
;
hr
=
IDirect3DDevice9Impl_CreateAdditionalSwapChain
(
&
device
->
IDirect3DDevice9Ex_iface
,
&
local_parameters
,
&
d3d_swapchain
);
...
...
@@ -3282,20 +3282,20 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
IDirect3DSwapChain9_Release
((
IDirect3DSwapChain9
*
)
d3d_swapchain
);
/* Copy back the presentation parameters */
present_parameters
->
BackBufferW
idth
=
local_parameters
.
BackBufferWidth
;
present_parameters
->
BackBufferH
eight
=
local_parameters
.
BackBufferHeight
;
present_parameters
->
BackBufferF
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
BackBufferFormat
);
present_parameters
->
BackBufferC
ount
=
local_parameters
.
BackBufferCount
;
present_parameters
->
MultiSampleT
ype
=
local_parameters
.
MultiSampleType
;
present_parameters
->
MultiSampleQ
uality
=
local_parameters
.
MultiSampleQuality
;
present_parameters
->
SwapE
ffect
=
local_parameters
.
SwapEffect
;
present_parameters
->
hDeviceW
indow
=
local_parameters
.
hDeviceWindow
;
present_parameters
->
W
indowed
=
local_parameters
.
Windowed
;
present_parameters
->
EnableAutoDepthS
tencil
=
local_parameters
.
EnableAutoDepthStencil
;
present_parameters
->
AutoDepthStencilF
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
AutoDepthStencilFormat
);
present_parameters
->
F
lags
=
local_parameters
.
Flags
;
present_parameters
->
FullScreen_RefreshRateInHz
=
local_parameters
.
FullScreen_RefreshRateInHz
;
present_parameters
->
PresentationI
nterval
=
local_parameters
.
PresentationInterval
;
desc
->
backbuffer_w
idth
=
local_parameters
.
BackBufferWidth
;
desc
->
backbuffer_h
eight
=
local_parameters
.
BackBufferHeight
;
desc
->
backbuffer_f
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
BackBufferFormat
);
desc
->
backbuffer_c
ount
=
local_parameters
.
BackBufferCount
;
desc
->
multisample_t
ype
=
local_parameters
.
MultiSampleType
;
desc
->
multisample_q
uality
=
local_parameters
.
MultiSampleQuality
;
desc
->
swap_e
ffect
=
local_parameters
.
SwapEffect
;
desc
->
device_w
indow
=
local_parameters
.
hDeviceWindow
;
desc
->
w
indowed
=
local_parameters
.
Windowed
;
desc
->
enable_auto_depth_s
tencil
=
local_parameters
.
EnableAutoDepthStencil
;
desc
->
auto_depth_stencil_f
ormat
=
wined3dformat_from_d3dformat
(
local_parameters
.
AutoDepthStencilFormat
);
desc
->
f
lags
=
local_parameters
.
Flags
;
desc
->
refresh_rate
=
local_parameters
.
FullScreen_RefreshRateInHz
;
desc
->
swap_i
nterval
=
local_parameters
.
PresentationInterval
;
return
hr
;
}
...
...
@@ -3328,10 +3328,11 @@ static void setup_fpu(void)
#endif
}
HRESULT
device_init
(
IDirect3DDevice9Impl
*
device
,
IDirect3D9Impl
*
parent
,
struct
wined3d
*
wined3d
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
,
D3DDISPLAYMODEEX
*
mode
)
HRESULT
device_init
(
IDirect3DDevice9Impl
*
device
,
IDirect3D9Impl
*
parent
,
struct
wined3d
*
wined3d
,
UINT
adapter
,
D3DDEVTYPE
device_type
,
HWND
focus_window
,
DWORD
flags
,
D3DPRESENT_PARAMETERS
*
parameters
,
D3DDISPLAYMODEEX
*
mode
)
{
WINED3DPRESENT_PARAMETERS
*
wined3d_parameters
;
struct
wined3d_swapchain_desc
*
swapchain_desc
;
UINT
i
,
count
=
1
;
HRESULT
hr
;
...
...
@@ -3388,8 +3389,8 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct
}
}
wined3d_parameters
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
wined3d_parameters
)
*
count
);
if
(
!
wined3d_parameters
)
swapchain_desc
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
swapchain_desc
)
*
count
);
if
(
!
swapchain_desc
)
{
ERR
(
"Failed to allocate wined3d parameters.
\n
"
);
wined3d_device_decref
(
device
->
wined3d_device
);
...
...
@@ -3399,30 +3400,30 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct
for
(
i
=
0
;
i
<
count
;
++
i
)
{
wined3d_parameters
[
i
].
BackBufferW
idth
=
parameters
[
i
].
BackBufferWidth
;
wined3d_parameters
[
i
].
BackBufferH
eight
=
parameters
[
i
].
BackBufferHeight
;
wined3d_parameters
[
i
].
BackBufferF
ormat
=
wined3dformat_from_d3dformat
(
parameters
[
i
].
BackBufferFormat
);
wined3d_parameters
[
i
].
BackBufferC
ount
=
parameters
[
i
].
BackBufferCount
;
wined3d_parameters
[
i
].
MultiSampleT
ype
=
parameters
[
i
].
MultiSampleType
;
wined3d_parameters
[
i
].
MultiSampleQ
uality
=
parameters
[
i
].
MultiSampleQuality
;
wined3d_parameters
[
i
].
SwapE
ffect
=
parameters
[
i
].
SwapEffect
;
wined3d_parameters
[
i
].
hDeviceW
indow
=
parameters
[
i
].
hDeviceWindow
;
wined3d_parameters
[
i
].
W
indowed
=
parameters
[
i
].
Windowed
;
wined3d_parameters
[
i
].
EnableAutoDepthS
tencil
=
parameters
[
i
].
EnableAutoDepthStencil
;
wined3d_parameters
[
i
].
AutoDepthStencilF
ormat
=
swapchain_desc
[
i
].
backbuffer_w
idth
=
parameters
[
i
].
BackBufferWidth
;
swapchain_desc
[
i
].
backbuffer_h
eight
=
parameters
[
i
].
BackBufferHeight
;
swapchain_desc
[
i
].
backbuffer_f
ormat
=
wined3dformat_from_d3dformat
(
parameters
[
i
].
BackBufferFormat
);
swapchain_desc
[
i
].
backbuffer_c
ount
=
parameters
[
i
].
BackBufferCount
;
swapchain_desc
[
i
].
multisample_t
ype
=
parameters
[
i
].
MultiSampleType
;
swapchain_desc
[
i
].
multisample_q
uality
=
parameters
[
i
].
MultiSampleQuality
;
swapchain_desc
[
i
].
swap_e
ffect
=
parameters
[
i
].
SwapEffect
;
swapchain_desc
[
i
].
device_w
indow
=
parameters
[
i
].
hDeviceWindow
;
swapchain_desc
[
i
].
w
indowed
=
parameters
[
i
].
Windowed
;
swapchain_desc
[
i
].
enable_auto_depth_s
tencil
=
parameters
[
i
].
EnableAutoDepthStencil
;
swapchain_desc
[
i
].
auto_depth_stencil_f
ormat
=
wined3dformat_from_d3dformat
(
parameters
[
i
].
AutoDepthStencilFormat
);
wined3d_parameters
[
i
].
F
lags
=
parameters
[
i
].
Flags
;
wined3d_parameters
[
i
].
FullScreen_RefreshRateInHz
=
parameters
[
i
].
FullScreen_RefreshRateInHz
;
wined3d_parameters
[
i
].
PresentationI
nterval
=
parameters
[
i
].
PresentationInterval
;
wined3d_parameters
[
i
].
AutoRestoreDisplayM
ode
=
TRUE
;
swapchain_desc
[
i
].
f
lags
=
parameters
[
i
].
Flags
;
swapchain_desc
[
i
].
refresh_rate
=
parameters
[
i
].
FullScreen_RefreshRateInHz
;
swapchain_desc
[
i
].
swap_i
nterval
=
parameters
[
i
].
PresentationInterval
;
swapchain_desc
[
i
].
auto_restore_display_m
ode
=
TRUE
;
}
hr
=
wined3d_device_init_3d
(
device
->
wined3d_device
,
wined3d_parameters
);
hr
=
wined3d_device_init_3d
(
device
->
wined3d_device
,
swapchain_desc
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize 3D, hr %#x.
\n
"
,
hr
);
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
HeapFree
(
GetProcessHeap
(),
0
,
wined3d_parameters
);
HeapFree
(
GetProcessHeap
(),
0
,
swapchain_desc
);
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -3432,23 +3433,23 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct
for
(
i
=
0
;
i
<
count
;
++
i
)
{
parameters
[
i
].
BackBufferWidth
=
wined3d_parameters
[
i
].
BackBufferW
idth
;
parameters
[
i
].
BackBufferHeight
=
wined3d_parameters
[
i
].
BackBufferH
eight
;
parameters
[
i
].
BackBufferFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
[
i
].
BackBufferF
ormat
);
parameters
[
i
].
BackBufferCount
=
wined3d_parameters
[
i
].
BackBufferC
ount
;
parameters
[
i
].
MultiSampleType
=
wined3d_parameters
[
i
].
MultiSampleT
ype
;
parameters
[
i
].
MultiSampleQuality
=
wined3d_parameters
[
i
].
MultiSampleQ
uality
;
parameters
[
i
].
SwapEffect
=
wined3d_parameters
[
i
].
SwapE
ffect
;
parameters
[
i
].
hDeviceWindow
=
wined3d_parameters
[
i
].
hDeviceW
indow
;
parameters
[
i
].
Windowed
=
wined3d_parameters
[
i
].
W
indowed
;
parameters
[
i
].
EnableAutoDepthStencil
=
wined3d_parameters
[
i
].
EnableAutoDepthS
tencil
;
parameters
[
i
].
BackBufferWidth
=
swapchain_desc
[
i
].
backbuffer_w
idth
;
parameters
[
i
].
BackBufferHeight
=
swapchain_desc
[
i
].
backbuffer_h
eight
;
parameters
[
i
].
BackBufferFormat
=
d3dformat_from_wined3dformat
(
swapchain_desc
[
i
].
backbuffer_f
ormat
);
parameters
[
i
].
BackBufferCount
=
swapchain_desc
[
i
].
backbuffer_c
ount
;
parameters
[
i
].
MultiSampleType
=
swapchain_desc
[
i
].
multisample_t
ype
;
parameters
[
i
].
MultiSampleQuality
=
swapchain_desc
[
i
].
multisample_q
uality
;
parameters
[
i
].
SwapEffect
=
swapchain_desc
[
i
].
swap_e
ffect
;
parameters
[
i
].
hDeviceWindow
=
swapchain_desc
[
i
].
device_w
indow
;
parameters
[
i
].
Windowed
=
swapchain_desc
[
i
].
w
indowed
;
parameters
[
i
].
EnableAutoDepthStencil
=
swapchain_desc
[
i
].
enable_auto_depth_s
tencil
;
parameters
[
i
].
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
[
i
].
AutoDepthStencilF
ormat
);
parameters
[
i
].
Flags
=
wined3d_parameters
[
i
].
F
lags
;
parameters
[
i
].
FullScreen_RefreshRateInHz
=
wined3d_parameters
[
i
].
FullScreen_RefreshRateInHz
;
parameters
[
i
].
PresentationInterval
=
wined3d_parameters
[
i
].
PresentationI
nterval
;
d3dformat_from_wined3dformat
(
swapchain_desc
[
i
].
auto_depth_stencil_f
ormat
);
parameters
[
i
].
Flags
=
swapchain_desc
[
i
].
f
lags
;
parameters
[
i
].
FullScreen_RefreshRateInHz
=
swapchain_desc
[
i
].
refresh_rate
;
parameters
[
i
].
PresentationInterval
=
swapchain_desc
[
i
].
swap_i
nterval
;
}
HeapFree
(
GetProcessHeap
(),
0
,
wined3d_parameters
);
HeapFree
(
GetProcessHeap
(),
0
,
swapchain_desc
);
/* Initialize the converted declaration array. This creates a valid pointer
* and when adding decls HeapReAlloc() can be used without further checking. */
...
...
dlls/d3d9/swapchain.c
View file @
94c9b0b4
...
...
@@ -181,31 +181,33 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(IDirect3DSwapChain9 *ifa
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DSwapChain9Impl_GetPresentParameters
(
LPDIRECT3DSWAPCHAIN9
iface
,
D3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
static
HRESULT
WINAPI
IDirect3DSwapChain9Impl_GetPresentParameters
(
IDirect3DSwapChain9
*
iface
,
D3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
IDirect3DSwapChain9Impl
*
This
=
(
IDirect3DSwapChain9Impl
*
)
iface
;
WINED3DPRESENT_PARAMETERS
winePresentParameters
;
struct
wined3d_swapchain_desc
desc
;
HRESULT
hr
;
TRACE
(
"iface %p, parameters %p.
\n
"
,
iface
,
pPresentationParameters
);
wined3d_mutex_lock
();
hr
=
wined3d_swapchain_get_
present_parameters
(
This
->
wined3d_swapchain
,
&
winePresentParameters
);
hr
=
wined3d_swapchain_get_
desc
(
This
->
wined3d_swapchain
,
&
desc
);
wined3d_mutex_unlock
();
pPresentationParameters
->
BackBufferWidth
=
winePresentParameters
.
BackBufferW
idth
;
pPresentationParameters
->
BackBufferHeight
=
winePresentParameters
.
BackBufferH
eight
;
pPresentationParameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
winePresentParameters
.
BackBufferF
ormat
);
pPresentationParameters
->
BackBufferCount
=
winePresentParameters
.
BackBufferC
ount
;
pPresentationParameters
->
MultiSampleType
=
winePresentParameters
.
MultiSampleT
ype
;
pPresentationParameters
->
MultiSampleQuality
=
winePresentParameters
.
MultiSampleQ
uality
;
pPresentationParameters
->
SwapEffect
=
winePresentParameters
.
SwapE
ffect
;
pPresentationParameters
->
hDeviceWindow
=
winePresentParameters
.
hDeviceW
indow
;
pPresentationParameters
->
Windowed
=
winePresentParameters
.
W
indowed
;
pPresentationParameters
->
EnableAutoDepthStencil
=
winePresentParameters
.
EnableAutoDepthS
tencil
;
pPresentationParameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
winePresentParameters
.
AutoDepthStencilF
ormat
);
pPresentationParameters
->
Flags
=
winePresentParameters
.
F
lags
;
pPresentationParameters
->
FullScreen_RefreshRateInHz
=
winePresentParameters
.
FullScreen_RefreshRateInHz
;
pPresentationParameters
->
PresentationInterval
=
winePresentParameters
.
PresentationI
nterval
;
pPresentationParameters
->
BackBufferWidth
=
desc
.
backbuffer_w
idth
;
pPresentationParameters
->
BackBufferHeight
=
desc
.
backbuffer_h
eight
;
pPresentationParameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
desc
.
backbuffer_f
ormat
);
pPresentationParameters
->
BackBufferCount
=
desc
.
backbuffer_c
ount
;
pPresentationParameters
->
MultiSampleType
=
desc
.
multisample_t
ype
;
pPresentationParameters
->
MultiSampleQuality
=
desc
.
multisample_q
uality
;
pPresentationParameters
->
SwapEffect
=
desc
.
swap_e
ffect
;
pPresentationParameters
->
hDeviceWindow
=
desc
.
device_w
indow
;
pPresentationParameters
->
Windowed
=
desc
.
w
indowed
;
pPresentationParameters
->
EnableAutoDepthStencil
=
desc
.
enable_auto_depth_s
tencil
;
pPresentationParameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
desc
.
auto_depth_stencil_f
ormat
);
pPresentationParameters
->
Flags
=
desc
.
f
lags
;
pPresentationParameters
->
FullScreen_RefreshRateInHz
=
desc
.
refresh_rate
;
pPresentationParameters
->
PresentationInterval
=
desc
.
swap_i
nterval
;
return
hr
;
}
...
...
@@ -238,48 +240,48 @@ static const struct wined3d_parent_ops d3d9_swapchain_wined3d_parent_ops =
HRESULT
swapchain_init
(
IDirect3DSwapChain9Impl
*
swapchain
,
IDirect3DDevice9Impl
*
device
,
D3DPRESENT_PARAMETERS
*
present_parameters
)
{
WINED3DPRESENT_PARAMETERS
wined3d_parameters
;
struct
wined3d_swapchain_desc
desc
;
HRESULT
hr
;
swapchain
->
ref
=
1
;
swapchain
->
lpVtbl
=
&
Direct3DSwapChain9_Vtbl
;
wined3d_parameters
.
BackBufferW
idth
=
present_parameters
->
BackBufferWidth
;
wined3d_parameters
.
BackBufferH
eight
=
present_parameters
->
BackBufferHeight
;
wined3d_parameters
.
BackBufferF
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
BackBufferFormat
);
wined3d_parameters
.
BackBufferC
ount
=
max
(
1
,
present_parameters
->
BackBufferCount
);
wined3d_parameters
.
MultiSampleT
ype
=
present_parameters
->
MultiSampleType
;
wined3d_parameters
.
MultiSampleQ
uality
=
present_parameters
->
MultiSampleQuality
;
wined3d_parameters
.
SwapE
ffect
=
present_parameters
->
SwapEffect
;
wined3d_parameters
.
hDeviceW
indow
=
present_parameters
->
hDeviceWindow
;
wined3d_parameters
.
W
indowed
=
present_parameters
->
Windowed
;
wined3d_parameters
.
EnableAutoDepthS
tencil
=
present_parameters
->
EnableAutoDepthStencil
;
wined3d_parameters
.
AutoDepthStencilF
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
AutoDepthStencilFormat
);
wined3d_parameters
.
F
lags
=
present_parameters
->
Flags
;
wined3d_parameters
.
FullScreen_RefreshRateInHz
=
present_parameters
->
FullScreen_RefreshRateInHz
;
wined3d_parameters
.
PresentationI
nterval
=
present_parameters
->
PresentationInterval
;
wined3d_parameters
.
AutoRestoreDisplayM
ode
=
TRUE
;
desc
.
backbuffer_w
idth
=
present_parameters
->
BackBufferWidth
;
desc
.
backbuffer_h
eight
=
present_parameters
->
BackBufferHeight
;
desc
.
backbuffer_f
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
BackBufferFormat
);
desc
.
backbuffer_c
ount
=
max
(
1
,
present_parameters
->
BackBufferCount
);
desc
.
multisample_t
ype
=
present_parameters
->
MultiSampleType
;
desc
.
multisample_q
uality
=
present_parameters
->
MultiSampleQuality
;
desc
.
swap_e
ffect
=
present_parameters
->
SwapEffect
;
desc
.
device_w
indow
=
present_parameters
->
hDeviceWindow
;
desc
.
w
indowed
=
present_parameters
->
Windowed
;
desc
.
enable_auto_depth_s
tencil
=
present_parameters
->
EnableAutoDepthStencil
;
desc
.
auto_depth_stencil_f
ormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
AutoDepthStencilFormat
);
desc
.
f
lags
=
present_parameters
->
Flags
;
desc
.
refresh_rate
=
present_parameters
->
FullScreen_RefreshRateInHz
;
desc
.
swap_i
nterval
=
present_parameters
->
PresentationInterval
;
desc
.
auto_restore_display_m
ode
=
TRUE
;
wined3d_mutex_lock
();
hr
=
wined3d_swapchain_create
(
device
->
wined3d_device
,
&
wined3d_parameters
,
hr
=
wined3d_swapchain_create
(
device
->
wined3d_device
,
&
desc
,
SURFACE_OPENGL
,
swapchain
,
&
d3d9_swapchain_wined3d_parent_ops
,
&
swapchain
->
wined3d_swapchain
);
wined3d_mutex_unlock
();
present_parameters
->
BackBufferWidth
=
wined3d_parameters
.
BackBufferW
idth
;
present_parameters
->
BackBufferHeight
=
wined3d_parameters
.
BackBufferH
eight
;
present_parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
BackBufferF
ormat
);
present_parameters
->
BackBufferCount
=
wined3d_parameters
.
BackBufferC
ount
;
present_parameters
->
MultiSampleType
=
wined3d_parameters
.
MultiSampleT
ype
;
present_parameters
->
MultiSampleQuality
=
wined3d_parameters
.
MultiSampleQ
uality
;
present_parameters
->
SwapEffect
=
wined3d_parameters
.
SwapE
ffect
;
present_parameters
->
hDeviceWindow
=
wined3d_parameters
.
hDeviceW
indow
;
present_parameters
->
Windowed
=
wined3d_parameters
.
W
indowed
;
present_parameters
->
EnableAutoDepthStencil
=
wined3d_parameters
.
EnableAutoDepthS
tencil
;
present_parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
AutoDepthStencilF
ormat
);
present_parameters
->
Flags
=
wined3d_parameters
.
F
lags
;
present_parameters
->
FullScreen_RefreshRateInHz
=
wined3d_parameters
.
FullScreen_RefreshRateInHz
;
present_parameters
->
PresentationInterval
=
wined3d_parameters
.
PresentationI
nterval
;
present_parameters
->
BackBufferWidth
=
desc
.
backbuffer_w
idth
;
present_parameters
->
BackBufferHeight
=
desc
.
backbuffer_h
eight
;
present_parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
desc
.
backbuffer_f
ormat
);
present_parameters
->
BackBufferCount
=
desc
.
backbuffer_c
ount
;
present_parameters
->
MultiSampleType
=
desc
.
multisample_t
ype
;
present_parameters
->
MultiSampleQuality
=
desc
.
multisample_q
uality
;
present_parameters
->
SwapEffect
=
desc
.
swap_e
ffect
;
present_parameters
->
hDeviceWindow
=
desc
.
device_w
indow
;
present_parameters
->
Windowed
=
desc
.
w
indowed
;
present_parameters
->
EnableAutoDepthStencil
=
desc
.
enable_auto_depth_s
tencil
;
present_parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
desc
.
auto_depth_stencil_f
ormat
);
present_parameters
->
Flags
=
desc
.
f
lags
;
present_parameters
->
FullScreen_RefreshRateInHz
=
desc
.
refresh_rate
;
present_parameters
->
PresentationInterval
=
desc
.
swap_i
nterval
;
if
(
FAILED
(
hr
))
{
...
...
dlls/ddraw/ddraw.c
View file @
94c9b0b4
...
...
@@ -617,9 +617,9 @@ static HRESULT ddraw_set_focus_window(IDirectDrawImpl *ddraw, HWND window)
}
static
HRESULT
ddraw_attach_d3d_device
(
IDirectDrawImpl
*
ddraw
,
WINED3DPRESENT_PARAMETERS
*
presentation_parameters
)
struct
wined3d_swapchain_desc
*
swapchain_desc
)
{
HWND
window
=
presentation_parameters
->
hDeviceW
indow
;
HWND
window
=
swapchain_desc
->
device_w
indow
;
HRESULT
hr
;
TRACE
(
"ddraw %p.
\n
"
,
ddraw
);
...
...
@@ -638,7 +638,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw,
ShowWindow
(
window
,
SW_HIDE
);
/* Just to be sure */
WARN
(
"No window for the Direct3DDevice, created hidden window %p.
\n
"
,
window
);
presentation_parameters
->
hDeviceW
indow
=
window
;
swapchain_desc
->
device_w
indow
=
window
;
}
else
{
...
...
@@ -649,7 +649,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw,
/* Set this NOW, otherwise creating the depth stencil surface will cause a
* recursive loop until ram or emulated video memory is full. */
ddraw
->
d3d_initialized
=
TRUE
;
hr
=
wined3d_device_init_3d
(
ddraw
->
wined3d_device
,
presentation_parameters
);
hr
=
wined3d_device_init_3d
(
ddraw
->
wined3d_device
,
swapchain_desc
);
if
(
FAILED
(
hr
))
{
ddraw
->
d3d_initialized
=
FALSE
;
...
...
@@ -673,7 +673,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw,
static
HRESULT
ddraw_create_swapchain
(
IDirectDrawImpl
*
ddraw
,
HWND
window
,
BOOL
windowed
)
{
WINED3DPRESENT_PARAMETERS
presentation_parameters
;
struct
wined3d_swapchain_desc
swapchain_desc
;
struct
wined3d_display_mode
mode
;
HRESULT
hr
=
WINED3D_OK
;
...
...
@@ -688,18 +688,18 @@ static HRESULT ddraw_create_swapchain(IDirectDrawImpl *ddraw, HWND window, BOOL
return
hr
;
}
memset
(
&
presentation_parameters
,
0
,
sizeof
(
presentation_parameters
));
presentation_parameters
.
BackBufferW
idth
=
mode
.
width
;
presentation_parameters
.
BackBufferH
eight
=
mode
.
height
;
presentation_parameters
.
BackBufferF
ormat
=
mode
.
format_id
;
presentation_parameters
.
SwapE
ffect
=
WINED3DSWAPEFFECT_COPY
;
presentation_parameters
.
hDeviceW
indow
=
window
;
presentation_parameters
.
W
indowed
=
windowed
;
memset
(
&
swapchain_desc
,
0
,
sizeof
(
swapchain_desc
));
swapchain_desc
.
backbuffer_w
idth
=
mode
.
width
;
swapchain_desc
.
backbuffer_h
eight
=
mode
.
height
;
swapchain_desc
.
backbuffer_f
ormat
=
mode
.
format_id
;
swapchain_desc
.
swap_e
ffect
=
WINED3DSWAPEFFECT_COPY
;
swapchain_desc
.
device_w
indow
=
window
;
swapchain_desc
.
w
indowed
=
windowed
;
if
(
DefaultSurfaceType
==
SURFACE_OPENGL
)
hr
=
ddraw_attach_d3d_device
(
ddraw
,
&
presentation_parameters
);
hr
=
ddraw_attach_d3d_device
(
ddraw
,
&
swapchain_desc
);
else
hr
=
wined3d_device_init_gdi
(
ddraw
->
wined3d_device
,
&
presentation_parameters
);
hr
=
wined3d_device_init_gdi
(
ddraw
->
wined3d_device
,
&
swapchain_desc
);
if
(
FAILED
(
hr
))
{
...
...
@@ -2919,21 +2919,21 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
if
((
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
&&
(
ddraw
->
cooperative_level
&
DDSCL_EXCLUSIVE
))
{
WINED3DPRESENT_PARAMETERS
presentation_parameters
;
struct
wined3d_swapchain_desc
swapchain_desc
;
hr
=
wined3d_swapchain_get_
present_parameters
(
ddraw
->
wined3d_swapchain
,
&
presentation_parameters
);
hr
=
wined3d_swapchain_get_
desc
(
ddraw
->
wined3d_swapchain
,
&
swapchain_desc
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get present parameters.
\n
"
);
return
hr
;
}
presentation_parameters
.
BackBufferW
idth
=
mode
.
width
;
presentation_parameters
.
BackBufferH
eight
=
mode
.
height
;
presentation_parameters
.
BackBufferF
ormat
=
mode
.
format_id
;
swapchain_desc
.
backbuffer_w
idth
=
mode
.
width
;
swapchain_desc
.
backbuffer_h
eight
=
mode
.
height
;
swapchain_desc
.
backbuffer_f
ormat
=
mode
.
format_id
;
hr
=
wined3d_device_reset
(
ddraw
->
wined3d_device
,
&
presentation_parameters
,
ddraw_reset_enum_callback
);
&
swapchain_desc
,
ddraw_reset_enum_callback
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to reset device.
\n
"
);
...
...
@@ -5433,12 +5433,12 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
}
static
HRESULT
CDECL
device_parent_create_swapchain
(
struct
wined3d_device_parent
*
device_parent
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
struct
wined3d_swapchain
**
swapchain
)
struct
wined3d_swapchain_desc
*
desc
,
struct
wined3d_swapchain
**
swapchain
)
{
struct
IDirectDrawImpl
*
ddraw
=
ddraw_from_device_parent
(
device_parent
);
HRESULT
hr
;
TRACE
(
"device_parent %p,
present_parameters %p, swapchain %p.
\n
"
,
device_parent
,
present_parameters
,
swapchain
);
TRACE
(
"device_parent %p,
desc %p, swapchain %p.
\n
"
,
device_parent
,
desc
,
swapchain
);
if
(
ddraw
->
wined3d_swapchain
)
{
...
...
@@ -5446,7 +5446,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
return
E_FAIL
;
}
hr
=
wined3d_swapchain_create
(
ddraw
->
wined3d_device
,
present_parameters
,
hr
=
wined3d_swapchain_create
(
ddraw
->
wined3d_device
,
desc
,
DefaultSurfaceType
,
NULL
,
&
ddraw_null_wined3d_parent_ops
,
swapchain
);
if
(
FAILED
(
hr
))
WARN
(
"Failed to create swapchain, hr %#x.
\n
"
,
hr
);
...
...
dlls/dxgi/device.c
View file @
94c9b0b4
...
...
@@ -290,14 +290,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
}
static
HRESULT
STDMETHODCALLTYPE
dxgi_device_create_swapchain
(
IWineDXGIDevice
*
iface
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
struct
wined3d_swapchain
**
wined3d_swapchain
)
struct
wined3d_swapchain_desc
*
desc
,
struct
wined3d_swapchain
**
wined3d_swapchain
)
{
struct
dxgi_device
*
This
=
impl_from_IWineDXGIDevice
(
iface
);
struct
dxgi_swapchain
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p,
present_parameters
%p, wined3d_swapchain %p.
\n
"
,
iface
,
present_parameters
,
wined3d_swapchain
);
TRACE
(
"iface %p,
desc
%p, wined3d_swapchain %p.
\n
"
,
iface
,
desc
,
wined3d_swapchain
);
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
...
...
@@ -306,7 +306,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_swapchain(IWineDXGIDevice *i
return
E_OUTOFMEMORY
;
}
hr
=
dxgi_swapchain_init
(
object
,
This
,
present_parameters
);
hr
=
dxgi_swapchain_init
(
object
,
This
,
desc
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize swapchain, hr %#x.
\n
"
,
hr
);
...
...
dlls/dxgi/dxgi_private.h
View file @
94c9b0b4
...
...
@@ -130,7 +130,7 @@ struct dxgi_swapchain
};
HRESULT
dxgi_swapchain_init
(
struct
dxgi_swapchain
*
swapchain
,
struct
dxgi_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
)
DECLSPEC_HIDDEN
;
struct
wined3d_swapchain_desc
*
desc
)
DECLSPEC_HIDDEN
;
/* IDXGISurface */
struct
dxgi_surface
...
...
dlls/dxgi/factory.c
View file @
94c9b0b4
...
...
@@ -161,13 +161,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IWineDXGIFact
return
E_NOTIMPL
;
}
/* TODO: The DXGI swapchain desc is a bit nicer than WINED3DPRESENT_PARAMETERS,
* change wined3d to use a structure more similar to DXGI. */
static
HRESULT
STDMETHODCALLTYPE
dxgi_factory_CreateSwapChain
(
IWineDXGIFactory
*
iface
,
IUnknown
*
device
,
DXGI_SWAP_CHAIN_DESC
*
desc
,
IDXGISwapChain
**
swapchain
)
{
WINED3DPRESENT_PARAMETERS
present_parameters
;
struct
wined3d_swapchain
*
wined3d_swapchain
;
struct
wined3d_swapchain_desc
wined3d_desc
;
struct
wined3d_device
*
wined3d_device
;
IWineDXGIDevice
*
dxgi_device
;
UINT
count
;
...
...
@@ -200,31 +198,30 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
FIXME
(
"Ignoring SwapEffect and Flags
\n
"
);
present_parameters
.
BackBufferW
idth
=
desc
->
BufferDesc
.
Width
;
present_parameters
.
BackBufferH
eight
=
desc
->
BufferDesc
.
Height
;
present_parameters
.
BackBufferF
ormat
=
wined3dformat_from_dxgi_format
(
desc
->
BufferDesc
.
Format
);
present_parameters
.
BackBufferC
ount
=
desc
->
BufferCount
;
wined3d_desc
.
backbuffer_w
idth
=
desc
->
BufferDesc
.
Width
;
wined3d_desc
.
backbuffer_h
eight
=
desc
->
BufferDesc
.
Height
;
wined3d_desc
.
backbuffer_f
ormat
=
wined3dformat_from_dxgi_format
(
desc
->
BufferDesc
.
Format
);
wined3d_desc
.
backbuffer_c
ount
=
desc
->
BufferCount
;
if
(
desc
->
SampleDesc
.
Count
>
1
)
{
present_parameters
.
MultiSampleT
ype
=
desc
->
SampleDesc
.
Count
;
present_parameters
.
MultiSampleQ
uality
=
desc
->
SampleDesc
.
Quality
;
wined3d_desc
.
multisample_t
ype
=
desc
->
SampleDesc
.
Count
;
wined3d_desc
.
multisample_q
uality
=
desc
->
SampleDesc
.
Quality
;
}
else
{
present_parameters
.
MultiSampleT
ype
=
WINED3DMULTISAMPLE_NONE
;
present_parameters
.
MultiSampleQ
uality
=
0
;
wined3d_desc
.
multisample_t
ype
=
WINED3DMULTISAMPLE_NONE
;
wined3d_desc
.
multisample_q
uality
=
0
;
}
present_parameters
.
SwapEffect
=
WINED3DSWAPEFFECT_DISCARD
;
present_parameters
.
hDeviceWindow
=
desc
->
OutputWindow
;
present_parameters
.
Windowed
=
desc
->
Windowed
;
present_parameters
.
EnableAutoDepthStencil
=
FALSE
;
present_parameters
.
AutoDepthStencilFormat
=
0
;
present_parameters
.
Flags
=
0
;
/* WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL? */
present_parameters
.
FullScreen_RefreshRateInHz
=
desc
->
BufferDesc
.
RefreshRate
.
Numerator
/
desc
->
BufferDesc
.
RefreshRate
.
Denominator
;
present_parameters
.
PresentationInterval
=
WINED3DPRESENT_INTERVAL_DEFAULT
;
hr
=
wined3d_device_init_3d
(
wined3d_device
,
&
present_parameters
);
wined3d_desc
.
swap_effect
=
WINED3DSWAPEFFECT_DISCARD
;
wined3d_desc
.
device_window
=
desc
->
OutputWindow
;
wined3d_desc
.
windowed
=
desc
->
Windowed
;
wined3d_desc
.
enable_auto_depth_stencil
=
FALSE
;
wined3d_desc
.
auto_depth_stencil_format
=
0
;
wined3d_desc
.
flags
=
0
;
/* WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL? */
wined3d_desc
.
refresh_rate
=
desc
->
BufferDesc
.
RefreshRate
.
Numerator
/
desc
->
BufferDesc
.
RefreshRate
.
Denominator
;
wined3d_desc
.
swap_interval
=
WINED3DPRESENT_INTERVAL_DEFAULT
;
hr
=
wined3d_device_init_3d
(
wined3d_device
,
&
wined3d_desc
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize 3D, returning %#x
\n
"
,
hr
);
...
...
dlls/dxgi/swapchain.c
View file @
94c9b0b4
...
...
@@ -272,14 +272,14 @@ static const struct wined3d_parent_ops dxgi_swapchain_wined3d_parent_ops =
};
HRESULT
dxgi_swapchain_init
(
struct
dxgi_swapchain
*
swapchain
,
struct
dxgi_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
)
struct
wined3d_swapchain_desc
*
desc
)
{
HRESULT
hr
;
swapchain
->
IDXGISwapChain_iface
.
lpVtbl
=
&
dxgi_swapchain_vtbl
;
swapchain
->
refcount
=
1
;
hr
=
wined3d_swapchain_create
(
device
->
wined3d_device
,
present_parameters
,
hr
=
wined3d_swapchain_create
(
device
->
wined3d_device
,
desc
,
SURFACE_OPENGL
,
swapchain
,
&
dxgi_swapchain_wined3d_parent_ops
,
&
swapchain
->
wined3d_swapchain
);
if
(
FAILED
(
hr
))
...
...
dlls/wined3d/context.c
View file @
94c9b0b4
...
...
@@ -1441,7 +1441,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto
out
;
}
switch
(
swapchain
->
presentParms
.
PresentationI
nterval
)
switch
(
swapchain
->
desc
.
swap_i
nterval
)
{
case
WINED3DPRESENT_INTERVAL_IMMEDIATE
:
swap_interval
=
0
;
...
...
@@ -1460,7 +1460,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
swap_interval
=
4
;
break
;
default:
FIXME
(
"Unknown
presentation interval %08x
\n
"
,
swapchain
->
presentParms
.
PresentationI
nterval
);
FIXME
(
"Unknown
swap interval %#x.
\n
"
,
swapchain
->
desc
.
swap_i
nterval
);
swap_interval
=
1
;
}
...
...
dlls/wined3d/device.c
View file @
94c9b0b4
...
...
@@ -1197,7 +1197,7 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
}
HRESULT
CDECL
wined3d_device_init_3d
(
struct
wined3d_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
)
struct
wined3d_swapchain_desc
*
swapchain_desc
)
{
static
const
struct
wined3d_color
black
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
};
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
...
...
@@ -1207,7 +1207,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
DWORD
state
;
unsigned
int
i
;
TRACE
(
"device %p,
present_parameters %p.
\n
"
,
device
,
present_parameters
);
TRACE
(
"device %p,
swapchain_desc %p.
\n
"
,
device
,
swapchain_desc
);
if
(
device
->
d3d_initialized
)
return
WINED3DERR_INVALIDCALL
;
...
...
@@ -1250,7 +1250,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
/* Setup the implicit swapchain. This also initializes a context. */
TRACE
(
"Creating implicit swapchain
\n
"
);
hr
=
device
->
device_parent
->
ops
->
create_swapchain
(
device
->
device_parent
,
present_parameters
,
&
swapchain
);
swapchain_desc
,
&
swapchain
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create implicit swapchain
\n
"
);
...
...
@@ -1345,7 +1345,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
/* Clear the screen */
wined3d_device_clear
(
device
,
0
,
NULL
,
WINED3DCLEAR_TARGET
|
(
present_parameters
->
EnableAutoDepthS
tencil
?
WINED3DCLEAR_ZBUFFER
|
WINED3DCLEAR_STENCIL
:
0
),
|
(
swapchain_desc
->
enable_auto_depth_s
tencil
?
WINED3DCLEAR_ZBUFFER
|
WINED3DCLEAR_STENCIL
:
0
),
&
black
,
1
.
0
f
,
0
);
device
->
d3d_initialized
=
TRUE
;
...
...
@@ -1376,17 +1376,17 @@ err_out:
}
HRESULT
CDECL
wined3d_device_init_gdi
(
struct
wined3d_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
)
struct
wined3d_swapchain_desc
*
swapchain_desc
)
{
struct
wined3d_swapchain
*
swapchain
=
NULL
;
HRESULT
hr
;
TRACE
(
"device %p,
present_parameters %p.
\n
"
,
device
,
present_parameters
);
TRACE
(
"device %p,
swapchain_desc %p.
\n
"
,
device
,
swapchain_desc
);
/* Setup the implicit swapchain */
TRACE
(
"Creating implicit swapchain
\n
"
);
hr
=
device
->
device_parent
->
ops
->
create_swapchain
(
device
->
device_parent
,
present_parameters
,
&
swapchain
);
swapchain_desc
,
&
swapchain
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create implicit swapchain
\n
"
);
...
...
@@ -4950,7 +4950,7 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st
if
(
prev
)
{
if
(
device
->
swapchains
[
0
]
->
presentParms
.
F
lags
&
WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
if
(
device
->
swapchains
[
0
]
->
desc
.
f
lags
&
WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
||
prev
->
flags
&
SFLAG_DISCARD
)
{
surface_modify_ds_location
(
prev
,
SFLAG_DS_DISCARDED
,
...
...
@@ -5217,7 +5217,7 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
}
static
HRESULT
updateSurfaceDesc
(
struct
wined3d_surface
*
surface
,
const
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
)
const
struct
wined3d_swapchain_desc
*
swapchain_desc
)
{
struct
wined3d_device
*
device
=
surface
->
resource
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
...
...
@@ -5231,28 +5231,32 @@ static HRESULT updateSurfaceDesc(struct wined3d_surface *surface,
surface
->
resource
.
allocatedMemory
=
NULL
;
surface
->
flags
&=
~
SFLAG_DIBSECTION
;
}
surface
->
resource
.
width
=
pPresentationParameters
->
BackBufferW
idth
;
surface
->
resource
.
height
=
pPresentationParameters
->
BackBufferH
eight
;
surface
->
resource
.
width
=
swapchain_desc
->
backbuffer_w
idth
;
surface
->
resource
.
height
=
swapchain_desc
->
backbuffer_h
eight
;
if
(
gl_info
->
supported
[
ARB_TEXTURE_NON_POWER_OF_TWO
]
||
gl_info
->
supported
[
ARB_TEXTURE_RECTANGLE
]
||
gl_info
->
supported
[
WINED3D_GL_NORMALIZED_TEXRECT
])
{
surface
->
pow2Width
=
pPresentationParameters
->
BackBufferWidth
;
surface
->
pow2Height
=
pPresentationParameters
->
BackBufferHeight
;
}
else
{
surface
->
pow2Width
=
swapchain_desc
->
backbuffer_width
;
surface
->
pow2Height
=
swapchain_desc
->
backbuffer_height
;
}
else
{
surface
->
pow2Width
=
surface
->
pow2Height
=
1
;
while
(
surface
->
pow2Width
<
pPresentationParameters
->
BackBufferWidth
)
surface
->
pow2Width
<<=
1
;
while
(
surface
->
pow2Height
<
pPresentationParameters
->
BackBufferHeight
)
surface
->
pow2Height
<<=
1
;
while
(
surface
->
pow2Width
<
swapchain_desc
->
backbuffer_width
)
surface
->
pow2Width
<<=
1
;
while
(
surface
->
pow2Height
<
swapchain_desc
->
backbuffer_height
)
surface
->
pow2Height
<<=
1
;
}
if
(
!
(
surface
->
resource
.
usage
&
WINED3DUSAGE_DEPTHSTENCIL
))
surface
->
resource
.
format
=
wined3d_get_format
(
gl_info
,
pPresentationParameters
->
BackBufferF
ormat
);
surface
->
resource
.
multisample_type
=
pPresentationParameters
->
MultiSampleT
ype
;
surface
->
resource
.
multisample_quality
=
pPresentationParameters
->
MultiSampleQ
uality
;
surface
->
resource
.
format
=
wined3d_get_format
(
gl_info
,
swapchain_desc
->
backbuffer_f
ormat
);
surface
->
resource
.
multisample_type
=
swapchain_desc
->
multisample_t
ype
;
surface
->
resource
.
multisample_quality
=
swapchain_desc
->
multisample_q
uality
;
surface
->
resource
.
resource_ops
->
resource_unload
(
&
surface
->
resource
);
if
(
surface
->
pow2Width
!=
pPresentationParameters
->
BackBufferW
idth
||
surface
->
pow2Height
!=
pPresentationParameters
->
BackBufferH
eight
)
if
(
surface
->
pow2Width
!=
swapchain_desc
->
backbuffer_w
idth
||
surface
->
pow2Height
!=
swapchain_desc
->
backbuffer_h
eight
)
{
surface
->
flags
|=
SFLAG_NONPOW2
;
}
...
...
@@ -5274,16 +5278,20 @@ static HRESULT updateSurfaceDesc(struct wined3d_surface *surface,
return
WINED3D_OK
;
}
static
BOOL
is_display_mode_supported
(
const
struct
wined3d_device
*
device
,
const
WINED3DPRESENT_PARAMETERS
*
pp
)
static
BOOL
is_display_mode_supported
(
const
struct
wined3d_device
*
device
,
const
struct
wined3d_swapchain_desc
*
swapchain_desc
)
{
struct
wined3d_display_mode
m
;
UINT
i
,
count
;
HRESULT
hr
;
/* All Windowed modes are supported, as is leaving the current mode */
if
(
pp
->
Windowed
)
return
TRUE
;
if
(
!
pp
->
BackBufferWidth
)
return
TRUE
;
if
(
!
pp
->
BackBufferHeight
)
return
TRUE
;
if
(
swapchain_desc
->
windowed
)
return
TRUE
;
if
(
!
swapchain_desc
->
backbuffer_width
)
return
TRUE
;
if
(
!
swapchain_desc
->
backbuffer_height
)
return
TRUE
;
count
=
wined3d_get_adapter_mode_count
(
device
->
wined3d
,
device
->
adapter
->
ordinal
,
WINED3DFMT_UNKNOWN
);
for
(
i
=
0
;
i
<
count
;
++
i
)
...
...
@@ -5292,7 +5300,7 @@ static BOOL is_display_mode_supported(const struct wined3d_device *device, const
hr
=
wined3d_enum_adapter_modes
(
device
->
wined3d
,
device
->
adapter
->
ordinal
,
WINED3DFMT_UNKNOWN
,
i
,
&
m
);
if
(
FAILED
(
hr
))
ERR
(
"Failed to enumerate adapter mode.
\n
"
);
if
(
m
.
width
==
pp
->
BackBufferWidth
&&
m
.
height
==
pp
->
BackBufferH
eight
)
if
(
m
.
width
==
swapchain_desc
->
backbuffer_width
&&
m
.
height
==
swapchain_desc
->
backbuffer_h
eight
)
/* Mode found, it is supported. */
return
TRUE
;
}
...
...
@@ -5418,7 +5426,7 @@ err:
/* Do not call while under the GL lock. */
HRESULT
CDECL
wined3d_device_reset
(
struct
wined3d_device
*
device
,
const
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
const
struct
wined3d_swapchain_desc
*
swapchain_desc
,
wined3d_device_reset_cb
callback
)
{
struct
wined3d_resource
*
resource
,
*
cursor
;
...
...
@@ -5429,7 +5437,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
unsigned
int
i
;
HRESULT
hr
;
TRACE
(
"device %p,
present_parameters %p.
\n
"
,
device
,
present_parameters
);
TRACE
(
"device %p,
swapchain_desc %p.
\n
"
,
device
,
swapchain_desc
);
wined3d_device_set_index_buffer
(
device
,
NULL
,
WINED3DFMT_UNKNOWN
);
for
(
i
=
0
;
i
<
MAX_STREAMS
;
++
i
)
...
...
@@ -5460,12 +5468,12 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
return
hr
;
}
if
(
!
is_display_mode_supported
(
device
,
present_parameters
))
if
(
!
is_display_mode_supported
(
device
,
swapchain_desc
))
{
WARN
(
"Rejecting
Reset() call because the requested display mode is not supported
\n
"
);
WARN
(
"Requested mode: %
d, %d
.
\n
"
,
present_parameters
->
BackBufferW
idth
,
present_parameters
->
BackBufferH
eight
);
WARN
(
"Rejecting
reset() call because the requested display mode is not supported.
\n
"
);
WARN
(
"Requested mode: %
ux%u
.
\n
"
,
swapchain_desc
->
backbuffer_w
idth
,
swapchain_desc
->
backbuffer_h
eight
);
wined3d_swapchain_decref
(
swapchain
);
return
WINED3DERR_INVALIDCALL
;
}
...
...
@@ -5478,47 +5486,47 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
* TODO: Figure out what happens to explicit swapchains, or if we have more than one implicit swapchain
*/
TRACE
(
"New params:
\n
"
);
TRACE
(
"
BackBufferWidth = %d
\n
"
,
present_parameters
->
BackBufferW
idth
);
TRACE
(
"
BackBufferHeight = %d
\n
"
,
present_parameters
->
BackBufferH
eight
);
TRACE
(
"
BackBufferFormat = %s
\n
"
,
debug_d3dformat
(
present_parameters
->
BackBufferF
ormat
));
TRACE
(
"
BackBufferCount = %d
\n
"
,
present_parameters
->
BackBufferC
ount
);
TRACE
(
"
MultiSampleType = %d
\n
"
,
present_parameters
->
MultiSampleT
ype
);
TRACE
(
"
MultiSampleQuality = %d
\n
"
,
present_parameters
->
MultiSampleQ
uality
);
TRACE
(
"
SwapEffect = %d
\n
"
,
present_parameters
->
SwapE
ffect
);
TRACE
(
"
hDeviceWindow = %p
\n
"
,
present_parameters
->
hDeviceW
indow
);
TRACE
(
"
Windowed = %s
\n
"
,
present_parameters
->
Windowed
?
"true"
:
"false"
);
TRACE
(
"
EnableAutoDepthStencil = %s
\n
"
,
present_parameters
->
EnableAutoDepthStencil
?
"true"
:
"false"
);
TRACE
(
"
Flags = %08x
\n
"
,
present_parameters
->
F
lags
);
TRACE
(
"
FullScreen_RefreshRateInHz = %d
\n
"
,
present_parameters
->
FullScreen_RefreshRateInHz
);
TRACE
(
"
PresentationInterval = %d
\n
"
,
present_parameters
->
PresentationI
nterval
);
TRACE
(
"
backbuffer_width %u
\n
"
,
swapchain_desc
->
backbuffer_w
idth
);
TRACE
(
"
backbuffer_height %u
\n
"
,
swapchain_desc
->
backbuffer_h
eight
);
TRACE
(
"
backbuffer_format %s
\n
"
,
debug_d3dformat
(
swapchain_desc
->
backbuffer_f
ormat
));
TRACE
(
"
backbuffer_count %u
\n
"
,
swapchain_desc
->
backbuffer_c
ount
);
TRACE
(
"
multisample_type %#x
\n
"
,
swapchain_desc
->
multisample_t
ype
);
TRACE
(
"
multisample_quality %u
\n
"
,
swapchain_desc
->
multisample_q
uality
);
TRACE
(
"
swap_effect %#x
\n
"
,
swapchain_desc
->
swap_e
ffect
);
TRACE
(
"
device_window %p
\n
"
,
swapchain_desc
->
device_w
indow
);
TRACE
(
"
windowed %#x
\n
"
,
swapchain_desc
->
windowed
);
TRACE
(
"
enable_auto_depth_stencil %#x
\n
"
,
swapchain_desc
->
enable_auto_depth_stencil
);
TRACE
(
"
flags %#x
\n
"
,
swapchain_desc
->
f
lags
);
TRACE
(
"
refresh_rate %u
\n
"
,
swapchain_desc
->
refresh_rate
);
TRACE
(
"
swap_interval %u
\n
"
,
swapchain_desc
->
swap_i
nterval
);
/* No special treatment of these parameters. Just store them */
swapchain
->
presentParms
.
SwapEffect
=
present_parameters
->
SwapE
ffect
;
swapchain
->
presentParms
.
Flags
=
present_parameters
->
F
lags
;
swapchain
->
presentParms
.
PresentationInterval
=
present_parameters
->
PresentationI
nterval
;
swapchain
->
presentParms
.
FullScreen_RefreshRateInHz
=
present_parameters
->
FullScreen_RefreshRateInHz
;
swapchain
->
desc
.
swap_effect
=
swapchain_desc
->
swap_e
ffect
;
swapchain
->
desc
.
flags
=
swapchain_desc
->
f
lags
;
swapchain
->
desc
.
swap_interval
=
swapchain_desc
->
swap_i
nterval
;
swapchain
->
desc
.
refresh_rate
=
swapchain_desc
->
refresh_rate
;
/* What to do about these? */
if
(
present_parameters
->
BackBufferC
ount
&&
present_parameters
->
BackBufferCount
!=
swapchain
->
presentParms
.
BackBufferC
ount
)
if
(
swapchain_desc
->
backbuffer_c
ount
&&
swapchain_desc
->
backbuffer_count
!=
swapchain
->
desc
.
backbuffer_c
ount
)
FIXME
(
"Cannot change the back buffer count yet.
\n
"
);
if
(
present_parameters
->
hDeviceW
indow
&&
present_parameters
->
hDeviceWindow
!=
swapchain
->
presentParms
.
hDeviceW
indow
)
if
(
swapchain_desc
->
device_w
indow
&&
swapchain_desc
->
device_window
!=
swapchain
->
desc
.
device_w
indow
)
FIXME
(
"Cannot change the device window yet.
\n
"
);
if
(
present_parameters
->
EnableAutoDepthS
tencil
&&
!
device
->
auto_depth_stencil
)
if
(
swapchain_desc
->
enable_auto_depth_s
tencil
&&
!
device
->
auto_depth_stencil
)
{
HRESULT
hrc
;
TRACE
(
"Creating the depth stencil buffer
\n
"
);
hrc
=
device
->
device_parent
->
ops
->
create_depth_stencil
(
device
->
device_parent
,
present_parameters
->
BackBufferW
idth
,
present_parameters
->
BackBufferH
eight
,
present_parameters
->
AutoDepthStencilF
ormat
,
present_parameters
->
MultiSampleT
ype
,
present_parameters
->
MultiSampleQ
uality
,
swapchain_desc
->
backbuffer_w
idth
,
swapchain_desc
->
backbuffer_h
eight
,
swapchain_desc
->
auto_depth_stencil_f
ormat
,
swapchain_desc
->
multisample_t
ype
,
swapchain_desc
->
multisample_q
uality
,
FALSE
,
&
device
->
auto_depth_stencil
);
if
(
FAILED
(
hrc
))
...
...
@@ -5536,7 +5544,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
/* Reset the depth stencil */
if
(
present_parameters
->
EnableAutoDepthS
tencil
)
if
(
swapchain_desc
->
enable_auto_depth_s
tencil
)
wined3d_device_set_depth_stencil
(
device
,
device
->
auto_depth_stencil
);
else
wined3d_device_set_depth_stencil
(
device
,
NULL
);
...
...
@@ -5545,46 +5553,46 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_stateblock_decref
(
device
->
updateStateBlock
);
wined3d_stateblock_decref
(
device
->
stateBlock
);
if
(
present_parameters
->
W
indowed
)
if
(
swapchain_desc
->
w
indowed
)
{
mode
.
width
=
swapchain
->
orig_width
;
mode
.
height
=
swapchain
->
orig_height
;
mode
.
refresh_rate
=
0
;
mode
.
format_id
=
swapchain
->
presentParms
.
BackBufferF
ormat
;
mode
.
format_id
=
swapchain
->
desc
.
backbuffer_f
ormat
;
}
else
{
mode
.
width
=
present_parameters
->
BackBufferW
idth
;
mode
.
height
=
present_parameters
->
BackBufferH
eight
;
mode
.
refresh_rate
=
present_parameters
->
FullScreen_RefreshRateInHz
;
mode
.
format_id
=
present_parameters
->
BackBufferF
ormat
;
mode
.
width
=
swapchain_desc
->
backbuffer_w
idth
;
mode
.
height
=
swapchain_desc
->
backbuffer_h
eight
;
mode
.
refresh_rate
=
swapchain_desc
->
refresh_rate
;
mode
.
format_id
=
swapchain_desc
->
backbuffer_f
ormat
;
}
/* Should Width == 800 && Height == 0 set 800x600? */
if
(
present_parameters
->
BackBufferWidth
&&
present_parameters
->
BackBufferH
eight
&&
(
present_parameters
->
BackBufferWidth
!=
swapchain
->
presentParms
.
BackBufferW
idth
||
present_parameters
->
BackBufferHeight
!=
swapchain
->
presentParms
.
BackBufferH
eight
))
if
(
swapchain_desc
->
backbuffer_width
&&
swapchain_desc
->
backbuffer_h
eight
&&
(
swapchain_desc
->
backbuffer_width
!=
swapchain
->
desc
.
backbuffer_w
idth
||
swapchain_desc
->
backbuffer_height
!=
swapchain
->
desc
.
backbuffer_h
eight
))
{
if
(
!
present_parameters
->
W
indowed
)
if
(
!
swapchain_desc
->
w
indowed
)
DisplayModeChanged
=
TRUE
;
swapchain
->
presentParms
.
BackBufferWidth
=
present_parameters
->
BackBufferW
idth
;
swapchain
->
presentParms
.
BackBufferHeight
=
present_parameters
->
BackBufferH
eight
;
swapchain
->
desc
.
backbuffer_width
=
swapchain_desc
->
backbuffer_w
idth
;
swapchain
->
desc
.
backbuffer_height
=
swapchain_desc
->
backbuffer_h
eight
;
update_desc
=
TRUE
;
}
if
(
present_parameters
->
BackBufferF
ormat
!=
WINED3DFMT_UNKNOWN
&&
present_parameters
->
BackBufferFormat
!=
swapchain
->
presentParms
.
BackBufferF
ormat
)
if
(
swapchain_desc
->
backbuffer_f
ormat
!=
WINED3DFMT_UNKNOWN
&&
swapchain_desc
->
backbuffer_format
!=
swapchain
->
desc
.
backbuffer_f
ormat
)
{
swapchain
->
presentParms
.
BackBufferFormat
=
present_parameters
->
BackBufferF
ormat
;
swapchain
->
desc
.
backbuffer_format
=
swapchain_desc
->
backbuffer_f
ormat
;
update_desc
=
TRUE
;
}
if
(
present_parameters
->
MultiSampleType
!=
swapchain
->
presentParms
.
MultiSampleT
ype
||
present_parameters
->
MultiSampleQuality
!=
swapchain
->
presentParms
.
MultiSampleQ
uality
)
if
(
swapchain_desc
->
multisample_type
!=
swapchain
->
desc
.
multisample_t
ype
||
swapchain_desc
->
multisample_quality
!=
swapchain
->
desc
.
multisample_q
uality
)
{
swapchain
->
presentParms
.
MultiSampleType
=
present_parameters
->
MultiSampleT
ype
;
swapchain
->
presentParms
.
MultiSampleQuality
=
present_parameters
->
MultiSampleQ
uality
;
swapchain
->
desc
.
multisample_type
=
swapchain_desc
->
multisample_t
ype
;
swapchain
->
desc
.
multisample_quality
=
swapchain_desc
->
multisample_q
uality
;
update_desc
=
TRUE
;
}
...
...
@@ -5592,16 +5600,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
UINT
i
;
hr
=
updateSurfaceDesc
(
swapchain
->
front_buffer
,
&
swapchain
->
presentParms
);
hr
=
updateSurfaceDesc
(
swapchain
->
front_buffer
,
&
swapchain
->
desc
);
if
(
FAILED
(
hr
))
{
wined3d_swapchain_decref
(
swapchain
);
return
hr
;
}
for
(
i
=
0
;
i
<
swapchain
->
presentParms
.
BackBufferC
ount
;
++
i
)
for
(
i
=
0
;
i
<
swapchain
->
desc
.
backbuffer_c
ount
;
++
i
)
{
hr
=
updateSurfaceDesc
(
swapchain
->
back_buffers
[
i
],
&
swapchain
->
presentParms
);
hr
=
updateSurfaceDesc
(
swapchain
->
back_buffers
[
i
],
&
swapchain
->
desc
);
if
(
FAILED
(
hr
))
{
wined3d_swapchain_decref
(
swapchain
);
...
...
@@ -5610,7 +5618,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
if
(
device
->
auto_depth_stencil
)
{
hr
=
updateSurfaceDesc
(
device
->
auto_depth_stencil
,
&
swapchain
->
presentParms
);
hr
=
updateSurfaceDesc
(
device
->
auto_depth_stencil
,
&
swapchain
->
desc
);
if
(
FAILED
(
hr
))
{
wined3d_swapchain_decref
(
swapchain
);
...
...
@@ -5621,18 +5629,18 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
delete_opengl_contexts
(
device
,
swapchain
);
if
(
!
present_parameters
->
Windowed
!=
!
swapchain
->
presentParms
.
W
indowed
if
(
!
swapchain_desc
->
windowed
!=
!
swapchain
->
desc
.
w
indowed
||
DisplayModeChanged
)
{
wined3d_device_set_display_mode
(
device
,
0
,
&
mode
);
if
(
!
present_parameters
->
W
indowed
)
if
(
!
swapchain_desc
->
w
indowed
)
{
if
(
swapchain
->
presentParms
.
W
indowed
)
if
(
swapchain
->
desc
.
w
indowed
)
{
HWND
focus_window
=
device
->
create_parms
.
focus_window
;
if
(
!
focus_window
)
focus_window
=
present_parameters
->
hDeviceW
indow
;
focus_window
=
swapchain_desc
->
device_w
indow
;
if
(
FAILED
(
hr
=
wined3d_device_acquire_focus_window
(
device
,
focus_window
)))
{
ERR
(
"Failed to acquire focus window, hr %#x.
\n
"
,
hr
);
...
...
@@ -5642,26 +5650,27 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
/* switch from windowed to fs */
wined3d_device_setup_fullscreen_window
(
device
,
swapchain
->
device_window
,
present_parameters
->
BackBufferW
idth
,
present_parameters
->
BackBufferH
eight
);
swapchain_desc
->
backbuffer_w
idth
,
swapchain_desc
->
backbuffer_h
eight
);
}
else
{
/* Fullscreen -> fullscreen mode change */
MoveWindow
(
swapchain
->
device_window
,
0
,
0
,
present_parameters
->
BackBufferWidth
,
present_parameters
->
BackBufferHeight
,
swapchain_desc
->
backbuffer_width
,
swapchain_desc
->
backbuffer_height
,
TRUE
);
}
}
else
if
(
!
swapchain
->
presentParms
.
W
indowed
)
else
if
(
!
swapchain
->
desc
.
w
indowed
)
{
/* Fullscreen -> windowed switch */
wined3d_device_restore_fullscreen_window
(
device
,
swapchain
->
device_window
);
wined3d_device_release_focus_window
(
device
);
}
swapchain
->
presentParms
.
Windowed
=
present_parameters
->
W
indowed
;
swapchain
->
desc
.
windowed
=
swapchain_desc
->
w
indowed
;
}
else
if
(
!
present_parameters
->
W
indowed
)
else
if
(
!
swapchain_desc
->
w
indowed
)
{
DWORD
style
=
device
->
style
;
DWORD
exStyle
=
device
->
exStyle
;
...
...
@@ -5672,8 +5681,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
device
->
style
=
0
;
device
->
exStyle
=
0
;
wined3d_device_setup_fullscreen_window
(
device
,
swapchain
->
device_window
,
present_parameters
->
BackBufferW
idth
,
present_parameters
->
BackBufferH
eight
);
swapchain_desc
->
backbuffer_w
idth
,
swapchain_desc
->
backbuffer_h
eight
);
device
->
style
=
style
;
device
->
exStyle
=
exStyle
;
}
...
...
@@ -6008,8 +6017,8 @@ void get_drawable_size_backbuffer(const struct wined3d_context *context, UINT *w
/* The drawable size of a backbuffer / aux buffer offscreen target is the size of the
* current context's drawable, which is the size of the back buffer of the swapchain
* the active context belongs to. */
*
width
=
swapchain
->
presentParms
.
BackBufferW
idth
;
*
height
=
swapchain
->
presentParms
.
BackBufferH
eight
;
*
width
=
swapchain
->
desc
.
backbuffer_w
idth
;
*
height
=
swapchain
->
desc
.
backbuffer_h
eight
;
}
LRESULT
device_process_message
(
struct
wined3d_device
*
device
,
HWND
window
,
BOOL
unicode
,
...
...
dlls/wined3d/stateblock.c
View file @
94c9b0b4
...
...
@@ -1307,8 +1307,8 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
/* Set the default viewport */
state
->
viewport
.
x
=
0
;
state
->
viewport
.
y
=
0
;
state
->
viewport
.
width
=
swapchain
->
presentParms
.
BackBufferW
idth
;
state
->
viewport
.
height
=
swapchain
->
presentParms
.
BackBufferH
eight
;
state
->
viewport
.
width
=
swapchain
->
desc
.
backbuffer_w
idth
;
state
->
viewport
.
height
=
swapchain
->
desc
.
backbuffer_h
eight
;
state
->
viewport
.
min_z
=
0
.
0
f
;
state
->
viewport
.
max_z
=
1
.
0
f
;
...
...
dlls/wined3d/surface.c
View file @
94c9b0b4
...
...
@@ -1694,15 +1694,15 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
&&
dst_surface
==
dst_swapchain
->
front_buffer
&&
src_surface
==
dst_swapchain
->
back_buffers
[
0
])
{
WINED3DSWAPEFFECT
swap_effect
=
dst_swapchain
->
presentParms
.
SwapE
ffect
;
WINED3DSWAPEFFECT
swap_effect
=
dst_swapchain
->
desc
.
swap_e
ffect
;
TRACE
(
"Using present for backbuffer -> frontbuffer blit.
\n
"
);
/* Set the swap effect to COPY, we don't want the backbuffer
* to become undefined. */
dst_swapchain
->
presentParms
.
SwapE
ffect
=
WINED3DSWAPEFFECT_COPY
;
dst_swapchain
->
desc
.
swap_e
ffect
=
WINED3DSWAPEFFECT_COPY
;
wined3d_swapchain_present
(
dst_swapchain
,
NULL
,
NULL
,
dst_swapchain
->
win_handle
,
NULL
,
0
);
dst_swapchain
->
presentParms
.
SwapE
ffect
=
swap_effect
;
dst_swapchain
->
desc
.
swap_e
ffect
=
swap_effect
;
return
WINED3D_OK
;
}
...
...
@@ -5639,8 +5639,8 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
* buffer, so the onscreen depth/stencil buffer is potentially smaller
* than the offscreen surface. Don't overwrite the offscreen surface
* with undefined data. */
w
=
min
(
w
,
context
->
swapchain
->
presentParms
.
BackBufferW
idth
);
h
=
min
(
h
,
context
->
swapchain
->
presentParms
.
BackBufferH
eight
);
w
=
min
(
w
,
context
->
swapchain
->
desc
.
backbuffer_w
idth
);
h
=
min
(
h
,
context
->
swapchain
->
desc
.
backbuffer_h
eight
);
TRACE
(
"Copying onscreen depth buffer to depth texture.
\n
"
);
...
...
dlls/wined3d/swapchain.c
View file @
94c9b0b4
...
...
@@ -48,7 +48,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
if
(
swapchain
->
back_buffers
)
{
i
=
swapchain
->
presentParms
.
BackBufferC
ount
;
i
=
swapchain
->
desc
.
backbuffer_c
ount
;
while
(
i
--
)
{
...
...
@@ -72,7 +72,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
* desktop resolution. In case of d3d7 this will be a NOP because ddraw
* sets the resolution before starting up Direct3D, thus orig_width and
* orig_height will be equal to the modes in the presentation params. */
if
(
!
swapchain
->
presentParms
.
Windowed
&&
swapchain
->
presentParms
.
AutoRestoreDisplayM
ode
)
if
(
!
swapchain
->
desc
.
windowed
&&
swapchain
->
desc
.
auto_restore_display_m
ode
)
{
mode
.
width
=
swapchain
->
orig_width
;
mode
.
height
=
swapchain
->
orig_height
;
...
...
@@ -163,7 +163,7 @@ HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapc
SetRect
(
&
src_rect
,
0
,
0
,
src_surface
->
resource
.
width
,
src_surface
->
resource
.
height
);
dst_rect
=
src_rect
;
if
(
swapchain
->
presentParms
.
W
indowed
)
if
(
swapchain
->
desc
.
w
indowed
)
{
MapWindowPoints
(
swapchain
->
win_handle
,
NULL
,
(
POINT
*
)
&
dst_rect
,
2
);
FIXME
(
"Using destination rect %s in windowed mode, this is likely wrong.
\n
"
,
...
...
@@ -184,7 +184,7 @@ HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *
* NULL). We need this because this function is called from
* stateblock_init_default_state() to get the default scissorrect
* dimensions. */
if
(
!
swapchain
->
back_buffers
||
back_buffer_idx
>=
swapchain
->
presentParms
.
BackBufferC
ount
)
if
(
!
swapchain
->
back_buffers
||
back_buffer_idx
>=
swapchain
->
desc
.
backbuffer_c
ount
)
{
WARN
(
"Invalid back buffer index.
\n
"
);
/* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it
...
...
@@ -243,12 +243,12 @@ struct wined3d_device * CDECL wined3d_swapchain_get_device(const struct wined3d_
return
swapchain
->
device
;
}
HRESULT
CDECL
wined3d_swapchain_get_
present_parameters
(
const
struct
wined3d_swapchain
*
swapchain
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
)
HRESULT
CDECL
wined3d_swapchain_get_
desc
(
const
struct
wined3d_swapchain
*
swapchain
,
struct
wined3d_swapchain_desc
*
desc
)
{
TRACE
(
"swapchain %p,
present_parameters %p.
\n
"
,
swapchain
,
present_parameters
);
TRACE
(
"swapchain %p,
desc %p.
\n
"
,
swapchain
,
desc
);
*
present_parameters
=
swapchain
->
presentParms
;
*
desc
=
swapchain
->
desc
;
return
WINED3D_OK
;
}
...
...
@@ -475,7 +475,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
/* DDBLT_KEYSRC will cause BltOverride to enable the alpha test with GL_NOTEQUAL, 0.0,
* which is exactly what we want :-)
*/
if
(
swapchain
->
presentParms
.
W
indowed
)
if
(
swapchain
->
desc
.
w
indowed
)
MapWindowPoints
(
NULL
,
swapchain
->
win_handle
,
(
LPPOINT
)
&
destRect
,
2
);
wined3d_surface_blt
(
swapchain
->
back_buffers
[
0
],
&
destRect
,
&
cursor
,
NULL
,
WINEDDBLT_KEYSRC
,
NULL
,
WINED3DTEXF_POINT
);
...
...
@@ -499,8 +499,8 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
{
src_rect
=
*
src_rect_in
;
if
(
!
render_to_fbo
&&
(
src_rect
.
left
||
src_rect
.
top
||
src_rect
.
right
!=
swapchain
->
presentParms
.
BackBufferW
idth
||
src_rect
.
bottom
!=
swapchain
->
presentParms
.
BackBufferH
eight
))
||
src_rect
.
right
!=
swapchain
->
desc
.
backbuffer_w
idth
||
src_rect
.
bottom
!=
swapchain
->
desc
.
backbuffer_h
eight
))
{
render_to_fbo
=
TRUE
;
}
...
...
@@ -509,8 +509,8 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
{
src_rect
.
left
=
0
;
src_rect
.
top
=
0
;
src_rect
.
right
=
swapchain
->
presentParms
.
BackBufferW
idth
;
src_rect
.
bottom
=
swapchain
->
presentParms
.
BackBufferH
eight
;
src_rect
.
right
=
swapchain
->
desc
.
backbuffer_w
idth
;
src_rect
.
bottom
=
swapchain
->
desc
.
backbuffer_h
eight
;
}
if
(
dst_rect_in
)
...
...
@@ -519,11 +519,9 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
GetClientRect
(
swapchain
->
win_handle
,
&
dst_rect
);
if
(
!
render_to_fbo
&&
(
dst_rect
.
left
||
dst_rect
.
top
||
dst_rect
.
right
!=
swapchain
->
presentParms
.
BackBufferWidth
||
dst_rect
.
bottom
!=
swapchain
->
presentParms
.
BackBufferHeight
))
{
||
dst_rect
.
right
!=
swapchain
->
desc
.
backbuffer_width
||
dst_rect
.
bottom
!=
swapchain
->
desc
.
backbuffer_height
))
render_to_fbo
=
TRUE
;
}
/* Rendering to a window of different size, presenting partial rectangles,
* or rendering to a different window needs help from FBO_blit or a textured
...
...
@@ -548,7 +546,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
*
* The DISCARD swap effect is ok as well since any backbuffer content is allowed after
* the swap. */
if
(
swapchain
->
presentParms
.
SwapE
ffect
==
WINED3DSWAPEFFECT_FLIP
)
if
(
swapchain
->
desc
.
swap_e
ffect
==
WINED3DSWAPEFFECT_FLIP
)
FIXME
(
"Render-to-fbo with WINED3DSWAPEFFECT_FLIP
\n
"
);
swapchain_blit
(
swapchain
,
context
,
&
src_rect
,
&
dst_rect
);
...
...
@@ -590,7 +588,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
* bug shows up much more than it does on Windows, and the players see single pixels
* with wrong colors.
* (The Max Payne bug has been confirmed on Windows with the debug runtime) */
if
(
FALSE
&&
swapchain
->
presentParms
.
SwapE
ffect
==
WINED3DSWAPEFFECT_DISCARD
)
if
(
FALSE
&&
swapchain
->
desc
.
swap_e
ffect
==
WINED3DSWAPEFFECT_DISCARD
)
{
static
const
struct
wined3d_color
cyan
=
{
0
.
0
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
};
...
...
@@ -634,13 +632,13 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
* If the swapeffect is COPY, the content remains the same. If it is FLIP however,
* the texture / sysmem copy needs to be reloaded from the drawable
*/
if
(
swapchain
->
presentParms
.
SwapE
ffect
==
WINED3DSWAPEFFECT_FLIP
)
if
(
swapchain
->
desc
.
swap_e
ffect
==
WINED3DSWAPEFFECT_FLIP
)
surface_modify_location
(
swapchain
->
back_buffers
[
0
],
swapchain
->
back_buffers
[
0
]
->
draw_binding
,
TRUE
);
}
if
(
fb
->
depth_stencil
)
{
if
(
swapchain
->
presentParms
.
F
lags
&
WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
if
(
swapchain
->
desc
.
f
lags
&
WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
||
fb
->
depth_stencil
->
flags
&
SFLAG_DISCARD
)
{
surface_modify_ds_location
(
fb
->
depth_stencil
,
SFLAG_DS_DISCARDED
,
...
...
@@ -691,7 +689,7 @@ void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *r
/* Front buffer coordinates are screen coordinates. Map them to the
* destination window if not fullscreened. */
if
(
swapchain
->
presentParms
.
W
indowed
)
if
(
swapchain
->
desc
.
w
indowed
)
ClientToScreen
(
window
,
&
offset
);
TRACE
(
"offset %s.
\n
"
,
wine_dbgstr_point
(
&
offset
));
...
...
@@ -792,7 +790,7 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
if
(
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
)
return
;
if
(
!
swapchain
->
presentParms
.
BackBufferC
ount
)
if
(
!
swapchain
->
desc
.
backbuffer_c
ount
)
{
TRACE
(
"Single buffered rendering.
\n
"
);
swapchain
->
render_to_fbo
=
FALSE
;
...
...
@@ -802,16 +800,16 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
GetClientRect
(
swapchain
->
win_handle
,
&
client_rect
);
TRACE
(
"Backbuffer %ux%u, window %ux%u.
\n
"
,
swapchain
->
presentParms
.
BackBufferW
idth
,
swapchain
->
presentParms
.
BackBufferH
eight
,
swapchain
->
desc
.
backbuffer_w
idth
,
swapchain
->
desc
.
backbuffer_h
eight
,
client_rect
.
right
,
client_rect
.
bottom
);
TRACE
(
"Multisample type %#x, quality %#x.
\n
"
,
swapchain
->
presentParms
.
MultiSampleT
ype
,
swapchain
->
presentParms
.
MultiSampleQ
uality
);
swapchain
->
desc
.
multisample_t
ype
,
swapchain
->
desc
.
multisample_q
uality
);
if
(
!
wined3d_settings
.
always_offscreen
&&
!
swapchain
->
presentParms
.
MultiSampleT
ype
&&
swapchain
->
presentParms
.
BackBufferW
idth
==
client_rect
.
right
&&
swapchain
->
presentParms
.
BackBufferH
eight
==
client_rect
.
bottom
)
if
(
!
wined3d_settings
.
always_offscreen
&&
!
swapchain
->
desc
.
multisample_t
ype
&&
swapchain
->
desc
.
backbuffer_w
idth
==
client_rect
.
right
&&
swapchain
->
desc
.
backbuffer_h
eight
==
client_rect
.
bottom
)
{
TRACE
(
"Backbuffer dimensions match window dimensions, rendering onscreen.
\n
"
);
swapchain
->
render_to_fbo
=
FALSE
;
...
...
@@ -824,7 +822,7 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
/* Do not call while under the GL lock. */
static
HRESULT
swapchain_init
(
struct
wined3d_swapchain
*
swapchain
,
WINED3DSURFTYPE
surface_type
,
struct
wined3d_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
struct
wined3d_device
*
device
,
struct
wined3d_swapchain_desc
*
desc
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
const
struct
wined3d_adapter
*
adapter
=
device
->
adapter
;
...
...
@@ -836,14 +834,14 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
HRESULT
hr
;
UINT
i
;
if
(
present_parameters
->
BackBufferC
ount
>
WINED3DPRESENT_BACK_BUFFER_MAX
)
if
(
desc
->
backbuffer_c
ount
>
WINED3DPRESENT_BACK_BUFFER_MAX
)
{
FIXME
(
"The application requested %u back buffers, this is not supported.
\n
"
,
present_parameters
->
BackBufferC
ount
);
desc
->
backbuffer_c
ount
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
present_parameters
->
BackBufferC
ount
>
1
)
if
(
desc
->
backbuffer_c
ount
>
1
)
{
FIXME
(
"The application requested more than one back buffer, this is not properly supported.
\n
"
"Please configure the application to use double buffering (1 back buffer) if possible.
\n
"
);
...
...
@@ -864,7 +862,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
return
WINED3DERR_INVALIDCALL
;
}
window
=
present_parameters
->
hDeviceWindow
?
present_parameters
->
hDeviceW
indow
:
device
->
create_parms
.
focus_window
;
window
=
desc
->
device_window
?
desc
->
device_w
indow
:
device
->
create_parms
.
focus_window
;
swapchain
->
device
=
device
;
swapchain
->
parent
=
parent
;
...
...
@@ -880,37 +878,37 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
format
=
wined3d_get_format
(
&
adapter
->
gl_info
,
mode
.
format_id
);
GetClientRect
(
window
,
&
client_rect
);
if
(
present_parameters
->
W
indowed
&&
(
!
present_parameters
->
BackBufferWidth
||
!
present_parameters
->
BackBufferH
eight
||
present_parameters
->
BackBufferF
ormat
==
WINED3DFMT_UNKNOWN
))
if
(
desc
->
w
indowed
&&
(
!
desc
->
backbuffer_width
||
!
desc
->
backbuffer_h
eight
||
desc
->
backbuffer_f
ormat
==
WINED3DFMT_UNKNOWN
))
{
if
(
!
present_parameters
->
BackBufferW
idth
)
if
(
!
desc
->
backbuffer_w
idth
)
{
present_parameters
->
BackBufferW
idth
=
client_rect
.
right
;
TRACE
(
"Updating width to %u.
\n
"
,
present_parameters
->
BackBufferW
idth
);
desc
->
backbuffer_w
idth
=
client_rect
.
right
;
TRACE
(
"Updating width to %u.
\n
"
,
desc
->
backbuffer_w
idth
);
}
if
(
!
present_parameters
->
BackBufferH
eight
)
if
(
!
desc
->
backbuffer_h
eight
)
{
present_parameters
->
BackBufferH
eight
=
client_rect
.
bottom
;
TRACE
(
"Updating height to %u.
\n
"
,
present_parameters
->
BackBufferH
eight
);
desc
->
backbuffer_h
eight
=
client_rect
.
bottom
;
TRACE
(
"Updating height to %u.
\n
"
,
desc
->
backbuffer_h
eight
);
}
if
(
present_parameters
->
BackBufferF
ormat
==
WINED3DFMT_UNKNOWN
)
if
(
desc
->
backbuffer_f
ormat
==
WINED3DFMT_UNKNOWN
)
{
present_parameters
->
BackBufferF
ormat
=
swapchain
->
orig_fmt
;
desc
->
backbuffer_f
ormat
=
swapchain
->
orig_fmt
;
TRACE
(
"Updating format to %s.
\n
"
,
debug_d3dformat
(
swapchain
->
orig_fmt
));
}
}
swapchain
->
presentParms
=
*
present_parameters
;
swapchain
->
desc
=
*
desc
;
swapchain_update_render_to_fbo
(
swapchain
);
TRACE
(
"Creating front buffer.
\n
"
);
hr
=
device
->
device_parent
->
ops
->
create_rendertarget
(
device
->
device_parent
,
parent
,
swapchain
->
presentParms
.
BackBufferWidth
,
swapchain
->
presentParms
.
BackBufferH
eight
,
swapchain
->
presentParms
.
BackBufferFormat
,
swapchain
->
presentParms
.
MultiSampleT
ype
,
swapchain
->
presentParms
.
MultiSampleQ
uality
,
TRUE
/* Lockable */
,
swapchain
->
desc
.
backbuffer_width
,
swapchain
->
desc
.
backbuffer_h
eight
,
swapchain
->
desc
.
backbuffer_format
,
swapchain
->
desc
.
multisample_t
ype
,
swapchain
->
desc
.
multisample_q
uality
,
TRUE
/* Lockable */
,
&
swapchain
->
front_buffer
);
if
(
FAILED
(
hr
))
{
...
...
@@ -928,15 +926,15 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
* so we should really check to see if there is a fullscreen swapchain
* already. Does a single head count as full screen? */
if
(
!
present_parameters
->
W
indowed
)
if
(
!
desc
->
w
indowed
)
{
struct
wined3d_display_mode
mode
;
/* Change the display settings */
mode
.
width
=
present_parameters
->
BackBufferW
idth
;
mode
.
height
=
present_parameters
->
BackBufferH
eight
;
mode
.
format_id
=
present_parameters
->
BackBufferF
ormat
;
mode
.
refresh_rate
=
present_parameters
->
FullScreen_RefreshRateInHz
;
mode
.
width
=
desc
->
backbuffer_w
idth
;
mode
.
height
=
desc
->
backbuffer_h
eight
;
mode
.
format_id
=
desc
->
backbuffer_f
ormat
;
mode
.
refresh_rate
=
desc
->
refresh_rate
;
hr
=
wined3d_device_set_display_mode
(
device
,
0
,
&
mode
);
if
(
FAILED
(
hr
))
...
...
@@ -997,18 +995,18 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
}
if
(
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
&&
(
!
present_parameters
->
EnableAutoDepthS
tencil
||
swapchain
->
presentParms
.
AutoDepthStencilF
ormat
!=
swapchain
->
ds_format
->
id
))
&&
(
!
desc
->
enable_auto_depth_s
tencil
||
swapchain
->
desc
.
auto_depth_stencil_f
ormat
!=
swapchain
->
ds_format
->
id
))
{
FIXME
(
"Add OpenGL context recreation support to context_validate_onscreen_formats
\n
"
);
}
context_release
(
swapchain
->
context
[
0
]);
}
if
(
swapchain
->
presentParms
.
BackBufferC
ount
>
0
)
if
(
swapchain
->
desc
.
backbuffer_c
ount
>
0
)
{
swapchain
->
back_buffers
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
swapchain
->
back_buffers
)
*
swapchain
->
presentParms
.
BackBufferC
ount
);
sizeof
(
*
swapchain
->
back_buffers
)
*
swapchain
->
desc
.
backbuffer_c
ount
);
if
(
!
swapchain
->
back_buffers
)
{
ERR
(
"Failed to allocate backbuffer array memory.
\n
"
);
...
...
@@ -1016,13 +1014,13 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
goto
err
;
}
for
(
i
=
0
;
i
<
swapchain
->
presentParms
.
BackBufferC
ount
;
++
i
)
for
(
i
=
0
;
i
<
swapchain
->
desc
.
backbuffer_c
ount
;
++
i
)
{
TRACE
(
"Creating back buffer %u.
\n
"
,
i
);
hr
=
device
->
device_parent
->
ops
->
create_rendertarget
(
device
->
device_parent
,
parent
,
swapchain
->
presentParms
.
BackBufferWidth
,
swapchain
->
presentParms
.
BackBufferH
eight
,
swapchain
->
presentParms
.
BackBufferFormat
,
swapchain
->
presentParms
.
MultiSampleT
ype
,
swapchain
->
presentParms
.
MultiSampleQ
uality
,
TRUE
/* Lockable */
,
swapchain
->
desc
.
backbuffer_width
,
swapchain
->
desc
.
backbuffer_h
eight
,
swapchain
->
desc
.
backbuffer_format
,
swapchain
->
desc
.
multisample_t
ype
,
swapchain
->
desc
.
multisample_q
uality
,
TRUE
/* Lockable */
,
&
swapchain
->
back_buffers
[
i
]);
if
(
FAILED
(
hr
))
{
...
...
@@ -1035,15 +1033,15 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
}
/* Swapchains share the depth/stencil buffer, so only create a single depthstencil surface. */
if
(
present_parameters
->
EnableAutoDepthS
tencil
&&
surface_type
==
SURFACE_OPENGL
)
if
(
desc
->
enable_auto_depth_s
tencil
&&
surface_type
==
SURFACE_OPENGL
)
{
TRACE
(
"Creating depth/stencil buffer.
\n
"
);
if
(
!
device
->
auto_depth_stencil
)
{
hr
=
device
->
device_parent
->
ops
->
create_depth_stencil
(
device
->
device_parent
,
swapchain
->
presentParms
.
BackBufferWidth
,
swapchain
->
presentParms
.
BackBufferH
eight
,
swapchain
->
presentParms
.
AutoDepthStencilFormat
,
swapchain
->
presentParms
.
MultiSampleT
ype
,
swapchain
->
presentParms
.
MultiSampleQ
uality
,
FALSE
/* FIXME: Discard */
,
swapchain
->
desc
.
backbuffer_width
,
swapchain
->
desc
.
backbuffer_h
eight
,
swapchain
->
desc
.
auto_depth_stencil_format
,
swapchain
->
desc
.
multisample_t
ype
,
swapchain
->
desc
.
multisample_q
uality
,
FALSE
/* FIXME: Discard */
,
&
device
->
auto_depth_stencil
);
if
(
FAILED
(
hr
))
{
...
...
@@ -1078,7 +1076,7 @@ err:
if
(
swapchain
->
back_buffers
)
{
for
(
i
=
0
;
i
<
swapchain
->
presentParms
.
BackBufferC
ount
;
++
i
)
for
(
i
=
0
;
i
<
swapchain
->
desc
.
backbuffer_c
ount
;
++
i
)
{
if
(
swapchain
->
back_buffers
[
i
])
{
...
...
@@ -1111,15 +1109,15 @@ err:
/* Do not call while under the GL lock. */
HRESULT
CDECL
wined3d_swapchain_create
(
struct
wined3d_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
WINED3DSURFTYPE
surface_type
,
struct
wined3d_swapchain_desc
*
desc
,
WINED3DSURFTYPE
surface_type
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_swapchain
**
swapchain
)
{
struct
wined3d_swapchain
*
object
;
HRESULT
hr
;
TRACE
(
"device %p,
present_parameters
%p, swapchain %p, parent %p, surface_type %#x.
\n
"
,
device
,
present_parameters
,
swapchain
,
parent
,
surface_type
);
TRACE
(
"device %p,
desc
%p, swapchain %p, parent %p, surface_type %#x.
\n
"
,
device
,
desc
,
swapchain
,
parent
,
surface_type
);
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
...
...
@@ -1128,7 +1126,7 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
return
E_OUTOFMEMORY
;
}
hr
=
swapchain_init
(
object
,
surface_type
,
device
,
present_parameters
,
parent
,
parent_ops
);
hr
=
swapchain_init
(
object
,
surface_type
,
device
,
desc
,
parent
,
parent_ops
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize swapchain, hr %#x.
\n
"
,
hr
);
...
...
@@ -1238,7 +1236,7 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain)
surface_update_draw_binding
(
swapchain
->
front_buffer
);
for
(
i
=
0
;
i
<
swapchain
->
presentParms
.
BackBufferC
ount
;
++
i
)
for
(
i
=
0
;
i
<
swapchain
->
desc
.
backbuffer_c
ount
;
++
i
)
{
surface_update_draw_binding
(
swapchain
->
back_buffers
[
i
]);
}
...
...
dlls/wined3d/wined3d.spec
View file @
94c9b0b4
...
...
@@ -239,7 +239,7 @@
@ cdecl wined3d_swapchain_get_front_buffer_data(ptr ptr)
@ cdecl wined3d_swapchain_get_gamma_ramp(ptr ptr)
@ cdecl wined3d_swapchain_get_parent(ptr)
@ cdecl wined3d_swapchain_get_
present_parameters
(ptr ptr)
@ cdecl wined3d_swapchain_get_
desc
(ptr ptr)
@ cdecl wined3d_swapchain_get_raster_status(ptr ptr)
@ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr ptr long)
...
...
dlls/wined3d/wined3d_private.h
View file @
94c9b0b4
...
...
@@ -2442,7 +2442,7 @@ struct wined3d_swapchain
struct
wined3d_surface
**
back_buffers
;
struct
wined3d_surface
*
front_buffer
;
WINED3DPRESENT_PARAMETERS
presentParms
;
struct
wined3d_swapchain_desc
desc
;
DWORD
orig_width
,
orig_height
;
enum
wined3d_format_id
orig_fmt
;
struct
wined3d_gamma_ramp
orig_gamma
;
...
...
include/wine/wined3d.h
View file @
94c9b0b4
...
...
@@ -1638,24 +1638,24 @@ struct wined3d_adapter_identifier
SIZE_T
video_memory
;
};
typedef
struct
_WINED3DPRESENT_PARAMETERS
{
UINT
BackBufferW
idth
;
UINT
BackBufferH
eight
;
enum
wined3d_format_id
BackBufferF
ormat
;
UINT
BackBufferC
ount
;
WINED3DMULTISAMPLE_TYPE
MultiSampleT
ype
;
DWORD
MultiSampleQ
uality
;
WINED3DSWAPEFFECT
SwapE
ffect
;
HWND
hDeviceW
indow
;
BOOL
W
indowed
;
BOOL
EnableAutoDepthS
tencil
;
enum
wined3d_format_id
AutoDepthStencilF
ormat
;
DWORD
F
lags
;
UINT
FullScreen_RefreshRateInHz
;
UINT
PresentationI
nterval
;
BOOL
AutoRestoreDisplayM
ode
;
}
WINED3DPRESENT_PARAMETERS
;
struct
wined3d_swapchain_desc
{
UINT
backbuffer_w
idth
;
UINT
backbuffer_h
eight
;
enum
wined3d_format_id
backbuffer_f
ormat
;
UINT
backbuffer_c
ount
;
WINED3DMULTISAMPLE_TYPE
multisample_t
ype
;
DWORD
multisample_q
uality
;
WINED3DSWAPEFFECT
swap_e
ffect
;
HWND
device_w
indow
;
BOOL
w
indowed
;
BOOL
enable_auto_depth_s
tencil
;
enum
wined3d_format_id
auto_depth_stencil_f
ormat
;
DWORD
f
lags
;
UINT
refresh_rate
;
UINT
swap_i
nterval
;
BOOL
auto_restore_display_m
ode
;
};
struct
wined3d_resource_desc
{
...
...
@@ -2041,7 +2041,7 @@ struct wined3d_device_parent_ops
UINT
width
,
UINT
height
,
UINT
depth
,
enum
wined3d_format_id
format_id
,
WINED3DPOOL
pool
,
DWORD
usage
,
struct
wined3d_volume
**
volume
);
HRESULT
(
__cdecl
*
create_swapchain
)(
struct
wined3d_device_parent
*
device_parent
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
struct
wined3d_swapchain
**
swapchain
);
struct
wined3d_swapchain_desc
*
desc
,
struct
wined3d_swapchain
**
swapchain
);
};
typedef
HRESULT
(
CDECL
*
wined3d_device_reset_cb
)(
struct
wined3d_resource
*
resource
);
...
...
@@ -2213,8 +2213,8 @@ HRESULT __cdecl wined3d_device_get_vs_consts_i(const struct wined3d_device *devi
UINT
start_register
,
int
*
constants
,
UINT
vector4i_count
);
HRESULT
__cdecl
wined3d_device_get_wined3d
(
const
struct
wined3d_device
*
device
,
struct
wined3d
**
wined3d
);
ULONG
__cdecl
wined3d_device_incref
(
struct
wined3d_device
*
device
);
HRESULT
__cdecl
wined3d_device_init_3d
(
struct
wined3d_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
);
HRESULT
__cdecl
wined3d_device_init_gdi
(
struct
wined3d_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
);
HRESULT
__cdecl
wined3d_device_init_3d
(
struct
wined3d_device
*
device
,
struct
wined3d_swapchain_desc
*
swapchain_desc
);
HRESULT
__cdecl
wined3d_device_init_gdi
(
struct
wined3d_device
*
device
,
struct
wined3d_swapchain_desc
*
swapchain_desc
);
HRESULT
__cdecl
wined3d_device_multiply_transform
(
struct
wined3d_device
*
device
,
WINED3DTRANSFORMSTATETYPE
state
,
const
struct
wined3d_matrix
*
matrix
);
HRESULT
__cdecl
wined3d_device_present
(
const
struct
wined3d_device
*
device
,
const
RECT
*
src_rect
,
...
...
@@ -2224,7 +2224,7 @@ HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device,
const
struct
wined3d_vertex_declaration
*
declaration
,
DWORD
flags
,
DWORD
dst_fvf
);
void
__cdecl
wined3d_device_release_focus_window
(
struct
wined3d_device
*
device
);
HRESULT
__cdecl
wined3d_device_reset
(
struct
wined3d_device
*
device
,
const
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
wined3d_device_reset_cb
callback
);
const
struct
wined3d_swapchain_desc
*
swapchain_desc
,
wined3d_device_reset_cb
callback
);
void
__cdecl
wined3d_device_restore_fullscreen_window
(
struct
wined3d_device
*
device
,
HWND
window
);
HRESULT
__cdecl
wined3d_device_set_base_vertex_index
(
struct
wined3d_device
*
device
,
INT
base_index
);
HRESULT
__cdecl
wined3d_device_set_clip_plane
(
struct
wined3d_device
*
device
,
UINT
plane_idx
,
const
float
*
plane
);
...
...
@@ -2395,7 +2395,7 @@ HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *s
DWORD
flags
,
struct
wined3d_surface
*
ref
);
HRESULT
__cdecl
wined3d_swapchain_create
(
struct
wined3d_device
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
WINED3DSURFTYPE
surface_type
,
void
*
parent
,
struct
wined3d_swapchain_desc
*
desc
,
WINED3DSURFTYPE
surface_type
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_swapchain
**
swapchain
);
ULONG
__cdecl
wined3d_swapchain_decref
(
struct
wined3d_swapchain
*
swapchain
);
HRESULT
__cdecl
wined3d_swapchain_get_back_buffer
(
const
struct
wined3d_swapchain
*
swapchain
,
...
...
@@ -2408,8 +2408,8 @@ HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swa
HRESULT
__cdecl
wined3d_swapchain_get_gamma_ramp
(
const
struct
wined3d_swapchain
*
swapchain
,
struct
wined3d_gamma_ramp
*
ramp
);
void
*
__cdecl
wined3d_swapchain_get_parent
(
const
struct
wined3d_swapchain
*
swapchain
);
HRESULT
__cdecl
wined3d_swapchain_get_
present_parameters
(
const
struct
wined3d_swapchain
*
swapchain
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
);
HRESULT
__cdecl
wined3d_swapchain_get_
desc
(
const
struct
wined3d_swapchain
*
swapchain
,
struct
wined3d_swapchain_desc
*
desc
);
HRESULT
__cdecl
wined3d_swapchain_get_raster_status
(
const
struct
wined3d_swapchain
*
swapchain
,
WINED3DRASTER_STATUS
*
raster_status
);
ULONG
__cdecl
wined3d_swapchain_incref
(
struct
wined3d_swapchain
*
swapchain
);
...
...
include/wine/winedxgi.idl
View file @
94c9b0b4
...
...
@@ -54,7 +54,7 @@ interface IWineDXGIDevice : IDXGIDevice
[
out
]
void
**
surface
)
;
HRESULT
create_swapchain
(
[
in
]
struct
_WINED3DPRESENT_PARAMETERS
*
present_parameters
,
[
in
]
struct
wined3d_swapchain_desc
*
desc
,
[
out
]
struct
wined3d_swapchain
**
wined3d_swapchain
)
;
}
...
...
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