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
45ebea1f
Commit
45ebea1f
authored
Oct 26, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Nov 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Set the display mode before creating the context.
parent
38147d28
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
24 deletions
+50
-24
device.c
dlls/wined3d/device.c
+50
-24
No files found.
dlls/wined3d/device.c
View file @
45ebea1f
...
@@ -1358,6 +1358,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
...
@@ -1358,6 +1358,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
IWineD3DSwapChainImpl
*
object
;
/** NOTE: impl ref allowed since this is a create function **/
IWineD3DSwapChainImpl
*
object
;
/** NOTE: impl ref allowed since this is a create function **/
HRESULT
hr
=
WINED3D_OK
;
HRESULT
hr
=
WINED3D_OK
;
IUnknown
*
bufferParent
;
IUnknown
*
bufferParent
;
BOOL
displaymode_set
=
FALSE
;
TRACE
(
"(%p) : Created Aditional Swap Chain
\n
"
,
This
);
TRACE
(
"(%p) : Created Aditional Swap Chain
\n
"
,
This
);
...
@@ -1450,30 +1451,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
...
@@ -1450,30 +1451,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
goto
error
;
goto
error
;
}
}
/**
* Create an opengl context for the display visual
* NOTE: the visual is chosen as the window is created and the glcontext cannot
* use different properties after that point in time. FIXME: How to handle when requested format
* doesn't match actual visual? Cannot choose one here - code removed as it ONLY works if the one
* it chooses is identical to the one already being used!
**********************************/
/** FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat **/
object
->
context
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
object
->
context
));
if
(
!
object
->
context
)
return
E_OUTOFMEMORY
;
object
->
num_contexts
=
1
;
object
->
context
[
0
]
=
CreateContext
(
This
,
(
IWineD3DSurfaceImpl
*
)
object
->
frontBuffer
,
object
->
win_handle
,
FALSE
/* pbuffer */
,
pPresentationParameters
);
if
(
!
object
->
context
[
0
])
{
ERR
(
"Failed to create a new context
\n
"
);
hr
=
WINED3DERR_NOTAVAILABLE
;
goto
error
;
}
else
{
TRACE
(
"Context created (HWND=%p, glContext=%p)
\n
"
,
object
->
win_handle
,
object
->
context
[
0
]
->
glCtx
);
}
/*********************
/*********************
* Windowed / Fullscreen
* Windowed / Fullscreen
*******************/
*******************/
...
@@ -1504,6 +1481,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
...
@@ -1504,6 +1481,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
devmode
.
dmPelsWidth
=
pPresentationParameters
->
BackBufferWidth
;
devmode
.
dmPelsWidth
=
pPresentationParameters
->
BackBufferWidth
;
devmode
.
dmPelsHeight
=
pPresentationParameters
->
BackBufferHeight
;
devmode
.
dmPelsHeight
=
pPresentationParameters
->
BackBufferHeight
;
ChangeDisplaySettingsExW
(
This
->
adapter
->
DeviceName
,
&
devmode
,
NULL
,
CDS_FULLSCREEN
,
NULL
);
ChangeDisplaySettingsExW
(
This
->
adapter
->
DeviceName
,
&
devmode
,
NULL
,
CDS_FULLSCREEN
,
NULL
);
displaymode_set
=
TRUE
;
/* For GetDisplayMode */
/* For GetDisplayMode */
This
->
ddraw_width
=
devmode
.
dmPelsWidth
;
This
->
ddraw_width
=
devmode
.
dmPelsWidth
;
...
@@ -1517,6 +1495,30 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
...
@@ -1517,6 +1495,30 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
ClipCursor
(
&
clip_rc
);
ClipCursor
(
&
clip_rc
);
}
}
/**
* Create an opengl context for the display visual
* NOTE: the visual is chosen as the window is created and the glcontext cannot
* use different properties after that point in time. FIXME: How to handle when requested format
* doesn't match actual visual? Cannot choose one here - code removed as it ONLY works if the one
* it chooses is identical to the one already being used!
**********************************/
/** FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat **/
object
->
context
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
object
->
context
));
if
(
!
object
->
context
)
return
E_OUTOFMEMORY
;
object
->
num_contexts
=
1
;
object
->
context
[
0
]
=
CreateContext
(
This
,
(
IWineD3DSurfaceImpl
*
)
object
->
frontBuffer
,
object
->
win_handle
,
FALSE
/* pbuffer */
,
pPresentationParameters
);
if
(
!
object
->
context
[
0
])
{
ERR
(
"Failed to create a new context
\n
"
);
hr
=
WINED3DERR_NOTAVAILABLE
;
goto
error
;
}
else
{
TRACE
(
"Context created (HWND=%p, glContext=%p)
\n
"
,
object
->
win_handle
,
object
->
context
[
0
]
->
glCtx
);
}
/*********************
/*********************
* Create the back, front and stencil buffers
* Create the back, front and stencil buffers
*******************/
*******************/
...
@@ -1594,6 +1596,30 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
...
@@ -1594,6 +1596,30 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
return
WINED3D_OK
;
return
WINED3D_OK
;
error:
error:
if
(
displaymode_set
)
{
DEVMODEW
devmode
;
HDC
hdc
;
int
bpp
=
0
;
RECT
clip_rc
;
SetRect
(
&
clip_rc
,
0
,
0
,
object
->
orig_width
,
object
->
orig_height
);
ClipCursor
(
NULL
);
/* Get info on the current display setup */
hdc
=
GetDC
(
0
);
bpp
=
GetDeviceCaps
(
hdc
,
BITSPIXEL
);
ReleaseDC
(
0
,
hdc
);
/* Change the display settings */
memset
(
&
devmode
,
0
,
sizeof
(
devmode
));
devmode
.
dmSize
=
sizeof
(
devmode
);
devmode
.
dmFields
=
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
devmode
.
dmBitsPerPel
=
(
bpp
>=
24
)
?
32
:
bpp
;
/* Stupid XVidMode cannot change bpp */
devmode
.
dmPelsWidth
=
object
->
orig_width
;
devmode
.
dmPelsHeight
=
object
->
orig_height
;
ChangeDisplaySettingsExW
(
This
->
adapter
->
DeviceName
,
&
devmode
,
NULL
,
CDS_FULLSCREEN
,
NULL
);
}
if
(
object
->
backBuffer
)
{
if
(
object
->
backBuffer
)
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
object
->
presentParms
.
BackBufferCount
;
i
++
)
{
for
(
i
=
0
;
i
<
object
->
presentParms
.
BackBufferCount
;
i
++
)
{
...
...
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