-
Notifications
You must be signed in to change notification settings - Fork 136
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
Allow DirectX11 Receiver on offscreen shared OpenGL context #18
Comments
I assume that this works for DirectX 11 because CreateDX11device does not need a window handle. For DirectX 9, hwnd is used for "CreateDeviceEx. The specification says that "For windowed mode, this parameter (hFocusWindow) may be NULL only if the hDeviceWindow member of pPresentationParameters is set to a valid, non-NULL value.", so that means one way or another hwnd is needed, so I included it twice. CreateDeviceEx probably needs a check for NULL hwnd. I am surprised that the interop still works. After wglGetCurrentContext(), does wglGetCurrentDC() return NULL? |
Indeed wglGetCurrentDC return a non NULL value. So an offscreen OpenGL context have a Device Context but no windows attached on it. It seems normal because I create offscreen openGL context with this command list:
Indeed, this seems to work with DirectX11 only. If I remove the hWnd Null check from SpoutSDK.cpp , DirectX9 implementation do not seems to be happy. So if(g_hWnd == NULL && interop.m_bUseDX9) seems to be the best option. By the way, thanks a lot for your reactivity. |
In practice I find that hwnd can be NULL for CreateDeviceEx, probably because the device is never used for rendering and is is only used to create a shared texture. But the function is never intended to work in this way, so hwnd should be included I think. You will notice a comment in "OpenSpout" (which gets g_hWnd), so the test for hwnd could be included in "OpenSpout" and would then be redundant in "OpenReceiver". I will give this more thought before making any changes. Meanwhile it solves the problem for your project. |
Latest commit changed OpenSpout to fail for DX9 if no hwnd. OpenSpout precedes the tests in OpenReceiver so they are no longer needed. Please let me know if this modification works or does not work. |
Hi Lynn, Indeed your change seems to fix my issue perfectly. Regards. |
OK thanks for the quick response. It's interesting that your FirePro W2100 works OK. There has been some trouble with FirePro W7100. That seemed to require DirectX 11. It caused some corruption problem and the cause is unknown. |
I only test Spout Receiver with W2100 W9100 and 780GTX with DirectX 11 and Memory Share successfully. Because my receiver use offscreen rendering context, I cannot test DirectX9 for now. For spout Sender, Its working with W2100, W9100, 780GTX, DirectX 9, DirectX 11 and Memory Share perfectly. (All in Windows 7 SP1 64) |
Yes this information does help and adds to the knowledgebase. Windows 7 might be the key, but who knows. I will close this one for now. Good luck with your project. |
Thanks you for all of this, Best regards. |
OK sounds good. Email direct to spout@zeal.co with the logo image - png if it has transparency. Feel free to make a post on the Announcements forum. Edit : or Showcase as you wish. |
Hi,
It could be great to allow DirectX11 Spout Receiver on offscreen shared OpenGL context.
Shared OpenGL context linked with wglShareLists and activated in offscreen rendering thread do not have any related HWND:
WindowFromDC(wglGetCurrentDC()) return NULL in this case.
spoutGLDXinterop::OpenDirectX only need an HWND for DirectX9 initialization.
DirectX11 initialization do not use any HWND.
Everywhere is spout code, the potential NULL value of hWnd or g_hWnd is forwarded silently except in SpoutSDK.cpp at line 1080
To made this possible, I modify this line like this:
After this modification, everything work perfectly.
Thanks for your concern about this.
The text was updated successfully, but these errors were encountered: