We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1565 - some small GL context creation enhancements
Summary: some small GL context creation enhancements
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All Linux
: P1 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.0
Depends on:
Blocks:
 
Reported: 2012-08-09 12:53 UTC by Matthias Bentrup
Modified: 2013-07-18 22:51 UTC (History)
1 user (show)

See Also:


Attachments
newcontextflags.diff (9.51 KB, patch)
2012-08-09 12:54 UTC, Matthias Bentrup
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Bentrup 2012-08-09 12:53:17 UTC
With OpenGL 4.3 the ARB added a new context flag for context reset isolation and renamed the existing ES2 profile bit to ES profile bit, as it can be used to request GLES 3 compatible contexts, too.

This patch adds these changes to SDL on Linux and Windows.

Also SDL lacks the ability to create shared contexts. This patch also adds a new GL attribute to enable context sharing. As casting a GL context to int is not portable, I added only a boolean attribute SDL_GL_SHARE_WITH_CURRENT_CONTEXT, which makes the new context share resources with the context current on the creating thread.
Comment 1 Matthias Bentrup 2012-08-09 12:54:21 UTC
Created attachment 920 [details]
newcontextflags.diff
Comment 2 Ryan C. Gordon 2012-08-12 10:50:04 UTC
This patch looks good to me.

--ryan.
Comment 3 Sam Lantinga 2012-08-12 11:17:19 UTC
I applied your patch, but it didn't compile on Windows.  I think I fixed it, but can you double check that it works properly?
http://hg.libsdl.org/SDL/rev/a773384edf20

Thanks!
Comment 4 Ryan C. Gordon 2012-08-12 14:16:16 UTC
Also, should we just remove the SDL_GL_CONTEXT_PROFILE_ES2 flag? I'm not sure it's worth keeping it around for compatibility in these early days of SDL2.

--ryan.
Comment 5 Sam Lantinga 2012-08-12 23:10:56 UTC
Removed!
Comment 6 Ryan C. Gordon 2012-08-24 16:24:57 UTC
Looking a little closer, since Buildbot threw a compiler warning for this code:

      _this->gl_data->wglShareLists(share_context, hdc);

Should that "hdc" have been "context"?

Also, while I'm looking at this: is sharing display lists _that_ important? Is there WGL (and glX, etc) functionality to share something that's useful in 2012, like buffer objects, textures, or shaders? If not, we should drop this piece of the patch (the rest of the improvements seem okay, though).

--ryan.
Comment 7 Matthias Bentrup 2012-08-25 06:26:42 UTC
Hello Ryan,

yes that has to be a HGLDC, so context is correct. wglShareLists is the method to share buffers, textures, shaders if you cannot use wglCreateContextAttribsARB, which has a separate share_context parameter.

  Matthias
Comment 8 Ryan C. Gordon 2012-08-25 13:56:25 UTC
(In reply to comment #7)
> yes that has to be a HGLDC, so context is correct.

Ok, I fixed that in hg changeset 3a098f2d4dea.

> wglShareLists is the method to share buffers, textures, shaders if you
> cannot use wglCreateContextAttribsARB, which has a separate 
> share_context parameter.

You're right, the MSDN documentation is incorrect:

    http://www.opengl.org/wiki/Platform_specifics:_Windows#wglShareLists

I think we're good to go, then. Sam, should we resolve this bug?

--ryan.
Comment 9 Ryan C. Gordon 2013-07-12 18:52:38 UTC
(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.0, Priority 1.

This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.
Comment 10 Ryan C. Gordon 2013-07-18 22:51:05 UTC
(In reply to comment #8)
> I think we're good to go, then. Sam, should we resolve this bug?

Resolving this bug, because I'm pretty sure we covered everything reported in it. If this was in error, please reopen it.

--ryan.