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
2e27ab6b
Commit
2e27ab6b
authored
Dec 20, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Add a separate function for swapchain initialization.
parent
ecbe545e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
67 deletions
+80
-67
d3d8_private.h
dlls/d3d8/d3d8_private.h
+3
-5
device.c
dlls/d3d8/device.c
+20
-61
swapchain.c
dlls/d3d8/swapchain.c
+57
-1
No files found.
dlls/d3d8/d3d8_private.h
View file @
2e27ab6b
...
@@ -227,11 +227,6 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device,
...
@@ -227,11 +227,6 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device,
/* ------------------- */
/* ------------------- */
/*****************************************************************************
/*****************************************************************************
* Predeclare the interface implementation structures
*/
extern
const
IDirect3DSwapChain8Vtbl
Direct3DSwapChain8_Vtbl
DECLSPEC_HIDDEN
;
/*****************************************************************************
* IDirect3DSwapChain8 implementation structure
* IDirect3DSwapChain8 implementation structure
*/
*/
struct
IDirect3DSwapChain8Impl
struct
IDirect3DSwapChain8Impl
...
@@ -247,6 +242,9 @@ struct IDirect3DSwapChain8Impl
...
@@ -247,6 +242,9 @@ struct IDirect3DSwapChain8Impl
LPDIRECT3DDEVICE8
parentDevice
;
LPDIRECT3DDEVICE8
parentDevice
;
};
};
HRESULT
swapchain_init
(
IDirect3DSwapChain8Impl
*
swapchain
,
IDirect3DDevice8Impl
*
device
,
D3DPRESENT_PARAMETERS
*
present_parameters
)
DECLSPEC_HIDDEN
;
/* ----------------- */
/* ----------------- */
/* IDirect3DSurface8 */
/* IDirect3DSurface8 */
/* ----------------- */
/* ----------------- */
...
...
dlls/d3d8/device.c
View file @
2e27ab6b
...
@@ -495,76 +495,35 @@ static BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL
...
@@ -495,76 +495,35 @@ static BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL
return
ret
;
return
ret
;
}
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CreateAdditionalSwapChain
(
LPDIRECT3DDEVICE8
iface
,
D3DPRESENT_PARAMETERS
*
pPresentationParameters
,
IDirect3DSwapChain8
**
pSwapChain
)
{
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CreateAdditionalSwapChain
(
IDirect3DDevice8
*
iface
,
D3DPRESENT_PARAMETERS
*
present_parameters
,
IDirect3DSwapChain8
**
swapchain
)
{
IDirect3DDevice8Impl
*
This
=
(
IDirect3DDevice8Impl
*
)
iface
;
IDirect3DDevice8Impl
*
This
=
(
IDirect3DDevice8Impl
*
)
iface
;
IDirect3DSwapChain8Impl
*
object
;
IDirect3DSwapChain8Impl
*
object
;
HRESULT
hrc
=
D3D_OK
;
HRESULT
hr
;
WINED3DPRESENT_PARAMETERS
localParameters
;
TRACE
(
"iface %p, present_parameters %p, swapchain %p.
\n
"
,
TRACE
(
"iface %p, present_parameters %p, swapchain %p.
\n
"
,
iface
,
pPresentationParameters
,
pSwapChain
);
iface
,
present_parameters
,
swapchain
);
/* Fix the back buffer count */
if
(
pPresentationParameters
->
BackBufferCount
==
0
)
{
pPresentationParameters
->
BackBufferCount
=
1
;
}
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
NULL
==
object
)
{
if
(
!
object
)
FIXME
(
"Allocation of memory failed
\n
"
);
{
*
pSwapChain
=
NULL
;
ERR
(
"Failed to allocate swapchain memory.
\n
"
)
;
return
D3DERR_OUTOFVIDEO
MEMORY
;
return
E_OUTOF
MEMORY
;
}
}
object
->
ref
=
1
;
object
->
lpVtbl
=
&
Direct3DSwapChain8_Vtbl
;
/* Allocate an associated WineD3DDevice object */
localParameters
.
BackBufferWidth
=
pPresentationParameters
->
BackBufferWidth
;
localParameters
.
BackBufferHeight
=
pPresentationParameters
->
BackBufferHeight
;
localParameters
.
BackBufferFormat
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
BackBufferFormat
);
localParameters
.
BackBufferCount
=
pPresentationParameters
->
BackBufferCount
;
localParameters
.
MultiSampleType
=
pPresentationParameters
->
MultiSampleType
;
localParameters
.
MultiSampleQuality
=
0
;
/* d3d9 only */
localParameters
.
SwapEffect
=
pPresentationParameters
->
SwapEffect
;
localParameters
.
hDeviceWindow
=
pPresentationParameters
->
hDeviceWindow
;
localParameters
.
Windowed
=
pPresentationParameters
->
Windowed
;
localParameters
.
EnableAutoDepthStencil
=
pPresentationParameters
->
EnableAutoDepthStencil
;
localParameters
.
AutoDepthStencilFormat
=
wined3dformat_from_d3dformat
(
pPresentationParameters
->
AutoDepthStencilFormat
);
localParameters
.
Flags
=
pPresentationParameters
->
Flags
;
localParameters
.
FullScreen_RefreshRateInHz
=
pPresentationParameters
->
FullScreen_RefreshRateInHz
;
localParameters
.
PresentationInterval
=
pPresentationParameters
->
FullScreen_PresentationInterval
;
localParameters
.
AutoRestoreDisplayMode
=
TRUE
;
wined3d_mutex_lock
();
hr
=
swapchain_init
(
object
,
This
,
present_parameters
);
hrc
=
IWineD3DDevice_CreateSwapChain
(
This
->
WineD3DDevice
,
&
localParameters
,
if
(
FAILED
(
hr
))
&
object
->
wineD3DSwapChain
,
(
IUnknown
*
)
object
,
SURFACE_OPENGL
);
{
wined3d_mutex_unlock
();
WARN
(
"Failed to initialize swapchain, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
pPresentationParameters
->
BackBufferWidth
=
localParameters
.
BackBufferWidth
;
TRACE
(
"Created swapchain %p.
\n
"
,
object
);
pPresentationParameters
->
BackBufferHeight
=
localParameters
.
BackBufferHeight
;
*
swapchain
=
(
IDirect3DSwapChain8
*
)
object
;
pPresentationParameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
localParameters
.
BackBufferFormat
);
pPresentationParameters
->
BackBufferCount
=
localParameters
.
BackBufferCount
;
pPresentationParameters
->
MultiSampleType
=
localParameters
.
MultiSampleType
;
pPresentationParameters
->
SwapEffect
=
localParameters
.
SwapEffect
;
pPresentationParameters
->
hDeviceWindow
=
localParameters
.
hDeviceWindow
;
pPresentationParameters
->
Windowed
=
localParameters
.
Windowed
;
pPresentationParameters
->
EnableAutoDepthStencil
=
localParameters
.
EnableAutoDepthStencil
;
pPresentationParameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
localParameters
.
AutoDepthStencilFormat
);
pPresentationParameters
->
Flags
=
localParameters
.
Flags
;
pPresentationParameters
->
FullScreen_RefreshRateInHz
=
localParameters
.
FullScreen_RefreshRateInHz
;
pPresentationParameters
->
FullScreen_PresentationInterval
=
localParameters
.
PresentationInterval
;
if
(
hrc
!=
D3D_OK
)
{
return
D3D_OK
;
FIXME
(
"(%p) call to IWineD3DDevice_CreateSwapChain failed
\n
"
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
pSwapChain
=
NULL
;
}
else
{
IUnknown_AddRef
(
iface
);
object
->
parentDevice
=
iface
;
*
pSwapChain
=
(
IDirect3DSwapChain8
*
)
object
;
}
TRACE
(
"(%p) returning %p
\n
"
,
This
,
*
pSwapChain
);
return
hrc
;
}
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_Reset
(
LPDIRECT3DDEVICE8
iface
,
D3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
static
HRESULT
WINAPI
IDirect3DDevice8Impl_Reset
(
LPDIRECT3DDEVICE8
iface
,
D3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
...
...
dlls/d3d8/swapchain.c
View file @
2e27ab6b
...
@@ -102,7 +102,7 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8
...
@@ -102,7 +102,7 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8
return
hrc
;
return
hrc
;
}
}
const
IDirect3DSwapChain8Vtbl
Direct3DSwapChain8_Vtbl
=
static
const
IDirect3DSwapChain8Vtbl
Direct3DSwapChain8_Vtbl
=
{
{
IDirect3DSwapChain8Impl_QueryInterface
,
IDirect3DSwapChain8Impl_QueryInterface
,
IDirect3DSwapChain8Impl_AddRef
,
IDirect3DSwapChain8Impl_AddRef
,
...
@@ -110,3 +110,59 @@ const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
...
@@ -110,3 +110,59 @@ const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
IDirect3DSwapChain8Impl_Present
,
IDirect3DSwapChain8Impl_Present
,
IDirect3DSwapChain8Impl_GetBackBuffer
IDirect3DSwapChain8Impl_GetBackBuffer
};
};
HRESULT
swapchain_init
(
IDirect3DSwapChain8Impl
*
swapchain
,
IDirect3DDevice8Impl
*
device
,
D3DPRESENT_PARAMETERS
*
present_parameters
)
{
WINED3DPRESENT_PARAMETERS
wined3d_parameters
;
HRESULT
hr
;
swapchain
->
ref
=
1
;
swapchain
->
lpVtbl
=
&
Direct3DSwapChain8_Vtbl
;
wined3d_parameters
.
BackBufferWidth
=
present_parameters
->
BackBufferWidth
;
wined3d_parameters
.
BackBufferHeight
=
present_parameters
->
BackBufferHeight
;
wined3d_parameters
.
BackBufferFormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
BackBufferFormat
);
wined3d_parameters
.
BackBufferCount
=
max
(
1
,
present_parameters
->
BackBufferCount
);
wined3d_parameters
.
MultiSampleType
=
present_parameters
->
MultiSampleType
;
wined3d_parameters
.
MultiSampleQuality
=
0
;
/* d3d9 only */
wined3d_parameters
.
SwapEffect
=
present_parameters
->
SwapEffect
;
wined3d_parameters
.
hDeviceWindow
=
present_parameters
->
hDeviceWindow
;
wined3d_parameters
.
Windowed
=
present_parameters
->
Windowed
;
wined3d_parameters
.
EnableAutoDepthStencil
=
present_parameters
->
EnableAutoDepthStencil
;
wined3d_parameters
.
AutoDepthStencilFormat
=
wined3dformat_from_d3dformat
(
present_parameters
->
AutoDepthStencilFormat
);
wined3d_parameters
.
Flags
=
present_parameters
->
Flags
;
wined3d_parameters
.
FullScreen_RefreshRateInHz
=
present_parameters
->
FullScreen_RefreshRateInHz
;
wined3d_parameters
.
PresentationInterval
=
present_parameters
->
FullScreen_PresentationInterval
;
wined3d_parameters
.
AutoRestoreDisplayMode
=
TRUE
;
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_CreateSwapChain
(
device
->
WineD3DDevice
,
&
wined3d_parameters
,
&
swapchain
->
wineD3DSwapChain
,
(
IUnknown
*
)
swapchain
,
SURFACE_OPENGL
);
wined3d_mutex_unlock
();
present_parameters
->
BackBufferWidth
=
wined3d_parameters
.
BackBufferWidth
;
present_parameters
->
BackBufferHeight
=
wined3d_parameters
.
BackBufferHeight
;
present_parameters
->
BackBufferFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
BackBufferFormat
);
present_parameters
->
BackBufferCount
=
wined3d_parameters
.
BackBufferCount
;
present_parameters
->
MultiSampleType
=
wined3d_parameters
.
MultiSampleType
;
present_parameters
->
SwapEffect
=
wined3d_parameters
.
SwapEffect
;
present_parameters
->
hDeviceWindow
=
wined3d_parameters
.
hDeviceWindow
;
present_parameters
->
Windowed
=
wined3d_parameters
.
Windowed
;
present_parameters
->
EnableAutoDepthStencil
=
wined3d_parameters
.
EnableAutoDepthStencil
;
present_parameters
->
AutoDepthStencilFormat
=
d3dformat_from_wined3dformat
(
wined3d_parameters
.
AutoDepthStencilFormat
);
present_parameters
->
Flags
=
wined3d_parameters
.
Flags
;
present_parameters
->
FullScreen_RefreshRateInHz
=
wined3d_parameters
.
FullScreen_RefreshRateInHz
;
present_parameters
->
FullScreen_PresentationInterval
=
wined3d_parameters
.
PresentationInterval
;
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d swapchain, hr %#x.
\n
"
,
hr
);
return
hr
;
}
swapchain
->
parentDevice
=
(
IDirect3DDevice8
*
)
device
;
IDirect3DDevice8_AddRef
(
swapchain
->
parentDevice
);
return
D3D_OK
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment