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
79dc3461
Commit
79dc3461
authored
Jul 02, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Jul 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Introduce a separate function for swapchain creation.
parent
9e0d03e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
60 deletions
+36
-60
d3d8_private.h
dlls/d3d8/d3d8_private.h
+2
-2
device.c
dlls/d3d8/device.c
+8
-57
swapchain.c
dlls/d3d8/swapchain.c
+26
-1
No files found.
dlls/d3d8/d3d8_private.h
View file @
79dc3461
...
...
@@ -186,8 +186,8 @@ struct d3d8_swapchain
IDirect3DDevice8
*
parent_device
;
};
HRESULT
swapchain_init
(
struct
d3d8_swapchain
*
swapchain
,
struct
d3d8_device
*
device
,
struct
wined3d_swapchain_desc
*
desc
)
DECLSPEC_HIDDEN
;
HRESULT
d3d8_swapchain_create
(
struct
d3d8_device
*
device
,
struct
wined3d_swapchain_desc
*
desc
,
struct
d3d8_swapchain
**
swapchain
)
DECLSPEC_HIDDEN
;
struct
d3d8_surface
{
...
...
dlls/d3d8/device.c
View file @
79dc3461
...
...
@@ -511,13 +511,6 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
TRACE
(
"iface %p, present_parameters %p, swapchain %p.
\n
"
,
iface
,
present_parameters
,
swapchain
);
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate swapchain memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
desc
.
backbuffer_width
=
present_parameters
->
BackBufferWidth
;
desc
.
backbuffer_height
=
present_parameters
->
BackBufferHeight
;
desc
.
backbuffer_format
=
wined3dformat_from_d3dformat
(
present_parameters
->
BackBufferFormat
);
...
...
@@ -534,7 +527,8 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
desc
.
swap_interval
=
present_parameters
->
FullScreen_PresentationInterval
;
desc
.
auto_restore_display_mode
=
TRUE
;
hr
=
swapchain_init
(
object
,
device
,
&
desc
);
if
(
SUCCEEDED
(
hr
=
d3d8_swapchain_create
(
device
,
&
desc
,
&
object
)))
*
swapchain
=
&
object
->
IDirect3DSwapChain8_iface
;
present_parameters
->
BackBufferWidth
=
desc
.
backbuffer_width
;
present_parameters
->
BackBufferHeight
=
desc
.
backbuffer_height
;
...
...
@@ -550,16 +544,6 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
present_parameters
->
FullScreen_RefreshRateInHz
=
desc
.
refresh_rate
;
present_parameters
->
FullScreen_PresentationInterval
=
desc
.
swap_interval
;
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize swapchain, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
TRACE
(
"Created swapchain %p.
\n
"
,
object
);
*
swapchain
=
&
object
->
IDirect3DSwapChain8_iface
;
return
D3D_OK
;
}
...
...
@@ -605,7 +589,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
swapchain_desc
.
backbuffer_width
=
present_parameters
->
BackBufferWidth
;
swapchain_desc
.
backbuffer_height
=
present_parameters
->
BackBufferHeight
;
swapchain_desc
.
backbuffer_format
=
wined3dformat_from_d3dformat
(
present_parameters
->
BackBufferFormat
);
swapchain_desc
.
backbuffer_count
=
present_parameters
->
BackBufferCount
;
swapchain_desc
.
backbuffer_count
=
max
(
1
,
present_parameters
->
BackBufferCount
)
;
swapchain_desc
.
multisample_type
=
present_parameters
->
MultiSampleType
;
swapchain_desc
.
multisample_quality
=
0
;
/* d3d9 only */
swapchain_desc
.
swap_effect
=
present_parameters
->
SwapEffect
;
...
...
@@ -2982,54 +2966,21 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
struct
wined3d_swapchain_desc
*
desc
,
struct
wined3d_swapchain
**
swapchain
)
{
struct
d3d8_device
*
device
=
device_from_device_parent
(
device_parent
);
D3DPRESENT_PARAMETERS
local_parameters
;
IDirect3DSwapChain8
*
d3d_swapchain
;
struct
d3d8_swapchain
*
d3d_swapchain
;
HRESULT
hr
;
TRACE
(
"device_parent %p, desc %p, swapchain %p.
\n
"
,
device_parent
,
desc
,
swapchain
);
/* Copy the presentation parameters */
local_parameters
.
BackBufferWidth
=
desc
->
backbuffer_width
;
local_parameters
.
BackBufferHeight
=
desc
->
backbuffer_height
;
local_parameters
.
BackBufferFormat
=
d3dformat_from_wined3dformat
(
desc
->
backbuffer_format
);
local_parameters
.
BackBufferCount
=
desc
->
backbuffer_count
;
local_parameters
.
MultiSampleType
=
desc
->
multisample_type
;
local_parameters
.
SwapEffect
=
desc
->
swap_effect
;
local_parameters
.
hDeviceWindow
=
desc
->
device_window
;
local_parameters
.
Windowed
=
desc
->
windowed
;
local_parameters
.
EnableAutoDepthStencil
=
desc
->
enable_auto_depth_stencil
;
local_parameters
.
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
desc
->
auto_depth_stencil_format
);
local_parameters
.
Flags
=
desc
->
flags
;
local_parameters
.
FullScreen_RefreshRateInHz
=
desc
->
refresh_rate
;
local_parameters
.
FullScreen_PresentationInterval
=
desc
->
swap_interval
;
hr
=
IDirect3DDevice8_CreateAdditionalSwapChain
(
&
device
->
IDirect3DDevice8_iface
,
&
local_parameters
,
&
d3d_swapchain
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
=
d3d8_swapchain_create
(
device
,
desc
,
&
d3d_swapchain
)))
{
WARN
(
"Failed to create swapchain, hr %#x.
\n
"
,
hr
);
*
swapchain
=
NULL
;
return
hr
;
}
*
swapchain
=
((
struct
d3d8_swapchain
*
)
d3d_swapchain
)
->
wined3d_swapchain
;
*
swapchain
=
d3d_swapchain
->
wined3d_swapchain
;
wined3d_swapchain_incref
(
*
swapchain
);
IDirect3DSwapChain8_Release
(
d3d_swapchain
);
/* Copy back the presentation parameters */
desc
->
backbuffer_width
=
local_parameters
.
BackBufferWidth
;
desc
->
backbuffer_height
=
local_parameters
.
BackBufferHeight
;
desc
->
backbuffer_format
=
wined3dformat_from_d3dformat
(
local_parameters
.
BackBufferFormat
);
desc
->
backbuffer_count
=
local_parameters
.
BackBufferCount
;
desc
->
multisample_type
=
local_parameters
.
MultiSampleType
;
desc
->
swap_effect
=
local_parameters
.
SwapEffect
;
desc
->
device_window
=
local_parameters
.
hDeviceWindow
;
desc
->
windowed
=
local_parameters
.
Windowed
;
desc
->
enable_auto_depth_stencil
=
local_parameters
.
EnableAutoDepthStencil
;
desc
->
auto_depth_stencil_format
=
wined3dformat_from_d3dformat
(
local_parameters
.
AutoDepthStencilFormat
);
desc
->
flags
=
local_parameters
.
Flags
;
desc
->
refresh_rate
=
local_parameters
.
FullScreen_RefreshRateInHz
;
desc
->
swap_interval
=
local_parameters
.
FullScreen_PresentationInterval
;
IDirect3DSwapChain8_Release
(
&
d3d_swapchain
->
IDirect3DSwapChain8_iface
);
return
hr
;
}
...
...
@@ -3121,7 +3072,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
swapchain_desc
.
backbuffer_width
=
parameters
->
BackBufferWidth
;
swapchain_desc
.
backbuffer_height
=
parameters
->
BackBufferHeight
;
swapchain_desc
.
backbuffer_format
=
wined3dformat_from_d3dformat
(
parameters
->
BackBufferFormat
);
swapchain_desc
.
backbuffer_count
=
parameters
->
BackBufferCount
;
swapchain_desc
.
backbuffer_count
=
max
(
1
,
parameters
->
BackBufferCount
)
;
swapchain_desc
.
multisample_type
=
parameters
->
MultiSampleType
;
swapchain_desc
.
multisample_quality
=
0
;
/* d3d9 only */
swapchain_desc
.
swap_effect
=
parameters
->
SwapEffect
;
...
...
dlls/d3d8/swapchain.c
View file @
79dc3461
...
...
@@ -149,7 +149,7 @@ static const struct wined3d_parent_ops d3d8_swapchain_wined3d_parent_ops =
d3d8_swapchain_wined3d_object_released
,
};
HRESULT
swapchain_init
(
struct
d3d8_swapchain
*
swapchain
,
struct
d3d8_device
*
device
,
static
HRESULT
swapchain_init
(
struct
d3d8_swapchain
*
swapchain
,
struct
d3d8_device
*
device
,
struct
wined3d_swapchain_desc
*
desc
)
{
HRESULT
hr
;
...
...
@@ -174,3 +174,28 @@ HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_device *dev
return
D3D_OK
;
}
HRESULT
d3d8_swapchain_create
(
struct
d3d8_device
*
device
,
struct
wined3d_swapchain_desc
*
desc
,
struct
d3d8_swapchain
**
swapchain
)
{
struct
d3d8_swapchain
*
object
;
HRESULT
hr
;
if
(
!
(
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
))))
{
ERR
(
"Failed to allocate swapchain memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
if
(
FAILED
(
hr
=
swapchain_init
(
object
,
device
,
desc
)))
{
WARN
(
"Failed to initialize swapchain, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
TRACE
(
"Created swapchain %p.
\n
"
,
object
);
*
swapchain
=
object
;
return
D3D_OK
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment