-
Notifications
You must be signed in to change notification settings - Fork 439
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
Multi-context/window rendering. #321
Comments
Hi! (apologies if you know this already) not widely known, but it's possible (and encouraged) to use a single GL context to render to multiple windows. For rendering to a different window you need to make it current on a different surface. Having one GL context per window is also possible, but the overhead from context switching and the limitations of sharing data between different GL contexts is not worth the pain. As far as You only need to do extra work on the "application" side, but from the above I assume you're doing that already. There's a (quite stale) PR #168 that is adding multi-window single-context support to |
Ok, I'll give it a shot on my glfw app ! |
Hmm, |
|
Can you share what exactly was the problem? We recently discovered issues with the ImGui rendering which were also "fixable" by calling So maybe this is yet another case of a state tracker bug that should be fixed on the engine side? |
I wrote a small sample at home, I'll push it tonight. To test I used the red-square-one-liner. |
Here it is : https://github.com/Tryum/magnum-imgui-state-bug (press a key to toggle imgui rendering). I did try to first draw a square in the primary window, it seems to solve the state tracker issue, as everything was rendered fine. I didn't realise that the commit you referenced were recent, I'll try to setup a master build of magnum to try out. |
I just discovered the --head option of vcpkg trying in a few minutes ;) |
Nop problem not solved in my case with head builds. What can I do to help tracking the state inconsistency ? |
Apologies if you said this elsewhere -- what's the system and GPU you're running on? Can you paste the engine startup log here? Some ideas to try:
|
I'm running on a windows 10 PC with a 1080ti. On special thing is I'm running in a VM with GPU pass-through, but I'll dual-boot to a native win10 to clear that out. Here's the engine startup log :
I'll try your suggestions. |
Pass-through should be okay, running with GPU virtualization would be much worse, that's a bug minefield as there's a combinatorial explosion of bugs in the host system drivers, guest system drivers and the VM translation layer :) The only possibility I could see is that the VM is interferring with window swapping or something. Let me know how it behaves natively and with |
In the |
What if you disable both?
|
Then only the main window is rendered, the additional windows only have the clear color ! |
Huh. I'm trying to reproduce again, disabling one, the other or both extensions, but at least on Mesa and either Intel or AMD GPU I'm getting no issues :( Unfortunately it's been some time since I had a machine with a NVidia GPU, so I can't really try to reproduce on NV right now. I could try to reproduce this on Intel/AMD and Windows tomorrow, tho. Any chance you could try to run this on the Intel onboard GPU instead of NV (assuming your CPU is Intel)? If I'm not mistaken, all Intel chips have it, there's just a different amount of pain involved with getting apps to run on it. Or trying out on a different machine with a different GPU vendor, if at all possible. I assume you still have a single GL context and only making it current on a different window surface (like in that By the way, when other community members tried to run the above sample on a NV card, it reported just 15 FPS instead of 60 (and, on non-NV cards, it was going smooth 60 without any problems). Are you getting that as well? Also, was there any change in the behavior when you tried on the non-passed-through GPU but a native system? |
I did not tried yet on the native system, but I should be able to test on both intel and nvidia, since both are plugged to the screen for the host+gpu passthrough ;) The only problem is that I don't have develop tools on the native win10, so I'll just launch and report. I'll be able to try things on my work machine in the next days though (win10 + GTX1060). |
Default installation from vcpkg + imgui running the imgui integration sample. Renderer: Intel(R) UHD Graphics 630 by Intel
But works fine if running on second grafics card Renderer: Quadro P2000/PCIe/SSE2 by NVIDIA Corporation |
@Fleischner yes, this is unfortunately a bug in the Intel drivers on Windows ... it was vcpkg install --head corrade
vcpkg install --head magnum
vcpkg install --head magnum-integration
... |
Thanks. Problem resolved. |
@Tryum anything left to be done here? :) |
I manage to get something working by hacking around. |
Closing as it was independently confirmed this is not a problem anymore. |
It appears to be a limition of a Platform::Application. You can apparently use a single context to render multiple windows: mosra/magnum#321 (comment) Will try a much more basic native SDL apprach next.
Is it possible to use magnum to render to different contexts ?
I'm using multiple-windows, doing the all the complex rendering from the main context through render to texture. I'm wondering if I can do the quad rendering for the other windows through Magnum or if I should do direct openGL calls.
The text was updated successfully, but these errors were encountered: