Nvidia 3D-Vision support

113 views
Skip to first unread message

badlogicgames

unread,
Dec 2, 2010, 6:42:41 AM12/2/10
to angleproject
Hi,

i created a quick hack that allows applications using the angle
project to go full-screen. This effectively allows Nvidia 3D-Vision
support, which usually only works with DirectX (unless you have an
expensive Nvidia Quadro card...).

My hack is a little fugly. From the EGL specs i see that there's no
configuration attribute that could trigger going fullscreen. Are there
plans to integrate fullscreen support officially in some way in angle?

I'll open source my "solution" as soon as i get the green light from
my company for you to laugh at it :)

Thanks for this awesome project! Keep up the good work guys!

Ciao,
Mario

Aitor Moreno

unread,
Dec 6, 2010, 7:39:51 AM12/6/10
to badlog...@gmail.com, angleproject
Hi Mario,

Although I am disconnected from the latest advances of the project, I am very interested in this specific contribution.

Can you sketch briefly how you managed to solve the "fullscreen" problem? Do you get stereoscopic visualization of DX demos?

Bye...
--
Aitor Moreno
   aitormoreno [@] gmail.com

badlogicgames

unread,
Dec 6, 2010, 12:12:20 PM12/6/10
to angleproject
Oh, and all my contributions are of course licensed under the New BSD
license.

On 6 Dez., 13:39, Aitor Moreno <aitormor...@gmail.com> wrote:
> Hi Mario,
>
> Although I am disconnected from the latest advances of the project, I am
> very interested in this specific contribution.
>
> Can you sketch briefly how you managed to solve the "fullscreen" problem? Do
> you get stereoscopic visualization of DX demos?
>
> Bye...
>

badlogicgames

unread,
Dec 6, 2010, 12:11:10 PM12/6/10
to angleproject
HI Aitor,

I created a fork on Google Code, you can find it at
https://code.google.com/p/angle-fullscreen/. It includes all the
projects of the original repository, slightly modified were needed. I
had to change parts of EGL and also took the freedom to extend the es-
utils a little. Here's what i changed in EGL.

- egl.h has a new attribute called EGL_FULLSCREEN_ANGLE (constant
0x304f, out of the reserved attribute range). This is to be used as
any other attribute like EGL_GREEN_SIZE etc. in all the EGLConfig
related methods. Not exactly optimal but i think it's OK given the
usage scenarios of Angle.
- Config has a new member called mFullscreen (type EGLBoolean). It
stores whether the configuration is a fullscreen configuration or not
(who'd have guessed...)
- Config::Config() and Config::set() have been changed accordingly to
include an argument specifying whether the config is a fullscreen
config or not.
- ConfigSet::add() was also extended to include the fullscreen flag.
- ConfigSet::getConfigs() also takes EGL_FULLSCREEN_ANGLE into account
when enumerating which configurations fit the specified attribute
list.
- Display::getConfigsAttrib() can cope with the new
EGL_FULLSCREEN_ANGLE attribute as well, returning 1 (set) or 0 (not
set).
- Display::initialize() usually enumerates and stores all
configurations consisting of combinations of the different D3DFORMAT
renderTargetFormats and depthStencilFormats. For each combination I
also check if it is supported in fullscreen and add an additional
Config with the mFullscreen flag set to true. E.g. render target
format = D3DFMT_X8R8G8B8 and depth/stencil format = D3DFMT_D24S8 would
create two configurations internally, one for windowed
(Config.mFullscreen = 0) and one for fullscreen (Config.mFullscreen =
1).
- When fetching compatible configurations for an attribute list
eglChooseConfig uses ConfigSet:getConfigs() internally which will
check all the configurations stored in the Display instance.
Fullscreen configurations will be ignored when EGL_FULLSCREEN_ANGLE
was not specified.
- Surface::resetSwapChain has been modified as well. In case the
Surface was created with a fullscreen Config it will reset the default
fullscreen swap chain. In case of a windowed Config it will use the
old code path. I created two new methods called
Surface::createFullScreen() and Surface::createWindowed() which do the
dirty work of reseting/creating the swap chain. Note that
Surface::createFullScreen will ignore the configurations backbuffer
width and height and use the default display dimensions instead. This
might be a big bozo but works so far.
- Surface::checkForOutOfDateSwapChain() has also been modified to use
the default displays resolution as the client area in case of a
fullscreen Config.

That's basically all that was necessary in EGL to get fullscreen
support and hence 3D-Vision support. So far i didn't encounter any
problems and i think the way i approached it is mostly OK. I can't
however guarantee that it won't explode in your face in more exotic
circumstances. My use case at the moment is to use an extended version
of the es-utils to create a (fullscreen) window and perform the
message dispatching. How switching between fullscreen and windowed
mode works out i don't know cause i didn't test it. Destroying the
Surface and recreating it should work though.

Here's what i changed in the es-utils:
- the ESContext struct has a couple of new callbacks: resizeFunc,
called on a window resize event, mouseFunc, called on a mouse(wheel)
event and quitFunc, called before the application is terminated. The
use of those should be fairly straight forward. I also extended
keyFunc a little similar to how mouseFunc works.
- I added ES_WINDOW_FULLSCREEN to be used like the other ES_WINDOW_XXX
defines in conjunction with esCreateWindow(). When specified in the
flags parameter of that function the function will add a
EGL_FULLSCREEN_ANGLE attribute to the attribute list it hands over to
eglCreateWindowSurface() and other egl methods in CreateEGLContext.
- esCreateWindow will ignore the given width and height in case
ES_WINDOW_FULLSCREEN was specified and use the current default
displays screen resolution instead.
- ESWindowProc has been beefed up a little so that the new callback
functions aren't useless :)

That's basically it. The fork is based on revision r498, so is pretty
up to date. A few things i had to comment out cause i couldn't get
them to compile (and i didn't have the time to figure it out).
- debug.cpp includes commons/debug.h. For some reason VC complains
that it can't find that header file. It's probably just a little fuck
up in the project settings. Didn't look to hard as nothing was used
from the header.

Final notes:
- you have to make sure to call eglTerminate or at least destroy the
context/surface when running in fullscreen + Nvidia 3D-Vision. It
seems the driver isn't capable of restoring the original desktop
display config when you perform a hard quit.
- While i tested this already and it seems to work as expected i can't
give an absolute guarantee that it won't kill anything. Use at your
own risk.

Keeping up with upstream shouldn't be a big deal as the modifications
are minimal and mostly contained in Display.cpp and Surface.cpp. I'll
try to keep up with the mainline code as good as possible. Inclusion
in the official project would of course be welcome but i guess for
that it's to experimental.

Ciao,
Mario

On 6 Dez., 13:39, Aitor Moreno <aitormor...@gmail.com> wrote:
> Hi Mario,
>
> Although I am disconnected from the latest advances of the project, I am
> very interested in this specific contribution.
>
> Can you sketch briefly how you managed to solve the "fullscreen" problem? Do
> you get stereoscopic visualization of DX demos?
>
> Bye...
>

Daniel Koch

unread,
Dec 14, 2010, 1:27:28 AM12/14/10
to badlog...@gmail.com, angleproject
Hi Mario,

That sounds pretty cool, but seriously -  why fork the project just for that?  
Why not contribute a patch to ANGLE and write a proper extension?  The changes don't seem to be overly invasive based on your description below.
See http://code.google.com/p/angleproject/issues/detail?id=91 for an example of how to do this.

More comments below.
Daniel

On 2010-12-06, at 12:11 PM, badlogicgames wrote:

HI Aitor,

I created a fork on Google Code, you can find it at
https://code.google.com/p/angle-fullscreen/. It includes all the
projects of the original repository, slightly modified were needed. I
had to change parts of EGL and also took the freedom to extend the es-
utils a little. Here's what i changed in EGL.

- egl.h has a new attribute called EGL_FULLSCREEN_ANGLE (constant
0x304f, out of the reserved attribute range). This is to be used as

Please don't do that.  It would go in eglext.h not egl.h. 
Furthermore, the reserved attributes are just that -- reserved.  They need to be specifically allocated by the registrar.
That said, if you write a proper EGL extension, I may be able to allocate one for you out of the ANGLE block of values.

---
                        Daniel Koch -+- dan...@transgaming.com
Senior Graphics Architect -+- TransGaming Inc.  -+- www.transgaming.com

badlogicgames

unread,
Dec 14, 2010, 9:42:41 AM12/14/10
to angleproject
Hi,

i forked the project as i felt my modifications did not meet the
standards for inclusion in upstream. As i said, the extension is a bit
fugly.

Anyways, i posted two patches and a spec for Khronos over at the issue
tracker (http://code.google.com/p/angleproject/issues/detail?id=96).
Please let me know if there's anything that needs changing. I used the
value 0x3201 for the new EGLConfig attribute EGL_D3D_FULLSCREEN_ANGLE,
which is one number above Vladimirs extension attribute.

If this gets into upstream i will of course delete the fork on Google
Code.

Thanks a bunch & ciao,
Mario

On 14 Dez., 07:27, Daniel Koch <dan...@transgaming.com> wrote:
> Hi Mario,
>
> That sounds pretty cool, but seriously -  why fork the project just for that?  
> Why not contribute a patch to ANGLE and write a proper extension?  The changes don't seem to be overly invasive based on your description below.
> Seehttp://code.google.com/p/angleproject/issues/detail?id=91for an example of how to do this.

badlogicgames

unread,
Dec 14, 2010, 2:41:56 PM12/14/10
to angleproject
Btw, do you guys have a CLA in place for contributions?

On 14 Dez., 07:27, Daniel Koch <dan...@transgaming.com> wrote:
> Hi Mario,
>
> That sounds pretty cool, but seriously -  why fork the project just for that?  
> Why not contribute a patch to ANGLE and write a proper extension?  The changes don't seem to be overly invasive based on your description below.
> Seehttp://code.google.com/p/angleproject/issues/detail?id=91for an example of how to do this.

Henry Bridge

unread,
Dec 14, 2010, 6:25:57 PM12/14/10
to badlog...@gmail.com, angleproject
Hi Mario,

http://code.google.com/legal/individual-cla-v1.0.html
Is the individual CLA (and can be signed electronically using the form at the bottom)

http://code.google.com/legal/corporate-cla-v1.0.html
Is the corporate one
Reply all
Reply to author
Forward
0 new messages