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
454a6122
Commit
454a6122
authored
Aug 12, 2007
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Aug 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wgl: Proper stereo / double buffering support for ChoosePixelFormat.
parent
b78923d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
19 deletions
+65
-19
opengl.c
dlls/winex11.drv/opengl.c
+65
-19
No files found.
dlls/winex11.drv/opengl.c
View file @
454a6122
...
@@ -1020,6 +1020,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1020,6 +1020,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
int
value
=
0
;
int
value
=
0
;
int
i
=
0
;
int
i
=
0
;
int
bestFormat
=
-
1
;
int
bestFormat
=
-
1
;
int
bestDBuffer
=
-
1
;
int
bestStereo
=
-
1
;
int
bestColor
=
-
1
;
int
bestColor
=
-
1
;
int
bestAlpha
=
-
1
;
int
bestAlpha
=
-
1
;
int
bestDepth
=
-
1
;
int
bestDepth
=
-
1
;
...
@@ -1062,34 +1064,69 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1062,34 +1064,69 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
continue
;
continue
;
}
}
/* Doublebuffer:
* Ignore doublebuffer when PFD_DOUBLEBUFFER_DONTCARE is set. Further if the flag
* is not set, we must return a format without double buffering. */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DOUBLEBUFFER
,
&
value
);
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DOUBLEBUFFER
,
&
value
);
if
(
value
)
dwFlags
|=
PFD_DOUBLEBUFFER
;
if
(
value
)
dwFlags
|=
PFD_DOUBLEBUFFER
;
if
(
!
(
ppfd
->
dwFlags
&
PFD_DOUBLEBUFFER_DONTCARE
)
&&
((
ppfd
->
dwFlags
^
dwFlags
)
&
PFD_DOUBLEBUFFER
))
{
TRACE
(
"dbl buffer mismatch for iPixelFormat=%d
\n
"
,
i
+
1
);
continue
;
}
/* Stereo:
* Ignore stereo when PFD_STEREO_DONTCARE is set. Further if the flag
* is not set, we must return a format without stereo support. */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_STEREO
,
&
value
);
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_STEREO
,
&
value
);
if
(
value
)
dwFlags
|=
PFD_STEREO
;
if
(
value
)
dwFlags
|=
PFD_STEREO
;
if
(
!
(
ppfd
->
dwFlags
&
PFD_STEREO_DONTCARE
)
&&
((
ppfd
->
dwFlags
^
dwFlags
)
&
PFD_STEREO
))
{
TRACE
(
"stereo mismatch for iPixelFormat=%d
\n
"
,
i
+
1
);
continue
;
}
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_BUFFER_SIZE
,
&
color
);
/* cColorBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_BUFFER_SIZE
,
&
color
);
/* cColorBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_ALPHA_SIZE
,
&
alpha
);
/* cAlphaBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_ALPHA_SIZE
,
&
alpha
);
/* cAlphaBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DEPTH_SIZE
,
&
depth
);
/* cDepthBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DEPTH_SIZE
,
&
depth
);
/* cDepthBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_STENCIL_SIZE
,
&
stencil
);
/* cStencilBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_STENCIL_SIZE
,
&
stencil
);
/* cStencilBits */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_AUX_BUFFERS
,
&
aux
);
/* cAuxBuffers */
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_AUX_BUFFERS
,
&
aux
);
/* cAuxBuffers */
/* The behavior of PDF_STEREO/PFD_STEREO_DONTCARE and PFD_DOUBLEBUFFER / PFD_DOUBLEBUFFER_DONTCARE
* is not very clear on MSDN. They specify that ChoosePixelFormat tries to match pixel formats
* with the flag (PFD_STEREO / PFD_DOUBLEBUFFERING) set. Otherwise it says that it tries to match
* formats without the given flag set.
* A test on Windows using a Radeon 9500pro on WinXP (the driver doesn't support Stereo)
* has indicated that a format without stereo is returned when stereo is unavailable.
* So in case PFD_STEREO is set, formats that support it should have priority above formats
* without. In case PFD_STEREO_DONTCARE is set, stereo is ignored.
*
* To summarize the following is most likely the correct behavior:
* stereo not set -> prefer no-stereo formats, else also accept stereo formats
* stereo set -> prefer stereo formats, else also accept no-stereo formats
* stereo don't care -> it doesn't matter whether we get stereo or not
*
* In Wine we will treat no-stereo the same way as don't care because it makes
* format selection even more complicated and second drivers with Stereo advertise
* each format twice anyway.
*/
/* Doublebuffer, see the comments above */
if
(
!
(
ppfd
->
dwFlags
&
PFD_DOUBLEBUFFER_DONTCARE
)
)
{
if
(
((
ppfd
->
dwFlags
&
PFD_DOUBLEBUFFER
)
!=
bestDBuffer
)
&&
((
dwFlags
&
PFD_DOUBLEBUFFER
)
==
(
ppfd
->
dwFlags
&
PFD_DOUBLEBUFFER
))
)
{
bestDBuffer
=
dwFlags
&
PFD_DOUBLEBUFFER
;
bestStereo
=
dwFlags
&
PFD_STEREO
;
bestAlpha
=
alpha
;
bestColor
=
color
;
bestDepth
=
depth
;
bestStencil
=
stencil
;
bestAux
=
aux
;
bestFormat
=
i
;
continue
;
}
}
/* Stereo, see the comments above. */
if
(
!
(
ppfd
->
dwFlags
&
PFD_STEREO_DONTCARE
)
)
{
if
(
((
ppfd
->
dwFlags
&
PFD_STEREO
)
!=
bestStereo
)
&&
((
dwFlags
&
PFD_STEREO
)
==
(
ppfd
->
dwFlags
&
PFD_STEREO
))
)
{
bestDBuffer
=
dwFlags
&
PFD_DOUBLEBUFFER
;
bestStereo
=
dwFlags
&
PFD_STEREO
;
bestAlpha
=
alpha
;
bestColor
=
color
;
bestDepth
=
depth
;
bestStencil
=
stencil
;
bestAux
=
aux
;
bestFormat
=
i
;
continue
;
}
}
/* Below we will do a number of checks to select the 'best' pixelformat.
/* Below we will do a number of checks to select the 'best' pixelformat.
* We assume the precedence cColorBits > cAlphaBits > cDepthBits > cStencilBits -> cAuxBuffers.
* We assume the precedence cColorBits > cAlphaBits > cDepthBits > cStencilBits -> cAuxBuffers.
* The code works by trying to match the most important options as close as possible.
* The code works by trying to match the most important options as close as possible.
...
@@ -1099,6 +1136,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1099,6 +1136,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
if
(
((
ppfd
->
cColorBits
>
bestColor
)
&&
(
color
>
bestColor
))
||
if
(
((
ppfd
->
cColorBits
>
bestColor
)
&&
(
color
>
bestColor
))
||
((
color
>=
ppfd
->
cColorBits
)
&&
(
color
<
bestColor
))
)
((
color
>=
ppfd
->
cColorBits
)
&&
(
color
<
bestColor
))
)
{
{
bestDBuffer
=
dwFlags
&
PFD_DOUBLEBUFFER
;
bestStereo
=
dwFlags
&
PFD_STEREO
;
bestAlpha
=
alpha
;
bestAlpha
=
alpha
;
bestColor
=
color
;
bestColor
=
color
;
bestDepth
=
depth
;
bestDepth
=
depth
;
...
@@ -1115,6 +1154,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1115,6 +1154,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
if
(
((
ppfd
->
cAlphaBits
>
bestAlpha
)
&&
(
alpha
>
bestAlpha
))
||
if
(
((
ppfd
->
cAlphaBits
>
bestAlpha
)
&&
(
alpha
>
bestAlpha
))
||
((
alpha
>=
ppfd
->
cAlphaBits
)
&&
(
alpha
<
bestAlpha
))
)
((
alpha
>=
ppfd
->
cAlphaBits
)
&&
(
alpha
<
bestAlpha
))
)
{
{
bestDBuffer
=
dwFlags
&
PFD_DOUBLEBUFFER
;
bestStereo
=
dwFlags
&
PFD_STEREO
;
bestAlpha
=
alpha
;
bestAlpha
=
alpha
;
bestColor
=
color
;
bestColor
=
color
;
bestDepth
=
depth
;
bestDepth
=
depth
;
...
@@ -1131,6 +1172,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1131,6 +1172,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
if
(
((
ppfd
->
cDepthBits
>
bestDepth
)
&&
(
depth
>
bestDepth
))
||
if
(
((
ppfd
->
cDepthBits
>
bestDepth
)
&&
(
depth
>
bestDepth
))
||
((
depth
>=
ppfd
->
cDepthBits
)
&&
(
depth
<
bestDepth
))
)
((
depth
>=
ppfd
->
cDepthBits
)
&&
(
depth
<
bestDepth
))
)
{
{
bestDBuffer
=
dwFlags
&
PFD_DOUBLEBUFFER
;
bestStereo
=
dwFlags
&
PFD_STEREO
;
bestAlpha
=
alpha
;
bestAlpha
=
alpha
;
bestColor
=
color
;
bestColor
=
color
;
bestDepth
=
depth
;
bestDepth
=
depth
;
...
@@ -1147,6 +1190,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1147,6 +1190,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
if
(
((
ppfd
->
cStencilBits
>
bestStencil
)
&&
(
stencil
>
bestStencil
))
||
if
(
((
ppfd
->
cStencilBits
>
bestStencil
)
&&
(
stencil
>
bestStencil
))
||
((
stencil
>=
ppfd
->
cStencilBits
)
&&
(
stencil
<
bestStencil
))
)
((
stencil
>=
ppfd
->
cStencilBits
)
&&
(
stencil
<
bestStencil
))
)
{
{
bestDBuffer
=
dwFlags
&
PFD_DOUBLEBUFFER
;
bestStereo
=
dwFlags
&
PFD_STEREO
;
bestAlpha
=
alpha
;
bestAlpha
=
alpha
;
bestColor
=
color
;
bestColor
=
color
;
bestDepth
=
depth
;
bestDepth
=
depth
;
...
@@ -1163,6 +1208,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1163,6 +1208,8 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
if
(
((
ppfd
->
cAuxBuffers
>
bestAux
)
&&
(
aux
>
bestAux
))
||
if
(
((
ppfd
->
cAuxBuffers
>
bestAux
)
&&
(
aux
>
bestAux
))
||
((
aux
>=
ppfd
->
cAuxBuffers
)
&&
(
aux
<
bestAux
))
)
((
aux
>=
ppfd
->
cAuxBuffers
)
&&
(
aux
<
bestAux
))
)
{
{
bestDBuffer
=
dwFlags
&
PFD_DOUBLEBUFFER
;
bestStereo
=
dwFlags
&
PFD_STEREO
;
bestAlpha
=
alpha
;
bestAlpha
=
alpha
;
bestColor
=
color
;
bestColor
=
color
;
bestDepth
=
depth
;
bestDepth
=
depth
;
...
@@ -1189,7 +1236,6 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
...
@@ -1189,7 +1236,6 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
return
ret
;
return
ret
;
}
}
/**
/**
* X11DRV_DescribePixelFormat
* X11DRV_DescribePixelFormat
*
*
...
...
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