-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
GUI: Also try a separate-shared-context mode #756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| current_context = glXGetCurrentContext(); | ||
| assert(current_context); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this if is skipped, we should abort, right? (same above in the old function i think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a good unification.
| if (QThread::currentThread() != QCoreApplication::instance()->thread()) | ||
| this->callback_processor.processEvents(); | ||
| #else | ||
| this->callback_processor.processEvents(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does apple need a special treatment here? (maybe even add a comment about the reason)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it out and see what mac users say. Can't really test this part.
| virtual void post_render() override; | ||
| }; | ||
|
|
||
| class GuiSeparateRenderingContext : public CtxExtractionMode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation for those classes pls
|
|
||
| namespace qtsdl { | ||
|
|
||
| class CtxExtractionException : public std::runtime_error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be a good job for the error::Error so we had nice backtraces etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's too deep to include the error. Replace the exception with an assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you catch it yourself it should be ok like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that's done. They won't escape.
| assert(std::this_thread::get_id() == this->owner); | ||
| #ifndef __APPLE__ | ||
| this->app.processEvents(); | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment about the reason pls, and where does apple process its events then?
|
|
||
| class GuiRenderingCtxActivator; | ||
|
|
||
| class GuiRenderingSetupRoutines { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation pls
| switch (debugMessage.source()) { | ||
| case QOpenGLDebugMessage::APISource: | ||
| source = GL_DEBUG_SOURCE_API; | ||
| break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have that in libopenage/error/gl_debug.cpp, we should not duplicate it. any idea how we could unify them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove the switch.
25733ef to
f66d9e8
Compare
|
|
||
| void apply_opengl_debug_parameters(gl_debug_parameters params, QOpenGLContext ¤t_dest_context) { | ||
| #ifndef __APPLE__ | ||
| if (params.is_debug && params.callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you elaborate a bit why apple needs this special treatment of debug function config? I want to understand/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have cleaned this up like in that other place.
AFAIK, apple doesn't support this GL version, so there may be some problems. Maybe Qt can deal with them by itself without the ifdefs.
|
Simple question: what is the separate-shared-context mode? 😁 Is it to have the gui opengl context separately? |
|
Yes, that creates another context just for gui. |
| try { | ||
| this->ctx_extraction_mode = std::make_unique<GuiSeparateRenderingContext>(window); | ||
| } catch (const CtxExtractionException&) { | ||
| assert(false && "setting up context for GUI failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a debugging leftover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole assert or the comment in it?
That's what I called "replace the exception with an assert".
It's kind of a spiritual successor to this one:
| assert(current_context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, i was just confused by the false &&, but it seems alright :)
| @@ -1,4 +1,4 @@ | |||
| // Copyright 2015-2016 the openage authors. See copying.md for legal info. | |||
| // Copyright 2015-2017 the openage authors. See copying.md for legal info. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw why does the cocoa extraction have to be a .mm file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a valid question. With current approach there is probably no need to do ObjC there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you wanna fix that? Would be good :)
| QVariant::fromValue<QGLXNativeContext>( | ||
| QGLXNativeContext(current_context, | ||
| wm_info.info.x11.display, | ||
| wm_info.info.x11.window)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
1ba6daf to
b9d15b7
Compare
|
I tried to compile this on latest Sierra, but there were some missing |
|
Good news launches (with my pull request): And it doesn't do the infinite stack trace thing. CPU usage is 0%, so that's good. Bad news Can't kill it with Ctrl-C. Nothing renders, ever. Nor are any sounds made. |
|
is there a way to run openage with placeholder assets? since maybe the black screen just indicates that my assets weren't extracted correctly. admittedly my |
|
Unfortunately not, if the log doesn't say anything about load-failures they should be loaded correctly. I guess that the separate gui context fails to be displayed. |
|
@Birch-san, we also discussed in this PR some changes to the input handling (in outdated comments): libopenage/gui/guisys/private/gui_application_impl.cpp and libopenage/gui/guisys/private/gui_event_queue_impl.cpp. Dropped that commit because it was unexplainable. I've put it here: |
|
that commit d577f56 certainly helps! |
|
Encountered these errors whilst using the game (looks like it's just complaining about audio format): https://gist.github.com/Birch-san/cc9220818094b61cc9b817925da1e036 |
|
Here's a gameplay video. Colours are off in a strange way. I wonder if it's an endianness problem? I saw color shifts like this once when compiling a Game Boy Advance emulator for Mac, and it was totally endianness. I wasn't able to interact with anything in the game, but the HUD buttons seemed to be clickable (though they spent a lot of their time disappearing). |
|
The exact code I was running is here: Which (at the time of writing) is the HEAD of this branch: |
|
A theory about the disappearing buttons: it's probably related to that input handling fix - some events can't pass through if there is not enough real input activity (so the GUI isn't updated). The debug overlay (the one with the graph) has correct colors. The GUI too.
You can't interact because the game isn't in the Action mode. Press M several times or the 'change mode' button. |
certainly I found that sometimes I had to click buttons several times before they would work. |
|
I fixed the color problem. I was able to confirm in Photoshop that it was just a case of "red & blue channels' being swapped". I was able to fix the pixel output format. See my pull request: |
|
@ChipmunkV Do you still want to get rid of the objective C file? |
|
@TheJJ, yes, but I only see how to remove a part of it. |
b9d15b7 to
2bc8a97
Compare
|
Added missing GL_DEBUG definitions to fix compile on Mac and minimized the ObjC file to just getting the current context and putting it into Qt. |
TheJJ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coal!






Try to init GUI as usual, fallback to the shared context mode if it fails.