Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Support robust context creation  (Read 5955 times)

0 Members and 1 Guest are viewing this topic.

feliwir

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Support robust context creation
« on: January 31, 2016, 03:40:43 pm »
Hello everyone,

I'd like to see that SFML allows the creation of robust OpenGL contexts. This is related to the GL_ARB_robustness extension, which got part of core OpenGL in 4.1. The thing SFML would need to add is GLX_ARB_create_context_robustness (for X11) and WGL_ARB_create_context_robustness (for windows). The benefit of a robust OpenGL context is that the programmer will get notified when a graphics reset happens and he can handle the behaviour of the program in that case. The glfw library does already allow to use this feature by adding new context creation flags, see here for reference. I think this would be a very useful feature for everyone using SFML with OpenGL.
Greetings
feliwir

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Support robust context creation
« Reply #1 on: February 01, 2016, 05:58:22 am »
Quote
The benefit of a robust OpenGL context is that the programmer will get notified when a graphics reset happens and he can handle the behaviour of the program in that case.

I'm not against something like this, but it begs the question - how? Say support is added for 'robust' contexts, how will a user be notified? Then say there is a way to get the notification, what will the user do then? SFML doesn't provide any way to easily recreate the context associated with a window without recreating the entire window.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Support robust context creation
« Reply #2 on: February 01, 2016, 07:30:20 am »
Quote
when a graphics reset happens
In what circumstances can a graphics reset happen? It doesn't sound like a common issue.
Laurent Gomila - SFML developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Support robust context creation
« Reply #3 on: February 01, 2016, 09:15:19 am »
Not sure about latest versions of Windows, drivers, etc. but IIRC this could happen when Windows shows an UAC prompt or you hit Ctrl+Alt+Del. I only remember this happening on DirectX though, haven't used OpenGL back then.

Also how about switching displays, e.g. having two monitors, one on the onboard card, one on dedicated card, moving the Window between screens should(?) cause something, unless that's handled by drivers. Unfortunately can't test that right now.

feliwir

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Support robust context creation
« Reply #4 on: February 01, 2016, 09:24:39 am »
There are a couple ways how a graphics reset could happen, and this extension is also part of OpenGL ES where graphics reset seem to happen way more frequently. However to check for a graphics reset the programmer must call GetGraphicsResetStatus which will then tell the programmer if a graphics reset happened (and if the current  context was responsible for it). I should also mention that this extension makes OpenGL safer for malware exploits by adding new fuctions with an additional bufSize parameter, see the specification for a list with new functions.
When a graphics reset happens a programmer must revalidate all buffers & textures and then can proceed like nothing ever happened.
« Last Edit: February 01, 2016, 09:26:58 am by feliwir »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Support robust context creation
« Reply #5 on: February 01, 2016, 11:24:40 am »
Quote
There are a couple ways how a graphics reset could happen
Which are... ?
Laurent Gomila - SFML developer

feliwir

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Support robust context creation
« Reply #6 on: February 01, 2016, 11:35:49 am »
I always get a graphics resets on windows 10 with Nvidia 361.75 driver when using the NSight plugin for Visual Studio  :) But there are many other ways aswell when you missuse some OpenGL functions

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Support robust context creation
« Reply #7 on: February 07, 2016, 03:15:12 am »
But there are many other ways aswell
Being concrete would actually help. We're programmers, not politicians. ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

feliwir

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Support robust context creation
« Reply #8 on: February 07, 2016, 09:20:22 am »
I guess to convince anyone i need to write a sample program. Will do so within the next days

 

anything